示例#1
0
 public static function getInstance()
 {
     if (self::$instance === NULL) {
         self::$instance = new self();
     }
     return self::$instance;
 }
示例#2
0
 /**
  * @return MainMenu
  */
 public static function getInstance($controller, $action)
 {
     if (null === self::$instance) {
         self::$instance = new self::$className($controller, $action);
     }
     return self::$instance;
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $menu = MainMenu::orderBy('urutan', 'ASC')->get();
     $data = "Coba test data";
     //$this->menus = $menu
     return view('layouts.nav', ['menu' => $menu]);
     // return View::make('layouts.master')->withMenus($this->menus);
 }
示例#4
0
 public function run()
 {
     $cs = Yii::app()->getClientScript();
     Yii::app()->clientScript->registerCoreScript('jquery');
     $this->registerCoreScripts();
     $model = MainMenu::model()->findByPK(1);
     $menu = $model->getTreeViewArray(false, 'id', 1);
     $this->render($this->itemview, array('menu' => $menu));
 }
示例#5
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = MainMenu::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
示例#6
0
                    <?php if(Yii::app()->user->ckAct('Site','Schedule')): ?>
                        <li><a class="<?php echo (in_array($cur_controller_action, array('schedule', 'schedulehistory')))?'active':''?>" href="<?php echo $this->createUrl('site/schedule'); ?>"><?php echo It::t('menu_label', 'home_schedule'); ?></a></li>
                    <?php endif;?>
                    <?php  if(Yii::app()->user->ckAct('Site','StationTypeDataExport')): ?>
                        <li><a class="<?php echo (in_array($cur_controller_action, array('stationtypedataexport', 'stationtypedatahistory')))?'active':''?>" href="<?php echo $this->createUrl('site/StationTypeDataExport'); ?>"> ODSS export</a></li>
                    <?php endif; ?>
                <?php } ?>
            </ul>
            <?php }?>                
            
            <div class="clear"></div>
        </div>
*/
?>
        <?php 
$mainMenu = MainMenu::getInstance($cur_controller, $cur_controller_action);
echo $mainMenu->getFirstMenu();
?>
    </div>
</div><!-- div#headerwrap-->    



<div id="middlewrap">
    <?php 
echo $mainMenu->getSecondMenu();
?>
    <?php 
$this->widget('ThrowStatus');
?>
    <?php 
示例#7
0
function error_page()
{
    $menu = MainMenu::getInstance()->getMenu();
    $html = "<!DOCTYPE HTML>";
    $html .= "<head>";
    $html .= "<meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=yes'>";
    $html .= "<meta name='format-detection' content='telephone=no'/>";
    $html .= "<title>Page Not Found</title>";
    $html .= "<style type='text/css'>";
    $html .= file_get_contents("css/404.css");
    $html .= "</style>";
    $html .= "</head>";
    $html .= "<body>";
    $html .= "<img src='/img/yawn.png' alt=''>";
    $html .= "<h1>Page Not Found</h1>";
    $html .= "<p>Sorry, but the page you were trying to view does not exist.</p>";
    $html .= "<p>&nbsp;</p>";
    $html .= "<p>Maybe, you try it here:</p>";
    $html .= "<ul>";
    $html .= "<li><a href='/'><strong>Start</strong></a><li>";
    foreach ($menu as $item) {
        $html .= "<li><a href='" . $item->url . "'>" . $item->title . "</a></li>";
    }
    $html .= "</ul>";
    $html .= "</body>";
    $html .= "</html>";
    $html .= "<!-- IE needs 512+ bytes: http://blogs.msdn.com/b/ieinternals/archive/2010/08/19/http-error-pages-in-internet-explorer.aspx -->";
    echo $html;
}
示例#8
0
 public static function getMainMenuItems($id)
 {
     return MainMenu::getMainMenuItems($id);
 }
示例#9
0
文件: core.php 项目: sd-studio/sh
function show($template, $name)
{
    global $smarty, $lang;
    $smarty->assign('name', $name);
    $smarty->assign('tpl', "{$template}.tpl");
    $crumbs = array();
    $mid = $_REQUEST['mid'];
    if ($mid) {
        $crumbs = MainMenu::path($mid);
    } else {
        if ($_REQUEST['referer']) {
            $referer = array();
            parse_str(parse_url($_REQUEST['referer'], PHP_URL_QUERY), $referer);
            if (array_key_exists('mid', $referer)) {
                $mid = $referer['mid'];
            }
            $crumbs = array_merge(MainMenu::path($mid), array(array('', $name)));
        }
    }
    $smarty->assign('mid', $mid);
    $smarty->assign('crumbs', $crumbs);
    $menutreestates = \cf\api\session\get('mainTree');
    $smarty->assign('menutreestates', $menutreestates ? $menutreestates : array());
    $smarty->display('main.tpl');
}
示例#10
0
文件: category.php 项目: sd-studio/sh
<?php

require_once 'core.php';
$id = cf\param::get('id');
$nm = cf\query2var('SELECT name FROM cf_admin_categories WHERE id=:id', array('id' => $id));
$smarty->assign('childmenu', MainMenu::children($id));
show('category', $nm);
/**
 * Add options to main menu
 *
 * @param MainMenu $menu
 * @param User $user
 */
function timer_handle_on_main_menu(MainMenu &$menu, User &$user)
{
    $menu->addBefore('timer', lang('Timer'), TimerModule::getTimerRoute(), AngieApplication::getImageUrl('module.png', TIMER_MODULE, AngieApplication::INTERFACE_DEFAULT), null, 'admin');
    // before admin
}
示例#12
0

   <?php 
echo CHtml::dropDownList('controller', $model->controller, CHtml::listData($items['controllers'], 'name', 'name'), array('prompt' => 'Нет ссылки', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('mainMenu/dynamicActions'), 'update' => '#MainMenu_action', 'beforeSend' => 'function(){
								$("#MainMenu_action").empty();
								$("#dynelements").empty();
						}', 'complete' => 'function(){
								$("#MainMenu_controller").val($("#controller option:selected").val());
								$("#MainMenu_action").change();
						}')));
?>

		<?php 
$actions = array();
if ($model->controller) {
    $actions = CHtml::listData(MainMenu::model()->getContActions($model->controller), 'name', 'name');
}
?>
		<?php 
echo $form->dropDownList($model, 'action', $actions, array('ajax' => array('type' => 'POST', 'url' => CController::createUrl('mainMenu/dynamicElements'), 'update' => '#dynelements', 'complete' => 'function(){
						//$("#dynelements").empty();
						}')));
?>
	<div class="row" id="dynelements">
		<?php 
echo $form->labelEx($model, 'element');
?>

		<?php 
if ($model->controller && $model->action) {
    echo $model->getActionElements($model->controller, $model->action);