QuickLinks.php

Go to the documentation of this file.
00001 <?php
00003 // {{{ license
00004 
00005 // +----------------------------------------------------------------------+
00006 // | FastFrame Application Framework                                      |
00007 // +----------------------------------------------------------------------+
00008 // | Copyright (c) 2002-2006 The Codejanitor Group                        |
00009 // +----------------------------------------------------------------------+
00010 // | This source file is subject to the GNU Lesser Public License (LGPL), |
00011 // | that is bundled with this package in the file LICENSE, and is        |
00012 // | available at through the world-wide-web at                           |
00013 // | http://www.fsf.org/copyleft/lesser.html                              |
00014 // | If you did not receive a copy of the LGPL and are unable to          |
00015 // | obtain it through the world-wide-web, you can get it by writing the  |
00016 // | Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
00017 // | MA 02111-1307, USA.                                                  |
00018 // +----------------------------------------------------------------------+
00019 // | Authors: Jason Rust <jrust@codejanitor.com>                          |
00020 // +----------------------------------------------------------------------+
00021 
00022 // }}}
00023 // {{{ requires 
00024 
00025 require_once dirname(__FILE__) . '/StaticList.php';
00026 
00027 // }}}
00028 // {{{ class FF_Menu_QuickLinks
00029 
00043 // }}}
00044 class FF_Menu_QuickLinks extends FF_Menu_StaticList {
00045     // {{{ properties
00046 
00051     var $ulId = 'quickLink';
00052 
00057     var $tmplVar = 'page_links';
00058 
00059     // }}}
00060     // {{{ renderMenu()
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     // {{{ _generateStaticMenu()
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     // {{{ _isMenuCached()
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     // {{{ _setCacheFile()
00123 
00130     function _setCacheFile()
00131     {
00132         // Get the profile specific application menu
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     // {{{ _importMenuVars()
00146 
00154     function _importMenuVars()
00155     {
00156         $this->menuVariables = array();
00157         // Include any additional action IDs this app has
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     // {{{ _getMenuFilename()
00181 
00191     function _getMenuFilename($in_app)
00192     {
00193         // Get the profile specific application menu
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 ?>

Generated on Fri Jun 23 11:38:17 2006 for FastFrame by  doxygen 1.4.4