Merge branch 'master' of github.com:easysoft/zentaopms
This commit is contained in:
@@ -464,6 +464,7 @@ class block extends control
|
||||
if($id) $block = $this->block->getByID($id);
|
||||
$this->view->longBlock = $this->block->isLongBlock($id ? $block : $params);
|
||||
$this->view->selfCall = $this->selfCall;
|
||||
$this->view->block = $id ? $block : '';
|
||||
|
||||
$this->viewType = (isset($params->viewType) and $params->viewType == 'json') ? 'json' : 'html';
|
||||
$this->params = $params;
|
||||
@@ -556,7 +557,9 @@ class block extends control
|
||||
$this->session->set('taskList', $uri);
|
||||
$this->session->set('storyList', $uri);
|
||||
if(preg_match('/[^a-zA-Z0-9_]/', $this->params->type)) die();
|
||||
$this->view->tasks = $this->loadModel('task')->getUserTasks($this->app->user->account, $this->params->type, $this->viewType == 'json' ? 0 : (int)$this->params->num, null, $this->params->orderBy);
|
||||
|
||||
$programID = $this->view->block->module == 'my' ? 0 : (int)$this->session->program;
|
||||
$this->view->tasks = $this->loadModel('task')->getUserTasks($this->app->user->account, $this->params->type, $this->viewType == 'json' ? 0 : (int)$this->params->num, null, $this->params->orderBy, $programID);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -569,7 +572,9 @@ class block extends control
|
||||
{
|
||||
$this->session->set('bugList', $this->app->getURI(true));
|
||||
if(preg_match('/[^a-zA-Z0-9_]/', $this->params->type)) die();
|
||||
$this->view->bugs = $this->loadModel('bug')->getUserBugs($this->app->user->account, $this->params->type, $this->params->orderBy, $this->viewType == 'json' ? 0 : (int)$this->params->num);
|
||||
|
||||
$programID = $this->view->block->module == 'my' ? 0 : (int)$this->session->program;
|
||||
$this->view->bugs = $this->loadModel('bug')->getUserBugs($this->app->user->account, $this->params->type, $this->params->orderBy, $this->viewType == 'json' ? 0 : (int)$this->params->num, null, $programID);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -595,6 +600,7 @@ class block extends control
|
||||
->andWhere('t3.status')->ne('done')
|
||||
->andWhere('t3.deleted')->eq(0)
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
->beginIF($this->view->block->module != 'my' and $this->session->program)->andWhere('t2.program')->eq((int)$this->session->program)->fi()
|
||||
->orderBy($this->params->orderBy)
|
||||
->beginIF($this->viewType != 'json')->limit((int)$this->params->num)->fi()
|
||||
->fetchAll();
|
||||
@@ -603,6 +609,7 @@ class block extends control
|
||||
{
|
||||
$cases = $this->dao->findByOpenedBy($this->app->user->account)->from(TABLE_CASE)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->beginIF($this->view->block->module != 'my' and $this->session->program)->andWhere('program')->eq((int)$this->session->program)->fi()
|
||||
->orderBy($this->params->orderBy)
|
||||
->beginIF($this->viewType != 'json')->limit((int)$this->params->num)->fi()
|
||||
->fetchAll();
|
||||
@@ -627,6 +634,7 @@ class block extends control
|
||||
->leftJoin(TABLE_PROJECT)->alias('t4')->on('t1.project=t4.id')
|
||||
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t5')->on('t1.project=t5.project')
|
||||
->where('t1.deleted')->eq('0')
|
||||
->beginIF($this->view->block->module != 'my' and $this->session->program)->andWhere('t1.program')->eq((int)$this->session->program)->fi()
|
||||
->beginIF(!$this->app->user->admin)->andWhere('t1.product')->in($this->app->user->view->products)->fi()
|
||||
->andWhere('t1.product = t5.product')
|
||||
->beginIF($this->params->type != 'all')->andWhere('t1.status')->eq($this->params->type)->fi()
|
||||
@@ -650,7 +658,9 @@ class block extends control
|
||||
$pager = pager::init(0, $num , 1);
|
||||
$type = isset($this->params->type) ? $this->params->type : 'assignedTo';
|
||||
$orderBy = isset($this->params->type) ? $this->params->orderBy : 'id_asc';
|
||||
$this->view->stories = $this->loadModel('story')->getUserStories($this->app->user->account, $type, $orderBy, $this->viewType != 'json' ? $pager : '');
|
||||
|
||||
$programID = $this->view->block->module == 'my' ? 0 : (int)$this->session->program;
|
||||
$this->view->stories = $this->loadModel('story')->getUserStories($this->app->user->account, $type, $orderBy, $this->viewType != 'json' ? $pager : '', 'story', $programID);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -666,6 +676,7 @@ class block extends control
|
||||
$this->view->plans = $this->dao->select('t1.*,t2.name as productName')->from(TABLE_PRODUCTPLAN)->alias('t1')
|
||||
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')
|
||||
->where('t1.deleted')->eq('0')
|
||||
->beginIF($this->view->block->module != 'my' and $this->session->program)->andWhere('t2.program')->eq((int)$this->session->program)->fi()
|
||||
->beginIF(!$this->app->user->admin)->andWhere('t1.product')->in($this->app->user->view->products)->fi()
|
||||
->orderBy('t1.begin desc')
|
||||
->beginIF($this->viewType != 'json')->limit((int)$this->params->num)->fi()
|
||||
@@ -686,6 +697,7 @@ class block extends control
|
||||
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')
|
||||
->leftJoin(TABLE_BUILD)->alias('t3')->on('t1.build=t3.id')
|
||||
->where('t1.deleted')->eq('0')
|
||||
->beginIF($this->view->block->module != 'my' and $this->session->program)->andWhere('t1.program')->eq((int)$this->session->program)->fi()
|
||||
->beginIF(!$this->app->user->admin)->andWhere('t1.product')->in($this->app->user->view->products)->fi()
|
||||
->orderBy('t1.id desc')
|
||||
->beginIF($this->viewType != 'json')->limit((int)$this->params->num)->fi()
|
||||
@@ -706,6 +718,7 @@ class block extends control
|
||||
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')
|
||||
->where('t1.deleted')->eq('0')
|
||||
->beginIF(!$this->app->user->admin)->andWhere('t1.project')->in($this->app->user->view->projects)->fi()
|
||||
->beginIF($this->view->block->module != 'my' and $this->session->program)->andWhere('t1.program')->eq((int)$this->session->program)->fi()
|
||||
->orderBy('t1.id desc')
|
||||
->beginIF($this->viewType != 'json')->limit((int)$this->params->num)->fi()
|
||||
->fetchAll();
|
||||
@@ -973,7 +986,8 @@ class block extends control
|
||||
$num = isset($this->params->num) ? (int)$this->params->num : 0;
|
||||
|
||||
/* Get projects. */
|
||||
$projects = $this->loadModel('project')->getOrderedProjects($status, $num);
|
||||
$programID = $this->view->block->module == 'my' ? 0 : (int)$this->session->program;
|
||||
$projects = $this->loadModel('project')->getOrderedProjects($status, $num, $programID);
|
||||
if(empty($projects))
|
||||
{
|
||||
$this->view->projects = $projects;
|
||||
@@ -1484,7 +1498,8 @@ class block extends control
|
||||
*/
|
||||
public function printProjectOverviewBlock()
|
||||
{
|
||||
$projects = $this->loadModel('project')->getList();
|
||||
$programID = $this->view->block->module == 'my' ? 0 : (int)$this->session->program;
|
||||
$projects = $this->loadModel('project')->getList('all', 0, 0, 0, $programID);
|
||||
|
||||
$total = 0;
|
||||
foreach($projects as $project)
|
||||
@@ -1514,8 +1529,13 @@ class block extends control
|
||||
*/
|
||||
public function printQaOverviewBlock()
|
||||
{
|
||||
$casePairs = $this->dao->select('lastRunResult, COUNT(*) AS count')->from(TABLE_CASE)->groupBy('lastRunResult')->fetchPairs();
|
||||
$total = array_sum($casePairs);
|
||||
$casePairs = $this->dao->select('lastRunResult, COUNT(*) AS count')->from(TABLE_CASE)
|
||||
->where('1=1')
|
||||
->beginIF($this->view->block->module != 'my' and $this->session->program)->andWhere('program')->eq((int)$this->session->program)->fi()
|
||||
->groupBy('lastRunResult')
|
||||
->fetchPairs();
|
||||
|
||||
$total = array_sum($casePairs);
|
||||
|
||||
$this->app->loadLang('testcase');
|
||||
foreach($this->lang->testcase->resultList as $result => $label)
|
||||
@@ -1547,7 +1567,9 @@ class block extends control
|
||||
$num = isset($this->params->num) ? (int)$this->params->num : 0;
|
||||
$type = isset($this->params->type) ? $this->params->type : 'all';
|
||||
$pager = pager::init(0, $num, 1);
|
||||
$this->view->projectStats = $this->loadModel('project')->getProjectStats($type, $productID = 0, $branch = 0, $itemCounts = 30, $orderBy = 'order_desc', $this->viewType != 'json' ? $pager : '');
|
||||
|
||||
$programID = $this->view->block->module == 'my' ? 0 : (int)$this->session->program;
|
||||
$this->view->projectStats = $this->loadModel('project')->getProjectStats($type, $productID = 0, $branch = 0, $itemCounts = 30, $orderBy = 'order_desc', $this->viewType != 'json' ? $pager : '', $programID);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1356,11 +1356,12 @@ class bugModel extends model
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getUserBugs($account, $type = 'assignedTo', $orderBy = 'id_desc', $limit = 0, $pager = null)
|
||||
public function getUserBugs($account, $type = 'assignedTo', $orderBy = 'id_desc', $limit = 0, $pager = null, $programID = 0)
|
||||
{
|
||||
if(!$this->loadModel('common')->checkField(TABLE_BUG, $type)) return array();
|
||||
$bugs = $this->dao->select('*')->from(TABLE_BUG)
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF($programID)->andWhere('program')->eq($programID)->fi()
|
||||
->beginIF(!$this->app->user->admin)->andWhere('project')->in('0,' . $this->app->user->view->projects)->fi()
|
||||
->beginIF($type != 'closedBy' and $this->app->moduleName == 'block')->andWhere('status')->ne('closed')->fi()
|
||||
->beginIF($type != 'all')->andWhere("`$type`")->eq($account)->fi()
|
||||
|
||||
@@ -1204,12 +1204,13 @@ class projectModel extends model
|
||||
*
|
||||
* @param string $status
|
||||
* @param int $num
|
||||
* @param int $programID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getOrderedProjects($status, $num = 0)
|
||||
public function getOrderedProjects($status, $num = 0, $programID = 0)
|
||||
{
|
||||
$projectList = $this->getList($status);
|
||||
$projectList = $this->getList($status, 0, 0, 0, $programID);
|
||||
if(empty($projectList)) return $projectList;
|
||||
|
||||
$projects = $mineProjects = $otherProjects = $closedProjects = array();
|
||||
|
||||
+20
-20
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/* Actions */
|
||||
$lang->risk->batchCreate = 'Batch Add';
|
||||
$lang->risk->create = 'Add Risk';
|
||||
$lang->risk->batchCreate = 'Batch Create';
|
||||
$lang->risk->create = 'Create Risk';
|
||||
$lang->risk->edit = 'Edit Risk';
|
||||
$lang->risk->browse = 'List';
|
||||
$lang->risk->browse = 'Risks';
|
||||
$lang->risk->view = 'Details';
|
||||
$lang->risk->activate = 'Active';
|
||||
$lang->risk->hangup = 'Suspend';
|
||||
@@ -28,29 +28,29 @@ $lang->risk->riskindex = 'Risk Index';
|
||||
$lang->risk->pri = 'Priority';
|
||||
$lang->risk->prevention = 'Mitigation';
|
||||
$lang->risk->remedy = 'Contingency';
|
||||
$lang->risk->identifiedDate = 'Identified Date';
|
||||
$lang->risk->plannedClosedDate = 'Closed Date';
|
||||
$lang->risk->identifiedDate = 'Identified';
|
||||
$lang->risk->plannedClosedDate = 'Deadline';
|
||||
$lang->risk->assignedTo = 'AssignedTo';
|
||||
$lang->risk->assignedDate = 'Assigned Date';
|
||||
$lang->risk->createdBy = 'Added By';
|
||||
$lang->risk->createdDate = 'Added Date';
|
||||
$lang->risk->assignedDate = 'AssignedDate';
|
||||
$lang->risk->createdBy = 'CreatedBy';
|
||||
$lang->risk->createdDate = 'CreatedDate';
|
||||
$lang->risk->noAssigned = 'Unassigned';
|
||||
$lang->risk->cancelBy = 'Canceled By';
|
||||
$lang->risk->cancelDate = 'Canceled Date';
|
||||
$lang->risk->cancelBy = 'CanceledBy';
|
||||
$lang->risk->cancelDate = 'CanceledDate';
|
||||
$lang->risk->cancelReason = 'Cancel Reason';
|
||||
$lang->risk->resolvedBy = 'Resolved By';
|
||||
$lang->risk->closedDate = 'Closed Date';
|
||||
$lang->risk->resolvedBy = 'ResolvedBy';
|
||||
$lang->risk->closedDate = 'ClosedDate';
|
||||
$lang->risk->actualClosedDate = 'Closed Date';
|
||||
$lang->risk->resolution = 'Resolution';
|
||||
$lang->risk->hangupBy = 'Suspended By';
|
||||
$lang->risk->hangupDate = 'Suspended Date';
|
||||
$lang->risk->activateBy = 'Activated By';
|
||||
$lang->risk->activateDate = 'Activated Date';
|
||||
$lang->risk->hangupBy = 'SuspendedBy';
|
||||
$lang->risk->hangupDate = 'SuspendedDate';
|
||||
$lang->risk->activateBy = 'ActivatedBy';
|
||||
$lang->risk->activateDate = 'ActivatedDate';
|
||||
$lang->risk->isChange = 'Any change?';
|
||||
$lang->risk->trackedBy = 'Tracked By';
|
||||
$lang->risk->trackedDate = 'Tracked Date';
|
||||
$lang->risk->editedBy = 'Edited By';
|
||||
$lang->risk->editedDate = 'Edited By';
|
||||
$lang->risk->trackedBy = 'TrackedBy';
|
||||
$lang->risk->trackedDate = 'TrackedDate';
|
||||
$lang->risk->editedBy = 'EditedBy';
|
||||
$lang->risk->editedDate = 'EditedDate';
|
||||
|
||||
$lang->risk->legendBasicInfo = 'Basic Info.';
|
||||
$lang->risk->legendLifeTime = 'About Risk';
|
||||
|
||||
@@ -2228,15 +2228,17 @@ class storyModel extends model
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @param string $storyType requirement|story
|
||||
* @param int $programID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getUserStories($account, $type = 'assignedTo', $orderBy = 'id_desc', $pager = null, $storyType = 'story')
|
||||
public function getUserStories($account, $type = 'assignedTo', $orderBy = 'id_desc', $pager = null, $storyType = 'story', $programID = 0)
|
||||
{
|
||||
$stories = $this->dao->select('t1.*, t2.name as productTitle')->from(TABLE_STORY)->alias('t1')
|
||||
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')
|
||||
->where('t1.deleted')->eq(0)
|
||||
->andWhere('t1.type')->eq($storyType)
|
||||
->beginIF($programID)->andWhere('t1.program')->eq($programID)->fi()
|
||||
->beginIF($type != 'closedBy' and $this->app->moduleName == 'block')->andWhere('t1.status')->ne('closed')->fi()
|
||||
->beginIF($type != 'all')
|
||||
->beginIF($type == 'assignedTo')->andWhere('assignedTo')->eq($account)->fi()
|
||||
|
||||
@@ -2001,10 +2001,12 @@ class taskModel extends model
|
||||
* @param string $type the query type
|
||||
* @param int $limit
|
||||
* @param object $pager
|
||||
* @param string $orderBy
|
||||
* @param int $programID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getUserTasks($account, $type = 'assignedTo', $limit = 0, $pager = null, $orderBy="id_desc")
|
||||
public function getUserTasks($account, $type = 'assignedTo', $limit = 0, $pager = null, $orderBy = "id_desc", $programID = 0)
|
||||
{
|
||||
if(!$this->loadModel('common')->checkField(TABLE_TASK, $type)) return array();
|
||||
$tasks = $this->dao->select('t1.*, t2.id as projectID, t2.name as projectName, t3.id as storyID, t3.title as storyTitle, t3.status AS storyStatus, t3.version AS latestStoryVersion')
|
||||
@@ -2013,6 +2015,7 @@ class taskModel extends model
|
||||
->leftjoin(TABLE_STORY)->alias('t3')->on('t1.story = t3.id')
|
||||
->where('t1.deleted')->eq(0)
|
||||
->beginIF($type != 'closedBy' and $this->app->moduleName == 'block')->andWhere('t1.status')->ne('closed')->fi()
|
||||
->beginIF($programID)->andWhere('t1.program')->eq($programID)->fi()
|
||||
->beginIF($type == 'finishedBy')
|
||||
->andWhere('t1.finishedby', 1)->eq($account)
|
||||
->orWhere('t1.finishedList')->like("%,{$account},%")
|
||||
|
||||
@@ -11,12 +11,27 @@
|
||||
*/
|
||||
class weekly extends control
|
||||
{
|
||||
/**
|
||||
* The construct function, load users.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
}
|
||||
|
||||
/**
|
||||
* Index
|
||||
*
|
||||
* @param int $program
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function index($program = 0, $date = '')
|
||||
{
|
||||
$program = $program ? $program : $this->session->program;
|
||||
@@ -46,13 +61,19 @@ class weekly extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* ComputeWeekly
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function computeWeekly()
|
||||
{
|
||||
$programs = $this->dao->select('id, name')->from(TABLE_PROJECT)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('isCat')->eq(0)
|
||||
->andWhere('template')->ne('')
|
||||
->andWhere('program')->eq(0)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('isCat')->eq(0)
|
||||
->andWhere('template')->ne('')
|
||||
->andWhere('program')->eq(0)
|
||||
->fetchPairs();
|
||||
$date = helper::today();
|
||||
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* The weekly module English file of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
|
||||
* @package weekly
|
||||
* @version $Id: en.php 4729 2013-05-03 07:53:55Z chencongzhi520@gmail.com $
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
$lang->weekly->common = 'Project Weekly';
|
||||
$lang->weekly->index = 'Weekly newspaper overview';
|
||||
$lang->weekly->progress = 'Percent Completed';
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* The weekly module zh-cn file of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
|
||||
* @package weekly
|
||||
* @version $Id: zh-cn.php 4729 2013-05-03 07:53:55Z chencongzhi520@gmail.com $
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
$lang->weekly->common = '项目周报';
|
||||
$lang->weekly->index = '周报总览';
|
||||
$lang->weekly->progress = '完成百分比';
|
||||
|
||||
+160
-3
@@ -11,6 +11,14 @@
|
||||
*/
|
||||
class weeklyModel extends model
|
||||
{
|
||||
/**
|
||||
* GetPageNav
|
||||
*
|
||||
* @param int $program
|
||||
* @param int $date
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getPageNav($program, $date)
|
||||
{
|
||||
$date = date('Ymd', strtotime($this->getThisMonday($date)));
|
||||
@@ -34,6 +42,13 @@ class weeklyModel extends model
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* GetWeekPairs
|
||||
*
|
||||
* @param int $begin
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getWeekPairs($begin)
|
||||
{
|
||||
$sn = $this->getWeekSN($begin, date('Y-m-d'));
|
||||
@@ -50,6 +65,14 @@ class weeklyModel extends model
|
||||
return $weeks;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetFromDB
|
||||
*
|
||||
* @param int $program
|
||||
* @param int $date
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getFromDB($program, $date)
|
||||
{
|
||||
$monday = $this->getThisMonday($date);
|
||||
@@ -60,6 +83,14 @@ class weeklyModel extends model
|
||||
->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save
|
||||
*
|
||||
* @param int $program
|
||||
* @param int $date
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function save($program, $date)
|
||||
{
|
||||
$report = new stdclass;
|
||||
@@ -75,11 +106,26 @@ class weeklyModel extends model
|
||||
$this->dao->replace(TABLE_WEEKLYREPORT)->data($report)->exec();
|
||||
}
|
||||
|
||||
/**
|
||||
* GetWeekSN
|
||||
*
|
||||
* @param int $begin
|
||||
* @param int $date
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getWeekSN($begin, $date)
|
||||
{
|
||||
return ceil((strtotime($date) - strtotime($begin)) / 7 / 86400);
|
||||
}
|
||||
|
||||
/**
|
||||
* GetThisMonday
|
||||
*
|
||||
* @param int $date
|
||||
* @access public
|
||||
* @return date
|
||||
*/
|
||||
public function getThisMonday($date)
|
||||
{
|
||||
$day = date('w', strtotime($date));
|
||||
@@ -88,12 +134,26 @@ class weeklyModel extends model
|
||||
return date('Y-m-d', strtotime("$date - $days days"));
|
||||
}
|
||||
|
||||
/**
|
||||
* GetThisSunday
|
||||
*
|
||||
* @param int $date
|
||||
* @access public
|
||||
* @return date
|
||||
*/
|
||||
public function getThisSunday($date)
|
||||
{
|
||||
$monday = $this->getThisMonday($date);
|
||||
return date('Y-m-d', strtotime("$monday +6 days"));
|
||||
}
|
||||
|
||||
/**
|
||||
* GetLastDay
|
||||
*
|
||||
* @param int $date
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getLastDay($date)
|
||||
{
|
||||
$this->loadModel('project');
|
||||
@@ -104,6 +164,14 @@ class weeklyModel extends model
|
||||
return end($workdays);
|
||||
}
|
||||
|
||||
/**
|
||||
* GetStaff
|
||||
*
|
||||
* @param int $program
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getStaff($program, $date = '')
|
||||
{
|
||||
if(!$date) $date = date('Y-m-d');
|
||||
@@ -121,6 +189,15 @@ class weeklyModel extends model
|
||||
->fetch('count');
|
||||
}
|
||||
|
||||
/**
|
||||
* GetFinished
|
||||
*
|
||||
* @param int $program
|
||||
* @param string $date
|
||||
* @param int $pager
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getFinished($program, $date = '', $pager = null)
|
||||
{
|
||||
if(!$date) $date = date('Y-m-d');
|
||||
@@ -140,6 +217,14 @@ class weeklyModel extends model
|
||||
return $this->loadModel('task')->processTasks($tasks);
|
||||
}
|
||||
|
||||
/**
|
||||
* GetPostponed
|
||||
*
|
||||
* @param int $program
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getPostponed($program, $date = '')
|
||||
{
|
||||
if(!$date) $date = date('Y-m-d');
|
||||
@@ -169,6 +254,14 @@ class weeklyModel extends model
|
||||
return $this->loadModel('task')->processTasks($tasks);
|
||||
}
|
||||
|
||||
/**
|
||||
* GetTasksOfNextWeek
|
||||
*
|
||||
* @param int $program
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getTasksOfNextWeek($program, $date = '')
|
||||
{
|
||||
if(!$date) $date = date('Y-m-d');
|
||||
@@ -188,6 +281,14 @@ class weeklyModel extends model
|
||||
return $this->loadModel('task')->processTasks($tasks);
|
||||
}
|
||||
|
||||
/**
|
||||
* GetWorkloadByType
|
||||
*
|
||||
* @param int $program
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getWorkloadByType($program, $date = '')
|
||||
{
|
||||
if(!$date) $date = date('Y-m-d');
|
||||
@@ -206,6 +307,14 @@ class weeklyModel extends model
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
/**
|
||||
* GetPlanedTaskByWeek
|
||||
*
|
||||
* @param int $program
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getPlanedTaskByWeek($program, $date = '')
|
||||
{
|
||||
if(!$date) $date = date('Y-m-d');
|
||||
@@ -222,6 +331,14 @@ class weeklyModel extends model
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* GetPV
|
||||
*
|
||||
* @param int $program
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getPV($program, $date = '')
|
||||
{
|
||||
$report = $this->getFromDB($program, $date);
|
||||
@@ -235,7 +352,7 @@ class weeklyModel extends model
|
||||
$lastDay = $this->getLastDay($date);
|
||||
$nextMonday = date('Y-m-d', strtotime("$sunday +1 days"));
|
||||
$workdays = $this->loadModel('holiday')->getActualWorkingDays($monday, $sunday);
|
||||
|
||||
|
||||
$projects = $this->loadModel('project')->getList($status = 'all', $limit = 0, $productID = 0, $branch = 0, $program->id);
|
||||
$projectIdList = array_keys($projects);
|
||||
|
||||
@@ -263,11 +380,19 @@ class weeklyModel extends model
|
||||
return round($PV, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* GetEV
|
||||
*
|
||||
* @param int $program
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getEV($program, $date = '')
|
||||
{
|
||||
$report = $this->getFromDB($program, $date);
|
||||
if(!empty($report)) return $report->ev;
|
||||
|
||||
|
||||
$projects = $this->loadModel('project')->getList($status = 'all', $limit = 0, $productID = 0, $branch = 0, $program);
|
||||
$projectIdList = array_keys($projects);
|
||||
|
||||
@@ -300,11 +425,19 @@ class weeklyModel extends model
|
||||
return round($EV, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* GetAC
|
||||
*
|
||||
* @param int $program
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getAC($program, $date = '')
|
||||
{
|
||||
$report = $this->getFromDB($program, $date);
|
||||
if(!empty($report)) return $report->ac;
|
||||
|
||||
|
||||
if(!$date) $date = date('Y-m-d');
|
||||
|
||||
$monday = $this->getThisMonday($date);
|
||||
@@ -323,6 +456,14 @@ class weeklyModel extends model
|
||||
return round($AC, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* GetSV
|
||||
*
|
||||
* @param int $ev
|
||||
* @param int $pv
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getSV($ev, $pv)
|
||||
{
|
||||
if($pv == 0) return 0;
|
||||
@@ -330,6 +471,14 @@ class weeklyModel extends model
|
||||
return number_format($sv * 100, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* GetCV
|
||||
*
|
||||
* @param int $ev
|
||||
* @param int $ac
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getCV($ev, $ac)
|
||||
{
|
||||
if($ac == 0) return 0;
|
||||
@@ -337,6 +486,14 @@ class weeklyModel extends model
|
||||
return number_format($cv * 100, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* GetTips
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $data
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getTips($type = 'progress', $data = 0)
|
||||
{
|
||||
$this->app->loadConfig('custom');
|
||||
|
||||
Reference in New Issue
Block a user