diff --git a/module/company/control.php b/module/company/control.php index 3a959332a1..48de9dc19f 100644 --- a/module/company/control.php +++ b/module/company/control.php @@ -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(); } diff --git a/module/company/view/browse.html.php b/module/company/view/browse.html.php index fb69a9efbd..3f2d670829 100644 --- a/module/company/view/browse.html.php +++ b/module/company/view/browse.html.php @@ -13,7 +13,6 @@ @@ -38,16 +37,17 @@ include '../../common/view/tablesorter.html.php';
- - - - - - - - - - + recTotal}&recPerPage={$pager->recPerPage}";?> + + + + + + + + + + diff --git a/module/dept/model.php b/module/dept/model.php index 36263f39c1..c71aea8280 100644 --- a/module/dept/model.php +++ b/module/dept/model.php @@ -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(); } diff --git a/module/user/model.php b/module/user/model.php index 1ebfe72790..f57d87dfcc 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -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)));
idAB;?>user->realname;?>user->account;?>user->role;?>user->email;?>user->gender;?>user->phone;?>user->join;?>user->last;?>user->visits;?>idAB);?>user->realname);?>user->account);?>user->role);?>user->email);?>user->gender);?>user->phone);?>user->join);?>user->last);?>user->visits);?> actions;?>