/**
     * Display the user ranks page
     *
     * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
     * @access public
     */
    public function display($name)
    {
        // Get the rank details
        $sql = 'SELECT *
			FROM ' . RANKS_TABLE . '
			ORDER BY rank_special DESC, rank_min ASC, rank_title ASC';
        $result = $this->db->sql_query($sql);
        while ($row = $this->db->sql_fetchrow($result)) {
            if ($this->config['userranks_special'] || $this->config['userranks_special_admin'] && $this->auth->acl_get('a_') || !$this->config['userranks_special'] && !$row['rank_special']) {
                $rank_row = array('S_RANK_IMAGE' => $row['rank_image'] ? true : false, 'S_SPECIAL_RANK' => $row['rank_special'] ? true : false, 'RANK_IMAGE' => $this->path_helper->get_web_root_path() . $this->config['ranks_path'] . '/' . $row['rank_image'], 'RANK_TITLE' => $row['rank_title'], 'MIN_POSTS' => $row['rank_min']);
                $this->template->assign_block_vars('ranks', $rank_row);
                // Are we displaying members?
                if ($this->config['userranks_members'] || $this->config['userranks_members_admin'] && $this->auth->acl_get('a_')) {
                    $rank_users = $this->get_user_rank_data($row['rank_id']);
                    if (sizeof($rank_users) > 0) {
                        foreach ($rank_users as $row_rank) {
                            $this->template->assign_block_vars('ranks.rank_member', array('MEMBERS' => get_username_string('full', $row_rank['user_id'], $row_rank['username'], $row_rank['user_colour'])));
                        }
                    } else {
                        $this->template->assign_block_vars('ranks.rank_member', array('MEMBERS' => $this->user->lang('NO_MEMBERS')));
                    }
                }
            }
        }
        $this->db->sql_freeresult($result);
        // Assign breadcrumb template vars for the user ranks page
        $this->template->assign_block_vars('navlinks', array('U_VIEW_FORUM' => $this->helper->route('david63_userranks_main_controller', array('name' => 'ranks')), 'FORUM_NAME' => $this->user->lang('USER_RANKS')));
        // Send all data to the template file
        return $this->helper->render('user_ranks.html', $name);
    }
Beispiel #2
0
 /**
  * Update the template variables
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function site_logo_header($event)
 {
     $site_logo_img = $this->config['site_logo_remove'] ? '' : $this->user->img('site_logo');
     if ($this->config['site_logo_image'] && !$this->config['site_logo_remove']) {
         $logo_path = strpos(strtolower($this->config['site_logo_image']), 'http') !== false ? $this->config['site_logo_image'] : append_sid($this->root_path . $this->config['site_logo_image'], false, false);
         $logo_corners = '0px 0px 0px 0px';
         $logo_corners = $this->config['site_logo_left'] ? $this->config['site_logo_pixels'] . 'px 0px 0px ' . $this->config['site_logo_pixels'] . 'px' : $logo_corners;
         $logo_corners = $this->config['site_logo_right'] ? '0px ' . $this->config['site_logo_pixels'] . 'px ' . $this->config['site_logo_pixels'] . 'px 0px' : $logo_corners;
         $logo_corners = $this->config['site_logo_left'] && $this->config['site_logo_right'] ? $this->config['site_logo_pixels'] . 'px ' . $this->config['site_logo_pixels'] . 'px ' . $this->config['site_logo_pixels'] . 'px ' . $this->config['site_logo_pixels'] . 'px' : $logo_corners;
         $site_logo_img = '<img src=' . $logo_path . ' style="max-width: 100%; height:auto; height:' . $this->config['site_logo_height'] . 'px; width:' . $this->config['site_logo_width'] . 'px; -webkit-border-radius: ' . $logo_corners . '; -moz-border-radius: ' . $logo_corners . '; border-radius: ' . $logo_corners . ';">';
     }
     $this->template->assign_vars(array('SITE_DESCRIPTION' => $this->config['site_name_supress'] ? '' : $this->config['site_desc'], 'SITE_LOGO_CENTRE' => $this->config['site_logo_position'] == 1 ? true : false, 'SITE_LOGO_IMG' => $site_logo_img, 'SITE_LOGO_RIGHT' => $this->config['site_logo_position'] == 2 ? true : false, 'SITENAME_SUPRESS' => $this->config['site_name_supress'] ? true : false, 'S_IN_SEARCH' => $this->config['site_search_remove'] ? true : false));
 }
Beispiel #3
0
 /**
  * Get template vars in a format Twig will use (from the context)
  *
  * @return array
  */
 protected function get_template_vars()
 {
     $vars = $this->gantry['theme']->add_to_context(parent::get_template_vars());
     $locator = $this->gantry['locator'];
     $loader = $this->twig->getLoader();
     foreach ($locator->findResources('gantry-theme://twig') as $path) {
         $loader->addPath($path);
     }
     return $vars;
 }
 /**
  * Check if quickedit is enabled and assign S_QUICK_EDIT accordingly
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function check_quickedit_enabled($event)
 {
     // Check if quick edit is available
     $s_quick_edit = false;
     if ($this->user->data['is_registered'] && $this->config['allow_quick_edit'] && $this->helper->check_forum_permissions($event)) {
         // Quick edit enabled forum
         $s_quick_edit = $this->helper->check_topic_edit($event);
     }
     $this->template->assign_var('S_QUICK_EDIT', $s_quick_edit);
 }
 /**
  * Update the data
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function add_stats_settings($event)
 {
     // Need this as global until it is added to the event
     global $legend;
     //$legend = $event['legend'];
     $display_output = false;
     // No point in doing the processing if it is not being displayed
     if ($this->config['statsonindex_guests'] || $this->config['statsonindex_admin'] && $this->auth->acl_get('a_') || !$this->config['statsonindex_admin'] && $this->user->data['is_registered']) {
         $display_output = true;
         $this->user->add_lang_ext('david63/statsonindex', 'stats_on_index');
         // Activity stats
         // Obtain posts/topics/new users activity
         $activity = $this->obtain_activity_data();
         $tf_posts = number_format($activity['posts'], '0');
         $tf_topics = number_format($activity['topics'], '0');
         $tf_users = number_format($activity['users'], '0');
         // Obtain user activity data
         $active_users = $this->obtain_active_user_data();
         $active_user_count = number_format(sizeof($active_users), '0');
         // 24 hour users online list, assign to the template block: lastvisit
         foreach ($active_users as $row) {
             // Check that the user is valid
             if ($row['user_id']) {
                 if ($row['user_type'] != USER_IGNORE) {
                     $this->template->assign_block_vars('lastvisit_user', array('USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'])));
                 } else {
                     $this->template->assign_block_vars('lastvisit_bot', array('USERNAME_FULL' => get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour'])));
                 }
             }
         }
         // Extended stats
         $files_per_day = number_format($this->config['num_files'] / ceil((time() - $this->config['board_startdate']) / 86400), '2');
         $files_per_user = number_format($this->config['num_files'] / $this->config['num_users'], '2');
         $files_per_year = number_format($files_per_day * 364.25, '0');
         $posts_per_day = number_format($this->config['num_posts'] / ceil((time() - $this->config['board_startdate']) / 86400), '2');
         $posts_per_topic = number_format($this->config['num_posts'] / $this->config['num_topics'], '2');
         $posts_per_user = number_format($this->config['num_posts'] / $this->config['num_users'], '2');
         $posts_per_year = number_format($posts_per_day * 364.25, '0');
         $topics_per_day = number_format($this->config['num_topics'] / ceil((time() - $this->config['board_startdate']) / 86400), '2');
         $topics_per_user = number_format($this->config['num_topics'] / $this->config['num_users'], '2');
         $topics_per_year = number_format($topics_per_day * 364.25, '0');
         $total_files = number_format($this->config['num_files'], '0');
         $users_per_day = number_format($this->config['num_users'] / ceil((time() - $this->config['board_startdate']) / 86400), '2');
         $users_per_year = number_format($users_per_day * 364.25, '0');
         $none = $this->user->lang('NONE');
         $this->template->assign_vars(array('FILES_PER_DAY' => $this->user->lang('FILE_PER_DAY', $files_per_day == 0 ? $none : $files_per_day), 'FILES_PER_USER' => $this->user->lang('FILES_PER_USER', $files_per_user == 0 ? $none : $files_per_user), 'FILES_PER_YEAR' => $this->user->lang('FILES_PER_YEAR', $files_per_year == 0 ? $none : $files_per_year), 'POSTS_PER_DAY' => $this->user->lang('POST_PER_DAY', $posts_per_day == 0 ? $none : $posts_per_day), 'POSTS_PER_TOPIC' => $this->user->lang('POSTS_PER_TOPIC', $posts_per_topic == 0 ? $none : $posts_per_topic), 'POSTS_PER_USER' => $this->user->lang('POSTS_PER_USER', $posts_per_user == 0 ? $none : $posts_per_user), 'POSTS_PER_YEAR' => $this->user->lang('POSTS_PER_YEAR', $posts_per_year == 0 ? $none : $posts_per_year), 'TFHOUR_POSTS' => $this->user->lang('TFHOUR_POSTS', $tf_posts == 0 ? $none : $tf_posts), 'TFHOUR_TOPICS' => $this->user->lang('TFHOUR_TOPICS', $tf_topics == 0 ? $none : $tf_topics), 'TFHOUR_USERS' => $this->user->lang('TFHOUR_USERS', $tf_users == 0 ? $none : $tf_users), 'TOPICS_PER_DAY' => $this->user->lang('TOPIC_PER_DAY', $topics_per_day == 0 ? $none : $topics_per_day), 'TOPICS_PER_USER' => $this->user->lang('TOPICS_PER_USER', $topics_per_user == 0 ? $none : $topics_per_user), 'TOPICS_PER_YEAR' => $this->user->lang('TOPICS_PER_YEAR', $topics_per_year == 0 ? $none : $topics_per_year), 'TOTAL_FILES' => $this->user->lang('TOTAL_FILES', $total_files == 0 ? $none : $total_files), 'USERS_PER_DAY' => $this->user->lang('USER_PER_DAY', $users_per_day == 0 ? $none : $users_per_day), 'USERS_PER_YEAR' => $this->user->lang('USERS_PER_YEAR', $users_per_year == 0 ? $none : $users_per_year), 'USERS_TFHOUR_TOTAL' => $this->user->lang('USERS_TFHOUR_TOTAL', $active_user_count == 0 ? $none : (int) $active_user_count), 'START_DATE' => $this->user->format_date($this->config['board_startdate']), 'ONLINE_FOR' => floor((time() - $this->config['board_startdate']) / 86400), 'S_SHOW_BOTS' => $this->config['statsonindex_bots'], 'S_SHOW_DAYS' => $this->config['statsonindex_days'], 'S_SHOW_STATS' => $this->config['statsonindex_stats'], 'S_SHOW_SUMMARY' => $this->config['statsonindex_summary'], 'S_SHOW_USERS' => $this->config['statsonindex_users'], 'LEGEND' => false, 'LEGEND_USERS' => $legend, 'TOTAL_POSTS' => $this->user->lang('TOTAL_POSTS_COUNT', number_format($this->config['num_posts'], '0')), 'TOTAL_TOPICS' => $this->user->lang('TOTAL_TOPICS', number_format($this->config['num_topics'], '0')), 'TOTAL_USERS' => $this->user->lang('TOTAL_USERS', number_format($this->config['num_users'], '0'))));
     }
     $this->template->assign_var('S_DISPLAY_STATS_OUTPUT', $display_output);
 }
Beispiel #6
0
 /**
  * Add some additional template variables
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function page_header($event)
 {
     $this->template->assign_vars(array('DISCLAIMER_BODY' => sprintf($this->user->lang('DISCLAIMER_TEXT'), $this->config['sitename']), 'S_DISCLAIMER' => $this->config['show_disclaimer'], 'SITE' => $this->config['sitename']));
 }
Beispiel #7
0
 public function display_list(array $data, \phpbb\template\twig\twig &$template, $handle = 'tree')
 {
     $prev_depth = 0;
     $parental_depth = array(0 => -1);
     $data = array_values($data);
     for ($i = 0, $size = sizeof($data); $i < $size; $i++) {
         $row = $data[$i];
         $this_depth = $parental_depth[$row['parent_id']] + 1;
         $repeat = abs($prev_depth - $this_depth);
         $tpl_data = array('PREV_DEPTH' => $prev_depth, 'THIS_DEPTH' => $this_depth, 'NUM_KIDS' => $this->count_descendants($row));
         $template->assign_block_vars($handle, array_merge($tpl_data, array_change_key_case($row, CASE_UPPER)));
         for ($j = 0; $j < $repeat; $j++) {
             $template->assign_block_vars($handle . '.close', array());
         }
         $prev_depth = $this_depth;
         $parental_depth[$row[$this->pk]] = $this_depth;
     }
     for ($i = 0; $i < $prev_depth; $i++) {
         $template->assign_block_vars('close_' . $handle, array());
     }
 }
 protected function close_open_tags(\phpbb\template\twig\twig &$template, $handle, $repeat)
 {
     for ($i = 0; $i < $repeat; $i++) {
         $template->assign_block_vars($handle, array());
     }
 }
Beispiel #9
0
 /**
  * Add the required template variables
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function page_header($event)
 {
     $this->template->assign_vars(array('S_USER_RANKS' => $this->config['userranks_enable'], 'S_USER_RANKS_LINK_ENABLED' => $this->config['userranks_header_link'], 'U_USER_RANKS' => $this->controller_helper->route('david63_userranks_main_controller', array('name' => 'ranks')), 'U_USER_RANKS_MEMBERS' => $this->config['userranks_members'] || $this->config['userranks_members_admin'] && $this->auth->acl_get('a_')));
 }
Beispiel #10
0
 /**
  * @param array $cur_voted_id
  * @param array $poll_info
  * @param int $poll_total
  * @param int $poll_most
  * @param \phpbb\template\twig\twig $template
  */
 private function _build_poll_options(array $cur_voted_id, array $poll_info, $poll_total, $poll_most, \phpbb\template\twig\twig &$template)
 {
     foreach ($poll_info as $poll_option) {
         $option_pct = $this->_calculate_option_percent($poll_option['poll_option_total'], $poll_total);
         $option_pct_rel = $this->_calculate_option_percent_rel($poll_option['poll_option_total'], $poll_most);
         $template->assign_block_vars('poll_option', array('POLL_OPTION_ID' => $poll_option['poll_option_id'], 'POLL_OPTION_CAPTION' => $poll_option['poll_option_text'], 'POLL_OPTION_RESULT' => $poll_option['poll_option_total'], 'POLL_OPTION_PERCENT' => sprintf("%.1d%%", round($option_pct * 100)), 'POLL_OPTION_PERCENT_REL' => sprintf("%.1d%%", round($option_pct_rel * 100)), 'POLL_OPTION_PCT' => round($option_pct * 100), 'POLL_OPTION_WIDTH' => round($option_pct * 250), 'POLL_OPTION_VOTED' => $this->_user_has_voted_option($poll_option['poll_option_id'], $cur_voted_id), 'POLL_OPTION_MOST_VOTES' => $this->_is_most_voted($poll_option['poll_option_total'], $poll_most)));
     }
 }
Beispiel #11
0
 public function page_footer($event)
 {
     $this->template->assign_vars(array('S_COOKIE_ON_INDEX' => $this->config['cookie_on_index'], 'S_COOKIE_SHOW_POLICY' => $this->config['cookie_show_policy'], 'U_COOKIE_PAGE' => $this->helper->route('david63_cookiepolicy_controller', array('name' => 'cookie'))));
 }