PMC-1422 Warning in charts.php

This commit is contained in:
Roly Rudy Gutierrez Pinto
2019-11-27 16:19:01 -04:00
parent 3c9d6a6e78
commit c89770cc61
6 changed files with 5 additions and 216 deletions

View File

@@ -82,6 +82,11 @@ workflow/engine/methods/setup/webServices.php
workflow/engine/methods/setup/webServicesAjax.php
workflow/engine/methods/setup/webServicesList.php
workflow/engine/methods/users/data_usersList.php
workflow/engine/plugins/charts.php
workflow/engine/plugins/charts/class.charts.php
workflow/engine/plugins/charts/config/setup.conf
workflow/engine/plugins/charts/genericCharts.php
workflow/engine/plugins/charts/setupPage.xml
workflow/engine/plugins/openFlash.php
workflow/engine/plugins/openFlash/chart-data.php
workflow/engine/plugins/openFlash/chart.php

View File

@@ -1,29 +0,0 @@
<?php
class chartsPlugin extends PMPlugin
{
public function chartsPlugin($sNamespace, $sFilename = null)
{
$res = parent::PMPlugin($sNamespace, $sFilename);
$this->sFriendlyName = 'Charts Plugin';
$this->sDescription = 'This plugin shows generic charts for ProcessMaker';
$this->sPluginFolder = 'charts';
$this->sSetupPage = 'setupPage';
$this->aWorkspaces = array( );
$this->iVersion = 0.45;
$this->bPrivate = true;
return $res;
}
public function setup()
{
$this->registerTrigger(10000, 'createCaseFolder');
}
public function install()
{
}
}
$oPluginRegistry = PMPluginRegistry::getSingleton();
$oPluginRegistry->registerPlugin('charts', __FILE__);

View File

@@ -1,106 +0,0 @@
<?php
require_once ( "classes/model/Application.php" );
require_once ( "classes/model/AppDelegation.php" );
require_once ( "classes/model/Process.php" );
class chartsClass extends PMPlugin {
function __construct ( ) {
}
function readConfig () {
$fileConf = PATH_PLUGINS . 'charts' . PATH_SEP . 'config' . PATH_SEP . 'setup.conf';
if ( !file_exists( dirname($fileConf) ) )
throw ( new Exception ("The directory " . dirname($fileConf) . " doesn't exist." ) );
if ( file_exists ( $fileConf ) && !is_writable( $fileConf ) )
throw ( new Exception ("The file $fileConf doesn't exist or this file is not writable." ) );
$content = file_get_contents ( $fileConf);
$fields = unserialize ($content);
return $fields;
}
function getFieldsForPageSetup () {
$fileConf = PATH_PLUGINS . $this->sPluginFolder . PATH_SEP . 'config' . PATH_SEP . 'setup.conf';
if ( !file_exists( dirname($fileConf) ) )
throw ( new Exception ("The directory " . dirname($fileConf) . " doesn't exist." ) );
if ( file_exists ( $fileConf ) && !is_writable( $fileConf ) )
throw ( new Exception ("The file $fileConf doesn't exist or this file is not writable." ) );
if ( file_exists ( $fileConf ) ) {
$content = file_get_contents ( $fileConf);
$fields = unserialize ($content);
}
else
$fields = array();
return $fields;
}
function updateFieldsForPageSetup ( $oData) {
$content = serialize ($oData['form']);
$fileConf = PATH_PLUGINS . $this->sPluginFolder . PATH_SEP . 'config' . PATH_SEP . 'setup.conf';
if ( !is_writable( dirname($fileConf) ) )
throw ( new Exception ("The directory " . dirname($fileConf) . " doesn't exist or this directory is not writable." ) );
if ( file_exists ( $fileConf ) && !is_writable( $fileConf ) )
throw ( new Exception ("The file $fileConf doesn't exist or this file is not writable." ) );
file_put_contents ( $fileConf, $content);
return true;
}
function setup() {
}
function getDatasetCasesByStatus ( ) {
$dataSet = new XYDataSet();
$c = new Criteria('workflow');
$c->clearSelectColumns();
$c->addSelectColumn ( ApplicationPeer::APP_STATUS );
$c->addSelectColumn ( 'COUNT(*) AS CANT') ;
$c->addGroupByColumn(ApplicationPeer::APP_STATUS);
$rs = ApplicationPeer::doSelectRS( $c );
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs->next();
$row = $rs->getRow();
while ( is_array ( $row ) ) {
$label = $row['APP_STATUS'];
$value = $row['CANT'];
$dataSet->addPoint(new Point($label , (int)$value ) );
$rs->next();
$row = $rs->getRow();
}
return $dataSet;
}
//we are trying to obtain the process title thru the long way, using the process object.
//there is a short way, if you use a more complex query joining Content Table.
function getDatasetCasesByProcess ( ) {
$dataSet = new XYDataSet();
$processObj = new Process;
$c = new Criteria('workflow');
$c->clearSelectColumns();
$c->addSelectColumn ( ApplicationPeer::PRO_UID );
$c->addSelectColumn ( 'COUNT(*) AS CANT') ;
//$c->addJoin( ProcessPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$c->addGroupByColumn(ApplicationPeer::PRO_UID);
$rs = ApplicationPeer::doSelectRS( $c );
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs->next();
$row = $rs->getRow();
while ( is_array ( $row ) ) {
$processObj->load ( $row['PRO_UID'] );
$label = $processObj->getProTitle();
$value = $row['CANT'];
$dataSet->addPoint(new Point($label , (int)$value) );
$rs->next();
$row = $rs->getRow();
}
return $dataSet;
}
}

View File

@@ -1 +0,0 @@
a:1:{s:6:"ACCEPT";s:4:"Save";}

View File

@@ -1,60 +0,0 @@
<?php
/**
* dashboard.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* 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
* 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/>.
*
* 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_SETUP"))!=1) return $RBAC_Response;
require_once ( "class.charts.php" );
header("Content-type: image/png");
//type of chart, pie, vertical bar, horizontal, etc.
$type = isset ( $_GET['type']) ? $_GET['type'] : '1' ;
$chartType = isset ( $_GET['chart']) ? $_GET['chart'] : '1' ;
$user = isset ( $_GET['user']) ? $_GET['user'] : $_SESSION['USER_LOGGED'] ;
$chartsObj = new chartsClass();
//$chart = new PieChart(450,300);
switch ( $type ) {
case '1' :
$chart = new VerticalBarChart(430, 280); break;
case '2' :
$chart = new HorizontalBarChart(430, 200); break;
case '3' :
$chart = new LineChart(430, 280); break;
case '4' :
$chart = new PieChart(430, 200 ); break;
}
switch ( $chartType ) {
case '1' :
$dataSet = $chartsObj->getDatasetCasesByStatus(); break;
default :
$dataSet = $chartsObj->getDatasetCasesByProcess(); break;
}
$chart->setDataSet($dataSet);
$chart->setTitle( "Cases list" );
$chart->render();

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm
name="About Charts Plugin"
type="xmlform"
width="550"
>
<TITLE type="title" >
<en>About charts Plugin</en>
</TITLE>
<sTITLE type="subtitle" >
<en>This is the Charts Plugin, with this plugin you can see many differents charts</en>
</sTITLE>
<ACCEPT type="submit" >
<en>Save</en>
</ACCEPT>
</dynaForm>