* change for order by data in server.
This commit is contained in:
@@ -42,7 +42,7 @@ class company extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function browse($param = 0, $type = 'bydept', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
public function browse($param = 0, $type = 'bydept', $orderBy = 'id', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
$this->loadModel('search');
|
||||
$this->lang->set('menugroup.company', 'company');
|
||||
@@ -66,7 +66,7 @@ class company extends control
|
||||
if($type == 'bydept')
|
||||
{
|
||||
$childDeptIds = $this->dept->getAllChildID($deptID);
|
||||
$users = $this->dept->getUsers($childDeptIds, $pager);
|
||||
$users = $this->dept->getUsers($childDeptIds, $pager, $orderBy);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -83,7 +83,7 @@ class company extends control
|
||||
$this->session->set('userQuery', ' 1 = 1');
|
||||
}
|
||||
}
|
||||
$users = $this->loadModel('user')->getByQuery($this->session->userQuery, $pager);
|
||||
$users = $this->loadModel('user')->getByQuery($this->session->userQuery, $pager, $orderBy);
|
||||
}
|
||||
|
||||
$this->view->header = $header;
|
||||
@@ -92,8 +92,11 @@ class company extends control
|
||||
$this->view->searchForm = $this->fetch('search', 'buildForm', $this->config->company->browse->search);
|
||||
$this->view->deptTree = $this->dept->getTreeMenu($rooteDeptID = 0, array('deptModel', 'createMemberLink'));
|
||||
$this->view->parentDepts = $this->dept->getParents($deptID);
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->deptID = $deptID;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->param = $param;
|
||||
$this->view->type = $type;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
<?php
|
||||
include '../../common/view/header.html.php';
|
||||
include '../../common/view/treeview.html.php';
|
||||
include '../../common/view/tablesorter.html.php';
|
||||
?>
|
||||
<table class='cont-lt1'>
|
||||
<tr>
|
||||
@@ -38,16 +37,17 @@ include '../../common/view/tablesorter.html.php';
|
||||
<table class='table-1 tablesorter'>
|
||||
<thead>
|
||||
<tr class='colhead'>
|
||||
<th class='w-id'><?php echo $lang->idAB;?></th>
|
||||
<th><?php echo $lang->user->realname;?></th>
|
||||
<th><?php echo $lang->user->account;?></th>
|
||||
<th><?php echo $lang->user->role;?></th>
|
||||
<th><?php echo $lang->user->email;?></th>
|
||||
<th><?php echo $lang->user->gender;?></th>
|
||||
<th><?php echo $lang->user->phone;?></th>
|
||||
<th><?php echo $lang->user->join;?></th>
|
||||
<th><?php echo $lang->user->last;?></th>
|
||||
<th><?php echo $lang->user->visits;?></th>
|
||||
<?php $vars = "param=$param&type=$type&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";?>
|
||||
<th class='w-id'><?php common::printorderlink('id', $orderBy, $vars, $lang->idAB);?></th>
|
||||
<th><?php common::printorderlink('realname', $orderBy, $vars, $lang->user->realname);?></th>
|
||||
<th><?php common::printOrderLink('account', $orderBy, $vars, $lang->user->account);?></th>
|
||||
<th><?php common::printOrderLink('role', $orderBy, $vars, $lang->user->role);?></th>
|
||||
<th><?php common::printOrderLink('email', $orderBy, $vars, $lang->user->email);?></th>
|
||||
<th><?php common::printOrderLink('gander', $orderBy, $vars, $lang->user->gender);?></th>
|
||||
<th><?php common::printOrderLink('phone', $orderBy, $vars, $lang->user->phone);?></th>
|
||||
<th><?php common::printOrderLink('join', $orderBy, $vars, $lang->user->join);?></th>
|
||||
<th><?php common::printOrderLink('last', $orderBy, $vars, $lang->user->last);?></th>
|
||||
<th><?php common::printOrderLink('visits', $orderBy, $vars, $lang->user->visits);?></th>
|
||||
<th class='w-80px'><?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -284,12 +284,12 @@ class deptModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getUsers($deptID, $pager = null)
|
||||
public function getUsers($deptID, $pager = null, $orderBy = 'id')
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_USER)
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF($deptID)->andWhere('dept')->in($deptID)->fi()
|
||||
->orderBy('id')
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
@@ -177,12 +177,12 @@ class userModel extends model
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getByQuery($query, $pager = null)
|
||||
public function getByQuery($query, $pager = null, $orderBy = 'id')
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_USER)
|
||||
->where($query)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy('id')
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->fetchAll();
|
||||
}
|
||||
@@ -316,6 +316,7 @@ class userModel extends model
|
||||
{
|
||||
$oldUsers = $this->dao->select('id, account')->from(TABLE_USER)->where('id')->in(array_keys($this->post->account))->fetchPairs('id', 'account');
|
||||
$accountGroup = $this->dao->select('id, account')->from(TABLE_USER)->where('account')->in($this->post->account)->fetchGroup('account', 'id');
|
||||
|
||||
foreach($this->post->account as $id => $account)
|
||||
{
|
||||
$users[$id]['account'] = $account;
|
||||
@@ -326,7 +327,7 @@ class userModel extends model
|
||||
$users[$id]['email'] = $this->post->email[$id];
|
||||
$users[$id]['join'] = $this->post->join[$id];
|
||||
|
||||
if(isset($accountGroup[$account]) and count($accountGroup[$account]) >1) die(js::error(sprintf($this->lang->user->error->accountDupl, $id)));
|
||||
if(isset($accountGroup[$account]) and count($accountGroup[$account]) > 1) die(js::error(sprintf($this->lang->user->error->accountDupl, $id)));
|
||||
if(!validater::checkReg($users[$id]['account'], '|(.){3,}|')) die(js::error(sprintf($this->lang->user->error->account, $id)));
|
||||
if($users[$id]['realname'] == '') die(js::error(sprintf($this->lang->user->error->realname, $id)));
|
||||
if($users[$id]['email'] and !validater::checkEmail($users[$id]['email'])) die(js::error(sprintf($this->lang->user->error->mail, $id)));
|
||||
|
||||
Reference in New Issue
Block a user