/**
  * 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;
 }
Пример #2
0
 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;
 }