/** * RegisterUiHooks plugin hook */ public function registerUiListeners() { $oViewListener = $this->getViewListener(); OX_Admin_UI_Hooks::registerBeforePageHeaderListener(array($oViewListener, 'beforePageHeader')); OX_Admin_UI_Hooks::registerBeforePageContentListener(array($oViewListener, 'beforeContent')); OX_Admin_UI_Hooks::registerAfterPageContentListener(array($oViewListener, 'afterContent')); }
private static function init() { if (self::$initialized) { return; } //register UI listeners from plugins $aPlugins = OX_Component::getListOfRegisteredComponentsForHook('registerUiListeners'); foreach ($aPlugins as $i => $id) { if ($obj = OX_Component::factoryByComponentIdentifier($id)) { if (is_callable(array($obj, 'registerUiListeners'))) { $obj->registerUiListeners(); } } } self::$initialized = true; }
/** * Show page header * * @param int $ID * @param OA_Admin_UI_Model_PageHeaderModel $headerModel * @param int $imgPath deprecated * @param bool $showSidebar Set to false if you do not wish to show the sidebar navigation * @param bool $showContentFrame Set to false if you do not wish to show the content frame * @param bool $showMainNavigation Set to false if you do not wish to show the main navigation */ function showHeader($ID = null, $oHeaderModel = null, $imgPath = "", $showSidebar = true, $showContentFrame = true, $showMainNavigation = true) { global $conf, $phpAds_CharSet, $phpAds_breadcrumbs_extra; $conf = $GLOBALS['_MAX']['CONF']; $ID = $this->getId($ID); $this->setCurrentId($ID); if (!defined('phpAds_installing')) { OX_Admin_UI_Hooks::beforePageHeader($ID, $this->getLinkParams(), $oHeaderModel); } $pageTitle = !empty($conf['ui']['applicationName']) ? $conf['ui']['applicationName'] : MAX_PRODUCT_NAME; $aMainNav = array(); $aLeftMenuNav = array(); $aLeftMenuSubNav = array(); $aSectionNav = array(); if ($ID !== phpAds_Login && $ID !== phpAds_Error && $ID !== phpAds_PasswordRecovery) { //get system navigation $oMenu = OA_Admin_Menu::singleton(); //update page title $oCurrentSection = $oMenu->get($ID); $this->redirectSectionToCorrectUrlIfOldUrlDetected($oCurrentSection); if ($oCurrentSection == null) { phpAds_Die($GLOBALS['strErrorOccurred'], 'Menu system error: <strong>' . OA_Permission::getAccountType(true) . '::' . htmlspecialchars($ID) . '</strong> not found for the current user: you might not have sufficient permission to view this page. <br/>If the problem persists, you can also try to delete the files inside your /path/to/openx/var/cache/ directory.'); } if ($oHeaderModel == null) { //build default model with title and name taken from nav entry $oHeaderModel = new OA_Admin_UI_Model_PageHeaderModel($oCurrentSection->getName()); } if ($oHeaderModel->getTitle()) { $pageTitle .= ' - ' . $oHeaderModel->getTitle(); } else { $pageTitle .= ' - ' . $oCurrentSection->getName(); } // compile navigation arrays $this->_compileMainNavigationTabBar($oCurrentSection, $oMenu, $aMainNav); $this->_compileLeftMenuNavigation($oCurrentSection, $oMenu, $aLeftMenuNav); $this->_compileLeftSubMenuNavigation($oCurrentSection, $oMenu, $aLeftMenuSubNav); $this->_compileSectionTabBar($oCurrentSection, $oMenu, $aSectionNav); } else { // Build tabbed navigation bar if ($ID == phpAds_Login) { $aMainNav[] = array('title' => $GLOBALS['strAuthentification'], 'filename' => 'index.php', 'selected' => true); } elseif ($ID == phpAds_Error) { $aMainNav[] = array('title' => $GLOBALS['strErrorOccurred'], 'filename' => 'index.php', 'selected' => true); } elseif ($ID == phpAds_PasswordRecovery) { $aMainNav[] = array('title' => $GLOBALS['strPasswordRecovery'], 'filename' => 'index.php', 'selected' => true); } $showContentFrame = false; } //html header $this->_assignLayout($pageTitle); $this->_assignJavascriptandCSS(); //layout stuff $this->oTpl->assign('uiPart', 'header'); $this->oTpl->assign('showContentFrame', $showContentFrame); $this->oTpl->assign('showSidebar', $showSidebar); $this->oTpl->assign('showMainNavigation', $showMainNavigation); //top $this->_assignBranding($conf['ui']); $this->_assignSearch($ID); $this->_assignUserAccountInfo($oCurrentSection); $this->oTpl->assign('headerModel', $oHeaderModel); $this->oTpl->assign('hideNavigator', $conf['ui']['hideNavigator']); // Tabbed navigation bar and sidebar $this->oTpl->assign('aMainTabNav', $aMainNav); $this->oTpl->assign('aLeftMenuNav', $aLeftMenuNav); $this->oTpl->assign('aLeftMenuSubNav', $aLeftMenuSubNav); $this->oTpl->assign('aSectionNav', $aSectionNav); // This is used to show banner preview $this->oTpl->assign('breadcrumbsExtra', $phpAds_breadcrumbs_extra); //tools and shortcuts $this->oTpl->assign('aTools', $this->aTools); $this->oTpl->assign('aShortcuts', $this->aShortcuts); //additional things $this->_assignJavascriptDefaults(); //JS validation messages and other defaults $this->_assignAlertMPE(); //mpe xajax $this->_assignInstalling(); //install indicator $this->_assignMessagesAndNotifications(); //messaging system //html header $this->_assignJavascriptandCSS(); /* DISPLAY */ // Use gzip content compression if (isset($conf['ui']['gzipCompression']) && $conf['ui']['gzipCompression']) { //enable compression if it's not alredy handled by the zlib and ob_gzhandler is loaded $zlibCompression = ini_get('zlib.output_compression'); if (!$zlibCompression && function_exists('ob_gzhandler')) { // enable compression only if it wasn't enabled previously (e.g by widget) //also, we cannot enable gzip if session was started $session_id = session_id(); //check if there's any session if (ob_get_contents() === false && empty($session_id)) { ob_start("ob_gzhandler"); } } } // Send header with charset info and display header("Content-Type: text/html" . (isset($phpAds_CharSet) && $phpAds_CharSet != "" ? "; charset=" . $phpAds_CharSet : "")); $this->oTpl->display(); if (!defined('phpAds_installing')) { OX_Admin_UI_Hooks::afterPageHeader($id); } }
public function afterContent($aParams, &$oTpl) { return OX_Admin_UI_Hooks::afterPageContent($this->pageId, $this->pageData, $oTpl); }