+ task#545
This commit is contained in:
@@ -336,6 +336,93 @@ class actionModel extends model
|
||||
return $actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product's actions as dynamic.
|
||||
*
|
||||
* @param string $objectType
|
||||
* @param int $count
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProductDynamic($productID = 0, $account = 'all', $period = 'all', $orderBy = 'date_desc', $pager = null)
|
||||
{
|
||||
$period = $this->computeBeginAndEnd($period);
|
||||
extract($period);
|
||||
|
||||
$actions = $this->dao->select('*')->from(TABLE_ACTION)
|
||||
->where('date')->gt($begin)
|
||||
->andWhere('date')->lt($end)
|
||||
->andWhere('product')->eq($productID)
|
||||
->beginIF($account != 'all')->andWhere('actor')->eq($account)->fi()
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
|
||||
if(!$actions) return array();
|
||||
|
||||
/* Group actions by objectType, and get there name field. */
|
||||
foreach($actions as $object) $objectTypes[$object->objectType][] = $object->objectID;
|
||||
foreach($objectTypes as $objectType => $objectIds)
|
||||
{
|
||||
if(!isset($this->config->action->objectTables[$objectType])) continue; // If no defination for this type, omit it.
|
||||
|
||||
$objectIds = array_unique($objectIds);
|
||||
$table = $this->config->action->objectTables[$objectType];
|
||||
$field = $this->config->action->objectNameFields[$objectType];
|
||||
if($table != 'zt_todo')
|
||||
{
|
||||
$objectNames[$objectType] = $this->dao->select("id, $field AS name")->from($table)->where('id')->in($objectIds)->fetchPairs();
|
||||
}
|
||||
else
|
||||
{
|
||||
$todos = $this->dao->select("id, $field AS name, account, private")->from($table)->where('id')->in($objectIds)->fetchAll('id');
|
||||
foreach($todos as $id => $todo)
|
||||
{
|
||||
if($todo->private == 1 and $todo->account != $this->app->user->account)
|
||||
{
|
||||
$objectNames[$objectType][$id] = $this->lang->todo->thisIsPrivate;
|
||||
}
|
||||
else
|
||||
{
|
||||
$objectNames[$objectType][$id] = $todo->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$objectNames['user'][0] = 'guest'; // Add guest account.
|
||||
|
||||
foreach($actions as $action)
|
||||
{
|
||||
/* Add name field to the actions. */
|
||||
$action->objectName = isset($objectNames[$action->objectType][$action->objectID]) ? $objectNames[$action->objectType][$action->objectID] : '';
|
||||
|
||||
$actionType = strtolower($action->action);
|
||||
$objectType = strtolower($action->objectType);
|
||||
$action->date = date(DT_MONTHTIME2, strtotime($action->date));
|
||||
$action->actionLabel = isset($this->lang->action->label->$actionType) ? $this->lang->action->label->$actionType : $action->action;
|
||||
$action->objectLabel = isset($this->lang->action->label->$objectType) ? $this->lang->action->label->$objectType : $objectType;
|
||||
|
||||
/* If action type is login or logout, needn't link. */
|
||||
if($actionType == 'login' or $actionType == 'logout')
|
||||
{
|
||||
$action->objectLink = '';
|
||||
$action->objectLabel = '';
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Other actions, create a link. */
|
||||
if(strpos($action->objectLabel, '|') !== false)
|
||||
{
|
||||
list($objectLabel, $moduleName, $methodName, $vars) = explode('|', $action->objectLabel);
|
||||
$action->objectLink = helper::createLink($moduleName, $methodName, sprintf($vars, $action->objectID));
|
||||
$action->objectLabel = $objectLabel;
|
||||
}
|
||||
else
|
||||
{
|
||||
$action->objectLink = '';
|
||||
}
|
||||
}
|
||||
return $actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the begin date and end date of a period.
|
||||
*
|
||||
|
||||
@@ -128,19 +128,20 @@ $lang->my->menu->profile = array('link' => 'Profile|my|profile|', 'alias' => 'e
|
||||
$lang->todo->menu = $lang->my->menu;
|
||||
|
||||
/* Product menu. */
|
||||
$lang->product->menu->list = '%s';
|
||||
$lang->product->menu->story = array('link' => 'Story|product|browse|productID=%s', 'subModule' => 'story');
|
||||
$lang->product->menu->plan = array('link' => 'Plan|productplan|browse|productID=%s', 'subModule' => 'productplan');
|
||||
$lang->product->menu->release= array('link' => 'Release|release|browse|productID=%s', 'subModule' => 'release');
|
||||
$lang->product->menu->roadmap= 'Roadmap|product|roadmap|productID=%s';
|
||||
$lang->product->menu->doc = array('link' => 'Doc|product|doc|productID=%s', 'subModule' => 'doc');
|
||||
$lang->product->menu->view = 'Info|product|view|productID=%s';
|
||||
$lang->product->menu->edit = 'Edit|product|edit|productID=%s';
|
||||
$lang->product->menu->module = 'Modules|tree|browse|productID=%s&view=story';
|
||||
$lang->product->menu->create = array('link' => 'New Product|product|create', 'float' => 'right');
|
||||
$lang->story->menu = $lang->product->menu;
|
||||
$lang->productplan->menu = $lang->product->menu;
|
||||
$lang->release->menu = $lang->product->menu;
|
||||
$lang->product->menu->list = '%s';
|
||||
$lang->product->menu->story = array('link' => 'Story|product|browse|productID=%s', 'subModule' => 'story');
|
||||
$lang->product->menu->plan = array('link' => 'Plan|productplan|browse|productID=%s', 'subModule' => 'productplan');
|
||||
$lang->product->menu->release = array('link' => 'Release|release|browse|productID=%s', 'subModule' => 'release');
|
||||
$lang->product->menu->roadmap = 'Roadmap|product|roadmap|productID=%s';
|
||||
$lang->product->menu->doc = array('link' => 'Doc|product|doc|productID=%s', 'subModule' => 'doc');
|
||||
$lang->product->menu->view = 'Info|product|view|productID=%s';
|
||||
$lang->product->menu->edit = 'Edit|product|edit|productID=%s';
|
||||
$lang->product->menu->module = 'Modules|tree|browse|productID=%s&view=story';
|
||||
$lang->product->menu->dynamic = 'Dynamic|product|dynamic|productID=%s';
|
||||
$lang->product->menu->create = array('link' => 'New Product|product|create', 'float' => 'right');
|
||||
$lang->story->menu = $lang->product->menu;
|
||||
$lang->productplan->menu = $lang->product->menu;
|
||||
$lang->release->menu = $lang->product->menu;
|
||||
|
||||
/* Project menu. */
|
||||
$lang->project->menu->list = '%s';
|
||||
|
||||
@@ -128,19 +128,20 @@ $lang->my->menu->profile = array('link' => '我的档案|my|profile|', 'alias'
|
||||
$lang->todo->menu = $lang->my->menu;
|
||||
|
||||
/* 产品视图设置。*/
|
||||
$lang->product->menu->list = '%s';
|
||||
$lang->product->menu->story = array('link' => '需求|product|browse|productID=%s', 'subModule' => 'story');
|
||||
$lang->product->menu->plan = array('link' => '计划|productplan|browse|productID=%s', 'subModule' => 'productplan');
|
||||
$lang->product->menu->release= array('link' => '发布|release|browse|productID=%s', 'subModule' => 'release');
|
||||
$lang->product->menu->roadmap= '路线图|product|roadmap|productID=%s';
|
||||
$lang->product->menu->doc = array('link' => '文档|product|doc|productID=%s', 'subModule' => 'doc');
|
||||
$lang->product->menu->view = '概况|product|view|productID=%s';
|
||||
$lang->product->menu->edit = '编辑|product|edit|productID=%s';
|
||||
$lang->product->menu->module = '模块|tree|browse|productID=%s&view=story';
|
||||
$lang->product->menu->create = array('link' => '新增产品|product|create', 'float' => 'right');
|
||||
$lang->story->menu = $lang->product->menu;
|
||||
$lang->productplan->menu = $lang->product->menu;
|
||||
$lang->release->menu = $lang->product->menu;
|
||||
$lang->product->menu->list = '%s';
|
||||
$lang->product->menu->story = array('link' => '需求|product|browse|productID=%s', 'subModule' => 'story');
|
||||
$lang->product->menu->plan = array('link' => '计划|productplan|browse|productID=%s', 'subModule' => 'productplan');
|
||||
$lang->product->menu->release = array('link' => '发布|release|browse|productID=%s', 'subModule' => 'release');
|
||||
$lang->product->menu->roadmap = '路线图|product|roadmap|productID=%s';
|
||||
$lang->product->menu->doc = array('link' => '文档|product|doc|productID=%s', 'subModule' => 'doc');
|
||||
$lang->product->menu->view = '概况|product|view|productID=%s';
|
||||
$lang->product->menu->edit = '编辑|product|edit|productID=%s';
|
||||
$lang->product->menu->module = '模块|tree|browse|productID=%s&view=story';
|
||||
$lang->product->menu->dynamic = '动态|product|dynamic|productID=%s';
|
||||
$lang->product->menu->create = array('link' => '新增产品|product|create', 'float' => 'right');
|
||||
$lang->story->menu = $lang->product->menu;
|
||||
$lang->productplan->menu = $lang->product->menu;
|
||||
$lang->release->menu = $lang->product->menu;
|
||||
|
||||
/* 项目视图菜单设置。*/
|
||||
$lang->project->menu->list = '%s';
|
||||
|
||||
@@ -310,6 +310,57 @@ class product extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Product dynamic.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function dynamic($productID = 0, $type = 'today', $param = '', $orderBy = 'date_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
/* Save session. */
|
||||
$uri = $this->app->getURI(true);
|
||||
$this->session->set('productList', $uri);
|
||||
$this->session->set('productPlanList', $uri);
|
||||
$this->session->set('releaseList', $uri);
|
||||
$this->session->set('storyList', $uri);
|
||||
$this->session->set('projectList', $uri);
|
||||
$this->session->set('taskList', $uri);
|
||||
$this->session->set('buildList', $uri);
|
||||
$this->session->set('bugList', $uri);
|
||||
$this->session->set('caseList', $uri);
|
||||
$this->session->set('testtaskList', $uri);
|
||||
|
||||
$this->product->setMenu($this->products, $productID);
|
||||
|
||||
/* Set the pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = pager::init($recTotal, $recPerPage, $pageID);
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->pager = $pager;
|
||||
|
||||
/* Set the user and type. */
|
||||
$account = $type == 'account' ? $param : 'all';
|
||||
$period = $type == 'account' ? 'all' : $type;
|
||||
|
||||
/* The header and position. */
|
||||
$this->view->header->title = $this->lang->company->common . $this->lang->colon . $this->lang->company->dynamic;
|
||||
$this->view->position[] = $this->lang->company->dynamic;
|
||||
|
||||
/* Assign. */
|
||||
$this->view->productID = $productID;
|
||||
$this->view->type = $type;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('nodeleted|noletter');
|
||||
$this->view->account = $account;
|
||||
$this->view->actions = $this->loadModel('action')->getProductDynamic($productID, $account, $period, $orderBy, $pager);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX: get projects of a product in html select.
|
||||
*
|
||||
|
||||
5
module/product/js/dynamic.js
Executable file
5
module/product/js/dynamic.js
Executable file
@@ -0,0 +1,5 @@
|
||||
function changeUser(account, productID)
|
||||
{
|
||||
link = createLink('product', 'dynamic', 'productID=' + productID + '&type=account¶m=' + account);
|
||||
location.href = link;
|
||||
}
|
||||
56
module/product/view/dynamic.html.php
Executable file
56
module/product/view/dynamic.html.php
Executable file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* The action->dynamic view file of dashboard module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2011 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
|
||||
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
|
||||
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
|
||||
* @package dashboard
|
||||
* @version $Id: action->dynamic.html.php 1477 2011-03-01 15:25:50Z wwccss $
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/tablesorter.html.php';?>
|
||||
<div id='featurebar'>
|
||||
<?php
|
||||
echo '<span id="today">' . html::a(inlink('dynamic', "productID=$productID&type=today"), $lang->action->dynamic->today) . '</span>';
|
||||
echo '<span id="yesterday">' . html::a(inlink('dynamic', "productID=$productID&type=yesterday"), $lang->action->dynamic->yesterday) . '</span>';
|
||||
echo '<span id="twodaysago">' . html::a(inlink('dynamic', "productID=$productID&type=twodaysago"), $lang->action->dynamic->twoDaysAgo) . '</span>';
|
||||
echo '<span id="thisweek">' . html::a(inlink('dynamic', "productID=$productID&type=thisweek"), $lang->action->dynamic->thisWeek) . '</span>';
|
||||
echo '<span id="lastweek">' . html::a(inlink('dynamic', "productID=$productID&type=lastweek"), $lang->action->dynamic->lastWeek) . '</span>';
|
||||
echo '<span id="thismonth">' . html::a(inlink('dynamic', "productID=$productID&type=thismonth"), $lang->action->dynamic->thisMonth) . '</span>';
|
||||
echo '<span id="lastmonth">' . html::a(inlink('dynamic', "productID=$productID&type=lastmonth"), $lang->action->dynamic->lastMonth) . '</span>';
|
||||
echo '<span id="all">' . html::a(inlink('dynamic', "productID=$productID&type=all"), $lang->action->dynamic->all) . '</span>';
|
||||
echo "<span id='account'>" . html::select('account', $users, $account, "onchange=changeUser(this.value,$productID)") . '</span>';
|
||||
?>
|
||||
</div>
|
||||
|
||||
<table class='table-1 colored tablesorter'>
|
||||
<thead>
|
||||
<tr class='colhead'>
|
||||
<th class='w-150px'><?php echo $lang->action->date;?></th>
|
||||
<th class='w-user'> <?php echo $lang->action->actor;?></th>
|
||||
<th class='w-100px'><?php echo $lang->action->action;?></th>
|
||||
<th class='w-80px'> <?php echo $lang->action->objectType;?></th>
|
||||
<th class='w-id'> <?php echo $lang->idAB;?></th>
|
||||
<th><?php echo $lang->action->objectName;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($actions as $action):?>
|
||||
<?php $module = $action->objectType == 'case' ? 'testcase' : $action->objectType;?>
|
||||
<tr class='a-center'>
|
||||
<td><?php echo $action->date;?></td>
|
||||
<td><?php isset($users[$action->actor]) ? print($users[$action->actor]) : print($action->actor);?></td>
|
||||
<td><?php echo $action->actionLabel;?></td>
|
||||
<td><?php echo $lang->action->objectTypes[$action->objectType];?></td>
|
||||
<td><?php echo $action->objectID;?></td>
|
||||
<td class='a-left'><?php echo html::a($action->objectLink, $action->objectName);?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
<tfoot><tr><td colspan='6'><?php $pager->show();?></td></tr></tfoot>
|
||||
</table>
|
||||
<script>$('#<?php echo $type;?>').addClass('active')</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
Reference in New Issue
Block a user