* add server tablesorter for productplan list.

*  code for task#1609.
This commit is contained in:
azhi
2013-07-29 14:07:35 +08:00
parent be00ccf5d5
commit f7c5fdcc41
3 changed files with 16 additions and 12 deletions
+7 -4
View File
@@ -104,24 +104,27 @@ class productplan extends control
* Browse plans.
*
* @param int $product
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function browse($product = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1 )
public function browse($productID = 0, $orderBy = 'begin_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1 )
{
/* Load pager. */
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal, $recPerPage, $pageID);
$this->session->set('productPlanList', $this->app->getURI(true));
$this->commonAction($product);
$this->commonAction($productID);
$products = $this->product->getPairs();
$this->view->title = $products[$product] . $this->lang->colon . $this->lang->productplan->browse;
$this->view->title = $products[$productID] . $this->lang->colon . $this->lang->productplan->browse;
$this->view->position[] = $this->lang->productplan->browse;
$this->view->plans = $this->productplan->getList($product, $pager);
$this->view->productID = $productID;
$this->view->orderBy = $orderBy;
$this->view->plans = $this->productplan->getList($productID, $pager, $orderBy);
$this->view->pager = $pager;
$this->display();
}
+3 -2
View File
@@ -33,14 +33,15 @@ class productplanModel extends model
*
* @param int $product
* @param object $pager
* @param string $orderBy
* @access public
* @return object
*/
public function getList($product = 0, $pager = null)
public function getList($product = 0, $pager = null, $orderBy)
{
return $this->dao->select('*')->from(TABLE_PRODUCTPLAN)->where('product')->eq($product)
->andWhere('deleted')->eq(0)
->orderBy('begin desc')
->orderBy($orderBy)
->page($pager)
->fetchAll();
}
+6 -6
View File
@@ -11,19 +11,19 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/tablesorter.html.php';?>
<table class='table-1 tablesorter fixed' id="productplan">
<caption class='caption-tr'>
<div class='f-left'><?php echo $lang->productplan->browse;?></div>
<div class='f-right'><?php common::printIcon('productplan', 'create', "productID=$product->id");?></div>
</caption>
<thead>
<?php $vars = "productID=$productID&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?>
<tr class='colhead'>
<th class='w-id'><?php echo $lang->idAB;?></th>
<th><?php echo $lang->productplan->title;?></th>
<th class='w-p50'><?php echo $lang->productplan->desc;?></th>
<th class='w-100px'><?php echo $lang->productplan->begin;?></th>
<th class='w-100px'><?php echo $lang->productplan->end;?></th>
<th class='w-id'> <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th> <?php common::printOrderLink('title', $orderBy, $vars, $lang->productplan->title);?></th>
<th class='w-p50'> <?php common::printOrderLink('desc', $orderBy, $vars, $lang->productplan->desc);?></th>
<th class='w-100px'> <?php common::printOrderLink('begin', $orderBy, $vars, $lang->productplan->begin);?></th>
<th class='w-100px'> <?php common::printOrderLink('end', $orderBy, $vars, $lang->productplan->end);?></th>
<th class="w-80px {sorter: false}"><?php echo $lang->actions;?></th>
</tr>
</thead>