コード例 #1
0
 private function build_form($theme_selected)
 {
     $form = new HTMLForm(__CLASS__);
     $theme_choise_fieldset = new FormFieldsetHTML('theme-choice', $this->lang['customization.interface.theme-choice']);
     $form->add_fieldset($theme_choise_fieldset);
     $theme_choise_fieldset->add_field(new FormFieldSimpleSelectChoice('select_theme', $this->lang['customization.interface.select-theme'], $theme_selected, $this->list_themes(), array('events' => array('change' => 'document.location.href = "' . AdminCustomizeUrlBuilder::customize_interface()->rel() . '" + HTMLForms.getField(\'select_theme\').getValue()'))));
     $customize_interface_fieldset = new FormFieldsetHTML('customize_interface', $this->lang['customization.interface']);
     $form->add_fieldset($customize_interface_fieldset);
     $header_logo_path = $this->get_header_logo_path($theme_selected);
     if (!empty($header_logo_path)) {
         $header_logo_file = new File(PATH_TO_ROOT . $header_logo_path);
         if ($header_logo_file->exists()) {
             $picture = '<img src="' . Url::to_rel($header_logo_file->get_path()) . '" alt="' . $this->lang['customization.interface.logo.current'] . '" title="' . $this->lang['customization.interface.logo.current'] . '"/>';
             $customize_interface_fieldset->add_field(new FormFieldFree('current_logo', $this->lang['customization.interface.logo.current'], $picture));
         } else {
             $customize_interface_fieldset->add_field(new FormFieldFree('current_logo', $this->lang['customization.interface.logo.current'], '<span class="text-strong color-alert">' . $this->lang['customization.interface.logo.current.erased'] . '</span>'));
         }
     } else {
         $customize_interface_fieldset->add_field(new FormFieldFree('current_logo', $this->lang['customization.interface.logo.current'], $this->lang['customization.interface.logo.current.null']));
     }
     $customize_interface_fieldset->add_field(new FormFieldFilePicker('header_logo', $this->lang['customization.interface.logo.current.change'], array('description' => $this->lang['customization.interface.logo.current.change-explain'])));
     $customize_interface_fieldset->add_field(new FormFieldCheckbox('use_default_logo', $this->lang['customization.interface.logo.use-default'], FormFieldCheckbox::UNCHECKED));
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $form->add_button(new FormButtonReset());
     $this->form = $form;
 }
コード例 #2
0
 public function get_actions_tree_links()
 {
     $lang = LangLoader::get('common', 'customization');
     $tree = new ModuleTreeLinks();
     $tree->add_link(new AdminModuleLink($lang['interface'], AdminCustomizeUrlBuilder::customize_interface()));
     $tree->add_link(new AdminModuleLink($lang['favicon'], AdminCustomizeUrlBuilder::customize_favicon()));
     $tree->add_link(new AdminModuleLink($lang['css-files'], AdminCustomizeUrlBuilder::editor_css_file()));
     $tree->add_link(new AdminModuleLink($lang['tpl-files'], AdminCustomizeUrlBuilder::editor_tpl_file()));
     return $tree;
 }
コード例 #3
0
 public function __construct($view, $title_page)
 {
     parent::__construct($view);
     $lang = LangLoader::get('common', 'customization');
     $this->set_title($lang['customization']);
     $this->add_link($lang['customization.interface'], AdminCustomizeUrlBuilder::customize_interface());
     $this->add_link($lang['customization.favicon'], AdminCustomizeUrlBuilder::customize_favicon());
     $this->add_link($lang['customization.editor.css-files'], AdminCustomizeUrlBuilder::editor_css_file());
     $this->add_link($lang['customization.editor.tpl-files'], AdminCustomizeUrlBuilder::editor_tpl_file());
     $env = $this->get_graphical_environment();
     $env->set_page_title($title_page);
 }
 private function build_form($theme_selected, $module_selected, $file_name, $file_selected)
 {
     $form = new HTMLForm(__CLASS__);
     $theme_choise_fieldset = new FormFieldsetHTML('theme-choice', $this->lang['customization.interface.theme-choice']);
     $form->add_fieldset($theme_choise_fieldset);
     $theme_choise_fieldset->add_field(new FormFieldSimpleSelectChoice('select_theme', $this->lang['customization.interface.select-theme'], $theme_selected, $this->list_themes(), array('events' => array('change' => 'document.location.href = "' . AdminCustomizeUrlBuilder::editor_tpl_file()->rel() . '" + HTMLForms.getField(\'select_theme\').getValue()'))));
     if (!empty($theme_selected)) {
         $file_editor_fieldset = new FormFieldsetHTML('file-editor', $this->lang['customization.editor.tpl-files']);
         $form->add_fieldset($file_editor_fieldset);
         $file_editor_fieldset->add_field(new FormFieldSimpleSelectChoice('select_file', $this->lang['customization.editor.files.select'], $file_selected, $this->list_files($theme_selected), array('events' => array('change' => 'document.location.href = "' . AdminCustomizeUrlBuilder::editor_tpl_file($theme_selected)->rel() . '" + "/" + HTMLForms.getField(\'select_file\').getValue()'))));
         if (!empty($file_selected)) {
             if (!empty($module_selected)) {
                 $modules_folder = new File(PATH_TO_ROOT . $this->templates_path . $theme_selected . $this->tpl_modules_files_path);
                 if (!$modules_folder->exists()) {
                     mkdir(PATH_TO_ROOT . $this->templates_path . $theme_selected . $this->tpl_modules_files_path);
                 }
                 $module_folder = new File(PATH_TO_ROOT . $this->templates_path . $theme_selected . $this->tpl_modules_files_path . $module_selected);
                 if (!$module_folder->exists()) {
                     mkdir(PATH_TO_ROOT . $this->templates_path . $theme_selected . $this->tpl_modules_files_path . $module_selected);
                 }
                 $this->tpl_file = new File(PATH_TO_ROOT . $this->templates_path . $theme_selected . $this->tpl_modules_files_path . $module_selected . '/' . $file_name);
                 if (!$this->tpl_file->exists()) {
                     copy(PATH_TO_ROOT . '/' . $module_selected . '/templates/' . $file_name, PATH_TO_ROOT . $this->templates_path . $theme_selected . $this->tpl_modules_files_path . $module_selected . '/' . $file_name);
                 }
             } else {
                 $this->tpl_file = new File(PATH_TO_ROOT . $this->templates_path . $theme_selected . $this->tpl_files_path . $file_name);
             }
             $file_editor_fieldset->add_field(new FormFieldMultiLineTextEditor('tpl_file', $this->lang['customization.editor.files.content'], $this->tpl_file->read(), array('rows' => 30)));
         }
     }
     if (!empty($theme_selected) && !empty($file_selected)) {
         $this->submit_button = new FormButtonDefaultSubmit();
         $form->add_button($this->submit_button);
         $form->add_button(new FormButtonReset());
     }
     $this->form = $form;
 }