CODE STYLE

files modified:
eventList.php
eventsAjax.php
eventsCompleted.php
eventsDelete.php
eventsEdit.php
eventsEditAction.php
eventsNew.php
eventsNewAction.php
eventsPending.php
eventsSave.php
eventsSetupGraph.php
triggersSave.php
This commit is contained in:
Ralph Asendeteufrer
2012-10-18 12:53:09 -04:00
parent c1aeaa801c
commit 77be29ba8c
12 changed files with 560 additions and 575 deletions

View File

@@ -20,14 +20,13 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
die();
}
G::LoadClass( 'configuration' );
@@ -41,20 +40,21 @@ $G_ID_MENU_SELECTED = 'logs';
$G_ID_SUB_MENU_SELECTED = 'EVENT';
//get values for the comboBoxes
$userUid = ( isset($_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '' ) ?
$_SESSION['USER_LOGGED'] : null;
$status = array(
array('', G::LoadTranslation('ID_ALL')),
array("PENDING",G::LoadTranslation('ID_OPEN')),
array("COMPLETED",G::LoadTranslation('ID_CLOSE')));
$type = array(
array('', G::LoadTranslation('ID_ALL')),
array('SEND_MESSAGE',G::LoadTranslation('ID_EVENT_MESSAGE')),
array('EXECUTE_TRIGGER',G::LoadTranslation('ID_EVENT_TIMER')),
array('EXECUTE_CONDITIONAL_TRIGGER',G::LoadTranslation('ID_EVENT_CONDITIONAL')));
$userUid = (isset( $_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '') ? $_SESSION['USER_LOGGED'] : null;
$status = array (array ('',G::LoadTranslation( 'ID_ALL' )
),array ("PENDING",G::LoadTranslation( 'ID_OPEN' )
),array ("COMPLETED",G::LoadTranslation( 'ID_CLOSE' )
)
);
$type = array (array ('',G::LoadTranslation( 'ID_ALL' )
),array ('SEND_MESSAGE',G::LoadTranslation( 'ID_EVENT_MESSAGE' )
),array ('EXECUTE_TRIGGER',G::LoadTranslation( 'ID_EVENT_TIMER' )
),array ('EXECUTE_CONDITIONAL_TRIGGER',G::LoadTranslation( 'ID_EVENT_CONDITIONAL' )
)
);
$processes = getProcessArray( $userUid );
$G_PUBLISH = new Publisher;
$G_PUBLISH = new Publisher();
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript( 'events/eventList', false ); //adding a javascript file .js
@@ -64,7 +64,8 @@ $oHeadPublisher->assign( 'typeValues', $type );
$oHeadPublisher->assign( 'statusValues', $status );
$oHeadPublisher->assign( 'processValues', $processes );
function getProcessArray ( $userUid ) {
function getProcessArray ($userUid)
{
global $oAppCache;
require_once ("classes/model/AppCacheView.php");

View File

@@ -6,7 +6,6 @@ require_once 'classes/model/Content.php';
switch($req){
case 'showUsers':
/*
$sql = "SELECT USR_UID, USR_EMAIL, CONCAT(USR_FIRSTNAME, ' ' , USR_LASTNAME) AS USR_FULLNAME FROM USERS WHERE USR_STATUS = 'ACTIVE' AND USR_EMAIL <> ''";
*/
@@ -40,7 +39,6 @@ switch($req){
G::LoadClass('ArrayPeer');
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('virtualtable');
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'events/usermailList', $oCriteria);
G::RenderPage('publish', 'raw');
@@ -56,14 +54,12 @@ switch($req){
$GROUP_TITLE = strip_tags($group->getGrpTitle());
$aRows[] = array('GRP_UID'=>$UID, 'GROUP_TITLE'=>$GROUP_TITLE);
}
global $_DBArray;
$_DBArray['virtualtable'] = $aRows;
$_SESSION['_DBArray'] = $_DBArray;
G::LoadClass('ArrayPeer');
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('virtualtable');
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'events/groupmailList', $oCriteria);
G::RenderPage('publish', 'raw');
@@ -72,25 +68,21 @@ switch($req){
G::LoadClass('xmlfield_InputPM');
$dynaformFields = getDynaformsVars($_SESSION['PROCESS'], false, false);
$fields = array(array('id' => 'char', 'dynaform' => 'char', 'name' => 'char'));
foreach ($dynaformFields as $dynaformField) {
$fields[] = array('id' => $dynaformField['sName'],
'name' => '<a href="#" style="color: black;" onclick="e.toAdd(\'' . $dynaformField['sName'] . '\', \'' . $dynaformField['sName'] . '\', \'dyn\');oPanel.remove();return false;">@#' . $dynaformField['sName'] . '</a>', 'label' => $dynaformField['sLabel']);
}
global $_DBArray;
$_DBArray['virtualtable'] = $fields;
$_SESSION['_DBArray'] = $_DBArray;
G::LoadClass('ArrayPeer');
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('virtualtable');
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'events/dynavarsList', $oCriteria);
G::RenderPage('publish', 'raw');
break;
case 'eventList':
$start = (isset($_REQUEST['start']))? $_REQUEST['start'] : '0';
$limit = (isset($_REQUEST['limit']))? $_REQUEST['limit'] : '25';
$proUid = (isset($_REQUEST['process']))? $_REQUEST['process'] : '';
@@ -120,8 +112,7 @@ switch($req){
if ($sort != '') {
if ($dir == 'ASC') {
$criteria->addAscendingOrderByColumn($sort);
}
else {
} else {
$criteria->addDescendingOrderByColumn($sort);
}
} else {
@@ -145,3 +136,4 @@ switch($req){
die(G::json_encode($response));
break;
}

View File

@@ -20,19 +20,19 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
die();
}
require_once 'classes/model/AppEvent.php';
$oAppEvent = new AppEvent();
global $G_PUBLISH;
$G_PUBLISH = new Publisher;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'events/appEventsListCompleted', $oAppEvent->getAppEventsCriteria( $_GET['PRO_UID'], 'COMPLETED', $_GET['EVN_TYPE'] ) );
G::RenderPage( 'publish', 'raw' );

View File

@@ -20,16 +20,16 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
die();
}
$evnUid = $_POST['EVN_UID'];
require_once 'classes/model/Event.php';
$oEvent = new Event();
$oEvent->remove( $evnUid );

View File

@@ -20,13 +20,12 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
die();
}
G::LoadClass( 'tasks' );
@@ -37,12 +36,10 @@ if (isset($_GET['EVN_UID'])) {
require_once 'classes/model/Event.php';
$oEvent = new Event();
$aFields = $oEvent->load( $_GET['EVN_UID'] );
}
else {
} else {
$aFields = array ('PRO_UID' => $_GET['PRO_UID'] );
}
if (! isset( $_SESSION['PROCESS'] )) {
if (isset( $aFields['PRO_UID'] )) {
$_SESSION['PROCESS'] = $aFields['PRO_UID'];
@@ -52,16 +49,14 @@ if (!isset($_SESSION['PROCESS'])){
$oTasks = new Tasks();
$aAux1 = $oTasks->getAllTasks( $aFields['PRO_UID'] );
$aTasks = array ();
$aTasks[] = array('TAS_UID' => 'char',
'TAS_TITLE' => 'char');
$aTasks[] = array ('TAS_UID' => 'char','TAS_TITLE' => 'char');
foreach ($aAux1 as $aAux2) {
if ($aAux2['TAS_TYPE'] != 'SUBPROCESS') {
$aTasks[] = array ('TAS_UID' => $aAux2['TAS_UID'],'TAS_TITLE' => $aAux2['TAS_TITLE'] );
}
}
$oProcessMap = new processMap(new DBConnection);
$oProcessMap = new processMap( new DBConnection() );
$aTriggersList = $oProcessMap->getTriggers( $_SESSION['PROCESS'] );
$aTriggersFileds = Array ('TRI_UID' => 'char','TRI_TITLE' => 'char');
@@ -71,15 +66,14 @@ foreach($aTriggersList as $i=>$v){
$aTriggersList[$i]['TRI_TITLE'] = (strlen( $aTriggersList[$i]['TRI_TITLE'] ) > 32) ? substr( $aTriggersList[$i]['TRI_TITLE'], 0, 32 ) . '...' : $aTriggersList[$i]['TRI_TITLE'];
}
$aTriggersList = array_merge(Array($aTriggersFileds), $aTriggersList);
$aTriggersList = array_merge( Array ($aTriggersFileds, $aTriggersList ));
$_DBArray['tasks'] = $aTasks;
$_DBArray['TMP_TRIGGERS'] = $aTriggersList;
$_SESSION['_DBArray'] = $_DBArray;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'events/eventsEdit', '', $aFields, '../events/eventsSave' );
G::RenderPage( 'publish', 'raw' );
?>

View File

@@ -20,7 +20,6 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
global $_DBArray;
@@ -28,14 +27,14 @@ global $_DBArray;
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
die();
}
if (isset( $_SESSION['EVN_UID'] )) {
$evnUid = $_SESSION['EVN_UID'];
unset( $_SESSION['EVN_UID'] );
}
else
} else {
$evnUid = $_GET['EVN_UID'];
}
require_once 'classes/model/Event.php';
require_once 'classes/model/Triggers.php';
@@ -49,7 +48,7 @@ $aTrigger = $oTrigger->load($aFields['TRI_UID']);
$hash = md5( $oTrigger->getTriWebbot() );
//var_dump($hash,$parameters->hash);die;
//if the hash is different, the script was edited , so we will show the trigger editor.
if ( ( isset($parameters->hash) && $hash <> $parameters->hash ) || $aFields['EVN_ACTION'] == 'EXECUTE_TRIGGER' || $aFields['EVN_ACTION'] == 'EXECUTE_CONDITIONAL_TRIGGER' ) {
if ((isset( $parameters->hash ) && $hash != $parameters->hash) || $aFields['EVN_ACTION'] == 'EXECUTE_TRIGGER' || $aFields['EVN_ACTION'] == 'EXECUTE_CONDITIONAL_TRIGGER') {
$oTriggerParams = unserialize( $aTrigger['TRI_PARAM'] );
// check again a hash, this time to check the trigger itself integrity
if ($oTriggerParams['hash'] != $hash) {
@@ -58,14 +57,14 @@ if ( ( isset($parameters->hash) && $hash <> $parameters->hash ) || $aFields['EVN
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'triggers/triggersNarrowEdit', '', $aTrigger, '../events/triggersSave' );
G::RenderPage( 'publish', 'raw' );
die;
die();
} else {
// if not launch the wizard view.
$triUid = $aFields['TRI_UID'];
$_GET = $oTriggerParams['params'];
$_GET['TRI_UID'] = $triUid;
require_once (PATH_METHODS . 'triggers/triggers_EditWizard.php');
die;
die();
}
}
@@ -81,7 +80,6 @@ if(isset($parameters->TO)){
case 'usr':
require_once ('classes/model/Users.php');
$user = new Users();
if ($row[1] == '-1') {
$value = '(Current Task User)';
} else {
@@ -89,31 +87,29 @@ if(isset($parameters->TO)){
$value = $rec['USR_FIRSTNAME'] . ' ' . $rec['USR_LASTNAME'];
}
break;
case 'grp':
G::LoadClass( 'groups' );
$group = new Groups();
$rec = $group->load( $row[1] );
$value = strip_tags( $rec->getGrpTitle() );
break;
case 'ext':
$value = htmlentities( $row[1] );
break;
case 'dyn':
$value = htmlentities( '@#' . $row[1] );
break;
default:
echo '->' . $row[0];
}
$paramTO[] = Array('id'=>replaceQuotes($item), 'name'=>$value);
$paramTO[] = Array ('id' => replaceQuotes( $item ),'name' => $value
);
}
} else {
$paramTO[] = Array('id'=>'char', 'name'=>'char');
$paramTO[] = Array('id'=>'usr|-1', 'name'=>'(Current Task User)');
$paramTO[] = Array ('id' => 'char','name' => 'char'
);
$paramTO[] = Array ('id' => 'usr|-1','name' => '(Current Task User)'
);
}
$_DBArray['eventomsgto'] = $paramTO;
@@ -133,24 +129,21 @@ if(isset($parameters->CC)){
$value = $rec['USR_FIRSTNAME'] . ' ' . $rec['USR_LASTNAME'];
}
break;
case 'grp':
G::LoadClass( 'groups' );
$group = new Groups();
$rec = $group->load( $row[1] );
$value = strip_tags( $rec->getGrpTitle() );
break;
case 'ext':
$value = htmlentities( $row[1] );
break;
case 'dyn':
$value = htmlentities( '@#' . $row[1] );
break;
}
$paramCC[] = Array('id'=>replaceQuotes($item), 'name'=>$value);
$paramCC[] = Array ('id' => replaceQuotes( $item ),'name' => $value
);
}
$_DBArray['eventomsgcc'] = $paramCC;
@@ -175,19 +168,15 @@ if(isset($parameters->BCC)){
$value = $rec['USR_FIRSTNAME'] . ' ' . $rec['USR_LASTNAME'];
}
break;
case 'grp':
G::LoadClass( 'groups' );
$group = new Groups();
$rec = $group->load( $row[1] );
$value = strip_tags( $rec->getGrpTitle() );
break;
case 'ext':
$value = htmlentities( $row[1] );
break;
case 'dyn':
$value = htmlentities( '@#' . $row[1] );
break;
@@ -205,10 +194,8 @@ $aFields['EVN_MESSAGE_TO_CC'] = (isset($parameters->CC) ? $paramCC : '');
$aFields['EVN_MESSAGE_TO_BCC'] = (isset( $parameters->BCC ) ? $paramBCC : '');
$aFields['EVN_MESSAGE_TEMPLATE'] = (isset( $parameters->TEMPLATE ) ? $parameters->TEMPLATE : '');
$aTemplates = array ();
$aTemplates[] = array('TEMPLATE1' => 'char',
'TEMPLATE2' => 'char');
$aTemplates[] = array ('TEMPLATE1' => 'char','TEMPLATE2' => 'char');
$sDirectory = PATH_DATA_MAILTEMPLATES . $aFields['PRO_UID'] . PATH_SEP;
G::verifyPath( $sDirectory, true );
if (! file_exists( $sDirectory . 'alert_message.html' )) {
@@ -217,22 +204,19 @@ if (!file_exists($sDirectory . 'alert_message.html')) {
$oDirectory = dir( $sDirectory );
while ($sObject = $oDirectory->read()) {
if (($sObject !== '.') && ($sObject !== '..') && ($sObject !== 'alert_message.html')) {
$aTemplates[] = array('TEMPLATE1' => $sObject,
'TEMPLATE2' => $sObject);
$aTemplates[] = array ('TEMPLATE1' => $sObject,'TEMPLATE2' => $sObject);
}
}
$_DBArray['templates'] = $aTemplates;
$aTriggers[] = array('TRI_UID' => 'char',
'TRI_TITLE' => 'char');
$aTriggers[] = array ('TRI_UID' => 'char','TRI_TITLE' => 'char');
G::LoadClass( 'processMap' );
$oProcessMap = new ProcessMap();
$oDataset = TriggersPeer::doSelectRS( $oProcessMap->getTriggersCriteria( $aFields['PRO_UID'] ) );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$aTriggers[] = array('TRI_UID' => $aRow['TRI_UID'],
'TRI_TITLE' => $aRow['TRI_TITLE']);
$aTriggers[] = array ('TRI_UID' => $aRow['TRI_UID'],'TRI_TITLE' => $aRow['TRI_TITLE'] );
$oDataset->next();
}
$_DBArray['triggers'] = $aTriggers;
@@ -244,6 +228,8 @@ $G_PUBLISH->AddContent('xmlform', 'xmlform', 'events/eventsEditAction', '', $aFi
//$G_PUBLISH->AddContent('xmlform', 'xmlform', 'events/eventsEditAction', '', $aFields, '../events/eventsSave');
G::RenderPage( 'publish', 'raw' );
function replaceQuotes($aData){
function replaceQuotes ($aData)
{
return str_replace( '"', '&quote;', $aData );
}

View File

@@ -20,13 +20,12 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
die();
}
global $_DBArray;
@@ -45,7 +44,7 @@ foreach ($aAux1 as $aAux2) {
}
}
$oProcessMap = new processMap(new DBConnection);
$oProcessMap = new processMap( new DBConnection() );
$aTriggersList = $oProcessMap->getTriggers( $_SESSION['PROCESS'] );
$aTriggersFileds = Array ('TRI_UID' => 'char','TRI_TITLE' => 'char');

View File

@@ -20,13 +20,12 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
die();
}
global $_DBArray;
@@ -39,7 +38,7 @@ $envUId = $oEvent->create($_POST);
$_SESSION['EVN_UID'] = $envUId;
require_once ('eventsEditAction.php');
die;
die();
/*
//this page is showing the parameters for setup email messages and triggers,
@@ -81,3 +80,4 @@ $G_PUBLISH->AddContent('xmlform', 'xmlform', 'events/events_EditAction', '', $_P
G::RenderPage('publish', 'raw');
*/

View File

@@ -20,19 +20,19 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
die();
}
require_once 'classes/model/AppEvent.php';
$oAppEvent = new AppEvent();
global $G_PUBLISH;
$G_PUBLISH = new Publisher;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'events/appEventsList', $oAppEvent->getAppEventsCriteria( $_GET['PRO_UID'], 'PENDING', $_GET['EVN_TYPE'] ) );
G::RenderPage( 'publish', 'raw' );

View File

@@ -20,26 +20,19 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
die();
}
$EVN_MESSAGE_TO_TO = isset( $_POST['form']['EVN_MESSAGE_TO_TO'] ) ? replaceQuotes( $_POST['form']['EVN_MESSAGE_TO_TO'] ) : Array ();
$EVN_MESSAGE_TO_CC = isset( $_POST['form']['EVN_MESSAGE_TO_CC'] ) ? replaceQuotes( $_POST['form']['EVN_MESSAGE_TO_CC'] ) : Array ();
$EVN_MESSAGE_TO_BCC = isset( $_POST['form']['EVN_MESSAGE_TO_BCC'] ) ? replaceQuotes( $_POST['form']['EVN_MESSAGE_TO_BCC'] ) : Array ();
if (isset( $_POST['form']['EVN_MESSAGE_SUBJECT'] )) {
$_POST['form']['EVN_ACTION_PARAMETERS'] = array(
'SUBJECT' => $_POST['form']['EVN_MESSAGE_SUBJECT'],
'TO' => $EVN_MESSAGE_TO_TO,
'CC' => $EVN_MESSAGE_TO_CC,
'BCC' => $EVN_MESSAGE_TO_BCC,
'TEMPLATE' => $_POST['form']['EVN_MESSAGE_TEMPLATE']
);
$_POST['form']['EVN_ACTION_PARAMETERS'] = array ('SUBJECT' => $_POST['form']['EVN_MESSAGE_SUBJECT'],'TO' => $EVN_MESSAGE_TO_TO,'CC' => $EVN_MESSAGE_TO_CC,'BCC' => $EVN_MESSAGE_TO_BCC,'TEMPLATE' => $_POST['form']['EVN_MESSAGE_TEMPLATE']);
unset( $_POST['form']['EVN_MESSAGE_SUBJECT'] );
unset( $_POST['form']['EVN_MESSAGE_TO_TO'] );
@@ -54,8 +47,7 @@ $oEvent = new Event();
if ($_POST['form']['EVN_UID'] == '') {
//this is probably not used, because the creation of one Event is done directly in EventsNewAction
$oEvent->create( $_POST['form'] );
}
else {
} else {
/*
*if($_POST['form']['EVN_ACTION'] == 'SEND_MESSAGE' && $ev->getTriUid() != trim($_POST['form']['TRI_UID']) ){
$oEvnActionParameters = unserialize($ev->getEvnActionParameters());
@@ -63,15 +55,16 @@ else {
if( isset($oEvnActionParameters->TRI_UID) ){
$_POST['form']['TRI_UID'] = $oEvnActionParameters->TRI_UID;
}
}
*/
$oEvent->update( $_POST['form'] );
}
function replaceQuotes($aData){
function replaceQuotes ($aData)
{
for ($i = 0; $i < sizeof( $aData ); $i ++) {
$aData[$i] = str_replace( "&quote;", '"', $aData[$i] );
}
return $aData;
}

View File

@@ -5,15 +5,21 @@
//how many task, single task or multiple
$t = isset( $_GET['t'] ) ? $_GET['t'] : 's';
if ( $t != 's' ) $t = 'm';
if ($t != 's') {
$t = 'm';
}
//when occurs, after time elapses or when starting
$o = isset( $_GET['o'] ) ? $_GET['o'] : 's';
if ( $t != 's' ) $t = 'a';
if ($t != 's') {
$t = 'a';
}
//status
$s = isset( $_GET['s'] ) ? $_GET['s'] : 'a';
if ( $s != 'a' ) $s = 'i';
if ($s != 'a') {
$s = 'i';
}
//timeUnit
$timeunit = isset( $_GET['t'] ) ? $_GET['t'] : 'Days';
@@ -22,11 +28,9 @@
//estimated
$estimated = abs( isset( $_GET['e'] ) ? (($timeunit == 'Hours') ? round( $_GET['e'] / 24, 2 ) : $_GET['e']) : '1' );
//when
$when = isset( $_GET['w'] ) ? $_GET['w'] : '0';
$im = imagecreate( $w, $h );
$bg = imagecolorallocate( $im, 0xFF, 0xFF, 0xFF );
$fg = imagecolorallocate( $im, 0x00, 200, 0x00 );
@@ -41,15 +45,18 @@
// $incM = $media/60;
// $mean = 60*$incM;
// $d = $varianza;
// if ( $d == 0 ) $d = 0.0001;
// $val1 = 1 / ( sqrt( 2*pi() *$d*$d ));
// $val2 = -( pow($mean-$mean,2) )/ (pow($d,2));
// $y = $val1 * exp ( $val2 );
// $incY = 80/$y;
// $range = 90/ $d;
// $offsetX = 100 - $mean;
// $antY = null;
@@ -63,7 +70,9 @@
// imageline($im, $x +$mean, $h , $x + $mean, $h-1, $red);
// }
function drawTask ( $im, $x1, $x2, $y, $h ) {
function drawTask ($im, $x1, $x2, $y, $h)
{
global $w;
$blue = imagecolorallocate( $im, 160, 160, 180 );
$gray = imagecolorallocate( $im, 100, 100, 100 );
@@ -78,9 +87,11 @@
imageline( $im, $i, $y - 10, $i, $y, $blue );
}
imagerectangle( $im, $x1, $y - 10, $x2, $y, $black );
};
}
;
function smallTask ($im, $x1, $x2, $y ) {
function smallTask ($im, $x1, $x2, $y)
{
$blue = imagecolorallocate( $im, 160, 160, 180 );
$black = imagecolorallocate( $im, 0, 0, 0 );
@@ -90,7 +101,8 @@
imagerectangle( $im, $x1, $y - 9, $x2 - 1, $y, $black );
}
function drawMultipleTask ( $im, $x1, $x2, $y, $h ) {
function drawMultipleTask ($im, $x1, $x2, $y, $h)
{
global $w;
$terca = ($x2 - $x1) / 3;
$blue = imagecolorallocate( $im, 160, 160, 180 );
@@ -107,9 +119,11 @@
smallTask( $im, $x1 + 0 * $terca, $x1 + 1 * $terca, $y - 12 );
smallTask( $im, $x1 + 1 * $terca, $x1 + 2 * $terca, $y - 6 );
smallTask( $im, $x1 + 2 * $terca, $x1 + 3 * $terca, $y );
};
}
;
function drawTimerEvent ( $im, $x1, $y1, $h ) {
function drawTimerEvent ($im, $x1, $y1, $h)
{
$blue = imagecolorallocate( $im, 160, 160, 180 );
$red = imagecolorallocate( $im, 200, 100, 0 );
$gray = imagecolorallocate( $im, 100, 100, 100 );
@@ -135,7 +149,6 @@
imageline( $im, $x1 - 1, $y1 + 1, $x1 + 1, $y1 - 5, $red );
imageline( $im, $x1 - 1, $y1 + 1, $x1 + 3, $y1 + 1, $red );
}
imageline( $im, 15, $h - 19, $w - 15, $h - 19, $red );
@@ -147,20 +160,20 @@
$s = 'i';
header( "Content-Type: image/png" );
imagepng( $im );
die;
die();
}
if ( $t == 's' )
if ($t == 's') {
drawTask( $im, 80, 220, $h - 30, $h - 15 );
else
} else {
drawMultipleTask( $im, 80, 220, $h - 30, $h - 15 );
}
//the zero
imagestring( $im, 3, 80 - 4, $h - 16, '0', $black );
//the estimated
imagestring( $im, 2, 220 - 4, $h - 16, $estimated, $black );
//when is negative and the event occurs at starting, then this event never will occurs
if ($when < 0 && $o == 's') {
$xTimer = 30;
@@ -170,18 +183,21 @@
//when is negative and the event occurs after, then this event will occurs
if ($when < 0 && $o == 'a') {
if ( abs($when) > abs($estimated) ) { //this event is before the start of the task, so will never occurs
if (abs( $when ) > abs( $estimated )) {
//this event is before the start of the task, so will never occurs
$xTimer = 30;
$sWhen = abs( $when ) - abs( $estimated );
imagestring( $im, 2, $xTimer - 8, $h - 16, $sWhen, $black );
$s = 'i';
}
if ( abs($when) < abs($estimated) ) { //this event is after the start of the task, drawing
if (abs( $when ) < abs( $estimated )) {
//this event is after the start of the task, drawing
$xTimer = 170;
$sWhen = $estimated + $when;
imagestring( $im, 2, $xTimer - 4, $h - 16, $sWhen, $black );
}
if ( abs($when) == abs($estimated) ) { //this event is exactly at starting
if (abs( $when ) == abs( $estimated )) {
//this event is exactly at starting
$xTimer = 80;
$sWhen = $estimated + $when;
imagestring( $im, 2, $xTimer - 4, $h - 16, $sWhen, $black );
@@ -197,10 +213,15 @@
//when is positive and the event occurs starting, then this event will occurs
if ($when > 0 && $o == 's') {
if ( abs($when) < abs($estimated) ) $xTimer = 140;
if ( abs($when) > abs($estimated) ) $xTimer = 270;
if ( abs($when) == abs($estimated) ) $xTimer = 220;
if (abs( $when ) < abs( $estimated )) {
$xTimer = 140;
}
if (abs( $when ) > abs( $estimated )) {
$xTimer = 270;
}
if (abs( $when ) == abs( $estimated )) {
$xTimer = 220;
}
imagestring( $im, 2, $xTimer - 4, $h - 16, $when, $black );
}
@@ -214,4 +235,5 @@
header( "Content-Type: image/png" );
imagepng( $im );
die;
die();

View File

@@ -20,21 +20,19 @@
*
* 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;
}
require_once ('classes/model/Triggers.php');
$oTrigger = new Triggers();
if ($_POST['form']['TRI_UID'] != '')
{
if ($_POST['form']['TRI_UID'] != '') {
$oTrigger->load( $_POST['form']['TRI_UID'] );
}
else
{
} else {
$oTrigger->create( $_POST['form'] );
$_POST['form']['TRI_UID'] = $oTrigger->getTriUid();
}
$oTrigger->update( $_POST['form'] );
?>