示例#1
0
 public static function getSidebarModules()
 {
     $start_page = AuthAccount::getStartPage();
     $menu = array();
     ## Modules info
     $mod_info = Config::get('mod_info');
     $mod_menu = Config::get('mod_menu');
     #Helper::dd($mod_info);
     #Helper::d($mod_menu);
     $dic_entities = array();
     if (class_exists('AdminDicvalsController')) {
         $entity_dics = Dic::where('entity', '1')->orderBy(DB::raw('-`order`'), 'DESC')->get();
         #Helper::tad($entity_dics);
         if (count($entity_dics)) {
             $controller = new AdminDicvalsController();
             foreach ($entity_dics as $entity_dic) {
                 if (!$controller->is_available($entity_dic)) {
                     continue;
                 }
                 $dic_entities[$entity_dic->slug] = array(array('title' => $entity_dic->name, 'link' => Helper::clearModuleLink(URL::route('entity.index', $entity_dic->slug)), 'class' => $entity_dic->icon_class, 'module' => 'dictionaries', 'permit' => 'dicval_entity_view'));
             }
             ##$dic_entities += $mod_menu;
             ##$mod_menu = $dic_entities;
             #Helper::d($dic_entities);
             #Helper::dd($mod_menu);
         }
     }
     ## If exists menu elements...
     if (isset($mod_menu) && is_array($mod_menu) && count($mod_menu)) {
         #foreach( $mod_menu as $mod_name => $menu_elements ) {
         foreach ((array) @$dic_entities + Allow::modules() as $mod_name => $module) {
             #Helper::d($mod_name);
             ## Hardcode...
             $menu_elements = @is_object($module) && @is_array($mod_menu[$mod_name]) ? $mod_menu[$mod_name] : $module;
             if (is_array($menu_elements) && count($menu_elements)) {
                 #Helper::d($mod_name); #continue;
                 #Helper::d($menu_elements); #continue;
                 foreach ($menu_elements as $m => $menu_element) {
                     #Helper::d($menu_element); #continue;
                     ## If permit to view menu element
                     $rules = @$menu_element['permit'];
                     $module = @$menu_element['module'] ?: $mod_name;
                     $permit = $rules ? Allow::action($module, $rules, true, false) : true;
                     #Helper::d($module . " :: " . $permit . " :: " . $rules);
                     #Helper::d( $menu_element['title'] . " - " . (int)$permit );
                     if ($permit) {
                         $menu[] = $menu_element;
                     }
                 }
             }
         }
     }
     #Helper::dd($menu);
     return $menu;
 }
示例#2
0
文件: Allow.php 项目: Grapheme/amway
 private static function init()
 {
     if (!self::$modules) {
         self::$modules = array();
         $temp = Module::with('actions')->orderBy('order', 'ASC')->orderBy('name', 'ASC')->get();
         foreach ($temp as $tmp) {
             $actions = array();
             foreach ($tmp->actions as $action) {
                 #Helper::d($action);
                 $actions[$action->action] = $action;
             }
             unset($tmp->actions);
             $tmp->actions = $actions;
             #Helper::ta($tmp->actions);
             #Helper::ta($tmp);
             self::$modules[$tmp['name']] = $tmp;
         }
         #self::$modules['system'] = array('system' => 1);
     }
     #Helper::dd(self::$modules);
     #Helper::tad(self::$modules);
 }
示例#3
0
@section('content')
<div class="row">

	<div class="col-xs-12 col-sm-12 col-md-12 col-lg-5">

        <h1>Модули</h1>

		<form action="{{ URL::route('modules.change') }}" class="smart-form">
                {{--<label class="label">Список доступных модулей:</label>--}}

                <table class="table table-bordered table-striped white-bg modules-list">
                    <?
                    #Helper::d(SystemModules::getModules());
                    $modules_info = Config::get('mod_info');
                    $modules = Allow::modules();
                    #Helper::tad($modules);
                    #Helper::tad($modules_info);
                    ?>
                    <tbody class="sortable">
                        @foreach($modules as $name => $module)
                        <?
                        if (!isset($modules_info[$module->name]) || !@$modules_info[$module->name]['visible'])
                            continue;
                        ?>
                        <tr data-id="{{ @$module->id }}">
                            <td>{{ @$modules_info[$module->name]['title'] }}</td>
                            <td style="width: 50px;">
                                <label class="toggle">
                                    <?php 
$checked = '';