/**
  * This method actually generates the output
  * @param mixed $params Comes from base class definition. Not used in this implementation.
  * @return string HTML output
  */
 public function execute($params = false)
 {
     $this->initFields();
     wfRunHooks('BsAuthorPageProfileImageAfterInitFields', array(&$this, $this->oUser));
     // CR RBV (03.06.11 08:39): Hook/Event!
     if (BsExtensionManager::isContextActive('MW::SecureFileStore::Active')) {
         $this->sImagePath = SecureFileStore::secureStuff($this->sImagePath, true);
     }
     $aOut = array();
     $aOut[] = '<div id="bs-authors-imageform" class="bs-userpagesettings-item">';
     $aOut[] = $this->renderLink(array('href' => htmlspecialchars($this->sImageUploadPath), 'title' => wfMessage('bs-authors-profileimage-change')->plain()), '<img src="' . $this->sImagePath . '" alt="' . $this->sUserDisplayName . '" width="64" title="' . wfMessage('bs-authors-profileimage')->plain() . '" />' . '<div class="bs-user-label">' . wfMessage('bs-authors-profileimage-change')->plain() . '</div>');
     $aOut[] = '</div>';
     return implode("\n", $aOut);
 }
 /**
  * Get the Users for specialpage, called via ajax
  * @param string $sPage page title
  * @return bool Always true
  */
 public static function getUsers($sPage)
 {
     $oTitle = Title::newFromText($sPage);
     if (!$oTitle->exists()) {
         return json_encode(array());
     }
     $iArticleID = $oTitle->getArticleID();
     $oStoreParams = BsExtJSStoreParams::newFromRequest();
     $iLimit = $oStoreParams->getLimit();
     $iStart = $oStoreParams->getStart();
     $sSort = $oStoreParams->getSort('MAX(readers_ts)');
     $sDirection = $oStoreParams->getDirection();
     if ($sSort == 'user_name') {
         $sSort = 'readers_user_name';
     } elseif ($sSort == 'user_ts') {
         $sSort = 'readers_ts';
     } elseif ($sSort == 'user_readers') {
         $sSort = 'readers_user_name';
     }
     $oDbr = wfGetDB(DB_SLAVE);
     $res = $oDbr->select(array('bs_readers'), array('readers_user_id', 'MAX(readers_ts) as readers_ts'), array('readers_page_id' => $iArticleID), __METHOD__, array('GROUP BY' => 'readers_user_id', 'ORDER BY' => $sSort . ' ' . $sDirection, 'LIMIT' => $iLimit, 'OFFSET' => $iStart));
     $aUsers = array();
     if ($oDbr->numRows($res) > 0) {
         $aParams = array();
         $oLanguage = RequestContext::getMain()->getLanguage();
         foreach ($res as $row) {
             $oUser = User::newFromId((int) $row->readers_user_id);
             $oTitle = Title::makeTitle(NS_USER, $oUser->getName());
             $oUserMiniProfile = BsCore::getInstance()->getUserMiniProfile($oUser, $aParams);
             $sImage = $oUserMiniProfile->getUserImageSrc();
             if (BsExtensionManager::isContextActive('MW::SecureFileStore::Active')) {
                 $sImage = SecureFileStore::secureStuff($sImage, true);
             }
             $aTmpUser = array();
             $aTmpUser['user_image'] = $sImage;
             $aTmpUser['user_name'] = $oUser->getName();
             $aTmpUser['user_page'] = $oTitle->getLocalURL();
             $aTmpUser['user_readers'] = SpecialPage::getTitleFor('Readers', $oTitle->getPrefixedText())->getLocalURL();
             $aTmpUser['user_ts'] = $row->readers_ts;
             $aTmpUser['user_date'] = $oLanguage->timeanddate($row->readers_ts);
             $aUsers['users'][] = $aTmpUser;
         }
     }
     $rowCount = $oDbr->select('bs_readers', 'readers_user_id', array('readers_page_id' => $iArticleID), __METHOD__, array('GROUP BY' => 'readers_user_id'));
     $aUsers['totalCount'] = $oDbr->numRows($rowCount);
     return json_encode($aUsers);
 }