public static function returnMenu()
 {
     $menu = array();
     $menu_child = array();
     if (Allow::action('system', 'settings', false, true)) {
         $menu_child[] = array('title' => 'Настройки', 'link' => 'system/settings', 'class' => 'fa-gear');
     }
     if (Allow::action('system', 'modules', false, true)) {
         $menu_child[] = array('title' => 'Модули', 'link' => 'system/modules', 'class' => 'fa-gears');
     }
     if (Allow::action('system', 'groups', false, true)) {
         $menu_child[] = array('title' => 'Группы', 'link' => 'system/groups', 'class' => 'fa-group');
     }
     if (Allow::action('system', 'users', false, true)) {
         $menu_child[] = array('title' => 'Пользователи', 'link' => 'system/users', 'class' => 'fa-user');
     }
     if (Allow::action('system', 'menu_editor', false, true)) {
         $menu_child[] = array('title' => 'Конструктор меню', 'link' => 'system/menu_editor', 'class' => 'fa-list');
     }
     if (Allow::action('system', 'locale_editor', false, true)) {
         $menu_child[] = array('title' => 'Редактор языков', 'link' => 'system/locale_editor', 'class' => 'fa-language');
     }
     if (Allow::action('system', 'tpl_editor', false, true)) {
         $menu_child[] = array('title' => 'Редактор шаблонов', 'link' => 'system/tpl_editor', 'class' => 'fa-th-large');
     }
     if (count($menu_child) && Allow::action('system', 'system', false, true)) {
         $menu[] = array('title' => 'Система', 'link' => '#', 'class' => 'fa-gear', 'system' => 1, 'menu_child' => $menu_child);
     }
     return $menu;
 }
示例#2
0
 public function templates($path = '', $post_path = '/views')
 {
     #Helper::dd($path . ' | ' . $post_path . ' | ' . "/*");
     #Helper::dd($path.$post_path."/*");
     $templates = array();
     $temp = glob($path . $post_path . "/*");
     #Helper::dd($temp);
     if (isset($temp) && is_array($temp) && count($temp)) {
         foreach ($temp as $t => $tmp) {
             if (is_dir($tmp)) {
                 continue;
             }
             #Helper::d($tmp);
             $properties = Helper::getFileProperties($tmp);
             #var_dump($properties);
             #echo (int)(in_array('TEMPLATE_IS_NOT_SETTABLE', $properties));
             #echo "<hr/>";
             if (@$properties['TEMPLATE_IS_NOT_SETTABLE'] || !Allow::action('pages', 'advanced') && !@$properties['AVAILABLE_IN_SIMPLE_MODE']) {
                 continue;
             }
             $name = basename($tmp);
             $name = str_replace(".blade.php", "", $name);
             $templates[$name] = @$properties['TITLE'] ?: $name;
         }
     }
     #Helper::dd($templates);
     return $templates;
 }
示例#3
0
 public static function returnExtFormElements()
 {
     $mod_tpl = static::returnTpl();
     $class = __CLASS__;
     ##
     ## EXTFORM SEO
     ##
     ExtForm::add("seo", function ($name = 'seo', $value = '', $params = null) use($mod_tpl, $class) {
         if (!Allow::action('seo', 'edit', true)) {
             return false;
         }
         ## default template
         $tpl = "extform_seo";
         ## custom template
         if (@$params['tpl']) {
             $tpl = $params['tpl'];
             unset($params['tpl']);
         }
         #$value = $element_meta->seo;
         /*
                         ## Don't work with i18n versions
                         if ( $value === false || $value === null ) {
                             $val = Form::text($name);
                             Helper::dd($val);
                             preg_match("~value=['\"]([^'\"]+?)['\"]~is", $val, $matches);
                             Helper::dd($matches);
                             $val = @$matches[1];
                             $array = json_decode($val, true);
                             if ($array)
                                 $value = $array;
                         }
                         #*/
         ## return view with form element
         return View::make($mod_tpl . $tpl, compact('name', 'value', 'params'));
     }, function ($params) use($mod_tpl, $class) {
         #Helper::dd($params);
         $module = isset($params['module']) ? $params['module'] : false;
         $unit_id = isset($params['unit_id']) ? $params['unit_id'] : false;
         $data = isset($params['data']) ? $params['data'] : false;
         $locale = isset($params['locale']) ? $params['locale'] : NULL;
         if (!$module || !$unit_id) {
             return false;
         }
         #Helper::dd($data);
         #$data['module'] = $module;
         #$data['unit_id'] = $unit_id;
         #Helper::dd($data);
         foreach ($data as $d => $dat) {
             if (!is_string($dat)) {
                 continue;
             }
             $data[$d] = trim($dat);
         }
         $seo = Seo::firstOrCreate(array('module' => $module, 'unit_id' => $unit_id, 'language' => $locale));
         $seo->update($data);
         return $seo;
     });
 }
示例#4
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;
 }
 public function index()
 {
     Allow::permission($this->module['group'], 'view');
     $elements = Upload::orderBy('created_at', 'DESC')->where('original_name', '!=', "''")->where('path', '!=', "''");
     if (!(Input::get('view') == 'all' && Allow::action($this->module['group'], 'view_all'))) {
         $elements = $elements->where('module', NULL)->where('unit_id', NULL);
     }
     $elements = $elements->paginate(30);
     #Helper::tad($elements);
     return View::make($this->module['tpl'] . 'index', compact('elements'));
 }
示例#6
0
<?php

return array('sections' => function () {
    $settings = [];
    if (TRUE) {
        $settings['main'] = ['title' => 'Основные', 'options' => array(['group_title' => 'Настройки отправки почты', 'style' => 'margin: 0 0 5px 0'], 'feedback_address' => array('title' => 'Адрес почты для сообщений обратной связи', 'type' => 'text'), 'feedback_from_email' => array('title' => 'Адрес почты, от имени которого будут отправляться сообщения', 'type' => 'text'), 'feedback_from_name' => array('title' => 'Имя пользователя, от которого будут отправляться сообщения', 'type' => 'text'), ['group_title' => 'Кеширование'], 'db_remember_timeout' => array('title' => 'Кол-во минут, на которое кешировать ВСЕ запросы к БД (не рекомендуется)', 'type' => 'text'), ['group_title' => 'Прочее'], 'tpl_footer_counters' => array('title' => 'Код невидимых счетчиков (Я.Метрика, Google Analytics и т.д.)', 'type' => 'textarea'))];
    }
    if (Allow::action('catalog', 'catalog_allow', true, false)) {
        $settings['catalog'] = ['title' => 'Магазин', 'options' => array('allow_products_order' => array('no_label' => true, 'title' => 'Разрешить сортировку всех товаров (не рекомендуется)', 'type' => 'checkbox', 'label_class' => 'normal_checkbox'), 'disable_attributes_for_products' => array('no_label' => true, 'title' => 'Отключить функционал работы с атрибутами для товаров', 'type' => 'checkbox', 'label_class' => 'normal_checkbox'), 'disable_attributes_for_categories' => array('no_label' => true, 'title' => 'Отключить функционал работы с атрибутами для категорий', 'type' => 'checkbox', 'label_class' => 'normal_checkbox'))];
    }
    return $settings;
});
示例#7
0
                'link' => mb_substr(action($module['class'] . '@getIndex'), 0, -6) . "?group_id=" . $grp->id,
                'title' => $grp->desc . ' (' . $grp->count_users() . ')',
            );
            if (@is_object($group) && $group->name == $grp->name)
                $def_arr = $arr;
            $temp[] = $arr;
        }

    }

    $def_arr['class'] = 'btn btn-default';
    if (count($temp) > 1)
        $def_arr['child'] = $temp;
    $menus[] = $def_arr;


    if (Allow::action($module['group'], 'users')) {
        $menus[] = array(
            'link' => action($module['class'] . '@getCreate'),
            'title' => 'Добавить',
            'class' => 'btn btn-primary'
        );
    }

?>

    <h1>{{ $page_title }}</h1>

    {{ Helper::drawmenu($menus) }}

示例#8
0
    );
}
if (Allow::action($module['group'], 'dicval_create')
    && (!isset($dic_settings['max_elements']) || !$dic_settings['max_elements'] || (isset($total_elements_current_selection) && $dic_settings['max_elements'] > $total_elements_current_selection))
) {
    $current_link_attributes = Helper::multiArrayToAttributes(Input::get('filter'), 'filter');
    $menus[] = array(
            'link' => action(is_numeric($dic_id) ? 'dicval.create' : 'entity.create', array('dic_id' => $dic_id) + $current_link_attributes), 'title' => 'Добавить', 'class' => 'btn btn-primary'
    );
}
if (Allow::action($module['group'], 'import')) {
    $menus[] = array(
            'link' => action('dic.import', array('dic_id' => $dic_id)), 'title' => 'Импорт', 'class' => 'btn btn-primary'
    );
}
if (Allow::action($module['group'], 'edit') && (!$dic->entity || Allow::superuser())) {
    $menus[] = array(
            'link' => action('dic.edit', array('dic_id' => $dic->id)), 'title' => 'Изменить', 'class' => 'btn btn-success'
    );
}
if (isset($total_elements_current_selection) && is_numeric($total_elements_current_selection) && $total_elements_current_selection > 0 && Allow::superuser()) {
    $menus[] = array(
        #'link' => URL::route('dic.clear', array('dic_id' => $dic->id)), 'title' => 'Очистить', 'class' => 'btn btn-danger'
        'raw' => Form::open(['url' => URL::route('dic.clear', array('dic_id' => $dic->id)), 'method' => 'POST', 'class' => 'clear_dic', 'style' => 'display:inline-block']) . Form::submit('Очистить', ['class' => 'btn btn-danger margin-bottom-5']) . Form::close(),
    );
}

if (isset($dic_settings['menus']))
    $dic_menu = $dic_settings['menus'];
#Helper::d($dic_menu);
if (isset($dic_menu) && is_callable($dic_menu)) {
示例#9
0
<?
    $menus = array();
    $menus[] = array(
        'link' => URL::route('uploads.index', null),
        'title' => 'Загрузки',
        'class' => 'btn btn-default'
    );
    if (Allow::action($module['group'], 'view_all')) {
        $menus[] = array(
            'link' => URL::route('uploads.index', array('view' => 'all')),
            'title' => 'Все загрузки',
            'class' => 'btn btn-default'
        );
    }
?>
    
    <h1>Загруженные файлы</h1>

    {{ Helper::drawmenu($menus) }}

    @if (@is_dir(Config::get('site.uploads_dir')) && @is_writable(Config::get('site.uploads_dir')))
        {{ Form::open(array('url' => '#', 'class' => 'smart-form', 'files' => true)) }}
            <section>
                <label class="input pull-left" style="width:300px;">
                    {{ ExtForm::uploads('files', null, array('allow' => '*')) }}
                </label>
                &nbsp; <button class="btn btn-default">Загрузить</button>
            </section>
        {{ Form::close() }}
    @else
        <div class="alert alert-danger fade in min-table">
 private function checkDicPermission($dic)
 {
     if (!is_object($dic)) {
         return false;
     }
     $return = true;
     if ((int) $dic->view_access == 0) {
         $return = true;
     } elseif ((int) $dic->view_access == 1 && !Allow::superuser()) {
         $return = false;
     } elseif ((int) $dic->view_access == 2 && !Allow::action($this->module['group'], 'hidden')) {
         $return = false;
     }
     #Helper::dd($return);
     return $return;
 }
 public function postAjaxPagesSaveBlock()
 {
     #if(!Request::ajax())
     #    App::abort(404);
     /*
     if (Input::get('id'))
         $block = PageBlock::where('id', Input::get('id'))->first();
     else
         $block = new PageBlock;
     */
     #Helper::tad(Input::all());
     $id = Input::get('id');
     $block = $id != FALSE && $id > 0 && $this->pages_blocks->find($id)->exists() ? $this->pages_blocks->find($id) : new PageBlock();
     $input = Input::all();
     $locales = Helper::withdraw($input, 'locales');
     if (Allow::action('pages', 'advanced', true, false)) {
         if (isset($input['template'])) {
             $input['template'] = trim($input['template']) != '' ? $input['template'] : NULL;
         }
         if (isset($input['slug'])) {
             $input['slug'] = trim($input['slug']) != '' ? $input['slug'] : $input['name'];
             $input['slug'] = Helper::translit($input['slug']);
         }
         $input['settings']['system_block'] = isset($input['settings']['system_block']) ? 1 : 0;
     }
     if (@$input['settings']) {
         $input['settings'] = json_encode(array_merge(@(array) json_decode($block['settings']), $input['settings']));
     }
     $validator = Validator::make($input, $this->pages_blocks->rules());
     if ($validator->passes()) {
         $redirect = FALSE;
         ## BLOCK
         /*
         if ($id != FALSE && $id > 0 && $this->pages_blocks->find($id)->exists()) {
         
             $element = $this->pages_blocks->find($id);
             $element->update($input);
         
         } else {
         
             $element = $this->pages_blocks->create($input);
             $id = $element->id;
         }
         */
         $block->save();
         $block->update($input);
         ## BLOCK_META
         if (count($locales)) {
             foreach ($locales as $locale_sign => $locale_settings) {
                 $locale_settings['template'] = @$locale_settings['template'] ? $locale_settings['template'] : NULL;
                 #dd($locale_settings);
                 if (isset($locale_settings['content']) && is_array($locale_settings['content'])) {
                     $locale_settings['content'] = json_encode($locale_settings['content'], JSON_UNESCAPED_UNICODE);
                 }
                 $block_meta = $this->pages_blocks_meta->where('block_id', $block->id)->where('language', $locale_sign)->first();
                 if (is_object($block_meta)) {
                     $block_meta->update($locale_settings);
                 } else {
                     $locale_settings['block_id'] = $id;
                     $locale_settings['language'] = $locale_sign;
                     $this->pages_blocks_meta->create($locale_settings);
                 }
             }
         }
         ## Clear & reload pages cache
         Page::drop_cache();
         Page::preload();
         $json_request['responseText'] = 'Сохранено';
         if (@$redirect) {
             $json_request['redirect'] = $redirect;
         }
         $json_request['status'] = TRUE;
     } else {
         $json_request['responseText'] = 'Неверно заполнены поля';
         $json_request['responseErrorText'] = $validator->messages()->all();
     }
     return Response::json($json_request, 200);
     #return '';
 }
示例#12
0
 public function postSave($id = false)
 {
     #Helper::dd($entity);
     if (@$id) {
         Allow::permission($this->module['group'], 'edit');
     } else {
         Allow::permission($this->module['group'], 'create');
     }
     if (!Request::ajax()) {
         App::abort(404);
     }
     #$id = Input::get('id');
     $input = Input::all();
     if (Allow::action($this->module['group'], 'settings')) {
         $input['entity'] = Input::get('entity') ? 1 : NULL;
         $input['hide_slug'] = Input::get('hide_slug') ? 1 : NULL;
         $input['make_slug_from_name'] = Input::get('make_slug_from_name') > 0 ? (int) Input::get('make_slug_from_name') : NULL;
         $input['name_title'] = Input::get('name_title') ?: NULL;
         $input['view_access'] = is_numeric(Input::get('view_access')) ? (int) Input::get('view_access') : NULL;
         $input['sortable'] = Input::get('sortable') ? (int) Input::get('sortable') : 0;
         $input['sort_by'] = Input::get('sort_by') != 'order' ? Input::get('sort_by') : NULL;
     }
     $json_request['responseText'] = "<pre>" . print_r($_POST, 1) . "</pre>";
     #return Response::json($json_request,200);
     $json_request = array('status' => FALSE, 'responseText' => '', 'responseErrorText' => '', 'redirect' => FALSE);
     $validator = Validator::make($input, array('name' => 'required'));
     if ($validator->passes()) {
         $redirect = false;
         if ($id > 0 && NULL !== ($element = Dictionary::find($id))) {
             #$json_request['responseText'] = "<pre>" . print_r($_POST, 1) . "</pre>";
             #return Response::json($json_request,200);
             $element->update($input);
             $redirect = false;
         } else {
             $element = new Dictionary();
             $element->save();
             $element->update($input);
             $dic_id = $element->id;
             $redirect = action('dicval.index', array('dic_id' => $dic_id));
         }
         ## Clear & reload dics cache
         Dic::drop_cache();
         Dic::preload();
         $json_request['responseText'] = 'Сохранено';
         if ($redirect) {
             $json_request['redirect'] = $redirect;
         }
         $json_request['status'] = TRUE;
     } else {
         $json_request['responseText'] = 'Неверно заполнены поля';
         $json_request['responseErrorText'] = $validator->messages()->all();
     }
     return Response::json($json_request, 200);
 }
示例#13
0
         'link' => $element->entity
                 ? URL::route('entity.index', $element->slug)
                 : URL::route('dicval.index', $element->id)
         ,
         'title' => 'Содержимое (' . $element->values_count() . ')',
         'class' => 'btn btn-warning'
     );
 }
 if (Allow::action($module['group'], 'create')) {
     $menus[] = array(
         'link' => URL::route('dic.create', null),
         'title' => 'Добавить',
         'class' => 'btn btn-primary'
     );
 }
 if (Allow::action($module['group'], 'import') && @$dic_id) {
     $menus[] = array(
         'link' => action('dic.import', array('dic_id' => $dic_id)),
         'title' => 'Импорт',
         'class' => 'btn btn-primary'
     );
 }
 if (Allow::superuser() && @is_object($element) && $element->id) {
     $menus[] = array(
         'link' => action('dic.sphinx', array('dic_id' => $element->id)),
         'title' => '<i class="fa fa-search-plus"></i>',
         'class' => 'btn btn-info',
         'others' => array(
             'title' => 'SQL-запрос для Sphinx',
             'target' => '_blank',
         ),
示例#14
0
<?
    $page_title = "Новости";


    $menus = array();

    if (Allow::action($module['group'], 'view')) {
        $menus[] = array(
            'link' => action($module['entity'].'.index'),
            'title' => 'Все новости',
            'class' => 'btn btn-default'
        );
    }

    if (Allow::action($module['group'], 'create')) {
        $menus[] = array(
            'link' => action($module['entity'].'.create'),
            'title' => 'Добавить',
            'class' => 'btn btn-primary'
        );
    }

?>

    <h1>{{ $page_title }}</h1>

    {{ Helper::drawmenu($menus) }}