function serviceGetWallPostComment($aEvent) { $iId = (int) $aEvent['object_id']; $iOwner = (int) $aEvent['owner_id']; $sOwner = getNickName($iOwner); $aItem = $this->_oDb->getSiteById($iId); if (empty($aItem) || !is_array($aItem)) { return array('perform_delete' => true); } if (!$this->oPrivacy->check('view', $iId, $this->iOwnerId)) { return; } $aContent = unserialize($aEvent['content']); if (empty($aContent) || !isset($aContent['comment_id'])) { return ''; } bx_import('Cmts', $this->_aModule); $oCmts = new BxSitesCmts('bx_sites', $iId); if (!$oCmts->isEnabled()) { return ''; } $aComment = $oCmts->getCommentRow((int) $aContent['comment_id']); $sImage = ''; if ($aItem['photo']) { $a = array('ID' => $aItem['id'], 'Avatar' => $aItem['photo']); $aImage = BxDolService::call('photos', 'get_image', array($a, 'browse'), 'Search'); $sImage = $aImage['no_image'] ? '' : $aImage['file']; } $sCss = ''; $sBaseUrl = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/'; if ($aEvent['js_mode']) { $sCss = $this->_oTemplate->addCss(array('wall_post.css', 'main.css', 'twig.css'), true); } else { $this->_oTemplate->addCss(array('wall_post.css', 'main.css', 'twig.css')); } bx_import('BxTemplVotingView'); $oVoting = new BxTemplVotingView('bx_sites', 0, 0); $sTextAddedNew = _t('_bx_sites_wall_added_new_comment'); $sTextWallObject = _t('_bx_sites_wall_object'); $aTmplVars = array('cpt_user_name' => $sOwner, 'cpt_added_new' => $sTextAddedNew, 'cpt_object' => $sTextWallObject, 'cpt_item_url' => $sBaseUrl . $aItem['entryUri'], 'cnt_comment_text' => $aComment['cmt_text'], 'unit' => $this->_oTemplate->unit($aItem, 'unit_wall', $oVoting), 'post_id' => $aEvent['id']); return array('title' => $sOwner . ' ' . $sTextAddedNew . ' ' . $sTextWallObject, 'description' => $aComment['cmt_text'], 'content' => $sCss . $this->_oTemplate->parseHtmlByName('wall_post_comment.html', $aTmplVars)); }
function getBlockCode_ViewComments() { if ($this->_oConfig->isCommentsAllowed() && $this->_oSites->oPrivacy->check('comments', $this->_aSite['id'], $this->_oSites->iOwnerId)) { $o = new BxSitesCmts('bx_sites', $this->_aSite['id']); if ($o->isEnabled()) { return $o->getCommentsFirst(); } } return ''; }