本文整理汇总了PHP中getCount函数的典型用法代码示例。如果您正苦于以下问题:PHP getCount函数的具体用法?PHP getCount怎么用?PHP getCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getCount函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: stepCounter
function stepCounter($file)
{
if (file_exists($file)) {
$value = getCount($file);
file_put_contents($file, ++$value);
}
}
示例2: _initialize
protected function _initialize()
{
parent::_initialize();
$this->openuid = I('get.openuid');
if (getUidByOpenuid($this->openuid)) {
$this->uid = getUidByOpenuid($this->openuid);
} else {
$this->error('您无权访问当前页面!');
}
$this->assign('openuid', $this->openuid);
//会员信息
$this->memberDetail = D('Home/User')->find($this->uid);
//烘焙作品数
$this->hbworksnum = getCount('Works', array('userid' => $this->uid, 'type' => 1));
//随拍作品
$this->spworksnum = getCount('Copy', array('userid' => $this->uid));
//关注数
$this->attentionnum = getCount('UserFans', array('myid' => $this->uid));
//被关注数
$this->fansnum = getCount('UserFans', array('userid' => $this->uid));
//是否关注
$this->isfans = getCount('UserFans', array('myid' => $this->userid, 'userid' => $this->uid, 'status' => true));
//中间广告
$this->midad = parent::getAdvert(9, 1, 0, 1);
}
示例3: discuss
function discuss($ID)
{
global $comments_disabled_after;
$preview = ps('preview');
extract(safe_row("Annotate,AnnotateInvite,unix_timestamp(Posted) as uPosted", "textpattern", "ID='{$ID}'"));
$darr = !$preview ? fetchComments($ID) : array(psas(array('name', 'email', 'web', 'message', 'parentid', 'remember')));
$out = n . '<h3 style="margin-top:2em" id="comment">' . $AnnotateInvite . '</h3>' . n;
if ($darr) {
$out .= '<ol>' . n;
$out .= formatComments($darr);
$out .= n . '</ol>';
}
$wasAnnotated = !$Annotate ? getCount('txp_discuss', "parentid={$ID}") : '';
if (!$Annotate) {
$out .= graf(gTxt("comments_closed"));
} else {
if ($comments_disabled_after) {
$lifespan = $comments_disabled_after * 86400;
$timesince = time() - $uPosted;
if ($lifespan > $timesince) {
$out .= commentForm($ID);
} else {
$out .= graf(gTxt("comments_closed"));
}
} else {
$out .= commentForm($ID);
}
}
return $out;
}
示例4: createTables
function createTables()
{
$division = $_SESSION['division'];
$date = $_SESSION['date'];
$count = getCount();
global $conn;
//check if import.csv is a new carrier or existing, create tableset if new
$getDivisionAll = mysqli_query($conn, "SELECT division from Division_All");
$getDivisionCount = mysqli_query($conn, "SELECT division, countImported, importDate from Division_Metadata");
$results = array();
while ($row = mysqli_fetch_array($getDivisionAll)) {
$results[] = $row[0];
}
if (!in_array($division, $results)) {
createTableSet($division, $conn);
mysqli_query($conn, "INSERT INTO Division_All VALUES (id, '{$division}')");
mysqli_query($conn, "INSERT INTO Division_Metadata VALUES (id, '{$division}', '{$date}', {$count})");
return $count;
} else {
$exists = mysqli_query($conn, "SELECT * from Division_Metadata where division = '{$division}'\n and countImported = {$count} and importDate = '{$date}'");
$row_cnt = $exists->num_rows;
if ($row_cnt < 1) {
mysqli_query($conn, "INSERT INTO Division_Metadata VALUES (id, '{$division}', '{$date}', {$count})");
return $count;
} else {
header("location:index.php?status=duplicate&division={$division}&count={$count}");
}
}
}
示例5: list_list
function list_list($message = "", $post = '')
{
extract(get_prefs());
$lvars = array("page", "sort", "dir", "crit", 'method');
extract(gpsa($lvars));
global $statuses, $step;
pagetop("Textpattern", $message);
$total = getCount('textpattern', "1");
$limit = $article_list_pageby ? $article_list_pageby : 25;
$numPages = ceil($total / $limit);
$page = !$page ? 1 : $page;
$offset = ($page - 1) * $limit;
if (!$sort) {
$sort = "Posted";
}
if (!$dir) {
$dir = "desc";
}
if ($dir == "desc") {
$linkdir = "asc";
} else {
$linkdir = "desc";
}
if ($crit) {
$critsql = array('title_body' => "Title rlike '{$crit}' or Body rlike '{$crit}'", 'author' => "AuthorID rlike '{$crit}'", 'categories' => "Category1 rlike '{$crit}' or Category2 rlike '{$crit}'", 'section' => "Section rlike '{$crit}'", 'status' => "Status rlike '{$crit}'");
$criteria = $critsql[$method];
$limit = 500;
} else {
$criteria = 1;
}
$rs = safe_rows("*, unix_timestamp(Posted) as uPosted", "textpattern", "{$criteria} order by {$sort} {$dir} limit {$offset},{$limit}");
echo !$crit ? list_nav_form($page, $numPages, $sort, $dir) : '', list_searching_form($crit, $method);
if ($rs) {
echo '<form action="index.php" method="post" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">', startTable('list'), '<tr>', column_head('posted', 'Posted', 'list', 1, $linkdir), column_head('title', 'Title', 'list', 1, $linkdir), $use_sections ? column_head('section', 'Section', 'list', 1, $linkdir) : '', $use_categories ? column_head('category1', 'Category1', 'list', 1, $linkdir) . column_head('category2', 'Category2', 'list', 1, $linkdir) : '', hCell(gTxt('Author')), column_head(gTxt('status'), 'Status', 'list', 1, $linkdir), td(), '</tr>';
foreach ($rs as $a) {
extract($a);
if ($use_categories == 1) {
$cat1 = $Category1;
$cat2 = $Category2;
}
$stat = !empty($Status) ? $statuses[$Status] : '';
if ($use_sections == 1) {
$sect = $Section;
}
$adate = date("d M y", $uPosted + $timeoffset);
$alink = eLink('article', 'edit', 'ID', $ID, $adate);
$tlink = eLink('article', 'edit', 'ID', $ID, $Title);
$modbox = fInput('checkbox', 'selected[]', $ID);
echo "<tr>" . n, td($alink), td($tlink, 200), $use_sections ? td($sect, 75) : '', $use_categories ? td($cat1, 75) . td($cat2, 75) : '', td($AuthorID), td($stat, 45), td($modbox), '</tr>' . n;
}
echo tr(tda(list_multiedit_form(), ' colspan="8" style="text-align:right;border:0px"'));
echo "</table></form>";
echo pageby_form('list', $article_list_pageby);
unset($sort);
}
}
示例6: lib_getarcattr
/**
* 文章属性调用标签
*
* @version $Id: getarcattr.lib.php netman
* @package Stourweb.Taglib
* @copyright Copyright (c) 2007 - 2011, Stourweb, Inc.
* @link http://www.stourweb.com
*/
function lib_getarcattr(&$ctag, &$refObj)
{
global $dsql;
$attlist = "row|8,limit|0,flag|";
FillAttsDefault($ctag->CAttribute->Items, $attlist);
extract($ctag->CAttribute->Items, EXTR_SKIP);
$innertext = trim($ctag->GetInnertext());
$revalue = '';
$kindid = $refObj->Fields['kindid'];
$sql = "select * from #@__article_attr where isopen=1 and pid!=0 order by displayorder asc limit {$limit},{$row}";
if ($flag == 'mdd') {
$sql = "select a.*,count(b.id) as num from #@__article_attr as a inner join #@__article as b on find_in_set(a.id,b.attrid) where find_in_set({$kindid},b.kindlist) group by a.id limit {$limit},{$row}";
}
$dsql->SetQuery($sql);
$dsql->Execute();
$ctp = new STTagParse();
$ctp->SetNameSpace("field", "[", "]");
$ctp->LoadSource($innertext);
$GLOBALS['autoindex'] = 0;
while ($row = $dsql->GetArray()) {
if (checkExist($row['id'])) {
$destid = isset($GLOBALS['destid']) ? $GLOBALS['destid'] : 0;
$py = Helper_Archive::getDestPinyin($destid);
$py = !empty($py) ? $py : 'all';
//$row['url'] = $GLOBALS['cfg_cmsurl']."/raiders/search.php?attrid={$row['id']}&destid={$destid}";
$row['url'] = $GLOBALS['cfg_cmsurl'] . "/raiders/" . $py . '-' . $row['id'];
$row['title'] = $row['attrname'];
$row['number'] = getCount($row['id']);
if ($flag == 'mdd') {
$row['number'] = $row['num'];
}
foreach ($ctp->CTags as $tagid => $ctag) {
if ($ctag->GetName() == 'array') {
$ctp->Assign($tagid, $row);
} else {
if (!empty($row[$ctag->GetName()])) {
$ctp->Assign($tagid, $row[$ctag->GetName()]);
}
}
}
$revalue .= $ctp->GetResult();
$GLOBALS['autoindex']++;
} else {
continue;
}
}
return $revalue;
}
示例7: action
function action()
{
if ($_SERVER["REQUEST_METHOD"] != "POST") {
die("You can only reach this page by posting from the web page.");
}
$where = isset($_GET["where"]) ? $_GET["where"] : "home";
if (isset($_GET["mode"])) {
if ($_GET["mode"] == "add") {
addNew($where);
}
if ($_GET["mode"] == "getCount") {
echo json_encode(array("count" => getCount($where)));
}
}
exit;
}
示例8: getBestSeller
function getBestSeller($count = 4)
{
$getOrder = DB::query("SELECT order_content FROM `" . PREFIX . 'order' . "`");
if (DB::numRows($getOrder) != 0) {
$product = new Models_Product();
while ($row = DB::fetchArray($getOrder)) {
$orderData[] = unserialize(stripslashes($row['order_content']));
}
$res = array();
foreach ($orderData as $k => $v) {
foreach ($v as $key => $val) {
$res[] = $product->getProduct($val['id']);
}
}
$goodsSale = getCount($res);
return array_slice($goodsSale, 0, $count);
}
}
示例9: log_list
function log_list()
{
pagetop(gTxt('visitor_logs'));
extract(get_prefs());
safe_delete("txp_log", "`time` < date_sub(now(),interval " . $expire_logs_after . " day)");
safe_optimize("txp_log");
safe_repair("txp_log");
$page = gps('page');
$total = getCount('txp_log', "1");
$limit = 50;
$numPages = ceil($total / $limit);
$page = !$page ? 1 : $page;
$offset = ($page - 1) * $limit;
$nav[] = $page > 1 ? PrevNextLink("log", $page - 1, gTxt('prev'), 'prev') : '';
$nav[] = sp . small($page . '/' . $numPages) . sp;
$nav[] = $page != $numPages ? PrevNextLink("log", $page + 1, gTxt('next'), 'next') : '';
$rs = safe_rows_start("*, unix_timestamp(time) as stamp", "txp_log", "1 order by time desc limit {$offset},{$limit}");
if ($rs) {
echo startTable('list'), assHead('time', 'host', 'page', 'referrer');
$stamp = '';
while ($a = nextRow($rs)) {
extract($a);
if ($refer) {
$referprint = preg_replace("/^www\\./", "", chunk(htmlspecialchars($refer), 50));
$referprint = '<a href="http://' . htmlspecialchars($refer) . '">' . $referprint . '</a>';
} else {
$referprint = ' ';
}
$pageprint = preg_replace('/\\/$/', '', htmlspecialchars(substr($page, 1)));
$pageprint = $pageprint == '' ? '' : '<a href="' . htmlspecialchars($page) . '" target="_blank">' . chunk($pageprint, 50) . '</a>';
if ($method == 'POST') {
$pageprint = '<b>' . $pageprint . '</b>';
}
$fstamp = date("n/j g:i a", $stamp + tz_offset());
$hostprint = chunk($host, 40);
echo tr(td($fstamp) . td($hostprint) . td($pageprint) . td($referprint));
unset($refer, $referprint, $page, $pageprint);
}
echo '<tr><td colspan="4" align="right" style="padding:10px">', join('', $nav), "</td></tr>", endTable();
} else {
echo graf(gTxt('no_refers_recorded'), ' align="center"');
}
}
示例10: index
public function index()
{
//测试用,清空缓存
cache('', null);
//幻灯片推荐作品
$workModel = D('Home/Works');
$this->assign('indextjwork', $workModel->indextjwork());
//新闻模块
//单条新闻
$firstnews = M('News')->field('title,id')->where(array('iftj' => true, 'status' => true))->order('sort DESC')->limit(1)->find();
$this->assign('firstnews', $firstnews);
$this->assign('indextjnews', D('Home/News')->indextjnews());
//每日新秀
$this->assign('indexxinxiu', $workModel->worksxinxiu());
//中间广告位
$this->assign('indexmidad', parent::getAdvert(1, 1, 0, 5));
//左侧广告位
$this->assign('indexleftad', parent::getAdvert(1, 2, 0, 1));
//类别每日一荐
$this->assign('indexcatetj', $workModel->cateonework());
//焙友动态
$this->userDynamicData = D('Home/User')->userDynamic(5);
//热门活动
$this->assign('activitytj', D('Home/Activity')->activitytj(2));
//右边上侧
$this->assign('rightopad', parent::getAdvert(1, 3, 0, 1));
//右边广告
$this->assign('indexrightad', parent::getAdvert(1, 3, 1, 3));
//分享达人
$this->assign('sharedaren', D('Home/User')->sharedaren(5, $this->userid));
//判断是否签到
$stime = strtotime(date('Y-m-d 00:00:00'));
$etime = strtotime(date('Y-m-d 23:59:59'));
$where['userid'] = array('EQ', $this->userid);
$where['create_time'] = array(array('GT', $stime), array('LT', $etime), 'and');
$where['action'] = array('EQ', 'sign');
$map['create_time'] = array(array('GT', $stime), array('LT', $etime), 'and');
$map['action'] = array('EQ', 'sign');
$this->mysign = getCount('UserDynamic', $where);
$this->signcount = getCount('UserDynamic', $map);
$this->display();
}
示例11: lookSee
/**
*根据初始字符串来获得下面的字符串
*@param string $str 初始字符串
*@param integer $n 输出多少行
*@return void
*/
function lookSee($str, $n)
{
$result[0] = $str;
for ($m = 0; $m < $n; $m++) {
$str3 = '';
for ($k = 0; $k < strlen($result[$m]); $k++) {
var_dump($str[$k]);
$str1 = $str[$k];
var_dump($str1);
if (!($str2 = getCount($str1, $str))) {
break;
}
var_dump($str2);
$str3 .= $str2 . $str1;
//var_dump($str3);
}
$result[$m] = $str3;
}
return $result;
}
示例12: index
/**
* 会员登录页显示
*/
public function index()
{
if (IS_POST) {
//更新用户资料
$post = I('post.');
if (empty($post)) {
$this->error('信息更新失败!');
}
$result = M('User')->where(array('userid' => $this->userid))->save($post);
if ($result !== false) {
$this->success('您的资料更新成功!');
} else {
$this->error('您的资料更新失败');
}
} else {
//省份
$this->province = M('Province')->field('province_id,province_name')->select();
if (!empty($this->userinfo['ucity']) && !empty($this->userinfo['uprovince'])) {
$this->ucity = M('City')->where(array('province_id' => $this->userinfo['uprovince']))->select();
}
if (!empty($this->userinfo['ucity']) && !empty($this->userinfo['uarea'])) {
$this->uarea = M('Area')->where(array('city_id' => $this->userinfo['ucity']))->select();
}
//数量统计
//烘焙作品数
$this->hbworksnum = getCount('Works', array('userid' => $this->userid, 'status' => true));
//随拍作品
$this->spworksnum = getCount('Suipai', array('userid' => $this->userid, 'status' => true));
//留言数
$this->msgnum = getCount('UserMessage', array('userid' => $this->userid, 'status' => true));
//试用报告数
$this->reportnum = getCount('TryReport', array('userid' => $this->userid, 'status' => true));
//收藏作品数
$this->favoritenum = getCount('UserFavorite', array('userid' => $this->userid, 'status' => true));
//修改头像密钥
$this->auth_key = urlencode(\Libs\Util\Encrypt::authcode($this->userid, ''));
}
$this->display();
}
示例13: image_list
function image_list($message = '')
{
global $txpcfg, $extensions, $path_from_root, $img_dir;
$pfr = $path_from_root;
extract($txpcfg);
extract(get_prefs());
pagetop(gTxt('image'), $message);
echo pageby_form('image', $article_list_pageby);
echo startTable('list'), tr(tda(upload_form(gTxt('upload_file'), gTxt('upload'), 'image_insert'), ' colspan="4" style="border:0"')), tr(hCell(ucfirst(gTxt('name'))) . hCell(gTxt('image_category')) . hCell(gTxt('tags')) . hCell(gTxt('author')) . hCell(gTxt('thumbnail')) . hCell());
$page = gps('page');
$total = getCount('txp_image', "1");
$limit = 15;
$numPages = ceil($total / $limit);
$page = !$page ? 1 : $page;
$offset = ($page - 1) * $limit;
$nav[] = $page > 1 ? PrevNextLink("image", $page - 1, gTxt('prev'), 'prev') : '';
$nav[] = sp . small($page . '/' . $numPages) . sp;
$nav[] = $page != $numPages ? PrevNextLink("image", $page + 1, gTxt('next'), 'next') : '';
$rs = safe_rows("*", "txp_image", "1 order by category,name limit {$offset},{$limit}");
if ($rs) {
foreach ($rs as $a) {
extract($a);
$thumbnail = $thumbnail ? '<img src="' . $pfr . $img_dir . '/' . $id . 't' . $ext . '" />' : gTxt('no');
$elink = eLink('image', 'image_edit', 'id', $id, $name);
$txtilelink = '<a target="_blank" href="?event=tag' . a . 'name=image' . a . 'id=' . $id . a . 'ext=' . $ext . a . 'alt=' . $alt . a . 'h=' . $h . a . 'w=' . $w . a . 'type=textile" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">Textile</a>';
$txplink = '<a target="_blank" href="?event=tag' . a . 'name=image' . a . 'id=' . $id . a . 'type=textpattern" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">Textpattern</a>';
$xhtmlink = '<a target="_blank" href="?event=tag' . a . 'name=image' . a . 'id=' . $id . a . 'ext=' . $ext . a . 'h=' . $h . a . 'w=' . $w . a . 'type=xhtml" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">XHTML</a>';
$dlink = dLink('image', 'image_delete', 'id', $id);
echo tr(td($elink) . td($category) . td($txtilelink . ' / ' . $txplink . ' / ' . $xhtmlink) . td($author) . td($thumbnail) . td($dlink, 10));
}
echo tr(tdcs(graf(join('', $nav)), 4));
}
echo endTable();
$imgdir = $doc_root . $path_from_root . $img_dir;
if (!is_dir($imgdir) or !is_writeable($imgdir)) {
echo graf(str_replace("{imgdir}", $imgdir, gTxt('img_dir_not_writeable')), ' style="text-align:center;color:red"');
}
}
示例14: link_list
function link_list($message = "")
{
global $step, $link_list_pageby;
extract(get_prefs());
$page = gps('page');
$total = getCount('txp_link', "1");
$limit = $link_list_pageby;
$numPages = ceil($total / $limit);
$page = !$page ? 1 : $page;
$offset = ($page - 1) * $limit;
$sort = gps('sort');
$dir = gps('dir');
$sort = $sort ? $sort : 'linksort';
$dir = $dir ? $dir : 'asc';
if ($dir == "desc") {
$dir = "asc";
} else {
$dir = "desc";
}
$nav[] = $page > 1 ? PrevNextLink("link", $page - 1, gTxt('prev'), 'prev') : '';
$nav[] = sp . small($page . '/' . $numPages) . sp;
$nav[] = $page != $numPages ? PrevNextLink("link", $page + 1, gTxt('next'), 'next') : '';
$rs = safe_rows("*", "txp_link", "1 order by {$sort} {$dir} limit {$offset},{$limit}");
if ($rs) {
echo '<form action="index.php" method="post" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">', startTable('list'), tr(column_head('link_name', 'linksort', 'link', 1, $dir) . column_head('description', 'description', 'link', 1, $dir) . column_head('link_category', 'category', 'link', 1, $dir) . td());
foreach ($rs as $a) {
extract($a);
$elink = eLink('link', 'link_edit', 'id', $id, $linkname);
$cbox = fInput('checkbox', 'selected[]', $id);
echo tr(td($elink) . td($description) . td($category) . td($cbox));
}
echo tr(tda(link_multiedit_form(), ' colspan="4" style="border:0px;text-align:right"'));
echo endTable(), '</form>';
echo pageby_form('link', $link_list_pageby);
echo graf(join('', $nav), ' align="center"');
}
}
示例15: author_list
/**
* The main author list.
*
* @param string|array $message The activity message
*/
function author_list($message = '')
{
global $txp_user, $author_list_pageby;
pagetop(gTxt('tab_site_admin'), $message);
if (is_disabled('mail')) {
echo graf(span(null, array('class' => 'ui-icon ui-icon-alert')) . ' ' . gTxt('warn_mail_unavailable'), array('class' => 'alert-block warning'));
}
echo hed(gTxt('tab_site_admin'), 1, array('class' => 'txp-heading'));
echo n . '<div id="users_control" class="txp-control-panel">';
$buttons = array();
// Change password button.
$buttons[] = sLink('admin', 'new_pass_form', gTxt('change_password'));
if (!has_privs('admin.edit')) {
// Change email address button.
$buttons[] = sLink('admin', 'change_email_form', gTxt('change_email_address'));
} else {
// New author button.
$buttons[] = sLink('admin', 'author_edit', gTxt('add_new_author'));
}
echo graf(join(n, $buttons), array('class' => 'txp-buttons'));
// User list.
if (has_privs('admin.list')) {
extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
if ($sort === '') {
$sort = get_pref('admin_sort_column', 'name');
}
if ($dir === '') {
$dir = get_pref('admin_sort_dir', 'asc');
}
$dir = $dir == 'desc' ? 'desc' : 'asc';
if (!in_array($sort, array('name', 'RealName', 'email', 'privs', 'last_login'))) {
$sort = 'name';
}
$sort_sql = $sort . ' ' . $dir;
set_pref('admin_sort_column', $sort, 'admin', 2, '', 0, PREF_PRIVATE);
set_pref('admin_sort_dir', $dir, 'admin', 2, '', 0, PREF_PRIVATE);
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$criteria = 1;
if ($search_method and $crit != '') {
$verbatim = preg_match('/^"(.*)"$/', $crit, $m);
$crit_escaped = $verbatim ? doSlash($m[1]) : doLike($crit);
$critsql = $verbatim ? array('id' => "user_id in ('" . join("','", do_list($crit_escaped)) . "')", 'login' => "name = '{$crit_escaped}'", 'real_name' => "RealName = '{$crit_escaped}'", 'email' => "email = '{$crit_escaped}'", 'privs' => "convert(privs, char) in ('" . join("','", do_list($crit_escaped)) . "')") : array('id' => "user_id in ('" . join("','", do_list($crit_escaped)) . "')", 'login' => "name like '%{$crit_escaped}%'", 'real_name' => "RealName like '%{$crit_escaped}%'", 'email' => "email like '%{$crit_escaped}%'", 'privs' => "convert(privs, char) in ('" . join("','", do_list($crit_escaped)) . "')");
if (array_key_exists($search_method, $critsql)) {
$criteria = $critsql[$search_method];
} else {
$search_method = '';
$crit = '';
}
} else {
$search_method = '';
$crit = '';
}
$criteria .= callback_event('admin_criteria', 'author_list', 0, $criteria);
$total = getCount('txp_users', $criteria);
if ($total < 1) {
if ($criteria != 1) {
echo n . author_search_form($crit, $search_method) . graf(gTxt('no_results_found'), ' class="indicator"') . '</div>';
}
return;
}
$limit = max($author_list_pageby, 15);
list($page, $offset, $numPages) = pager($total, $limit, $page);
$use_multi_edit = has_privs('admin.edit') && safe_count('txp_users', '1=1') > 1;
echo author_search_form($crit, $search_method) . '</div>';
$rs = safe_rows_start('*, unix_timestamp(last_access) as last_login', 'txp_users', "{$criteria} order by {$sort_sql} limit {$offset}, {$limit}");
if ($rs) {
echo n . tag_start('div', array('id' => 'users_container', 'class' => 'txp-container')) . n . tag_start('form', array('action' => 'index.php', 'id' => 'users_form', 'class' => 'multi_edit_form', 'method' => 'post', 'name' => 'longform')) . n . tag_start('div', array('class' => 'txp-listtables')) . n . tag_start('table', array('class' => 'txp-list')) . n . tag_start('thead') . tr(($use_multi_edit ? hCell(fInput('checkbox', 'select_all', 0, '', '', '', '', '', 'select_all'), '', ' scope="col" title="' . gTxt('toggle_all_selected') . '" class="txp-list-col-multi-edit"') : hCell('', '', ' scope="col" class="txp-list-col-multi-edit"')) . column_head('login_name', 'name', 'admin', true, $switch_dir, '', '', ('name' == $sort ? "{$dir} " : '') . 'txp-list-col-login-name name') . column_head('real_name', 'RealName', 'admin', true, $switch_dir, '', '', ('RealName' == $sort ? "{$dir} " : '') . 'txp-list-col-real-name name') . column_head('email', 'email', 'admin', true, $switch_dir, '', '', ('email' == $sort ? "{$dir} " : '') . 'txp-list-col-email') . column_head('privileges', 'privs', 'admin', true, $switch_dir, '', '', ('privs' == $sort ? "{$dir} " : '') . 'txp-list-col-privs') . column_head('last_login', 'last_login', 'admin', true, $switch_dir, '', '', ('last_login' == $sort ? "{$dir} " : '') . 'txp-list-col-last-login date')) . n . tag_end('thead') . n . tag_start('tbody');
while ($a = nextRow($rs)) {
extract(doSpecial($a));
echo tr(td((has_privs('admin.edit') and $txp_user != $a['name']) ? fInput('checkbox', 'selected[]', $a['name'], 'checkbox') : '', '', 'txp-list-col-multi-edit') . hCell(has_privs('admin.edit') ? eLink('admin', 'author_edit', 'user_id', $user_id, $name) : $name, '', ' scope="row" class="txp-list-col-login-name name"') . td($RealName, '', 'txp-list-col-real-name name') . td(href($email, 'mailto:' . $email), '', 'txp-list-col-email') . td(get_priv_level($privs), '', 'txp-list-col-privs') . td($last_login ? safe_strftime('%b %Y', $last_login) : '', '', 'txp-list-col-last-login date'));
}
echo n . tag_end('tbody') . n . tag_end('table') . n . tag_end('div') . ($use_multi_edit ? author_multiedit_form($page, $sort, $dir, $crit, $search_method) : '') . tInput() . n . tag_end('form') . n . tag_start('div', array('id' => 'users_navigation', 'class' => 'txp-navigation')) . pageby_form('admin', $author_list_pageby) . nav_form('admin', $page, $numPages, $sort, $dir, $crit, $search_method) . n . tag_end('div') . n . tag_end('div');
}
} else {
echo n . tag_end('div');
}
}