/** * Saves the page's options. * If no page ID is given by $_POST * * @param int Page ID */ public function save_options() { $id_page = $this->input->post('id_page'); // Do stuff if ($id_page) { // Prepare data before save $this->_prepare_options_data(); // Event Data $event_data = array('base' => $this->data, 'lang' => $this->lang_data, 'post' => $this->input->post()); Event::fire('Page.options.save.before', $event_data); // Save Page $this->page_model->save($this->data, $this->lang_data); // Save the Urls $this->page_model->save_urls($id_page); // Save Home page if ($this->data['home'] == '1') { $this->page_model->update_home_page($id_page); } $page = array_merge($this->lang_data[Settings::get_lang('default')], $this->page_model->get_by_id($id_page)); $page['menu'] = $this->menu_model->get($page['id_menu']); // Saves linked categories $this->base_model->join_items_keys_to('category', $this->input->post('categories'), 'page', $id_page); // Saves Tags $this->tag_model->save_element_tags($this->input->post('tags'), 'page', $id_page); // Rules if (Authority::can('access', 'admin/page/permissions/backend')) { $resource = $this->_get_resource_name('backend', 'page', $id_page); $this->rule_model->save_element_roles_rules($resource, $this->input->post('backend_rule')); } if (Authority::can('access', 'admin/page/permissions/frontend')) { $resource = $this->_get_resource_name('frontend', 'page', $id_page); $this->rule_model->save_element_roles_rules($resource, $this->input->post('frontend_rule')); } Event::fire('Page.options.save.success', $event_data); // Remove HTML tags from returned array strip_html($page); } // Reloads the page edition panel $this->_reload_panel($id_page); // Answer $this->success(lang('ionize_message_page_saved')); }