* Project add sort.
This commit is contained in:
@@ -275,6 +275,7 @@ class product extends control
|
||||
$this->view->title = $this->lang->product->create;
|
||||
$this->view->position[] = $this->view->title;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->program = $this->loadModel('program')->getParentPairs();
|
||||
$this->view->poUsers = $poUsers;
|
||||
$this->view->qdUsers = $qdUsers;
|
||||
$this->view->rdUsers = $rdUsers;
|
||||
@@ -334,8 +335,11 @@ class product extends control
|
||||
$this->view->title = $this->lang->product->edit . $this->lang->colon . $product->name;
|
||||
$this->view->position[] = html::a($this->createLink($this->moduleName, 'browse'), $product->name);
|
||||
$this->view->position[] = $this->lang->product->edit;
|
||||
|
||||
$this->view->product = $product;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->program = $this->loadModel('program')->getParentPairs();
|
||||
$this->view->poUsers = $poUsers;
|
||||
$this->view->poUsers = $poUsers;
|
||||
$this->view->qdUsers = $qdUsers;
|
||||
$this->view->rdUsers = $rdUsers;
|
||||
@@ -754,7 +758,7 @@ class product extends control
|
||||
$this->view->lines = array('') + $this->tree->getLinePairs();
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->programTree = $this->program->getPGMTreeMenu($programID, 'product');
|
||||
$this->view->programTree = $this->program->getPGMTreeMenu($programID, 'product', '&browseType=' . $browseType);
|
||||
$this->view->programID = $programID;
|
||||
$this->view->program = $program;
|
||||
$this->view->browseType = $browseType;
|
||||
|
||||
@@ -357,16 +357,16 @@ class productModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ordered products
|
||||
* Get ordered products.
|
||||
*
|
||||
* @param string $status
|
||||
* @param int $num
|
||||
* @param string $status
|
||||
* @param int $num
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getOrderedProducts($status, $num = 0)
|
||||
{
|
||||
$products = $this->getList($this->session->PRJ, $status);
|
||||
$products = $this->getList($this->session->program, $status);
|
||||
if(empty($products)) return $products;
|
||||
|
||||
$lines = $this->loadModel('tree')->getLinePairs($useShort = true);
|
||||
@@ -456,7 +456,6 @@ class productModel extends model
|
||||
{
|
||||
$product = fixer::input('post')
|
||||
->setIF($this->post->acl != 'custom', 'whitelist', '')
|
||||
->setDefault('program', $this->session->PRJ)
|
||||
->setDefault('status', 'normal')
|
||||
->setDefault('createdBy', $this->app->user->account)
|
||||
->setDefault('createdDate', helper::now())
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<?php $canOrder = common::hasPriv('product', 'updataOrder');?>
|
||||
<?php $canBatchEdit = common::hasPriv('product', 'batchEdit');?>
|
||||
<table id="productList" class="table has-sort-head table-fixed">
|
||||
<?php $vars = "programID=$programID&browseType=$browseType&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
|
||||
<?php $vars = "programID=$programID&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='c-id'>
|
||||
|
||||
@@ -21,26 +21,30 @@
|
||||
<form class="load-indicator main-form form-ajax" id="createForm" method="post" target='hiddenwin'>
|
||||
<table class="table table-form">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><?php echo $lang->program->PGMCommon;?></th>
|
||||
<td><?php echo html::select('program', $program, '', "class='form-control chosen'");?></td><td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='w-140px'><?php echo $lang->product->name;?></th>
|
||||
<td><?php echo html::input('name', '', "class='form-control input-product-title' required");?></td><td></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->product->code;?></th>
|
||||
<td><?php echo html::input('code', '', "class='form-control input-product-code' required");?></td><td></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->product->PO;?></th>
|
||||
<td><?php echo html::select('PO', $poUsers, $this->app->user->account, "class='form-control chosen'");?></td><td></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->product->QD;?></th>
|
||||
<td><?php echo html::select('QD', $qdUsers, '', "class='form-control chosen'");?></td><td></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->product->RD;?></th>
|
||||
<td><?php echo html::select('RD', $rdUsers, '', "class='form-control chosen'");?></td><td></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->product->type;?></th>
|
||||
<td>
|
||||
|
||||
@@ -28,11 +28,11 @@
|
||||
<tr>
|
||||
<th class='w-140px'><?php echo $lang->product->name;?></th>
|
||||
<td class='w-p40-f'><?php echo html::input('name', $product->name, "class='form-control' required");?></td><td></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->product->code;?></th>
|
||||
<td><?php echo html::input('code', $product->code, "class='form-control' required");?></td><td></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->product->PO;?></th>
|
||||
<td><?php echo html::select('PO', $poUsers, $product->PO, "class='form-control chosen'");?></td><td></td>
|
||||
@@ -40,19 +40,19 @@
|
||||
<tr>
|
||||
<th><?php echo $lang->product->QD;?></th>
|
||||
<td><?php echo html::select('QD', $qdUsers, $product->QD, "class='form-control chosen'");?></td><td></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->product->RD;?></th>
|
||||
<td><?php echo html::select('RD', $rdUsers, $product->RD, "class='form-control chosen'");?></td><td></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->product->type;?></th>
|
||||
<td><?php echo html::select('type', $lang->product->typeList, $product->type, "class='form-control'");?></td><td></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->product->status;?></th>
|
||||
<td><?php echo html::select('status', $lang->product->statusList, $product->status, "class='form-control'");?></td><td></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<?php $this->printExtendFields($product, 'table');?>
|
||||
<tr>
|
||||
<th><?php echo $lang->product->desc;?></th>
|
||||
|
||||
@@ -877,7 +877,6 @@ class program extends control
|
||||
|
||||
$project = $this->program->getPRJByID($projectID);
|
||||
$parents = $this->program->getParentPairs();
|
||||
unset($parents[$projectID]);
|
||||
|
||||
$this->view->title = $this->lang->program->PRJEdit;
|
||||
$this->view->position[] = $this->lang->program->PRJEdit;
|
||||
@@ -1280,4 +1279,25 @@ class program extends control
|
||||
$this->view->project = $project;
|
||||
$this->display('project', 'activate');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update projects order.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function PRJUpdateOrder()
|
||||
{
|
||||
$idList = explode(',', trim($this->post->projects, ','));
|
||||
$orderBy = $this->post->orderBy;
|
||||
if(strpos($orderBy, 'order') === false) return false;
|
||||
|
||||
$projects = $this->dao->select('id,`order`')->from(TABLE_PROJECT)->where('id')->in($idList)->orderBy($orderBy)->fetchPairs('order', 'id');
|
||||
foreach($projects as $order => $id)
|
||||
{
|
||||
$newID = array_shift($idList);
|
||||
if($id == $newID) continue;
|
||||
$this->dao->update(TABLE_PROJECT)->set('`order`')->eq($order)->where('id')->eq($newID)->exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,13 @@ $(function()
|
||||
$.cookie('PRJMine', PRJMine, {expires:config.cookieLife, path:config.webRoot});
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
$('#projectTableList').on('sort.sortable', function(e, data)
|
||||
{
|
||||
var list = '';
|
||||
for(i = 0; i < data.list.length; i++) list += $(data.list[i].item).attr('data-id') + ',';
|
||||
$.post(createLink('program', 'PRJUpdateOrder'), {'projects' : list, 'orderBy' : orderBy});
|
||||
});
|
||||
});
|
||||
|
||||
$('#project' + programID).addClass('active');
|
||||
|
||||
@@ -25,6 +25,7 @@ $lang->program->PRJExport = '导出';
|
||||
$lang->program->PRJManageGroupMember = '维护分组用户';
|
||||
$lang->program->PRJModuleSetting = '项目集设置';
|
||||
$lang->program->PRJModuleOpen = '列表页是否显示项目集名';
|
||||
$lang->program->PRJUpdateOrder = '排序';
|
||||
|
||||
/* Fields. */
|
||||
$lang->program->common = '项目';
|
||||
|
||||
@@ -711,12 +711,13 @@ class programModel extends model
|
||||
/**
|
||||
* Get the treemenu of program.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param int $productList
|
||||
* @param int $programID
|
||||
* @param int $productList
|
||||
* @param string $vars
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getPGMTreeMenu($programID = 0, $from = 'program')
|
||||
public function getPGMTreeMenu($programID = 0, $from = 'program', $vars = '')
|
||||
{
|
||||
$programMenu = array();
|
||||
$query = $this->dao->select('*')->from(TABLE_PROJECT)
|
||||
@@ -729,7 +730,7 @@ class programModel extends model
|
||||
|
||||
while($program = $stmt->fetch())
|
||||
{
|
||||
$link = $from == 'program' ? helper::createLink('program', 'pgmview', "programID=$program->id", '', '', $program->id) : helper::createLink('product', 'all', "programID=$program->id", '', '', $program->id);
|
||||
$link = $from == 'program' ? helper::createLink('program', 'pgmview', "programID=$program->id", '', '', $program->id) : helper::createLink('product', 'all', "programID=$program->id" . $vars, '', '', $program->id);
|
||||
$linkHtml = html::a($link, "<i class='icon icon-stack'></i> " . $program->name, '', "id='program$program->id' class='text-ellipsis' title=$program->name");
|
||||
|
||||
if(isset($programMenu[$program->id]) and !empty($programMenu[$program->id]))
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/sortable.html.php';?>
|
||||
<?php
|
||||
js::set('orderBy', $orderBy);
|
||||
js::set('programID', $programID);
|
||||
js::set('browseType', $browseType);
|
||||
?>
|
||||
@@ -35,7 +37,7 @@ js::set('browseType', $browseType);
|
||||
<?php common::printLink('program', 'createGuide', "programID=$programID", '<i class="icon icon-plus"></i>' . $lang->program->PRJCreate, '', 'class="btn btn-primary" data-toggle="modal" data-target="#guideDialog"');?>
|
||||
</div>
|
||||
</div>
|
||||
<div id='mainContent' class="main-row">
|
||||
<div id='mainContent' class="main-row fade">
|
||||
<div id="sidebar" class="side-col">
|
||||
<div class="sidebar-toggle"><i class="icon icon-angle-left"></i></div>
|
||||
<div class="cell">
|
||||
@@ -46,9 +48,9 @@ js::set('browseType', $browseType);
|
||||
</div>
|
||||
</div>
|
||||
<div class="main-col">
|
||||
<?php $canBatchEdit = common::hasPriv('project', 'batchEdit'); ?>
|
||||
<form class='main-table' id='projectsForm' method='post' action='<?php echo inLink('batchEdit', "programID=$programID");?>' data-ride='table'>
|
||||
<table class='table has-sort-head table-fixed' id='projectList'>
|
||||
<?php $canOrder = common::hasPriv('program', 'PRJOrderUpdate');?>
|
||||
<form class='main-table table-project' id='projectsForm' method='post' data-ride='table'>
|
||||
<table class='table has-sort-head table-fixed'>
|
||||
<?php $vars = "programID=$programID&browseType=$browseType¶m=$param&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -61,11 +63,14 @@ js::set('browseType', $browseType);
|
||||
<th class='w-80px'><?php echo $lang->program->PRJBudget;?></th>
|
||||
<th class='w-80px'><?php echo $lang->program->PRJPM;?></th>
|
||||
<th class='w-200px'><?php echo $lang->actions;?></th>
|
||||
<?php if($canOrder):?>
|
||||
<th class='w-70px sort-default'><?php common::printOrderLink('order', $orderBy, $vars, $lang->program->PRJUpdateOrder);?></th>
|
||||
<?php endif;?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody class="sortable" id='projectTableList'>
|
||||
<?php foreach($projectStats as $project):?>
|
||||
<tr>
|
||||
<tr data-id='<?php echo $project->id ?>' data-order='<?php echo $project->code;?>'>
|
||||
<td><?php printf('%03d', $project->id);?></td>
|
||||
<td class='text-left' title="<?php echo $project->code;?>"><?php echo $project->code;?></td>
|
||||
<td class='c-name text-left' title='<?php echo $project->name?>'>
|
||||
@@ -85,6 +90,9 @@ js::set('browseType', $browseType);
|
||||
<?php common::printIcon('program', 'PRJClose', "programID=$project->id", $project, 'list', 'off', '', 'iframe', true);?>
|
||||
<?php if(common::hasPriv('program', 'PRJEdit')) echo html::a($this->createLink("program", "PRJEdit", "programID=$project->id"), "<i class='icon-edit'></i>", '', "class='btn' title='{$lang->edit}'");?>
|
||||
</td>
|
||||
<?php if($canOrder):?>
|
||||
<td class='c-actions sort-handler'><i class="icon icon-move"></i></td>
|
||||
<?php endif;?>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user