コード例 #1
0
 private function save()
 {
     $this->config->set_items_number_per_page($this->form->get_value('items_number_per_page'));
     $this->config->set_categories_number_per_page($this->form->get_value('categories_number_per_page'));
     $this->config->set_columns_number_per_line($this->form->get_value('columns_number_per_line'));
     $this->config->set_category_display_type($this->form->get_value('category_display_type')->get_raw_value());
     if ($this->config->get_category_display_type() != WebConfig::DISPLAY_ALL_CONTENT) {
         if ($this->form->get_value('display_descriptions_to_guests')) {
             $this->config->display_descriptions_to_guests();
         } else {
             $this->config->hide_descriptions_to_guests();
         }
     }
     if ($this->form->get_value('comments_enabled')) {
         $this->config->enable_comments();
     } else {
         $this->config->disable_comments();
     }
     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('web', $this->config->get_notation_scale(), $this->form->get_value('notation_scale'));
         }
     } else {
         $this->config->disable_notation();
     }
     $this->config->set_root_category_description($this->form->get_value('root_category_description'));
     $this->config->set_sort_type($this->form->get_value('sort_type')->get_raw_value());
     $this->config->set_sort_mode($this->form->get_value('sort_mode')->get_raw_value());
     $this->config->set_partners_number_in_menu($this->form->get_value('partners_number_in_menu'));
     $this->config->set_authorizations($this->form->get_value('authorizations')->build_auth_array());
     WebConfig::save();
     WebService::get_categories_manager()->regenerate_cache();
     WebCache::invalidate();
 }