Merged in norah/processmaker/PM-813 (pull request #1194)

PM-813 Process Category List
This commit is contained in:
Julio Cesar Laura Avendaño
2014-11-12 14:13:48 -04:00
2 changed files with 18 additions and 8 deletions

View File

@@ -35,6 +35,8 @@ if (isset( $_REQUEST['action'] )) {
$start = isset( $_POST['start'] ) ? $_POST['start'] : 0; $start = isset( $_POST['start'] ) ? $_POST['start'] : 0;
$limit = isset( $_POST['limit'] ) ? $_POST['limit'] : $limit_size; $limit = isset( $_POST['limit'] ) ? $_POST['limit'] : $limit_size;
$filter = isset( $_REQUEST['textFilter'] ) ? $_REQUEST['textFilter'] : ''; $filter = isset( $_REQUEST['textFilter'] ) ? $_REQUEST['textFilter'] : '';
$dir = isset( $_POST['dir'] ) ? $_POST['dir'] : 'ASC';
$sort = isset( $_POST['sort'] ) ? $_POST['sort'] : 'CATEGORY_NAME';
$oCriteria = new Criteria( 'workflow' ); $oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( 'COUNT(*) AS CNT' ); $oCriteria->addSelectColumn( 'COUNT(*) AS CNT' );
@@ -55,6 +57,13 @@ if (isset( $_REQUEST['action'] )) {
if ($filter != '') { if ($filter != '') {
$oCriteria->add( ProcessCategoryPeer::CATEGORY_NAME, '%' . $filter . '%', Criteria::LIKE ); $oCriteria->add( ProcessCategoryPeer::CATEGORY_NAME, '%' . $filter . '%', Criteria::LIKE );
} }
if ($dir == "DESC") {
$oCriteria->addDescendingOrderByColumn($sort);
} else {
$oCriteria->addAscendingOrderByColumn($sort);
}
$oCriteria->setLimit( $limit ); $oCriteria->setLimit( $limit );
$oCriteria->setOffset( $start ); $oCriteria->setOffset( $start );
$oDataset = ProcessCategoryPeer::doSelectRS( $oCriteria ); $oDataset = ProcessCategoryPeer::doSelectRS( $oCriteria );
@@ -62,14 +71,16 @@ if (isset( $_REQUEST['action'] )) {
$proc = new Process(); $proc = new Process();
$aProcess = $proc->getAllProcessesByCategory(); $aProcess = $proc->getAllProcessesByCategory();
$result = "";
$aCat = array (); $aCat = array ();
while ($oDataset->next()) { while ($oDataset->next()) {
$aCat[] = $oDataset->getRow(); $aCat[] = $oDataset->getRow();
$index = sizeof( $aCat ) - 1; $index = sizeof( $aCat ) - 1;
$aCat[$index]['TOTAL_PROCESSES'] = isset( $aProcess[$aCat[$index]['CATEGORY_UID']] ) ? $aProcess[$aCat[$index]['CATEGORY_UID']] : 0; $aCat[$index]['TOTAL_PROCESSES'] = isset( $aProcess[$aCat[$index]['CATEGORY_UID']] ) ? $aProcess[$aCat[$index]['CATEGORY_UID']] : 0;
} }
echo '{categories: ' . G::json_encode( $aCat ) . ', total_categories: ' . $total_categories . '}'; $result['data'] = $aCat;
$result['totalCount'] = $total_categories;
echo G::json_encode( $result );
break; break;
case 'updatePageSize': case 'updatePageSize':
G::LoadClass( 'configuration' ); G::LoadClass( 'configuration' );

View File

@@ -160,13 +160,14 @@ Ext.onReady(function(){
} }
}); });
store = new Ext.data.GroupingStore( { store = new Ext.data.GroupingStore({
remoteSort: true,
proxy : new Ext.data.HttpProxy({ proxy : new Ext.data.HttpProxy({
url: 'processCategory_Ajax?action=processCategoryList' url: 'processCategory_Ajax?action=processCategoryList'
}), }),
reader : new Ext.data.JsonReader( { reader : new Ext.data.JsonReader({
root: 'categories', totalProperty: 'totalCount',
totalProperty: 'total_categories', root: 'data',
fields : [ fields : [
{name : 'CATEGORY_UID'}, {name : 'CATEGORY_UID'},
{name : 'CATEGORY_PARENT'}, {name : 'CATEGORY_PARENT'},
@@ -176,7 +177,6 @@ Ext.onReady(function(){
] ]
}) })
}); });
cmodel = new Ext.grid.ColumnModel({ cmodel = new Ext.grid.ColumnModel({
defaults: { defaults: {
width: 50, width: 50,
@@ -274,7 +274,6 @@ Ext.onReady(function(){
); );
infoGrid.addListener('rowcontextmenu',onMessageContextMenu,this); infoGrid.addListener('rowcontextmenu',onMessageContextMenu,this);
infoGrid.store.load(); infoGrid.store.load();
viewport = new Ext.Viewport({ viewport = new Ext.Viewport({