* pivot: move methods from control to zen.

This commit is contained in:
liugang
2023-10-24 10:57:08 +08:00
parent f515f62fba
commit e05ea84da4
2 changed files with 156 additions and 156 deletions
-156
View File
@@ -89,162 +89,6 @@ class pivot extends control
$this->display();
}
/**
* Project deviation pivot.
*
* @access public
* @return void
*/
public function projectDeviation($begin = 0, $end = 0)
{
$this->session->set('executionList', $this->app->getURI(true), 'execution');
$begin = date('Y-m-d', ($begin ? strtotime($begin) : time() - (date('j') - 1) * 24 * 3600));
$end = date('Y-m-d', ($end ? strtotime($end) : time() + (date('t') - date('j')) * 24 * 3600));
$this->view->title = $this->lang->pivot->projectDeviation;
$this->view->executions = $this->pivot->getExecutions($begin, $end);
$this->view->begin = $begin;
$this->view->end = $end;
$this->view->submenu = 'project';
$this->display();
}
/**
* Product information pivot.
*
* @params string $conditions
* @access public
* @return void
*/
public function productSummary($conditions = '')
{
$this->app->loadLang('story');
$this->app->loadLang('product');
$this->app->loadLang('productplan');
$this->session->set('productList', $this->app->getURI(true), 'product');
$this->view->title = $this->lang->pivot->productSummary;
$this->view->products = $this->pivot->getProducts($conditions);
$this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed');
$this->view->submenu = 'product';
$this->view->conditions = $conditions;
$this->display();
}
/**
* Bug create pivot.
*
* @param int $begin
* @param int $end
* @param int $product
* @param int $execution
* @access public
* @return void
*/
public function bugCreate($begin = 0, $end = 0, $product = 0, $execution = 0)
{
$this->app->loadLang('bug');
$begin = $begin == 0 ? date('Y-m-d', strtotime('last month', strtotime(date('Y-m',time()) . '-01 00:00:01'))) : date('Y-m-d', strtotime($begin));
$end = $end == 0 ? date('Y-m-d', strtotime('now')) : $end = date('Y-m-d', strtotime($end));
$this->view->title = $this->lang->pivot->bugCreate;
$this->view->begin = $begin;
$this->view->end = $end;
$this->view->bugs = $this->pivot->getBugs($begin, $end, $product, $execution);
$this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed');
$this->view->executions = $this->pivot->getProjectExecutions();
$this->view->products = $this->loadModel('product')->getPairs('', 0, '', 'all');
$this->view->execution = $execution;
$this->view->product = $product;
$this->view->submenu = 'test';
$this->display();
}
/**
* Bug assign pivot.
*
* @access public
* @return void
*/
public function bugAssign()
{
$this->session->set('productList', $this->app->getURI(true), 'product');
$this->view->title = $this->lang->pivot->bugAssign;
$this->view->submenu = 'test';
$this->view->assigns = $this->pivot->getBugAssign();
$this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed');
$this->display();
}
/**
* Workload pivot.
*
* @param string $begin
* @param string $end
* @param int $days
* @param int $workday
* @param int $dept
* @param int $assign
*
* @access public
* @return void
*/
public function workload($begin = '', $end = '', $days = 0, $workday = 0, $dept = 0, $assign = 'assign')
{
if($_POST)
{
$data = fixer::input('post')->get();
$begin = $data->begin;
$end = $data->end;
$dept = $data->dept;
$days = $data->days;
$assign = $data->assign;
$workday = $data->workday;
}
$this->app->loadConfig('execution');
$this->session->set('executionList', $this->app->getURI(true), 'execution');
$begin = $begin ? strtotime($begin) : time();
$end = $end ? strtotime($end) : time() + (7 * 24 * 3600);
$end += 24 * 3600;
$beginWeekDay = date('w', $begin);
$begin = date('Y-m-d', $begin);
$end = date('Y-m-d', $end);
if(empty($workday))$workday = $this->config->execution->defaultWorkhours;
$diffDays = helper::diffDate($end, $begin);
if($days > $diffDays) $days = $diffDays;
if(empty($days))
{
$weekDay = $beginWeekDay;
$days = $diffDays;
for($i = 0; $i < $diffDays; $i++,$weekDay++)
{
$weekDay = $weekDay % 7;
if(($this->config->execution->weekend == 2 and $weekDay == 6) or $weekDay == 0) $days --;
}
}
$this->view->title = $this->lang->pivot->workload;
$this->view->workload = $this->pivot->getWorkload($dept, $assign);
$this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed');
$this->view->depts = $this->loadModel('dept')->getOptionMenu();
$this->view->begin = $begin;
$this->view->end = date('Y-m-d', strtotime($end) - 24 * 3600);
$this->view->days = $days;
$this->view->workday = $workday;
$this->view->dept = $dept;
$this->view->assign = $assign;
$this->view->allHour = $days * $workday;
$this->view->submenu = 'staff';
$this->display();
}
/**
* Ajax get sys options.
*
+156
View File
@@ -276,4 +276,160 @@ class pivotZen extends pivot
return $sidebar;
}
/**
* Bug create pivot.
*
* @param int $begin
* @param int $end
* @param int $product
* @param int $execution
* @access public
* @return void
*/
public function bugCreate($begin = 0, $end = 0, $product = 0, $execution = 0)
{
$this->app->loadLang('bug');
$begin = $begin == 0 ? date('Y-m-d', strtotime('last month', strtotime(date('Y-m',time()) . '-01 00:00:01'))) : date('Y-m-d', strtotime($begin));
$end = $end == 0 ? date('Y-m-d', strtotime('now')) : $end = date('Y-m-d', strtotime($end));
$this->view->title = $this->lang->pivot->bugCreate;
$this->view->begin = $begin;
$this->view->end = $end;
$this->view->bugs = $this->pivot->getBugs($begin, $end, $product, $execution);
$this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed');
$this->view->executions = $this->pivot->getProjectExecutions();
$this->view->products = $this->loadModel('product')->getPairs('', 0, '', 'all');
$this->view->execution = $execution;
$this->view->product = $product;
$this->view->submenu = 'test';
$this->display();
}
/**
* Bug assign pivot.
*
* @access public
* @return void
*/
public function bugAssign()
{
$this->session->set('productList', $this->app->getURI(true), 'product');
$this->view->title = $this->lang->pivot->bugAssign;
$this->view->submenu = 'test';
$this->view->assigns = $this->pivot->getBugAssign();
$this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed');
$this->display();
}
/**
* Product information pivot.
*
* @params string $conditions
* @access public
* @return void
*/
public function productSummary($conditions = '')
{
$this->app->loadLang('story');
$this->app->loadLang('product');
$this->app->loadLang('productplan');
$this->session->set('productList', $this->app->getURI(true), 'product');
$this->view->title = $this->lang->pivot->productSummary;
$this->view->products = $this->pivot->getProducts($conditions);
$this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed');
$this->view->submenu = 'product';
$this->view->conditions = $conditions;
$this->display();
}
/**
* Project deviation pivot.
*
* @access public
* @return void
*/
public function projectDeviation($begin = 0, $end = 0)
{
$this->session->set('executionList', $this->app->getURI(true), 'execution');
$begin = date('Y-m-d', ($begin ? strtotime($begin) : time() - (date('j') - 1) * 24 * 3600));
$end = date('Y-m-d', ($end ? strtotime($end) : time() + (date('t') - date('j')) * 24 * 3600));
$this->view->title = $this->lang->pivot->projectDeviation;
$this->view->executions = $this->pivot->getExecutions($begin, $end);
$this->view->begin = $begin;
$this->view->end = $end;
$this->view->submenu = 'project';
$this->display();
}
/**
* Workload pivot.
*
* @param string $begin
* @param string $end
* @param int $days
* @param int $workday
* @param int $dept
* @param int $assign
*
* @access public
* @return void
*/
public function workload($begin = '', $end = '', $days = 0, $workday = 0, $dept = 0, $assign = 'assign')
{
if($_POST)
{
$data = fixer::input('post')->get();
$begin = $data->begin;
$end = $data->end;
$dept = $data->dept;
$days = $data->days;
$assign = $data->assign;
$workday = $data->workday;
}
$this->app->loadConfig('execution');
$this->session->set('executionList', $this->app->getURI(true), 'execution');
$begin = $begin ? strtotime($begin) : time();
$end = $end ? strtotime($end) : time() + (7 * 24 * 3600);
$end += 24 * 3600;
$beginWeekDay = date('w', $begin);
$begin = date('Y-m-d', $begin);
$end = date('Y-m-d', $end);
if(empty($workday))$workday = $this->config->execution->defaultWorkhours;
$diffDays = helper::diffDate($end, $begin);
if($days > $diffDays) $days = $diffDays;
if(empty($days))
{
$weekDay = $beginWeekDay;
$days = $diffDays;
for($i = 0; $i < $diffDays; $i++,$weekDay++)
{
$weekDay = $weekDay % 7;
if(($this->config->execution->weekend == 2 and $weekDay == 6) or $weekDay == 0) $days --;
}
}
$this->view->title = $this->lang->pivot->workload;
$this->view->workload = $this->pivot->getWorkload($dept, $assign);
$this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed');
$this->view->depts = $this->loadModel('dept')->getOptionMenu();
$this->view->begin = $begin;
$this->view->end = date('Y-m-d', strtotime($end) - 24 * 3600);
$this->view->days = $days;
$this->view->workday = $workday;
$this->view->dept = $dept;
$this->view->assign = $assign;
$this->view->allHour = $days * $workday;
$this->view->submenu = 'staff';
$this->display();
}
}