protected function build_new_config() { $config = $this->get_old_config(); $config['root'] = unserialize($config['root']); $media_config = MediaConfig::load(); $media_config->set_items_number_per_page($config['pagin']); $media_config->set_categories_number_per_page($config['nbr_column']); $media_config->set_notation_scale($config['note_max']); $media_config->set_max_video_width($config['width']); $media_config->set_max_video_height($config['height']); $media_config->set_root_category_description($config['root']['desc']); $media_config->set_root_category_content_type($config['root']['mime_type']); $media_config->set_authorizations($this->build_authorizations(unserialize($config['root']['auth']))); MediaConfig::save(); return true; }
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(); }