public function execute(HTTPRequestCustom $request) { $this->load_lang(); $this->load_config(); $theme = $request->get_value('theme', 'all'); if ($theme !== 'all' && !ThemesManager::get_theme_existed($theme)) { AppContext::get_response()->redirect(AdminCustomizeUrlBuilder::customize_interface()); } $this->build_form($theme); $tpl = new StringTemplate('# INCLUDE MSG # # INCLUDE FORM #'); $tpl->add_lang($this->lang); if ($this->submit_button->has_been_submited() && $this->form->validate()) { $header_logo = $this->form->get_value('header_logo', null); if ($header_logo !== null) { $file_type = new FileType(new File($header_logo->get_name())); if ($file_type->is_picture()) { $this->save($header_logo, $theme); AppContext::get_response()->redirect(AdminCustomizeUrlBuilder::customize_interface()); } else { $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('process.error', 'status-messages-common'), MessageHelper::ERROR, 4)); } } elseif ($this->form->get_value('use_default_logo')) { $this->delete_pictures_saved($theme); AppContext::get_response()->redirect(AdminCustomizeUrlBuilder::customize_interface()); } else { $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('process.error', 'status-messages-common'), MessageHelper::ERROR, 4)); } } $tpl->put('FORM', $this->form->display()); return new AdminCustomizationDisplayResponse($tpl, $this->lang['customization.interface']); }
/** * @return string The html code for the input. */ public function display() { $template = $this->get_template_to_use(); $this->assign_common_template_variables($template); $file_type = new FileType(new File($this->get_value())); $template->put_all(array('C_PREVIEW_HIDDEN' => !$file_type->is_picture(), 'C_AUTH_UPLOAD' => FileUploadConfig::load()->is_authorized_to_access_interface_files(), 'FILE_PATH' => Url::to_rel($this->get_value()))); return $template; }
public function execute(HTTPRequestCustom $request) { $this->load_lang(); $this->load_config(); $this->build_form(); $tpl = new StringTemplate('# INCLUDE MSG # # INCLUDE FORM #'); $tpl->add_lang($this->lang); if ($this->submit_button->has_been_submited() && $this->form->validate()) { $favicon = $this->form->get_value('favicon', null); if ($favicon !== null) { $file_type = new FileType(new File($favicon->get_name())); if ($file_type->is_picture()) { $this->save($favicon); $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('process.success', 'status-messages-common'), MessageHelper::SUCCESS, 4)); } else { $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('process.error', 'status-messages-common'), MessageHelper::ERROR, 4)); } } else { $tpl->put('MSG', MessageHelper::display($this->lang['customization.favicon.error'], MessageHelper::ERROR, 4)); } } $tpl->put('FORM', $this->form->display()); return new AdminCustomizationDisplayResponse($tpl, $this->lang['customization.interface']); }