1
0
AntonLV 5 жил өмнө
parent
commit
9b6f8202eb

+ 8 - 4
inc/classes/BxDolCmtsGridAdministration.php

@@ -11,15 +11,19 @@ define('BX_DOL_MANAGE_TOOLS_ADMINISTRATION', 'administration');
 
 class BxDolCmtsGridAdministration extends BxTemplGrid
 {
+    protected $_oCmts;
+
     protected $_sManageType;
     protected $_sParamsDivider;
 
     protected $_sFilter1Name;
     protected $_sFilter1Value;
     protected $_aFilter1Values;
-    
+
     public function __construct ($aOptions, $oTemplate = false)
     {
+        $this->_oCmts = null;
+
         $this->_sFilter1Name = 'filter1';
         $this->_aFilter1Values = ['' => _t('_adm_txt_select_module')];
 
@@ -61,11 +65,11 @@ class BxDolCmtsGridAdministration extends BxTemplGrid
         if(!$oModule)
             return '';
 
-        $oCmts = BxDolCmts::getObjectInstance($oModule->_oConfig->CNF['OBJECT_COMMENTS'], 0, false);
-        if(!$oCmts || !$oCmts->isEnabled())
+        $this->_oCmts = BxDolCmts::getObjectInstance($oModule->_oConfig->CNF['OBJECT_COMMENTS'], 0, false);
+        if(!$this->_oCmts || !$this->_oCmts->isEnabled())
             return '';
 
-        $this->_aOptions['source'] = $oModule->_oDb->prepareAsString("SELECT `sys_cmts_ids`.`id`, `sys_cmts_ids`.`cmt_id`, `sys_cmts_ids`.`reports`, `cmts`.*, `sys_accounts`.`email` FROM `sys_cmts_ids` INNER JOIN " . $oCmts->getCommentsTableName() . " AS `cmts` ON `cmts`.`cmt_id`=`sys_cmts_ids`.`cmt_id` INNER JOIN `sys_profiles` ON `cmts`.`cmt_author_id`=`sys_profiles`.`id` INNER JOIN `sys_accounts` ON `sys_profiles`.`account_id`=`sys_accounts`.`id` WHERE `sys_cmts_ids`.`system_id`=?", $oCmts->getSystemId());
+        $this->_aOptions['source'] = $oModule->_oDb->prepareAsString("SELECT `sys_cmts_ids`.`id`, `sys_cmts_ids`.`cmt_id`, `sys_cmts_ids`.`reports`, `cmts`.*, `sys_accounts`.`email` FROM `sys_cmts_ids` INNER JOIN " . $this->_oCmts->getCommentsTableName() . " AS `cmts` ON `cmts`.`cmt_id`=`sys_cmts_ids`.`cmt_id` INNER JOIN `sys_profiles` ON `cmts`.`cmt_author_id`=`sys_profiles`.`id` INNER JOIN `sys_accounts` ON `sys_profiles`.`account_id`=`sys_accounts`.`id` WHERE `sys_cmts_ids`.`system_id`=?", $this->_oCmts->getSystemId());
 
         return parent::_getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
     }

+ 9 - 2
template/scripts/BxBaseCmtsGridAdministration.php

@@ -113,8 +113,15 @@ class BxBaseCmtsGridAdministration extends BxDolCmtsGridAdministration
     
     protected function _getCellCmtText($mixedValue, $sKey, $aField, $aRow)
     {
-        $sTmp = strip_tags($aRow['cmt_text']);
-        return parent::_getCellDefault($sTmp, $sKey, $aField, $aRow);
+        $mixedValue = strmaxtextlen($aRow['cmt_text']);
+
+        if($this->_oCmts && $this->_oCmts->isEnabled()) {
+            $this->_oCmts->setId($aRow['cmt_object_id']);
+
+            $mixedValue = $this->_oTemplate->parseLink($this->_oCmts->getViewUrl($aRow['cmt_id']), $mixedValue, ['target' => '_blank']);
+        }
+
+        return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
     }
     
     protected function _getCellCmtAuthorId($mixedValue, $sKey, $aField, $aRow)