예제 #1
0
    function render()
    {
        //得到属性的值
        $name = $this->_extract('name');
        $catch_id = 'Dy_menu' . $name;
        //读取缓存
        $rowSet = Q::cache($catch_id);
        //读取失败
        if (!$rowSet) {
            $rowSet = Sysmenu::find()->order('parent_id ASC, order_pos ASC')->asArray()->getAll();
            //写缓存
            Q::writeCache($catch_id, $rowSet);
        }
        /**
         * 验证不能访问的菜单
         */
        $app = MyApp::instance();
        foreach ($rowSet as $offset => $row) {
            if ($row['controller'] == '') {
                continue;
            }
            $udi = "{$row['controller']}/{$row['action']}";
            //权限判断
            if (!$app->authorizedUDI($app->currentUserRoles(), $udi)) {
                //删除没有权限访问的菜单
                unset($rowSet[$offset]);
            } else {
                $args = array();
                parse_str($row['args'], $args);
                $rowSet[$offset]['url'] = url($udi, $args);
            }
        }
        //数组转换成树
        $menu = Helper_Array::toTree($rowSet, 'menu_id', 'parent_id', 'submenu');
        //	 $mainMenu = & new Helper_Menu($menu) ;
        $mainMenu = new Helper_Menu($menu);
        $output = "var {$name} = ";
        $output .= $mainMenu->returnJsArray(true);
        $output .= ";\n";
        echo <<<EOT

<div id="mainMenuBar"></div>

<link href="js/ThemeOffice/theme.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="js/JSCookMenu.js"></script>
<script language="javascript" type="text/javascript" src="js/ThemeOffice/theme.js"></script>

<script language="javascript" type="text/javascript">
{{$output}}

cmDraw ('mainMenuBar', myMenu, 'hbr', cmThemeOffice);
</script>

EOT;
    }
예제 #2
0
 function render()
 {
     $currentUser = MyApp::instance()->currentUser();
     $category = array();
     if ($currentUser['group_id'] == 1) {
         $category = Category::find('enabled=1')->order('weight desc')->getAll();
     } else {
         $user = Users::find()->getById($currentUser['id']);
         $category = $user->group->categorys;
     }
     $this->_view['title'] = $this->title;
     $this->_view['category'] = $category;
     return $this->_fetchView(dirname(__FILE__) . '/category_view');
 }
예제 #3
0
<?php

// $Id: index.php 11 2012-02-08 06:05:02Z zys4416@gmail.com $
/**
 * 应用程序启动脚本
 */
global $g_boot_time;
$g_boot_time = microtime(true);
$app_config = (require dirname(__FILE__) . '/../config/boot.php');
require $app_config['QEEPHP_DIR'] . '/library/q.php';
require $app_config['APP_DIR'] . '/myapp.php';
$ret = MyApp::instance($app_config)->dispatching();
if (is_string($ret)) {
    echo $ret;
}
return $ret;
예제 #4
0
<?php

// $Id: generate.php 895 2010-03-23 05:36:29Z thinkgem $
/**
 * 命令行代码生成器的入口文件
 */
if (!isset($argv)) {
    echo <<<EOT
ERR: PHP running command line without \$argv.

EOT;
    exit;
}
$app_config = (require dirname(dirname(__FILE__)) . '/config/boot.php');
require $app_config['QEEPHP_DIR'] . '/library/q.php';
require $app_config['APP_DIR'] . '/myapp.php';
MyApp::instance($app_config);
require $app_config['QEEPHP_DIR'] . '/commands/cli/generator.php';
array_shift($argv);
$generator = new CliGenerator($app_config, $argv);
$generator->generating();
예제 #5
0
파일: index.php 프로젝트: fchaose/qeephp
<?php

global $g_boot_time;
$g_boot_time = microtime(true);
$app_config = (require dirname(__FILE__) . '/../config/boot.php');
require $app_config['ROOT_DIR'] . '/app/myapp.php';
MyApp::instance($app_config)->run();