コード例 #1
0
 private function save()
 {
     $this->config->set_number_articles_per_page($this->form->get_value('number_articles_per_page'));
     if ($this->form->get_value('display_icon_cats')) {
         $this->config->enable_cats_icon();
         $this->config->set_number_cols_display_cats($this->form->get_value('number_cols_display_cats'));
     } else {
         $this->config->disable_cats_icon();
     }
     $this->config->set_number_categories_per_page($this->form->get_value('number_categories_per_page'));
     $this->config->set_number_character_to_cut($this->form->get_value('number_character_to_cut', $this->config->get_number_character_to_cut()));
     if ($this->form->get_value('notation_enabled')) {
         $this->config->enable_notation();
         $this->config->set_notation_scale($this->form->get_value('notation_scale'));
         if ($this->form->get_value('notation_scale') != $this->config->get_notation_scale()) {
             NotationService::update_notation_scale('articles', $this->config->get_notation_scale(), $this->form->get_value('notation_scale'));
         }
     } else {
         $this->config->disable_notation();
     }
     if ($this->form->get_value('comments_enabled')) {
         $this->config->enable_comments();
     } else {
         $this->config->disable_comments();
     }
     if ($this->form->get_value('display_descriptions_to_guests')) {
         $this->config->display_descriptions_to_guests();
     } else {
         $this->config->hide_descriptions_to_guests();
     }
     $this->config->set_display_type($this->form->get_value('display_type')->get_raw_value());
     $this->config->set_root_category_description($this->form->get_value('root_category_description'));
     $this->config->set_authorizations($this->form->get_value('authorizations')->build_auth_array());
     ArticlesConfig::save();
     ArticlesService::get_categories_manager()->regenerate_cache();
 }