/**
  * Format a table cell. The return value should be HTML, but use an empty
  * string not &#160; for empty cells. Do not include the <td> and </td>.
  *
  * The current result row is available as $this->mCurrentRow, in case you
  * need more context.
  *
  * @param $name String: the database field name
  * @param $value String: the value retrieved from the database
  */
 function formatValue($name, $value)
 {
     global $wgLang;
     switch ($name) {
         case 'wps_start_date':
         case 'wps_end_date':
             return $value === null ? '-' : $wgLang->date($value, true);
         case 'wpp_name':
             return wfMessage('wpp-' . $value)->text();
         case 'wps_tmr_status':
             $msg = wfMessage("status-{$value}")->text();
             if ($value == 'PE' && $this->mCurrentRow->wps_active == 0) {
                 $msg .= ' (' . SpecialSubscriptions::getLinkCancel($this->mCurrentRow->wps_id) . ')';
             }
             return $msg;
         case 'wpp_nb_wikiplaces':
         case 'wpp_nb_wikiplace_pages':
             return wfFormatNumber($value);
         case 'wpp_monthly_bandwidth':
         case 'wpp_diskspace':
             return wfFormatSizeMB($value);
         default:
             return htmlspecialchars($value);
     }
 }
 /**
  * Format a table cell. The return value should be HTML, but use an empty
  * string not &#160; for empty cells. Do not include the <td> and </td>.
  *
  * The current result row is available as $this->mCurrentRow, in case you
  * need more context.
  *
  * @param $name String: the database field name
  * @param $value String: the value retrieved from the database
  */
 function formatValue($name, $value)
 {
     global $wgLang;
     switch ($name) {
         case 'wpi_date_created':
             return $wgLang->date($value, true);
         case 'wpi_counter':
             if (!is_null($this->mCurrentRow->user_name)) {
                 return wfMessage('wpi-used', $this->mCurrentRow->user_name)->parse();
             } elseif ($value != 0) {
                 return wfMessage('status-PE')->text();
             } else {
                 return '-';
             }
         case 'wpi_to_email':
             if ($this->mCurrentRow->wpi_counter < 0) {
                 return wfMessage('wpi-unlimited', -($this->mCurrentRow->wpi_counter + 1))->text();
             } else {
                 if ($this->mCurrentRow->wpi_counter > 1) {
                     return wfMessage('wpi-remaining', wfFormatNumber($this->mCurrentRow->wpi_counter))->text();
                 } else {
                     if (empty($value)) {
                         return '-';
                     } else {
                         return htmlspecialchars($value);
                     }
                 }
             }
         case 'wpic_desc':
             return wfMessage('wpi-' . $value)->text();
         default:
             return htmlspecialchars($value);
     }
 }
示例#3
0
 function formatMonthlyQuotas()
 {
     $html = Xml::openElement('ul');
     $html .= Html::rawElement('li', array(), '<b>' . wfFormatNumber($this->mCurrentRow->wpp_monthly_page_hits) . '</b> ' . wfMessage('wp-Hits')->text());
     $html .= Html::rawElement('li', array(), '<b>' . wfFormatSizeMB($this->mCurrentRow->wpp_monthly_bandwidth) . '</b> ' . wfMessage('wp-bandwidth')->text());
     $html .= Xml::closeElement('ul');
     return $html;
 }
示例#4
0
 /**
  * Format a table cell. The return value should be HTML, but use an empty
  * string not &#160; for empty cells. Do not include the <td> and </td>.
  *
  * The current result row is available as $this->mCurrentRow, in case you
  * need more context.
  *
  * @param $name String: the database field name
  * @param $value String: the value retrieved from the database
  */
 function formatValue($name, $value)
 {
     global $wgLang;
     switch ($name) {
         case 'page_title':
             return $this->formatPageTitle($value);
         case 'page_namespace':
             return $this->formatNamespace($value);
         case 'page_touched':
             return $wgLang->date($value, true);
         case 'page_counter':
             return wfFormatNumber($value) . ' ' . wfMessage('wp-hits')->text();
         case 'actions':
             return $this->formatActions();
         default:
             return htmlspecialchars($value);
     }
 }
 /**
  * Format a table cell. The return value should be HTML, but use an empty
  * string not &#160; for empty cells. Do not include the <td> and </td>.
  *
  * The current result row is available as $this->mCurrentRow, in case you
  * need more context.
  *
  * @param $name String: the database field name
  * @param $value String: the value retrieved from the database
  */
 function formatValue($name, $value)
 {
     global $wgLang;
     switch ($name) {
         case 'page_title':
             $title = Title::makeTitle($this->mCurrentRow->page_namespace, $value);
             return Linker::linkKnown($title, null, array(), array('redirect' => 'no'));
         case 'count':
             return $this->getCountHtml($name, $value);
         case 'members':
             return $this->getMembersHtml($name, $value);
         case 'wpw_monthly_page_hits':
             return wfFormatNumber($value) . ' ' . wfMessage('wp-hits')->text();
         case 'wpw_monthly_bandwidth':
             return wfFormatSizekB($value);
         case 'wpw_report_updated':
         case 'wpw_date_expires':
             return $value === null ? '-' : $wgLang->timeanddate($value, true);
         default:
             return htmlspecialchars($value);
     }
 }
示例#6
0
 private function displayList()
 {
     $user = $this->getUser();
     if ($user->isAllowed(WP_ADMIN_RIGHT) && $this->name != null) {
         $user_id = User::newFromName($this->name)->getId();
         if ($user_id == 0) {
             $this->action = self::ACTION_NOACTION;
             $this->msgKey = 'wp-invalid-name';
             $this->msgType = 'error';
             $this->display();
             return;
         }
     } else {
         $user_id = $user->getId();
     }
     $output = $this->getOutput();
     $tp = new WpWikiplacesTablePager();
     $tp->setSelectConds(array('wpw_owner_user_id' => $user_id));
     $tp->setHeader(wfMessage('wp-list-header')->parse());
     $diskspace = wfFormatSizeMB(WpPage::countDiskspaceUsageByUser($user_id));
     $pages = wfFormatNumber(WpPage::countPagesOwnedByUser($user_id));
     $tp->setFooter(wfMessage('wp-list-footer', $diskspace, $pages)->parse());
     /** @TODO Add Total Hits, Total Bandwidth & Report Updated, ie. Make pretty getters and factories in WpWikiplace that can take the result/row from the pager as argument */
     $output->addHTML($tp->getWholeHtml());
 }