* getProjectStoryPair(): set the product name and module name.

This commit is contained in:
wangchunsheng
2009-11-03 01:41:39 +00:00
parent 211b03cf02
commit c0ee774c4d
4 changed files with 40 additions and 14 deletions
+4
View File
@@ -95,6 +95,10 @@ EOT;
<div>
<?php
echo html::select('date', $dates, $date, 'onchange=changeDate(this.value)');
echo html::a($this->createLink('my', 'todo', "date=thisweek"), $lang->todo->thisWeekTodos);
echo html::a($this->createLink('my', 'todo', "date=lastweek"), $lang->todo->lastWeekTodos);
echo html::a($this->createLink('my', 'todo', "date=alldays"), $lang->todo->allDaysTodos);
echo html::a($this->createLink('my', 'todo', "date=allundone"), $lang->todo->allUndone);
echo html::a($this->createLink('todo', 'create', "date=$date"), $lang->todo->create);
?>
</div>
+17 -5
View File
@@ -105,11 +105,23 @@ class storyModel extends model
/* 获得某一个项目相关的需求id=>title的列表。*/
function getProjectStoryPair($projectID = 0)
{
$projectID = (int)$projectID;
if($projectID == 0) return false;
$sql = "SELECT T2.id, T2.title FROM " . TABLE_PROJECTSTORY . " AS T1 LEFT JOIN " . TABLE_STORY . " AS T2 ON T1.story = T2.id
WHERE T1.project = '$projectID'";
return $this->fetchPairs($sql);
$stories = $this->dao->select('t2.id, t2.title, t2.module, t3.name AS product')
->from(TABLE_PROJECTSTORY)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')
->on('t1.story = t2.id')
->leftJoin(TABLE_PRODUCT)->alias('t3')
->on('t1.product = t3.id')
->where('t1.project')->eq((int)$projectID)
->fetchAll();
/* 查找每个story所对应的模块名称。*/
foreach($stories as $story) $modules[] = $story->module;
$moduleNames = $this->dao->select('id, name')->from(TABLE_MODULE)->where('id')->in($modules)->fetchPairs();
/* 重新组织每一个story的展示方式。*/
$storyPairs = array();
foreach($stories as $story) $storyPairs[$story->id] = $story->product . '/' . ($story->module > 0 ? $moduleNames[$story->module] . '/' : '') . $story->title;
return $storyPairs;
}
/* 从story列表中提取所有出现过的账户。*/
+15 -9
View File
@@ -32,11 +32,6 @@ $lang->todo->mark = "更改状态";
$lang->todo->delete = "删除";
$lang->todo->browse = "浏览TODO";
$lang->todo->confirmDelete = "您确定要删除这个todo吗?";
$lang->todo->successMarked = "成功切换状态!";
$lang->todo->thisIsPrivate = '这是一条私人事务。:)';
$lang->todo->lblDisableDate = '暂时不设定时间';
$lang->todo->id = '编号';
$lang->todo->date = '日期';
$lang->todo->begin = '开始时间';
@@ -57,11 +52,22 @@ $lang->todo->statusList->wait = '未开始';
$lang->todo->statusList->doing = '进行中';
$lang->todo->statusList->done = '已完成';
$lang->todo->priList->item3 = '一般';
$lang->todo->priList->item1 = '最高';
$lang->todo->priList->item2 = '较高';
$lang->todo->priList->item4 = '最低';
$lang->todo->priList[3] = '一般';
$lang->todo->priList[1] = '最高';
$lang->todo->priList[2] = '较高';
$lang->todo->priList[4] = '最低';
$lang->todo->typeList->custom = '自定义';
$lang->todo->typeList->bug = 'Bug';
$lang->todo->typeList->task = '项目任务';
$lang->todo->confirmDelete = "您确定要删除这个todo吗?";
$lang->todo->successMarked = "成功切换状态!";
$lang->todo->thisIsPrivate = '这是一条私人事务。:)';
$lang->todo->lblDisableDate = '暂时不设定时间';
$lang->todo->thisWeekTodos = '本周计划';
$lang->todo->lastWeekTodos = '上周总结';
$lang->todo->allDaysTodos = '所有任务';
$lang->todo->allUndone = '所有未作';
+4
View File
@@ -86,6 +86,10 @@ class todoModel extends model
/* 获得用户的todo列表。*/
public function getList($date = 'today', $account = '')
{
// echo date('Y-m-d', strtotime('last monday'));
// echo date('Y-m-d', strtotime('last sunday'));
// echo date('Y-m-d', strtotime('this sunday'));
// echo date('Y-m-d', strtotime('this monday'));
$todos = array();
if($date == 'today') $date = $this->today();
if($account == '') $account = $this->app->user->account;