public function get_content() { $tpl = new FileTemplate('newsletter/newsletter_mini.tpl'); $tpl->add_lang(LangLoader::get('common', 'newsletter')); $tpl->put('USER_MAIL', AppContext::get_current_user()->get_email()); return $tpl; }
private static function get_subheader_tpl() { $subheader_lang = LangLoader::get('admin-links-common'); $subheader_tpl = new FileTemplate('admin/subheader_menu.tpl'); $subheader_tpl->add_lang($subheader_lang); $modules = ModulesManager::get_activated_modules_map_sorted_by_localized_name(); $modules_number = 0; foreach ($modules as $module) { if ($module->get_configuration()->get_admin_menu() == 'modules') { $modules_number++; } } $subheader_tpl->put_all(array('L_ADD' => $subheader_lang['add'], 'L_ADMINISTRATION' => $subheader_lang['administration'], 'L_MANAGEMENT' => $subheader_lang['management'], 'L_CONFIGURATION' => $subheader_lang['configuration'], 'L_CONFIG_GENERAL' => $subheader_lang['administration.configuration.general'], 'L_CONFIG_ADVANCED' => $subheader_lang['administration.configuration.advanced'], 'L_MAIL_CONFIG' => $subheader_lang['administration.configuration.mail'], 'L_THEMES' => $subheader_lang['administration.themes'], 'L_LANGS' => $subheader_lang['administration.langs'], 'L_SMILEY' => $subheader_lang['administration.smileys'], 'L_ADMINISTRATOR_ALERTS' => $subheader_lang['administration.alerts'], 'L_TOOLS' => $subheader_lang['tools'], 'L_UPDATES' => $subheader_lang['updates'], 'L_KERNEL' => $subheader_lang['tools.updates.kernel'], 'L_MAINTAIN' => $subheader_lang['tools.maintain'], 'L_CACHE' => $subheader_lang['tools.cache'], 'L_SYNDICATION_CACHE' => $subheader_lang['tools.cache.syndication'], 'L_CSS_CACHE_CONFIG' => $subheader_lang['tools.cache.css'], 'L_ERRORS' => $subheader_lang['tools.errors-archived'], 'L_404_ERRORS' => $subheader_lang['tools.404-errors-archived'], 'L_SERVER' => $subheader_lang['tools.server'], 'L_PHPINFO' => $subheader_lang['tools.server.phpinfo'], 'L_SYSTEM_REPORT' => $subheader_lang['tools.server.system-report'], 'L_USER' => $subheader_lang['users'], 'L_PUNISHEMENT' => $subheader_lang['users.punishement'], 'L_GROUP' => $subheader_lang['users.groups'], 'L_EXTEND_FIELD' => $subheader_lang['users.extended-fields'], 'L_CONTENT' => $subheader_lang['content'], 'L_CONTENT_CONFIG' => $subheader_lang['content'], 'L_MENUS' => $subheader_lang['content.menus'], 'L_ADD_CONTENT_MENU' => $subheader_lang['content.menus.content'], 'L_ADD_LINKS_MENU' => $subheader_lang['content.menus.links'], 'L_ADD_FEED_MENU' => $subheader_lang['content.menus.feed'], 'L_FILES' => $subheader_lang['content.files'], 'L_COMMENTS' => $subheader_lang['content.comments'], 'L_MODULES' => $subheader_lang['modules'], 'U_NBR_MODULES' => ceil(($modules_number + 1) / 7), 'U_INDEX_SITE' => Environment::get_home_page(), 'C_ADMIN_LINKS_1' => false, 'C_ADMIN_LINKS_2' => false, 'C_ADMIN_LINKS_3' => false, 'C_ADMIN_LINKS_4' => false, 'C_ADMIN_LINKS_5' => false, 'C_ADMIN_LINKS_1' => false)); $array_pos = array(0, 4, 4, 3, 3, 1); $menus_numbers = array('index' => 1, 'administration' => 2, 'tools' => 3, 'members' => 4, 'content' => 5, 'modules' => 6); foreach ($modules as $module) { $module_id = $module->get_id(); $configuration = $module->get_configuration(); $menu_pos_name = $configuration->get_admin_menu(); $menu_pos = 0; if (!empty($menu_pos_name) && !empty($menus_numbers[$menu_pos_name])) { $menu_pos = $menus_numbers[$menu_pos_name]; } if ($menu_pos > 0) { $array_pos[$menu_pos - 1]++; $idmenu = $array_pos[$menu_pos - 1]; $subheader_tpl->put('C_ADMIN_LINKS_' . $menu_pos, true); $subheader_tpl->assign_block_vars('admin_links_' . $menu_pos, array('MODULE_MENU' => ModuleTreeLinksService::display_admin_actions_menu($module))); } } return $subheader_tpl; }
public function get_menu_content() { $tpl = new FileTemplate('calendar/CalendarModuleMiniMenu.tpl'); $tpl->add_lang(LangLoader::get('common', 'calendar')); $tpl->put('CALENDAR', CalendarAjaxCalendarController::get_view(true)); return $tpl->render(); }
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); }
public function display() { $tpl = new FileTemplate('ReCaptcha/ReCaptcha.tpl'); $this->lang = LangLoader::get('common', 'ReCaptcha'); $tpl->add_lang($this->lang); $tpl->put_all(array('C_RECAPTCHA_V2' => $this->is_recaptcha_v2, 'SITE_KEY' => $this->is_recaptcha_v2 ? $this->config->get_site_key() : self::DEFAULT_SITE_KEY, 'HTML_ID' => $this->get_html_id())); return $tpl->render(); }
private function build_view() { $config_html = new SitemapExportConfig('sitemap/export/sitemap.html.tpl', 'sitemap/export/module_map.html.tpl', 'sitemap/export/sitemap_section.html.tpl', 'sitemap/export/sitemap_link.html.tpl'); $sitemap = SitemapService::get_personal_sitemap(); $tpl = new FileTemplate('sitemap/ViewSitemapController.tpl'); $tpl->add_lang($this->lang); $tpl->put('SITEMAP', $sitemap->export($config_html)); return $tpl; }
private function build_response(View $view) { $body_view = new FileTemplate('newsletter/NewsletterBody.tpl'); $body_view->add_lang($this->lang); $body_view->put('TEMPLATE', $view); $response = new SiteDisplayResponse($body_view); $breadcrumb = $response->get_graphical_environment()->get_breadcrumb(); $breadcrumb->add($this->lang['newsletter'], NewsletterUrlBuilder::home()->rel()); $breadcrumb->add($this->lang['unsubscribe.newsletter'], NewsletterUrlBuilder::unsubscribe()->rel()); $graphical_environment = $response->get_graphical_environment(); $graphical_environment->set_page_title($this->lang['unsubscribe.newsletter'], $this->lang['newsletter']); $graphical_environment->get_seo_meta_data()->set_canonical_url(NewsletterUrlBuilder::unsubscribe()); return $response; }
function display() { $template = $this->get_template_to_use(); $tpl = new FileTemplate('QuestionCaptcha/QuestionCaptchaFormFieldQuestions.tpl'); $tpl->add_lang(LangLoader::get('common', 'QuestionCaptcha')); $this->assign_common_template_variables($template); $i = 1; foreach ($this->get_value() as $id => $options) { $tpl->assign_block_vars('fieldelements', array('ID' => $i, 'LABEL' => $options['label'], 'ANSWERS' => $options['answers'], 'C_DELETE' => $i > 1)); $i++; } $tpl->put_all(array('NAME' => $this->get_html_id(), 'HTML_ID' => $this->get_html_id(), 'C_DISABLED' => $this->is_disabled(), 'MAX_INPUT' => $this->max_input, 'NBR_QUESTIONS' => $i)); $template->assign_block_vars('fieldelements', array('ELEMENT' => $tpl->render())); return $template; }
public function execute(HTTPRequestCustom $request) { $view = new FileTemplate('sitemap/GenerateXMLSitemapController.tpl'); $lang = LangLoader::get('common', 'sitemap'); $view->add_lang($lang); try { SitemapXMLFileService::try_to_generate(); } catch (IOException $ex) { $view->put_all(array('C_GOT_ERROR' => true)); } $view->put_all(array('U_GENERATE' => SitemapUrlBuilder::get_xml_file_generation()->rel())); $response = new AdminSitemapResponse($view); $response->get_graphical_environment()->set_page_title($lang['generate_xml_file'], $lang['sitemap']); return $response; }
public function get_menu_content() { //Create file template $tpl = new FileTemplate('guestbook/GuestbookModuleMiniMenu.tpl'); //Assign the lang file to the tpl $tpl->add_lang(LangLoader::get('common', 'guestbook')); $tpl->put('U_GUESTBOOK', GuestbookUrlBuilder::home()->rel()); $guestbook_cache = GuestbookMessagesCache::load(); $random_message = $guestbook_cache->get_message(array_rand($guestbook_cache->get_messages())); if ($random_message !== null) { $user_group_color = User::get_group_color($random_message['groups'], $random_message['level']); $tpl->put_all(array('C_ANY_MESSAGE_GUESTBOOK' => true, 'C_USER_GROUP_COLOR' => !empty($user_group_color), 'C_MORE_CONTENTS' => strlen($random_message['contents']) >= 200, 'C_VISITOR' => empty($random_message['user_id']), 'CONTENTS' => $random_message['contents'], 'SHORT_CONTENTS' => nl2br(TextHelper::substr_html($random_message['contents'], 0, 200)), 'USER_PSEUDO' => $random_message['login'], 'USER_LEVEL_CLASS' => UserService::get_level_class($random_message['level']), 'USER_GROUP_COLOR' => $user_group_color, 'U_MESSAGE' => GuestbookUrlBuilder::home($random_message['page'], $random_message['id'])->rel(), 'U_PROFILE' => UserUrlBuilder::profile($random_message['user_id'])->rel())); } return $tpl->render(); }
public function get_menu_content() { //Create file template $tpl = new FileTemplate('web/WebModuleMiniMenu.tpl'); //Assign the lang file to the tpl $tpl->add_lang(LangLoader::get('common', 'web')); //Load module cache $web_cache = WebCache::load(); $partners_weblinks = $web_cache->get_partners_weblinks(); $tpl->put('C_PARTNERS', !empty($partners_weblinks)); foreach ($partners_weblinks as $partner) { $partner_picture = new Url($partner['partner_picture']); $picture = $partner_picture->rel(); $tpl->assign_block_vars('partners', array('C_HAS_PARTNER_PICTURE' => !empty($picture), 'NAME' => $partner['name'], 'U_PARTNER_PICTURE' => $picture, 'U_VISIT' => WebUrlBuilder::visit($partner['id'])->rel())); } return $tpl->render(); }
function display() { $template = $this->get_template_to_use(); $lang = LangLoader::get('admin-user-common'); $tpl = new FileTemplate('contact/ContactFormFieldRecipientsPossibleValues.tpl'); $tpl->add_lang($lang); $this->assign_common_template_variables($template); $i = 0; foreach ($this->get_value() as $name => $options) { if (!empty($options)) { $tpl->assign_block_vars('fieldelements', array('C_DELETABLE' => $i > 0, 'ID' => $i, 'NAME' => stripslashes($options['title']), 'IS_DEFAULT' => (int) $options['is_default'], 'EMAIL' => $i > 0 ? stripslashes($options['email']) : implode(',', MailServiceConfig::load()->get_administrators_mails()))); $i++; } } $tpl->put_all(array('NAME' => $this->get_html_id(), 'HTML_ID' => $this->get_html_id(), 'C_DISABLED' => $this->is_disabled(), 'MAX_INPUT' => $this->max_input, 'NBR_FIELDS' => $i)); $template->assign_block_vars('fieldelements', array('ELEMENT' => $tpl->render())); return $template; }
private function build_children_view($template, $categories, $id_parent) { foreach ($categories as $id => $category) { if ($category->get_id_parent() == $id_parent && $id != Category::ROOT_CATEGORY) { $description = ''; if (method_exists($category, 'get_description')) { $description = FormatingHelper::second_parse($category->get_description()); $description = strlen($description) > 250 ? substr(@strip_tags($description, '<br><br/>'), 0, 250) . '...' : $description; } $description_exists = method_exists($category, 'get_description'); $category_view = new FileTemplate('default/framework/content/categories/category.tpl'); $category_view->add_lang($this->lang); $category_view->put_all(array('C_DESCRIPTION' => !empty($description), 'U_DISPLAY' => $this->get_display_category_url($category)->rel(), 'U_EDIT' => $this->get_edit_category_url($category)->rel(), 'U_DELETE' => $this->get_delete_category_url($category)->rel(), 'ID' => $id, 'NAME' => $category->get_name(), 'DESCRIPTION' => $description)); $this->build_children_view($category_view, $categories, $id); $template->assign_block_vars('childrens', array('child' => $category_view->render())); } } }
function display() { $template = $this->get_template_to_use(); $tpl = new FileTemplate('news/NewsFormFieldSelectSources.tpl'); $tpl->add_lang(LangLoader::get('common')); $tpl->put_all(array('NAME' => $this->get_html_id(), 'ID' => $this->get_html_id(), 'C_DISABLED' => $this->is_disabled())); $this->assign_common_template_variables($template); $i = 0; foreach ($this->get_value() as $name => $value) { $tpl->assign_block_vars('fieldelements', array('ID' => $i, 'VALUE' => $value, 'NAME' => $name)); $i++; } if ($i == 0) { $tpl->assign_block_vars('fieldelements', array('ID' => $i, 'VALUE' => '', 'NAME' => '')); } $tpl->put_all(array('NAME' => $this->get_html_id(), 'ID' => $this->get_html_id(), 'C_DISABLED' => $this->is_disabled(), 'MAX_INPUT' => $this->max_input, 'NBR_FIELDS' => $i == 0 ? 1 : $i)); $template->assign_block_vars('fieldelements', array('ELEMENT' => $tpl->render())); return $template; }
function display() { $template = $this->get_template_to_use(); $lang = LangLoader::get('common', 'contact'); $config = ContactConfig::load(); $tpl = new FileTemplate('contact/ContactFormFieldObjectPossibleValues.tpl'); $tpl->add_lang($lang); $this->assign_common_template_variables($template); $fields = $config->get_fields(); $recipients_field_id = $config->get_field_id_by_name('f_recipients'); $recipients_field = new ContactField(); $recipients_field->set_properties($fields[$recipients_field_id]); foreach ($recipients_field->get_possible_values() as $id => $options) { if (!empty($options)) { $tpl->assign_block_vars('recipients_list', array('ID' => $id, 'NAME' => stripslashes($options['title']))); } } $i = 0; foreach ($this->get_value() as $name => $options) { if (!empty($options)) { $tpl->assign_block_vars('fieldelements', array('ID' => $i, 'NAME' => stripslashes($options['title']), 'IS_DEFAULT' => (int) $options['is_default'])); foreach ($recipients_field->get_possible_values() as $id => $recipient_options) { if (!empty($recipient_options)) { $tpl->assign_block_vars('fieldelements.recipients_list', array('C_RECIPIENT_SELECTED' => $options['recipient'] == $id, 'ID' => $id, 'NAME' => stripslashes($recipient_options['title']))); } } $i++; } } if ($i == 0) { $tpl->assign_block_vars('fieldelements', array('ID' => $i, 'NAME' => '', 'IS_DEFAULT' => 0)); foreach ($recipients_field->get_possible_values() as $id => $options) { if (!empty($options)) { $tpl->assign_block_vars('fieldelements.recipients_list', array('ID' => $id, 'NAME' => stripslashes($options['title']))); } } $i++; } $tpl->put_all(array('NAME' => $this->get_html_id(), 'HTML_ID' => $this->get_html_id(), 'C_DISABLED' => $this->is_disabled(), 'MAX_INPUT' => $this->max_input, 'NBR_FIELDS' => $i)); $template->assign_block_vars('fieldelements', array('ELEMENT' => $tpl->render())); return $template; }
public function get_menu_content() { //Create file template $tpl = new FileTemplate('shoutbox/ShoutboxModuleMiniMenu.tpl'); //Assign the lang file to the tpl $tpl->add_lang(LangLoader::get('common', 'shoutbox')); $config = ShoutboxConfig::load(); $forbidden_tags = array_flip($config->get_forbidden_formatting_tags()); if ($config->is_shout_bbcode_enabled()) { $smileys_cache = SmileysCache::load(); $smileys_per_line = 5; //Smileys par ligne. $smileys_displayed_number = 0; foreach ($smileys_cache->get_smileys() as $code_smile => $infos) { $smileys_displayed_number++; $tpl->assign_block_vars('smileys', array('C_END_LINE' => $smileys_displayed_number % $smileys_per_line == 0, 'URL' => TPL_PATH_TO_ROOT . '/images/smileys/' . $infos['url_smiley'], 'CODE' => addslashes($code_smile))); } } $tpl->put_all(array('C_MEMBER' => AppContext::get_current_user()->check_level(User::MEMBER_LEVEL), 'C_DISPLAY_FORM' => ShoutboxAuthorizationsService::check_authorizations()->write() && !AppContext::get_current_user()->is_readonly(), 'C_VALIDATE_ONKEYPRESS_ENTER' => $config->is_validation_onkeypress_enter_enabled(), 'C_DISPLAY_SHOUT_BBCODE' => ModulesManager::is_module_installed('BBCode') && $config->is_shout_bbcode_enabled(), 'C_BOLD_DISABLED' => isset($forbidden_tags['b']), 'C_ITALIC_DISABLED' => isset($forbidden_tags['i']), 'C_UNDERLINE_DISABLED' => isset($forbidden_tags['u']), 'C_STRIKE_DISABLED' => isset($forbidden_tags['s']), 'C_AUTOMATIC_REFRESH_ENABLED' => $config->is_automatic_refresh_enabled(), 'SHOUTBOX_PSEUDO' => AppContext::get_current_user()->get_display_name(), 'SHOUT_REFRESH_DELAY' => $config->get_refresh_delay(), 'L_ALERT_LINK_FLOOD' => sprintf(LangLoader::get_message('e_l_flood', 'errors'), $config->get_max_links_number_per_message()), 'SHOUTBOX_MESSAGES' => ShoutboxAjaxRefreshMessagesController::get_view())); return $tpl->render(); }
function display() { $template = $this->get_template_to_use(); $lang = LangLoader::get('admin-user-common'); $tpl = new FileTemplate('framework/builder/form/FormFieldPossibleValues.tpl'); $tpl->add_lang($lang); $this->assign_common_template_variables($template); $i = 0; foreach ($this->get_value() as $name => $options) { if (!empty($options)) { $tpl->assign_block_vars('fieldelements', array('ID' => $i, 'NAME' => $name, 'IS_DEFAULT' => (int) $options['is_default'], 'TITLE' => stripslashes($options['title']))); $i++; } } if ($i == 0) { $tpl->assign_block_vars('fieldelements', array('ID' => $i, 'NAME' => '', 'IS_DEFAULT' => 0, 'TITLE' => '')); $i++; } $tpl->put_all(array('NAME' => $this->get_html_id(), 'ID' => $this->get_id(), 'HTML_ID' => $this->get_html_id(), 'C_DISABLED' => $this->is_disabled(), 'MAX_INPUT' => $this->max_input, 'NBR_FIELDS' => $i)); $template->assign_block_vars('fieldelements', array('ELEMENT' => $tpl->render())); return $template; }
public function get_menu_content() { $tpl = new FileTemplate('online/OnlineModuleMiniMenu.tpl'); $lang = LangLoader::get('common', 'online'); $tpl->add_lang($lang); $online_config = OnlineConfig::load(); $condition = 'WHERE s.timestamp > :time ORDER BY ' . $online_config->get_display_order_request(); $parameters = array('time' => time() - SessionsConfig::load()->get_active_session_duration()); $users = OnlineService::get_online_users($condition, $parameters); foreach ($users as $user) { $this->incremente_level($user); if ($this->total_users <= $online_config->get_number_member_displayed()) { $group_color = User::get_group_color($user->get_groups(), $user->get_level(), true); if ($user->get_level() != User::VISITOR_LEVEL) { $tpl->assign_block_vars('users', array('U_PROFILE' => UserUrlBuilder::profile($user->get_id())->rel(), 'PSEUDO' => TextHelper::wordwrap_html($user->get_display_name(), 19), 'LEVEL_CLASS' => UserService::get_level_class($user->get_level()), 'C_GROUP_COLOR' => !empty($group_color), 'GROUP_COLOR' => $group_color)); } } } $main_lang = LangLoader::get('main'); $tpl->put_all(array('C_MORE_USERS' => $this->total_users > $online_config->get_number_member_displayed(), 'L_VISITOR' => $this->number_visitor > 1 ? $main_lang['guest_s'] : $main_lang['guest'], 'L_MEMBER' => $this->number_member > 1 ? $main_lang['member_s'] : $main_lang['member'], 'L_MODO' => $this->number_moderator > 1 ? $main_lang['modo_s'] : $main_lang['modo'], 'L_ADMIN' => $this->number_administrator > 1 ? $main_lang['admin_s'] : $main_lang['admin'], 'L_USERS_ONLINE' => $this->total_users > 1 ? $lang['online_users'] : $lang['online_user'], 'L_TOTAL' => $main_lang['total'], 'TOTAL_USERS_CONNECTED' => $this->total_users, 'TOTAL_VISITOR_CONNECTED' => $this->number_visitor, 'TOTAL_MEMBER_CONNECTED' => $this->number_member, 'TOTAL_MODERATOR_CONNECTED' => $this->number_moderator, 'TOTAL_ADMINISTRATOR_CONNECTED' => $this->number_administrator)); return $tpl->render(); }
public function get_menu_content() { //Create file template $tpl = new FileTemplate('faq/FaqModuleMiniMenu.tpl'); //Assign the lang file to the tpl $tpl->add_lang(LangLoader::get('common', 'faq')); //Load module cache $faq_cache = FaqCache::load(); //Get authorized categories for the current user $authorized_categories = FaqService::get_authorized_categories(Category::ROOT_CATEGORY); $categories = array_intersect($faq_cache->get_categories(), $authorized_categories); if (!empty($categories)) { $id_category = $categories[array_rand($categories)]; $category_questions = $faq_cache->get_category_questions($id_category); $random_question = $category_questions[array_rand($category_questions)]; if (!empty($random_question)) { $category = FaqService::get_categories_manager()->get_categories_cache()->get_category($id_category); $tpl->put_all(array('C_QUESTION' => true, 'QUESTION' => $random_question['question'], 'U_LINK' => FaqUrlBuilder::display($category->get_id(), $category->get_rewrited_name(), $random_question['id'])->rel())); } } return $tpl->render(); }
public function get_content() { $user = AppContext::get_current_user(); $theme_id = AppContext::get_request()->get_string('switchtheme', ''); if (!empty($theme_id)) { $theme = ThemesManager::get_theme($theme_id); if ($theme !== null) { if ($theme->is_activated() && $theme->check_auth()) { $user->update_theme($theme->get_id()); } } $query_string = preg_replace('`switchtheme=[^&]+`', '', QUERY_STRING); AppContext::get_response()->redirect(trim(HOST . SCRIPT . (!empty($query_string) ? '?' . $query_string : ''))); } $tpl = new FileTemplate('ThemesSwitcher/themeswitcher.tpl'); $tpl->add_lang(LangLoader::get('themeswitcher_common', 'ThemesSwitcher')); foreach (ThemesManager::get_activated_and_authorized_themes_map() as $id => $theme) { $selected = $user->get_theme() == $id ? ' selected="selected"' : ''; $tpl->assign_block_vars('themes', array('NAME' => $theme->get_configuration()->get_name(), 'IDNAME' => $id, 'SELECTED' => $selected)); } $tpl->put('DEFAULT_THEME', UserAccountsConfig::load()->get_default_theme()); return $tpl; }
public function get_menu_content() { //Create file template $tpl = new FileTemplate('download/DownloadModuleMiniMenu.tpl'); //Assign the lang file to the tpl $tpl->add_lang(LangLoader::get('common', 'download')); //Load module config $config = DownloadConfig::load(); //Load module cache $download_cache = DownloadCache::load(); //Load categories cache $categories_cache = DownloadService::get_categories_manager()->get_categories_cache(); $downloadfiles = $download_cache->get_downloadfiles(); $tpl->put_all(array('C_FILES' => !empty($downloadfiles), 'C_SORT_BY_DATE' => $config->is_sort_type_date(), 'C_SORT_BY_NOTATION' => $config->is_sort_type_notation(), 'C_SORT_BY_NUMBER_DOWNLOADS' => $config->is_sort_type_number_downloads())); $displayed_position = 1; foreach ($downloadfiles as $file) { $downloadfile = new DownloadFile(); $downloadfile->set_properties($file); $tpl->assign_block_vars('downloadfiles', array_merge($downloadfile->get_array_tpl_vars(), array('DISPLAYED_POSITION' => $displayed_position))); $displayed_position++; } return $tpl->render(); }
public function get_content() { $user = AppContext::get_current_user(); $lang_id = AppContext::get_request()->get_string('switchlang', ''); if (!empty($lang_id)) { $lang = LangsManager::get_lang($lang_id); if ($lang !== null) { if ($lang->is_activated() && $lang->check_auth()) { $user->update_lang($lang->get_id()); } } $query_string = preg_replace('`switchlang=[^&]+`', '', QUERY_STRING); AppContext::get_response()->redirect(trim(HOST . SCRIPT . (!empty($query_string) ? '?' . $query_string : ''))); } $tpl = new FileTemplate('LangsSwitcher/langswitcher.tpl'); $tpl->add_lang(LangLoader::get('langswitcher_common', 'LangsSwitcher')); foreach (LangsManager::get_activated_and_authorized_langs_map() as $id => $lang) { $selected = $user->get_locale() == $id ? ' selected="selected"' : ''; $tpl->assign_block_vars('langs', array('NAME' => $lang->get_configuration()->get_name(), 'IDNAME' => $id, 'SELECTED' => $selected)); } $lang_identifier = str_replace('en', 'uk', LangLoader::get_message('xml_lang', 'main')); $tpl->put_all(array('DEFAULT_LANG' => UserAccountsConfig::load()->get_default_lang(), 'IMG_LANG_IDENTIFIER' => TPL_PATH_TO_ROOT . '/images/stats/countries/' . $lang_identifier . '.png')); return $tpl; }
* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ###################################################*/ require_once '../admin/admin_begin.php'; define('TITLE', $LANG['administration']); require_once '../admin/admin_header.php'; $template = new FileTemplate('admin/admin_extend.tpl'); $template->add_lang(LangLoader::get('admin-links-common')); //Listing des modules disponibles foreach (ModulesManager::get_activated_modules_map_sorted_by_localized_name() as $module) { $configuration = $module->get_configuration(); $admin_home_page = $configuration->get_admin_main_page(); if (!empty($admin_home_page)) { $template->assign_block_vars('modules_extend', array('NAME' => $configuration->get_name(), 'IMG' => PATH_TO_ROOT . '/' . $module->get_id() . '/' . $module->get_id() . '.png', 'U_ADMIN_MODULE' => PATH_TO_ROOT . '/' . $module->get_id() . '/' . $admin_home_page)); } } $template->display(); require_once '../admin/admin_footer.php';
public static function build_legend($list, $current_page) { $lang = LangLoader::get('common', 'bugtracker'); $config = BugtrackerConfig::load(); $severities = $config->get_severities(); $legend_view = new FileTemplate('bugtracker/BugtrackerLegend.tpl'); $legend_view->add_lang($lang); $legend_colspan = 0; foreach ($list as $element) { if ($current_page == 'solved' || !empty($element) && isset($severities[$element])) { $legend_view->assign_block_vars('legend', array('COLOR' => $current_page == 'solved' ? $element == 'fixed' ? $config->get_fixed_bug_color() : $config->get_rejected_bug_color() : stripslashes($severities[$element]['color']), 'NAME' => $current_page == 'solved' ? $lang['status.' . $element] : stripslashes($severities[$element]['name']))); $legend_colspan = $legend_colspan + 3; } } $legend_view->put_all(array('LEGEND_COLSPAN' => $legend_colspan)); return $legend_colspan ? $legend_view : new StringTemplate(''); }
AppContext::get_session()->no_session_location(); //Ne réactualise pas l'emplacement du visiteur/membre define('TITLE', ''); include_once PATH_TO_ROOT . '/kernel/header_no_display.php'; $request = AppContext::get_request(); $date = $request->get_getvalue('date', ''); $field = $request->get_getvalue('field', ''); $input_field = $request->get_getvalue('input_field', ''); $input_date = $request->get_getvalue('input_date', ''); $calendar_number = $request->get_getvalue('calendar_number', ''); //Vide par défaut => Type date. $calendar_type = !empty($date) ? 'timestamp' : 'date'; $field = !empty($field) ? trim($field) : 'calendar'; $date_lang = LangLoader::get('date-common'); $tpl = new FileTemplate('framework/util/mini_calendar_response.tpl'); $tpl->add_lang($date_lang); //Type date. if ($calendar_type == 'date') { $now = new Date(); $year = $request->get_getint('y', $now->get_year()); $month = $request->get_getint('m', $now->get_month()); $day = $request->get_getint('d', $now->get_day()); $input_date = !empty($input_date) ? trim($input_date) : $day . '/' . $month . '/' . $year; $selected = explode('/', $input_date); $selected_day = NumberHelper::numeric($selected[0]); $selected_month = NumberHelper::numeric($selected[1]); $selected_year = NumberHelper::numeric($selected[2]); if (!checkdate($month, $day, $year)) { list($year, $month, $day) = array(date('Y'), date('n'), date('j')); } $bissextile = date("L", mktime(0, 0, 0, 1, 1, $year)) == 1 ? 29 : 28;
private function build_versions_table() { $versions = $this->config->get_versions(); $versions_table = new FileTemplate('bugtracker/AdminBugtrackerVersionsListController.tpl'); $versions_table->add_lang($this->lang); $key = 0; foreach ($versions as $key => $version) { $release_date = !empty($version['release_date']) && is_numeric($version['release_date']) ? new Date($version['release_date'], Timezone::SERVER_TIMEZONE) : null; $versions_table->assign_block_vars('versions', array('C_IS_DEFAULT' => $this->config->get_default_version() == $key, 'C_DETECTED_IN' => $version['detected_in'], 'ID' => $key, 'NAME' => stripslashes($version['name']), 'RELEASE_DATE' => !empty($release_date) ? $release_date->format(Date::FORMAT_ISO_DAY_MONTH_YEAR) : '', 'DAY' => !empty($release_date) ? $release_date->get_day() : date('d'), 'MONTH' => !empty($release_date) ? $release_date->get_month() : date('n'), 'YEAR' => !empty($release_date) ? $release_date->get_year() : date('Y'), 'LINK_DELETE' => BugtrackerUrlBuilder::delete_parameter('version', $key)->rel())); } $versions_table->put_all(array('C_VERSIONS' => !empty($versions), 'MAX_INPUT' => $this->max_input, 'NEXT_ID' => $key + 1, 'DAY' => date('d'), 'MONTH' => date('n'), 'YEAR' => date('Y'), 'C_DISPLAY_DEFAULT_DELETE_BUTTON' => $this->config->get_default_version(), 'LINK_DELETE_DEFAULT' => BugtrackerUrlBuilder::delete_default_parameter('version')->rel())); return $versions_table; }
private function build_response(View $view) { $body_view = new FileTemplate('newsletter/NewsletterBody.tpl'); $body_view->add_lang($this->lang); $body_view->put('TEMPLATE', $view); $response = new SiteDisplayResponse($body_view); $breadcrumb = $response->get_graphical_environment()->get_breadcrumb(); $breadcrumb->add($this->lang['newsletter'], NewsletterUrlBuilder::home()->rel()); $breadcrumb->add($this->lang['archives.list'], NewsletterUrlBuilder::archives()->rel()); if ($this->stream->get_id() > 0) { $stream = NewsletterStreamsCache::load()->get_stream($this->stream->get_id()); $breadcrumb->add($stream->get_name(), NewsletterUrlBuilder::archives($this->stream->get_id(), $this->stream->get_rewrited_name())->rel()); } $graphical_environment = $response->get_graphical_environment(); $graphical_environment->set_page_title($this->lang['archives.list'], $this->lang['newsletter']); $graphical_environment->get_seo_meta_data()->set_canonical_url(NewsletterUrlBuilder::archives($this->stream->get_id(), $this->stream->get_rewrited_name())); return $response; }
private function build_response(View $view, $type) { $body_view = new FileTemplate('newsletter/NewsletterBody.tpl'); $body_view->add_lang($this->lang); $body_view->put('TEMPLATE', $view); $response = new SiteDisplayResponse($body_view); $breadcrumb = $response->get_graphical_environment()->get_breadcrumb(); $breadcrumb->add($this->lang['newsletter'], NewsletterUrlBuilder::home()->rel()); $breadcrumb->add($this->lang['newsletter-add'], NewsletterUrlBuilder::add_newsletter()->rel()); $breadcrumb->add($this->lang['newsletter.types.' . $type], NewsletterUrlBuilder::add_newsletter($type)->rel()); $response->get_graphical_environment()->set_page_title($this->lang['newsletter-add'], $this->lang['newsletter']); return $response; }