Beispiel #1
0
 public function save_options()
 {
     $rel = $this->input->post('rel');
     // IDs
     $rel = explode(".", $rel);
     $id_page = $this->data['id_page'] = !empty($rel[1]) ? $rel[0] : '0';
     // $id_article = $this->input->post('id_article');
     $this->_prepare_options_data();
     // Event : On before save
     $event_data = array('base' => $this->data, 'lang' => $this->lang_data, 'post' => $this->input->post());
     Event::fire('Article.options.save.before', $event_data);
     // Saves article to DB and get the saved ID
     $id_article = $this->article_model->save($this->data, $this->lang_data);
     // Saves linked categories
     $this->base_model->join_items_keys_to('category', $this->input->post('categories'), 'article', $id_article);
     // Saves Tags
     $this->tag_model->save_element_tags($this->input->post('tags'), 'article', $id_article);
     // Rules
     if (Authority::can('access', 'admin/article/permissions/backend')) {
         $resource = $this->_get_resource_name('backend', 'article', $id_article);
         $this->rule_model->save_element_roles_rules($resource, $this->input->post('backend_rule'));
     }
     if (Authority::can('access', 'admin/article/permissions/frontend')) {
         $resource = $this->_get_resource_name('frontend', 'article', $id_article);
         $this->rule_model->save_element_roles_rules($resource, $this->input->post('frontend_rule'));
     }
     // Event : On after save
     Event::fire('Article.options.save.success', $event_data);
     // Context update
     $this->update_contexts($id_article);
     // Reloads the edition panel
     $this->_reload_panel($id_page, $id_article);
     // Answer
     $this->success(lang('ionize_message_article_saved'));
 }
Beispiel #2
0
 /**
  * Update one menu
  *
  */
 public function update()
 {
     $id_menu = $this->input->post('id_menu');
     if ($id_menu) {
         $this->menu_model->update($id_menu, $this->input->post());
         if (Authority::can('access', 'admin/menu/permissions/backend')) {
             $resource = 'backend/menu/' . $id_menu;
             $this->rule_model->save_element_roles_rules($resource, $this->input->post('backend_rule'));
         }
     }
     // UI update panels
     $this->_update_panels();
     $this->success(lang('ionize_message_menu_updated'));
 }
Beispiel #3
0
 /**
  * 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'));
 }