private function assign_template(Template $tpl)
 {
     $tpl->put('CONTENT', 'fruits:');
     foreach ($this->fruits as $fruit) {
         $tpl->assign_block_vars('elements', array('NAME' => $fruit));
     }
 }
Example #2
0
 private function generate_pagination()
 {
     $nb_pages = $this->get_nb_pages();
     $pagination = new Pagination($nb_pages, $this->page_number);
     $pagination->set_url_builder_callback(array($this->parameters, 'get_pagination_url'));
     $this->tpl->put('pagination', $pagination->export());
 }
 public static function add_filter_fieldset(Menu $menu, Template $tpl)
 {
     $tpl_filter = new FileTemplate('admin/menus/filters.tpl');
     $tpl_filter->assign_block_vars('modules', array('ID' => ''));
     foreach (ModulesManager::get_activated_modules_map_sorted_by_localized_name() as $module) {
         $configuration = $module->get_configuration();
         $home_page = $configuration->get_home_page();
         if (!empty($home_page)) {
             $tpl_filter->assign_block_vars('modules', array('ID' => $module->get_id()));
         }
     }
     //Ajout du menu
     if ($menu->get_id() == '') {
         $menu->set_filters(array(new MenuStringFilter('/')));
     }
     // Installed modules
     foreach ($menu->get_filters() as $key => $filter) {
         $filter_pattern = $filter->get_pattern();
         $filter_infos = explode('/', $filter_pattern);
         $module_name = $filter_infos[0];
         $regex = substr(strstr($filter_pattern, '/'), 1);
         $tpl_filter->assign_block_vars('filters', array('ID' => $key, 'FILTER' => $regex));
         $tpl_filter->assign_block_vars('filters.modules', array('ID' => '', 'SELECTED' => $filter_pattern == '/' ? ' selected="selected"' : ''));
         foreach (ModulesManager::get_activated_modules_map_sorted_by_localized_name() as $module) {
             $configuration = $module->get_configuration();
             $home_page = $configuration->get_home_page();
             if (!empty($home_page)) {
                 $tpl_filter->assign_block_vars('filters.modules', array('ID' => $module->get_id(), 'SELECTED' => $module_name == $module->get_id() ? ' selected="selected"' : ''));
             }
         }
     }
     $tpl_filter->add_lang(LangLoader::get('admin-menus-common'));
     $tpl_filter->put_all(array('NBR_FILTER' => $menu->get_id() == '' ? 0 : count($menu->get_filters()) - 1));
     $tpl->put('filters', $tpl_filter);
 }
 private function add_language_bar()
 {
     $lang = AppContext::get_request()->get_string('lang', self::UPDATE_DEFAULT_LANGUAGE);
     $lang_dir = new Folder(PATH_TO_ROOT . '/lang');
     $langs = array();
     foreach ($lang_dir->get_folders('`^[a-z_-]+$`i') as $folder) {
         $info_lang = load_ini_file(PATH_TO_ROOT . '/lang/', $folder->get_name());
         if (!empty($info_lang['name'])) {
             $langs[] = array('LANG' => $folder->get_name(), 'LANG_NAME' => $info_lang['name'], 'SELECTED' => $folder->get_name() == $lang ? 'selected="selected"' : '');
             if ($folder->get_name() == $lang) {
                 $this->full_view->put('LANG_IDENTIFIER', $info_lang['identifier']);
             }
         }
     }
     $this->full_view->put('lang', $langs);
 }
 /**
  * @param Template $view
  * @return InstallDisplayResponse
  */
 private function create_response()
 {
     $this->view = new FileTemplate('install/website.tpl');
     $this->view->put('WEBSITE_FORM', $this->form->display());
     $step_title = $this->lang['step.websiteConfig.title'];
     $response = new InstallDisplayResponse(4, $step_title, $this->view);
     return $response;
 }
 private function check_folders_permissions()
 {
     $folders = array();
     foreach (PHPBoostFoldersPermissions::get_permissions() as $folder_name => $folder) {
         $folders[] = array('NAME' => $folder_name, 'EXISTS' => $folder->exists(), 'IS_WRITABLE' => $folder->is_writable());
     }
     $this->view->put('folder', $folders);
 }
 /**
  * @return InstallDisplayResponse
  */
 private function create_response()
 {
     $this->view = new FileTemplate('install/admin.tpl');
     $this->view->put('ADMIN_FORM', $this->form->display());
     $step_title = $this->lang['step.admin.title'];
     $response = new InstallDisplayResponse(5, $step_title, $this->view);
     return $response;
 }
 private function add_language_bar()
 {
     $lang = TextHelper::htmlspecialchars(AppContext::get_request()->get_string('lang', InstallController::DEFAULT_LOCALE));
     $lang = in_array($lang, InstallationServices::get_available_langs()) ? $lang : InstallController::DEFAULT_LOCALE;
     $lang_dir = new Folder(PATH_TO_ROOT . '/lang');
     $langs = array();
     foreach ($lang_dir->get_folders('`^[a-z_-]+$`i') as $folder) {
         $info_lang = load_ini_file(PATH_TO_ROOT . '/lang/', $folder->get_name());
         if (!empty($info_lang['name'])) {
             $langs[] = array('LANG' => $folder->get_name(), 'LANG_NAME' => $info_lang['name'], 'SELECTED' => $folder->get_name() == $lang ? 'selected="selected"' : '');
             if ($folder->get_name() == $lang) {
                 $this->full_view->put('LANG_IDENTIFIER', $info_lang['identifier']);
             }
         }
     }
     $this->full_view->put('lang', $langs);
 }
 private function add_navigation(Template $view)
 {
     $form = new HTMLForm('preambleForm', InstallUrlBuilder::license()->rel(), false);
     $action_fieldset = new FormFieldsetSubmit('actions');
     $next = new FormButtonSubmitCssImg($this->lang['step.next'], 'fa fa-arrow-right', 'welcome');
     $action_fieldset->add_element($next);
     $form->add_fieldset($action_fieldset);
     $view->put('LICENSE_FORM', $form->display());
 }
 private function add_navigation(Template $view)
 {
     $form = new HTMLForm('continueForm', '#error', false);
     $action_fieldset = new FormFieldsetSubmit('actions');
     $back = new FormButtonLinkCssImg($this->lang['step.previous'], UpdateServices::database_config_file_checked() ? UpdateUrlBuilder::server_configuration() : UpdateUrlBuilder::database(), 'fa fa-arrow-left');
     $action_fieldset->add_element($back);
     $this->submit = new FormButtonSubmitCssImg($this->lang['step.next'], 'fa fa-arrow-right', 'finish');
     $action_fieldset->add_element($this->submit);
     $form->add_fieldset($action_fieldset);
     $view->put('SERVER_FORM', $form->display());
 }
 /**
  * @return InstallDisplayResponse
  */
 private function create_response()
 {
     $this->view = new FileTemplate('install/database.tpl');
     $this->view->put('DATABASE_FORM', $this->form->display());
     if (!empty($this->error)) {
         $this->view->put('ERROR', $this->error);
     }
     $step_title = $this->lang['step.dbConfig.title'];
     $response = new InstallDisplayResponse(3, $step_title, $this->view);
     return $response;
 }
 protected function display_menus(Template $template)
 {
     $menus = MenusCache::load()->get_menus();
     $columns_disabled = ThemesManager::get_theme(AppContext::get_current_user()->get_theme())->get_columns_disabled();
     foreach ($menus as $cached_menu) {
         $menu = $cached_menu->get_menu();
         if ($menu->check_auth() && !$columns_disabled->menus_column_is_disabled($menu->get_block())) {
             $display = false;
             $filters = $menu->get_filters();
             $nbr_filters = count($filters);
             foreach ($filters as $filter) {
                 if ($nbr_filters > 1 && $filter->get_pattern() != '/' || $filter->match() && !$display) {
                     $display = true;
                 }
             }
             if ($display) {
                 $menu_content = $cached_menu->has_cached_string() ? $cached_menu->get_cached_string() : $menu->display();
                 $block = $menu->get_block();
                 switch ($block) {
                     case Menu::BLOCK_POSITION__HEADER:
                         $template->put('C_MENUS_HEADER_CONTENT', true);
                         $template->assign_block_vars('menus_header', array('MENU' => $menu_content));
                         break;
                     case Menu::BLOCK_POSITION__SUB_HEADER:
                         $template->put('C_MENUS_SUB_HEADER_CONTENT', true);
                         $template->assign_block_vars('menus_sub_header', array('MENU' => $menu_content));
                         break;
                     case Menu::BLOCK_POSITION__LEFT:
                         $template->put('C_MENUS_LEFT_CONTENT', true);
                         $template->assign_block_vars('menus_left', array('MENU' => $menu_content));
                         break;
                     case Menu::BLOCK_POSITION__RIGHT:
                         $template->put('C_MENUS_RIGHT_CONTENT', true);
                         $template->assign_block_vars('menus_right', array('MENU' => $menu_content));
                         break;
                     case Menu::BLOCK_POSITION__TOP_CENTRAL:
                         $template->put('C_MENUS_TOPCENTRAL_CONTENT', true);
                         $template->assign_block_vars('menus_top_central', array('MENU' => $menu_content));
                         break;
                     case Menu::BLOCK_POSITION__BOTTOM_CENTRAL:
                         $template->put('C_MENUS_BOTTOM_CENTRAL_CONTENT', true);
                         $template->assign_block_vars('menus_bottom_central', array('MENU' => $menu_content));
                         break;
                     case Menu::BLOCK_POSITION__TOP_FOOTER:
                         $template->put('C_MENUS_TOP_FOOTER_CONTENT', true);
                         $template->assign_block_vars('menus_top_footer', array('MENU' => $menu_content));
                         break;
                     case Menu::BLOCK_POSITION__FOOTER:
                         $template->put('C_MENUS_FOOTER_CONTENT', true);
                         $template->assign_block_vars('menus_footer', array('MENU' => $menu_content));
                 }
             }
         }
     }
 }
 protected function assign_common_template_variables(Template $template)
 {
     $has_js_validations = false;
     $js_tpl = new FileTemplate('framework/builder/form/AddFieldJS.tpl');
     foreach ($this->get_related_fields() as $field) {
         $js_tpl->assign_block_vars('related_field', array('ID' => $field));
         $has_js_validations = true;
     }
     foreach ($this->events as $event => $handler) {
         $js_tpl->assign_block_vars('event_handler', array('EVENT' => $event, 'HANDLER' => $handler));
         $has_js_validations = true;
     }
     foreach ($this->get_js_validations() as $constraint) {
         $js_tpl->assign_block_vars('constraint', array('CONSTRAINT' => $constraint));
         $has_js_validations = true;
     }
     $js_tpl->put_all(array('C_DISABLED' => $this->is_disabled(), 'C_HAS_CONSTRAINTS' => $this->has_constraints(), 'ID' => $this->get_id(), 'HTML_ID' => $this->get_html_id(), 'JS_SPECIALIZATION_CODE' => $this->get_js_specialization_code(), 'FORM_ID' => $this->form_id, 'FIELDSET_ID' => $this->fieldset_id));
     $template->put('ADD_FIELD_JS', $js_tpl);
     $description = $this->get_description();
     $template->put_all(array('ID' => $this->get_id(), 'HTML_ID' => $this->get_html_id(), 'NAME' => $this->get_html_id(), 'LABEL' => $this->get_label(), 'DESCRIPTION' => $description, 'C_DESCRIPTION' => !empty($description), 'C_REQUIRED' => $this->is_required(), 'C_REQUIRED_AND_HAS_VALUE' => $this->is_required() && (!empty($this->value) || $this->value == '0'), 'VALUE' => $this->get_value(), 'C_HAS_CONSTRAINTS' => $this->has_constraints(), 'CLASS' => $this->get_css_class(), 'FIELD_CLASS' => $this->get_css_field_class(), 'C_HAS_FIELD_CLASS' => $this->get_css_field_class() != '', 'FORM_FIELD_CLASS' => $this->get_css_form_field_class(), 'C_HAS_FORM_FIELD_CLASS' => $this->get_css_form_field_class() != '', 'FORM_ID' => $this->form_id, 'FIELDSET_ID' => $this->fieldset_id, 'C_HAS_LABEL' => !empty($description) || $this->get_label() != '', 'C_DISABLED' => $this->is_disabled(), 'C_READONLY' => $this->is_readonly(), 'C_HIDDEN' => $this->is_hidden(), 'C_PATTERN' => $this->has_pattern(), 'PATTERN' => $this->pattern, 'C_PLACEHOLDER' => $this->has_placeholder(), 'PLACEHOLDER' => $this->placeholder));
 }
 public function send()
 {
     $this->full_view->put('links', $this->links);
     parent::send();
 }
Example #15
0
 private function assign(Template $tpl)
 {
     $tpl->put('TARGET', $this->target);
     $tpl->put('METHOD', $this->method);
     $events = array();
     foreach ($this->events as $event => $callback) {
         $events[] = array('NAME' => $event, 'CALLBACK' => $callback);
     }
     $tpl->put('event', $events);
     $params = array();
     foreach ($this->parameters as $key => $value) {
         $params[] = array('NAME' => $key, 'VALUE' => $value);
     }
     $tpl->put('param', $params);
 }
 protected function assign_template_fields(Template $template)
 {
     $js_tpl = new FileTemplate('framework/builder/form/AddFieldsetJS.tpl');
     $js_tpl->put_all(array('ID' => $this->id, 'HTML_ID' => $this->get_html_id(), 'C_DISABLED' => $this->disabled, 'FORM_ID' => $this->form_id));
     $template->put('ADD_FIELDSET_JS', $js_tpl);
     $template->put_all(array('C_DESCRIPTION' => !empty($this->description), 'DESCRIPTION' => $this->description, 'ID' => $this->id, 'HTML_ID' => $this->get_html_id(), 'C_DISABLED' => $this->disabled, 'CSS_CLASS' => $this->css_class, 'FORM_ID' => $this->form_id));
     foreach ($this->elements as $element) {
         $template->assign_block_vars('elements', array(), array('ELEMENT' => $element->display()));
     }
 }