public function getBreadCrumb() { if (self::$m_BreadCrumb != null) { return self::$m_BreadCrumb; } self::$m_BreadCrumb = array(); $uri = $_SERVER['REQUEST_URI']; if (empty($uri)) { return array(); } $matchUri = $this->_getMatchUri($uri); $uri = str_replace(APP_INDEX, '', $uri); $pathArray = array(); //global $g_BizSystem; //$currentView = $g_BizSystem->getCurrentViewName(); //$this->fetchNodePath("[link]='$uri' OR [view]='$currentView'", $pathArray); // first find the exact uri match $this->fetchNodePath("[link]='{$uri}'", $pathArray); if (count($pathArray) > 0) { self::$m_BreadCrumb = $pathArray; return $pathArray; } // then find partial match uri $this->fetchNodePath("[link] LIKE '%{$matchUri}%'", $pathArray); self::$m_BreadCrumb = $pathArray; return $pathArray; }
protected function loadFullMenuTree() { if (self::$fullMenuTree != null) { return; } $cache_id = 'FULL_MENU_LIST'; $cacheSvc = Openbiz::getService(CACHE_SERVICE, 1); $cacheSvc->init($this->objectName, 600); // cache for 10 mins if ($cacheSvc->test($cache_id)) { self::$fullMenuTree = $cacheSvc->load($cache_id); return; } $rs = parent::directFetch(); foreach ($rs as $record) { if (empty($record['PId'])) { $record['PId'] = "__root__"; } unset($record['create_by']); unset($record['create_time']); unset($record['update_by']); unset($record['update_time']); unset($record['name']); unset($record['parent']); self::$fullMenuTree[$record['Id']] = $record; } foreach (self::$fullMenuTree as $mId => $record) { self::$fullMenuTree[$record['PId']]['children'][] = $mId; } //print_r(self::$fullMenuTree); $cacheSvc->save(self::$fullMenuTree, $cache_id); // put it in apc or file cache }