diff --git a/module/user/control.php b/module/user/control.php index 0a1e8df1d1..297b2b48b8 100644 --- a/module/user/control.php +++ b/module/user/control.php @@ -120,14 +120,21 @@ class user extends control * User bugs. * * @param string $account + * @param int $recTotal + * @param int $recPerPage + * @param int $pageID * @access public * @return void */ - public function bug($account) + public function bug($account, $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Save the session. */ $this->session->set('bugList', $this->app->getURI(true)); + /* Load pager. */ + $this->app->loadClass('pager', $static = true); + $pager = pager::init($recTotal, $recPerPage, $pageID); + /* Set menu. */ $this->lang->set('menugroup.user', 'company'); $this->user->setMenu($this->user->getPairs('noempty|noclosed'), $account); @@ -141,9 +148,10 @@ class user extends control $this->view->header = $header; $this->view->position = $position; $this->view->tabID = 'bug'; - $this->view->bugs = $this->user->getBugs($account); + $this->view->bugs = $this->user->getBugs($account, $pager); $this->view->user = $this->dao->findByAccount($account)->from(TABLE_USER)->fetch(); $this->view->users = $this->user->getPairs('noletter'); + $this->view->pager = $pager; $this->display(); } diff --git a/module/user/model.php b/module/user/model.php index 7c8fec41c4..ca6f01e101 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -394,10 +394,11 @@ class userModel extends model * Get bugs assigned to a user. * * @param string $account + * @param object $pager * @access public * @return array */ - public function getBugs($account) + public function getBugs($account, $pager = null) { return $this->dao->select('t1.*') ->from(TABLE_BUG)->alias('t1') @@ -406,6 +407,8 @@ class userModel extends model ->where('t2.deleted')->eq(0) ->andwhere('t1.deleted')->eq(0) ->andwhere('t1.assignedTo')->eq($account) + ->orderBy('id desc') + ->page($pager) ->fetchAll(); } } diff --git a/module/user/view/bug.html.php b/module/user/view/bug.html.php index 49dcb59cc7..6df0d63cc2 100644 --- a/module/user/view/bug.html.php +++ b/module/user/view/bug.html.php @@ -39,5 +39,6 @@ + show();?>