From d0b8f6164bbfccd68a489f3026ce7a4e890a2b35 Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Thu, 11 Mar 2021 15:24:17 +0800 Subject: [PATCH] * Add order by to user view. --- module/common/lang/menuOrder.php | 7 ++++--- module/common/lang/zh-cn.php | 2 +- module/common/model.php | 2 +- module/index/js/index.js | 5 ++++- module/project/model.php | 6 +++--- module/todo/control.php | 2 +- module/user/control.php | 18 +++++++++++------- module/user/model.php | 6 +++--- module/user/view/bug.html.php | 19 ++++++++++--------- module/user/view/execution.html.php | 19 ++++++++++--------- module/user/view/story.html.php | 21 +++++++++++---------- module/user/view/task.html.php | 21 +++++++++++---------- 12 files changed, 70 insertions(+), 58 deletions(-) diff --git a/module/common/lang/menuOrder.php b/module/common/lang/menuOrder.php index c8ded5ed3a..239ddeb20b 100644 --- a/module/common/lang/menuOrder.php +++ b/module/common/lang/menuOrder.php @@ -148,9 +148,10 @@ $lang->group->menuOrder = $lang->company->menuOrder; $lang->user->menuOrder = $lang->company->menuOrder; /* system menu order. */ -$lang->system->menuOrder[5] = 'company'; -$lang->system->menuOrder[10] = 'team'; -$lang->system->menuOrder[15] = 'calendar'; +$lang->system->menuOrder[5] = 'team'; +$lang->system->menuOrder[10] = 'calendar'; +$lang->system->menuOrder[15] = 'dynamic'; +$lang->system->menuOrder[20] = 'view'; /* admin menu order. */ $lang->admin->menuOrder[5] = 'index'; diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index cfcaaa1fdb..f59799f6ac 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -554,7 +554,7 @@ $lang->admin->subMenu->system->cron = array('link' => '定时|cron|index', $lang->admin->subMenu->system->timezone = array('link' => '时区|custom|timezone', 'subModule' => 'custom'); $lang->admin->subMenu->system->buildIndex = array('link' => '重建索引|search|buildindex|'); -$lang->admin->dividerMenu = ',message,system,'; +$lang->admin->dividerMenu = ',company,message,system,'; $lang->convert = new stdclass(); $lang->upgrade = new stdclass(); diff --git a/module/common/model.php b/module/common/model.php index c3c68969b9..42300c2f69 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -1728,7 +1728,7 @@ EOD; if(!defined('IN_UPGRADE') and $inProject) { /* Check program priv. */ - if($this->session->PRJ and strpos(",{$this->app->user->view->projects},", ",{$this->session->PRJ},") === false and !$this->app->user->admin) $this->loadModel('program')->accessDenied(); + if($this->session->PRJ and strpos(",{$this->app->user->view->projects},", ",{$this->session->PRJ},") === false and !$this->app->user->admin) $this->loadModel('project')->accessDenied(); $this->resetProgramPriv($module, $method); if(!commonModel::hasPriv($module, $method)) $this->deny($module, $method, false); } diff --git a/module/index/js/index.js b/module/index/js/index.js index 0e2c07fc94..3b19206365 100644 --- a/module/index/js/index.js +++ b/module/index/js/index.js @@ -118,7 +118,10 @@ { if(['todo', 'task', 'story', 'bug', 'testtask', 'testcase', 'execution', 'dynamic', 'profile'].includes(methodLowerCase)) return 'system'; } - if(moduleName === 'my') if(methodLowerCase === 'team' || methodLowerCase == 'calendar') return 'system'; + if(moduleName === 'my') + { + if(['todo', 'team', 'calendar'].includes(methodLowerCase)) return 'system'; + } if(moduleName === 'company') if(methodLowerCase === 'dynamic' || methodLowerCase == 'view') return 'system'; if(moduleName === 'tree') { diff --git a/module/project/model.php b/module/project/model.php index b2d2bc877a..7616256143 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -562,15 +562,15 @@ class projectModel extends model * Get project pairs by model and project. * * @param string $model all|scrum|waterfall - * @param int $projectID + * @param int $programID * @access public * @return array */ - public function getPairsByModel($model = 'all', $projectID = 0) + public function getPairsByModel($model = 'all', $programID = 0) { return $this->dao->select('id, name')->from(TABLE_PROJECT) ->where('type')->eq('project') - ->beginIF($projectID)->andWhere('parent')->eq($projectID)->fi() + ->beginIF($programID)->andWhere('parent')->eq($programID)->fi() ->beginIF($model != 'all')->andWhere('model')->eq($model)->fi() ->andWhere('deleted')->eq('0') ->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->projects)->fi() diff --git a/module/todo/control.php b/module/todo/control.php index 75ec16b32b..3a011752ff 100644 --- a/module/todo/control.php +++ b/module/todo/control.php @@ -399,7 +399,7 @@ class todo extends control $this->lang->set('menugroup.todo', $from); } - $projects = $this->loadModel('project')->getPairs(); + $projects = $this->loadModel('project')->getPairsByModel('all'); if(!isset($this->session->PRJ)) $this->session->set('project', key($projects)); $this->view->title = $this->app->user->account == $todo->account ? "{$this->lang->todo->common} #$todo->id $todo->name" : $this->lang->todo->common ; diff --git a/module/user/control.php b/module/user/control.php index f485f71dde..ef820738ab 100644 --- a/module/user/control.php +++ b/module/user/control.php @@ -55,7 +55,7 @@ class user extends control * @access public * @return void */ - public function todo($userID, $type = 'today', $status = 'all', $orderBy='date,status,begin', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function todo($userID, $type = 'today', $status = 'all', $orderBy = 'date,status,begin', $recTotal = 0, $recPerPage = 20, $pageID = 1) { $user = $this->user->getById($userID, 'id'); if(empty($user)) die(js::error($this->lang->notFound) . js::locate('back')); @@ -112,7 +112,7 @@ class user extends control * @access public * @return void */ - public function story($userID, $storyType = 'story', $type = 'assignedTo', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function story($userID, $storyType = 'story', $type = 'assignedTo', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Save session. */ $this->session->set('storyList', $this->app->getURI(true)); @@ -138,9 +138,10 @@ class user extends control /* Assign. */ $this->view->title = $this->lang->user->common . $this->lang->colon . $this->lang->user->story; $this->view->position[] = $this->lang->user->story; - $this->view->stories = $this->story->getUserStories($account, $type, 'id_desc', $pager, $storyType); + $this->view->stories = $this->story->getUserStories($account, $type, $orderBy, $pager, $storyType); $this->view->users = $this->user->getPairs('noletter'); $this->view->storyType = $storyType; + $this->view->orderBy = $orderBy; $this->view->type = $type; $this->view->user = $user; $this->view->pager = $pager; @@ -160,7 +161,7 @@ class user extends control * @access public * @return void */ - public function task($userID, $type = 'assignedTo', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function task($userID, $type = 'assignedTo', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Save the session. */ $this->session->set('taskList', $this->app->getURI(true)); @@ -184,8 +185,9 @@ class user extends control $this->view->title = $this->lang->user->common . $this->lang->colon . $this->lang->user->task; $this->view->position[] = $this->lang->user->task; $this->view->tabID = 'task'; - $this->view->tasks = $this->loadModel('task')->getUserTasks($account, $type, 0, $pager); + $this->view->tasks = $this->loadModel('task')->getUserTasks($account, $type, 0, $pager, $orderBy); $this->view->type = $type; + $this->view->orderBy = $orderBy; $this->view->user = $user; $this->view->pager = $pager; @@ -233,6 +235,7 @@ class user extends control $this->view->bugs = $this->loadModel('bug')->getUserBugs($account, $type, $orderBy, 0, $pager); $this->view->type = $type; $this->view->user = $user; + $this->view->orderBy = $orderBy; $this->view->users = $this->user->getPairs('noletter'); $this->view->pager = $pager; @@ -362,7 +365,7 @@ class user extends control * @access public * @return void */ - public function execution($userID, $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function execution($userID, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { $uri = $this->app->getURI(true); $this->session->set('projectList', $uri); @@ -386,8 +389,9 @@ class user extends control $this->view->title = $this->lang->user->common . $this->lang->colon . $this->lang->user->execution; $this->view->position[] = $this->lang->user->execution; $this->view->tabID = 'project'; - $this->view->executions = $this->user->getProjects($account, 'execution', 'all', $pager); + $this->view->executions = $this->user->getExecutions($account, 'execution', 'all', $orderBy, $pager); $this->view->user = $user; + $this->view->orderBy = $orderBy; $this->view->pager = $pager; $this->display(); diff --git a/module/user/model.php b/module/user/model.php index 709cf03868..f81c58a4bc 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -1015,7 +1015,7 @@ class userModel extends model } /** - * Get projects a user participated. + * Get execution a user participated. * * @param string $account * @param string $type project|execution @@ -1023,7 +1023,7 @@ class userModel extends model * @access public * @return array */ - public function getProjects($account, $type = 'project', $status = 'all', $pager = null) + public function getExecutions($account, $type = 'execution', $status = 'all', $orderBy, $pager = null) { if($type == 'execution') $type = 'sprint,stage'; $myProjectsList = $this->dao->select('t1. *,t2. *')->from(TABLE_TEAM)->alias('t1') @@ -1035,7 +1035,7 @@ class userModel extends model ->beginIF($status == 'openedbyme')->andWhere('openedBy')->eq($account)->fi() ->andWhere('t1.account')->eq($account) ->andWhere('t2.deleted')->eq(0) - ->orderBy('t2.id_desc') + ->orderBy("t2.$orderBy") ->page($pager) ->fetchGroup('project'); diff --git a/module/user/view/bug.html.php b/module/user/view/bug.html.php index 1ad4588a65..800d00814d 100644 --- a/module/user/view/bug.html.php +++ b/module/user/view/bug.html.php @@ -34,17 +34,18 @@
- +
+ id}&type=$type&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}"; ?> - - - - - - - - + + + + + + + + diff --git a/module/user/view/execution.html.php b/module/user/view/execution.html.php index 9ebdaaa049..184b0f3181 100644 --- a/module/user/view/execution.html.php +++ b/module/user/view/execution.html.php @@ -15,17 +15,18 @@
-
idAB;?>bug->severityAB;?>priAB;?>typeAB;?>bug->title;?>openedByAB;?>bug->resolvedBy;?>bug->resolutionAB;?> idAB);?>bug->severityAB);?> priAB);?> typeAB);?> bug->title);?> openedByAB);?> bug->resolvedBy);?> bug->resolutionAB);?>
+
+ id}&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}"; ?> - - - - - - - - + + + + + + + + diff --git a/module/user/view/story.html.php b/module/user/view/story.html.php index 01a69ad966..d0a6e11590 100644 --- a/module/user/view/story.html.php +++ b/module/user/view/story.html.php @@ -34,18 +34,19 @@
-
idAB;?>user->name;?>statusAB;?>team->role;?>execution->begin;?>execution->end;?>team->join;?>team->hours;?> idAB);?>user->name);?> statusAB);?> team->role;?> execution->begin);?> execution->end);?> team->join;?> team->hours;?>
+
+ id}&storyType=$storyType&type=$type&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}"; ?> - - - - - - - - - + + + + + + + + + diff --git a/module/user/view/task.html.php b/module/user/view/task.html.php index 7c7dd7e512..2d0aca9091 100644 --- a/module/user/view/task.html.php +++ b/module/user/view/task.html.php @@ -37,18 +37,19 @@
-
idAB;?> priAB;?> story->product;?> story->title;?> story->plan;?> openedByAB;?> story->estimateAB;?>statusAB;?> story->stageAB;?> idAB);?> priAB);?> story->product);?> story->title);?> story->plan);?> openedByAB);?> story->estimateAB);?>statusAB);?> story->stageAB);?>
+
+ id}&type=$type&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}"; ?> - - - - - - - - - + + + + + + + + +
idAB;?>priAB;?>task->execution;?>task->name;?>task->estimateAB;?>task->consumedAB;?>task->leftAB;?>task->deadlineAB;?>statusAB;?>idAB);?>priAB);?>task->execution);?>task->name);?>task->estimateAB);?>task->consumedAB);?>task->leftAB);?>task->deadlineAB);?>statusAB);?>