* Adjustment Code.
This commit is contained in:
@@ -28,66 +28,64 @@ class programplan extends control
|
||||
/**
|
||||
* Common action.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param int $productID
|
||||
* @param string $extra
|
||||
* @param int $projectID
|
||||
* @param int $productID
|
||||
* @param string $extra
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function commonAction($programID, $productID = 0, $extra = '')
|
||||
public function commonAction($projectID, $productID = 0, $extra = '')
|
||||
{
|
||||
$products = $this->loadModel('product')->getPairs('', $programID);
|
||||
$products = $this->loadModel('product')->getProductsByProject('', $projectID);
|
||||
$productID = $this->product->saveState($productID, $products);
|
||||
$this->product->setMenu($products, $productID, 0, 0, '', $extra);
|
||||
$this->productID = $productID;
|
||||
$this->programplan->setMenu($programID, $productID);
|
||||
$this->product->setMenu($products, $productID, 0, 0, '', $extra);
|
||||
$this->programplan->setMenu($projectID, $productID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Browse programplans.
|
||||
* Browse program plans.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param int $productID
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @param int $baselineID
|
||||
* @param int $projectID
|
||||
* @param int $productID
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @param int $baselineID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function browse($programID = 0, $productID = 0, $type = 'gantt', $orderBy = 'id_asc', $baselineID = 0)
|
||||
public function browse($projectID = 0, $productID = 0, $type = 'gantt', $orderBy = 'id_asc', $baselineID = 0)
|
||||
{
|
||||
$this->app->loadLang('stage');
|
||||
$this->commonAction($programID, $productID, $type);
|
||||
$this->commonAction($projectID, $productID, $type);
|
||||
$this->session->set('programPlanList', $this->app->getURI(true));
|
||||
|
||||
if(common::hasPriv('programplan', 'create')) $this->lang->TRActions = html::a($this->createLink('programplan', 'create', "programID=$programID"), "<i class='icon icon-sm icon-plus'></i> " . $this->lang->programplan->create, '', "class='btn btn-primary'");
|
||||
if(common::hasPriv('programplan', 'create')) $this->lang->TRActions = html::a($this->createLink('programplan', 'create', "projectID=$projectID"), "<i class='icon icon-sm icon-plus'></i> " . $this->lang->programplan->create, '', "class='btn btn-primary'");
|
||||
|
||||
$selectCustom = 0;
|
||||
$dateDetails = 1;
|
||||
$selectCustom = 0; // Display date and task settings.
|
||||
$dateDetails = 1; // Gantt chart detail date display.
|
||||
if($type == 'gantt')
|
||||
{
|
||||
$owner = $this->app->user->account;
|
||||
$module = 'programplan';
|
||||
$section = 'browse';
|
||||
$object = 'stageCustom';
|
||||
$setting = $this->loadModel('setting');
|
||||
$selectCustom = $setting->getItem("owner={$owner}&module={$module}§ion={$section}&key={$object}");
|
||||
|
||||
$selectCustom = $this->loadModel('setting')->getItem("owner={$owner}&module={$module}§ion={$section}&key={$object}");
|
||||
if(strpos($selectCustom, 'date') !== false) $dateDetails = 0;
|
||||
|
||||
$plans = $this->programplan->getDataForGantt($programID, $this->productID, $baselineID);
|
||||
$plans = $this->programplan->getDataForGantt($projectID, $this->productID, $baselineID);
|
||||
}
|
||||
|
||||
if($type == 'lists')
|
||||
{
|
||||
$sort = $this->loadModel('common')->appendOrder($orderBy);
|
||||
$this->loadModel('datatable');
|
||||
$plans = $this->programplan->getPlans($programID, $this->productID, $sort);
|
||||
$plans = $this->programplan->getPlans($projectID, $this->productID, $sort);
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->programplan->browse;
|
||||
$this->view->position[] = $this->lang->programplan->browse;
|
||||
$this->view->programID = $programID;
|
||||
$this->view->programID = $projectID;
|
||||
$this->view->productID = $this->productID;
|
||||
$this->view->type = $type;
|
||||
$this->view->plans = $plans;
|
||||
|
||||
@@ -16,12 +16,12 @@ class programplanModel extends model
|
||||
/**
|
||||
* Set menu.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param int $productID
|
||||
* @param int $projectID
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function setMenu($programID, $productID)
|
||||
public function setMenu($projectID, $productID)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -49,30 +49,28 @@ class programplanModel extends model
|
||||
*/
|
||||
public function getProjectsByProduct($productID)
|
||||
{
|
||||
$projects = $this->dao->select('project')->from(TABLE_PROJECTPRODUCT)->where('product')->eq($productID)->fetchPairs();
|
||||
|
||||
return $projects;
|
||||
return $this->dao->select('project')->from(TABLE_PROJECTPRODUCT)->where('product')->eq($productID)->fetchPairs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get plans list.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param int $productID
|
||||
* @param int $planID
|
||||
* @param string $browseType
|
||||
* @param string $orderBy
|
||||
* @param int $projectID
|
||||
* @param int $productID
|
||||
* @param int $planID
|
||||
* @param string $browseType
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getList($programID = 0, $productID = 0, $planID = 0, $browseType = 'all', $orderBy = 'id_asc')
|
||||
public function getStage($projectID = 0, $productID = 0, $planID = 0, $browseType = 'all', $orderBy = 'id_asc')
|
||||
{
|
||||
$projects = $this->getProjectsByProduct($productID);
|
||||
|
||||
$plans = $this->dao->select('*')->from(TABLE_PROJECT)
|
||||
->where('type')->eq('stage')
|
||||
->beginIF($browseType == 'all')->andWhere('project')->eq($programID)->fi()
|
||||
->beginIF($browseType == 'parent')->andWhere('parent')->eq($programID)->fi()
|
||||
->beginIF($browseType == 'all')->andWhere('project')->eq($projectID)->fi()
|
||||
->beginIF($browseType == 'parent')->andWhere('parent')->eq($projectID)->fi()
|
||||
->beginIF($browseType == 'children')->andWhere('parent')->eq($planID)->fi()
|
||||
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->sprints)->fi()
|
||||
->beginIF($productID)->andWhere('id')->in($projects)->fi()
|
||||
@@ -139,7 +137,7 @@ class programplanModel extends model
|
||||
*/
|
||||
public function getPlans($programID = 0, $productID = 0, $orderBy = 'id_asc')
|
||||
{
|
||||
$plans = $this->getList($programID, $productID, 0, 'all', $orderBy);
|
||||
$plans = $this->getStage($programID, $productID, 0, 'all', $orderBy);
|
||||
|
||||
$parents = array();
|
||||
$children = array();
|
||||
@@ -182,19 +180,19 @@ class programplanModel extends model
|
||||
/**
|
||||
* Get gantt data.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param int $productID
|
||||
* @param int $baselineID
|
||||
* @param string $selectCustom
|
||||
* @param bool $returnJson
|
||||
* @param int $projectID
|
||||
* @param int $productID
|
||||
* @param int $baselineID
|
||||
* @param string $selectCustom
|
||||
* @param bool $returnJson
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getDataForGantt($programID, $productID, $baselineID = 0, $selectCustom = '', $returnJson = true)
|
||||
public function getDataForGantt($projectID, $productID, $baselineID = 0, $selectCustom = '', $returnJson = true)
|
||||
{
|
||||
$this->loadModel('stage');
|
||||
|
||||
$plans = $this->getList($programID, $productID, 0, 'all');
|
||||
$plans = $this->getStage($projectID, $productID, 0, 'all');
|
||||
if($baselineID)
|
||||
{
|
||||
$baseline = $this->loadModel('cm')->getByID($baselineID);
|
||||
@@ -251,9 +249,8 @@ class programplanModel extends model
|
||||
$module = 'programplan';
|
||||
$section = 'browse';
|
||||
$object = 'stageCustom';
|
||||
$setting = $this->loadModel('setting');
|
||||
|
||||
if(empty($selectCustom)) $selectCustom = $setting->getItem("owner={$owner}&module={$module}§ion={$section}&key={$object}");
|
||||
if(empty($selectCustom)) $selectCustom = $this->loadModel('setting')->getItem("owner={$owner}&module={$module}§ion={$section}&key={$object}");
|
||||
|
||||
$tasks = array();
|
||||
if(strpos($selectCustom, 'task') !== false)
|
||||
@@ -333,7 +330,7 @@ class programplanModel extends model
|
||||
*/
|
||||
public function getTotalPercent($plan)
|
||||
{
|
||||
$plans = $this->getList($plan->project, $plan->product, $plan->parent, 'parent');
|
||||
$plans = $this->getStage($plan->project, $plan->product, $plan->parent, 'parent');
|
||||
|
||||
$totalPercent = 0;
|
||||
foreach($plans as $id => $stage)
|
||||
@@ -354,11 +351,7 @@ class programplanModel extends model
|
||||
*/
|
||||
public function processPlans($plans)
|
||||
{
|
||||
foreach($plans as $planID => $plan)
|
||||
{
|
||||
$plans[$planID] = $this->processPlan($plan);
|
||||
}
|
||||
|
||||
foreach($plans as $planID => $plan) $plans[$planID] = $this->processPlan($plan);
|
||||
return $plans;
|
||||
}
|
||||
|
||||
@@ -392,8 +385,8 @@ class programplanModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
$plan->begin = $plan->begin == '0000-00-00' ? '' : $plan->begin;
|
||||
$plan->end = $plan->end == '0000-00-00' ? '' : $plan->end;
|
||||
$plan->begin = $plan->begin == '0000-00-00' ? '' : $plan->begin;
|
||||
$plan->end = $plan->end == '0000-00-00' ? '' : $plan->end;
|
||||
$plan->realBegan = $plan->realBegan == '0000-00-00' ? '' : $plan->realBegan;
|
||||
$plan->realEnd = $plan->realEnd == '0000-00-00' ? '' : $plan->realEnd;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user