Файл: modules/users/list.php
Строк: 65
<?php
/**
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) 2013-2014, Taras Chornyi, Sergiy Mazurenko, Ivan Kotliar
* @link http://perf-engine.net
* @package PerfEngine
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
$locate = 'in_users';
$title = _t('users');
include_header($title);
$tpl->div('title', _t('users'));
if($_GET['gender'] == 'man') {
$where = "WHERE `gender` = '1'";
$g = "&gender=man";
} elseif($_GET['gender'] == 'woman') {
$where = "WHERE `gender` = '2'";
$g = "&gender=woman";
}
if($_GET['sort'] == 'visit_time') {
$sort = "time";
$s = "&sort=visit_time";
} else {
$sort = "id";
$s = "&sort=id";
}
if($_GET['type_sort'] == 'asc') {
$type_sort = "ASC";
$ts = "&type_sort=asc";
} else {
$type_sort = "DESC";
$ts = "&type_sort=desc";
}
$users_a = $db->query("SELECT * FROM `users` ".$where."")->rowCount();
echo '<div class="list">
'.($_GET['gender'] == 'man' || $_GET['gender']== 'woman' ? '<a href="/users/list/">'._t('alls').'</a>' : '<b>'._t('alls').'</b>').' |
'.($_GET['gender'] == 'man' ? '<b>'._t('man').'</b>' : '<a href="/users/list/?gender=man">'._t('man').'</a>').' |
'.($_GET['gender'] == 'woman' ? '<b>'._t('woman').'</b>' : '<a href="/users/list/?gender=woman">'._t('woman').'</a>').' <br />';
if ($users_a != 0) {
echo _t('sort').' : '.($_GET['sort'] == 'visit_time' ? '<a href="/users/list/?sort=id'.$g.$ts.'">Id</a> | <b>'._t('sort_last_visit_time').'</b>' : '<b>Id</b> | <a href="/users/list/?sort=visit_time'.$g.$ts.'">'._t('sort_last_visit_time').'</a>').'<br />
('.($_GET['type_sort'] == 'asc' ? '<b>'._t('sort_asc').'</b> | <a href="/users/list/?type_sort=desc'.$g.$s.'">'._t('sort_desc').'</a>' : '<a href="/users/list/?type_sort=asc'.$g.$s.'">'._t('sort_asc').'</a> | <b>'._t('sort_desc').'</b>').')';
}
echo '</div>';
$pages = new Paginator($users_a, $ames);
if($users_a == 0)
{
$tpl->div('menu', _t('not_users'));
}
else
{
$users_q = $db->query("SELECT * FROM `users` ".$where." ORDER BY ".$sort." ".$type_sort." LIMIT $start, $ames");
while($users = $users_q->fetch())
{
$tpl->div('post', nick($users['id'], ($_GET['sort'] == 'visit_time' ? rtime($users['time']) : null)));
}
$pages->view(($_GET['gender']== 'man' || $_GET['gender']== 'woman' || isset($_GET['type_sort']) || isset($_GET['sort']) ? '&' : '?'));
}
$tpl->div('block',
NAV .' <a href="/users">'._t('back').'</a><br/>'.
HICO .'<a href="/">'. _t('home').'</a>');
include_footer();
?>