Exemple #1
0
 public static function GenerateUserList($site_prefix, $response, $paginate = FALSE)
 {
     $users_html = array();
     // IF total > 30 then we display page numbers
     if ($paginate && $response->Total(TRUE) > 30) {
         $users_html[] = Page::GeneratePageNumbers(ceil($response->Total() / 30));
     }
     while ($user = $response->Fetch(FALSE)) {
         // Get the user's location
         $user['location'] = ViewUtils::GetIndexValue($user, 'location');
         // Generate the URL of their profile
         $profile_url = "{$site_prefix}/users/{$user['user_id']}";
         $users_html[] = '<li><span class="ui-li-count">' . Number::FormatUnit($user['reputation']) . "</span><a href='{$profile_url}'><img src='{$user['profile_image']}&s=16' class='site-icon ui-li-icon' />" . self::GenerateUsername($user) . "<p>{$user['location']}</p></a></li>";
     }
     if (count($users_html)) {
         return implode('', $users_html);
     } else {
         return '<li><span class="unknown">[empty]</span></li>';
     }
 }