From b30722c4898d2e8fc2f4765540f92b5482276918 Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Tue, 22 Jan 2013 07:55:28 +0000 Subject: [PATCH] * adjust the todo menu in user-todo page. * sort the data on server side. --- module/user/control.php | 9 ++++++--- module/user/view/todo.html.php | 36 ++++++++++++++++------------------ 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/module/user/control.php b/module/user/control.php index 0060792244..03d2fef768 100644 --- a/module/user/control.php +++ b/module/user/control.php @@ -43,15 +43,16 @@ class user extends control * Todos of a user. * * @param string $account - * @param string $type the tod type, today|lastweek|thisweek|all|undone, or a date. + * @param string $type the todo type, today|lastweek|thisweek|all|undone, or a date. * @param string $status + * @param string $orderBy * @param int $recTotal * @param int $recPerPage * @param int $pageID * @access public * @return void */ - public function todo($account, $type = 'today', $status = 'all', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function todo($account, $type = 'today', $status = 'all', $orderBy='date,status,begin', $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Set thie url to session. */ $uri = $this->app->getURI(true); @@ -70,7 +71,7 @@ class user extends control /* Get user, totos. */ $user = $this->dao->findByAccount($account)->from(TABLE_USER)->fetch(); - $todos = $this->todo->getList($type, $account, $status, 0, $pager); + $todos = $this->todo->getList($type, $account, $status, 0, $pager, $orderBy); $date = (int)$type == 0 ? helper::today() : $type; $title = $this->lang->company->orgView . $this->lang->colon . $this->lang->user->todo; @@ -84,6 +85,8 @@ class user extends control $this->view->user = $user; $this->view->account = $account; $this->view->type = $type; + $this->view->status = $status; + $this->view->orderBy = $orderBy; $this->view->pager = $pager; $this->display(); diff --git a/module/user/view/todo.html.php b/module/user/view/todo.html.php index c7304dee1d..ea4dbb7252 100644 --- a/module/user/view/todo.html.php +++ b/module/user/view/todo.html.php @@ -11,7 +11,6 @@ */ ?> - requestType == 'GET' ? '&onlybody=yes' : '?onlybody=yes';?> @@ -22,13 +21,12 @@
user->todo; ?>
todo->todayTodos) . '
'; - echo html::a(inLink('todo', "account=$account&type=thisweek"), $lang->todo->thisWeekTodos) . '
'; - echo html::a(inLink('todo', "account=$account&type=lastweek"), $lang->todo->lastWeekTodos) . '
'; - echo html::a(inLink('todo', "account=$account&type=future"), $lang->todo->futureTodos) . '
'; - echo html::a(inLink('todo', "account=$account&type=all"), $lang->todo->allDaysTodos) . '
'; - echo html::a(inLink('todo', "account=$account&type=before"), $lang->todo->allUndone) . '
'; - echo html::input('date', $date, "class='w-date todo-date' onchange=changeDate(this.value)"); + foreach($lang->todo->periods as $period => $label) + { + $vars = "account={$app->user->account}&date=$period"; + if($period == 'before') $vars .= "&status=undone"; + echo "" . html::a(inlink('todo', $vars), $label) . '
'; + } ?>
@@ -36,24 +34,24 @@
' id='todoform'> + recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}"; ?> - - - - - - - - + + + + + + + + - - + @@ -63,7 +61,7 @@ - +
idAB;?>todo->date;?>todo->type;?>priAB;?>todo->name;?>todo->beginAB;?>todo->endAB;?>todo->status;?> idAB);?>todo->date);?>todo->type);?> priAB);?> todo->name);?>todo->beginAB);?>todo->endAB);?>todo->status);?>
id;?>date == '2030-01-01' ? $lang->todo->dayInFuture : $todo->date;?>date == '2030-01-01' ? $lang->todo->periods['future'] : $todo->date;?> todo->typeList[$todo->type];?> pri;?>'>pri?> createLink('todo', 'view', "id=$todo->id") . $onlybody, $todo->name, '', "class='colorbox'");?>
show();?>
show();?>