* @copyright: Copyright (c) 2010, Bunzia Alexander * @version: 1.0 * @license: http://www.gnu.org/copyleft/gpl.html GNU/GPL * @package: HiLo CMS */ /** * Автоматически генерирует административное меню на основе данных * предоставляемых установленными модулями * * @var: array $options * @return: str */ function system_menu($options){ global $MAIN_USER; if ( empty($MAIN_USER) /*|| $MAIN_USER -> is_admin()===false*/ ){ sys_error(ERROR_500); } $result = array(); include_once(MAIN_SOURCE_PATH.'/modules/admin/inc/class.modules.php'); $m = new modulesQuery('m'); $m -> where_active(1); $m -> orderby_pos('ASC'); $m -> get('m_path'); while( list($path) = $m -> row() ) { if ( !file_exists(MAIN_SOURCE_PATH.'/modules/'.$path.'/inc/system.php') ){ continue; } include_once(MAIN_SOURCE_PATH.'/modules/'.$path.'/inc/system.php'); $f = $path.'_menu'; if ( !function_exists($f) ){ continue; } $r = $f(); if ( !is_array($r) ){ continue; } $row = $r[0]; unset($r[0]); $result[] = array('title'=>$row['title'],'url'=>$row['url'],'sub'=> $r); } $t = new PHPTAL( false ); $t -> setSnippet('admin','system_menu'); $t -> menu = $result; return $t -> execute(); } define('TMPL_ADMIN_MENU', '
'); ?>