* UpDate
This commit is contained in:
@@ -12,6 +12,7 @@ $config->action->objectTables['testtask'] = TABLE_TESTTASK;
|
||||
$config->action->objectTables['user'] = TABLE_USER;
|
||||
$config->action->objectTables['doc'] = TABLE_DOC;
|
||||
$config->action->objectTables['doclib'] = TABLE_DOCLIB;
|
||||
$config->action->objectTables['todo'] = TABLE_TODO;
|
||||
|
||||
$config->action->objectNameFields['product'] = 'name';
|
||||
$config->action->objectNameFields['story'] = 'title';
|
||||
@@ -26,3 +27,4 @@ $config->action->objectNameFields['testtask'] = 'name';
|
||||
$config->action->objectNameFields['user'] = 'account';
|
||||
$config->action->objectNameFields['doc'] = 'title';
|
||||
$config->action->objectNameFields['doclib'] = 'name';
|
||||
$config->action->objectNameFields['todo'] = 'name';
|
||||
|
||||
@@ -21,6 +21,15 @@ $lang->action->date = 'Date';
|
||||
$lang->action->trashTips = "Tips:The deleting actions in zentao are all logic, the real data don't be erased from the database.
|
||||
So if you want to erase a record, can use phpmyadmin and such tools to remove it from database.";
|
||||
|
||||
$lang->action->dynamic->today = 'Today';
|
||||
$lang->action->dynamic->yesterday = 'Yesterday';
|
||||
$lang->action->dynamic->twoDaysAgo= 'The day Before Yesterday';
|
||||
$lang->action->dynamic->thisWeek = 'This Week';
|
||||
$lang->action->dynamic->lastWeek = 'Last Week';
|
||||
$lang->action->dynamic->thisMonth = 'This Month';
|
||||
$lang->action->dynamic->lastMonth = 'Last Month';
|
||||
$lang->action->dynamic->all = 'All';
|
||||
|
||||
$lang->action->objectTypes['product'] = 'PRODUCT';
|
||||
$lang->action->objectTypes['story'] = 'STORY';
|
||||
$lang->action->objectTypes['productplan'] = 'PLAN';
|
||||
|
||||
@@ -17,10 +17,20 @@ $lang->action->objectType = '对象类型';
|
||||
$lang->action->objectID = '对象ID';
|
||||
$lang->action->objectName = '对象名称';
|
||||
$lang->action->actor = '操作者';
|
||||
$lang->action->action = '动作';
|
||||
$lang->action->date = '日期';
|
||||
$lang->action->trashTips = '提示:禅道系统的删除都是标记删除,并没有真正从数据库里面删除数据。这样做是为了系统数据的完整和安全。
|
||||
因此如果你确定要删除某一条数据,可以使用phpmyadmin等管理工具,进数据库删除。';
|
||||
|
||||
$lang->action->dynamic->today = '今天';
|
||||
$lang->action->dynamic->yesterday = '昨天';
|
||||
$lang->action->dynamic->twoDaysAgo= '前天';
|
||||
$lang->action->dynamic->thisWeek = '本周';
|
||||
$lang->action->dynamic->lastWeek = '上周';
|
||||
$lang->action->dynamic->thisMonth = '本月';
|
||||
$lang->action->dynamic->lastMonth = '上月';
|
||||
$lang->action->dynamic->all = '所有';
|
||||
|
||||
$lang->action->objectTypes['product'] = '产品';
|
||||
$lang->action->objectTypes['story'] = '需求';
|
||||
$lang->action->objectTypes['productplan'] = '产品计划';
|
||||
@@ -34,6 +44,7 @@ $lang->action->objectTypes['testtask'] = '测试任务';
|
||||
$lang->action->objectTypes['user'] = '用户';
|
||||
$lang->action->objectTypes['doc'] = '文档';
|
||||
$lang->action->objectTypes['doclib'] = '文档库';
|
||||
$lang->action->objectTypes['todo'] = 'TODO';
|
||||
|
||||
/* 用来描述操作历史记录。*/
|
||||
$lang->action->desc->common = '$date, <strong>$action</strong> by <strong>$actor</strong>' . "\n";
|
||||
|
||||
@@ -211,14 +211,34 @@ class actionModel extends model
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getDynamic($objectType = 'all', $count = 30)
|
||||
public function getDynamic($account = 'all', $period = 'all', $orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
$period = $this->computeBeginAndEnd($period);
|
||||
extract($period);
|
||||
|
||||
$actions = $this->dao->select('*')->from(TABLE_ACTION)
|
||||
->beginIF($objectType != 'all')->where('objectType')->eq($objectType)->fi()
|
||||
->orderBy('id desc')->limit($count)->fetchAll();
|
||||
->where('date')->gt($begin)
|
||||
->andWhere('date')->lt($end)
|
||||
->beginIF($account != 'all')->andWhere('actor')->eq($account)->fi()
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
|
||||
if(!$actions) return array();
|
||||
|
||||
/* Group trashes by objectType, and get there name field. */
|
||||
foreach($actions as $object) $objectTypes[$object->objectType][] = $object->objectID;
|
||||
foreach($objectTypes as $objectType => $objectIds)
|
||||
{
|
||||
$objectIds = array_unique($objectIds);
|
||||
$table = $this->config->action->objectTables[$objectType];
|
||||
$field = $this->config->action->objectNameFields[$objectType];
|
||||
$objectNames[$objectType] = $this->dao->select("id, $field AS name")->from($table)->where('id')->in($objectIds)->fetchPairs();
|
||||
}
|
||||
|
||||
foreach($actions as $action)
|
||||
{
|
||||
/* Add name field to the trashes. */
|
||||
$action->objectName = $objectNames[$action->objectType][$action->objectID];
|
||||
|
||||
$actionType = strtolower($action->action);
|
||||
$objectType = strtolower($action->objectType);
|
||||
$action->date = date(DT_MONTHTIME2, strtotime($action->date));
|
||||
@@ -248,6 +268,39 @@ class actionModel extends model
|
||||
return $actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the begin date and end date of a period.
|
||||
*
|
||||
* @param string $period
|
||||
* @access private
|
||||
* @return array
|
||||
*/
|
||||
private function computeBeginAndEnd($period)
|
||||
{
|
||||
$this->loadModel('todo');
|
||||
|
||||
$today = $this->todo->today();
|
||||
$tomorrow = $this->todo->tomorrow();
|
||||
$yesterday = $this->todo->yesterday();
|
||||
$twoDaysAgo = $this->todo->twoDaysAgo();
|
||||
|
||||
if($period == 'all') return array('begin' => '1970-1-1', 'end' => '2109-1-1');
|
||||
if($period == 'today') return array('begin' => $today, 'end' => $tomorrow);
|
||||
if($period == 'yesterday') return array('begin' => $yesterday, 'end' => $today);
|
||||
if($period == 'twodaysago') return array('begin' => $twoDaysAgo, 'end' => $yesterday);
|
||||
|
||||
/* If the period is by week, add the end time to the end date. */
|
||||
if($period == 'thisweek' or $period == 'lastweek')
|
||||
{
|
||||
$func = "get$period";
|
||||
extract($this->todo->$func());
|
||||
return array('begin' => $begin, 'end' => $end . ' 23:59:59');
|
||||
}
|
||||
|
||||
if($period == 'thismonth') return $this->todo->getThisMonth();
|
||||
if($period == 'lastmonth') return $this->todo->getLastMonth();
|
||||
}
|
||||
|
||||
/**
|
||||
* Print changes of every action.
|
||||
*
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
<thead>
|
||||
<tr class='colhead'>
|
||||
<th class='w-80px'><?php common::printOrderLink('objectType', $orderBy, $vars, $lang->action->objectType);?></th>
|
||||
<th class='w-id'><?php common::printOrderLink('objectID', $orderBy, $vars, $lang->idAB);?></th>
|
||||
<th class='w-id'> <?php common::printOrderLink('objectID', $orderBy, $vars, $lang->idAB);?></th>
|
||||
<th><?php echo $lang->action->objectName;?></th>
|
||||
<th class='w-100px'><?php common::printOrderLink('actor', $orderBy, $vars, $lang->action->actor);?></th>
|
||||
<th class='w-150px'><?php common::printOrderLink('date', $orderBy, $vars, $lang->action->date);?></th>
|
||||
<th class='w-100px'><?php common::printOrderLink('actor', $orderBy, $vars, $lang->action->actor);?></th>
|
||||
<th class='w-150px'><?php common::printOrderLink('date', $orderBy, $vars, $lang->action->date);?></th>
|
||||
<th class='w-80px'><?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -116,6 +116,7 @@ $lang->my->menu->bug = '我的Bug|my|bug|';
|
||||
$lang->my->menu->testask = '我的测试|my|testtask|';
|
||||
$lang->my->menu->story = '我的需求|my|story|';
|
||||
$lang->my->menu->project = '我的项目|my|project|';
|
||||
$lang->my->menu->dynamic = '我的动态|my|dynamic|';
|
||||
$lang->my->menu->profile = array('link' => '我的档案|my|profile|', 'alias' => 'editprofile');
|
||||
$lang->todo->menu = $lang->my->menu;
|
||||
|
||||
|
||||
@@ -73,12 +73,16 @@ class index extends control
|
||||
$my['bugs'] = $this->dao->select('id, title')->from(TABLE_BUG)->where('assignedTo')->eq($this->session->user->account)->andWhere('deleted')->eq(0)->orderBy('id desc')->limit(10)->fetchPairs();
|
||||
$my['todos'] = $this->loadModel('todo')->getList('all', $this->session->user->account, 'wait, doing');
|
||||
|
||||
/* Set the dynamic pager. */
|
||||
$this->app->loadClass('pager', true);
|
||||
$pager = new pager(0, $this->config->index->dynamicCounts);
|
||||
|
||||
$this->view->projects = $projects;
|
||||
$this->view->projectsCount = $projectCount;
|
||||
$this->view->burns = $burns;
|
||||
$this->view->stats = $stats;
|
||||
$this->view->my = $my;
|
||||
$this->view->actions = $this->loadModel('action')->getDynamic('all', 23);
|
||||
$this->view->actions = $this->loadModel('action')->getDynamic('all', 'all', 'id_desc', $pager);
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->users['guest']= 'guest'; // append the guest account.
|
||||
$this->display();
|
||||
|
||||
@@ -313,4 +313,47 @@ class my extends control
|
||||
$this->view->user = $this->user->getById($this->app->user->id);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* My dynamic.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function dynamic($type = 'today', $orderBy = 'id_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);
|
||||
|
||||
/* Set the pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = pager::init($recTotal, $recPerPage, $pageID);
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->pager = $pager;
|
||||
|
||||
/* The header and position. */
|
||||
$this->view->header->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->dynamic;
|
||||
$this->view->position[] = $this->lang->my->dynamic;
|
||||
|
||||
/* Assign. */
|
||||
$this->view->type = $type;
|
||||
$this->view->actions = $this->loadModel('action')->getDynamic($this->app->user->account, $type, $orderBy, $pager);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ $lang->my->story = '我的需求';
|
||||
$lang->my->project = '我的项目';
|
||||
$lang->my->team = '我的团队';
|
||||
$lang->my->profile = '我的档案';
|
||||
$lang->my->dynamic = '我的动态';
|
||||
$lang->my->editProfile = '更新信息';
|
||||
|
||||
$lang->my->taskMenu->assignedToMe = '指派给我';
|
||||
|
||||
@@ -256,6 +256,28 @@ class todoModel extends model
|
||||
return date(DT_DATE1, strtotime('yesterday'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tomorrow.
|
||||
*
|
||||
* @access public
|
||||
* @return date
|
||||
*/
|
||||
public function tomorrow()
|
||||
{
|
||||
return date(DT_DATE1, strtotime('tomorrow'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the day before yesterday.
|
||||
*
|
||||
* @access public
|
||||
* @return date
|
||||
*/
|
||||
public function twoDaysAgo()
|
||||
{
|
||||
return date(DT_DATE1, strtotime('-2 days'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get now time period.
|
||||
*
|
||||
@@ -362,4 +384,18 @@ class todoModel extends model
|
||||
if($weekDay == 7) $baseTime = time() - 86400 * 10; // Make sure is last thursday.
|
||||
return $baseTime;
|
||||
}
|
||||
|
||||
public function getThisMonth()
|
||||
{
|
||||
$begin = date('Y-m');
|
||||
$end = date('Y-m', strtotime('next month'));
|
||||
return array('begin' => $begin, 'end' => $end);
|
||||
}
|
||||
|
||||
public function getLastMonth()
|
||||
{
|
||||
$begin = date('Y-m', strtotime('last month'));
|
||||
$end = date('Y-m', strtotime('this month'));
|
||||
return array('begin' => $begin, 'end' => $end);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user