+ add the feature of my stories in my control.

This commit is contained in:
wangchunsheng
2010-01-13 09:14:45 +00:00
parent 87d80e7fea
commit 0af32ef4ad
4 changed files with 71 additions and 3 deletions

View File

@@ -60,6 +60,7 @@ $lang->my->menu->account = '%s' . $lang->arrow;
$lang->my->menu->todo = array('link' => '我的TODO|my|todo|', 'subModule' => 'todo');
$lang->my->menu->task = '我的任务|my|task|';
$lang->my->menu->project = '我的项目|my|project|';
$lang->my->menu->story = '我的需求|my|story|';
$lang->my->menu->bug = '我的Bug|my|bug|';
$lang->my->menu->profile = array('link' => '我的档案|my|profile|', 'alias' => 'editprofile');
$lang->todo->menu = $lang->my->menu;

View File

@@ -64,6 +64,23 @@ class my extends control
$this->display();
}
/* 用户的story列表。*/
public function story()
{
/* 设定header和position信息。*/
$this->view->header->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->story;
$this->view->position[] = $this->lang->my->story;
/* 记录用户当前选择的列表。*/
$this->app->session->set('storyList', $this->app->getURI(true));
/* 赋值。*/
$this->view->stories = $this->loadModel('story')->getUserStories($this->app->user->account, 'doing,wait');
$this->view->users = $this->user->getPairs($this->app->company->id, 'noletter');
$this->display();
}
/* 用户的task列表。*/
public function task()
{

View File

@@ -22,6 +22,45 @@
* @link http://www.zentao.cn
*/
?>
<?php include './header.html.php';?>
<?php include './footer.html.php';?>
<?php include '../../common/header.html.php';?>
<?php include '../../common/tablesorter.html.php';?>
<div class='yui-d0'>
<table class='table-1 fixed tablesorter'>
<thead>
<tr class='colhead'>
<th><?php echo $lang->story->id;?></th>
<th><?php echo $lang->story->pri;?></th>
<th class='w-100px'><?php echo $lang->story->product;?></th>
<th class='w-p40'><?php echo $lang->story->title;?></th>
<th><?php echo $lang->story->plan;?></th>
<th><?php echo $lang->story->assignedTo;?></th>
<th><?php echo $lang->story->openedBy;?></th>
<th><?php echo $lang->story->estimate;?></th>
<th><?php echo $lang->story->status;?></th>
<th class='w-100px'><?php echo $lang->story->lastEditedDate;?></th>
<th><?php echo $lang->action;?></th>
</tr>
</thead>
<tbody>
<?php foreach($stories as $key => $story):?>
<tr class='a-center'>
<td><?php if(!common::printLink('story', 'view', "id=$story->id", sprintf('%03d', $story->id))) printf('%03d', $story->id);?></td>
<td><?php echo $story->pri;?></td>
<td><?php echo $story->productTitle;?></td>
<td class='a-left nobr'><?php echo $story->title;?></td>
<td><?php echo $story->planTitle;?></td>
<td><?php echo $users[$story->assignedTo];?></td>
<td><?php echo $users[$story->openedBy];?></td>
<td><?php echo $story->estimate;?></td>
<td class='<?php echo $story->status;?>'><?php $statusList = (array)$lang->story->statusList; echo $statusList[$story->status];?></td>
<td><?php echo substr($story->lastEditedDate, 5, 11);?></td>
<td>
<?php if(common::hasPriv('story', 'edit')) echo html::a($this->createLink('story', 'edit', "story={$story->id}"), $lang->edit);?>
<?php if(common::hasPriv('story', 'delete')) echo html::a($this->createLink('story', 'delete', "story={$story->id}&confirm=no"), $lang->delete, 'hiddenwin');?>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
<?php include '../../common/footer.html.php';?>

View File

@@ -167,6 +167,17 @@ class storyModel extends model
return $this->dao->select('*')->from(TABLE_STORY)->where('plan')->eq($planID)->onCaseOf($status != 'all')->andWhere('status')->in($status)->endCase()->fetchAll();
}
/* 获得指派给某一个用户的需求列表。*/
function getUserStories($account, $status = 'all', $orderBy = 'id|desc', $pager = null)
{
return $this->dao->select('t1.*, t2.title as planTitle, t3.name as productTitle')
->from(TABLE_STORY)->alias('t1')
->leftJoin(TABLE_PRODUCTPLAN)->alias('t2')->on('t1.plan = t2.id')
->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t1.product = t3.id')
->where('t1.assignedTo')->eq($account)
->orderBy($orderBy)->page($pager)->fetchAll();
}
/* 格式化需求显示。*/
private function formatStories($stories)
{