* finish task#1281.

This commit is contained in:
chencongzhi520@gmail.com
2013-04-29 03:30:48 +00:00
parent 76fdadde8e
commit 7e287be2ef
5 changed files with 15 additions and 5 deletions

View File

@@ -14,6 +14,7 @@ class action extends control
/**
* Trash
*
* @param string $type all|hidden
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
@@ -21,7 +22,7 @@ class action extends control
* @access public
* @return void
*/
public function trash($orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function trash($type = 'all', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
/* Save session. */
$uri = $this->app->getURI(true);
@@ -40,13 +41,14 @@ class action extends control
/* Get deleted objects. */
$this->app->loadClass('pager', $static = true);
$pager = pager::init($recTotal, $recPerPage, $pageID);
$trashes = $this->action->getTrashes($orderBy, $pager);
$trashes = $this->action->getTrashes($type, $orderBy, $pager);
/* Title and position. */
$this->view->title = $this->lang->action->trash;
$this->view->position[] = $this->lang->action->trash;
$this->view->trashes = $trashes;
$this->view->type = $type;
$this->view->orderBy = $orderBy;
$this->view->pager = $pager;
$this->view->users = $this->loadModel('user')->getPairs('noletter');

View File

@@ -39,6 +39,7 @@ $lang->action->dynamic->lastWeek = 'Last week';
$lang->action->dynamic->thisMonth = 'This month';
$lang->action->dynamic->lastMonth = 'Last month';
$lang->action->dynamic->all = 'All';
$lang->action->dynamic->hidden = 'Hidden';
$lang->action->dynamic->search = 'Search';
$lang->action->objectTypes['product'] = 'Product';

View File

@@ -39,6 +39,7 @@ $lang->action->dynamic->lastWeek = '上周';
$lang->action->dynamic->thisMonth = '本月';
$lang->action->dynamic->lastMonth = '上月';
$lang->action->dynamic->all = '所有';
$lang->action->dynamic->hidden = '已隐藏';
$lang->action->dynamic->search = '搜索';
$lang->action->objectTypes['product'] = '产品';

View File

@@ -213,16 +213,18 @@ class actionModel extends model
/**
* Get deleted objects.
*
* @param string $type all|hidden
* @param string $orderBy
* @param object $pager
* @access public
* @return array
*/
public function getTrashes($orderBy, $pager)
public function getTrashes($type, $orderBy, $pager)
{
$extra = $type == 'hidden' ? self::BE_HIDDEN : self::CAN_UNDELETED;
$trashes = $this->dao->select('*')->from(TABLE_ACTION)
->where('action')->eq('deleted')
->andWhere('extra')->eq(self::CAN_UNDELETED)
->andWhere('extra')->eq($extra)
->orderBy($orderBy)->page($pager)->fetchAll();
if(!$trashes) return array();

View File

@@ -13,6 +13,10 @@
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/colorize.html.php';?>
<table class='table-1 colored tablesorter'>
<caption class='caption-tr'>
<?php if($type == 'hidden') echo html::a($this->inLink('trash', "type=all"), $lang->goback);?>
<?php if($type == 'all') echo html::a($this->inLink('trash', "type=hidden"), $lang->action->dynamic->hidden);?>
</caption>
<?php $vars = "orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?>
<thead>
<tr class='colhead'>
@@ -36,7 +40,7 @@
<td>
<?php
common::printIcon('action', 'undelete', "actionid=$action->id", '', 'list', '', 'hiddenwin');
common::printIcon('action', 'hideOne', "actionid=$action->id", '', 'list', '', 'hiddenwin');
if($type == 'all') common::printIcon('action', 'hideOne', "actionid=$action->id", '', 'list', '', 'hiddenwin');
?>
</td>
</tr>