oDb = new BxDolStudioPageQuery(); $this->aPage = array(); $this->bPageMultiple = false; $this->sPageSelected = ''; $this->sPageRssHelpObject = 'sys_studio_page_help'; $this->sPageRssHelpUrl = 'http://feed.una.io/?section={page_name}'; $this->iPageRssHelpLength = 5; $this->aActions = array(); $this->aMarkers = array(); if(is_string($mixedPageName)) { $this->oDb->getPages(array('type' => 'by_page_name_full', 'value' => $mixedPageName), $this->aPage, false); if(empty($this->aPage) || !is_array($this->aPage)) return; $this->aPage['bookmarked'] = $this->oDb->isBookmarked($this->aPage); } else if(is_array($mixedPageName)) { $aPages = array(); $this->oDb->getPages(array('type' => 'by_page_names_full', 'value' => array_keys($mixedPageName)), $aPages, false); if(empty($aPages) || !is_array($aPages)) return; $this->bPageMultiple = true; foreach($aPages as $aPage) { if((int)$mixedPageName[$aPage['name']] == 1) $this->sPageSelected = $aPage['name']; $aPage['bookmarked'] = $this->oDb->isBookmarked($aPage); $this->aPage[$aPage['name']] = $aPage; } } if(!$this->bPageMultiple) { $this->sPageRssHelpId = $this->aPage['name']; $this->addAction(array( 'type' => 'switcher', 'name' => 'bookmark', 'caption' => '_adm_txt_pca_favorite', 'checked' => $this->aPage['bookmarked'], 'onchange' => "javascript:" . BX_DOL_STUDIO_PAGE_JS_OBJECT . ".bookmark('" . $this->aPage['name'] . "', this)" )); $this->aMarkers['page_name'] = $this->aPage['name']; } } public function getRssHelpUrl() { return bx_replace_markers($this->sPageRssHelpUrl, $this->aMarkers); } public function addAction($aAction, $bOnRight = true) { if($bOnRight) $this->aActions[] = $aAction; else $this->aActions = array_merge(array($aAction), $this->aActions); } /** * Add replace markers. * @param $a array of markers as key => value * @return true on success or false on error */ public function addMarkers ($a) { if(empty($a) || !is_array($a)) return false; $this->aMarkers = array_merge($this->aMarkers, $a); return true; } public function removeActions() { $this->aActions = array(); } public function bookmark() { $bResult = $this->oDb->bookmark($this->aPage); if(!$bResult) return array('code' => 1, 'message' => _t('_adm_err_operation_failed')); $oTemplate = BxDolStudioTemplate::getInstance(); return array('code' => 0, 'message' => _t('_adm_scs_operation_done')); } protected function getSystemName($sValue) { return BxDolStudioUtils::getSystemName($sValue); } protected function getClassName($sValue) { return BxDolStudioUtils::getClassName($sValue); } protected function getModuleTitle($sName) { return BxDolStudioUtils::getModuleTitle($sName); } protected function getModuleIcon($sName, $sType = 'menu', $bReturnAsUrl = true) { return BxDolStudioUtils::getModuleIcon($sName, $sType, $bReturnAsUrl); } protected function getModules($bShowCustom = true, $bShowSystem = true) { return BxDolStudioUtils::getModules($bShowCustom, $bShowSystem); } protected function updateHistory() { if(empty($this->aPage['wid_id'])) return; $sHistorySessionKey = BxTemplStudioMenuTop::$sHistorySessionKey; $iHistoryLength = BxTemplStudioMenuTop::$iHistoryLength; $oSession = BxDolSession::getInstance(); $aHistory = $oSession->getValue($sHistorySessionKey); if(!empty($aHistory) && isset($aHistory[$this->aPage['name']])) unset($aHistory[$this->aPage['name']]); $aHistory[$this->aPage['name']] = array( 'name' => $this->aPage['name'], 'icon' => $this->aPage['wid_icon'], 'link' => $this->aPage['wid_url'], 'onclick' => $this->aPage['wid_click'], 'title' => $this->aPage['wid_caption'] ); if(count($aHistory) > $iHistoryLength) $aHistory = array_slice($aHistory, -$iHistoryLength); $oSession->setValue($sHistorySessionKey, $aHistory); } } /** @} */