/** * @param array $path */ public function __controller(array $path) { \classes\compiler::disable(); error_reporting(-1); \core::$css = ['/.core/module/cms/css/styles.css']; \core::$js = ['/.core/js/jquery.js', '/.core/js/_ajax.js', '/.core/js/content_collapse.js', '/.core/module/cms/js/cms.js', '/.core/js/colorbox.js', '/.core/plugins/ckeditor/ckeditor.js']; if (\core::is_admin() && !isset($path[1])) { $path[1] = 'dashboard'; } $this->view = 'login'; if (isset($path[1]) && !empty($path[1]) && \core::is_admin()) { $this->view = $path[1]; if (isset($path[2])) { $this->set_from_mid($path[2]); $this->npp = session::is_set('cms', $this->module->get_class_name(), 'npp') ? session::get('cms', $this->module->get_class_name(), 'npp') : 25; $this->page = isset($path[4]) ? $path[4] : 1; $this->current_class = $this->module->get_class(); } } if (isset($path[3]) && !empty($path[3]) && core::is_admin()) { /** @var table $class */ $class = $this->current_class; $class::$retrieve_unlive = true; $class::$retrieve_deleted = true; $this->current->do_retrieve_from_id([], $path[3]); } parent::__controller($path); }
public function get_submit() { $html = parent::get_submit(); if (session::is_set('cms', 'filter', $this->_mid)) { $html .= node::create('a.btn.btn-default', ['href' => '#', 'data-ajax-click' => '\\module\\cms\\form\\cms_filter_form:do_clear_filter', 'data-ajax-post' => '{"_mid":"' . $this->_mid . '"}', 'data-ajax-shroud' => '#filter_form'], 'Clear Filters'); } return node::create('span', [], $html); }
public function set_search() { if (!isset($this->sort_method)) { $this->search_form = new search_form(get_class($this)); $this->search_form->set_from_request(); $this->search_form->attributes['data-ajax-change'] = get_class($this) . ':do_search_submit'; if (session::is_set(get_class($this), $this->search_form->identifier, 'search')) { $this->search_form->keywords = session::get(get_class($this), $this->search_form->identifier, 'search'); } } }
public function set_sort() { if (!isset($this->sort_method)) { $this->sort_form = new sort_form($this->get_sortable_fields(), get_class($this)); $this->sort_form->set_from_request(); $this->sort_form->attributes['data-ajax-change'] = get_class($this) . ':do_sort_submit'; if (session::is_set(get_class($this), $this->sort_form->identifier, 'sort')) { $this->sort_form->sort = session::get(get_class($this), $this->sort_form->identifier, 'sort'); } } }
public function set_filters() { if (!isset($this->filters)) { $this->filters = new filter_form($this->get_filterable_fields(), $this); $this->filters->set_from_request(); $this->filters->attributes['data-ajax-change'] = get_class($this) . ':do_filter_submit'; if (session::is_set(get_class($this), $this->filters->identifier, 'filter')) { foreach (session::get(get_class($this), $this->filters->identifier, 'filter') as $filter => $value) { $this->filters->{$filter} = $value; } } } }
public function __construct(__cms_module $module, $page) { $this->module = $module; $this->page = $page; $this->npp = session::is_set('cms', 'filter', $module->mid, 'npp') ? session::get('cms', 'filter', $module->mid, 'npp') : 25; $this->deleted = session::is_set('cms', 'filter', $module->mid, 'deleted') ? session::get('cms', 'filter', $module->mid, 'deleted') : false; $this->allowed_keys = ['' => 0] + (session::is_set('cms', 'expand', $module->mid) ? session::get('cms', 'expand', $module->mid) : []); $this->where = []; if ($module->order && preg_match('/[a-zA-Z0-9,\\s]+/', $module->order)) { $this->order = $module->order; } $class = $this->module->get_class_name(); $this->class_name = $class; $this->class = new $class(); foreach ($module->get_class()->get_fields() as $field) { if (session::is_set('cms', 'filter', $module->mid, $field->field_name) && session::get('cms', 'filter', $module->mid, $field->field_name)) { $this->where[$field->field_name] = session::get('cms', 'filter', $module->mid, $field->field_name); } } }
public static function is_admin() { compiler::allow(); return session::is_set('admin'); }
public function do_toggle_expand() { if (isset($_REQUEST['id'])) { $module = new _cms_module(); $module->do_retrieve([], ['where_equals' => ['mid' => $_REQUEST['mid']]]); if (_session::is_set('cms', 'expand', $module->mid)) { $value = _session::get('cms', 'expand', $module->mid); if (($key = array_search($_REQUEST['id'], $value)) !== false) { unset($value[$key]); } else { $value[] = $_REQUEST['id']; } _session::set($value, 'cms', 'expand', $module->mid); } else { _session::set([$_REQUEST['id']], 'cms', 'expand', $module->mid); } $list = new _cms_table_list($module, 1); _ajax::update($list->get_table()); } }