_oConfig->CNF; if(empty($sTranscoder) && !empty($CNF['OBJECT_IMAGES_TRANSCODER_GALLERY'])) $sTranscoder = $CNF['OBJECT_IMAGES_TRANSCODER_GALLERY']; $mixedResult = $this->_getFieldValueThumb('FIELD_THUMB', $iContentId, $sTranscoder); return $mixedResult !== false ? $mixedResult : ''; } public function serviceGetMenuAddonManageTools() { bx_import('SearchResult', $this->_aModule); $sClass = $this->_aModule['class_prefix'] . 'SearchResult'; $o = new $sClass(); $o->fillFilters(array( 'status' => 'hidden' )); $o->unsetPaginate(); return $o->getNum(); } public function serviceGetMenuAddonManageToolsProfileStats() { bx_import('SearchResult', $this->_aModule); $sClass = $this->_aModule['class_prefix'] . 'SearchResult'; $o = new $sClass(); $o->fillFilters(array( 'author' => bx_get_logged_profile_id() )); $o->unsetPaginate(); return $o->getNum(); } /** * Display public entries * @return HTML string */ public function serviceBrowsePublic ($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true) { return $this->_serviceBrowse ('public', $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate); } /** * Display popular entries * @return HTML string */ public function serviceBrowsePopular ($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true) { return $this->_serviceBrowse ('popular', $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate); } /** * Display recently updated entries * @return HTML string */ public function serviceBrowseUpdated ($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true) { return $this->_serviceBrowse ('updated', $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate); } /** * Display entries of the author * @return HTML string */ public function serviceBrowseAuthor ($iProfileId = 0, $aParams = array()) { return $this->_serviceBrowseWithParam ('author', 'profile_id', $iProfileId, $aParams); } /** * Display entries posted into particular context * @return HTML string */ public function serviceBrowseContext ($iProfileId = 0, $aParams = array()) { return $this->_serviceBrowseWithParam ('context', 'profile_id', $iProfileId, $aParams); } public function _serviceBrowseWithParam ($sParamName, $sParamGet, $sParamVal, $aParams = array()) { if (!$sParamVal) $sParamVal = bx_process_input(bx_get($sParamGet), BX_DATA_INT); if (!$sParamVal) return ''; $bEmptyMessage = true; if(isset($aParams['empty_message'])) { $bEmptyMessage = (bool)$aParams['empty_message']; unset($aParams['empty_message']); } return $this->_serviceBrowse ($sParamName, array_merge(array($sParamName => $sParamVal), $aParams), BX_DB_PADDING_DEF, $bEmptyMessage); } /** * Entry author block */ public function serviceEntityAuthor ($iContentId = 0) { return $this->_serviceTemplateFunc ('entryAuthor', $iContentId); } /** * Entry context block */ public function serviceEntityContext ($iContentId = 0) { return $this->_serviceTemplateFunc ('entryContext', $iContentId); } public function serviceEntityBreadcrumb ($iContentId = 0) { if (!$iContentId) $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT); if (!$iContentId) return false; $aContentInfo = $this->_oDb->getContentInfoById($iContentId); if (!$aContentInfo) return false; return $this->_oTemplate->entryBreadcrumb($aContentInfo); } /** * Delete all content by profile * @param $iProfileId profile id * @return number of deleted items */ public function serviceDeleteEntitiesByAuthor ($iProfileId) { $a = $this->_oDb->getEntriesByAuthor((int)$iProfileId); if (!$a) return 0; $iCount = 0; foreach ($a as $aContentInfo) $iCount += ('' == $this->serviceDeleteEntity($aContentInfo[$this->_oConfig->CNF['FIELD_ID']]) ? 1 : 0); return $iCount; } // ====== PERMISSION METHODS /** * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden. So make sure to make strict(===) checking. */ public function checkAllowedSetThumb ($iContentId = 0) { // check ACL $aCheck = checkActionModule($this->_iProfileId, 'set thumb', $this->getName(), false); if ($aCheck[CHECK_ACTION_RESULT] !== CHECK_ACTION_RESULT_ALLOWED) return $aCheck[CHECK_ACTION_MESSAGE]; return CHECK_ACTION_RESULT_ALLOWED; } // ====== PROTECTED METHODS protected function _buildRssParams($sMode, $aArgs) { $aParams = array (); $sMode = bx_process_input($sMode); switch ($sMode) { case 'author': $aParams = array('author' => isset($aArgs[0]) ? (int)$aArgs[0] : ''); break; } return $aParams; } } /** @} */