diff --git a/module/block/control.php b/module/block/control.php index 88798f641c..16cd14f38d 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -1114,7 +1114,13 @@ class block extends control */ public function printCmmiGanttBlock() { - $this->view->program = $this->loadModel('project')->getByID($this->session->program); + $products = $this->loadModel('product')->getPairs(); + $productID = isset($this->session->product) ? 0 : $this->session->product; + if($productID && !array_key_exists($productID, $products)) $productID = 0; + + $this->view->plans = $this->loadModel('programplan')->getDataForGantt($this->session->program, $productID); + $this->view->products = $products; + $this->view->productID = $productID; } /** @@ -1192,7 +1198,7 @@ class block extends control $start = $begin; $longProgram = helper::diffDate($today, $begin) / 7 > 10; while($start < $end) - { + { $charts['labels'][] = $longProgram ? $this->lang->milestone->chart->time . $i . $this->lang->milestone->chart->month : $this->lang->milestone->chart->time . $i . $this->lang->milestone->chart->week; $stageEnd = $longProgram ? date('Y-m-t', strtotime($start)) : $this->weekly->getThisSunday($start); $charts['PV'] .= $this->milestone->getPV($projectIdList, $begin, $stageEnd) . ','; diff --git a/module/block/view/cmmiganttblock.html.php b/module/block/view/cmmiganttblock.html.php index e69de29bb2..246b32c478 100644 --- a/module/block/view/cmmiganttblock.html.php +++ b/module/block/view/cmmiganttblock.html.php @@ -0,0 +1,167 @@ +
+
+ +
+
+
+
+
+
+
+ + +
diff --git a/module/product/control.php b/module/product/control.php index 87cd3d9be2..5a1f5d200d 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -622,9 +622,9 @@ class product extends control /** * Ajax set unfoldID. - * - * @param int $productID - * @param string $action + * + * @param int $productID + * @param string $action * @access public * @return void */ @@ -834,4 +834,17 @@ class product extends control $this->display(); } + + /** + * Set product id to session in ajax + * + * @param int $productID + * @access public + * @return void + */ + public function ajaxSetState($productID) + { + $this->session->set('product', (int)$productID); + $this->send(array('result' => 'success', 'productID' => $this->session->product)); + } } diff --git a/module/programplan/lang/zh-cn.php b/module/programplan/lang/zh-cn.php index 05cdc6527b..8bb0677439 100644 --- a/module/programplan/lang/zh-cn.php +++ b/module/programplan/lang/zh-cn.php @@ -14,9 +14,11 @@ $lang->programplan->emptyParent = '无'; $lang->programplan->name = '名称'; $lang->programplan->percent = '计划工作量'; $lang->programplan->percentAB = '计划工作量'; +$lang->programplan->planPercent = '工作量'; $lang->programplan->attribute = '阶段'; $lang->programplan->milestone = '里程碑'; $lang->programplan->taskProgress = '任务进度'; +$lang->programplan->task = '任务'; $lang->programplan->begin = '计划开始'; $lang->programplan->end = '计划完成'; $lang->programplan->realStarted = '实际开始'; diff --git a/module/programplan/model.php b/module/programplan/model.php index c9a2ed9f6b..4eb96fe7b4 100644 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -133,6 +133,7 @@ class programplanModel extends model $data = new stdclass(); $data->id = $plan->id; + $data->type = 'plan'; $data->text = empty($plan->milestone) ? $plan->name : $isMilestone . $plan->name; $data->percent = $plan->percent; $data->attribute = zget($this->lang->stage->typeList, $plan->attribute); @@ -141,7 +142,7 @@ class programplanModel extends model $data->deadline = $end; $data->realStarted = $plan->realStarted == '0000-00-00' ? '' : $plan->realStarted; $data->realFinished = $plan->realFinished == '0000-00-00' ? '' : $plan->realFinished; - $data->duration = helper::diffDate($plan->end, $plan->begin) + 1;; + $data->duration = helper::diffDate($plan->end, $plan->begin) + 1;; $data->parent = $plan->parent; $data->open = true; @@ -192,6 +193,7 @@ class programplanModel extends model $data = new stdclass(); $data->id = $task->project . '-' . $task->id; + $data->type = 'task'; $data->text = $taskSign . $priIcon . $task->name; $data->percent = ''; $data->attribute = ''; @@ -287,7 +289,7 @@ class programplanModel extends model return $plan; } - + public function getDuration($begin, $end) { $duration = $this->loadModel('holiday')->getActualWorkingDays($begin, $end);