예제 #1
0
파일: Webmenu.php 프로젝트: kokkez/shineisp
 /** 
  * Create a CMS menu
  * @param unknown_type $parent
  * @param unknown_type $locale
  * @return string
  */
 private function createMenu($parent)
 {
     $locale = $this->translator->getAdapter()->getLocale();
     $children = CmsPages::getParent($parent, $locale);
     $items = array();
     if (is_array($children)) {
         foreach ($children as $row) {
             $link = !empty($row['link']) ? $row['link'] : "/cms/" . $row['var'] . ".html";
             $items[] = "<li class=\"dropdown\"><a href=\"" . $link . "\">" . $row['title'] . "</a>" . $this->createMenu($row['page_id']) . "</li>";
         }
     }
     if (count($items)) {
         return "<ul class=\"dropdown-menu\">" . implode('', $items) . "</ul>";
     } else {
         return '';
     }
 }
예제 #2
0
 private function CreateSubHeader($page)
 {
     $data = array();
     $translation = Shineisp_Registry::getInstance()->Zend_Translate;
     $locale = $translation->getAdapter()->getLocale();
     if (strlen($locale) == 2) {
         $locale = $locale . "_" . strtoupper($locale);
     }
     if (is_array($page)) {
         $pages = CmsPages::getParent($page['page_id'], $locale);
         // Set the title of the subheader
         $data['title'] = $page['title'];
         // Set the menu of the subheader
         if (count($pages) > 0) {
             foreach ($pages as $item) {
                 $link = !empty($item['link']) ? $item['link'] : $item['var'];
                 $data['subitems'][] = array('link' => $link, 'label' => $item['title']);
             }
         }
     }
     return $data;
 }