batchcreate.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. helper::importControl('task');
  3. class myTask extends task
  4. {
  5. /**
  6. * 批量创建任务。
  7. * Batch create tasks.
  8. *
  9. * @param int $executionID
  10. * @param int $storyID
  11. * @param int $moduleID
  12. * @param int $taskID
  13. * @param string $extra
  14. * @access public
  15. * @return void
  16. */
  17. public function batchCreate($executionID = 0, $storyID = 0, $moduleID = 0, $taskID = 0, $extra = '')
  18. {
  19. $executions = $this->execution->getPairs();
  20. if(empty($executions))
  21. {
  22. echo(js::alert($this->lang->task->kanbanDenied));
  23. die(js::locate(helper::createLink('execution', 'create')));
  24. }
  25. $regionList = $this->loadModel('kanban')->getRegionPairs($executionID, 0, 'execution');
  26. /* Filter Kanban without Lane. */
  27. $lanes = $this->kanban->getLaneGroupByRegion(array_keys($regionList), 'task');
  28. foreach($regionList as $key => $region)
  29. {
  30. if(!isset($lanes[$key])) unset($regionList[$key]);
  31. }
  32. $this->view->regionList = $regionList;
  33. $this->view->extra = $extra;
  34. $extra = str_replace(array(',', ' '), array('&', ''), $extra);
  35. parse_str($extra, $output);
  36. $lanes = array();
  37. if(isset($output['laneID']))
  38. {
  39. $regionID = $this->dao->select("*")->from(TABLE_KANBANLANE)->where('id')->eq($output['laneID'])->fetch('region');
  40. $lanes = $this->kanban->getLanePairsByRegion($regionID, 'task');
  41. $this->view->regionID = $regionID;
  42. }
  43. $this->config->execution->task->allModule = 1;
  44. $this->view->lanes = $lanes;
  45. if(!empty($_POST))
  46. {
  47. $laneIDList = $_POST['lane'];
  48. foreach($laneIDList as $key => $lane)
  49. {
  50. $_POST['column'][$key] = $this->dao->select("t1.id")->from(TABLE_KANBANCOLUMN)->alias('t1')
  51. ->leftJoin(TABLE_KANBANLANE)->alias('t2')
  52. ->on("t2.group = t1.group")
  53. ->where('t1.deleted')->eq('0')
  54. ->andWhere('t2.id')->eq($lane)
  55. ->andWhere('t1.type')->eq('wait')
  56. ->fetch('id');
  57. }
  58. }
  59. return parent::batchCreate($executionID, $storyID, $moduleID, $taskID, $extra);
  60. }
  61. }