Exemplo n.º 1
0
 /**
  * Displays the global ranking list.
  *
  * @param int $page Page of the ranking list to be displayed.
  */
 public function index_action($page = 1)
 {
     $vis_query = get_vis_query('b');
     // Calculate offsets
     $max_per_page = get_config('ENTRIES_PER_PAGE');
     if ($page < 1) {
         $page = 1;
     }
     $offset = max(0, ($page - 1) * $max_per_page);
     // Liste aller die mutig (oder eitel?) genug sind
     $query = "SELECT SQL_CALC_FOUND_ROWS a.user_id,username,score,geschlecht, {$GLOBALS['_fullname_sql']['full']} AS fullname\n                  FROM user_info AS a\n                  LEFT JOIN auth_user_md5 AS b USING (user_id)\n                  WHERE score > 0 AND locked = 0 AND {$vis_query}\n                  ORDER BY score DESC\n                  LIMIT " . (int) $offset . "," . (int) $max_per_page;
     $result = DBManager::get()->fetchAll($query);
     $count = DBManager::get()->fetchColumn("SELECT FOUND_ROWS()");
     $persons = array();
     foreach ($result as $row) {
         $row['is_king'] = StudipKing::is_king($row['user_id'], true);
         $persons[$row['user_id']] = $row;
     }
     $persons = Score::getScoreContent($persons);
     $this->persons = array_values($persons);
     $this->numberOfPersons = $count;
     $this->page = $page;
     $this->offset = $offset;
     $this->max_per_page = $max_per_page;
     $this->current_user = User::findCurrent();
     $this->current_user_score = Score::getMyScore($this->current_user);
     // Set up sidebar and helpbar
     $sidebar = Sidebar::get();
     $sidebar->setImage('sidebar/medal-sidebar.png');
     $actions = new OptionsWidget();
     $actions->addCheckbox(_('Ihren Wert veröffentlichen'), $this->current_user->score, $this->url_for('score/publish'), $this->url_for('score/unpublish'));
     $sidebar->addWidget($actions);
     $helpbar = Helpbar::get();
 }
Exemplo n.º 2
0
 private static function get_kings()
 {
     if (self::$kings === null) {
         $cache = StudipCacheFactory::getCache();
         # read cache (unserializing a cache miss - FALSE - does not matter)
         $kings = unserialize($cache->read(self::CACHE_KEY));
         # cache miss, retrieve from database
         if ($kings === FALSE) {
             $kings = self::get_kings_uncached();
             # write to cache with an expiry time of 24 hours
             $cache->write(self::CACHE_KEY, serialize($kings), 86400);
         }
         self::$kings = $kings;
     }
     return self::$kings;
 }
Exemplo n.º 3
0
 /**
  * Get the decorated StudIP-Kings information
  * @return String
  */
 function getKingsInformations()
 {
     $is_king = StudipKing::is_king($this->current_user->user_id, TRUE);
     $result = '';
     foreach ($is_king as $type => $text) {
         $type = str_replace('_', '-', $type);
         $result .= Assets::img("crowns/crown-{$type}.png", array('alt' => $text, 'title' => $text));
     }
     return $result ?: null;
 }
Exemplo n.º 4
0
">
            <?php 
echo Avatar::getAvatar($user['user_id'], $user['username'])->getImageTag(Avatar::SMALL, array('title' => htmlReady($user['name'])));
?>
        </a>
    </td>
    <td>
        <a href="<?php 
echo $controller->url_for('profile?username='******'username']);
?>
">
            <?php 
echo htmlReady($user['name']);
?>
        </a>
    <? foreach (StudipKing::is_king($user['user_id'], true) as $text) : ?>
        <?php 
echo Icon::create('crown', 'sort', ['title' => $text])->asImg();
?>
    <? endforeach ?>
    </td>
    <td style="white-space: nowrap;">
        <?php 
echo ucfirst(reltime(time() - $user['last_action']));
?>
    </td>
    <td class="actions" nowrap="nowrap">
    <? if (class_exists("Blubber")) : ?>
        <a href="<?php 
echo URLHelper::getLink('plugins.php/blubber/streams/global', array('mention' => $user['username']));
?>
Exemplo n.º 5
0
            <?php 
echo Avatar::getAvatar($tmp_user_id)->getImageTag(Avatar::SMALL);
?>
        </a>
    </td>

    <td width="66%">
        <a href="<?php 
echo URLHelper::getLink('dispatch.php/profile', array('username' => $tmp_online_uname));
?>
">
            <?php 
echo htmlReady($fullname);
?>
        </a>
            <? foreach (StudipKing::is_king($tmp_user_id, TRUE) as $type => $text) : ?>
                <?php 
echo Icon::create('crown', 'sort', ['title' => $text, 'title' => $text, 'class' => 'text-bottom'])->asImg();
?>
            <? endforeach ?>
    </td>

    <td width="20%">
            <?php 
echo date("i:s", $zeit);
?>
    </td>

    <td width="3%" align="center">
        <? if (class_exists("Blubber")) : ?>
        <a href="<?php