* Distinguish project execution from task module.

This commit is contained in:
holan20180123
2021-03-05 09:35:40 +08:00
parent 361af39093
commit a41e43311a
18 changed files with 430 additions and 431 deletions
+120 -121
View File
@@ -29,7 +29,7 @@ class task extends control
/**
* Create a task.
*
* @param int $projectID
* @param int $executionID
* @param int $storyID
* @param int $moduleID
* @param int $taskID
@@ -37,17 +37,17 @@ class task extends control
* @access public
* @return void
*/
public function create($projectID = 0, $storyID = 0, $moduleID = 0, $taskID = 0, $todoID = 0)
public function create($executionID = 0, $storyID = 0, $moduleID = 0, $taskID = 0, $todoID = 0)
{
$projects = $this->project->getExecutionPairs($this->session->project);
$projectID = $this->project->saveState($projectID, $projects);
$executions = $this->execution->getPairs($this->session->project);
$executionID = $this->execution->saveState($executionID, $executions);
$this->project->getLimitedExecution();
$limitedProjects = !empty($_SESSION['limitedProjects']) ? $_SESSION['limitedProjects'] : '';
if(strpos(",{$limitedProjects},", ",$projectID,") !== false)
$this->execution->getLimitedExecution();
$limitedExecutions = !empty($_SESSION['limitedExecutions']) ? $_SESSION['limitedExecutions'] : '';
if(strpos(",{$limitedExecutions},", ",$executionID,") !== false)
{
echo js::alert($this->lang->task->createDenied);
die(js::locate($this->createLink('project', 'task', "projectID=$projectID")));
die(js::locate($this->createLink('execution', 'task', "executionID=$executionID")));
}
$task = new stdClass();
@@ -65,8 +65,8 @@ class task extends control
$task->color = '';
if($taskID > 0)
{
$task = $this->task->getByID($taskID);
$projectID = $task->project;
$task = $this->task->getByID($taskID);
$executionID = $task->execution;
}
if($todoID > 0)
@@ -77,13 +77,12 @@ class task extends control
$task->desc = $todo->desc;
}
$project = $this->project->getById($projectID);
$taskLink = $this->createLink('project', 'browse', "projectID=$projectID&tab=task");
$storyLink = $this->session->storyList ? $this->session->storyList : $this->createLink('project', 'story', "projectID=$projectID");
$execution = $this->execution->getById($executionID);
$taskLink = $this->createLink('execution', 'browse', "executionID=$executionID&tab=task");
$storyLink = $this->session->storyList ? $this->session->storyList : $this->createLink('execution', 'story', "executionID=$executionID");
/* Set menu. */
$this->project->setMenu($projects, $project->id);
$this->execution->setMenu($executions, $execution->id);
if(!empty($_POST))
{
@@ -91,8 +90,8 @@ class task extends control
$response['message'] = $this->lang->saveSuccess;
setcookie('lastTaskModule', (int)$this->post->module, $this->config->cookieLife, $this->config->webRoot, '', false, false);
if($this->post->project) $projectID = (int)$this->post->project;
$tasksID = $this->task->create($projectID);
if($this->post->execution) $executionID = (int)$this->post->execution;
$tasksID = $this->task->create($executionID);
if(dao::isError())
{
$response['result'] = 'fail';
@@ -145,13 +144,13 @@ class task extends control
if($this->post->after == 'continueAdding')
{
$response['message'] = $this->lang->task->successSaved . $this->lang->task->afterChoices['continueAdding'];
$response['locate'] = $this->createLink('task', 'create', "projectID=$projectID&storyID={$this->post->story}&moduleID=$moduleID");
$response['locate'] = $this->createLink('task', 'create', "executionID=$executionID&storyID={$this->post->story}&moduleID=$moduleID");
$this->send($response);
}
elseif($this->post->after == 'toTaskList')
{
setcookie('moduleBrowseParam', 0, 0, $this->config->webRoot, '', false, false);
$taskLink = $this->createLink('project', 'task', "projectID=$projectID&status=unclosed&param=0&orderBy=id_desc");
$taskLink = $this->createLink('execution', 'task', "executionID=$executionID&status=unclosed&param=0&orderBy=id_desc");
$response['locate'] = $taskLink;
$this->send($response);
}
@@ -168,9 +167,9 @@ class task extends control
}
$users = $this->loadModel('user')->getPairs('noclosed|nodeleted');
$members = $this->project->getTeamMemberPairs($projectID, 'nodeleted');
$showAllModule = isset($this->config->project->task->allModule) ? $this->config->project->task->allModule : '';
$moduleOptionMenu = $this->tree->getTaskOptionMenu($projectID, 0, 0, $showAllModule ? 'allModule' : '');
$members = $this->execution->getTeamMemberPairs($executionID, 'nodeleted');
$showAllModule = isset($this->config->execution->task->allModule) ? $this->config->execution->task->allModule : '';
$moduleOptionMenu = $this->tree->getTaskOptionMenu($executionID, 0, 0, $showAllModule ? 'allModule' : '');
/* Fix bug #3381. When the story module is the root module. */
if($storyID)
@@ -189,16 +188,16 @@ class task extends control
$moduleID = $this->tree->getStoryModule($task->module);
$moduleIdList = $this->tree->getAllChildID($moduleID);
}
$stories = $this->story->getProjectStoryPairs($projectID, 0, 0, $moduleIdList, 'full', 'unclosed');
$stories = $this->story->getExecutionStoryPairs($executionID, 0, 0, $moduleIdList, 'full', 'unclosed');
$title = $project->name . $this->lang->colon . $this->lang->task->create;
$position[] = html::a($taskLink, $project->name);
$title = $execution->name . $this->lang->colon . $this->lang->task->create;
$position[] = html::a($taskLink, $execution->name);
$position[] = $this->lang->task->common;
$position[] = $this->lang->task->create;
/* Set Custom*/
foreach(explode(',', $this->config->task->customCreateFields) as $field) $customFields[$field] = $this->lang->task->$field;
if($project->type == 'ops') unset($customFields['story']);
if($execution->type == 'ops') unset($customFields['story']);
$this->view->customFields = $customFields;
$this->view->showFields = $this->config->task->custom->createFields;
@@ -206,12 +205,12 @@ class task extends control
$this->view->title = $title;
$this->view->position = $position;
$this->view->project = $project;
$this->view->projects = $this->config->systemMode == 'classic' ? $projects : $this->execution->getByProject($this->session->project, 'all', 0, true);
$this->view->execution = $execution;
$this->view->executions = $this->config->systemMode == 'classic' ? $executions : $this->execution->getByProject($this->session->project, 'all', 0, true);
$this->view->task = $task;
$this->view->users = $users;
$this->view->stories = $stories;
$this->view->testStoryIdList = $this->loadModel('story')->getTestStories(array_keys($stories), $project->id);
$this->view->testStoryIdList = $this->loadModel('story')->getTestStories(array_keys($stories), $execution->id);
$this->view->members = $members;
$this->view->moduleOptionMenu = $moduleOptionMenu;
$this->display();
@@ -220,7 +219,7 @@ class task extends control
/**
* Batch create task.
*
* @param int $projectID
* @param int $executionID
* @param int $storyID
* @param int $iframe
* @param int $taskID
@@ -228,14 +227,14 @@ class task extends control
* @access public
* @return void
*/
public function batchCreate($projectID = 0, $storyID = 0, $moduleID = 0, $taskID = 0, $iframe = 0)
public function batchCreate($executionID = 0, $storyID = 0, $moduleID = 0, $taskID = 0, $iframe = 0)
{
$this->project->getLimitedExecution();
$limitedProjects = !empty($_SESSION['limitedProjects']) ? $_SESSION['limitedProjects'] : '';
if(strpos(",{$limitedProjects},", ",$projectID,") !== false)
$this->execution->getLimitedExecution();
$limitedExecutions = !empty($_SESSION['limitedExecutions']) ? $_SESSION['limitedExecutions'] : '';
if(strpos(",{$limitedExecutions},", ",$executionID,") !== false)
{
echo js::alert($this->lang->task->createDenied);
die(js::locate($this->createLink('project', 'task', "projectID=$projectID")));
die(js::locate($this->createLink('execution', 'task', "executionID=$executionID")));
}
if($this->config->systemMode == 'new')
@@ -244,12 +243,12 @@ class task extends control
if($project->model == 'waterfall') $this->config->task->create->requiredFields .= ',estStarted,deadline';
}
$project = $this->project->getById($projectID);
$taskLink = $this->createLink('project', 'browse', "projectID=$projectID&tab=task");
$storyLink = $this->session->storyList ? $this->session->storyList : $this->createLink('project', 'story', "projectID=$projectID");
$execution = $this->execution->getById($executionID);
$taskLink = $this->createLink('execution', 'browse', "executionID=$executionID&tab=task");
$storyLink = $this->session->storyList ? $this->session->storyList : $this->createLink('execution', 'story', "executionID=$executionID");
/* Set menu. */
$this->project->setMenu($this->project->getExecutionPairs($this->session->project), $project->id);
$this->execution->setMenu($this->execution->getPairs($this->session->project), $execution->id);
/* When common task are child tasks, query whether common task are consumed. */
$taskConsumed = 0;
@@ -261,7 +260,7 @@ class task extends control
if(!empty($_POST))
{
$mails = $this->task->batchCreate($projectID);
$mails = $this->task->batchCreate($executionID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
/* Locate the browser. */
@@ -275,14 +274,14 @@ class task extends control
$this->view->showFields = $this->config->task->custom->batchCreateFields;
$stories = $this->story->getProjectStoryPairs($projectID, 0, 0, 0, 'short');
$members = $this->project->getTeamMemberPairs($projectID, 'nodeleted');
$stories = $this->story->getExecutionStoryPairs($executionID, 0, 0, 0, 'short');
$members = $this->execution->getTeamMemberPairs($executionID, 'nodeleted');
$showAllModule = isset($this->config->project->task->allModule) ? $this->config->project->task->allModule : '';
$modules = $this->loadModel('tree')->getTaskOptionMenu($projectID, 0, 0, $showAllModule ? 'allModule' : '');
$showAllModule = isset($this->config->execution->task->allModule) ? $this->config->execution->task->allModule : '';
$modules = $this->loadModel('tree')->getTaskOptionMenu($executionID, 0, 0, $showAllModule ? 'allModule' : '');
$title = $project->name . $this->lang->colon . $this->lang->task->batchCreate;
$position[] = html::a($taskLink, $project->name);
$title = $execution->name . $this->lang->colon . $this->lang->task->batchCreate;
$position[] = html::a($taskLink, $execution->name);
$position[] = $this->lang->task->common;
$position[] = $this->lang->task->batchCreate;
@@ -290,13 +289,13 @@ class task extends control
$this->view->title = $title;
$this->view->position = $position;
$this->view->project = $project;
$this->view->execution = $execution;
$this->view->stories = $stories;
$this->view->modules = $modules;
$this->view->parent = $taskID;
$this->view->storyID = $storyID;
$this->view->story = $this->story->getByID($storyID);
$this->view->storyTasks = $this->task->getStoryTaskCounts(array_keys($stories), $projectID);
$this->view->storyTasks = $this->task->getStoryTaskCounts(array_keys($stories), $executionID);
$this->view->members = $members;
$this->view->moduleID = $moduleID;
$this->view->taskConsumed = $taskConsumed;
@@ -312,14 +311,14 @@ class task extends control
*/
public function commonAction($taskID)
{
$this->view->task = $this->loadModel('task')->getByID($taskID);
$this->view->project = $this->project->getById($this->view->task->project);
$this->view->members = $this->project->getTeamMemberPairs($this->view->project->id ,'nodeleted');
$this->view->actions = $this->loadModel('action')->getList('task', $taskID);
$this->view->task = $this->loadModel('task')->getByID($taskID);
$this->view->execution = $this->execution->getById($this->view->task->execution);
$this->view->members = $this->execution->getTeamMemberPairs($this->view->execution->id ,'nodeleted');
$this->view->actions = $this->loadModel('action')->getList('task', $taskID);
/* Set menu. */
$this->project->setMenu($this->project->getExecutionPairs($this->session->project), $this->view->project->id);
$this->view->position[] = html::a($this->createLink('project', 'browse', "project={$this->view->task->project}"), $this->view->project->name);
$this->execution->setMenu($this->execution->getPairs($this->session->project), $this->view->execution->id);
$this->view->position[] = html::a($this->createLink('execution', 'browse', "execution={$this->view->task->execution}"), $this->view->execution->name);
}
/**
@@ -379,7 +378,7 @@ class task extends control
}
}
$tasks = $this->task->getParentTaskPairs($this->view->project->id, $this->view->task->parent);
$tasks = $this->task->getParentTaskPairs($this->view->execution->id, $this->view->task->parent);
if(isset($tasks[$taskID])) unset($tasks[$taskID]);
if(!isset($this->view->members[$this->view->task->assignedTo])) $this->view->members[$this->view->task->assignedTo] = $this->view->task->assignedTo;
@@ -388,12 +387,12 @@ class task extends control
$this->view->title = $this->lang->task->edit . 'TASK' . $this->lang->colon . $this->view->task->name;
$this->view->position[] = $this->lang->task->common;
$this->view->position[] = $this->lang->task->edit;
$this->view->stories = $this->story->getProjectStoryPairs($this->view->project->id);
$this->view->stories = $this->story->getExecutionStoryPairs($this->view->execution->id);
$this->view->tasks = $tasks;
$this->view->users = $this->loadModel('user')->getPairs('nodeleted', "{$this->view->task->openedBy},{$this->view->task->canceledBy},{$this->view->task->closedBy}");
$this->view->showAllModule = isset($this->config->project->task->allModule) ? $this->config->project->task->allModule : '';
$this->view->modules = $this->tree->getTaskOptionMenu($this->view->task->project, 0, 0, $this->view->showAllModule ? 'allModule' : '');
$this->view->projects = $this->config->systemMode == 'classic' ? $this->project->getExecutionPairs() : $this->execution->getByProject($this->session->project, 'all', 0, true);
$this->view->showAllModule = isset($this->config->execution->task->allModule) ? $this->config->execution->task->allModule : '';
$this->view->modules = $this->tree->getTaskOptionMenu($this->view->task->execution, 0, 0, $this->view->showAllModule ? 'allModule' : '');
$this->view->executions = $this->config->systemMode == 'classic' ? $this->execution->getPairs() : $this->execution->getByProject($this->session->project, 'all', 0, true);
$this->display();
}
@@ -445,16 +444,16 @@ class task extends control
/* The tasks of execution. */
if($executionID)
{
$execution = $this->project->getById($executionID);
$this->project->setMenu($this->project->getExecutionPairs($this->session->project), $execution->id);
$execution = $this->execution->getById($executionID);
$this->execution->setMenu($this->execution->getPairs($this->session->project), $execution->id);
/* Set modules and members. */
$showAllModule = isset($this->config->project->task->allModule) ? $this->config->project->task->allModule : '';
$showAllModule = isset($this->config->task->allModule) ? $this->config->task->allModule : '';
$modules = $this->tree->getTaskOptionMenu($executionID, 0, 0, $showAllModule ? 'allModule' : '');
$modules = array('ditto' => $this->lang->task->ditto) + $modules;
$this->view->title = $execution->name . $this->lang->colon . $this->lang->task->batchEdit;
$this->view->position[] = html::a($this->createLink('project', 'browse', "executionID=$execution->id"), $execution->name);
$this->view->position[] = html::a($this->createLink('execution', 'browse', "executionID=$execution->id"), $execution->name);
$this->view->execution = $execution;
$this->view->modules = $modules;
}
@@ -476,7 +475,7 @@ class task extends control
/* Get execution teams. */
$executionIDList = array();
foreach($tasks as $task) if(!in_array($task->project, $executionIDList)) $executionIDList[] = $task->project;
foreach($tasks as $task) if(!in_array($task->execution, $executionIDList)) $executionIDList[] = $task->execution;
$executionTeams = $this->dao->select('*')->from(TABLE_TEAM)->where('root')->in($executionIDList)->andWhere('type')->in('sprint,stage')->fetchGroup('root', 'account');
/* Judge whether the editedTasks is too large and set session. */
@@ -514,7 +513,7 @@ class task extends control
* @access public
* @return void
*/
public function assignTo($projectID, $taskID)
public function assignTo($executionID, $taskID)
{
$this->commonAction($taskID);
@@ -534,7 +533,7 @@ class task extends control
$task = $this->task->getByID($taskID);
$members = $this->project->getTeamMemberPairs($projectID, 'nodeleted');
$members = $this->execution->getTeamMemberPairs($executionID, 'nodeleted');
/* Compute next assignedTo. */
if(!empty($task->team))
@@ -546,7 +545,7 @@ class task extends control
if(!isset($members[$task->assignedTo])) $members[$task->assignedTo] = $task->assignedTo;
if(isset($members['closed']) or $task->status == 'closed') $members['closed'] = 'Closed';
$this->view->title = $this->view->project->name . $this->lang->colon . $this->lang->task->assign;
$this->view->title = $this->view->execution->name . $this->lang->colon . $this->lang->task->assign;
$this->view->position[] = $this->lang->task->assign;
$this->view->task = $task;
$this->view->members = $members;
@@ -584,11 +583,11 @@ class task extends control
/**
* Batch update assign of task.
*
* @param int $project
* @param int $execution
* @access public
* @return void
*/
public function batchAssignTo($project)
public function batchAssignTo($execution)
{
if(!empty($_POST))
{
@@ -596,7 +595,7 @@ class task extends control
$taskIDList = $this->post->taskIDList;
$taskIDList = array_unique($taskIDList);
unset($_POST['taskIDList']);
if(!is_array($taskIDList)) die(js::locate($this->createLink('project', 'task', "projectID=$project"), 'parent'));
if(!is_array($taskIDList)) die(js::locate($this->createLink('execution', 'task', "executionID=$execution"), 'parent'));
$taskIDList = array_unique($taskIDList);
$muletipleTasks = $this->dao->select('root , account')->from(TABLE_TEAM)->where('type')->eq('task')->andWhere('root')->in($taskIDList)->fetchGroup('root', 'account');
@@ -628,7 +627,7 @@ class task extends control
{
$task = $this->task->getById($taskID, true);
if(!$task) die(js::error($this->lang->notFound) . js::locate('back'));
$this->session->project = $task->PRJ;
$this->session->project = $task->project;
if($task->fromBug != 0)
{
@@ -655,19 +654,19 @@ class task extends control
if($task->assignedTo == $this->app->user->account) $this->loadModel('action')->read('task', $taskID);
/* Set menu. */
$project = $this->project->getById($task->project);
$this->project->setMenu($this->project->getExecutionPairs($this->session->project), $project->id);
$execution = $this->execution->getById($task->execution);
$this->execution->setMenu($this->execution->getPairs($this->session->project), $execution->id);
$this->executeHooks($taskID);
$title = "TASK#$task->id $task->name / $project->name";
$position[] = html::a($this->createLink('project', 'browse', "projectID=$task->project"), $project->name);
$title = "TASK#$task->id $task->name / $execution->name";
$position[] = html::a($this->createLink('execution', 'browse', "executionID=$task->execution"), $execution->name);
$position[] = $this->lang->task->common;
$position[] = $this->lang->task->view;
$this->view->title = $title;
$this->view->position = $position;
$this->view->project = $project;
$this->view->execution = $execution;
$this->view->task = $task;
$this->view->actions = $this->loadModel('action')->getList('task', $taskID);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
@@ -742,11 +741,11 @@ class task extends control
die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent'));
}
$this->view->title = $this->view->project->name . $this->lang->colon .$this->lang->task->start;
$this->view->title = $this->view->execution->name . $this->lang->colon .$this->lang->task->start;
$this->view->position[] = $this->lang->task->start;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->members = $this->execution->getTeamMemberPairs($task->project, 'nodeleted');
$this->view->members = $this->execution->getTeamMemberPairs($task->execution, 'nodeleted');
$this->view->assignedTo = $task->assignedTo == '' ? $this->app->user->account : $task->assignedTo;
$this->display();
}
@@ -905,7 +904,7 @@ class task extends control
}
$task = $this->view->task;
$members = $this->execution->getTeamMemberPairs($task->project, 'nodeleted');
$members = $this->execution->getTeamMemberPairs($task->execution, 'nodeleted');
$task->nextBy = $task->openedBy;
$this->view->users = $members;
@@ -927,7 +926,7 @@ class task extends control
}
}
$this->view->title = $this->view->project->name . $this->lang->colon .$this->lang->task->finish;
$this->view->title = $this->view->execution->name . $this->lang->colon .$this->lang->task->finish;
$this->view->position[] = $this->lang->task->finish;
$this->view->members = $members;
@@ -963,7 +962,7 @@ class task extends control
die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent'));
}
$this->view->title = $this->view->project->name . $this->lang->colon .$this->lang->task->pause;
$this->view->title = $this->view->execution->name . $this->lang->colon .$this->lang->task->pause;
$this->view->position[] = $this->lang->task->pause;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
@@ -1002,11 +1001,11 @@ class task extends control
die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent'));
}
$this->view->title = $this->view->project->name . $this->lang->colon .$this->lang->task->restart;
$this->view->title = $this->view->execution->name . $this->lang->colon .$this->lang->task->restart;
$this->view->position[] = $this->lang->task->restart;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->members = $this->execution->getTeamMemberPairs($task->project, 'nodeleted');
$this->view->members = $this->execution->getTeamMemberPairs($task->execution, 'nodeleted');
$this->view->assignedTo = $task->assignedTo == '' ? $this->app->user->account : $task->assignedTo;
$this->display();
}
@@ -1048,7 +1047,7 @@ class task extends control
}
}
$this->view->title = $this->view->project->name . $this->lang->colon .$this->lang->task->finish;
$this->view->title = $this->view->execution->name . $this->lang->colon .$this->lang->task->finish;
$this->view->position[] = $this->lang->task->finish;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
@@ -1171,7 +1170,7 @@ class task extends control
die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent'));
}
$this->view->title = $this->view->project->name . $this->lang->colon .$this->lang->task->cancel;
$this->view->title = $this->view->execution->name . $this->lang->colon .$this->lang->task->cancel;
$this->view->position[] = $this->lang->task->cancel;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
@@ -1208,7 +1207,7 @@ class task extends control
}
if(!isset($this->view->members[$this->view->task->finishedBy])) $this->view->members[$this->view->task->finishedBy] = $this->view->task->finishedBy;
$this->view->title = $this->view->project->name . $this->lang->colon . $this->lang->task->activate;
$this->view->title = $this->view->execution->name . $this->lang->colon . $this->lang->task->activate;
$this->view->position[] = $this->lang->task->activate;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->display();
@@ -1217,20 +1216,20 @@ class task extends control
/**
* Delete a task.
*
* @param int $projectID
* @param int $executionID
* @param int $taskID
* @param string $confirm yes|no
* @access public
* @return void
*/
public function delete($projectID, $taskID, $confirm = 'no')
public function delete($executionID, $taskID, $confirm = 'no')
{
$task = $this->task->getById($taskID);
if($task->parent < 0) die(js::alert($this->lang->task->cannotDeleteParent));
if($confirm == 'no')
{
die(js::confirm($this->lang->task->confirmDelete, inlink('delete', "projectID=$projectID&taskID=$taskID&confirm=yes")));
die(js::confirm($this->lang->task->confirmDelete, inlink('delete', "executionID=$executionID&taskID=$taskID&confirm=yes")));
}
else
{
@@ -1271,16 +1270,16 @@ class task extends control
}
/**
* AJAX: return project tasks in html select.
* AJAX: return execution tasks in html select.
*
* @param int $projectID
* @param int $executionID
* @param int $taskID
* @access public
* @return string
*/
public function ajaxGetProjectTasks($projectID, $taskID = 0)
public function ajaxGetExecutionTasks($executionID, $taskID = 0)
{
$tasks = $this->task->getProjectTaskPairs((int)$projectID);
$tasks = $this->task->getExecutionTaskPairs((int)$executionID);
die(html::select('task', empty($tasks) ? array('' => '') : $tasks, $taskID, "class='form-control'"));
}
@@ -1300,12 +1299,12 @@ class task extends control
/**
* The report page.
*
* @param int $projectID
* @param int $executionID
* @param string $browseType
* @access public
* @return void
*/
public function report($projectID, $browseType = 'all', $chartType = 'default')
public function report($executionID, $browseType = 'all', $chartType = 'default')
{
$this->loadModel('report');
$this->view->charts = array();
@@ -1324,14 +1323,14 @@ class task extends control
}
}
$projects = $this->project->getExecutionPairs($this->session->project);
$executions = $this->execution->getPairs($this->session->project);
$this->project->setMenu($projects, $projectID);
$this->projects = $projects;
$this->view->title = $this->projects[$projectID] . $this->lang->colon . $this->lang->task->report->common;
$this->view->position[] = $this->projects[$projectID];
$this->execution->setMenu($executions, $executionID);
$this->executions = $executions;
$this->view->title = $this->executions[$executionID] . $this->lang->colon . $this->lang->task->report->common;
$this->view->position[] = $this->executions[$executionID];
$this->view->position[] = $this->lang->task->report->common;
$this->view->projectID = $projectID;
$this->view->executionID = $executionID;
$this->view->browseType = $browseType;
$this->view->chartType = $chartType;
$this->view->checkedCharts = $this->post->charts ? join(',', $this->post->charts) : '';
@@ -1342,16 +1341,16 @@ class task extends control
/**
* get data to export
*
* @param int $projectID
* @param int $executionID
* @param string $orderBy
* @access public
* @return void
*/
public function export($projectID, $orderBy, $type)
public function export($executionID, $orderBy, $type)
{
$project = $this->project->getById($projectID);
$execution = $this->execution->getById($executionID);
$allExportFields = $this->config->task->exportFields;
if($project->type == 'ops') $allExportFields = str_replace(' story,', '', $allExportFields);
if($execution->type == 'ops') $allExportFields = str_replace(' story,', '', $allExportFields);
if($_POST)
{
@@ -1400,9 +1399,9 @@ class task extends control
while($row = $stmt->fetch()) $tasks[$row->id] = $row;
}
/* Get users and projects. */
$users = $this->loadModel('user')->getPairs('noletter');
$projects = $this->execution->getPairs($this->session->project, 'all', 'all|nocode');
/* Get users and executions. */
$users = $this->loadModel('user')->getPairs('noletter');
$executions = $this->execution->getPairs($this->session->execution, 'all', 'all|nocode');
/* Get related objects id lists. */
$relatedStoryIdList = array();
@@ -1466,7 +1465,7 @@ class task extends control
if($type == 'group')
{
$stories = $this->loadModel('story')->getProjectStories($projectID);
$stories = $this->loadModel('story')->getExecutionStories($executionID);
$groupTasks = array();
foreach($tasks as $task)
{
@@ -1525,7 +1524,7 @@ class task extends control
/* fill some field with useful value. */
$task->story = isset($relatedStories[$task->story]) ? $relatedStories[$task->story] . "(#$task->story)" : '';
if(isset($projects[$task->project])) $task->project = $projects[$task->project] . "(#$task->project)";
if(isset($executions[$task->execution])) $task->execution = $executions[$task->execution] . "(#$task->execution)";
if(isset($taskLang->typeList[$task->type])) $task->type = $taskLang->typeList[$task->type];
if(isset($taskLang->priList[$task->pri])) $task->pri = $taskLang->priList[$task->pri];
if(isset($taskLang->statusList[$task->status])) $task->status = $this->processStatus('task', $task);
@@ -1548,9 +1547,9 @@ class task extends control
$task->canceledDate = substr($task->canceledDate, 0, 10);
$task->closedDate = substr($task->closedDate, 0, 10);
$task->lastEditedDate = substr($task->lastEditedDate, 0, 10);
$task->estimate = $task->estimate . $this->lang->project->workHourUnit;
$task->consumed = $task->consumed . $this->lang->project->workHourUnit;
$task->left = $task->left . $this->lang->project->workHourUnit;
$task->estimate = $task->estimate . $this->lang->execution->workHourUnit;
$task->consumed = $task->consumed . $this->lang->execution->workHourUnit;
$task->left = $task->left . $this->lang->execution->workHourUnit;
/* Set related files. */
$task->files = '';
@@ -1571,24 +1570,24 @@ class task extends control
$this->fetch('file', 'export2' . $this->post->fileType, $_POST);
}
$this->app->loadLang('project');
$fileName = $this->lang->task->common;
$projectName = $this->dao->findById($projectID)->from(TABLE_PROJECT)->fetch('name');
if(isset($this->lang->project->featureBar['task'][$type]))
$this->app->loadLang('execution');
$fileName = $this->lang->task->common;
$executionName = $this->dao->findById($executionID)->from(TABLE_PROJECT)->fetch('name');
if(isset($this->lang->execution->featureBar['task'][$type]))
{
$browseType = $this->lang->project->featureBar['task'][$type];
$browseType = $this->lang->execution->featureBar['task'][$type];
}
else
{
$browseType = isset($this->lang->project->statusSelects[$type]) ? $this->lang->project->statusSelects[$type] : '';
$browseType = isset($this->lang->execution->statusSelects[$type]) ? $this->lang->execution->statusSelects[$type] : '';
}
$this->view->fileName = $projectName . $this->lang->dash . $browseType . $fileName;
$this->view->fileName = $executionName . $this->lang->dash . $browseType . $fileName;
$this->view->allExportFields = $allExportFields;
$this->view->customExport = true;
$this->view->orderBy = $orderBy;
$this->view->type = $type;
$this->view->projectID = $projectID;
$this->view->executionID = $executionID;
$this->display();
}