public function ajax_load() { $this->set_view(); $this->set_page(); $this->view_object->get(); $push_state = $this->get_push_state(); _ajax::push_state($push_state); }
/** * */ 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); } }