* code for task#790.
* add pager for user-bug page.
This commit is contained in:
+10
-2
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,5 +39,6 @@
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
<tfoot><tr><td colspan='8'><?php echo $pager->show();?></td></tr></tfoot>
|
||||
</table>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user