* add actions of project.

This commit is contained in:
zhujinyong
2013-01-16 07:06:53 +00:00
parent d05c63b9b6
commit 2e34380354
7 changed files with 421 additions and 0 deletions

View File

@@ -80,6 +80,7 @@ class project extends control
$products = $this->project->getProducts($project->id);
$childProjects = $this->project->getChildProjects($project->id);
$teamMembers = $this->project->getTeamMembers($project->id);
$actions = $this->loadModel('action')->getList('project', $project->id);
/* Set menu. */
$this->project->setMenu($this->projects, $project->id, $extra);
@@ -90,6 +91,7 @@ class project extends control
$this->view->childProjects = $childProjects;
$this->view->products = $products;
$this->view->teamMembers = $teamMembers;
$this->view->actions = $actions;
return $project;
}
@@ -893,6 +895,156 @@ class project extends control
$this->display();
}
/**
* Start project.
*
* @param int $projectID
* @access public
* @return void
*/
public function start($projectID)
{
$this->commonAction($projectID);
if(!empty($_POST))
{
$this->loadModel('action');
$changes = $this->project->start($projectID);
if(dao::isError()) die(js::error(dao::getError()));
if($this->post->comment != '' or !empty($changes))
{
$actionID = $this->action->create('project', $projectID, 'Started', $this->post->comment);
$this->action->logHistory($actionID, $changes);
}
die(js::locate($this->createLink('project', 'view', "projectID=$projectID"), 'parent'));
}
$this->view->header->title = $this->view->project->name . $this->lang->colon .$this->lang->project->start;
$this->view->position[] = $this->lang->project->start;
$this->display();
}
/**
* Delay project.
*
* @param int $projectID
* @access public
* @return void
*/
public function delay($projectID)
{
$this->commonAction($projectID);
if(!empty($_POST))
{
$this->loadModel('action');
$changes = $this->project->delay($projectID);
if(dao::isError()) die(js::error(dao::getError()));
if($this->post->comment != '' or !empty($changes))
{
$actionID = $this->action->create('project', $projectID, 'Delayed', $this->post->comment);
$this->action->logHistory($actionID, $changes);
}
die(js::locate($this->createLink('project', 'view', "projectID=$projectID"), 'parent'));
}
$this->view->header->title = $this->view->project->name . $this->lang->colon .$this->lang->project->delay;
$this->view->position[] = $this->lang->project->delay;
$this->display();
}
/**
* Suspend project.
*
* @param int $projectID
* @access public
* @return void
*/
public function suspend($projectID)
{
$this->commonAction($projectID);
if(!empty($_POST))
{
$this->loadModel('action');
$changes = $this->project->suspend($projectID);
if(dao::isError()) die(js::error(dao::getError()));
if($this->post->comment != '' or !empty($changes))
{
$actionID = $this->action->create('project', $projectID, 'Suspended', $this->post->comment);
$this->action->logHistory($actionID, $changes);
}
die(js::locate($this->createLink('project', 'view', "projectID=$projectID"), 'parent'));
}
$this->view->header->title = $this->view->project->name . $this->lang->colon .$this->lang->project->suspend;
$this->view->position[] = $this->lang->project->suspend;
$this->display();
}
/**
* Activate project.
*
* @param int $projectID
* @access public
* @return void
*/
public function activate($projectID)
{
$this->commonAction($projectID);
if(!empty($_POST))
{
$this->loadModel('action');
$changes = $this->project->activate($projectID);
if(dao::isError()) die(js::error(dao::getError()));
if($this->post->comment != '' or !empty($changes))
{
$actionID = $this->action->create('project', $projectID, 'Activated', $this->post->comment);
$this->action->logHistory($actionID, $changes);
}
die(js::locate($this->createLink('project', 'view', "projectID=$projectID"), 'parent'));
}
$this->view->header->title = $this->view->project->name . $this->lang->colon .$this->lang->project->activate;
$this->view->position[] = $this->lang->project->activate;
$this->display();
}
/**
* Close project.
*
* @param int $projectID
* @access public
* @return void
*/
public function close($projectID)
{
$this->commonAction($projectID);
if(!empty($_POST))
{
$this->loadModel('action');
$changes = $this->project->close($projectID);
if(dao::isError()) die(js::error(dao::getError()));
if($this->post->comment != '' or !empty($changes))
{
$actionID = $this->action->create('project', $projectID, 'Closed', $this->post->comment);
$this->action->logHistory($actionID, $changes);
}
die(js::locate($this->createLink('project', 'view', "projectID=$projectID"), 'parent'));
}
$this->view->header->title = $this->view->project->name . $this->lang->colon .$this->lang->project->suspend;
$this->view->position[] = $this->lang->project->suspend;
$this->display();
}
/**
* View a project.
*

View File

@@ -336,6 +336,119 @@ class projectModel extends model
if(!dao::isError()) return common::createChanges($oldProject, $project);
}
/**
* Start project.
*
* @param int $projectID
* @access public
* @return void
*/
public function start($projectID)
{
$oldProject = $this->getById($projectID);
$now = helper::now();
$project = fixer::input('post')
->setDefault('status', 'doing')
->remove('comment')->get();
$this->dao->update(TABLE_PROJECT)->data($project)
->autoCheck()
->where('id')->eq((int)$projectID)
->exec();
if(!dao::isError()) return common::createChanges($oldProject, $project);
}
/**
* Delay project.
*
* @param int $projectID
* @access public
* @return void
*/
public function delay($projectID)
{
$oldProject = $this->getById($projectID);
$now = helper::now();
$project = fixer::input('post')->remove('comment')->get();
$this->dao->update(TABLE_PROJECT)->data($project)
->autoCheck()
->where('id')->eq((int)$projectID)
->exec();
if(!dao::isError()) return common::createChanges($oldProject, $project);
}
/**
* Suspend project.
*
* @param int $projectID
* @access public
* @return void
*/
public function suspend($projectID)
{
$oldProject = $this->getById($projectID);
$now = helper::now();
$project = fixer::input('post')
->setDefault('status', 'suspended')
->remove('comment')->get();
$this->dao->update(TABLE_PROJECT)->data($project)
->autoCheck()
->where('id')->eq((int)$projectID)
->exec();
if(!dao::isError()) return common::createChanges($oldProject, $project);
}
/**
* Activate project.
*
* @param int $projectID
* @access public
* @return void
*/
public function activate($projectID)
{
$oldProject = $this->getById($projectID);
$now = helper::now();
$project = fixer::input('post')
->setDefault('status', 'doing')
->remove('comment')->get();
$this->dao->update(TABLE_PROJECT)->data($project)
->autoCheck()
->where('id')->eq((int)$projectID)
->exec();
if(!dao::isError()) return common::createChanges($oldProject, $project);
}
/**
* Close project.
*
* @param int $projectID
* @access public
* @return void
*/
public function close($projectID)
{
$oldProject = $this->getById($projectID);
$now = helper::now();
$project = fixer::input('post')
->setDefault('status', 'done')
->remove('comment')->get();
$this->dao->update(TABLE_PROJECT)->data($project)
->autoCheck()
->where('id')->eq((int)$projectID)
->exec();
if(!dao::isError()) return common::createChanges($oldProject, $project);
}
/**
* Get project pairs.
*

View File

@@ -0,0 +1,29 @@
<?php
/**
* The suspend file of project module of ZenTaoPMS.
*
* @copyright Copyright 2009-2012 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Chunsheng Wang<wwccss@gmail.com>
* @package project
* @version $Id: suspend.html.php 935 2013-01-16 07:49:24Z wwccss@gmail.com $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<?php js::import($jsRoot . 'misc/date.js');?>
<form method='post' target='hiddenwin'>
<table class='table-1'>
<caption><?php echo $project->name;?></caption>
<tr>
<td class='rowhead'><?php echo $lang->comment;?></td>
<td><?php echo html::textarea('comment', '', "rows='6' class='area-1'");?></td>
</tr>
<tr>
<td colspan='2' class='a-center'><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
</tr>
</table>
<?php include '../../common/view/action.html.php';?>
</form>
<?php include '../../common/view/footer.html.php';?>

View File

@@ -0,0 +1,29 @@
<?php
/**
* The suspend file of project module of ZenTaoPMS.
*
* @copyright Copyright 2009-2012 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Chunsheng Wang<wwccss@gmail.com>
* @package project
* @version $Id: suspend.html.php 935 2013-01-16 07:49:24Z wwccss@gmail.com $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<?php js::import($jsRoot . 'misc/date.js');?>
<form method='post' target='hiddenwin'>
<table class='table-1'>
<caption><?php echo $project->name;?></caption>
<tr>
<td class='rowhead'><?php echo $lang->comment;?></td>
<td><?php echo html::textarea('comment', '', "rows='6' class='area-1'");?></td>
</tr>
<tr>
<td colspan='2' class='a-center'><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
</tr>
</table>
<?php include '../../common/view/action.html.php';?>
</form>
<?php include '../../common/view/footer.html.php';?>

View File

@@ -0,0 +1,41 @@
<?php
/**
* The delay file of project module of ZenTaoPMS.
*
* @copyright Copyright 2009-2012 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Chunsheng Wang<wwccss@gmail.com>
* @package project
* @version $Id: delay.html.php 935 2013-01-16 07:49:24Z wwccss@gmail.com $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<?php js::import($jsRoot . 'misc/date.js');?>
<form method='post' target='hiddenwin'>
<table class='table-1'>
<caption><?php echo $project->name;?></caption>
<tr>
<td class='rowhead'><?php echo $lang->project->begin;?></td>
<td><?php echo html::input('begin', $project->begin, "class='text-3 date' onchange='computeWorkDays()'");?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->project->end;?></td>
<td><?php echo html::input('end', $project->end, "class='text-3 date' onchange='computeWorkDays()'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->days;?></th>
<td><?php echo html::input('days', $project->days, "class='text-3'") . $lang->project->day;?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->comment;?></td>
<td><?php echo html::textarea('comment', '', "rows='6' class='area-1'");?></td>
</tr>
<tr>
<td colspan='2' class='a-center'><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
</tr>
</table>
<?php include '../../common/view/action.html.php';?>
</form>
<?php include '../../common/view/footer.html.php';?>

View File

@@ -0,0 +1,28 @@
<?php
/**
* The start file of project module of ZenTaoPMS.
*
* @copyright Copyright 2009-2012 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Chunsheng Wang<wwccss@gmail.com>
* @package project
* @version $Id: start.html.php 935 2013-01-16 07:49:24Z wwccss@gmail.com $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<form method='post' target='hiddenwin'>
<table class='table-1'>
<caption><?php echo $project->name;?></caption>
<tr>
<td class='rowhead'><?php echo $lang->comment;?></td>
<td><?php echo html::textarea('comment', '', "rows='6' class='area-1'");?></td>
</tr>
<tr>
<td colspan='2' class='a-center'><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
</tr>
</table>
<?php include '../../common/view/action.html.php';?>
</form>
<?php include '../../common/view/footer.html.php';?>

View File

@@ -0,0 +1,29 @@
<?php
/**
* The suspend file of project module of ZenTaoPMS.
*
* @copyright Copyright 2009-2012 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Chunsheng Wang<wwccss@gmail.com>
* @package project
* @version $Id: suspend.html.php 935 2013-01-16 07:49:24Z wwccss@gmail.com $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<?php js::import($jsRoot . 'misc/date.js');?>
<form method='post' target='hiddenwin'>
<table class='table-1'>
<caption><?php echo $project->name;?></caption>
<tr>
<td class='rowhead'><?php echo $lang->comment;?></td>
<td><?php echo html::textarea('comment', '', "rows='6' class='area-1'");?></td>
</tr>
<tr>
<td colspan='2' class='a-center'><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
</tr>
</table>
<?php include '../../common/view/action.html.php';?>
</form>
<?php include '../../common/view/footer.html.php';?>