task.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * 通过传入的对象ID设置任务信息。
  4. * Set task through the input object ID.
  5. *
  6. * @param int $storyID
  7. * @param int $moduleID
  8. * @param int $taskID
  9. * @param int $todoID
  10. * @param int $bugID
  11. * @param array $output
  12. * @access public
  13. * @return object
  14. */
  15. public function setTaskByObjectID($storyID, $moduleID, $taskID, $todoID, $bugID, $output = array())
  16. {
  17. if(!isset($output['feedbackID'])) return parent::setTaskByObjectID($storyID, $moduleID, $taskID, $todoID, $bugID, $output);
  18. $this->loadModel('feedback');
  19. $feedbackID = $output['feedbackID'];
  20. $feedback = $this->feedback->getById($feedbackID);
  21. $actions = $this->loadModel('action')->getList('feedback', $feedbackID);
  22. foreach($actions as $action)
  23. {
  24. if($action->action == 'reviewed' and $action->comment)
  25. {
  26. $feedback->desc .= $feedback->desc ? '<br/>' . $this->lang->feedback->reviewOpinion . ':' . $action->comment : $this->lang->feedback->reviewOpinion . ':' . $action->comment;
  27. }
  28. }
  29. /* Init vars. */
  30. $task = $this->config->task->create->template;
  31. $task->module = $moduleID ? $moduleID : (int)$this->cookie->lastTaskModule;
  32. $task->name = $feedback->title;
  33. $task->desc = $feedback->desc;
  34. /* Set Menu. */
  35. $this->feedback->setMenu($feedback->product);
  36. $this->lang->feedback->menu->browse['subModule'] = 'task';
  37. $this->view->feedbackID = $feedbackID;
  38. return $task;
  39. }
  40. /**
  41. * 处理创建后选择跳转的返回信息。
  42. * Process the return information for selecting a jump after creation.
  43. *
  44. * @param object $task
  45. * @param int $executionID
  46. * @param string $afterChoose continueAdding|toTaskList|toStoryList
  47. * @param array $response
  48. * @access public
  49. * @return array
  50. */
  51. public function generalCreateResponse($task, $executionID, $afterChoose, $response = array())
  52. {
  53. $feedbackID = $this->post->feedback;
  54. if(empty($feedbackID)) return parent::generalCreateResponse($task, $executionID, $afterChoose, $response);
  55. return array('result' => 'success', 'message' => !empty($response['message']) ? $response['message'] : $this->lang->saveSuccess, 'load' => $this->createLink('feedback', 'adminView', "feedbackID=$feedbackID"));
  56. }