コード例 #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'));
     if ($this->form->get_value('author_displayed')) {
         $this->config->display_author();
     } else {
         $this->config->hide_author();
     }
     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('media', $this->config->get_notation_scale(), $this->form->get_value('notation_scale'));
         }
     } else {
         $this->config->disable_notation();
     }
     $this->config->set_max_video_width($this->form->get_value('max_video_width'));
     $this->config->set_max_video_height($this->form->get_value('max_video_height'));
     $this->config->set_root_category_description($this->form->get_value('root_category_description'));
     $this->config->set_root_category_content_type($this->form->get_value('root_category_content_type')->get_raw_value());
     $this->config->set_authorizations($this->form->get_value('authorizations')->build_auth_array());
     MediaConfig::save();
     MediaService::get_categories_manager()->regenerate_cache();
 }