Example #1
0
 static function GetTrail($start = null)
 {
     $obj = utopia::GetInstance('uCMS_List');
     $arr = $obj->GetNestedArray();
     $out = array();
     //TODO: add (Search Results) to end of title if current page is filtered.
     $out[$_SERVER['REQUEST_URI']] = '{utopia.title}';
     // '<a href="'.$_SERVER['REQUEST_URI'].'">{utopia.title}</a>';
     foreach (self::$extras as $a) {
         $out[$a[1]] = $a[0];
         //'<a href="'.$a[1].'">'.$a[0].'</a>';
     }
     $obj = utopia::GetInstance('uCMS_View');
     $row = uCMS_View::findPage();
     do {
         if (!$row) {
             break;
         }
         $url = $obj->GetURL($row['cms_id']);
         $title = $row['nav_text'] ? $row['nav_text'] : $row['title'];
         $out[$url] = $title;
     } while ($row['parent'] && ($row = uCMS_List::findKey($arr, $row['parent'])));
     $build = array();
     foreach ($out as $k => $v) {
         $build[] = '<a href="' . $k . '">' . $v . '</a>';
     }
     $build = array_unique($build);
     if ($start) {
         $build[] = $start;
     }
     if (count($build) < 1) {
         return '';
     }
     return implode(' &gt; ', array_reverse($build));
 }
Example #2
0
 static function GetChildren($parent)
 {
     $specific = isset(self::$children[$parent]) ? self::$children[$parent] : array();
     $currentModule = $parent == utopia::GetCurrentModule() && isset(self::$children['/']) ? self::$children['/'] : array();
     $catchAll = isset(self::$children['*']) ? self::$children['*'] : array();
     $baseModule = array();
     switch ($parent) {
         case 'uCMS_View':
             $currentPage = uCMS_View::findPage();
             if ($currentPage['is_home'] && isset(self::$children[''])) {
                 $baseModule = self::$children[''];
             }
             break;
         case 'uDashboard':
             if (isset(self::$children[''])) {
                 $baseModule = self::$children[''];
             }
     }
     $arr = array_merge($catchAll, $baseModule, $currentModule, $specific);
     return $arr;
 }
Example #3
0
 static function findPage()
 {
     if (self::$currentPage) {
         return self::$currentPage;
     }
     $uri = $_SERVER['REQUEST_URI'];
     $uri = preg_replace('/(\\?.*)?/', '', $uri);
     if ($uri === PATH_REL_ROOT) {
         return self::GetHomepage();
     }
     if (strpos($uri, PATH_REL_CORE . 'index.php') === 0) {
         return FALSE;
     }
     $obj = utopia::GetInstance('uCMS_View');
     $cm = utopia::GetCurrentModule();
     if ($cm && $cm !== __CLASS__) {
         $o = utopia::GetInstance(utopia::GetCurrentModule());
         $uuid = $o->GetUUID();
         $uuid = explode('/', $uuid);
         $uuid = end($uuid);
         $row = $obj->LookupRecord($uuid);
         if ($row) {
             self::$currentPage = $row;
             return $row;
         }
         return false;
     }
     preg_match('/([^\\/]+)(\\/)?(\\.php)?$/Ui', $uri, $matches);
     if (array_key_exists(1, $matches)) {
         $row = $obj->LookupRecord($matches[1]);
         if ($row) {
             self::$currentPage = $row;
             return $row;
         }
     }
     return false;
 }