* finish task #713.

This commit is contained in:
shiyangyangwork@yahoo.cn
2012-02-21 04:26:11 +00:00
parent 583c14024f
commit d5bee55d08
4 changed files with 71 additions and 4 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
$config->product->orderBy = 'code';
$config->product->orderBy = 'isClosed, `order`';
global $lang, $app;
$app->loadLang('story');
+19
View File
@@ -350,6 +350,25 @@ class product extends control
$this->display();
}
/**
* order product
*
* @param int $productID
* @access public
* @return void
*/
public function order($productID)
{
if($_POST)
{
$this->product->saveOrder();
die(js::reload('parent'));
}
$this->product->setMenu($this->products, $productID);
$this->view->products = $this->product->getList('noclosed');
$this->display();
}
/**
* AJAX: get projects of a product in html select.
*
+19 -3
View File
@@ -91,6 +91,20 @@ class productModel extends model
return $this->session->product;
}
/**
* Save order
*
* @access public
* @return void
*/
public function saveOrder()
{
foreach($_POST as $productID => $order)
{
$this->dao->update(TABLE_PRODUCT)->set('`order`')->eq($order)->where('id')->eq($productID)->exec();
}
}
/**
* Check privilege.
*
@@ -154,8 +168,10 @@ class productModel extends model
{
return $this->dao->select('*')->from(TABLE_PRODUCT)
->where('deleted')->eq(0)
->beginIF($status != 'all')->andWhere('status')->in($status)->fi()
->beginIF($status = 'noclosed')->andWhere('status')->ne('closed')->fi()
->beginIF($status != 'all' and $status != 'noclosed')->andWhere('status')->in($status)->fi()
->beginIF($limit > 0)->limit($limit)->fi()
->orderBy('`order` asc')
->fetchAll('id');
}
@@ -167,9 +183,9 @@ class productModel extends model
*/
public function getPairs($mode = '')
{
$orderBy = !empty($this->config->product->orderBy) ? $this->config->product->orderBy : 'code';
$orderBy = !empty($this->config->product->orderBy) ? $this->config->product->orderBy : 'isClosed, `order`';
$mode .= $this->cookie->productMode;
$products = $this->dao->select('*')
$products = $this->dao->select('*, IF(INSTR(" closed", status) < 2, 0, 1) AS isClosed')
->from(TABLE_PRODUCT)
->where('deleted')->eq(0)
->beginIF(strpos($mode, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi()
+32
View File
@@ -0,0 +1,32 @@
<?php
/**
* The order view file of product module of ZenTaoPMS.
*
* @copyright Copyright 2009-2012 QingDao Nature Easy Soft Network Technology Co,LTD (www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Yidong Wang <yidong@cnezsoft.com>
* @package product
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<form method='post' target='hiddenwin'>
<table align='center' class='table-5'>
<tr class='colhead'>
<th class='w-80px'><?php echo $lang->product->id?></th>
<th><?php echo $lang->product->name?></th>
<th class='w-80px'><?php echo $lang->product->order?></th>
</tr>
<?php foreach($products as $product):?>
<tr class='a-center'>
<td><?php echo $product->id?></td>
<td><?php echo $product->name?></td>
<td><?php echo html::input($product->id, $product->order, "size='5'")?></td>
</tr>
<?php endforeach;?>
<tr><td colspan='3' align='center'><?php echo html::submitButton() . html::resetButton()?></td></tr>
</table>
</form>
<?php include '../../common/view/footer.html.php';?>