本文整理汇总了PHP中wcf\util\StringUtil::formatInteger方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtil::formatInteger方法的具体用法?PHP StringUtil::formatInteger怎么用?PHP StringUtil::formatInteger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wcf\util\StringUtil
的用法示例。
在下文中一共展示了StringUtil::formatInteger方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeLink
/**
* Generates HTML code for a link.
*
* @param string $link
* @param integer $pageNo
* @param integer $activePage
* @return string
*/
protected function makeLink($link, $pageNo, $activePage, $break = false) {
// first page
if ($activePage != $pageNo) {
return '<li class="button"><a href="'.$this->insertPageNumber($link, $pageNo).'" title="'.WCF::getLanguage()->getDynamicVariable('wcf.page.pageNo', array('pageNo' => $pageNo)).'">'.StringUtil::formatInteger($pageNo).'</a></li>'."\n";
}
else {
return '<li class="button active"><span>'.StringUtil::formatInteger($pageNo).'</span></li>'."\n";
}
}
示例2: readUsers
/**
* Gets the list of results.
*/
protected function readUsers()
{
// get user ids
$userIDs = array();
$sql = "SELECT\t\tuser_table.userID\n\t\t\tFROM\t\twcf" . WCF_N . "_user user_table\n\t\t\t" . (isset($this->options[$this->sortField]) ? "LEFT JOIN wcf" . WCF_N . "_user_option_value user_option_value ON (user_option_value.userID = user_table.userID)" : '') . "\n\t\t\t" . $this->conditions . "\n\t\t\tORDER BY\t" . ($this->sortField != 'email' && isset($this->options[$this->sortField]) ? 'user_option_value.userOption' . $this->options[$this->sortField]->optionID : $this->sortField) . " " . $this->sortOrder;
$statement = WCF::getDB()->prepareStatement($sql, $this->itemsPerPage, ($this->pageNo - 1) * $this->itemsPerPage);
$statement->execute($this->conditions->getParameters());
while ($row = $statement->fetchArray()) {
$userIDs[] = $row['userID'];
}
// get user data
if (!empty($userIDs)) {
$userToGroups = array();
// get group ids
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("user_table.userID IN (?)", array($userIDs));
$sql = "SELECT\tuserID, groupID\n\t\t\t\tFROM\twcf" . WCF_N . "_user_to_group user_table\n\t\t\t\t" . $conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
$userToGroups[$row['userID']][] = $row['groupID'];
}
$sql = "SELECT\t\tuser_avatar.*, option_value.*, user_table.*\n\t\t\t\tFROM\t\twcf" . WCF_N . "_user user_table\n\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_user_option_value option_value\n\t\t\t\tON\t\t(option_value.userID = user_table.userID)\n\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_user_avatar user_avatar\n\t\t\t\tON\t\t(user_avatar.avatarID = user_table.avatarID)\n\t\t\t\t" . $conditions . "\n\t\t\t\tORDER BY\t" . ($this->sortField != 'email' && isset($this->options[$this->sortField]) ? 'option_value.userOption' . $this->options[$this->sortField]->optionID : 'user_table.' . $this->sortField) . " " . $this->sortOrder;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
$groupIDs = isset($userToGroups[$row['userID']]) ? $userToGroups[$row['userID']] : array();
$row['groupIDs'] = implode(',', $groupIDs);
$accessible = !empty($groupIDs) ? UserGroup::isAccessibleGroup($groupIDs) : true;
$row['accessible'] = $accessible;
$row['deletable'] = $accessible && WCF::getSession()->getPermission('admin.user.canDeleteUser') && $row['userID'] != WCF::getUser()->userID ? 1 : 0;
$row['editable'] = $accessible && WCF::getSession()->getPermission('admin.user.canEditUser') ? 1 : 0;
$row['bannable'] = $accessible && WCF::getSession()->getPermission('admin.user.canBanUser') && $row['userID'] != WCF::getUser()->userID ? 1 : 0;
$row['canBeEnabled'] = $accessible && WCF::getSession()->getPermission('admin.user.canEnableUser') && $row['userID'] != WCF::getUser()->userID ? 1 : 0;
$row['isMarked'] = intval(in_array($row['userID'], $this->markedUsers));
$this->users[] = new UserProfile(new User(null, $row));
}
// get special columns
foreach ($this->users as $key => $user) {
foreach ($this->columns as $column) {
switch ($column) {
case 'email':
$this->columnValues[$user->userID][$column] = '<a href="mailto:' . StringUtil::encodeHTML($user->email) . '">' . StringUtil::encodeHTML($user->email) . '</a>';
break;
case 'registrationDate':
$this->columnValues[$user->userID][$column] = DateUtil::format(DateUtil::getDateTimeByTimestamp($user->{$column}), DateUtil::DATE_FORMAT);
break;
case 'lastActivityTime':
if ($user->{$column}) {
$this->columnValues[$user->userID][$column] = str_replace('%time%', DateUtil::format(DateUtil::getDateTimeByTimestamp($user->{$column}), DateUtil::TIME_FORMAT), str_replace('%date%', DateUtil::format(DateUtil::getDateTimeByTimestamp($user->{$column}), DateUtil::DATE_FORMAT), WCF::getLanguage()->get('wcf.date.dateTimeFormat')));
}
break;
case 'profileHits':
case 'activityPoints':
case 'likesReceived':
$this->columnValues[$user->userID][$column] = StringUtil::formatInteger($user->{$column});
break;
default:
if (isset($this->options[$column])) {
if ($this->options[$column]->outputClass) {
$this->options[$column]->setOptionValue($user->getDecoratedObject());
$outputObj = $this->options[$column]->getOutputObject();
$this->columnValues[$user->userID][$column] = $outputObj->getOutput($user->getDecoratedObject(), $this->options[$column]->getDecoratedObject(), $user->{$column});
} else {
$this->columnValues[$user->userID][$column] = StringUtil::encodeHTML($user->{$column});
}
}
break;
}
}
}
}
}