本文整理汇总了PHP中phpbb\template\template::assign_block_vars方法的典型用法代码示例。如果您正苦于以下问题:PHP template::assign_block_vars方法的具体用法?PHP template::assign_block_vars怎么用?PHP template::assign_block_vars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpbb\template\template
的用法示例。
在下文中一共展示了template::assign_block_vars方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: article
/**
* Display an article
*
* @param string $article URL of the article
* @return object
*/
public function article($article)
{
$this->user->add_lang_ext('tas2580/wiki', 'common');
if (!$this->auth->acl_get('u_wiki_view')) {
trigger_error('NOT_AUTHORISED');
}
$this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang['WIKI'], 'U_VIEW_FORUM' => $this->helper->route('tas2580_wiki_index', array())));
$this->template->assign_vars(array('WIKI_FOOTER' => $this->user->lang('WIKI_FOOTER', base64_decode('aHR0cHM6Ly90YXMyNTgwLm5ldA=='), base64_decode('dGFzMjU4MA=='))));
include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
include $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext;
$action = $this->request->variable('action', '');
$id = $this->request->variable('id', 0);
switch ($action) {
case 'edit':
return $this->edit->edit_article($article);
case 'versions':
return $this->compare->view_versions($article);
case 'compare':
$from = $this->request->variable('from', 0);
$to = $this->request->variable('to', 0);
return $this->compare->compare_versions($article, $from, $to);
case 'delete':
return $this->delete->version($id);
case 'detele_article':
return $this->delete->article($article);
case 'active':
return $this->edit->active($id);
case 'deactivate':
return $this->edit->deactivate($article);
default:
return $this->view->view_article($article, $id);
}
}
示例2: display_topics
/**
* Display support topics from all contributions or of a specific type.
*
* @param string $type Contribution type's string identifier
* @return \Symfony\Component\HttpFoundation\Response
*/
public function display_topics($type)
{
$type_id = $this->get_type_id($type);
if ($type_id === false) {
return $this->helper->error('NO_PAGE', 404);
}
if ($type == 'all') {
// Mark all topics read
if ($this->request->variable('mark', '') == 'topics') {
$this->tracking->track(TITANIA_ALL_SUPPORT, self::ALL_SUPPORT);
}
// Mark all topics read
$this->template->assign_var('U_MARK_TOPICS', $this->helper->route('phpbb.titania.support', array('type' => 'all', 'mark' => 'topics')));
}
$this->display->assign_global_vars();
$u_all_support = $this->helper->route('phpbb.titania.support', array('type' => 'all'));
$this->template->assign_var('U_ALL_SUPPORT', $u_all_support);
// Generate the main breadcrumbs
$this->display->generate_breadcrumbs(array('ALL_SUPPORT' => $u_all_support));
// Links to the support topic lists
foreach ($this->types->get_all() as $id => $class) {
$this->template->assign_block_vars('support_types', array('U_SUPPORT' => $this->helper->route('phpbb.titania.support', array('type' => $class->url)), 'TYPE_SUPPORT' => $class->langs));
}
$data = \topics_overlord::display_forums_complete('all_support', false, array('contrib_type' => $type_id));
// Canonical URL
$data['sort']->set_url($this->helper->route('phpbb.titania.support', array('type' => $type)));
$this->template->assign_var('U_CANONICAL', $data['sort']->build_canonical());
return $this->helper->render('all_support.html', 'CUSTOMISATION_DATABASE');
}
示例3: get_bookmarks
public function get_bookmarks($ext_mode = '', $forums = array())
{
define('POSTS_BOOKMARKS_TABLE', $this->table_prefix . 'posts_bookmarks');
$start = $this->request->variable('start', 0);
$sql = 'SELECT COUNT(post_id) as posts_count
FROM ' . POSTS_BOOKMARKS_TABLE . '
WHERE user_id = ' . $this->user->data['user_id'];
$result = $this->db->sql_query($sql);
$posts_count = (int) $this->db->sql_fetchfield('posts_count');
$this->db->sql_freeresult($result);
$sql_where = $sql_fields = '';
if ($ext_mode != 'find') {
$sql_where = 'LEFT JOIN ' . USERS_TABLE . ' u ON (p.poster_id = u.user_id)';
$sql_fields = ', p.post_time, u.user_id, u.username, u.user_colour';
}
$pagination_url = append_sid("{$this->phpbb_root_path}postbookmark", "mode=find");
$this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $posts_count, $this->config['topics_per_page'], $start);
$sql = 'SELECT b.post_id AS b_post_id, b.user_id, b.bookmark_time, b.bookmark_desc, p.post_id, p.forum_id, p.topic_id, p.poster_id, p.post_subject, t.topic_title ' . $sql_fields . '
FROM ' . POSTS_BOOKMARKS_TABLE . ' b
LEFT JOIN ' . POSTS_TABLE . ' p ON( b.post_id = p.post_id)
LEFT JOIN ' . TOPICS_TABLE . ' t ON( t.topic_id = p.topic_id)
' . $sql_where . '
WHERE b.user_id = ' . $this->user->data['user_id'] . '
ORDER BY b.bookmark_time ASC';
$result = $this->db->sql_query_limit($sql, $this->config['topics_per_page'], $start);
while ($row = $this->db->sql_fetchrow($result)) {
$topic_author = $sql_where ? get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : '';
$post_time = $sql_where ? $this->user->format_date($row['post_time']) : '';
// Send vars to template
$this->template->assign_block_vars('postrow', array('POST_ID' => $row['b_post_id'], 'POST_TIME' => $post_time, 'BOOKMARK_TIME' => $this->user->format_date($row['bookmark_time']), 'BOOKMARK_DESC' => $row['bookmark_desc'], 'TOPIC_AUTHOR' => $topic_author, 'POST_TITLE' => $row['post_subject'] ? $row['post_subject'] : $row['topic_title'], 'U_VIEW_POST' => append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "p=" . $row['post_id'] . "#p" . $row['post_id'] . ""), 'S_DELETED_TOPIC' => !$row['topic_id'] ? true : false, 'S_DELETED_POST' => !$row['post_id'] ? true : false, 'U_POST_BOOKMARK' => '[url=' . generate_board_url() . '/viewtopic.' . $this->php_ext . '?p=' . $row['post_id'] . '#p' . $row['post_id'] . ']' . ($row['post_subject'] ? $row['post_subject'] : $row['topic_title']) . '[/url]'));
}
$this->db->sql_freeresult($result);
$this->template->assign_vars(array('TOTAL_BOOKMARKS' => $this->user->lang('TOTAL_BOOKMARKS', (int) $posts_count), 'PAGE_NUMBER' => $this->pagination->on_page($posts_count, $this->config['topics_per_page'], $start)));
}
示例4: page
/**
* Controller for route /paypal
*
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
*/
public function page()
{
$this->user->add_lang_ext('tas2580/paypal', 'common');
$amount_list = '';
$sql = 'SELECT *
FROM ' . $this->table_amount . '
ORDER BY amount_value';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$amount_list .= '<option value="' . number_format($row['amount_value'] / 100, 2) . '">' . number_format($row['amount_value'] / 100, 2) . '</option>';
}
$sql = 'SELECT *
FROM ' . $this->table_items . '
ORDER BY item_name';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$this->template->assign_block_vars('items', array('ITEM_NAME' => $row['item_name'], 'ITEM' => generate_text_for_display($row['item_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], 7), 'ITEM_ID' => $row['item_id']));
}
$sql = 'SELECT *
FROM ' . $this->table_config;
$result = $this->db->sql_query($sql);
$row = $this->db->sql_fetchrow($result);
$this->template->assign_vars(array('PAYPAL_TITLE' => $row['paypal_title'], 'PAYPAL_TEXT' => generate_text_for_display($row['paypal_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], 7), 'PAYPAL_EMAIL' => $row['paypal_email'], 'AMOUNT_LIST' => $amount_list, 'PAYPAL_ACTION' => $row['paypal_sandbox'] == 1 ? 'https://www.sandbox.paypal.com/cgi-bin/webscr' : 'https://www.paypal.com/cgi-bin/webscr', 'S_SANDBOX' => $row['paypal_sandbox'] == 1 ? true : false, 'S_CURL' => function_exists('curl_init'), 'CURRENCY_CODE' => $this->currency_code_select($row['paypal_currency']), 'CURRENCY' => $row['paypal_currency'], 'USER_ID' => $this->user->data['user_id'], 'IPN_URL' => $this->helper->route('tas2580_paypal_ipn', array(), true, '', \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL), 'RETURN_URL' => $this->helper->route('tas2580_paypal_controller', array(), true, '', \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL)));
return $this->helper->render('paypal_body.html', $row['paypal_title']);
}
示例5: main
function main()
{
$sql = 'SELECT *
FROM ' . $this->points_values_table;
$result = $this->db->sql_query($sql);
$points_values = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
// Add part to bar
$this->template->assign_block_vars('navlinks', array('U_VIEW_FORUM' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'info')), 'FORUM_NAME' => sprintf($this->user->lang['POINTS_INFO'], $this->config['points_name'])));
// Read out all the need values
$info_attach = $points_values['points_per_attach'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_attach']) . ' ' . $this->config['points_name']);
$info_addtional_attach = $points_values['points_per_attach_file'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_attach_file']) . ' ' . $this->config['points_name']);
$info_poll = $points_values['points_per_poll'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_poll']) . ' ' . $this->config['points_name']);
$info_poll_option = $points_values['points_per_poll_option'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_poll_option']) . ' ' . $this->config['points_name']);
$info_topic_word = $points_values['points_per_topic_word'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_topic_word']) . ' ' . $this->config['points_name']);
$info_topic_character = $points_values['points_per_topic_character'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_topic_character']) . ' ' . $this->config['points_name']);
$info_post_word = $points_values['points_per_post_word'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_post_word']) . ' ' . $this->config['points_name']);
$info_post_character = $points_values['points_per_post_character'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_post_character']) . ' ' . $this->config['points_name']);
$info_cost_warning = $points_values['points_per_warn'] == 0 ? sprintf($this->user->lang['INFO_NO_COST'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_warn']) . ' ' . $this->config['points_name']);
$info_reg_bonus = $points_values['reg_points_bonus'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['reg_points_bonus']) . ' ' . $this->config['points_name']);
$info_points_bonus = $points_values['points_bonus_chance'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->user->lang['INFO_BONUS_CHANCE_EXPLAIN'], $this->functions_points->number_format_points($points_values['points_bonus_chance']), $this->functions_points->number_format_points($points_values['points_bonus_min']), $this->functions_points->number_format_points($points_values['points_bonus_max']), $this->config['points_name']);
$this->template->assign_vars(array('USER_POINTS' => sprintf($this->functions_points->number_format_points($this->user->data['user_points'])), 'POINTS_NAME' => $this->config['points_name'], 'LOTTERY_NAME' => $points_values['lottery_name'], 'BANK_NAME' => $points_values['bank_name'], 'POINTS_INFO_DESCRIPTION' => sprintf($this->user->lang['POINTS_INFO_DESCRIPTION'], $this->config['points_name']), 'INFO_ATTACH' => $info_attach, 'INFO_ADD_ATTACH' => $info_addtional_attach, 'INFO_POLL' => $info_poll, 'INFO_POLL_OPTION' => $info_poll_option, 'INFO_TOPIC_WORD' => $info_topic_word, 'INFO_TOPIC_CHARACTER' => $info_topic_character, 'INFO_POST_WORD' => $info_post_word, 'INFO_POST_CHARACTER' => $info_post_character, 'INFO_COST_WARNING' => $info_cost_warning, 'INFO_REG_BONUS' => $info_reg_bonus, 'INFO_POINTS_BONUS' => $info_points_bonus, 'U_TRANSFER_USER' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'transfer_user')), 'U_LOGS' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'logs')), 'U_LOTTERY' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'lottery')), 'U_BANK' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'bank')), 'U_ROBBERY' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'robbery')), 'U_INFO' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'info')), 'U_USE_TRANSFER' => $this->auth->acl_get('u_use_transfer'), 'U_USE_LOGS' => $this->auth->acl_get('u_use_logs'), 'U_USE_LOTTERY' => $this->auth->acl_get('u_use_lottery'), 'U_USE_BANK' => $this->auth->acl_get('u_use_bank'), 'U_USE_ROBBERY' => $this->auth->acl_get('u_use_robbery')));
// Generate the page
page_header($this->user->lang['POINTS_INFO']);
// Generate the page template
$this->template->set_filenames(array('body' => 'points/points_info.html'));
page_footer();
}
示例6: page_header_after
public function page_header_after($event)
{
$context = $this->phpbb_container->get('template_context');
$rootref =& $context->get_root_ref();
if (isset($this->config['menu_enabled']) && $this->config['menu_enabled']) {
$sql = 'SELECT *
FROM ' . $this->menu_colors;
$result = $this->db->sql_query($sql);
$row = $this->db->sql_fetchrow($result);
if ($this->db->sql_affectedrows()) {
$this->template->assign_vars(array('S_MENU_COLOR' => $row['color_name'], 'S_MENU_FONT_COLOR' => $row['color_text'], 'S_MENU_FONT_COLOR_HOVER' => $row['color_text_hover'], 'S_MENU_DECORATION' => $row['color_text_hover_decor'], 'S_MENU_WEIGHT' => $row['color_text_weight'], 'S_MENU_SEARCH' => $row['color_display_search'], 'S_MENU_TEXT_TRANSFORM' => $row['color_text_transform'], 'S_MENU_ALIGN' => $row['color_align']));
$sql = 'SELECT *
FROM ' . $this->menu_buttons . '
WHERE button_display = 1
AND parent_id = 0
ORDER BY left_id';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
if ($row['button_only_registered'] && $this->user->data['user_id'] == ANONYMOUS || $row['button_only_guest'] && $this->user->data['user_id'] != ANONYMOUS) {
continue;
}
if (preg_match("/\\{(.*)\\}/", $row['button_url'])) {
$brackets = array("{", "}");
$var_name = strtoupper(str_replace($brackets, '', $row['button_url']));
$row['button_url'] = $rootref[$var_name];
}
if (preg_match("/\\{(.*)\\}/", $row['button_name'])) {
$brackets = array("{L_", "}");
$var_name = strtoupper(str_replace($brackets, '', $row['button_name']));
$row['button_name'] = $this->user->lang[$var_name];
}
$this->template->assign_block_vars('buttons', array('ID' => $row['button_id'], 'URL' => $row['button_url'], 'NAME' => $row['button_name'], 'EXTERNAL' => $row['button_external']));
$sub_sql = 'SELECT *
FROM ' . $this->menu_buttons . '
WHERE button_display = 1
AND parent_id = ' . $row['button_id'] . '
ORDER BY left_id';
$sub_result = $this->db->sql_query($sub_sql);
while ($sub_row = $this->db->sql_fetchrow($sub_result)) {
if ($sub_row['button_only_registered'] && $this->user->data['user_id'] == ANONYMOUS || $sub_row['button_only_guest'] && $this->user->data['user_id'] != ANONYMOUS) {
continue;
}
if (preg_match("/\\{(.*)\\}/", $sub_row['button_url'])) {
$brackets = array("{", "}");
$var_name = strtoupper(str_replace($brackets, '', $sub_row['button_url']));
$sub_row['button_url'] = $rootref[$var_name];
}
if (preg_match("/\\{(.*)\\}/", $sub_row['button_name'])) {
$brackets = array("{L_", "}");
$var_name = strtoupper(str_replace($brackets, '', $sub_row['button_name']));
$sub_row['button_name'] = $this->user->lang[$var_name];
}
$this->template->assign_block_vars('buttons.sub', array('ID' => $sub_row['button_id'], 'URL' => $sub_row['button_url'], 'NAME' => $sub_row['button_name'], 'EXTERNAL' => $sub_row['button_external']));
}
$this->db->sql_freeresult($sub_result);
}
$this->db->sql_freeresult($result);
}
}
}
示例7: display_options
/**
* Display the options a user can configure for this extension
*
* @return null
* @access public
*/
public function display_options()
{
// Create a form key for preventing CSRF attacks
$form_key = 'sitelogo';
add_form_key($form_key);
// Is the form being submitted
if ($this->request->is_set_post('submit')) {
// Is the submitted form is valid
if (!check_form_key($form_key)) {
trigger_error($this->user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
}
// If no errors, process the form data
// Set the options the user configured
$this->set_options();
// Add option settings change action to the admin log
$phpbb_log = $this->container->get('log');
$phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'SITE_LOGO_LOG');
// Option settings have been updated and logged
// Confirm this to the user and provide link back to previous page
trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
}
// Set output vars for display in the template
// Positions
$positions = array();
$positions[] = $this->user->lang('LOGO_LEFT');
$positions[] = $this->user->lang('LOGO_CENTRE');
$positions[] = $this->user->lang('LOGO_RIGHT');
foreach ($positions as $value => $label) {
$this->template->assign_block_vars('positions', array('S_CHECKED' => $this->config['site_logo_position'] == $value ? true : false, 'LABEL' => $label, 'VALUE' => $value));
}
$this->template->assign_vars(array('SITE_LOGO_HEIGHT' => isset($this->config['site_logo_height']) ? $this->config['site_logo_height'] : '', 'SITE_LOGO_IMAGE' => isset($this->config['site_logo_image']) ? $this->config['site_logo_image'] : '', 'SITE_LOGO_LEFT' => isset($this->config['site_logo_left']) ? $this->config['site_logo_left'] : '', 'SITE_LOGO_PIXELS' => isset($this->config['site_logo_pixels']) ? $this->config['site_logo_pixels'] : '', 'SITE_LOGO_REMOVE' => isset($this->config['site_logo_remove']) ? $this->config['site_logo_remove'] : '', 'SITE_LOGO_RIGHT' => isset($this->config['site_logo_right']) ? $this->config['site_logo_right'] : '', 'SITE_LOGO_WIDTH' => isset($this->config['site_logo_width']) ? $this->config['site_logo_width'] : '', 'SITE_NAME_SUPRESS' => isset($this->config['site_name_supress']) ? $this->config['site_name_supress'] : '', 'SITE_SEARCH_REMOVE' => isset($this->config['site_search_remove']) ? $this->config['site_search_remove'] : '', 'U_ACTION' => $this->u_action));
}
示例8: display_list
public function display_list()
{
$this->user->add_lang_ext('phpbb/titania', 'faq', false, true);
/**
* From phpBB faq.php
*/
// Pull the array data from the lang pack
$switch_column = $found_switch = false;
$help_blocks = array();
foreach ($this->user->help as $help_ary) {
if ($help_ary[0] == '--') {
if ($help_ary[1] == '--') {
$switch_column = true;
$found_switch = true;
continue;
}
$this->template->assign_block_vars('faq_block', array('BLOCK_TITLE' => $help_ary[1], 'SWITCH_COLUMN' => $switch_column));
if ($switch_column) {
$switch_column = false;
}
continue;
}
$this->template->assign_block_vars('faq_block.faq_row', array('FAQ_QUESTION' => $help_ary[0], 'FAQ_ANSWER' => $help_ary[1]));
}
// Lets build a page ...
$this->template->assign_vars(array('L_FAQ_TITLE' => $this->user->lang['FAQ_EXPLAIN'], 'L_BACK_TO_TOP' => $this->user->lang['BACK_TO_TOP'], 'SWITCH_COLUMN_MANUALLY' => !$found_switch));
$this->display->assign_global_vars();
return $this->helper->render('faq_body.html', 'FAQ_EXPLAIN');
}
示例9: crawler
public function crawler()
{
$this->template->assign_vars(array('S_CRAWLER' => true, 'S_CRAWLER_SPEED' => $this->config['crawler_speed'], 'S_CRAWLER_BEHAVIOR' => $this->config['crawler_behavior'], 'S_CRAWLER_NEUTRAL' => $this->config['crawler_neutral'], 'S_CRAWLER_DIRECTION' => $this->config['crawler_direction'], 'S_CRAWLER_MOVEATLEAST' => $this->config['crawler_moveatleast']));
$crawler_ids = explode(',', $this->config['crawler_id']);
foreach ($crawler_ids as $crawler_id) {
$this->template->assign_block_vars('crawlerrow', array('CRAWLER_ID' => trim($crawler_id)));
}
}
示例10: handle
public function handle()
{
if (!function_exists('display_forums')) {
include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
}
display_forums('', $this->config['load_moderators']);
$this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang('FORUM'), 'U_VIEW_FORUM' => $this->helper->route('blitze_sitemaker_forum')));
return $this->helper->render('index_body.html', $this->user->lang('FORUM_INDEX'));
}
示例11: set_assets
/**
* Pass assets to template
*/
public function set_assets()
{
$this->_prep_scripts();
foreach ($this->scripts as $type => $scripts) {
foreach ($scripts as $file) {
$this->template->assign_block_vars($type, array('UA_FILE' => trim($file)));
}
}
$this->scripts = array();
}
示例12: get_template_side
/**
* {@inheritdoc}
*/
public function get_template_side($module_id)
{
$sql = 'SELECT user_id, username, user_posts, user_colour
FROM ' . USERS_TABLE . '
WHERE user_type <> ' . USER_IGNORE . "\n\t\t\t\tAND user_posts <> 0\n\t\t\t\tAND username <> ''\n\t\t\tORDER BY user_posts DESC";
$result = $this->db->sql_query_limit($sql, $this->config['board3_topposters_' . $module_id], 0, 600);
while ($row = $this->db->sql_fetchrow($result)) {
$this->template->assign_block_vars('topposters', array('S_SEARCH_ACTION' => append_sid("{$this->phpbb_root_path}search.{$this->php_ext}", 'author_id=' . $row['user_id'] . '&sr=posts'), 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'POSTER_POSTS' => $row['user_posts']));
}
$this->db->sql_freeresult($result);
return 'topposters_side.html';
}
示例13: show_ucp_complete
/**
* This method is called to show the UCP page.
* You can assign template variables to the template, or do anything else here.
*
* @param string $table
* @param string $where Extra where clause. Please make sure to use AND as first.
*/
protected function show_ucp_complete($table, $where = '')
{
$sql = 'SELECT *
FROM ' . $this->db->sql_escape($table) . '
WHERE user_id = ' . (int) $this->user->data['user_id'] . ' ' . $where . '
ORDER BY registration_id ASC';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$this->template->assign_block_vars('keys', array('CLASS' => $this->get_name(), 'ID' => $row['registration_id'], 'REGISTERED' => $this->user->format_date($row['registered']), 'LAST_USED' => $row['last_used'] ? $this->user->format_date($row['last_used']) : false, 'TYPE' => $this->user->lang($this->get_translatable_name())));
}
$this->db->sql_freeresult($result);
}
示例14: render
/**
* Render block
*
* @param array $display_modes
* @param bool $edit_mode
* @param array $data
* @param array $users_groups
* @param int $position_counter
*/
public function render(array $display_modes, $edit_mode, array $data, array $users_groups, &$position_counter)
{
$position = $data['position'];
$service_name = $data['name'];
if ($this->_block_is_viewable($data, $display_modes, $users_groups, $edit_mode) && ($block_instance = $this->block_factory->get_block($service_name)) !== null) {
$block = $block_instance->display($data, $edit_mode);
if ($content = $this->_get_block_content($block, $edit_mode)) {
$tpl_data = array_merge($data, array('TITLE' => $this->_get_block_title($data['title'], $block['title']), 'CONTENT' => $content));
$this->template->assign_block_vars($position, array_change_key_case($tpl_data, CASE_UPPER));
$position_counter++;
}
}
}
示例15: get_template_side
/**
* {@inheritdoc}
*/
public function get_template_side($module_id)
{
$sql = 'SELECT user_id, username, user_regdate, user_colour
FROM ' . USERS_TABLE . '
WHERE user_type <> ' . USER_IGNORE . '
AND user_inactive_time = 0
ORDER BY user_regdate DESC';
$result = $this->db->sql_query_limit($sql, $this->config['board3_max_last_member_' . $module_id], 0, 600);
while (($row = $this->db->sql_fetchrow($result)) && $row['username']) {
$this->template->assign_block_vars('latest_members', array('USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'JOINED' => $this->user->format_date($row['user_regdate'], $format = 'd M')));
}
$this->db->sql_freeresult($result);
return 'latest_members_side.html';
}