/** * 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); } }
/** * Builds entity header, with breadcrumbs, links proper classes etc. * * @param unknown_type $aEntityNamesUrls * @param unknown_type $entityClass * @param unknown_type $pageType * @return OA_Admin_UI_Model_PageHeaderModel */ public function buildEntityHeader($aEntityNamesUrls, $entityClass, $pageType = "default") { $headerMeta = $this->getEntityHeaderMeta($entityClass); $oHeader = new OA_Admin_UI_Model_PageHeaderModel(); $entityCount = count($aEntityNamesUrls); if ($pageType == "edit-new" || $pageType == "list") { if ($pageType == "edit-new") { $oHeader->setTitle($headerMeta['newLabel']); if (!empty($headerMeta['newHeaderClass'])) { $oHeader->setIconClass($headerMeta['newHeaderClass']); } else { $oHeader->setIconClass($headerMeta['headerClass']); } } else { $oHeader->setTitle($headerMeta['label']); $oHeader->setIconClass($headerMeta['headerClass']); } if ($entityCount - 2 >= 0) { $oHeader->setNewTargetTitle($headerMeta['newTarget']); $oHeader->setNewTargetName($aEntityNamesUrls[$entityCount - 2]['name']); if ($pageType == "list") { $oHeader->setNewTargetLink($aEntityNamesUrls[$entityCount - 2]['url']); } } } else { $oHeader->setTitle($headerMeta['label']); $oHeader->setEntityName($aEntityNamesUrls[$entityCount - 1]['name']); $oHeader->setIconClass($headerMeta['headerClass']); } $oHeader->setPageType($pageType); $breadcrumbPath = $this->getEntityBreadcrumbPath($entityClass); // Breadcrumbs above the main title for ($i = 0; $i < $entityCount - 1; $i++) { if (empty($aEntityNamesUrls[$i]["name"])) { continue; } $headerMeta = $this->getEntityHeaderMeta($breadcrumbPath[$i]); $oSegment = new OA_Admin_UI_Model_EntityBreadcrumbSegment(); $oSegment->setEntityName($aEntityNamesUrls[$i]["name"]); $oSegment->setEntityLabel($headerMeta['label']); $oSegment->setCssClass($headerMeta['class']); $oSegment->setUrl($aEntityNamesUrls[$i]["url"]); //for list segments $oSegment->setEntityId($aEntityNamesUrls[$i]['id']); $oSegment->setHtmlName($aEntityNamesUrls[$i]['htmlName']); $oSegment->setEntityMap($aEntityNamesUrls[$i]['entities']); $oHeader->addSegment($oSegment); } return $oHeader; }
function getHeaderModel() { $builder = new OA_Admin_UI_Model_InventoryPageHeaderModelBuilder(); $oMenu = OA_Admin_Menu::singleton(); $oMenu->_setLinkParams($this->aPageParams); $oCurrentSection = $oMenu->get($this->pageId); $oHeader = new OA_Admin_UI_Model_PageHeaderModel($oCurrentSection->getName()); $oHeader->setIconClass('iconTargetingChannelsLarge'); foreach ($this->aPageBreadcrumbs as $v) { $headerMeta = $builder->getEntityHeaderMeta($v['type']); $oSegment = new OA_Admin_UI_Model_EntityBreadcrumbSegment(); $oSegment->setEntityName($v['name']); $oSegment->setEntityLabel($headerMeta['label']); $oSegment->setCssClass($headerMeta['class']); $oHeader->addSegment($oSegment); } return $oHeader; }