CODE STYLE changes...

FILES:
workflow/engine/classes/class.pmGauge.php
workflow/engine/classes/model/AppMessage.php
workflow/engine/classes/model/CaseTracker.php
workflow/engine/classes/model/CaseTrackerObject.php
workflow/engine/classes/model/GroupUser.php
workflow/engine/classes/model/LoginLog.php
workflow/engine/classes/model/ObjectPermission.php
This commit is contained in:
jennylee
2012-10-19 17:09:00 -04:00
parent 669370c080
commit 679c33224c
7 changed files with 720 additions and 740 deletions

View File

@@ -66,7 +66,7 @@ class pmGauge
$center_x = intval( $width / 2 ); $center_x = intval( $width / 2 );
$center_y = intval( $height / 2 ); $center_y = intval( $height / 2 );
//gauge color //gauge color
$bgcolor = ImageColorAllocate( $im, 247, 247, 247 ); $bgcolor = ImageColorAllocate( $im, 247, 247, 247 );
$extRing = ImageColorAllocate( $im, 214, 214, 214 ); $extRing = ImageColorAllocate( $im, 214, 214, 214 );
$blueRing = ImageColorAllocate( $im, 70, 132, 238 ); $blueRing = ImageColorAllocate( $im, 70, 132, 238 );
@@ -85,26 +85,26 @@ class pmGauge
ImageFilledRectangle( $im, 0, 0, $width - 1, $height - 1, $white ); ImageFilledRectangle( $im, 0, 0, $width - 1, $height - 1, $white );
ImageRectangle( $im, 0, 0, $width - 1, $height - 1, $gray ); ImageRectangle( $im, 0, 0, $width - 1, $height - 1, $gray );
//center coords //center coords
$cX = intval( $this->w / 2 ); $cX = intval( $this->w / 2 );
//$cX = intval($this->w /4); //$cX = intval($this->w /4);
$cY = intval( $this->h / 2 ); $cY = intval( $this->h / 2 );
//diameter for gauge //diameter for gauge
$diameter = intval( $this->h * 4 / 5 ); $diameter = intval( $this->h * 4 / 5 );
$this->renderGauge( $im, $cX, $cY, $diameter ); $this->renderGauge( $im, $cX, $cY, $diameter );
/* /*
//center coords //center coords
$cX = intval($this->w * 3/4); $cX = intval($this->w * 3/4);
$cY = intval($this->h /2); $cY = intval($this->h /2);
//diameter for gauge //diameter for gauge
$diameter = intval( $this->h * 4/5 ); $diameter = intval( $this->h * 4/5 );
$this->renderGauge($im, $cX, $cY, $diameter); $this->renderGauge($im, $cX, $cY, $diameter);
*/ */
Header( "Content-type: image/png" ); Header( "Content-type: image/png" );
ImagePng( $im ); ImagePng( $im );
@@ -112,7 +112,7 @@ class pmGauge
function renderGauge ($im, $cX, $cY, $diameter) function renderGauge ($im, $cX, $cY, $diameter)
{ {
//gauge color //gauge color
$bgcolor = ImageColorAllocate( $im, 247, 247, 247 ); $bgcolor = ImageColorAllocate( $im, 247, 247, 247 );
$extRing = ImageColorAllocate( $im, 214, 214, 214 ); $extRing = ImageColorAllocate( $im, 214, 214, 214 );
$blueRing = ImageColorAllocate( $im, 70, 132, 238 ); $blueRing = ImageColorAllocate( $im, 70, 132, 238 );
@@ -129,7 +129,7 @@ class pmGauge
$fontArial = PATH_THIRDPARTY . 'html2ps_pdf/fonts/arial.ttf'; $fontArial = PATH_THIRDPARTY . 'html2ps_pdf/fonts/arial.ttf';
$dX = intval( $diameter * 8 / 7 ); //for now ratio aspect is 8:7 $dX = intval( $diameter * 8 / 7 ); //for now ratio aspect is 8:7
$dY = intval( $diameter ); $dY = intval( $diameter );
$dXRing = intval( $dX * 0.90 ); $dXRing = intval( $dX * 0.90 );
$dYRing = intval( $dY * 0.90 ); $dYRing = intval( $dY * 0.90 );
@@ -144,19 +144,25 @@ class pmGauge
imagefilledellipse( $im, $cX, $cY, $dXRing, $dYRing, $bgcolor ); imagefilledellipse( $im, $cX, $cY, $dXRing, $dYRing, $bgcolor );
//drawing the red arc //drawing the red arc
if ($this->redFrom > $this->maxValue) if ($this->redFrom > $this->maxValue) {
$this->redFrom = $this->maxValue; $this->redFrom = $this->maxValue;
if ($this->redTo > $this->maxValue) }
if ($this->redTo > $this->maxValue) {
$this->redTo = $this->maxValue; $this->redTo = $this->maxValue;
if ($this->yellowFrom > $this->maxValue) }
if ($this->yellowFrom > $this->maxValue) {
$this->yellowFrom = $this->maxValue; $this->yellowFrom = $this->maxValue;
if ($this->yellowTo > $this->maxValue) }
if ($this->yellowTo > $this->maxValue) {
$this->yellowTo = $this->maxValue; $this->yellowTo = $this->maxValue;
if ($this->greenFrom > $this->maxValue) }
if ($this->greenFrom > $this->maxValue) {
$this->greenFrom = $this->maxValue; $this->greenFrom = $this->maxValue;
if ($this->greenTo > $this->maxValue) }
if ($this->greenTo > $this->maxValue) {
$this->greenTo = $this->maxValue; $this->greenTo = $this->maxValue;
}
$redFrom = $this->redFrom / $this->maxValue * 300 - 240; $redFrom = $this->redFrom / $this->maxValue * 300 - 240;
$redTo = $this->redTo / $this->maxValue * 300 - 240; $redTo = $this->redTo / $this->maxValue * 300 - 240;
@@ -176,15 +182,16 @@ class pmGauge
} }
imagefilledellipse( $im, $cX, $cY, $dXRingCenter, $dYRingCenter, $bgcolor ); imagefilledellipse( $im, $cX, $cY, $dXRingCenter, $dYRingCenter, $bgcolor );
//ticks //ticks
$radiusX = intval( $dX * 0.42 ); $radiusX = intval( $dX * 0.42 );
$radiusY = intval( $dY * 0.42 ); $radiusY = intval( $dY * 0.42 );
$min = 5; $min = 5;
while ($min <= 55) { while ($min <= 55) {
if ($min % 5 == 0) if ($min % 5 == 0) {
$len = $radiusX / 8; $len = $radiusX / 8;
else } else {
$len = $radiusX / 25; $len = $radiusX / 25;
}
$ang = (2 * M_PI * $min) / 60; $ang = (2 * M_PI * $min) / 60;
$x1 = sin( $ang ) * ($radiusX - $len) + $cX; $x1 = sin( $ang ) * ($radiusX - $len) + $cX;
@@ -198,7 +205,7 @@ class pmGauge
$textToDisplay = sprintf( "%d", (55 - $min) * $this->maxValue / 50 ); $textToDisplay = sprintf( "%d", (55 - $min) * $this->maxValue / 50 );
$bbox = imagettfbbox( 8, 0, $fontArial, $textToDisplay ); $bbox = imagettfbbox( 8, 0, $fontArial, $textToDisplay );
$x1 = sin( $ang ) * ($radiusX - 2.5 * $len) + $cX - $bbox[4] / 2; $x1 = sin( $ang ) * ($radiusX - 2.5 * $len) + $cX - $bbox[4] / 2;
$y1 = cos( $ang ) * ($radiusY - 2.5 * $len) + $cY + 2; // - abs($bbox[5]); $y1 = cos( $ang ) * ($radiusY - 2.5 * $len) + $cY + 2; // - abs($bbox[5]);
imagettftext( $im, 8, 0, $x1, $y1, $gray, $fontArial, $textToDisplay ); imagettftext( $im, 8, 0, $x1, $y1, $gray, $fontArial, $textToDisplay );
} }
$min ++; $min ++;
@@ -215,7 +222,7 @@ class pmGauge
imagettftext( $im, 9, 0, $cX * 0.60, $cY * 1.8, $gray, $fontArial, $this->open ); imagettftext( $im, 9, 0, $cX * 0.60, $cY * 1.8, $gray, $fontArial, $this->open );
imagettftext( $im, 9, 0, $cX * 1.40, $cY * 1.8, $gray, $fontArial, $this->completed ); imagettftext( $im, 9, 0, $cX * 1.40, $cY * 1.8, $gray, $fontArial, $this->completed );
//drawing the arrow, simple way //drawing the arrow, simple way
$radiusX = intval( $dX * 0.35 ); $radiusX = intval( $dX * 0.35 );
$radiusY = intval( $dY * 0.35 ); $radiusY = intval( $dY * 0.35 );
@@ -224,41 +231,41 @@ class pmGauge
$y1 = cos( $ang ) * ($radiusY) + $cY; $y1 = cos( $ang ) * ($radiusY) + $cY;
ImageLine( $im, $cX, $cY, $x1, $y1, $arrowLine ); ImageLine( $im, $cX, $cY, $x1, $y1, $arrowLine );
/* /*
//arrowLine //arrowLine
$arrowHeight = intval($dY * 0.02); $arrowHeight = intval($dY * 0.02);
$arrowWidth = intval($dX * 0.35); $arrowWidth = intval($dX * 0.35);
$arrowTail = intval($dX * 0.15); $arrowTail = intval($dX * 0.15);
$values = array( $values = array(
0, -$arrowHeight, 0, -$arrowHeight,
-$arrowTail, 0, -$arrowTail, 0,
0, $arrowHeight, 0, $arrowHeight,
$arrowWidth, 0, $arrowWidth, 0,
0, -$arrowHeight 0, -$arrowHeight
); );
//rotate n degrees //rotate n degrees
$n = 20; $n = 20;
$ang = (2 * M_PI * $n) / 60; $ang = (2 * M_PI * $n) / 60;
foreach ( $values as $k => $val ) { foreach ( $values as $k => $val ) {
if ( $k % 2 == 0 ) { if ( $k % 2 == 0 ) {
//$values[$k] = sin($ang)*$val + 20; //$values[$k] = sin($ang)*$val + 20;
$values[$k] = sin($ang)*($val/$cX)*$; $values[$k] = sin($ang)*($val/$cX)*$;
$values[$k] += $cX; $values[$k] += $cX;
} }
else { else {
//$ys = intval(sin($sec * M_PI/30 - M_PI/2) * R); //$ys = intval(sin($sec * M_PI/30 - M_PI/2) * R);
//$values[$k] = intval(sin($n * M_PI/30 - M_PI/2) *$val); //$values[$k] = intval(sin($n * M_PI/30 - M_PI/2) *$val);
$values[$k] = (cos($ang))*($val/$cY)*$cY; $values[$k] = (cos($ang))*($val/$cY)*$cY;
$values[$k] += $cY; $values[$k] += $cY;
} }
} }
imagefilledpolygon ($im, $values, 5, $arrowBody); imagefilledpolygon ($im, $values, 5, $arrowBody);
imagepolygon ($im, $values, 5, $arrowLine); imagepolygon ($im, $values, 5, $arrowLine);
*/ */
//blue ring //blue ring
$dXBlueRing = $dX * 0.07; $dXBlueRing = $dX * 0.07;
$dYBlueRing = $dY * 0.07; $dYBlueRing = $dY * 0.07;
imagefilledellipse( $im, $cX, $cY, $dXBlueRing, $dXBlueRing, $blueRing ); imagefilledellipse( $im, $cX, $cY, $dXBlueRing, $dXBlueRing, $blueRing );
@@ -273,5 +280,5 @@ class pmGauge
imagettftext( $im, 9, 0, $centerX, $centerY, $black, $fontArial, $textToDisplay ); imagettftext( $im, 9, 0, $centerX, $centerY, $black, $fontArial, $textToDisplay );
} }
}
}

View File

@@ -1,11 +1,11 @@
<?php <?php
/** /**
* AppMessage.php * AppMessage.php
** @package workflow.engine.classes.model * * @package workflow.engine.classes.model
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc. * Copyright (C) 2004 - 2011 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -13,15 +13,14 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
require_once 'classes/model/om/BaseAppMessage.php'; require_once 'classes/model/om/BaseAppMessage.php';
@@ -29,93 +28,98 @@ require_once 'classes/model/om/BaseAppMessage.php';
/** /**
* Skeleton subclass for representing a row from the 'APP_MESSAGE' table. * Skeleton subclass for representing a row from the 'APP_MESSAGE' table.
* *
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
* long as it does not already exist in the output directory. * long as it does not already exist in the output directory.
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class AppMessage extends BaseAppMessage { class AppMessage extends BaseAppMessage
{
private $data_spool;
private $status_spool; private $data_spool;
private $error_spool; private $status_spool;
private $error_spool;
public function getSpoolStatus() {
return $this->status_spool; public function getSpoolStatus ()
} {
return $this->status_spool;
public function getSpoolError() {
return $this->error_spool;
}
/**
* AppMessgae quick Save method
* @param Array(msg_uid, app_uid, del_index, app_msg_type, app_msg_subject, app_msg_from, app_msg_to,
* app_msg_body, app_msg_cc, app_msg_bcc, app_msg_attach, app_msg_template, app_msg_status )
*
* @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@gmai.com>
* Date Aug 31th, 2009
*/
public function quickSave2($data_spool) {
$this->data_spool = $data_spool;
$sUID = G::generateUniqueID();
$spool = new AppMessage();
$spool->setAppMsgUid($sUID);
$spool->setMsgUid($data_spool['msg_uid']);
$spool->setAppUid($data_spool['app_uid']);
$spool->setDelIndex($data_spool['del_index']);
$spool->setAppMsgType($data_spool['app_msg_type']);
$spool->setAppMsgSubject($data_spool['app_msg_subject']);
$spool->setAppMsgFrom($data_spool['app_msg_from']);
$spool->setAppMsgTo($data_spool['app_msg_to']);
$spool->setAppMsgBody($data_spool['app_msg_body']);
$spool->setAppMsgDate(date('Y-m-d H:i:s'));
$spool->setAppMsgCc($data_spool['app_msg_cc']);
$spool->setAppMsgBcc($data_spool['app_msg_bcc']);
$spool->setappMsgAttach($data_spool['app_msg_attach']);
$spool->setAppMsgTemplate($data_spool['app_msg_template']);
$spool->setAppMsgStatus($data_spool['app_msg_status']);
if( !$spool->validate() ) {
$this->error_spool = $spool->getValidationFailures();
$this->status_spool = 'error';
$error_msg = "AppMessage::quickSave(): Validation error: \n";
foreach($errors as $key=>$value) {
$error_msg .= $value->getMessage($key) . "\n";
}
throw new Exception($error_msg);
} else {
//echo "Saving - validation ok\n";
$this->error_spool = '';
$this->status = 'success';
$spool->save();
} }
return $sUID;
} public function getSpoolError ()
{
return $this->error_spool;
public function quickSave($aData){
if(isset($aData['app_msg_uid'])) {
$o = EmployeePeer::retrieveByPk($aData['app_msg_uid']);
} }
if (isset($o) && is_object($o)&& get_class($o) == 'AppMessage') {
$o->fromArray($aData, BasePeer::TYPE_FIELDNAME); /**
$o->setAppMsgDate(date('Y-m-d H:i:s')); * AppMessgae quick Save method
$o->save(); *
return $o->getAppMsgUid(); * @param Array(msg_uid, app_uid, del_index, app_msg_type, app_msg_subject, app_msg_from, app_msg_to,
} else { * app_msg_body, app_msg_cc, app_msg_bcc, app_msg_attach, app_msg_template, app_msg_status )
$this->fromArray($aData, BasePeer::TYPE_FIELDNAME); *
$this->setAppMsgDate(date('Y-m-d H:i:s')); * @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@gmai.com>
$this->save(); * Date Aug 31th, 2009
return $this->getAppMsgUid(); */
public function quickSave2 ($data_spool)
{
$this->data_spool = $data_spool;
$sUID = G::generateUniqueID();
$spool = new AppMessage();
$spool->setAppMsgUid( $sUID );
$spool->setMsgUid( $data_spool['msg_uid'] );
$spool->setAppUid( $data_spool['app_uid'] );
$spool->setDelIndex( $data_spool['del_index'] );
$spool->setAppMsgType( $data_spool['app_msg_type'] );
$spool->setAppMsgSubject( $data_spool['app_msg_subject'] );
$spool->setAppMsgFrom( $data_spool['app_msg_from'] );
$spool->setAppMsgTo( $data_spool['app_msg_to'] );
$spool->setAppMsgBody( $data_spool['app_msg_body'] );
$spool->setAppMsgDate( date( 'Y-m-d H:i:s' ) );
$spool->setAppMsgCc( $data_spool['app_msg_cc'] );
$spool->setAppMsgBcc( $data_spool['app_msg_bcc'] );
$spool->setappMsgAttach( $data_spool['app_msg_attach'] );
$spool->setAppMsgTemplate( $data_spool['app_msg_template'] );
$spool->setAppMsgStatus( $data_spool['app_msg_status'] );
if (! $spool->validate()) {
$this->error_spool = $spool->getValidationFailures();
$this->status_spool = 'error';
$error_msg = "AppMessage::quickSave(): Validation error: \n";
foreach ($errors as $key => $value) {
$error_msg .= $value->getMessage( $key ) . "\n";
}
throw new Exception( $error_msg );
} else {
//echo "Saving - validation ok\n";
$this->error_spool = '';
$this->status = 'success';
$spool->save();
}
return $sUID;
} }
}
public function quickSave ($aData)
} // AppMessage {
if (isset( $aData['app_msg_uid'] )) {
$o = EmployeePeer::retrieveByPk( $aData['app_msg_uid'] );
}
if (isset( $o ) && is_object( $o ) && get_class( $o ) == 'AppMessage') {
$o->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
$o->setAppMsgDate( date( 'Y-m-d H:i:s' ) );
$o->save();
return $o->getAppMsgUid();
} else {
$this->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
$this->setAppMsgDate( date( 'Y-m-d H:i:s' ) );
$this->save();
return $this->getAppMsgUid();
}
}
}
// AppMessage

View File

@@ -1,125 +1,124 @@
<?php <?php
/** /**
* CaseTracker.php * CaseTracker.php
* @package workflow.engine.classes.model *
* @package workflow.engine.classes.model
*/ */
require_once 'classes/model/om/BaseCaseTracker.php'; require_once 'classes/model/om/BaseCaseTracker.php';
/** /**
* Skeleton subclass for representing a row from the 'CASE_TRACKER' table. * Skeleton subclass for representing a row from the 'CASE_TRACKER' table.
* *
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
* long as it does not already exist in the output directory. * long as it does not already exist in the output directory.
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class CaseTracker extends BaseCaseTracker { class CaseTracker extends BaseCaseTracker
public function load($sProcessUID) { {
try {
$oRow = CaseTrackerPeer::retrieveByPK($sProcessUID);
if (!is_null($oRow)) {
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
$this->setNew(false);
return $aFields;
}
else {
throw(new Exception("The row '$sProcessUID' in table CASE_TRACKER doesn't exist!"));
}
}
catch (Exception $oError) {
throw($oError);
}
}
public function create($aData) { public function load ($sProcessUID)
$oConnection = Propel::getConnection(CaseTrackerPeer::DATABASE_NAME); {
try { try {
if (!isset($aData['CT_MAP_TYPE'])) { $oRow = CaseTrackerPeer::retrieveByPK( $sProcessUID );
$aData['CT_MAP_TYPE'] = 'PROCESSMAP'; if (! is_null( $oRow )) {
} $aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
$oCaseTracker = new CaseTracker(); $this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
$oCaseTracker->fromArray($aData, BasePeer::TYPE_FIELDNAME); $this->setNew( false );
if ($oCaseTracker->validate()) { return $aFields;
$oConnection->begin(); } else {
$iResult = $oCaseTracker->save(); throw (new Exception( "The row '$sProcessUID' in table CASE_TRACKER doesn't exist!" ));
$oConnection->commit(); }
return true; } catch (Exception $oError) {
} throw ($oError);
else {
$sMessage = '';
$aValidationFailures = $oCaseTracker->getValidationFailures();
foreach($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
} }
throw(new Exception('The registry cannot be created!<br />'.$sMessage));
}
} }
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
public function update($aData) { public function create ($aData)
$oConnection = Propel::getConnection(CaseTrackerPeer::DATABASE_NAME); {
try { $oConnection = Propel::getConnection( CaseTrackerPeer::DATABASE_NAME );
$oCaseTracker = CaseTrackerPeer::retrieveByPK($aData['PRO_UID']); try {
if (!is_null($oCaseTracker)) if (! isset( $aData['CT_MAP_TYPE'] )) {
{ $aData['CT_MAP_TYPE'] = 'PROCESSMAP';
$oCaseTracker->fromArray($aData, BasePeer::TYPE_FIELDNAME); }
if ($oCaseTracker->validate()) { $oCaseTracker = new CaseTracker();
$oConnection->begin(); $oCaseTracker->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
$iResult = $oCaseTracker->save(); if ($oCaseTracker->validate()) {
$oConnection->commit(); $oConnection->begin();
return $iResult; $iResult = $oCaseTracker->save();
$oConnection->commit();
return true;
} else {
$sMessage = '';
$aValidationFailures = $oCaseTracker->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
} }
else { }
$sMessage = '';
$aValidationFailures = $oCaseTracker->getValidationFailures(); public function update ($aData)
foreach($aValidationFailures as $oValidationFailure) { {
$sMessage .= $oValidationFailure->getMessage() . '<br />'; $oConnection = Propel::getConnection( CaseTrackerPeer::DATABASE_NAME );
} try {
throw(new Exception('The registry cannot be updated!<br />'.$sMessage)); $oCaseTracker = CaseTrackerPeer::retrieveByPK( $aData['PRO_UID'] );
if (! is_null( $oCaseTracker )) {
$oCaseTracker->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oCaseTracker->validate()) {
$oConnection->begin();
$iResult = $oCaseTracker->save();
$oConnection->commit();
return $iResult;
} else {
$sMessage = '';
$aValidationFailures = $oCaseTracker->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
}
} else {
throw (new Exception( 'This row doesn\'t exist!' ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
} }
}
else {
throw(new Exception('This row doesn\'t exist!'));
}
} }
catch (Exception $oError) {
$oConnection->rollback(); public function remove ($sProcessUID)
throw($oError); {
$oConnection = Propel::getConnection( CaseTrackerPeer::DATABASE_NAME );
try {
$oConnection->begin();
$this->setProUid( $sProcessUID );
$iResult = $this->delete();
$oConnection->commit();
return $iResult;
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
} }
}
function caseTrackerExists ($sUid)
public function remove($sProcessUID) { {
$oConnection = Propel::getConnection(CaseTrackerPeer::DATABASE_NAME); try {
try { $oObj = CaseTrackerPeer::retrieveByPk( $sUid );
$oConnection->begin(); return (is_object( $oObj ) && get_class( $oObj ) == 'CaseTracker');
$this->setProUid($sProcessUID); } catch (Exception $oError) {
$iResult = $this->delete(); throw ($oError);
$oConnection->commit(); }
return $iResult;
} }
catch (Exception $oError) { }
$oConnection->rollback(); // CaseTracker
throw($oError);
}
}
function caseTrackerExists ( $sUid ) {
try {
$oObj = CaseTrackerPeer::retrieveByPk($sUid);
return (is_object($oObj) && get_class($oObj) == 'CaseTracker');
}
catch (Exception $oError) {
throw($oError);
}
}
} // CaseTracker

View File

@@ -1,173 +1,165 @@
<?php <?php
/** /**
* CaseTrackerObject.php * CaseTrackerObject.php
* @package workflow.engine.classes.model *
* @package workflow.engine.classes.model
*/ */
require_once 'classes/model/om/BaseCaseTrackerObject.php'; require_once 'classes/model/om/BaseCaseTrackerObject.php';
/** /**
* Skeleton subclass for representing a row from the 'CASE_TRACKER_OBJECT' table. * Skeleton subclass for representing a row from the 'CASE_TRACKER_OBJECT' table.
* *
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
* long as it does not already exist in the output directory. * long as it does not already exist in the output directory.
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class CaseTrackerObject extends BaseCaseTrackerObject { class CaseTrackerObject extends BaseCaseTrackerObject
public function load($Uid) { {
try {
$oRow = CaseTrackerObjectPeer::retrieveByPK( $Uid );
if (!is_null($oRow))
{
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
$this->fromArray($aFields,BasePeer::TYPE_FIELDNAME);
$this->setNew(false);
return $aFields;
}
else {
throw( new Exception( "The row '$Uid' in table CaseTrackerObject doesn't exist!" ));
}
}
catch (Exception $oError) {
throw($oError);
}
}
public function create($aData) { public function load ($Uid)
$oConnection = Propel::getConnection(CaseTrackerObjectPeer::DATABASE_NAME); {
try { try {
if (!isset($aData['CTO_UID'])) { $oRow = CaseTrackerObjectPeer::retrieveByPK( $Uid );
$aData['CTO_UID'] = G::generateUniqueID(); if (! is_null( $oRow )) {
} $aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
$oCaseTrackerObject = new CaseTrackerObject(); $this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
$oCaseTrackerObject->fromArray($aData, BasePeer::TYPE_FIELDNAME); $this->setNew( false );
if ($oCaseTrackerObject->validate()) { return $aFields;
$oConnection->begin(); } else {
$iResult = $oCaseTrackerObject->save(); throw (new Exception( "The row '$Uid' in table CaseTrackerObject doesn't exist!" ));
$oConnection->commit(); }
return $aData['CTO_UID']; } catch (Exception $oError) {
} throw ($oError);
else {
$sMessage = '';
$aValidationFailures = $oCaseTrackerObject->getValidationFailures();
foreach($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
} }
throw(new Exception('The registry cannot be created!<br />'.$sMessage));
}
} }
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
public function update($aData) public function create ($aData)
{ {
$oConnection = Propel::getConnection(CaseTrackerObjectPeer::DATABASE_NAME); $oConnection = Propel::getConnection( CaseTrackerObjectPeer::DATABASE_NAME );
try { try {
$oCaseTrackerObject = CaseTrackerObjectPeer::retrieveByPK($aData['CTO_UID']); if (! isset( $aData['CTO_UID'] )) {
if (!is_null($oCaseTrackerObject)) $aData['CTO_UID'] = G::generateUniqueID();
{ }
$oCaseTrackerObject->fromArray($aData, BasePeer::TYPE_FIELDNAME); $oCaseTrackerObject = new CaseTrackerObject();
if ($oCaseTrackerObject->validate()) { $oCaseTrackerObject->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
$oConnection->begin(); if ($oCaseTrackerObject->validate()) {
$iResult = $oCaseTrackerObject->save(); $oConnection->begin();
$oConnection->commit(); $iResult = $oCaseTrackerObject->save();
return $iResult; $oConnection->commit();
return $aData['CTO_UID'];
} else {
$sMessage = '';
$aValidationFailures = $oCaseTrackerObject->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
} }
else { }
$sMessage = '';
$aValidationFailures = $oCaseTrackerObject->getValidationFailures(); public function update ($aData)
foreach($aValidationFailures as $oValidationFailure) { {
$sMessage .= $oValidationFailure->getMessage() . '<br />'; $oConnection = Propel::getConnection( CaseTrackerObjectPeer::DATABASE_NAME );
} try {
throw(new Exception('The registry cannot be updated!<br />'.$sMessage)); $oCaseTrackerObject = CaseTrackerObjectPeer::retrieveByPK( $aData['CTO_UID'] );
if (! is_null( $oCaseTrackerObject )) {
$oCaseTrackerObject->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oCaseTrackerObject->validate()) {
$oConnection->begin();
$iResult = $oCaseTrackerObject->save();
$oConnection->commit();
return $iResult;
} else {
$sMessage = '';
$aValidationFailures = $oCaseTrackerObject->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
}
} else {
throw (new Exception( 'This row doesn\'t exist!' ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
} }
}
else {
throw(new Exception('This row doesn\'t exist!'));
}
} }
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
public function remove($sCTOUID) { public function remove ($sCTOUID)
$oConnection = Propel::getConnection(CaseTrackerObjectPeer::DATABASE_NAME); {
try { $oConnection = Propel::getConnection( CaseTrackerObjectPeer::DATABASE_NAME );
$oCaseTobj = CaseTrackerObjectPeer::retrieveByPK($sCTOUID); try {
if (is_object($oCaseTobj) && get_class($oCaseTobj) == 'CaseTrackerObject') $oCaseTobj = CaseTrackerObjectPeer::retrieveByPK( $sCTOUID );
{ if (is_object( $oCaseTobj ) && get_class( $oCaseTobj ) == 'CaseTrackerObject') {
$oConnection->begin(); $oConnection->begin();
$iResult = $oCaseTobj->delete(); $iResult = $oCaseTobj->delete();
$oConnection->commit(); $oConnection->commit();
return $iResult; return $iResult;
} } else {
else { throw (new Exception( "The row '" . $sCTOUID . "' in table CaseTrackerObject doesn't exist!" ));
throw( new Exception( "The row '" . $sCTOUID . "' in table CaseTrackerObject doesn't exist!" )); }
} } catch (Exception $oError) {
var_dump( $oError );
die();
$oConnection->rollback();
throw ($oError);
}
} }
catch (Exception $oError) {var_dump($oError);die;
$oConnection->rollback();
throw($oError);
}
}
function reorderPositions($sProcessUID, $iPosition) { function reorderPositions ($sProcessUID, $iPosition)
try { {
$oCriteria = new Criteria('workflow'); try {
$oCriteria->add(CaseTrackerObjectPeer::PRO_UID, $sProcessUID); $oCriteria = new Criteria( 'workflow' );
$oCriteria->add(CaseTrackerObjectPeer::CTO_POSITION, $iPosition, '>'); $oCriteria->add( CaseTrackerObjectPeer::PRO_UID, $sProcessUID );
$oDataset = CaseTrackerObjectPeer::doSelectRS($oCriteria); $oCriteria->add( CaseTrackerObjectPeer::CTO_POSITION, $iPosition, '>' );
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset = CaseTrackerObjectPeer::doSelectRS( $oCriteria );
$oDataset->next(); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
while ($aRow = $oDataset->getRow()) { $oDataset->next();
$this->update(array('CTO_UID' => $aRow['CTO_UID'], while ($aRow = $oDataset->getRow()) {
'PRO_UID' => $aRow['PRO_UID'], $this->update( array ('CTO_UID' => $aRow['CTO_UID'],'PRO_UID' => $aRow['PRO_UID'],'CTO_TYPE_OBJ' => $aRow['CTO_TYPE_OBJ'],'CTO_UID_OBJ' => $aRow['CTO_UID_OBJ'],'CTO_CONDITION' => $aRow['CTO_CONDITION'],'CTO_POSITION' => $aRow['CTO_POSITION'] - 1
'CTO_TYPE_OBJ' => $aRow['CTO_TYPE_OBJ'], ) );
'CTO_UID_OBJ' => $aRow['CTO_UID_OBJ'], $oDataset->next();
'CTO_CONDITION' => $aRow['CTO_CONDITION'], }
'CTO_POSITION' => $aRow['CTO_POSITION'] - 1)); } catch (Exception $oException) {
$oDataset->next(); throw $Exception;
} }
} }
catch (Exception $oException) {
throw $Exception;
}
}
function caseTrackerObjectExists ( $Uid ) { function caseTrackerObjectExists ($Uid)
try { {
$oObj = CaseTrackerObjectPeer::retrieveByPk( $Uid ); try {
if (is_object($oObj) && get_class ($oObj) == 'CaseTrackerObject' ) { $oObj = CaseTrackerObjectPeer::retrieveByPk( $Uid );
return true; if (is_object( $oObj ) && get_class( $oObj ) == 'CaseTrackerObject') {
} return true;
else { } else {
return false; return false;
} }
} catch (Exception $oError) {
throw ($oError);
}
} }
catch (Exception $oError) {
throw($oError);
}
}
function removeByObject($sType, $sObjUid) { function removeByObject ($sType, $sObjUid)
try { {
$oCriteria = new Criteria('workflow'); try {
$oCriteria->add(CaseTrackerObjectPeer::CTO_TYPE_OBJ, $sType); $oCriteria = new Criteria( 'workflow' );
$oCriteria->add(CaseTrackerObjectPeer::CTO_UID_OBJ, $sObjUid); $oCriteria->add( CaseTrackerObjectPeer::CTO_TYPE_OBJ, $sType );
CaseTrackerObjectPeer::doDelete($oCriteria); $oCriteria->add( CaseTrackerObjectPeer::CTO_UID_OBJ, $sObjUid );
CaseTrackerObjectPeer::doDelete( $oCriteria );
} catch (Exception $e) {
throw ($e);
}
} }
catch(Exception $e) { }
throw($e); // CaseTrackerObject
}
}
} // CaseTrackerObject

View File

@@ -1,11 +1,12 @@
<?php <?php
/** /**
* GroupUser.php * GroupUser.php
* @package workflow.engine.classes.model *
* @package workflow.engine.classes.model
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc. * Copyright (C) 2004 - 2011 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -13,15 +14,15 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
require_once 'classes/model/om/BaseGroupUser.php'; require_once 'classes/model/om/BaseGroupUser.php';
@@ -35,114 +36,112 @@ require_once 'classes/model/Groupwf.php';
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
* long as it does not already exist in the input directory. * long as it does not already exist in the input directory.
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class GroupUser extends BaseGroupUser { class GroupUser extends BaseGroupUser
{
/** /**
* Create the application document registry * Create the application document registry
* @param array $aData *
* @return string * @param array $aData
*/ * @return string
public function create($aData) */
{ public function create ($aData)
$oConnection = Propel::getConnection(GroupUserPeer::DATABASE_NAME); {
try { $oConnection = Propel::getConnection( GroupUserPeer::DATABASE_NAME );
$oGroupUser = new GroupUser(); try {
$oGroupUser->fromArray($aData, BasePeer::TYPE_FIELDNAME); $oGroupUser = new GroupUser();
if ($oGroupUser->validate()) { $oGroupUser->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
$oConnection->begin(); if ($oGroupUser->validate()) {
$iResult = $oGroupUser->save(); $oConnection->begin();
$oConnection->commit(); $iResult = $oGroupUser->save();
return $iResult; $oConnection->commit();
} return $iResult;
else { } else {
$sMessage = ''; $sMessage = '';
$aValidationFailures = $oGroupUser->getValidationFailures(); $aValidationFailures = $oGroupUser->getValidationFailures();
foreach($aValidationFailures as $oValidationFailure) { foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />'; $sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
} }
throw(new Exception('The registry cannot be created!<br />'.$sMessage));
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
/**
* Remove the application document registry
* @param string $sGrpUid
* @param string $sUserUid
* @return string
*/
public function remove($sGrpUid, $sUserUid)
{
$oConnection = Propel::getConnection(GroupUserPeer::DATABASE_NAME);
try {
$oGroupUser = GroupUserPeer::retrieveByPK($sGrpUid, $sUserUid);
if (!is_null($oGroupUser))
{
$oConnection->begin();
$iResult = $oGroupUser->delete();
$oConnection->commit();
return $iResult;
}
else {
throw(new Exception('This row doesn\'t exist!'));
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
function getCountAllUsersByGroup()
{
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(GroupUserPeer::GRP_UID);
$oCriteria->addSelectColumn('COUNT(*) AS CNT');
$oCriteria->addJoin(GroupUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::INNER_JOIN);
$oCriteria->add(UsersPeer::USR_STATUS,'CLOSED', Criteria::NOT_EQUAL);
$oCriteria->addGroupByColumn(GroupUserPeer::GRP_UID);
$oDataset = GroupUserPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode (ResultSet::FETCHMODE_ASSOC);
$aRows = Array();
while ($oDataset->next()){
$row = $oDataset->getRow();
$aRows[$row['GRP_UID']] = $row['CNT'];
}
return $aRows;
}
function getAllUserGroups($usrUid)
{
$oCriteria = new Criteria('workflow');
$oCriteria->add(GroupUserPeer::USR_UID, $usrUid);
//$oCriteria->addGroupByColumn(GroupUserPeer::GRP_UID);
$oDataset = GroupUserPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode (ResultSet::FETCHMODE_ASSOC);
$rows = Array();
while ($oDataset->next()) {
$row = $oDataset->getRow();
$g = new Groupwf();
try {
$grpRow = $g->load($row['GRP_UID']);
$row = array_merge($row, $grpRow);
$rows[] = $row;
}
catch (Exception $e){
continue;
}
} }
return $rows; /**
} * Remove the application document registry
*
* @param string $sGrpUid
* @param string $sUserUid
* @return string
*/
public function remove ($sGrpUid, $sUserUid)
{
$oConnection = Propel::getConnection( GroupUserPeer::DATABASE_NAME );
try {
$oGroupUser = GroupUserPeer::retrieveByPK( $sGrpUid, $sUserUid );
if (! is_null( $oGroupUser )) {
$oConnection->begin();
$iResult = $oGroupUser->delete();
$oConnection->commit();
return $iResult;
} else {
throw (new Exception( 'This row doesn\'t exist!' ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
function getCountAllUsersByGroup ()
{
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( GroupUserPeer::GRP_UID );
$oCriteria->addSelectColumn( 'COUNT(*) AS CNT' );
$oCriteria->addJoin( GroupUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::INNER_JOIN );
$oCriteria->add( UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL );
$oCriteria->addGroupByColumn( GroupUserPeer::GRP_UID );
$oDataset = GroupUserPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$aRows = Array ();
while ($oDataset->next()) {
$row = $oDataset->getRow();
$aRows[$row['GRP_UID']] = $row['CNT'];
}
return $aRows;
}
function getAllUserGroups ($usrUid)
{
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( GroupUserPeer::USR_UID, $usrUid );
//$oCriteria->addGroupByColumn(GroupUserPeer::GRP_UID);
$oDataset = GroupUserPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rows = Array ();
while ($oDataset->next()) {
$row = $oDataset->getRow();
$g = new Groupwf();
try {
$grpRow = $g->load( $row['GRP_UID'] );
$row = array_merge( $row, $grpRow );
$rows[] = $row;
} catch (Exception $e) {
continue;
}
}
return $rows;
}
}
// GroupUser
} // GroupUser

View File

@@ -1,143 +1,130 @@
<?php <?php
/** /**
* LoginLog.php * LoginLog.php
* @package workflow.engine.classes.model *
* @package workflow.engine.classes.model
*/ */
require_once 'classes/model/om/BaseLoginLog.php'; require_once 'classes/model/om/BaseLoginLog.php';
/** /**
* Skeleton subclass for representing a row from the 'LOGIN_LOG' table. * Skeleton subclass for representing a row from the 'LOGIN_LOG' table.
* *
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
* long as it does not already exist in the output directory. * long as it does not already exist in the output directory.
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class LoginLog extends BaseLoginLog { class LoginLog extends BaseLoginLog
function create ($aData) {
{
$con = Propel::getConnection(LoginLogPeer::DATABASE_NAME);
try
{
$this->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if($this->validate())
{
$result=$this->save();
}
else
{
$e=new Exception("Failed Validation in class ".get_class($this).".");
$e->aValidationFailures=$this->getValidationFailures();
throw($e);
}
$con->commit();
return $result;
}
catch(Exception $e)
{
$con->rollback();
throw($e);
}
}
public function load($LogUid)
{
try {
$oRow = LoginLogPeer::retrieveByPK( $LogUid );
if (!is_null($oRow))
{
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
$this->fromArray($aFields,BasePeer::TYPE_FIELDNAME);
$this->setNew(false);
return $aFields;
}
else {
throw(new Exception( "The row '" . $LogUid . "' in table LOGIN_LOG doesn't exist!" ));
}
}
catch (Exception $oError) {
throw($oError);
}
}
public function update($fields)
{
$con = Propel::getConnection(LoginLogPeer::DATABASE_NAME);
try
{
$con->begin();
$this->load($fields['LOG_UID']);
$this->fromArray($fields,BasePeer::TYPE_FIELDNAME);
if($this->validate())
{
$result=$this->save();
$con->commit();
return $result;
}
else
{
$con->rollback();
throw(new Exception("Failed Validation in class ".get_class($this)."."));
}
}
catch(Exception $e)
{
$con->rollback();
throw($e);
}
}
function remove($LogUid) function create ($aData)
{
$con = Propel::getConnection(LoginLogPeer::DATABASE_NAME);
try
{ {
$con->begin(); $con = Propel::getConnection( LoginLogPeer::DATABASE_NAME );
$this->setWlUid($LogUid); try {
$result=$this->delete(); $this->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
$con->commit(); if ($this->validate()) {
return $result; $result = $this->save();
} else {
$e = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
$e->aValidationFailures = $this->getValidationFailures();
throw ($e);
}
$con->commit();
return $result;
} catch (Exception $e) {
$con->rollback();
throw ($e);
}
} }
catch(Exception $e)
public function load ($LogUid)
{ {
$con->rollback(); try {
throw($e); $oRow = LoginLogPeer::retrieveByPK( $LogUid );
if (! is_null( $oRow )) {
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
$this->setNew( false );
return $aFields;
} else {
throw (new Exception( "The row '" . $LogUid . "' in table LOGIN_LOG doesn't exist!" ));
}
} catch (Exception $oError) {
throw ($oError);
}
} }
}
public function update ($fields)
//Added by Qennix {
function getLastLoginByUser($sUID){ $con = Propel::getConnection( LoginLogPeer::DATABASE_NAME );
$c = new Criteria(); try {
$c->addSelectColumn(LoginLogPeer::LOG_INIT_DATE); $con->begin();
$c->add(LoginLogPeer::USR_UID,$sUID); $this->load( $fields['LOG_UID'] );
$c->setLimit(1); $this->fromArray( $fields, BasePeer::TYPE_FIELDNAME );
$c->addDescendingOrderByColumn(LoginLogPeer::LOG_INIT_DATE); if ($this->validate()) {
$Dat = LoginLogPeer::doSelectRS ($c); $result = $this->save();
$Dat->setFetchmode ( ResultSet::FETCHMODE_ASSOC ); $con->commit();
$Dat->next(); return $result;
$aRow = $Dat->getRow(); } else {
return isset($aRow['LOG_INIT_DATE']) ? $aRow['LOG_INIT_DATE'] : ''; $con->rollback();
} throw (new Exception( "Failed Validation in class " . get_class( $this ) . "." ));
}
//Added by Qennix } catch (Exception $e) {
function getLastLoginAllUsers(){ $con->rollback();
$c = new Criteria(); throw ($e);
$c->addSelectColumn(LoginLogPeer::USR_UID); }
$c->addAsColumn('LAST_LOGIN', 'MAX(LOG_INIT_DATE)'); }
$c->addGroupByColumn(LoginLogPeer::USR_UID);
$Dat = LoginLogPeer::doSelectRS ($c); function remove ($LogUid)
$Dat->setFetchmode (ResultSet::FETCHMODE_ASSOC); {
$aRows = Array(); $con = Propel::getConnection( LoginLogPeer::DATABASE_NAME );
while ($Dat->next()){ try {
$row = $Dat->getRow(); $con->begin();
$aRows[$row['USR_UID']] = $row['LAST_LOGIN']; $this->setWlUid( $LogUid );
} $result = $this->delete();
return $aRows; $con->commit();
} return $result;
} catch (Exception $e) {
} // LoginLog $con->rollback();
throw ($e);
}
}
//Added by Qennix
function getLastLoginByUser ($sUID)
{
$c = new Criteria();
$c->addSelectColumn( LoginLogPeer::LOG_INIT_DATE );
$c->add( LoginLogPeer::USR_UID, $sUID );
$c->setLimit( 1 );
$c->addDescendingOrderByColumn( LoginLogPeer::LOG_INIT_DATE );
$Dat = LoginLogPeer::doSelectRS( $c );
$Dat->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$Dat->next();
$aRow = $Dat->getRow();
return isset( $aRow['LOG_INIT_DATE'] ) ? $aRow['LOG_INIT_DATE'] : '';
}
//Added by Qennix
function getLastLoginAllUsers ()
{
$c = new Criteria();
$c->addSelectColumn( LoginLogPeer::USR_UID );
$c->addAsColumn( 'LAST_LOGIN', 'MAX(LOG_INIT_DATE)' );
$c->addGroupByColumn( LoginLogPeer::USR_UID );
$Dat = LoginLogPeer::doSelectRS( $c );
$Dat->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$aRows = Array ();
while ($Dat->next()) {
$row = $Dat->getRow();
$aRows[$row['USR_UID']] = $row['LAST_LOGIN'];
}
return $aRows;
}
}
// LoginLog

View File

@@ -1,139 +1,131 @@
<?php <?php
/** /**
* ObjectPermission.php * ObjectPermission.php
* @package workflow.engine.classes.model *
* @package workflow.engine.classes.model
*/ */
require_once 'classes/model/om/BaseObjectPermission.php'; require_once 'classes/model/om/BaseObjectPermission.php';
/** /**
* Skeleton subclass for representing a row from the 'OBJECT_PERMISSION' table. * Skeleton subclass for representing a row from the 'OBJECT_PERMISSION' table.
* *
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
* long as it does not already exist in the output directory. * long as it does not already exist in the output directory.
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class ObjectPermission extends BaseObjectPermission { class ObjectPermission extends BaseObjectPermission
{
public function load($UID) public function load ($UID)
{
try {
$oRow = ObjectPermissionPeer::retrieveByPK( $UID );
if (!is_null($oRow))
{
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
$this->fromArray($aFields,BasePeer::TYPE_FIELDNAME);
$this->setNew(false);
return $aFields;
}
else {
throw(new Exception( "The row '" . $UsrUid . "' in table USER doesn't exist!" ));
}
}
catch (Exception $oError) {
throw($oError);
}
}
function create ($aData)
{
try
{ {
$this->fromArray($aData,BasePeer::TYPE_FIELDNAME); try {
$result=$this->save(); $oRow = ObjectPermissionPeer::retrieveByPK( $UID );
return $result; if (! is_null( $oRow )) {
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
$this->setNew( false );
return $aFields;
} else {
throw (new Exception( "The row '" . $UsrUid . "' in table USER doesn't exist!" ));
}
} catch (Exception $oError) {
throw ($oError);
}
} }
catch(Exception $e)
function create ($aData)
{ {
throw($e); try {
$this->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
$result = $this->save();
return $result;
} catch (Exception $e) {
throw ($e);
}
} }
}
function Exists ( $Uid ) { function Exists ($Uid)
try { {
$oPro = ObjectPermissionPeer::retrieveByPk( $Uid ); try {
if (is_object($oPro) && get_class ($oPro) == 'ObjectPermission' ) { $oPro = ObjectPermissionPeer::retrieveByPk( $Uid );
return true; if (is_object( $oPro ) && get_class( $oPro ) == 'ObjectPermission') {
} return true;
else { } else {
return false; return false;
} }
} catch (Exception $oError) {
throw ($oError);
}
} }
catch (Exception $oError) {
throw($oError);
}
}
function remove($Uid) function remove ($Uid)
{ {
$con = Propel::getConnection(ObjectPermissionPeer::DATABASE_NAME); $con = Propel::getConnection( ObjectPermissionPeer::DATABASE_NAME );
try { try {
$oObjPer = ObjectPermissionPeer::retrieveByPK($Uid); $oObjPer = ObjectPermissionPeer::retrieveByPK( $Uid );
if (is_object($oObjPer) && get_class($oObjPer) == 'ObjectPermission') if (is_object( $oObjPer ) && get_class( $oObjPer ) == 'ObjectPermission') {
{ $con->begin();
$con->begin(); $iResult = $oObjPer->delete();
$iResult = $oObjPer->delete(); $con->commit();
$con->commit(); return $iResult;
return $iResult; } else {
} throw (new Exception( "The row '" . $Uid . "' in table CaseTrackerObject doesn't exist!" ));
else { }
throw( new Exception( "The row '" . $Uid . "' in table CaseTrackerObject doesn't exist!" )); } catch (exception $e) {
} $con->rollback();
throw ($e);
}
} }
catch (exception $e) {
$con->rollback();
throw ($e);
}
}
function update($aFields) { function update ($aFields)
$oConnection = Propel::getConnection(ObjectPermissionPeer::DATABASE_NAME); {
try { $oConnection = Propel::getConnection( ObjectPermissionPeer::DATABASE_NAME );
$oConnection->begin(); try {
$this->load($aFields['OP_UID']); $oConnection->begin();
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME); $this->load( $aFields['OP_UID'] );
if ($this->validate()) { $this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
$iResult = $this->save(); if ($this->validate()) {
$oConnection->commit(); $iResult = $this->save();
return $iResult; $oConnection->commit();
} return $iResult;
else { } else {
$oConnection->rollback(); $oConnection->rollback();
throw(new Exception('Failed Validation in class ' . get_class($this) . '.')); throw (new Exception( 'Failed Validation in class ' . get_class( $this ) . '.' ));
} }
} catch (Exception $e) {
$oConnection->rollback();
throw ($e);
}
} }
catch(Exception $e) {
$oConnection->rollback();
throw($e);
}
}
function removeByObject($sType, $sObjUid) { function removeByObject ($sType, $sObjUid)
try { {
$oCriteria = new Criteria('workflow'); try {
$oCriteria->add(ObjectPermissionPeer::OP_OBJ_TYPE, $sType); $oCriteria = new Criteria( 'workflow' );
$oCriteria->add(ObjectPermissionPeer::OP_OBJ_UID, $sObjUid); $oCriteria->add( ObjectPermissionPeer::OP_OBJ_TYPE, $sType );
ObjectPermissionPeer::doDelete($oCriteria); $oCriteria->add( ObjectPermissionPeer::OP_OBJ_UID, $sObjUid );
ObjectPermissionPeer::doDelete( $oCriteria );
} catch (Exception $e) {
throw ($e);
}
} }
catch(Exception $e) {
throw($e); function loadInfo ($sObjUID)
{
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ObjectPermissionPeer::OP_OBJ_UID, $sObjUID );
$oDataset = ObjectPermissionPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aRow = $oDataset->getRow();
return ($aRow);
} }
} }
// ObjectPermission
function loadInfo($sObjUID){
$oCriteria = new Criteria('workflow');
$oCriteria->add(ObjectPermissionPeer::OP_OBJ_UID, $sObjUID);
$oDataset = ObjectPermissionPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
return($aRow);
}
} // ObjectPermission