From 08f665a20f2e62cade5f55ffe9016aaabb1fed69 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Sun, 6 Sep 2015 13:32:35 +0800 Subject: [PATCH] * finish task #2281. --- module/company/control.php | 1 + module/project/control.php | 9 +++++++-- module/project/view/story.html.php | 3 ++- module/story/model.php | 3 ++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/module/company/control.php b/module/company/control.php index 1f2570e3a4..f2cb427dbb 100644 --- a/module/company/control.php +++ b/module/company/control.php @@ -129,6 +129,7 @@ class company extends control die(js::reload('parent.parent')); } + $this->company->setMenu(); $title = $this->lang->company->common . $this->lang->colon . $this->lang->company->edit; $position[] = $this->lang->company->edit; $this->view->title = $title; diff --git a/module/project/control.php b/module/project/control.php index 0b07c658a1..256dfafdcb 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -529,7 +529,7 @@ class project extends control * @access public * @return void */ - public function story($projectID = 0, $orderBy = '', $type = 'byModule', $param = 0) + public function story($projectID = 0, $orderBy = '', $type = 'byModule', $param = 0, $recTotal = 0, $recPerPage = 50, $pageID = 1) { /* Load these models. */ $this->loadModel('story'); @@ -554,8 +554,12 @@ class project extends control $position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $project->name); $position[] = $this->lang->project->story; + /* Load pager. */ + $this->app->loadClass('pager', $static = true); + $pager = new pager($recTotal, $recPerPage, $pageID); + /* The pager. */ - $stories = $this->story->getProjectStories($projectID, $sort, $type, $param); + $stories = $this->story->getProjectStories($projectID, $sort, $type, $param, $pager); $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'story', false); $storyTasks = $this->task->getStoryTaskCounts(array_keys($stories), $projectID); $users = $this->user->getPairs('noletter'); @@ -583,6 +587,7 @@ class project extends control $this->view->moduleTree = $this->loadModel('tree')->getProjectStoryTreeMenu($projectID, $startModuleID = 0, array('treeModel', 'createProjectStoryLink')); $this->view->tabID = 'story'; $this->view->users = $users; + $this->view->pager = $pager; $this->display(); } diff --git a/module/project/view/story.html.php b/module/project/view/story.html.php index 48a0635117..9c2e873d8e 100644 --- a/module/project/view/story.html.php +++ b/module/project/view/story.html.php @@ -46,7 +46,7 @@ - id}&orderBy=%s&type=$type¶m=$param"; ?> + id}&orderBy=%s&type=$type¶m=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?> @@ -147,6 +147,7 @@ echo "
" . $summary . '
'; ?> + show();?> diff --git a/module/story/model.php b/module/story/model.php index 77ae73e4d0..49b99ce224 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -1181,7 +1181,7 @@ class storyModel extends model * @access public * @return array */ - public function getProjectStories($projectID = 0, $orderBy = 'pri_asc,id_desc', $type = 'byModule', $param = 0) + public function getProjectStories($projectID = 0, $orderBy = 'pri_asc,id_desc', $type = 'byModule', $param = 0, $pager = null) { $modules = ($type == 'byModule' and $param) ? $this->dao->select('*')->from(TABLE_MODULE)->where('path')->like("%,$param,%")->andWhere('type')->eq('story')->fetchPairs('id', 'id') : array(); $stories = $this->dao->select('t1.*, t2.*')->from(TABLE_PROJECTSTORY)->alias('t1') @@ -1191,6 +1191,7 @@ class storyModel extends model ->beginIF($type == 'byModule' and $param)->andWhere('t2.module')->in($modules)->fi() ->andWhere('t2.deleted')->eq(0) ->orderBy($orderBy) + ->page($pager) ->fetchAll('id'); return $stories; }
idAB);?> priAB);?> story->title);?>