+ add the feature of import 2 today.

This commit is contained in:
wangchunsheng
2009-11-06 08:16:52 +00:00
parent 914fe6392f
commit 7637f3e313
6 changed files with 47 additions and 11 deletions

View File

@@ -46,16 +46,19 @@ class my extends control
$header['title'] = $this->lang->my->common . $this->lang->colon . $this->lang->my->todo;
$position[] = $this->lang->my->todo;
$importFeature = ($date == 'before');
$todos = $this->todo->getList($date, $account, $status);
if((int)$date == 0) $date = $this->todo->today();
/* 赋值。*/
$this->assign('header', $header);
$this->assign('position', $position);
$this->assign('tabID', 'todo');
$this->assign('dates', $this->todo->buildDateList());
$this->assign('date', $date);
$this->assign('todos', $todos);
$this->assign('header', $header);
$this->assign('position', $position);
$this->assign('tabID', 'todo');
$this->assign('dates', $this->todo->buildDateList());
$this->assign('date', $date);
$this->assign('todos', $todos);
$this->assign('importFeature', $importFeature);
$this->display();
}

View File

@@ -98,7 +98,7 @@ EOT;
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=all"), $lang->todo->allDaysTodos);
echo html::a($this->createLink('my', 'todo', "date=all&account={$app->user->account}&status=wait,doing"), $lang->todo->allUndone);
echo html::a($this->createLink('my', 'todo', "date=before&account={$app->user->account}&status=wait,doing"), $lang->todo->allUndone);
echo html::select('date', $dates, $date, 'onchange=changeDate(this.value)');
echo html::a($this->createLink('todo', 'create', "date=$date"), $lang->todo->create);

View File

@@ -23,6 +23,7 @@
*/
?>
<?php include './header.html.php';?>
<form method='post' target='hiddenwin' action='<?php echo $this->createLink('todo', 'import2Today');?>'>
<table class='table-1 tablesorter'>
<thead>
<tr>
@@ -33,7 +34,6 @@
<th><?php echo $lang->todo->name;?></th>
<th><?php echo $lang->todo->begin;?></th>
<th><?php echo $lang->todo->end;?></th>
<!--<th><?php echo $lang->todo->desc;?></th>-->
<th><?php echo $lang->todo->status;?></th>
<th><?php echo $lang->action;?></th>
</tr>
@@ -41,7 +41,12 @@
<tbody>
<?php foreach($todos as $todo):?>
<tr class='a-center'>
<td><?php echo $todo->id;?></td>
<td>
<?php
if($importFeature) echo "<input type='checkbox' name='todos[]' value='$todo->id' /> ";
echo $todo->id;
?>
</td>
<td><?php echo $todo->date;?></td>
<td><?php echo $lang->todo->typeList->{$todo->type};?></td>
<td><?php echo $todo->pri;?></td>
@@ -55,7 +60,6 @@
</td>
<td><?php echo $todo->begin;?></td>
<td><?php echo $todo->end;?></td>
<!--<td><?php echo $todo->desc;?></td>-->
<td class='<?php echo $todo->status;?>'><?php echo $lang->todo->statusList->{$todo->status};?></td>
<td>
<?php
@@ -66,6 +70,14 @@
</td>
</tr>
<?php endforeach;?>
<?php if($importFeature):?>
<tr>
<td colspan='9'>
<input type='submit' value='<?php echo $lang->todo->toToday;?>' />
</td>
</tr>
<?php endif;?>
</tbody>
</table>
</form>
<?php include './footer.html.php';?>

View File

@@ -104,4 +104,13 @@ class todo extends control
$this->todo->mark($todoID, $status);
die(js::reload('parent'));
}
/* 批量导入今天。*/
public function import2Today()
{
$todos = $this->post->todos;
$today = $this->todo->today();
$this->dao->update(TABLE_TODO)->set('date')->eq($today)->where('id')->in($todos)->exec();
die(js::reload('parent'));
}
}

View File

@@ -31,6 +31,7 @@ $lang->todo->markDoing = "已完成";
$lang->todo->mark = "更改状态";
$lang->todo->delete = "删除";
$lang->todo->browse = "浏览TODO";
$lang->todo->toToday = "导入到今天";
$lang->todo->id = '编号';
$lang->todo->date = '日期';
@@ -69,6 +70,6 @@ $lang->todo->lblDisableDate = '暂时不设定时间';
$lang->todo->thisWeekTodos = '本周计划';
$lang->todo->lastWeekTodos = '上周总结';
$lang->todo->allDaysTodos = '所有任务';
$lang->todo->allUndone = '所有未作';
$lang->todo->allUndone = '之前未完';
$lang->todo->todayTodos = '今日安排';

View File

@@ -105,6 +105,11 @@ class todoModel extends model
$begin = '1970-01-01';
$end = '2109-01-01';
}
elseif($date == 'before')
{
$begin = '1970-01-01';
$end = $this->yesterday();
}
else
{
$begin = $end = $date;
@@ -182,6 +187,12 @@ class todoModel extends model
return date('Ymd', time());
}
/* 获得昨天的日期。*/
public function yesterday()
{
return date('Y-m-d', strtotime('yesterday'));
}
/* 获得当前的时间。*/
public function now($delta = 15)
{