* finish task #713.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
$config->product->orderBy = 'code';
|
||||
$config->product->orderBy = 'isClosed, `order`';
|
||||
|
||||
global $lang, $app;
|
||||
$app->loadLang('story');
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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';?>
|
||||
|
||||
Reference in New Issue
Block a user