当前位置: 首页>>代码示例>>PHP>>正文


PHP Avatar::getPicture方法代码示例

本文整理汇总了PHP中Avatar::getPicture方法的典型用法代码示例。如果您正苦于以下问题:PHP Avatar::getPicture方法的具体用法?PHP Avatar::getPicture怎么用?PHP Avatar::getPicture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Avatar的用法示例。


在下文中一共展示了Avatar::getPicture方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showWidget

    function showWidget($top = false)
    {
        global $wgLanguageCode, $wgParser;
        $rec = FeaturedContributor::getFCList($top);
        preg_match('/== (.*?) ==/', $rec, $matches);
        $fc_user = $matches[1];
        preg_match('/==\\n(.*)/', $rec, $matches);
        $fc_blurb = $matches[1];
        $u = User::newFromName($fc_user);
        if (!$u) {
            return;
        }
        $u->load();
        $avatar = $wgLanguageCode == 'en' ? Avatar::getPicture($u->getName(), true, true) : "";
        $t = new Title();
        $output = $wgParser->parse($fc_blurb, $t, new ParserOptions());
        $fc_blurb = preg_replace("/\n/", "", strip_tags($output->getText(), '<p><b><a><br>'));
        $fc_blurb = str_replace("\$1", $u->getName(), $fc_blurb);
        $regYear = gmdate('Y', wfTimestamp(TS_UNIX, $u->getRegistration()));
        $fc_blurb = str_replace("\$2", $regYear, $fc_blurb);
        ?>
	<div>
		<h3><?php 
        echo wfMessage('fc_title')->text();
        ?>
</h3>
		<div class='featuredContrib_id'>
		<?php 
        if ($avatar != '') {
            ?>
			<span id='fc_id_img' class='fc_id_img'><a href='/<?php 
            echo $u->getUserPage();
            ?>
' onclick='gatTrack("Browsing","Feat_contrib_img","Feat_contrib_wgt");'><?php 
            echo $avatar;
            ?>
</a></span>
		<?php 
        }
        ?>
		<span id='fc_id' class='fc_id' onclick='gatTrack("Browsing","Feat_contrib_blurb","Feat_contrib_wgt");'><?php 
        echo $fc_blurb;
        ?>
</span>
		</div>
        <div class="clearall"></div>
	</div>

<?php 
        return;
    }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:51,代码来源:FeaturedContributor.body.php

示例2: getPBTitle

 function getPBTitle()
 {
     global $wgUser, $wgOut, $wgLang, $wgTitle, $wgScriptPath, $wgStylePath;
     wfLoadExtensionMessages('ProfileBox');
     $name = "";
     $name .= wfMsg('profilebox-name');
     $name .= " for " . $wgUser->getName();
     $avatar = Avatar::getPicture($wgUser->getName());
     if ($wgUser->getID() > 0) {
         if ($wgUser->getRegistration() != '') {
             $pbDate = ProfileBox::getMemberLength(wfTimestamp(TS_UNIX, $wgUser->getRegistration()));
         } else {
             $pbDate = ProfileBox::getMemberLength(wfTimestamp(TS_UNIX, '20060725043938'));
         }
     }
     $heading = $avatar . "<div id='avatarNameWrap'><h1 class=\"firstHeading\">" . $name . "</h1><div id='regdate'>" . wfMsg('pb-joinedwikihow', $pbDate) . "</div></div><div style='clear: both;'> </div>";
     return $heading;
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:18,代码来源:ProfileBox.body.php

示例3: getLeaderboard

 public function getLeaderboard(&$dbr)
 {
     global $wgUser;
     $sk = $wgUser->getSkin();
     $startdate = strtotime('7 days ago');
     $starttimestamp = date('YmdG', $startdate) . floor(date('i', $startdate) / 10) . '00000';
     $data = $this->getLeaderboardData($dbr, $starttimestamp);
     $count = 0;
     $leaderboardData = array();
     foreach ($data as $key => $value) {
         $u = new User();
         $u->setName($key);
         if ($value > 0 && $key != '' && $u->getName() != "WRM") {
             $leaderboardData[$count] = array();
             $img = Avatar::getPicture($u->getName(), true);
             if ($img == '') {
                 $img = Avatar::getDefaultPicture();
             }
             $leaderboardData[$count]['img'] = $img;
             $leaderboardData[$count]['user'] = $sk->makeLinkObj($u->getUserPage(), $u->getName());
             $leaderboardData[$count]['count'] = $value;
             $data[$key] = $value * -1;
             $count++;
             if ($count >= 6) {
                 break;
             }
         }
     }
     $html = "";
     $count = 0;
     foreach ($leaderboardData as $leader) {
         if ($count == 0) {
             $html .= "<tr class='first'>";
         } else {
             $html .= "<tr>";
         }
         $html .= "<td class='cd-avatar'>" . $leader['img'] . "</td>";
         $html .= "<td class='cd-user'>" . $leader['user'] . "</td>";
         $html .= "<td class='cd-count'>" . $leader['count'] . "</td>";
         $html .= "</tr>";
         $count++;
     }
     $jsondata = array();
     $jsondata['leaderboard'] = $html;
     return json_encode($jsondata);
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:46,代码来源:DashboardWidget.php

示例4: execute

    /**
     * Template filter callback for wikiHow skin.
     * Takes an associative array of data set from a SkinTemplate-based
     * class, and a wrapper for MediaWiki's localization database, and
     * outputs a formatted page.
     *
     * @access private
     */
    public function execute()
    {
        global $wgUser, $wgLang, $wgTitle, $wgRequest, $wgParser, $wgGoogleSiteVerification;
        global $wgOut, $wgScript, $wgStylePath, $wgLanguageCode, $wgForumLink;
        global $wgContLang, $wgXhtmlDefaultNamespace, $wgContLanguageCode;
        global $wgWikiHowSections, $IP, $wgServer, $wgServerName, $wgIsDomainTest;
        global $wgSSLsite, $wgSpecialPages;
        $prefix = "";
        if (class_exists('MobileWikihow')) {
            $mobileWikihow = new MobileWikihow();
            $result = $mobileWikihow->controller();
            // false means we stop processing template
            if (!$result) {
                return;
            }
        }
        $action = $wgRequest->getVal('action', 'view');
        if (count($wgRequest->getVal('diff')) > 0) {
            $action = 'diff';
        }
        $isMainPage = $wgTitle && $wgTitle->getNamespace() == NS_MAIN && $wgTitle->getText() == wfMessage('mainpage')->inContentLanguage()->text() && $action == 'view';
        $isArticlePage = $wgTitle && !$isMainPage && $wgTitle->getNamespace() == NS_MAIN && $action == 'view';
        $isDocViewer = $wgTitle->getText() == "DocViewer";
        $isBehindHttpAuth = !empty($_SERVER['HTTP_AUTHORIZATION']);
        // determine whether or not the user is logged in
        $isLoggedIn = $wgUser->getID() > 0;
        $isTool = false;
        wfRunHooks('getToolStatus', array(&$isTool));
        $sk = $this->getSkin();
        wikihowAds::setCategories();
        if (!$isLoggedIn && $action == "view") {
            wikihowAds::getGlobalChannels();
        }
        $showAds = wikihowAds::isEligibleForAds();
        $isIndexed = RobotPolicy::isIndexable($wgTitle);
        $pageTitle = SkinWikihowSkin::getHTMLTitle($wgOut->getHTMLTitle(), $this->data['title'], $isMainPage);
        // set the title and what not
        $avatar = '';
        $namespace = $wgTitle->getNamespace();
        if ($namespace == NS_USER || $namespace == NS_USER_TALK) {
            $username = $wgTitle->getText();
            $usernameKey = $wgTitle->getDBKey();
            $avatar = $wgLanguageCode == 'en' ? Avatar::getPicture($usernameKey) : "";
            $h1 = $username;
            if ($wgTitle->getNamespace() == NS_USER_TALK) {
                $h1 = $wgLang->getNsText(NS_USER_TALK) . ": {$username}";
            } elseif ($username == $wgUser->getName()) {
                //user's own page
                $profileBoxName = wfMessage('profilebox-name')->text();
                $h1 .= "<div id='gatEditRemoveButtons'>\n\t\t\t\t\t\t\t\t<a href='/Special:Profilebox' id='gatProfileEditButton'>Edit</a>\n\t\t\t\t\t\t\t\t | <a href='#' onclick='removeUserPage(\"{$profileBoxName}\");'>Remove {$profileBoxName}</a>\n\t\t\t\t\t\t\t\t </div>";
            }
            $this->set("title", $h1);
        }
        $logoutPage = $wgLang->specialPage("Userlogout");
        $returnTarget = $wgTitle->getPrefixedURL();
        $returnto = strcasecmp(urlencode($logoutPage), $returnTarget) ? "returnto={$returnTarget}" : "";
        $login = "";
        if (!$wgUser->isAnon()) {
            $uname = $wgUser->getName();
            if (strlen($uname) > 16) {
                $uname = substr($uname, 0, 16) . "...";
            }
            $login = wfMessage('welcome_back', $wgUser->getUserPage()->getFullURL(), $uname)->text();
            if ($wgLanguageCode == 'en' && $wgUser->isFacebookUser()) {
                $login = wfMessage('welcome_back_fb', $wgUser->getUserPage()->getFullURL(), $wgUser->getName())->text();
            } elseif ($wgLanguageCode == 'en' && $wgUser->isGPlusUser()) {
                $gname = $wgUser->getName();
                if (substr($gname, 0, 3) == 'GP_') {
                    $gname = substr($gname, 0, 12) . '...';
                }
                $login = wfMessage('welcome_back_gp', $wgUser->getUserPage()->getFullURL(), $gname)->text();
            }
        } else {
            if ($wgLanguageCode == "en") {
                $login = wfMessage('signup_or_login', $returnto)->text() . " " . wfMessage('social_connect_header')->text();
            } else {
                $login = wfMessage('signup_or_login', $returnto)->text();
            }
        }
        //XX PROFILE EDIT/CREAT/DEL BOX DATE - need to check for pb flag in order to display this.
        $pbDate = "";
        $pbDateFlag = 0;
        $profilebox_name = wfMessage('profilebox-name')->text();
        if ($wgTitle->getNamespace() == NS_USER) {
            if ($u = User::newFromName($wgTitle->getDBKey())) {
                if (UserPagePolicy::isGoodUserPage($wgTitle->getDBKey())) {
                    $pbDate = ProfileBox::getPageTop($u);
                    $pbDateFlag = true;
                }
            }
        }
        $heading = '';
//.........这里部分代码省略.........
开发者ID:biribogos,项目名称:wikihow-src,代码行数:101,代码来源:WikiHowSkin.php

示例5: execute


//.........这里部分代码省略.........
             $data = $this->getThumbsUp($starttimestamp);
             break;
         case 'spellchecked':
             $section = 'Writing';
             $learnlink = '/wikiHow:Spellchecker';
             $columnHeader = 'Articles Spell Checked';
             $data = $this->getSpellchecked($starttimestamp);
             break;
         case 'methodguardian':
             $section = 'Other';
             $learnlink = '/wikiHow:LB-Method-Guardian';
             $columnHeader = 'Methods Guarded';
             $data = $this->getMethodGuardian($starttimestamp);
             break;
         case 'methodeditor':
             $section = 'Other';
             $learnlink = '/wikiHow:LB-Method-Editor';
             $columnHeader = 'Methods Edited';
             $data = $this->getMethodEditor($starttimestamp);
             break;
         case 'welcomewagon':
             $section = 'Other';
             $learnlink = '/wikiHow:LB-Welcome-Wagon';
             $columnHeader = 'Welcome Wagon';
             $data = $this->getWelcomeWagon($starttimestamp);
             break;
         default:
             $wgOut->redirect($wgServer . "/Special:Leaderboard/articles_written");
             return;
     }
     switch ($section) {
         case 'Other':
             $sectionStyleOther = "class='on'";
             break;
         case 'RCNAB':
             $sectionStyleRCNAB = "class='on'";
             break;
         case 'Writing':
             $sectionStyleWriting = "class='on'";
             break;
         case 'Greenhouse':
             $sectionStyleGreenhouse = "class='on'";
             break;
         case "Imagevideo":
             $sectionStyleImagevideo = "class='on'";
             break;
     }
     // Vu Note: Due to the reskin adding elements above the articl_tab_line, I had use javascript to inject the tabs above the article_inner.  hacky i know, but otherwise it would have to go into the skin which is worse.
     $dropdown = " <span style='float:right;'>In the last <select id='period' onChange='changePeriod(this);'> <option {$period24selected} value='24'>24 hours</option> <option {$period7selected} value='7'>7 days</option> <option {$period31selected} value='31'>31 days</option> </select> </span>";
     $tabs_main = "<ul id='tabs'><li><a href='/Special:Leaderboard/articles_written' {$sectionStyleWriting} >Writing</a></li><li><a href='/Special:Leaderboard/articles_nabed' {$sectionStyleRCNAB} >RC and NAB</a></li><li><a href='/Special:Leaderboard/repair_format' {$sectionStyleGreenhouse} >Greenhouse</a></li><li><a href='/Special:Leaderboard/images_added' {$sectionStyleImagevideo} >Images/Videos</a></li><li><a href='/Special:Leaderboard/total_edits' {$sectionStyleOther} >Other</a></li></ul>";
     $tabs_sub = $this->getTabs($section, $target);
     if ($action != 'articlelist') {
         $tabs_sub .= "<div class='clearall'></div>";
     }
     $tab_sub .= "<div style='clear:both;'></div>";
     $wgOut->addHTML("<div id='leaderboard_tabs'>{$dropdown}{$tabs_main}{$tabs_sub}</div>");
     $wgOut->addHTML("  <style type='text/css' media='all'>/*<![CDATA[*/ @import '" . wfGetPad('/extensions/min/f/extensions/wikihow/winpop.css?rev=') . WH_SITEREV . "'; /*]]>*/</style>\n\t\t\t<script type='text/javascript' language='javascript' src='" . wfGetPad('/extensions/min/f/extensions/wikihow/winpop.js?rev=') . WH_SITEREV . "'></script>");
     $wgOut->addHTML("  <script type='text/javascript'>\n\t\t\t\tvar lb_page = '{$target}';\n\t\t\t\tvar lb_period = '{$period}';\n\t\t\t</script>\n");
     //
     //MAIN PAGE SECTION
     //
     if ($action == 'articlelist') {
         $u = User::newFromName($wgRequest->getVal('lb_name'));
         if (isset($u)) {
             $this->showArticlesPage($target, $period, $starttimestamp, $u->getName());
         } else {
             echo wfMsg('leaderboard-invalid-user');
         }
         return;
     }
     $wgOut->addHTML("<div id='Leaderboard' class='section_text'>\n\t\t\t<p class='leader_head'>Leaders: {$columnHeader}</p> <span class='leader_learn'><img src='" . wfGetPad('/skins/WikiHow/images/icon_help.jpg') . "'><a href='{$learnlink}'>Learn about this activity</a></span>\n\t\t");
     $wgOut->addHTML("\n\t\t\t<table class='leader_table'>\n\t\t\t\t<tr> <td colspan='3' class='leader_title'>{$columnHeader}:</td> </tr> ");
     $index = 1;
     //display difference in only new articles
     //don't sort nfd b/c numbers can be big and include "," so don't sort nicely
     if ($target != 'rc_edits' && $target != 'nfd') {
         arsort($data);
     }
     foreach ($data as $key => $value) {
         $u = new User();
         $u->setName($key);
         if ($value > 0 && $key != '' && $u->getName() != "WRM") {
             $class = "";
             if ($index % 2 == 1) {
                 $class = 'class="odd"';
             }
             $img = Avatar::getPicture($u->getName(), true);
             if ($img == '') {
                 $img = Avatar::getDefaultPicture();
             }
             $wgOut->addHTML("\n\t\t\t\t<tr {$class}>\n\t\t\t\t\t<td class='leader_image'>" . $img . "</td>\n\t\t\t\t\t<td class='leader_user'>" . $sk->makeLinkObj($u->getUserPage(), $u->getName()) . "</td>\n\t\t\t\t\t<td class='leader_count'><a href='/Special:Leaderboard/{$target}?action=articlelist&period={$period}&lb_name=" . $u->getName() . "' >{$value}</a> </td>\n\t\t\t\t</tr> ");
             $data[$key] = $value * -1;
             $index++;
         }
         if ($index > 20) {
             break;
         }
     }
     $wgOut->addHTML("</table></div>");
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:101,代码来源:Leaderboard.body.php

示例6: getTopAuthorWidget

 function getTopAuthorWidget()
 {
     global $wgUser;
     $startdate = strtotime('7 days ago');
     $starttimestamp = date('Ymd-G', $startdate) . '!' . floor(date('i', $startdate) / 10) . '00000';
     $data = LeaderBoard::getArticlesWritten($starttimestamp);
     arsort($data);
     $html = "<h3>Top Authors - Last 7 Days</h3><table class='stleaders'>";
     $index = 1;
     $sk = $wgUser->getSkin();
     foreach ($data as $key => $value) {
         $u = new User();
         $value = number_format($value, 0, "", ',');
         $u->setName($key);
         if ($value > 0 && $key != '') {
             $class = "";
             if ($index % 2 == 1) {
                 $class = 'class="odd"';
             }
             $img = Avatar::getPicture($u->getName(), true);
             if ($img == '') {
                 $img = Avatar::getDefaultPicture();
             }
             $html .= "<tr {$class}>\n\t\t\t\t\t<td class='leader_image'>" . $img . "</td>\n\t\t\t\t\t<td class='leader_user'>" . $sk->makeLinkObj($u->getUserPage(), $u->getName()) . "</td>\n\t\t\t\t\t<td class='leader_count'><a href='/Special:Leaderboard/{$target}?action=articlelist&period={$period}&lb_name=" . $u->getName() . "' >{$value}</a> </td>\n\t\t\t\t</tr> ";
             $data[$key] = $value * -1;
             $index++;
         }
         if ($index > 6) {
             break;
         }
     }
     $html .= "</table>";
     return $html;
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:34,代码来源:Suggest.body.php

示例7: displayContainer

 /**
  * Display the HTML for this special page with all the widgets in it
  */
 private function displayContainer()
 {
     global $wgWidgetList, $wgUser, $wgWidgetShortCodes;
     $containerJS = array('community-dashboard.js', 'dashboard-widget.js', 'jquery.ui.sortable.min.js', 'jquery.json-2.2.min.js');
     $containerCSS = array('community-dashboard.css');
     $jsTags = $this->makeUrlTags('js', $containerJS);
     $cssTags = $this->makeUrlTags('css', $containerCSS);
     // get all commonly updating stats, to see the initial widget
     // displays with
     $this->refreshData = $this->dashboardData->getStatsData();
     // get all data such as wikihow-defined structure goals, dynamic
     // global data, and user-specific data
     $staticData = $this->dashboardData->loadStaticGlobalOpts();
     $priorities = json_decode($staticData['cdo_priorities_json'], true);
     if (!is_array($priorities)) {
         $priorities = array();
     }
     $thresholds = json_decode($staticData['cdo_thresholds_json'], true);
     DashboardWidget::setThresholds($thresholds);
     $baselines = (array) json_decode($staticData['cdo_baselines_json']);
     DashboardWidget::setBaselines($baselines);
     DashboardWidget::setMaxUsernameLength(CommunityDashboard::USERNAME_MAX_LENGTH);
     // display the user-defined ordering of widgets inside an outside
     // container
     $userData = $this->dashboardData->loadUserData();
     $prefs = !empty($userData['prefs']) ? $userData['prefs'] : array();
     $userOrdering = isset($prefs['ordering']) ? $prefs['ordering'] : array();
     $completion = !empty($userData['completion']) ? $userData['completion'] : array();
     DashboardWidget::setCompletion($completion);
     // add any new widgets that have been added since the user last
     // customized
     foreach ($wgWidgetList as $name) {
         $found = false;
         foreach ($userOrdering as $arr) {
             if ($arr['wid'] == $name) {
                 $found = true;
                 break;
             }
         }
         if (!$found) {
             $userOrdering[] = array('wid' => $name, 'show' => 1);
         }
     }
     // create the user-defined ordering list, removing any community
     // priority widgets from the list so their not displayed twice
     $userWidgets = array();
     foreach ($userOrdering as $arr) {
         $found = false;
         foreach ($priorities as $name) {
             if ($arr['wid'] == $name) {
                 $found = true;
                 break;
             }
         }
         if (!$found && $arr['show']) {
             $userWidgets[] = $arr['wid'];
         }
     }
     $func = array($this, 'displayWidgets');
     $out = call_user_func($func, array('test'));
     $langKeys = array('howto', 'cd-pause-updates', 'cd-resume-updates', 'cd-current-priority', 'cd-network-error');
     $langScript = Wikihow_i18n::genJSMsgs($langKeys);
     //TODO: Likely should move this somewhere else
     //but not sure where yet
     //load user specific info that only needs to be loaded
     //once
     if ($wgUser->getID() > 0) {
         $u = new User();
         $u->setID($wgUser->getID());
         $img = Avatar::getPicture($u->getName(), true);
         if ($img == '') {
             $img = Avatar::getDefaultPicture();
         }
         $sk = $wgUser->getSkin();
         $userName = $sk->makeLinkObj($u->getUserPage(), $u->getName());
         $tipsLink = "/Special:TipsPatrol";
     } else {
         $tipsLink = "/Special:Userlogin?returnto=Special:TipsPatrol";
     }
     $tmpl = new EasyTemplate(dirname(__FILE__));
     $tmpl->set_vars(array('jsTags' => $jsTags, 'cssTags' => $cssTags, 'thresholds' => $staticData['cdo_thresholds_json'], 'GLOBAL_DATA_REFRESH_TIME_SECS' => self::GLOBAL_DATA_REFRESH_TIME_SECS, 'USER_DATA_REFRESH_TIME_SECS' => self::USER_DATA_REFRESH_TIME_SECS, 'USERNAME_MAX_LENGTH' => self::USERNAME_MAX_LENGTH, 'widgetTitles' => DashboardData::getTitles(), 'priorityWidgets' => $priorities, 'userWidgets' => $userWidgets, 'prefsOrdering' => $userOrdering, 'userCounts' => $userData['counts'], 'userImage' => $img, 'userName' => $userName, 'displayWidgetsFunc' => array($this, 'displayWidgets'), 'appShortCodes' => $wgWidgetShortCodes, 'tipsLink' => $tipsLink));
     $html = $tmpl->execute('dashboard-container.tmpl.php');
     return $langScript . $html;
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:87,代码来源:CommunityDashboard.body.php

示例8: getUserAvatar

 private function getUserAvatar($user, $guestId)
 {
     if ($user->isAnon()) {
         // look for the guest_id cookie value to
         // give them the right avatar image
         $userAvatar = Avatar::getAnonAvatar($guestId);
         return $userAvatar;
     }
     $avatar = Avatar::getPicture($user->getName(), false);
     if ($avatar == '') {
         $avatar = Avatar::getDefaultPicture();
     }
     $userName = Linker::linkKnown($user->getUserPage(), $user->getName());
     $userAvatar = array("name" => $userName, "image" => $avatar);
     return $userAvatar;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:16,代码来源:UCIPatrol.body.php

示例9: getReviewersTable

 function getReviewersTable()
 {
     $rankings = self::getWeekRankings();
     $table = "<table>";
     $index = 0;
     if (isset($rankings) && is_array($rankings)) {
         foreach ($rankings as $u => $c) {
             $u = User::newFromID($u);
             $u->load();
             $img = Avatar::getPicture($u->getName(), true);
             if ($img == '') {
                 $img = Avatar::getDefaultPicture();
             }
             $table .= "<tr><td class='va_image'>{$img}</td><td class='va_reviewer'><a href='{$u->getUserPage()->getFullURL()}' target='new'>{$u->getName()}</a></td><td class='va_stat'>{$c}</td></tr>";
             $index++;
             if ($index == 5) {
                 break;
             }
         }
     }
     $table .= "</table>";
     return $table;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:23,代码来源:Videoadder.body.php

示例10: getStandingsTable

 /**
  * getStandingsTable
  * returns just the raw table for the standings, useful for ajax calls
  **/
 function getStandingsTable()
 {
     global $wgUser;
     $fname = "StandingsGroup::getStandingsTable";
     wfProfileIn($fname);
     $display = "<table>";
     $startdate = strtotime('7 days ago');
     $starttimestamp = date('YmdG', $startdate) . floor(date('i', $startdate) / 10) . '00000';
     $data = $this->getStandingsFromCache();
     $count = 0;
     foreach ($data as $key => $value) {
         $u = new User();
         $u->setName($key);
         if ($value > 0 && $key != '') {
             $img = Avatar::getPicture($u->getName(), true);
             if ($img == '') {
                 $img = Avatar::getDefaultPicture();
             }
             $id = "";
             if ($wgUser->getName() == $u->getName()) {
                 $id = "id='iia_stats_group'";
             }
             $display .= "<tr><td class='leader_image'>{$img}</td><td class='leader_name'>" . Linker::link($u->getUserPage(), $u->getName()) . "</td><td class='leader_count' {$id}>{$value}</td></tr>";
             $count++;
         }
         if ($count > 5) {
             break;
         }
     }
     $display .= "\n\t\t</table>";
     wfProfileOut($fname);
     return $display;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:37,代码来源:Standings.class.php


注:本文中的Avatar::getPicture方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。