CODE STYLE file workflow/engine/methods/reports/

FILES:
reportsList.php
reports_Dashboard.php
reports_Description.php
reports_Duration.php
reports_View.php
This commit is contained in:
jennylee
2012-10-17 12:28:46 -04:00
parent 57c78b8342
commit c1f29f8729
5 changed files with 424 additions and 461 deletions

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' );
}