コード例 #1
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;
 }
コード例 #2
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_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_css_file()->rel() . '" + HTMLForms.getField(\'select_theme\').getValue()'))));
     if (!empty($theme_selected)) {
         $file_editor_fieldset = new FormFieldsetHTML('file-editor', $this->lang['customization.editor.css-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_css_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->css_modules_files_path);
                 if (!$modules_folder->exists()) {
                     mkdir(PATH_TO_ROOT . $this->templates_path . $theme_selected . $this->css_modules_files_path);
                 }
                 $module_folder = new File(PATH_TO_ROOT . $this->templates_path . $theme_selected . $this->css_modules_files_path . $module_selected);
                 if (!$module_folder->exists()) {
                     mkdir(PATH_TO_ROOT . $this->templates_path . $theme_selected . $this->css_modules_files_path . $module_selected);
                 }
                 $this->css_file = new File(PATH_TO_ROOT . $this->templates_path . $theme_selected . $this->css_modules_files_path . $module_selected . '/' . $file_selected);
                 if (!$this->css_file->exists()) {
                     copy(PATH_TO_ROOT . '/' . $module_selected . '/templates/' . $file_selected, PATH_TO_ROOT . $this->templates_path . $theme_selected . $this->css_modules_files_path . $module_selected . '/' . $file_selected);
                 }
             } else {
                 $this->css_file = new File(PATH_TO_ROOT . $this->templates_path . $theme_selected . $this->css_files_path . $file_selected);
             }
             $file_editor_fieldset->add_field(new FormFieldMultiLineTextEditor('css_file', $this->lang['customization.editor.files.content'], $this->css_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;
 }