本文整理汇总了PHP中FileTemplate::assign_block_vars方法的典型用法代码示例。如果您正苦于以下问题:PHP FileTemplate::assign_block_vars方法的具体用法?PHP FileTemplate::assign_block_vars怎么用?PHP FileTemplate::assign_block_vars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileTemplate
的用法示例。
在下文中一共展示了FileTemplate::assign_block_vars方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_filter_fieldset
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);
}
示例2: get_view
private function get_view()
{
global $Bread_crumb, $LANG, $pages;
$pages_config = PagesConfig::load();
//Configuration des authorisations
$config_authorizations = $pages_config->get_authorizations();
require_once PATH_TO_ROOT . '/pages/pages_begin.php';
$tpl = new FileTemplate('pages/index.tpl');
$num_pages = PersistenceContext::get_querier()->count(PREFIX . "pages", 'WHERE redirect = 0');
$num_coms = CommentsService::get_number_and_lang_comments('pages', $pages['id']);
$tpl->put_all(array('NUM_PAGES' => sprintf($LANG['pages_num_pages'], $num_pages), 'NUM_COMS' => sprintf($LANG['pages_num_coms'], $num_coms, $num_pages > 0 ? $num_coms / $num_pages : 0), 'L_EXPLAIN_PAGES' => $LANG['pages_explain'], 'L_STATS' => $LANG['pages_stats']));
//Liste des dossiers de la racine
$root = '';
foreach (PagesCategoriesCache::load()->get_categories() as $key => $cat) {
if ($cat['id_parent'] == 0) {
//Autorisation particulière ?
$special_auth = !empty($cat['auth']);
//Vérification de l'autorisation d'éditer la page
if ($special_auth && AppContext::get_current_user()->check_auth($cat['auth'], READ_PAGE) || !$special_auth && AppContext::get_current_user()->check_auth($config_authorizations, READ_PAGE)) {
$root .= '<li><a href="javascript:open_cat(' . $key . '); show_pages_cat_contents(' . $cat['id_parent'] . ', 0);"><i class="fa fa-folder"></i>' . stripslashes($cat['title']) . '</a></li>';
}
}
}
//Liste des fichiers de la racine
$result = PersistenceContext::get_querier()->select("SELECT title, id, encoded_title, auth\r\n\t\t\tFROM " . PREFIX . "pages\r\n\t\t\tWHERE id_cat = 0 AND is_cat = 0\r\n\t\t\tORDER BY is_cat DESC, title ASC");
while ($row = $result->fetch()) {
//Autorisation particulière ?
$special_auth = !empty($row['auth']);
$array_auth = unserialize($row['auth']);
//Vérification de l'autorisation d'éditer la page
if ($special_auth && AppContext::get_current_user()->check_auth($array_auth, READ_PAGE) || !$special_auth && AppContext::get_current_user()->check_auth($config_authorizations, READ_PAGE)) {
$root .= '<li><a href="' . PagesUrlBuilder::get_link_item($row['encoded_title']) . '"><i class="fa fa-file"></i>' . stripslashes($row['title']) . '</a></li>';
}
}
$result->dispose();
$tpl->put_all(array('TITLE' => $LANG['pages'], 'L_ROOT' => $LANG['pages_root'], 'ROOT_CONTENTS' => $root, 'L_CATS' => $LANG['pages_cats_tree'], 'L_EXPLORER' => $LANG['pages_explorer'], 'SELECTED_CAT' => 0, 'CAT_0' => 'selected', 'CAT_LIST' => ''));
$contents = '';
$result = PersistenceContext::get_querier()->select("SELECT c.id, p.title, p.encoded_title\r\n\t\tFROM " . PREFIX . "pages_cats c\r\n\t\tLEFT JOIN " . PREFIX . "pages p ON p.id = c.id_page\r\n\t\tWHERE c.id_parent = 0\r\n\t\tORDER BY p.title ASC");
while ($row = $result->fetch()) {
$sub_cats_number = PersistenceContext::get_querier()->count(PREFIX . "pages_cats", 'WHERE id_parent=:id_parent', array('id_parent' => $row['id']));
if ($sub_cats_number > 0) {
$tpl->assign_block_vars('list', array('DIRECTORY' => '<li class="sub"><a class="parent" href="javascript:show_pages_cat_contents(' . $row['id'] . ', 0);"><i class="fa fa-plus-square-o" id="img2_' . $row['id'] . '"></i><i class="fa fa-folder" id ="img_' . $row['id'] . '"></i></a><a id="class_' . $row['id'] . '" href="javascript:open_cat(' . $row['id'] . ');">' . stripslashes($row['title']) . '</a><span id="cat_' . $row['id'] . '"></li>'));
} else {
$tpl->assign_block_vars('list', array('DIRECTORY' => '<li class="sub"><a id="class_' . $row['id'] . '" href="javascript:open_cat(' . $row['id'] . ');"><i class="fa fa-folder"></i>' . stripslashes($row['title']) . '</a><span id="cat_' . $row['id'] . '"></span></li>'));
}
}
$result->dispose();
return $tpl;
}
示例3: get_menu_content
public function get_menu_content()
{
global $LANG;
$poll_config = PollConfig::load();
$config_cookie_name = $poll_config->get_cookie_name();
$polls = PollMiniMenuCache::load()->get_polls();
//Chargement de la langue du module.
load_module_lang('poll');
$rand = array_rand($polls);
$poll_mini = $polls[$rand];
//Sondage aléatoire.
$tpl = new FileTemplate('poll/poll_mini.tpl');
#####################Résultats######################
//Si le cookie existe, on redirige vers les resulats, sinon on prend en compte le vote (vérification par ip plus tard).
$array_cookie = array();
if (AppContext::get_request()->has_cookieparameter($config_cookie_name)) {
$array_cookie = explode('/', AppContext::get_request()->get_cookie($config_cookie_name));
}
if (in_array($poll_mini['id'], $array_cookie)) {
$tpl->put_all(array('L_VOTE' => $poll_mini['total'] > 1 ? $LANG['poll_vote_s'] : $LANG['poll_vote']));
$tpl->assign_block_vars('result', array('QUESTION' => $poll_mini['question'], 'VOTES' => $poll_mini['total']));
foreach ($poll_mini['votes'] as $answer => $width) {
$tpl->assign_block_vars('result.answers', array('ANSWERS' => $answer, 'WIDTH' => NumberHelper::round($width, 0), 'PERCENT' => $width));
}
} else {
#####################Questions######################
$tpl->put_all(array('L_MINI_POLL' => $LANG['mini_poll'], 'L_VOTE' => $LANG['poll_vote'], 'L_POLL_RESULT' => $LANG['poll_result'], 'U_POLL_RESULT' => url('.php?id=' . $poll_mini['id'] . '&r=1', '-' . $poll_mini['id'] . '-1.php')));
$tpl->assign_block_vars('question', array('ID' => url('.php?id=' . $poll_mini['id'], '-' . $poll_mini['id'] . '.php'), 'QUESTION' => $poll_mini['question']));
$z = 0;
if ($poll_mini['type'] == '1') {
if (is_array($poll_mini['votes'])) {
// FIXME should always be an array, needs to patch cache generation
foreach ($poll_mini['votes'] as $answer => $width) {
$tpl->assign_block_vars('question.radio', array('NAME' => $z, 'ANSWERS' => $answer));
$z++;
}
}
} elseif ($poll_mini['type'] == '0') {
foreach ($poll_mini['votes'] as $answer => $width) {
$tpl->assign_block_vars('question.checkbox', array('NAME' => $z, 'ANSWERS' => $answer));
$z++;
}
}
}
return $tpl->render();
}
示例4: display
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;
}
示例5: get_view
private function get_view()
{
global $Bread_crumb, $LANG, $encoded_title, $id_article, $article_infos, $id_cat;
load_module_lang('wiki');
include_once PATH_TO_ROOT . '/wiki/wiki_functions.php';
$bread_crumb_key = 'wiki';
require_once PATH_TO_ROOT . '/wiki/wiki_bread_crumb.php';
$config = WikiConfig::load();
$tpl = new FileTemplate('wiki/index.tpl');
if ($config->get_number_articles_on_index() > 1) {
$result = PersistenceContext::get_querier()->select("SELECT a.title, a.encoded_title, a.id\r\n\t\t\tFROM " . PREFIX . "wiki_articles a\r\n\t\t\tLEFT JOIN " . PREFIX . "wiki_contents c ON c.id_contents = a.id_contents\r\n\t\t\tWHERE a.redirect = 0\r\n\t\t\tORDER BY c.timestamp DESC\r\n\t\t\tLIMIT :number_articles_on_index OFFSET 0", array('number_articles_on_index' => $config->get_number_articles_on_index()));
$tpl->assign_block_vars('last_articles', array('C_ARTICLES' => $result->get_rows_count(), 'L_ARTICLES' => $LANG['wiki_last_articles_list']));
$i = 0;
while ($row = $result->fetch()) {
$tpl->assign_block_vars('last_articles.list', array('ARTICLE' => $row['title'], 'TR' => $i > 0 && $i % 2 == 0 ? '</tr><tr>' : '', 'U_ARTICLE' => url('wiki.php?title=' . $row['encoded_title'], $row['encoded_title'])));
$i++;
}
$result->dispose();
if ($i == 0) {
$tpl->put_all(array('L_NO_ARTICLE' => '<td class="center" colspan="2">' . $LANG['wiki_no_article'] . '</td>'));
}
}
//Affichage de toutes les catégories si c'est activé
if ($config->are_categories_displayed_on_index()) {
$tpl->assign_block_vars('cat_list', array('L_CATS' => $LANG['wiki_cats_list']));
$i = 0;
foreach (WikiCategoriesCache::load()->get_categories() as $id => $cat) {
//Si c'est une catégorie mère
if ($cat['id_parent'] == 0) {
$tpl->assign_block_vars('cat_list.list', array('CAT' => stripslashes($cat['title']), 'U_CAT' => url('wiki.php?title=' . $cat['encoded_title'], $cat['encoded_title'])));
$i++;
}
}
if ($i == 0) {
$tpl->put_all(array('L_NO_CAT' => $LANG['wiki_no_cat']));
}
}
$tpl->put_all(array('TITLE' => $config->get_wiki_name() ? $config->get_wiki_name() : $LANG['wiki'], 'INDEX_TEXT' => $config->get_index_text() ? FormatingHelper::second_parse(wiki_no_rewrite($config->get_index_text())) : $LANG['wiki_empty_index'], 'L_EXPLORER' => $LANG['wiki_explorer'], 'U_EXPLORER' => url('explorer.php')));
$page_type = 'index';
include PATH_TO_ROOT . '/wiki/wiki_tools.php';
$tpl->put('wiki_tools', $tools_tpl);
return new StringTemplate($tpl->render());
}
示例6: display
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;
}
示例7: display
public function display()
{
$template = $this->get_template_to_use();
$tpl = new FileTemplate('framework/builder/form/FormFieldMultipleAutocompleter.tpl');
$this->assign_common_template_variables($template);
if (empty($this->file)) {
throw new Exception('Add file options containing file url');
}
$i = 0;
foreach ($this->get_value() as $value) {
$tpl->assign_block_vars('fieldelements', array('ID' => $i, 'VALUE' => $value));
$i++;
}
if ($i == 0) {
$tpl->assign_block_vars('fieldelements', array('ID' => $i, 'VALUE' => ''));
}
$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 == 0 ? 1 : $i, 'SIZE' => $this->size, 'METHOD' => $this->method, 'NAME_PARAMETER' => $this->name_parameter, 'FILE' => $this->file));
$template->assign_block_vars('fieldelements', array('ELEMENT' => $tpl->render()));
return $template;
}
示例8: display
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;
}
示例9: display
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;
}
示例10: get_menu_content
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();
}
示例11: display
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;
}
示例12: display_admin_actions_menu
public static function display_admin_actions_menu(Module $module)
{
$id_module = $module->get_id();
$configuration = $module->get_configuration();
$admin_main_page = $configuration->get_admin_main_page();
$tpl = new FileTemplate('framework/module/admin_module_actions_links_menu.tpl');
$tpl->put_all(array('U_LINK' => TPL_PATH_TO_ROOT . '/' . $id_module . '/' . $configuration->get_admin_main_page(), 'NAME' => $configuration->get_name(), 'IMG' => TPL_PATH_TO_ROOT . '/' . $id_module . '/' . $id_module . '_mini.png', 'C_HAS_SUB_LINK' => false, 'C_DISPLAY' => !empty($admin_main_page)));
$tree_links = self::get_tree_links($id_module);
if ($tree_links !== null) {
$actions_tree_links = $tree_links->get_actions_tree_links();
$tpl->put_all(array('C_HAS_SUB_LINK' => $actions_tree_links->has_links(), 'C_DISPLAY' => $actions_tree_links->has_links() || !empty($admin_main_page)));
$home_page = $configuration->get_home_page();
if (!empty($home_page)) {
$module_home = new ModuleLink(LangLoader::get_message('home', 'main'), new Url('/' . $id_module . '/' . $home_page));
$tpl->assign_block_vars('element', array(), array('ELEMENT' => $module_home->export()));
}
return self::display($actions_tree_links, $tpl);
}
return $tpl;
}
示例13: get_menu_content
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();
}
示例14: get_view
private function get_view()
{
$this->check_authorizations();
global $Bread_crumb, $LANG;
require_once PATH_TO_ROOT . '/poll/poll_begin.php';
$tpl = new FileTemplate('poll/poll.tpl');
$now = new Date();
$show_archives = PersistenceContext::get_querier()->count(PREFIX . "poll", 'WHERE archive = 1 AND visible = 1 AND start <= :timestamp AND (end >= :timestamp OR end = 0)', array('timestamp' => $now->get_timestamp()));
$show_archives = !empty($show_archives) ? '<a href="poll' . url('.php?archives=1', '.php?archives=1') . '">' . $LANG['archives'] . '</a>' : '';
$edit = '';
if (AppContext::get_current_user()->check_level(User::ADMIN_LEVEL)) {
$edit = '<a href="' . PATH_TO_ROOT . '/poll/admin_poll.php" title="' . LangLoader::get_message('edit', 'common') . '" class="fa fa-edit"></a>';
}
$tpl->put_all(array('C_POLL_MAIN' => true, 'EDIT' => $edit, 'U_ARCHIVE' => $show_archives, 'L_POLL' => $LANG['poll'], 'L_POLL_MAIN' => $LANG['poll_main']));
$result = PersistenceContext::get_querier()->select("SELECT id, question \r\n\t\tFROM " . PREFIX . "poll \r\n\t\tWHERE archive = 0 AND visible = 1 AND start <= :timestamp AND (end >= :timestamp OR end = 0)\r\n\t\tORDER BY id DESC", array('timestamp' => $now->get_timestamp()));
while ($row = $result->fetch()) {
$tpl->assign_block_vars('list', array('U_POLL_ID' => url('.php?id=' . $row['id'], '-' . $row['id'] . '.php'), 'QUESTION' => stripslashes($row['question'])));
}
$result->dispose();
return $tpl;
}
示例15: get_menu_content
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();
}