* adjust the todo menu in user-todo page.

* sort the data on server side.
This commit is contained in:
wangchunsheng
2013-01-22 07:55:28 +00:00
parent b29c436fae
commit b30722c489
2 changed files with 23 additions and 22 deletions

View File

@@ -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();

View File

@@ -11,7 +11,6 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/tablesorter.html.php';?>
<?php include "../../common/view/datepicker.html.php"; ?>
<?php include './featurebar.html.php';?>
<?php $onlybody = $config->requestType == 'GET' ? '&onlybody=yes' : '?onlybody=yes';?>
@@ -22,13 +21,12 @@
<div class='box-title'><?php echo $lang->user->todo; ?></div>
<div class='box-content'>
<?php
echo html::a(inLink('todo', "account=$account&type=today"), $lang->todo->todayTodos) . '<br />';
echo html::a(inLink('todo', "account=$account&type=thisweek"), $lang->todo->thisWeekTodos) . '<br />';
echo html::a(inLink('todo', "account=$account&type=lastweek"), $lang->todo->lastWeekTodos) . '<br />';
echo html::a(inLink('todo', "account=$account&type=future"), $lang->todo->futureTodos) . '<br />';
echo html::a(inLink('todo', "account=$account&type=all"), $lang->todo->allDaysTodos) . '<br />';
echo html::a(inLink('todo', "account=$account&type=before"), $lang->todo->allUndone) . '<br />';
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 "<span id='$period'>" . html::a(inlink('todo', $vars), $label) . '</span><br />';
}
?>
</div>
</td>
@@ -36,24 +34,24 @@
<td>
<form method='post' target='hiddenwin' action='<?php echo $this->createLink('todo', 'import2Today');?>' id='todoform'>
<table class='table-1 tablesorter'>
<?php $vars = "type=$type&account=$account&status=$status&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}"; ?>
<thead>
<tr class='colhead'>
<th class='w-id'><?php echo $lang->idAB;?></th>
<th class='w-date'><?php echo $lang->todo->date;?></th>
<th class='w-type'><?php echo $lang->todo->type;?></th>
<th class='w-pri'><?php echo $lang->priAB;?></th>
<th><?php echo $lang->todo->name;?></th>
<th class='w-hour'><?php echo $lang->todo->beginAB;?></th>
<th class='w-hour'><?php echo $lang->todo->endAB;?></th>
<th class='w-status'><?php echo $lang->todo->status;?></th>
<th class='w-id'> <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th class='w-date'><?php common::printOrderLink('date', $orderBy, $vars, $lang->todo->date);?></th>
<th class='w-type'><?php common::printOrderLink('type', $orderBy, $vars, $lang->todo->type);?></th>
<th class='w-pri'> <?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
<th> <?php common::printOrderLink('name', $orderBy, $vars, $lang->todo->name);?></th>
<th class='w-hour'><?php common::printOrderLink('begin', $orderBy, $vars, $lang->todo->beginAB);?></th>
<th class='w-hour'><?php common::printOrderLink('end', $orderBy, $vars, $lang->todo->endAB);?></th>
<th class='w-status'><?php common::printOrderLink('status', $orderBy, $vars, $lang->todo->status);?></th>
</tr>
</thead>
<tbody>
<?php foreach($todos as $todo):?>
<tr class='a-center'>
<td><?php echo $todo->id;?></td>
<td><?php echo $todo->date == '2030-01-01' ? $lang->todo->dayInFuture : $todo->date;?></td>
<td><?php echo $todo->date == '2030-01-01' ? $lang->todo->periods['future'] : $todo->date;?></td>
<td><?php echo $lang->todo->typeList[$todo->type];?></td>
<td><span class='<?php echo 'pri' . $todo->pri;?>'><?php echo $todo->pri?></span></td>
<td class='a-left'><?php echo html::a($this->createLink('todo', 'view', "id=$todo->id") . $onlybody, $todo->name, '', "class='colorbox'");?></td>
@@ -63,7 +61,7 @@
</tr>
<?php endforeach;?>
</tbody>
<?php if($type == 'all'):?><tfoot><tr><td colspan='8'><?php $pager->show();?></td></tr></tfoot><?php endif;?>
<tfoot><tr><td colspan='8'><?php $pager->show();?></td></tr></tfoot>
</table>
</form>
</td>