adding the processes pagging toolbar

This commit is contained in:
Erik Amaru Ortiz
2011-02-07 16:04:51 +00:00
parent 9d3cd25bf4
commit 73cdf51d10
5 changed files with 83 additions and 13 deletions

View File

@@ -443,5 +443,18 @@ class Configurations // extends Configuration
return $dateTime;
}
function getEnvSetting($key=null)
{
$this->loadConfig($obj, 'ENVIRONMENT_SETTINGS','');
if( isset($key) ) {
if( isset($this->aConfig[$key]) ) {
return $this->aConfig[$key];
} else
return '';
} else
return $this->aConfig;
}
}
?>

View File

@@ -511,20 +511,20 @@ class Process extends BaseProcess {
$oCriteria->addJoin(ProcessPeer::PRO_CREATE_USER, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
$oCriteria->addJoin(ProcessPeer::PRO_CATEGORY, ProcessCategoryPeer::CATEGORY_UID, Criteria::LEFT_JOIN);
$oCriteria->addDescendingOrderByColumn(ProcessPeer::PRO_CREATE_DATE);
//$oCriteria->addDescendingOrderByColumn(ProcessPeer::PRO_CREATE_DATE);
/*if($start != '')
$this->tmpCriteria = clone $oCriteria;
if($start != '')
$oCriteria->setOffset($start);
if($limit != '')
$oCriteria->setLimit($limit);
*/
//execute a query to obtain numbers, how many cases there are by process
$casesCnt = $this->getCasesCountInAllProcesses();
//execute the query
$this->tmpCriteria = $oCriteria;
$oDataset = ProcessPeer::doSelectRS ( $oCriteria );
$oDataset->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
$processes = Array();
@@ -611,6 +611,8 @@ class Process extends BaseProcess {
$aProcesses[] = $process;
}
usort($aProcesses, 'ordProcessByProTitle');
return $aProcesses;
}
@@ -638,3 +640,15 @@ class Process extends BaseProcess {
return $aProcesses;
}
} // Process
function ordProcessByProTitle($a, $b){
if ($a['PRO_TITLE']>$b['PRO_TITLE']) {
return 1;
} elseif ($a['PRO_TITLE']<$b['PRO_TITLE']) {
return -1;
} else {
return 0;
}
}

View File

@@ -24,6 +24,8 @@
*/
$oHeadPublisher =& headPublisher::getSingleton();
G::loadClass('configuration');
$conf = new Configurations;
$oHeadPublisher->addExtJsScript('processes/main', false ); //adding a javascript file .js
$oHeadPublisher->addContent('processes/main'); //adding a html file .html.
@@ -35,6 +37,9 @@
'ID_SELECT', 'ID_SEARCH', 'ID_NO_SELECTION_WARNING', 'ID_PROCESS_DELETE_LABEL', 'ID_PROCESS_DELETE_ALL_LABEL',
'ID_PROCESS_CANT_DELETE', 'ID_EDIT_BPMN'
));
$oHeadPublisher->assign('pageSize', $conf->getEnvSetting('casesListRowNumber'));
$oHeadPublisher->assign('TRANSLATIONS', $translations);
G::RenderPage('publish', 'extJs');

View File

@@ -44,6 +44,7 @@ else {
}
$r->data = $proData;
$r->totalCount = count($proData); //$oProcess->getAllProcessesCount();
//$r->totalCount = count($proData);
$r->totalCount = $oProcess->getAllProcessesCount();
echo G::json_encode($r);

View File

@@ -22,7 +22,7 @@ new Ext.KeyMap(document, {
Ext.onReady(function(){
//Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
Ext.QuickTips.init();
store = new Ext.data.GroupingStore( {
@@ -107,7 +107,44 @@ Ext.onReady(function(){
store.load({params:{category: filter, start : 0 , limit : 25 }});
}}
})
/* storePageSize = new Ext.data.SimpleStore({
fields: ['size'],
data: [['20'],['30'],['40'],['50'],['100']],
autoLoad: true
});
var comboPageSize = new Ext.form.ComboBox({
typeAhead : false,
mode : 'local',
triggerAction : 'all',
store: storePageSize,
valueField: 'size',
displayField: 'size',
width: 50,
editable: false,
listeners:{
select: function(c,d,i){
//UpdatePageConfig(d.data['size']);
bbar.pageSize = parseInt(d.data['size']);
bbar.moveFirst();
//Ext.getCmp('bbar').setPageSize(comboPageSize.getValue());
}
}
});
comboPageSize.setValue(pageSize);
var bbar = new Ext.PagingToolbar({
id: 'bbar',
pageSize: '15',
store: store,
displayInfo: true,
displayMsg: 'Displaying Processes {0} - {1} of {2}',
emptyMsg: "",
items:[_('ID_PAGE_SIZE')+':',comboPageSize]
}) */
processesGrid = new Ext.grid.GridPanel( {
region: 'center',
layout: 'fit',
@@ -253,14 +290,14 @@ Ext.onReady(function(){
}
],
// paging bar on the bottom
/*bbar: new Ext.PagingToolbar({
bbar: new Ext.PagingToolbar({
pageSize: 15,
store: store,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display",
displayMsg: 'Displaying Processes {0} - {1} of {2}',
emptyMsg: "",
items:[]
}),*/
}),
listeners: {
rowdblclick: editProcess,
rowclick: function(){