Exemplo n.º 1
0
 public static function CreateLinkMenu($module = null)
 {
     $cm = utopia::GetCurrentModule();
     if ($module === null) {
         $module = $cm;
     }
     if (isset(self::$done[$module])) {
         return;
     }
     self::$done[$module] = true;
     $cmAdmin = is_subclass_of($cm, 'iAdminModule');
     $modules = utopia::GetChildren($module);
     $highestpos = 0;
     foreach ($modules as $mid => $children) {
         if ($cmAdmin && !is_subclass_of($mid, 'iAdminModule')) {
             continue;
         }
         if (!$cmAdmin && is_subclass_of($mid, 'iAdminModule')) {
             continue;
         }
         foreach ($children as $child) {
             if (isset($child['callback'])) {
                 continue;
             }
             if (isset($child['fieldLinks']) && $mid !== $cm) {
                 continue;
             }
             if (uEvents::TriggerEvent('CanAccessModule', $mid) === FALSE) {
                 continue;
             }
             if ($module !== $cm && $child['parent'] === '/') {
                 continue;
             }
             $parent = '_modlinks_';
             if (isset($child['parent']) && $child['parent'] !== '/') {
                 $parent .= $child['parent'];
             }
             $obj = utopia::GetInstance($mid);
             $position = $obj->GetSortOrder();
             if (isset($child['fieldLinks']) && $mid === $cm) {
                 $position = 0;
             }
             if ($position > $highestpos) {
                 $highestpos = $position;
             }
             uMenu::AddItem($parent . $mid, $obj->GetTitle(), $obj->GetURL(), $parent, null, $position);
         }
         self::CreateLinkMenu($mid);
     }
     if ($module === $cm) {
         // add separators
         $i = -10001;
         while ($i < $highestpos) {
             uMenu::AddItem('_sep_' . $i, '', '', '_modlinks_', null, $i);
             $i = $i + 1000;
         }
     }
 }
Exemplo n.º 2
0
 static function InitSitemap()
 {
     $o = utopia::GetInstance(__CLASS__);
     $rows = self::fetchAll();
     foreach ($rows as $row) {
         if ($row['noindex']) {
             continue;
         }
         // is published
         if ($row['content_time'] == '0000-00-00 00:00:00' && !$row['is_published']) {
             continue;
         }
         if (!$row['is_published']) {
             continue;
         }
         $title = $row['nav_text'] ? $row['nav_text'] : $row['title'];
         $url = $o->GetURL($row['cms_id']);
         // add to menu
         if (!$row['hide']) {
             uMenu::AddItem($row['cms_id'], $title, $url, $row['parent'], array('class' => strtolower($row['cms_id'])), $row['position']);
         }
         // add to sitemap
         $additional = array();
         if ($row['is_home']) {
             $additional['priority'] = 1;
         }
         uSitemap::AddItem('http://' . utopia::GetDomainName() . $url, $additional);
     }
 }