Example #1
0
 /**
  * @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);
 }
Example #2
0
 public function __construct()
 {
     self::$js[] = 'http://maps.google.com/maps/api/js?libraries=geometry';
     self::$js[] = 'https://www.google.com/jsapi';
     parent::__construct();
 }
Example #3
0
 /**
  *
  */
 public function load_page()
 {
     $compiler = new compiler();
     $options = ['ajax' => ajax, 'admin' => core::is_admin(), "dev" => dev, "debug" => debug];
     try {
         $compiler_page = $compiler->load(uri, $options);
     } catch (\Exception $e) {
         if ($this->path) {
             if (!is_numeric($this->path[0])) {
                 $this->module_name = $this->path[0];
             } else {
                 $this->module_name = 'pages';
             }
         } else {
             $this->module_name = ini::get('site', 'default_module', 'pages');
         }
         $compiler_page = new compiler_page();
         if (class_exists('module\\' . $this->module_name . '\\controller')) {
             $class_name = 'module\\' . $this->module_name . '\\controller';
             $this->module = new $class_name();
             $this->module->__controller($this->path);
             $this->module->page = $this->pagination_page;
             if (!ajax) {
                 $compiler_page->content = $this->module->view_object->get_page();
             } else {
                 $compiler_page->content = $this->module->view_object->get();
                 $compiler_page->ajax = ajax::current();
             }
             $push_state = $this->module->get_push_state();
             if ($push_state) {
                 $push_state->data->actions = array_merge($push_state->data->actions, self::$push_state_ajax_calls);
             }
             $compiler_page->push_state = $push_state;
         }
         $compiler->save(uri, $compiler_page, $options);
     }
     if (!ajax) {
         if ($compiler_page->push_state) {
             $compiler_page->push_state->type = push_state::REPLACE;
             $compiler_page->push_state->get();
         }
         echo $compiler_page->content;
     } else {
         ajax::set_current($compiler_page->ajax);
         if ($compiler_page->push_state) {
             ajax::push_state($compiler_page->push_state);
         }
         $class = new \ReflectionClass('\\classes\\ajax');
         $function = $class->getMethod('inject');
         $function->invokeArgs(null, $compiler_page->content);
     }
 }