initial commit from rev. 632

This commit is contained in:
Erik Amaru Ortiz
2010-12-02 23:34:41 +00:00
commit 0525681d79
5410 changed files with 864427 additions and 0 deletions

View File

@@ -0,0 +1,106 @@
<?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

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

View File

@@ -0,0 +1,60 @@
<?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" );
G::LoadThirdParty("libchart/classes", "libchart" );
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

@@ -0,0 +1,20 @@
<?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>