Merge pull request #772 from Jennydmz/master

CODE STYLE methods/processes/* methods/report/* methods/reportTables/*
This commit is contained in:
ferOnti
2012-10-17 09:51:15 -07:00
11 changed files with 1063 additions and 1155 deletions

View File

@@ -1,80 +1,75 @@
<?php
$id = isset($_GET['id']) ? $_GET['id'] : false;
$id = isset( $_GET['id'] ) ? $_GET['id'] : false;
$table = false;
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('reportTables/edit', true );
$oHeadPublisher->assign('ADD_TAB_UID', $id);
$oHeadPublisher->addExtJsScript( 'reportTables/edit', true );
$oHeadPublisher->assign( 'ADD_TAB_UID', $id );
if ($id) { // if is a edit request
require_once 'classes/model/AdditionalTables.php';
require_once 'classes/model/Fields.php';
G::LoadClass('xmlfield_InputPM');
require_once 'classes/model/AdditionalTables.php';
require_once 'classes/model/Fields.php';
G::LoadClass( 'xmlfield_InputPM' );
$additionalTables = new AdditionalTables();
$table = $additionalTables->load($id, true);
$tableFields = array();
$fieldsList = array();
$additionalTables = new AdditionalTables();
$table = $additionalTables->load( $id, true );
$tableFields = array ();
$fieldsList = array ();
// list the case fields
foreach ($table['FIELDS'] as $i=>$field) {
/*if ($field['FLD_NAME'] == 'APP_UID' || $field['FLD_NAME'] == 'APP_NUMBER' || $field['FLD_NAME'] == 'ROW') {
// list the case fields
foreach ($table['FIELDS'] as $i => $field) {
/*if ($field['FLD_NAME'] == 'APP_UID' || $field['FLD_NAME'] == 'APP_NUMBER' || $field['FLD_NAME'] == 'ROW') {
unset($table['FIELDS'][$i]);
continue;
}*/
array_push($tableFields, $field['FLD_DYN_NAME']);
}
//list dynaform fields
if ($table['ADD_TAB_TYPE'] == 'NORMAL') {
$fields = getDynaformsVars($table['PRO_UID'], false);
foreach ($fields as $field) {
//select to not assigned fields for available grid
if (!in_array($field['sName'], $tableFields)) {
$fieldsList[] = array(
'FIELD_UID' => $field['sName'] . '-' . $field['sType'],
'FIELD_NAME' => $field['sName']
);
}
array_push( $tableFields, $field['FLD_DYN_NAME'] );
}
} else {
list($gridName, $gridId) = explode('-', $table['ADD_TAB_GRID']);
$G_FORM = new Form($table['PRO_UID'] . '/' . $gridId, PATH_DYNAFORM, SYS_LANG, false);
$gridFields = $G_FORM->getVars(false);
foreach ($gridFields as $gfield) {
if (!in_array($gfield['sName'], $tableFields)) {
$fieldsList[] = array(
'FIELD_UID' => $gfield['sName'] . '-' . $gfield['sType'],
'FIELD_NAME' => $gfield['sName']
);
}
}
}
$oHeadPublisher->assign('avFieldsList', $fieldsList);
//list dynaform fields
if ($table['ADD_TAB_TYPE'] == 'NORMAL') {
$fields = getDynaformsVars( $table['PRO_UID'], false );
foreach ($fields as $field) {
//select to not assigned fields for available grid
if (! in_array( $field['sName'], $tableFields )) {
$fieldsList[] = array ('FIELD_UID' => $field['sName'] . '-' . $field['sType'],'FIELD_NAME' => $field['sName']
);
}
}
} else {
list ($gridName, $gridId) = explode( '-', $table['ADD_TAB_GRID'] );
$G_FORM = new Form( $table['PRO_UID'] . '/' . $gridId, PATH_DYNAFORM, SYS_LANG, false );
$gridFields = $G_FORM->getVars( false );
foreach ($gridFields as $gfield) {
if (! in_array( $gfield['sName'], $tableFields )) {
$fieldsList[] = array ('FIELD_UID' => $gfield['sName'] . '-' . $gfield['sType'],'FIELD_NAME' => $gfield['sName']
);
}
}
}
$oHeadPublisher->assign( 'avFieldsList', $fieldsList );
}
$repTabPluginPermissions = false;
global $G_TMP_MENU;
$oMenu = new Menu();
$oMenu->load('setup');
$oMenu->load( 'setup' );
foreach( $oMenu->Options as $i=>$option) {
if ($oMenu->Types[$i] == 'private' && $oMenu->Id[$i] == 'PLUGIN_REPTAB_PERMISSIONS') {
$repTabPluginPermissions = array();
$repTabPluginPermissions['label'] = $oMenu->Labels[$i];
$repTabPluginPermissions['fn'] = $oMenu->Options[$i];
break;
}
foreach ($oMenu->Options as $i => $option) {
if ($oMenu->Types[$i] == 'private' && $oMenu->Id[$i] == 'PLUGIN_REPTAB_PERMISSIONS') {
$repTabPluginPermissions = array ();
$repTabPluginPermissions['label'] = $oMenu->Labels[$i];
$repTabPluginPermissions['fn'] = $oMenu->Options[$i];
break;
}
}
$oHeadPublisher->assign('_plugin_permissions', $repTabPluginPermissions);
$oHeadPublisher->assign( '_plugin_permissions', $repTabPluginPermissions );
$oHeadPublisher->assign('PRO_UID', isset($_GET['PRO_UID'])? $_GET['PRO_UID'] : false);
$oHeadPublisher->assign('TABLE', $table);
$oHeadPublisher->assign( 'PRO_UID', isset( $_GET['PRO_UID'] ) ? $_GET['PRO_UID'] : false );
$oHeadPublisher->assign( 'TABLE', $table );
G::RenderPage('publish', 'extJs');
G::RenderPage( 'publish', 'extJs' );

View File

@@ -12,48 +12,47 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
$RBAC->requirePermissions('PM_SETUP_ADVANCE');
$G_PUBLISH = new Publisher;
$RBAC->requirePermissions( 'PM_SETUP_ADVANCE' );
$G_PUBLISH = new Publisher();
G::LoadClass('configuration');
G::LoadClass( 'configuration' );
$c = new Configurations();
$configPage = $c->getConfiguration('additionalTablesList', 'pageSize','',$_SESSION['USER_LOGGED']);
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
$configPage = $c->getConfiguration( 'additionalTablesList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
$Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20;
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher = & headPublisher::getSingleton();
$repTabPluginPermissions = false;
global $G_TMP_MENU;
$oMenu = new Menu();
$oMenu->load('setup');
$oMenu->load( 'setup' );
$simpleREportsPlugin = false;
foreach( $oMenu->Options as $i=>$option) {
if ($oMenu->Types[$i] == 'private' && $oMenu->Id[$i] == 'PLUGIN_REPTAB_PERMISSIONS') {
$simpleREportsPlugin = array();
$simpleREportsPlugin['label'] = $oMenu->Labels[$i];
$simpleREportsPlugin['fn'] = $oMenu->Options[$i];
break;
}
foreach ($oMenu->Options as $i => $option) {
if ($oMenu->Types[$i] == 'private' && $oMenu->Id[$i] == 'PLUGIN_REPTAB_PERMISSIONS') {
$simpleREportsPlugin = array ();
$simpleREportsPlugin['label'] = $oMenu->Labels[$i];
$simpleREportsPlugin['fn'] = $oMenu->Options[$i];
break;
}
}
$oHeadPublisher->assign('_PLUGIN_SIMPLEREPORTS', $simpleREportsPlugin);
$oHeadPublisher->assign( '_PLUGIN_SIMPLEREPORTS', $simpleREportsPlugin );
$oHeadPublisher->addExtJsScript('reportTables/main', true); //adding a javascript file .js
$oHeadPublisher->addContent('reportTables/main'); //adding a html file .html.
$oHeadPublisher->assign('FORMATS',$c->getFormats());
$oHeadPublisher->assign('CONFIG', $Config);
$oHeadPublisher->assign('PRO_UID', isset($_GET['PRO_UID'])? $_GET['PRO_UID'] : false);
G::RenderPage('publish', 'extJs');
$oHeadPublisher->addExtJsScript( 'reportTables/main', true ); //adding a javascript file .js
$oHeadPublisher->addContent( 'reportTables/main' ); //adding a html file .html.
$oHeadPublisher->assign( 'FORMATS', $c->getFormats() );
$oHeadPublisher->assign( 'CONFIG', $Config );
$oHeadPublisher->assign( 'PRO_UID', isset( $_GET['PRO_UID'] ) ? $_GET['PRO_UID'] : false );
G::RenderPage( 'publish', 'extJs' );

File diff suppressed because it is too large Load Diff

View File

@@ -12,26 +12,26 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
G::LoadClass('reportTables');
try{
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1)
return $RBAC_Response;
G::LoadClass( 'reportTables' );
try {
$oReportTables = new ReportTables();
$oReportTables->deleteReportTable($_POST['REP_TAB_UID']);
$oReportTables->deleteReportTable( $_POST['REP_TAB_UID'] );
$result->success = true;
$result->msg = G::LoadTranslation('ID_REPORTTABLE_REMOVED');
$result->msg = G::LoadTranslation( 'ID_REPORTTABLE_REMOVED' );
} catch (Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
}
print G::json_encode($result);
}
print G::json_encode( $result );
?>

View File

@@ -12,53 +12,50 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
G::LoadClass('reportTables');
G::LoadClass('xmlfield_InputPM');
$aFields['FIELDS'] = array();
if (isset($_GET['REP_TAB_UID']))
{
$oReportTable = new ReportTable();
$aFields = $oReportTable->load($_GET['REP_TAB_UID']);
$aTheFields = getDynaformsVars($aFields['PRO_UID'], false);
$oReportTables = new ReportTables();
$aVars = $oReportTables->getTableVars($_GET['REP_TAB_UID']);
$aFields['FIELDS'] = array();
foreach ($aTheFields as $aField) {
if (in_array($aField['sName'], $aVars)) {
$aFields['FIELDS'][] = $aField['sName'] . '-' . $aField['sType'];
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1)
return $RBAC_Response;
G::LoadClass( 'reportTables' );
G::LoadClass( 'xmlfield_InputPM' );
$aFields['FIELDS'] = array ();
if (isset( $_GET['REP_TAB_UID'] )) {
$oReportTable = new ReportTable();
$aFields = $oReportTable->load( $_GET['REP_TAB_UID'] );
$aTheFields = getDynaformsVars( $aFields['PRO_UID'], false );
$oReportTables = new ReportTables();
$aVars = $oReportTables->getTableVars( $_GET['REP_TAB_UID'] );
$aFields['FIELDS'] = array ();
foreach ($aTheFields as $aField) {
if (in_array( $aField['sName'], $aVars )) {
$aFields['FIELDS'][] = $aField['sName'] . '-' . $aField['sType'];
}
}
}
} else {
$aFields['PRO_UID'] = $_GET['PRO_UID'];
$aFields['FIELDS'] = array ();
$aTheFields = getDynaformsVars( $aFields['PRO_UID'], false );
}
else
{
$aFields['PRO_UID'] = $_GET['PRO_UID'];
$aFields['FIELDS'] = array();
$aTheFields = getDynaformsVars($aFields['PRO_UID'], false);
}
$aProcessFields[] = array('FIELD_UID' => 'char',
'FIELD_NAME' => 'char');
$aTheFields = getDynaformsVars($aFields['PRO_UID'], false);
$aProcessFields[] = array ('FIELD_UID' => 'char','FIELD_NAME' => 'char'
);
$aTheFields = getDynaformsVars( $aFields['PRO_UID'], false );
foreach ($aTheFields as $aField) {
$aProcessFields[] = array('FIELD_UID' => $aField['sName'] . '-' . $aField['sType'],
'FIELD_NAME' => $aField['sName']);
$aProcessFields[] = array ('FIELD_UID' => $aField['sName'] . '-' . $aField['sType'],'FIELD_NAME' => $aField['sName']
);
}
$aProcessGridFields[] = array('FIELD_UID' => 'char',
'FIELD_NAME' => 'char');
$aTheFields = getGridsVars($aFields['PRO_UID']);
$aProcessGridFields[] = array ('FIELD_UID' => 'char','FIELD_NAME' => 'char'
);
$aTheFields = getGridsVars( $aFields['PRO_UID'] );
foreach ($aTheFields as $aField) {
$aProcessGridFields[] = array('FIELD_UID' => $aField['sName'] . '-' . $aField['sXmlForm'],
'FIELD_NAME' => $aField['sName']);
$aProcessGridFields[] = array ('FIELD_UID' => $aField['sName'] . '-' . $aField['sXmlForm'],'FIELD_NAME' => $aField['sName']
);
}
global $_DBArray;
$_DBArray['processFields'] = $aProcessFields;
@@ -67,6 +64,6 @@ $_SESSION['_DBArray'] = $_DBArray;
$aFields['LANG'] = SYS_LANG;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'reportTables/reportTables_Edit', '', $aFields, '../reportTables/reportTables_Save');
G::RenderPage('publish', 'blank');
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'reportTables/reportTables_Edit', '', $aFields, '../reportTables/reportTables_Save' );
G::RenderPage( 'publish', 'blank' );
?>

View File

@@ -12,92 +12,88 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1)
return $RBAC_Response;
G::LoadClass('reportTables');
G::LoadClass( 'reportTables' );
if(isset($_POST['form']))
$values = $_POST['form']; //For Old processmap
else
{
$values = $_POST; //For extjs,since we are not using form
$values['FIELDS'] = explode(',',$_POST['FIELDS']);
if (isset( $_POST['form'] ))
$values = $_POST['form']; //For Old processmap
else {
$values = $_POST; //For extjs,since we are not using form
$values['FIELDS'] = explode( ',', $_POST['FIELDS'] );
}
$oReportTable = new ReportTable();
if (!isset($values['REP_TAB_CONNECTION'])) {
$values['REP_TAB_CONNECTION'] = 'report';
if (! isset( $values['REP_TAB_CONNECTION'] )) {
$values['REP_TAB_CONNECTION'] = 'report';
}
if ($values['REP_TAB_UID'] != '') {
$aReportTable = $oReportTable->load($values['REP_TAB_UID']);
$sOldTableName = $aReportTable['REP_TAB_NAME'];
$sOldConnection = $aReportTable['REP_TAB_CONNECTION'];
}
else {
$sOldTableName = $values['REP_TAB_NAME'];
$sOldConnection = $values['REP_TAB_CONNECTION'];
$oReportTable->create($values);
$values['REP_TAB_UID'] = $oReportTable->getRepTabUid();
$aReportTable = $oReportTable->load( $values['REP_TAB_UID'] );
$sOldTableName = $aReportTable['REP_TAB_NAME'];
$sOldConnection = $aReportTable['REP_TAB_CONNECTION'];
} else {
$sOldTableName = $values['REP_TAB_NAME'];
$sOldConnection = $values['REP_TAB_CONNECTION'];
$oReportTable->create( $values );
$values['REP_TAB_UID'] = $oReportTable->getRepTabUid();
}
$oReportTable->update($values);
$oReportTable->update( $values );
$oReportVar = new ReportVar();
$oReportTables = new ReportTables();
$oReportTables->deleteAllReportVars($values['REP_TAB_UID']);
$aFields = array();
$oReportTables->deleteAllReportVars( $values['REP_TAB_UID'] );
$aFields = array ();
if ($values['REP_TAB_TYPE'] == 'GRID') {
$aAux = explode('-', $values['REP_TAB_GRID']);
global $G_FORM;
$G_FORM = new Form($values['PRO_UID'] . '/' . $aAux[1], PATH_DYNAFORM, SYS_LANG, false);
$aAux = $G_FORM->getVars(false);
foreach ($aAux as $aField) {
$values['FIELDS'][] = $aField['sName'] . '-' . $aField['sType'];
}
$aAux = explode( '-', $values['REP_TAB_GRID'] );
global $G_FORM;
$G_FORM = new Form( $values['PRO_UID'] . '/' . $aAux[1], PATH_DYNAFORM, SYS_LANG, false );
$aAux = $G_FORM->getVars( false );
foreach ($aAux as $aField) {
$values['FIELDS'][] = $aField['sName'] . '-' . $aField['sType'];
}
}
foreach ($values['FIELDS'] as $sField) {
$aField = explode('-', $sField);
switch ($aField[1]) {
case 'currency':
case 'percentage':
$sType = 'number';
break;
case 'text':
case 'password':
case 'dropdown':
case 'yesno':
case 'checkbox':
case 'radiogroup':
case 'hidden':
$sType = 'char';
break;
case 'textarea':
$sType = 'text';
break;
case 'date':
$sType = 'date';
break;
default:
$sType = 'char';
break;
}
$oReportVar->create(array('REP_TAB_UID' => $values['REP_TAB_UID'],
'PRO_UID' => $values['PRO_UID'],
'REP_VAR_NAME' => $aField[0],
'REP_VAR_TYPE' => $sType));
$aFields[] = array('sFieldName' => $aField[0], 'sType' => $sType);
$aField = explode( '-', $sField );
switch ($aField[1]) {
case 'currency':
case 'percentage':
$sType = 'number';
break;
case 'text':
case 'password':
case 'dropdown':
case 'yesno':
case 'checkbox':
case 'radiogroup':
case 'hidden':
$sType = 'char';
break;
case 'textarea':
$sType = 'text';
break;
case 'date':
$sType = 'date';
break;
default:
$sType = 'char';
break;
}
$oReportVar->create( array ('REP_TAB_UID' => $values['REP_TAB_UID'],'PRO_UID' => $values['PRO_UID'],'REP_VAR_NAME' => $aField[0],'REP_VAR_TYPE' => $sType
) );
$aFields[] = array ('sFieldName' => $aField[0],'sType' => $sType
);
}
$oReportTables->dropTable($sOldTableName, $sOldConnection);
$oReportTables->createTable($values['REP_TAB_NAME'], $values['REP_TAB_CONNECTION'], $values['REP_TAB_TYPE'], $aFields);
$oReportTables->populateTable($values['REP_TAB_NAME'], $values['REP_TAB_CONNECTION'], $values['REP_TAB_TYPE'], $aFields, $values['PRO_UID'], $values['REP_TAB_GRID']);
$oReportTables->dropTable( $sOldTableName, $sOldConnection );
$oReportTables->createTable( $values['REP_TAB_NAME'], $values['REP_TAB_CONNECTION'], $values['REP_TAB_TYPE'], $aFields );
$oReportTables->populateTable( $values['REP_TAB_NAME'], $values['REP_TAB_CONNECTION'], $values['REP_TAB_TYPE'], $aFields, $values['PRO_UID'], $values['REP_TAB_GRID'] );
?>

View File

@@ -12,66 +12,53 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
switch ($RBAC->userCanAccess('PM_REPORTS'))
{
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
switch ($RBAC->userCanAccess( 'PM_REPORTS' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'REPORTS';
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'REPORTS';
$reports= array();
$reports = array ();
$reports[] = array('RPT_UID' => '',
'RPT_TITLE' => '',
'VIEW' => '');
$reports[] = array ('RPT_UID' => '','RPT_TITLE' => '','VIEW' => ''
);
$reports[] = array('RPT_NUMBER' => count($reports),
'RPT_UID' => 1,
'RPT_TITLE' => G::LoadTranslation('ID_REPORT1'),
'VIEW' => G::LoadTranslation('ID_VIEW'));
$reports[] = array ('RPT_NUMBER' => count( $reports ),'RPT_UID' => 1,'RPT_TITLE' => G::LoadTranslation( 'ID_REPORT1' ),'VIEW' => G::LoadTranslation( 'ID_VIEW' )
);
$reports[] = array('RPT_NUMBER' => count($reports),
'RPT_UID' => 2,
'RPT_TITLE' => G::LoadTranslation('ID_REPORT2'),
'VIEW' => G::LoadTranslation('ID_VIEW'));
$reports[] = array ('RPT_NUMBER' => count( $reports ),'RPT_UID' => 2,'RPT_TITLE' => G::LoadTranslation( 'ID_REPORT2' ),'VIEW' => G::LoadTranslation( 'ID_VIEW' )
);
$reports[] = array('RPT_NUMBER' => count($reports),
'RPT_UID' => 3,
'RPT_TITLE' => G::LoadTranslation('ID_REPORT3'),
'VIEW' => G::LoadTranslation('ID_VIEW'));
$reports[] = array ('RPT_NUMBER' => count( $reports ),'RPT_UID' => 3,'RPT_TITLE' => G::LoadTranslation( 'ID_REPORT3' ),'VIEW' => G::LoadTranslation( 'ID_VIEW' )
);
$reports[] = array('RPT_NUMBER' => count($reports),
'RPT_UID' => 4,
'RPT_TITLE' => G::LoadTranslation('ID_REPORT4'),
'VIEW' => G::LoadTranslation('ID_VIEW'));
$reports[] = array ('RPT_NUMBER' => count( $reports ),'RPT_UID' => 4,'RPT_TITLE' => G::LoadTranslation( 'ID_REPORT4' ),'VIEW' => G::LoadTranslation( 'ID_VIEW' )
);
$reports[] = array('RPT_NUMBER' => count($reports),
'RPT_UID' => 5,
'RPT_TITLE' => G::LoadTranslation('ID_REPORT5'),
'VIEW' => G::LoadTranslation('ID_VIEW'));
$reports[] = array ('RPT_NUMBER' => count( $reports ),'RPT_UID' => 5,'RPT_TITLE' => G::LoadTranslation( 'ID_REPORT5' ),'VIEW' => G::LoadTranslation( 'ID_VIEW' )
);
/*$reports[] = array('RPT_UID' => 6,
/*$reports[] = array('RPT_UID' => 6,
'RPT_TITLE' => "Report 6",//G::LoadTranslation('ID_REPORT6'),
'VIEW' => G::LoadTranslation('ID_VIEW'));
@@ -87,58 +74,52 @@ switch ($RBAC->userCanAccess('PM_REPORTS'))
'RPT_TITLE' => "Report 9",//G::LoadTranslation('ID_REPORT6'),
'VIEW' => G::LoadTranslation('ID_VIEW'));*/
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$aAvailableReports = $oPluginRegistry->getReports();
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$aAvailableReports = $oPluginRegistry->getReports();
//$aReports = array();
foreach ($aAvailableReports as $sReportClass) {
//$aReports = array();
foreach ($aAvailableReports as $sReportClass) {
require_once PATH_PLUGINS. $sReportClass . PATH_SEP . 'class.' . $sReportClass . '.php';
$sClassName = $sReportClass . 'Class';
$oInstance = new $sClassName();
$aReports = $oInstance->getAvailableReports();
foreach ($aReports as $oReport ) {
$reports[] = array('RPT_NUMBER' => count($reports),
'RPT_UID' => $oReport['uid'],
'RPT_TITLE' => $oReport['title'],
'VIEW' => G::LoadTranslation('ID_VIEW'));
}
require_once PATH_PLUGINS . $sReportClass . PATH_SEP . 'class.' . $sReportClass . '.php';
$sClassName = $sReportClass . 'Class';
$oInstance = new $sClassName();
$aReports = $oInstance->getAvailableReports();
foreach ($aReports as $oReport) {
$reports[] = array ('RPT_NUMBER' => count( $reports ),'RPT_UID' => $oReport['uid'],'RPT_TITLE' => $oReport['title'],'VIEW' => G::LoadTranslation( 'ID_VIEW' )
);
}
//now check if there are customized reports inside the processes
if ( file_exists ( PATH_DATA_PUBLIC) && is_dir (PATH_DATA_PUBLIC) ) {
if ($handle = opendir( PATH_DATA_PUBLIC ) ) {
while ( false !== ($dir = readdir($handle)) ) {
if ( $dir[0] != '.' && file_exists( PATH_DATA_PUBLIC.$dir.PATH_SEP.'reports.php' ) ) {
include_once (PATH_DATA_PUBLIC.$dir.PATH_SEP.'reports.php');
$className = 'report' . $dir;
if (class_exists ( $className )) {
$oReport = new $className();
$aReports = $oReport->getAvailableReports();
foreach ($aReports as $oReport ) {
$reports[] = array('RPT_NUMBER' => count($reports),
'RPT_UID' => $oReport['uid'],
'RPT_TITLE' => $oReport['title'],
'VIEW' => G::LoadTranslation('ID_VIEW'));
}
}
//now check if there are customized reports inside the processes
if (file_exists( PATH_DATA_PUBLIC ) && is_dir( PATH_DATA_PUBLIC )) {
if ($handle = opendir( PATH_DATA_PUBLIC )) {
while (false !== ($dir = readdir( $handle ))) {
if ($dir[0] != '.' && file_exists( PATH_DATA_PUBLIC . $dir . PATH_SEP . 'reports.php' )) {
include_once (PATH_DATA_PUBLIC . $dir . PATH_SEP . 'reports.php');
$className = 'report' . $dir;
if (class_exists( $className )) {
$oReport = new $className();
$aReports = $oReport->getAvailableReports();
foreach ($aReports as $oReport) {
$reports[] = array ('RPT_NUMBER' => count( $reports ),'RPT_UID' => $oReport['uid'],'RPT_TITLE' => $oReport['title'],'VIEW' => G::LoadTranslation( 'ID_VIEW' )
);
}
}
}
}
}
}
closedir($handle);
}
closedir( $handle );
}
global $_DBArray;
$_DBArray['reports'] = $reports;
global $_DBArray;
$_DBArray['reports'] = $reports;
$_SESSION['_DBArray'] = $_DBArray;
G::LoadClass( 'ArrayPeer' );
$oCriteria = new Criteria( 'dbarray' );
$oCriteria->setDBArrayTable( 'reports' );
$_SESSION['_DBArray'] = $_DBArray;
G::LoadClass('ArrayPeer');
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('reports');
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'reports/reportsList', $oCriteria );
G::RenderPage('publish');
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'reports/reportsList', $oCriteria );
G::RenderPage( 'publish' );
?>

View File

@@ -12,51 +12,50 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$_GET['sType'] = str_replace('?', '', $_GET['sType']);
$_GET['sType'] = str_replace( '?', '', $_GET['sType'] );
G::LoadClass('report');
G::LoadClass( 'report' );
$oReport = new Report();
switch($_GET['sType']) {
case 'ID_REPORT1':
$oCriteria = $oReport->generatedReport1();
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'reports/report1_dashboard', $oCriteria);
G::RenderPage('publish', 'raw');
break;
case 'ID_REPORT2':
$oCriteria = $oReport->generatedReport2();
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'reports/report2_dashboard', $oCriteria);
G::RenderPage('publish', 'raw');
break;
case 'ID_REPORT3':
$oCriteria = $oReport->generatedReport3();
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'reports/report3_dashboard', $oCriteria);
G::RenderPage('publish', 'raw');
break;
case 'ID_REPORT4':
$oCriteria = $oReport->generatedReport4();
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'reports/report4_dashboard', $oCriteria);
G::RenderPage('publish', 'raw');
break;
case 'ID_REPORT5':
$oCriteria = $oReport->generatedReport5();
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'reports/report5_dashboard', $oCriteria);
G::RenderPage('publish', 'raw');
break;
switch ($_GET['sType']) {
case 'ID_REPORT1':
$oCriteria = $oReport->generatedReport1();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'reports/report1_dashboard', $oCriteria );
G::RenderPage( 'publish', 'raw' );
break;
case 'ID_REPORT2':
$oCriteria = $oReport->generatedReport2();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'reports/report2_dashboard', $oCriteria );
G::RenderPage( 'publish', 'raw' );
break;
case 'ID_REPORT3':
$oCriteria = $oReport->generatedReport3();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'reports/report3_dashboard', $oCriteria );
G::RenderPage( 'publish', 'raw' );
break;
case 'ID_REPORT4':
$oCriteria = $oReport->generatedReport4();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'reports/report4_dashboard', $oCriteria );
G::RenderPage( 'publish', 'raw' );
break;
case 'ID_REPORT5':
$oCriteria = $oReport->generatedReport5();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'reports/report5_dashboard', $oCriteria );
G::RenderPage( 'publish', 'raw' );
break;
}
?>

View File

@@ -12,59 +12,57 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
switch ($RBAC->userCanAccess('PM_REPORTS'))
{
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
switch ($RBAC->userCanAccess( 'PM_REPORTS' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
G::LoadClass('xmlfield_InputPM');
G::LoadClass( 'xmlfield_InputPM' );
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'REPORTS';
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'REPORTS';
$PRO_UID = $_POST['PRO_UID'];
G::LoadClass('report');
$oReport= new Report();
$PRO_UID = $_POST['PRO_UID'];
G::LoadClass( 'report' );
$oReport = new Report();
/*
$sw=0;
if(isset($_POST['FROM']) && isset($_POST['TO'])&& isset($_POST['STARTEDBY']))
{
if($_POST['FROM']!='0000-00-00' || $_POST['TO']!='0000-00-00')$sw=1;
}
}
if($sw==0)*/
$c = $oReport->descriptionReport1($PRO_UID);
if($sw==0)*/
$c = $oReport->descriptionReport1( $PRO_UID );
/*
else
else
$c = $oReport->reports_Description_filter($_POST['FROM'], $_POST['TO'], $_POST['STARTEDBY'], $PRO_UID);
*/
$fields['PRO_UID']=$PRO_UID;
*/
$fields['PRO_UID'] = $PRO_UID;
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'reports/reports_Description', $c );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'reports/reports_Description', $c );
//$G_PUBLISH->AddContent('xmlform', 'xmlform', 'reports/reports_Description_search', '', $fields);
G::RenderPage('publish','raw');
G::RenderPage( 'publish', 'raw' );
?>

View File

@@ -12,87 +12,80 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
require_once 'classes/model/AppDelegation.php';
require_once 'classes/model/AppDelegation.php';
G::LoadClass('dates');
$oDates = new dates();
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(AppDelegationPeer::APP_UID);
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
$oCriteria->addSelectColumn(AppDelegationPeer::TAS_UID);
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE);
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
$oDataset = AppDelegationPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(TaskPeer::TAS_UID);
$oCriteria->add(TaskPeer::TAS_UID, $aRow['TAS_UID']);
$oDataseti = TaskPeer::doSelectRS($oCriteria);
$oDataseti->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataseti->next();
$b=0;
while ($aRows = $oDataseti->getRow()) {
if(TaskPeer::doCount($oCriteria) == 1)
$b=1;
$oDataseti->next();
}
if($b==1)
{
if($aRow['DEL_INIT_DATE']!=null && $aRow['DEL_FINISH_DATE']!=null)
{ $fDuration = $oDates->calculateDuration($aRow['DEL_INIT_DATE'], $aRow['DEL_FINISH_DATE'], null, null, $aRow['TAS_UID']);
$oCriteria = new Criteria('workflow');
$sql = "UPDATE APP_DELEGATION SET DEL_DURATION='".$fDuration."'
WHERE APP_UID='".$aRow['APP_UID']."' AND DEL_INDEX='".$aRow['DEL_INDEX']."'";
$con = Propel::getConnection("workflow");
$stmt = $con->prepareStatement($sql);
$rs = $stmt->executeQuery();
}
else
{
$oCriteria = new Criteria('workflow');
$sql = "UPDATE APP_DELEGATION SET DEL_DURATION=0
WHERE APP_UID='".$aRow['APP_UID']."' AND DEL_INDEX='".$aRow['DEL_INDEX']."'";
$con = Propel::getConnection("workflow");
$stmt = $con->prepareStatement($sql);
$rs = $stmt->executeQuery();
}
}
else
{
$oCriteria = new Criteria('workflow');
$sql = "UPDATE APP_DELEGATION SET DEL_DURATION=0
WHERE APP_UID='".$aRow['APP_UID']."' AND DEL_INDEX='".$aRow['DEL_INDEX']."'";
$con = Propel::getConnection("workflow");
$stmt = $con->prepareStatement($sql);
$rs = $stmt->executeQuery();
}
$oDataset->next();
G::LoadClass( 'dates' );
$oDates = new dates();
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( AppDelegationPeer::APP_UID );
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_INDEX );
$oCriteria->addSelectColumn( AppDelegationPeer::TAS_UID );
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_INIT_DATE );
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE );
$oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( TaskPeer::TAS_UID );
$oCriteria->add( TaskPeer::TAS_UID, $aRow['TAS_UID'] );
$oDataseti = TaskPeer::doSelectRS( $oCriteria );
$oDataseti->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataseti->next();
$b = 0;
while ($aRows = $oDataseti->getRow()) {
if (TaskPeer::doCount( $oCriteria ) == 1)
$b = 1;
$oDataseti->next();
}
if ($b == 1) {
if ($aRow['DEL_INIT_DATE'] != null && $aRow['DEL_FINISH_DATE'] != null) {
$fDuration = $oDates->calculateDuration( $aRow['DEL_INIT_DATE'], $aRow['DEL_FINISH_DATE'], null, null, $aRow['TAS_UID'] );
$oCriteria = new Criteria( 'workflow' );
$sql = "UPDATE APP_DELEGATION SET DEL_DURATION='" . $fDuration . "'
WHERE APP_UID='" . $aRow['APP_UID'] . "' AND DEL_INDEX='" . $aRow['DEL_INDEX'] . "'";
$con = Propel::getConnection( "workflow" );
$stmt = $con->prepareStatement( $sql );
$rs = $stmt->executeQuery();
} else {
$oCriteria = new Criteria( 'workflow' );
$sql = "UPDATE APP_DELEGATION SET DEL_DURATION=0
WHERE APP_UID='" . $aRow['APP_UID'] . "' AND DEL_INDEX='" . $aRow['DEL_INDEX'] . "'";
$con = Propel::getConnection( "workflow" );
$stmt = $con->prepareStatement( $sql );
$rs = $stmt->executeQuery();
}
} else {
$oCriteria = new Criteria( 'workflow' );
$sql = "UPDATE APP_DELEGATION SET DEL_DURATION=0
WHERE APP_UID='" . $aRow['APP_UID'] . "' AND DEL_INDEX='" . $aRow['DEL_INDEX'] . "'";
$con = Propel::getConnection( "workflow" );
$stmt = $con->prepareStatement( $sql );
$rs = $stmt->executeQuery();
}
$oDataset->next();
}
//G::header('location: reportsList');
?>

View File

@@ -12,267 +12,259 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/**
* Report - Report view
*
* @package ProcessMaker
* @author Everth S. Berrios Morales
* @copyright 2008 COLOSA
*/
global $RBAC;
switch ($RBAC->userCanAccess('PM_REPORTS'))
{
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
switch ($RBAC->userCanAccess( 'PM_REPORTS' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
try {
//form type format hours in the form xml
G::LoadClass('xmlfield_InputPM');
//form type format hours in the form xml
G::LoadClass( 'xmlfield_InputPM' );
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'REPORTS';
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'REPORTS';
$RPT_UID = $_GET['RPT_UID'];
$RPT_UID = $_GET['RPT_UID'];
switch($RPT_UID)
{
case 1:
$sw=0;
if (isset($_POST['form']))
{ if($_POST['form']['FROM']!='0000-00-00' || $_POST['form']['TO']!='0000-00-00') $sw=1;
$fields['FROM']=$_POST['form']['FROM'];
$fields['TO']=$_POST['form']['TO'];
$fields['STARTEDBY']= $_POST['form']['STARTEDBY'];
}
else
{ $fields['FROM']=date('Y-m-d');
$fields['TO']=date('Y-m-d');
}
G::LoadClass('report');
$oReport= new Report();
if($sw==0)
$c = $oReport->generatedReport1();
else
$c = $oReport->generatedReport1_filter($_POST['form']['FROM'], $_POST['form']['TO'], $_POST['form']['STARTEDBY']);
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addScriptFile('/jscore/reports/reports.js');
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'reports/report1', $c);
if(isset($_POST['form']))
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'reports/report1_search', '', $fields);
else
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'reports/report1_search');
G::RenderPage('publish');
break;
case 2:
$sw=0;
if (isset($_POST['form']))
{ if($_POST['form']['FROM']!='0000-00-00' || $_POST['form']['TO']!='0000-00-00') $sw=1;
$fields['FROM']=$_POST['form']['FROM'];
$fields['TO']=$_POST['form']['TO'];
$fields['STARTEDBY']= $_POST['form']['STARTEDBY'];
}
else
{ $fields['FROM']=date('Y-m-d');
$fields['TO']=date('Y-m-d');
}
G::LoadClass('report');
$oReport= new Report();
if($sw==0)
$c = $oReport->generatedReport2();
else
$c = $oReport->generatedReport2_filter($_POST['form']['FROM'], $_POST['form']['TO'], $_POST['form']['STARTEDBY']);
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addScriptFile('/jscore/reports/reports.js');
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'reports/report2', $c );
if(isset($_POST['form']))
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'reports/report1_search', '', $fields);
else
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'reports/report1_search');
G::RenderPage('publish');
break;
case 3:
$sw=0;
if (isset($_POST['form']))
{
$sw=1;
$fields['PROCESS']=$_POST['form']['PROCESS'];
$fields['TASKS']=$_POST['form']['TASKS'];
}
else
{ $fields['FROM']=date('Y-m-d');
$fields['TO']=date('Y-m-d');
}
G::LoadClass('report');
$oReport= new Report();
if($sw==0)
$c = $oReport->generatedReport3();
else
$c = $oReport->generatedReport3_filter($_POST['form']['PROCESS'], $_POST['form']['TASKS']);
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addScriptFile('/jscore/reports/reports.js');
$G_PUBLISH = new Publisher;
if(isset($_POST['form']))
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'reports/report_filter', '', $fields);
else
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'reports/report_filter');
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'reports/report3', $c);
G::RenderPage('publish');
break;
case 4:
$sw=0;
if (isset($_POST['form']))
{
$sw=1;
$fields['PROCESS']=$_POST['form']['PROCESS'];
$fields['TASKS']=$_POST['form']['TASKS'];
}
G::LoadClass('report');
$oReport= new Report();
if($sw==0)
$c = $oReport->generatedReport4();
else
$c = $oReport->generatedReport4_filter($_POST['form']['PROCESS'], $_POST['form']['TASKS']);
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addScriptFile('/jscore/reports/reports.js');
$G_PUBLISH = new Publisher;
if(isset($_POST['form']))
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'reports/report_filter', '', $fields);
else
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'reports/report_filter');
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'reports/report4', $c);
G::RenderPage('publish');
break;
case 5:
$sw=0;
if (isset($_POST['form']))
{
$sw=1;
$fields['PROCESS']=$_POST['form']['PROCESS'];
$fields['TASKS']=$_POST['form']['TASKS'];
}
G::LoadClass('report');
$oReport= new Report();
if($sw==0)
$c = $oReport->generatedReport5();
else
$c = $oReport->generatedReport5_filter($_POST['form']['PROCESS'], $_POST['form']['TASKS']);
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addScriptFile('/jscore/reports/reports.js');
$G_PUBLISH = new Publisher;
if(isset($_POST['form']))
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'reports/report_filter', '', $fields);
else
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'reports/report_filter');
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'reports/report5', $c);
G::RenderPage('publish');
break;
default :
$foundReport = false;
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$aAvailableReports = $oPluginRegistry->getReports();
foreach ($aAvailableReports as $sReportClass) {
require_once PATH_PLUGINS. $sReportClass . PATH_SEP . 'class.' . $sReportClass . '.php';
$sClassName = $sReportClass . 'Class';
$oInstance = new $sClassName();
$aReports = $oInstance->getAvailableReports();
foreach ($aReports as $oReport) {
if ( $RPT_UID == $oReport['uid'] && method_exists( $oInstance, $RPT_UID )) {
$foundReport = true;
$result = $oInstance->{$RPT_UID} ();
}
}
}
//now check if there are customized reports inside the processes
if ( file_exists ( PATH_DATA_PUBLIC) && is_dir (PATH_DATA_PUBLIC) ) {
if ($handle = opendir( PATH_DATA_PUBLIC ) ) {
while ( false !== ($dir = readdir($handle)) ) {
if ( $dir[0] != '.' && file_exists( PATH_DATA_PUBLIC.$dir.PATH_SEP.'reports.php' ) ) {
include_once (PATH_DATA_PUBLIC.$dir.PATH_SEP.'reports.php');
$className = 'report' . $dir;
if (class_exists ( $className )) {
$oInstance = new $className();
$aReports = $oInstance->getAvailableReports();
foreach ($aReports as $oReport ) {
if ( $RPT_UID == $oReport['uid'] && method_exists( $oInstance, $RPT_UID ) ) {
$foundReport = true;
$result = $oInstance->{$RPT_UID} ();
}
}
switch ($RPT_UID) {
case 1:
$sw = 0;
if (isset( $_POST['form'] )) {
if ($_POST['form']['FROM'] != '0000-00-00' || $_POST['form']['TO'] != '0000-00-00')
$sw = 1;
$fields['FROM'] = $_POST['form']['FROM'];
$fields['TO'] = $_POST['form']['TO'];
$fields['STARTEDBY'] = $_POST['form']['STARTEDBY'];
} else {
$fields['FROM'] = date( 'Y-m-d' );
$fields['TO'] = date( 'Y-m-d' );
}
}
}
}
closedir($handle);
G::LoadClass( 'report' );
$oReport = new Report();
if ($sw == 0)
$c = $oReport->generatedReport1();
else
$c = $oReport->generatedReport1_filter( $_POST['form']['FROM'], $_POST['form']['TO'], $_POST['form']['STARTEDBY'] );
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile( '/jscore/reports/reports.js' );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'reports/report1', $c );
if (isset( $_POST['form'] ))
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'reports/report1_search', '', $fields );
else
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'reports/report1_search' );
G::RenderPage( 'publish' );
break;
case 2:
$sw = 0;
if (isset( $_POST['form'] )) {
if ($_POST['form']['FROM'] != '0000-00-00' || $_POST['form']['TO'] != '0000-00-00')
$sw = 1;
$fields['FROM'] = $_POST['form']['FROM'];
$fields['TO'] = $_POST['form']['TO'];
$fields['STARTEDBY'] = $_POST['form']['STARTEDBY'];
} else {
$fields['FROM'] = date( 'Y-m-d' );
$fields['TO'] = date( 'Y-m-d' );
}
G::LoadClass( 'report' );
$oReport = new Report();
if ($sw == 0)
$c = $oReport->generatedReport2();
else
$c = $oReport->generatedReport2_filter( $_POST['form']['FROM'], $_POST['form']['TO'], $_POST['form']['STARTEDBY'] );
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile( '/jscore/reports/reports.js' );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'reports/report2', $c );
if (isset( $_POST['form'] ))
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'reports/report1_search', '', $fields );
else
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'reports/report1_search' );
G::RenderPage( 'publish' );
break;
case 3:
$sw = 0;
if (isset( $_POST['form'] )) {
$sw = 1;
$fields['PROCESS'] = $_POST['form']['PROCESS'];
$fields['TASKS'] = $_POST['form']['TASKS'];
} else {
$fields['FROM'] = date( 'Y-m-d' );
$fields['TO'] = date( 'Y-m-d' );
}
G::LoadClass( 'report' );
$oReport = new Report();
if ($sw == 0)
$c = $oReport->generatedReport3();
else
$c = $oReport->generatedReport3_filter( $_POST['form']['PROCESS'], $_POST['form']['TASKS'] );
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile( '/jscore/reports/reports.js' );
$G_PUBLISH = new Publisher();
if (isset( $_POST['form'] ))
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'reports/report_filter', '', $fields );
else
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'reports/report_filter' );
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'reports/report3', $c );
G::RenderPage( 'publish' );
break;
case 4:
$sw = 0;
if (isset( $_POST['form'] )) {
$sw = 1;
$fields['PROCESS'] = $_POST['form']['PROCESS'];
$fields['TASKS'] = $_POST['form']['TASKS'];
}
G::LoadClass( 'report' );
$oReport = new Report();
if ($sw == 0)
$c = $oReport->generatedReport4();
else
$c = $oReport->generatedReport4_filter( $_POST['form']['PROCESS'], $_POST['form']['TASKS'] );
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile( '/jscore/reports/reports.js' );
$G_PUBLISH = new Publisher();
if (isset( $_POST['form'] ))
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'reports/report_filter', '', $fields );
else
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'reports/report_filter' );
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'reports/report4', $c );
G::RenderPage( 'publish' );
break;
case 5:
$sw = 0;
if (isset( $_POST['form'] )) {
$sw = 1;
$fields['PROCESS'] = $_POST['form']['PROCESS'];
$fields['TASKS'] = $_POST['form']['TASKS'];
}
G::LoadClass( 'report' );
$oReport = new Report();
if ($sw == 0)
$c = $oReport->generatedReport5();
else
$c = $oReport->generatedReport5_filter( $_POST['form']['PROCESS'], $_POST['form']['TASKS'] );
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile( '/jscore/reports/reports.js' );
$G_PUBLISH = new Publisher();
if (isset( $_POST['form'] ))
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'reports/report_filter', '', $fields );
else
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'reports/report_filter' );
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'reports/report5', $c );
G::RenderPage( 'publish' );
break;
default:
$foundReport = false;
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$aAvailableReports = $oPluginRegistry->getReports();
foreach ($aAvailableReports as $sReportClass) {
require_once PATH_PLUGINS . $sReportClass . PATH_SEP . 'class.' . $sReportClass . '.php';
$sClassName = $sReportClass . 'Class';
$oInstance = new $sClassName();
$aReports = $oInstance->getAvailableReports();
foreach ($aReports as $oReport) {
if ($RPT_UID == $oReport['uid'] && method_exists( $oInstance, $RPT_UID )) {
$foundReport = true;
$result = $oInstance->{$RPT_UID}();
}
}
}
//now check if there are customized reports inside the processes
if (file_exists( PATH_DATA_PUBLIC ) && is_dir( PATH_DATA_PUBLIC )) {
if ($handle = opendir( PATH_DATA_PUBLIC )) {
while (false !== ($dir = readdir( $handle ))) {
if ($dir[0] != '.' && file_exists( PATH_DATA_PUBLIC . $dir . PATH_SEP . 'reports.php' )) {
include_once (PATH_DATA_PUBLIC . $dir . PATH_SEP . 'reports.php');
$className = 'report' . $dir;
if (class_exists( $className )) {
$oInstance = new $className();
$aReports = $oInstance->getAvailableReports();
foreach ($aReports as $oReport) {
if ($RPT_UID == $oReport['uid'] && method_exists( $oInstance, $RPT_UID )) {
$foundReport = true;
$result = $oInstance->{$RPT_UID}();
}
}
}
}
}
}
closedir( $handle );
}
if (! $foundReport)
throw (new Exception( "Call to an nonexistent member function " . $RPT_UID . "() " ));
}
if ( !$foundReport )
throw ( new Exception ( "Call to an nonexistent member function " . $RPT_UID . "() ") );
}
}
catch ( Exception $e ) {
$G_PUBLISH = new Publisher;
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', 'blank' );
} catch (Exception $e) {
$G_PUBLISH = new Publisher();
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', 'blank' );
}