* Finish task #9118.

This commit is contained in:
holan20180123
2021-01-28 14:46:12 +08:00
parent d8ac5728d8
commit c26a63e7fb
17 changed files with 104 additions and 131 deletions
+49 -76
View File
@@ -33,20 +33,18 @@ class user extends control
* View a user.
*
* @param string $userID
* @param string $fromModule
* @access public
* @return void
*/
public function view($userID, $fromModule = 'user')
public function view($userID)
{
$this->locate($this->createLink('user', 'todo', "userID=$userID&fromModule=$fromModule"));
$this->locate($this->createLink('user', 'todo', "userID=$userID"));
}
/**
* Todos of a user.
*
* @param string $userID
* @param string $fromModule
* @param string $type the todo type, today|lastweek|thisweek|all|undone, or a date.
* @param string $status
* @param string $orderBy
@@ -56,7 +54,7 @@ class user extends control
* @access public
* @return void
*/
public function todo($userID, $fromModule = 'user', $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'));
@@ -78,19 +76,18 @@ class user extends control
$account = $user->account;
$todos = $this->todo->getList($type, $account, $status, 0, $pager, $sort);
$date = (int)$type == 0 ? helper::today() : $type;
$users = $fromModule == 'user' ? $this->user->getPairs('noempty|noclosed|nodeleted|useid') : $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
$users = $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
/* Change the menu when in my module. */
$this->resetMenu($fromModule);
$this->resetMenu();
/* set menus. */
$this->lang->set('menugroup.user', 'company');
$this->view->userList = $this->user->setUserList($users, $userID, $fromModule);
$this->view->userList = $this->user->setUserList($users, $userID);
$this->view->title = $this->lang->user->common . $this->lang->colon . $this->lang->user->todo;
$this->view->position[] = $this->lang->user->todo;
$this->view->tabID = 'todo';
$this->view->fromModule = $fromModule;
$this->view->date = $date;
$this->view->todos = $todos;
$this->view->user = $user;
@@ -106,7 +103,6 @@ class user extends control
* Story of a user.
*
* @param int $userID
* @param string $fromModule
* @param string $storyType
* @param string $type
* @param int $recTotal
@@ -115,7 +111,7 @@ class user extends control
* @access public
* @return void
*/
public function story($userID, $fromModule = 'user', $storyType = 'story', $type = 'assignedTo', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function story($userID, $storyType = 'story', $type = 'assignedTo', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
/* Save session. */
$this->session->set('storyList', $this->app->getURI(true));
@@ -126,25 +122,24 @@ class user extends control
$user = $this->user->getById($userID, 'id');
$account = $user->account;
$users = $fromModule == 'user' ? $this->user->getPairs('noempty|noclosed|nodeleted|useid') : $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
$users = $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
/* Set menu. */
$this->lang->set('menugroup.user', 'company');
/* Change the menu when in my module. */
$this->resetMenu($fromModule);
$this->resetMenu();
/* 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->loadModel('story')->getUserStories($account, $type, 'id_desc', $pager, $storyType);
$this->view->users = $this->user->getPairs('noletter');
$this->view->fromModule = $fromModule;
$this->view->storyType = $storyType;
$this->view->type = $type;
$this->view->user = $user;
$this->view->pager = $pager;
$this->view->userList = $this->user->setUserList($users, $userID, $fromModule);
$this->view->userList = $this->user->setUserList($users, $userID);
$this->display();
}
@@ -153,7 +148,6 @@ class user extends control
* Tasks of a user.
*
* @param int $userID
* @param string $fromModule
* @param string $type
* @param int $recTotal
* @param int $recPerPage
@@ -161,7 +155,7 @@ class user extends control
* @access public
* @return void
*/
public function task($userID, $fromModule = 'user', $type = 'assignedTo', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function task($userID, $type = 'assignedTo', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
/* Save the session. */
$this->session->set('taskList', $this->app->getURI(true));
@@ -172,21 +166,20 @@ class user extends control
$user = $this->user->getById($userID, 'id');
$account = $user->account;
$users = $fromModule == 'user' ? $this->user->getPairs('noempty|noclosed|nodeleted|useid') : $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
$users = $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
/* Set the menu. */
$this->lang->set('menugroup.user', 'company');
$this->view->userList = $this->user->setUserList($users, $userID, $fromModule);
$this->view->userList = $this->user->setUserList($users, $userID);
/* Change the menu when in my module. */
$this->resetMenu($fromModule);
$this->resetMenu();
/* Assign. */
$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->fromModule = $fromModule;
$this->view->type = $type;
$this->view->user = $user;
$this->view->pager = $pager;
@@ -198,7 +191,6 @@ class user extends control
* User bugs.
*
* @param int $userID
* @param string $fromModule
* @param string $type
* @param string $orderBy
* @param int $recTotal
@@ -207,7 +199,7 @@ class user extends control
* @access public
* @return void
*/
public function bug($userID, $fromModule = 'user', $type = 'assignedTo', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function bug($userID, $type = 'assignedTo', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
/* Save the session. */
$this->session->set('bugList', $this->app->getURI(true));
@@ -218,23 +210,22 @@ class user extends control
$user = $this->user->getById($userID, 'id');
$account = $user->account;
$users = $fromModule == 'user' ? $this->user->getPairs('noempty|noclosed|nodeleted|useid') : $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
$users = $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
/* Set menu. */
$this->lang->set('menugroup.user', 'company');
$this->view->userList = $this->user->setUserList($users, $userID, $fromModule);
$this->view->userList = $this->user->setUserList($users, $userID);
/* Load the lang of bug module. */
$this->app->loadLang('bug');
/* Change the menu when in my module. */
$this->resetMenu($fromModule);
$this->resetMenu();
$this->view->title = $this->lang->user->common . $this->lang->colon . $this->lang->user->bug;
$this->view->position[] = $this->lang->user->bug;
$this->view->tabID = 'bug';
$this->view->bugs = $this->loadModel('bug')->getUserBugs($account, $type, $orderBy, 0, $pager);
$this->view->fromModule = $fromModule;
$this->view->type = $type;
$this->view->user = $user;
$this->view->users = $this->user->getPairs('noletter');
@@ -247,7 +238,6 @@ class user extends control
* User's testtask
*
* @param int $userID
* @param string $fromModule
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
@@ -255,7 +245,7 @@ class user extends control
* @access public
* @return void
*/
public function testtask($userID, $fromModule = 'user', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function testtask($userID, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
/* Load pager. */
$this->app->loadClass('pager', $static = true);
@@ -263,11 +253,11 @@ class user extends control
$user = $this->user->getById($userID, 'id');
$account = $user->account;
$users = $fromModule == 'user' ? $this->user->getPairs('noempty|noclosed|nodeleted|useid') : $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
$users = $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
/* Set menu. */
$this->lang->set('menugroup.user', 'company');
$this->view->userList = $this->user->setUserList($users, $userID, $fromModule);
$this->view->userList = $this->user->setUserList($users, $userID);
/* Save session. */
$this->session->set('testtaskList', $this->app->getURI(true));
@@ -278,14 +268,13 @@ class user extends control
$sort = $this->loadModel('common')->appendOrder($orderBy);
/* Change the menu when in my module. */
$this->resetMenu($fromModule);
$this->resetMenu();
$this->view->title = $this->lang->user->common . $this->lang->colon . $this->lang->user->testTask;
$this->view->position[] = $this->lang->user->testTask;
$this->view->tasks = $this->loadModel('testtask')->getByUser($account, $pager, $sort);
$this->view->users = $this->user->getPairs('noletter');
$this->view->user = $user;
$this->view->fromModule = $fromModule;
$this->view->recTotal = $recTotal;
$this->view->recPerPage = $recPerPage;
$this->view->pageID = $pageID;
@@ -298,7 +287,6 @@ class user extends control
* User's test case.
*
* @param int $userID
* @param string $fromModule
* @param string $type
* @param string $orderBy
* @param int $recTotal
@@ -307,7 +295,7 @@ class user extends control
* @access public
* @return void
*/
public function testcase($userID, $fromModule = 'user', $type = 'case2Him', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function testcase($userID, $type = 'case2Him', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
/* Save session, load lang. */
$this->session->set('caseList', $this->app->getURI(true));
@@ -319,7 +307,7 @@ class user extends control
$user = $this->user->getById($userID, 'id');
$account = $user->account;
$users = $fromModule == 'user' ? $this->user->getPairs('noempty|noclosed|nodeleted|useid') : $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
$users = $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
/* Append id for secend sort. */
$sort = $this->loadModel('common')->appendOrder($orderBy);
@@ -328,7 +316,7 @@ class user extends control
$this->lang->set('menugroup.user', 'company');
/* Change the menu when in my module. */
$this->resetMenu($fromModule);
$this->resetMenu();
$cases = array();
if($type == 'case2Him')
@@ -348,14 +336,13 @@ class user extends control
$this->view->cases = $cases;
$this->view->users = $this->user->getPairs('noletter');
$this->view->tabID = 'test';
$this->view->fromModule = $fromModule;
$this->view->type = $type;
$this->view->recTotal = $recTotal;
$this->view->recPerPage = $recPerPage;
$this->view->pageID = $pageID;
$this->view->orderBy = $orderBy;
$this->view->pager = $pager;
$this->view->userList = $this->user->setUserList($users, $userID, $fromModule);
$this->view->userList = $this->user->setUserList($users, $userID);
$this->display();
}
@@ -364,21 +351,20 @@ class user extends control
* User executions.
*
* @param int $userID
* @param string $fromModule
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function execution($userID, $fromModule = 'user', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function execution($userID, $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$uri = $this->app->getURI(true);
$this->session->set('projectList', $uri);
$user = $this->user->getById($userID, 'id');
$account = $user->account;
$users = $fromModule == 'user' ? $this->user->getPairs('noempty|noclosed|nodeleted|useid') : $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
$users = $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
/* Load pager. */
$this->app->loadClass('pager', $static = true);
@@ -387,14 +373,13 @@ class user extends control
/* Set the menus. */
$this->loadModel('project');
$this->lang->set('menugroup.user', 'company');
$this->view->userList = $this->user->setUserList($users, $userID, $fromModule);
$this->view->userList = $this->user->setUserList($users, $userID);
/* Change the menu when in my module. */
$this->resetMenu($fromModule);
$this->resetMenu();
$this->view->title = $this->lang->user->common . $this->lang->colon . $this->lang->user->execution;
$this->view->position[] = $this->lang->user->execution;
$this->view->fromModule = $fromModule;
$this->view->tabID = 'project';
$this->view->executions = $this->user->getProjects($account, array('sprint', 'stage'), 'all', $pager);
$this->view->user = $user;
@@ -407,7 +392,6 @@ class user extends control
* User issues.
*
* @param int $userID
* @param string $fromModule
* @param string $type
* @param string $orderBy
* @param int $recTotal
@@ -416,14 +400,14 @@ class user extends control
* @access public
* @return void
*/
public function issue($userID, $fromModule = 'user', $type = 'assignedTo', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function issue($userID, $type = 'assignedTo', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$uri = $this->app->getURI(true);
$this->session->set('issueList', $uri);
$user = $this->user->getById($userID, 'id');
$account = $user->account;
$users = $fromModule == 'user' ? $this->user->getPairs('noempty|noclosed|nodeleted|useid') : $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
$users = $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
/* Load pager. */
$this->app->loadClass('pager', $static = true);
@@ -431,14 +415,13 @@ class user extends control
/* Set the menus. */
$this->lang->set('menugroup.user', 'company');
$this->view->userList = $this->user->setUserList($users, $userID, $fromModule);
$this->view->userList = $this->user->setUserList($users, $userID);
/* Change the menu when in my module. */
$this->resetMenu($fromModule);
$this->resetMenu();
$this->view->title = $this->lang->user->common . $this->lang->colon . $this->lang->user->issue;
$this->view->position[] = $this->lang->user->issue;
$this->view->fromModule = $fromModule;
$this->view->issues = $this->loadModel('issue')->getUserIssues($type, $account, $orderBy, $pager);
$this->view->user = $user;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
@@ -453,7 +436,6 @@ class user extends control
* User risks.
*
* @param int $userID
* @param string $fromModule
* @param string $type
* @param string $orderBy
* @param int $recTotal
@@ -462,14 +444,14 @@ class user extends control
* @access public
* @return void
*/
public function risk($userID, $fromModule = 'user', $type = 'assignedTo', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function risk($userID, $type = 'assignedTo', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$uri = $this->app->getURI(true);
$this->session->set('riskList', $uri);
$user = $this->user->getById($userID, 'id');
$account = $user->account;
$users = $fromModule == 'user' ? $this->user->getPairs('noempty|noclosed|nodeleted|useid') : $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
$users = $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
/* Load pager. */
$this->app->loadClass('pager', $static = true);
@@ -477,14 +459,13 @@ class user extends control
/* Set the menus. */
$this->lang->set('menugroup.user', 'company');
$this->view->userList = $this->user->setUserList($users, $userID, $fromModule);
$this->view->userList = $this->user->setUserList($users, $userID);
/* Change the menu when in my module. */
$this->resetMenu($fromModule);
$this->resetMenu();
$this->view->title = $this->lang->user->common . $this->lang->colon . $this->lang->user->risk;
$this->view->position[] = $this->lang->user->risk;
$this->view->fromModule = $fromModule;
$this->view->risks = $this->loadModel('risk')->getUserRisks($type, $account, $orderBy, $pager);
$this->view->user = $user;
$this->view->type = $type;
@@ -498,30 +479,28 @@ class user extends control
* The profile of a user.
*
* @param int $userID
* @param string $fromModule
* @access public
* @return void
*/
public function profile($userID = '', $fromModule = 'user')
public function profile($userID = '')
{
if(empty($userID)) $userID = $this->app->user->id;
$user = $this->user->getById($userID, 'id');
$account = $user->account;
$users = $fromModule == 'user' ? $this->user->getPairs('noempty|noclosed|nodeleted|useid') : $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
$users = $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
/* Change the menu when in my module. */
$this->resetMenu($fromModule);
$this->resetMenu();
$this->view->title = "USER #$user->id $user->account/" . $this->lang->user->profile;
$this->view->position[] = $this->lang->user->common;
$this->view->position[] = $this->lang->user->profile;
$this->view->user = $user;
$this->view->fromModule = $fromModule;
$this->view->groups = $this->loadModel('group')->getByAccount($account);
$this->view->deptPath = $this->dept->getParents($user->dept);
$this->view->personalData = $this->user->getPersonalData($user->account);
$this->view->userList = $this->user->setUserList($users, $userID, $fromModule);
$this->view->userList = $this->user->setUserList($users, $userID);
$this->display();
}
@@ -1092,7 +1071,6 @@ class user extends control
* User dynamic.
*
* @param int $userID
* @param string $fromModule
* @param string $period
* @param int $recTotal
* @param string $date
@@ -1100,15 +1078,15 @@ class user extends control
* @access public
* @return void
*/
public function dynamic($userID = '', $fromModule = 'user', $period = 'today', $recTotal = 0, $date = '', $direction = 'next')
public function dynamic($userID = '', $period = 'today', $recTotal = 0, $date = '', $direction = 'next')
{
$user = $this->user->getById($userID, 'id');
$account = $user->account;
$users = $fromModule == 'user' ? $this->user->getPairs('noempty|noclosed|nodeleted|useid') : $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
$users = $this->loadModel('dept')->getDeptUserPairs($user->dept, 'useid');
/* set menus. */
$this->lang->set('menugroup.user', 'company');
$this->view->userList = $this->user->setUserList($users, $userID, $fromModule);
$this->view->userList = $this->user->setUserList($users, $userID);
/* Save session. */
$uri = $this->app->getURI(true);
@@ -1133,7 +1111,7 @@ class user extends control
$date = empty($date) ? '' : date('Y-m-d', $date);
/* Change the menu when in my module. */
$this->resetMenu($fromModule);
$this->resetMenu();
$actions = $this->loadModel('action')->getDynamic($account, $period, $sort, $pager, 'all', 'all', $date, $direction);
@@ -1145,7 +1123,6 @@ class user extends control
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->pager = $pager;
$this->view->user = $user;
$this->view->fromModule = $fromModule;
$this->view->dateGroups = $this->action->buildDateGroup($actions, $direction, $period);
$this->view->direction = $direction;
$this->display();
@@ -1154,17 +1131,13 @@ class user extends control
/**
* Reset menu when from my module.
*
* @param string $fromModule
* @access public
* @return void
*/
public function resetMenu($fromModule = 'user')
public function resetMenu()
{
if($fromModule == 'my')
{
$this->lang->admin->menu = $this->lang->my->menu;
$this->lang->noMenuModule[] = 'user';
}
$this->lang->admin->menu = $this->lang->my->menu;
$this->lang->noMenuModule[] = 'user';
}
/**