00001 <?php
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 require_once dirname(__FILE__) . '/StaticList.php';
00026
00027
00028
00029
00043
00044 class FF_Menu_QuickLinks extends FF_Menu_StaticList {
00045
00046
00051 var $ulId = 'quickLink';
00052
00057 var $tmplVar = 'page_links';
00058
00059
00060
00061
00068 function renderMenu()
00069 {
00070 if (!file_exists($this->o_registry->getAppFile($this->_getMenuFilename($this->o_registry->getCurrentApp()), null, 'config'))) {
00071 return;
00072 }
00073
00074 parent::renderMenu();
00075 }
00076
00077
00078
00079
00086 function _generateStaticMenu()
00087 {
00088 $s_html = parent::_generateStaticMenu();
00089 $s_html = preg_replace('/(<\/li>.+?<li)/s', ' || \\1', $s_html);
00090 return $s_html;
00091 }
00092
00093
00094
00095
00103 function _isMenuCached()
00104 {
00105 list($s_subdir, $s_name) = explode('/', $this->cacheFile);
00106 if (!file_exists(($pth_file = $this->o_fileCache->getPath(array('subdir' => $s_subdir, 'name' => $s_name))))) {
00107 return false;
00108 }
00109 else {
00110 $s_cacheMTime = filemtime($pth_file);
00111 }
00112
00113 $pth_menu = $this->o_registry->getAppFile($this->_getMenuFilename($this->o_registry->getCurrentApp()), null, 'config');
00114 if (file_exists($pth_menu) && (filemtime($pth_menu) > $s_cacheMTime)) {
00115 return false;
00116 }
00117
00118 return true;
00119 }
00120
00121
00122
00123
00130 function _setCacheFile()
00131 {
00132
00133 if ($this->o_registry->getAppParam('profile', false)) {
00134 $s_menuFile = sprintf('%s.%s.%s.php', $this->menuType, $this->o_registry->getCurrentApp(),
00135 $this->o_registry->getAppParam('profile'));
00136 }
00137 else {
00138 $s_menuFile = sprintf('%s.%s.php', $this->menuType, $this->o_registry->getCurrentApp());
00139 }
00140
00141 $this->cacheFile = "menu/$s_menuFile";
00142 }
00143
00144
00145
00146
00154 function _importMenuVars()
00155 {
00156 $this->menuVariables = array();
00157
00158 $pth_actions = $this->o_registry->getAppFile('ActionHandler/actions.php', null, 'libs');
00159 if (file_exists($pth_actions)) {
00160 require_once $pth_actions;
00161 }
00162
00163 $pth_menu = $this->o_registry->getAppFile($this->_getMenuFilename($this->o_registry->getCurrentApp()), null, 'config');
00164 if (file_exists($pth_menu)) {
00165 $a_appMenu = null;
00166 require $pth_menu;
00167 if (is_array($a_appMenu) && isset($a_appMenu[0])) {
00168 $this->menuVariables[] = array(
00169 'app' => $this->o_registry->getCurrentApp(),
00170 'vars' => $a_appMenu,
00171 );
00172 }
00173 else {
00174 return trigger_error('The menu file ' . basename($pth_menu) . ' for the ' . $this->o_registry->getCurrentApp() . ' application is not configured correctly.', E_USER_WARNING);
00175 }
00176 }
00177 }
00178
00179
00180
00181
00191 function _getMenuFilename($in_app)
00192 {
00193
00194 if ($this->o_registry->getAppParam('profile', false, $in_app)) {
00195 return sprintf('%s/quicklinks.php',
00196 $this->o_registry->getAppParam('profile', null, $in_app));
00197 }
00198 else {
00199 return 'quicklinks.php';
00200 }
00201 }
00202
00203
00204 }
00205 ?>