CODE STYLE class/model/ files

This commit is contained in:
Fernando Ontiveros
2012-10-20 17:19:10 -04:00
parent 319f755d18
commit ea98460f99
28 changed files with 845 additions and 851 deletions

View File

@@ -14,21 +14,20 @@ require_once 'classes/model/om/BaseDashlet.php';
*
* @package classes.model
*/
class Dashlet extends BaseDashlet {
public function load($dasUid) {
try {
$dashlet = DashletPeer::retrieveByPK($dasUid);
if (!is_null($dashlet)) {
return $dashlet->toArray(BasePeer::TYPE_FIELDNAME);
}
else {
return null;
}
class Dashlet extends BaseDashlet
{
public function load($dasUid)
{
try {
$dashlet = DashletPeer::retrieveByPK($dasUid);
if (!is_null($dashlet)) {
return $dashlet->toArray(BasePeer::TYPE_FIELDNAME);
} else {
return null;
}
} catch (Exception $error) {
throw $error;
}
}
catch (Exception $error) {
throw $error;
}
}
}
} // Dashlet

View File

@@ -14,94 +14,90 @@ require_once 'classes/model/om/BaseDashletInstance.php';
*
* @package classes.model
*/
class DashletInstance extends BaseDashletInstance {
private $filterThisFields = array('DAS_INS_UID', 'DAS_UID', 'DAS_INS_OWNER_TYPE', 'DAS_INS_OWNER_UID',
class DashletInstance extends BaseDashletInstance
{
private $filterThisFields = array('DAS_INS_UID', 'DAS_UID', 'DAS_INS_OWNER_TYPE', 'DAS_INS_OWNER_UID',
'DAS_INS_CREATE_DATE', 'DAS_INS_UPDATE_DATE', 'DAS_INS_STATUS',
'pmos_generik', 'ys-admin-tabpanel', 'PHPSESSID');
public function load($dasInsUid) {
try {
$dashletInstance = DashletInstancePeer::retrieveByPK($dasInsUid);
$fields = $dashletInstance->toArray(BasePeer::TYPE_FIELDNAME);
if ($fields['DAS_INS_ADDITIONAL_PROPERTIES'] != '') {
$fields = array_merge($fields, unserialize($fields['DAS_INS_ADDITIONAL_PROPERTIES']));
}
return $fields;
}
catch (Exception $error) {
throw $error;
}
}
public function createOrUpdate($data) {
$additionalFields = array();
foreach ($data as $field => $value) {
if (!in_array($field, $this->filterThisFields)) {
$additionalFields[$field] = $value;
unset($data[$field]);
}
}
if (!empty($additionalFields)) {
$data['DAS_INS_ADDITIONAL_PROPERTIES'] = serialize($additionalFields);
}
else {
$data['DAS_INS_ADDITIONAL_PROPERTIES'] = '';
}
$connection = Propel::getConnection(DashletInstancePeer::DATABASE_NAME);
try {
if (!isset($data['DAS_INS_UID'])) {
$data['DAS_INS_UID'] = '';
}
if ($data['DAS_INS_UID'] == '') {
$data['DAS_INS_UID'] = G::generateUniqueID();
$data['DAS_INS_CREATE_DATE'] = date('Y-m-d H:i:s');
$dashletInstance = new DashletInstance();
}
else {
$dashletInstance = DashletInstancePeer::retrieveByPK($data['DAS_INS_UID']);
}
$data['DAS_INS_UPDATE_DATE'] = date('Y-m-d H:i:s');
$dashletInstance->fromArray($data, BasePeer::TYPE_FIELDNAME);
if ($dashletInstance->validate()) {
$connection->begin();
$result = $dashletInstance->save();
$connection->commit();
return $data['DAS_INS_UID'];
}
else {
$message = '';
$validationFailures = $dashletInstance->getValidationFailures();
foreach($validationFailures as $validationFailure) {
$message .= $validationFailure->getMessage() . '. ';
public function load($dasInsUid)
{
try {
$dashletInstance = DashletInstancePeer::retrieveByPK($dasInsUid);
$fields = $dashletInstance->toArray(BasePeer::TYPE_FIELDNAME);
if ($fields['DAS_INS_ADDITIONAL_PROPERTIES'] != '') {
$fields = array_merge($fields, unserialize($fields['DAS_INS_ADDITIONAL_PROPERTIES']));
}
return $fields;
} catch (Exception $error) {
throw $error;
}
throw(new Exception('Error trying to update: ' . $message));
}
}
catch (Exception $error) {
$connection->rollback();
throw $error;
}
}
public function remove($dasInsUid) {
$connection = Propel::getConnection(DashletInstancePeer::DATABASE_NAME);
try {
$dashletInstance = DashletInstancePeer::retrieveByPK($dasInsUid);
if (!is_null($dashletInstance)) {
$connection->begin();
$result = $dashletInstance->delete();
$connection->commit();
return $result;
}
else {
throw new Exception('Error trying to delete: The row "' . $dasInsUid. '" does not exist.');
}
public function createOrUpdate($data)
{
$additionalFields = array();
foreach ($data as $field => $value) {
if (!in_array($field, $this->filterThisFields)) {
$additionalFields[$field] = $value;
unset($data[$field]);
}
}
if (!empty($additionalFields)) {
$data['DAS_INS_ADDITIONAL_PROPERTIES'] = serialize($additionalFields);
} else {
$data['DAS_INS_ADDITIONAL_PROPERTIES'] = '';
}
$connection = Propel::getConnection(DashletInstancePeer::DATABASE_NAME);
try {
if (!isset($data['DAS_INS_UID'])) {
$data['DAS_INS_UID'] = '';
}
if ($data['DAS_INS_UID'] == '') {
$data['DAS_INS_UID'] = G::generateUniqueID();
$data['DAS_INS_CREATE_DATE'] = date('Y-m-d H:i:s');
$dashletInstance = new DashletInstance();
} else {
$dashletInstance = DashletInstancePeer::retrieveByPK($data['DAS_INS_UID']);
}
$data['DAS_INS_UPDATE_DATE'] = date('Y-m-d H:i:s');
$dashletInstance->fromArray($data, BasePeer::TYPE_FIELDNAME);
if ($dashletInstance->validate()) {
$connection->begin();
$result = $dashletInstance->save();
$connection->commit();
return $data['DAS_INS_UID'];
} else {
$message = '';
$validationFailures = $dashletInstance->getValidationFailures();
foreach ($validationFailures as $validationFailure) {
$message .= $validationFailure->getMessage() . '. ';
}
throw(new Exception('Error trying to update: ' . $message));
}
} catch (Exception $error) {
$connection->rollback();
throw $error;
}
}
catch (Exception $error) {
$connection->rollback();
throw $error;
}
}
} // DashletInstance
public function remove($dasInsUid)
{
$connection = Propel::getConnection(DashletInstancePeer::DATABASE_NAME);
try {
$dashletInstance = DashletInstancePeer::retrieveByPK($dasInsUid);
if (!is_null($dashletInstance)) {
$connection->begin();
$result = $dashletInstance->delete();
$connection->commit();
return $result;
} else {
throw new Exception('Error trying to delete: The row "' . $dasInsUid. '" does not exist.');
}
} catch (Exception $error) {
$connection->rollback();
throw $error;
}
}
}

View File

@@ -10,7 +10,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'DASHLET_INSTANCE' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -18,6 +18,7 @@
*
* @package classes.model
*/
class DashletInstancePeer extends BaseDashletInstancePeer {
class DashletInstancePeer extends BaseDashletInstancePeer
{
}
} // DashletInstancePeer

View File

@@ -10,7 +10,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'DASHLET' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -18,6 +18,7 @@
*
* @package classes.model
*/
class DashletPeer extends BaseDashletPeer {
class DashletPeer extends BaseDashletPeer
{
}
} // DashletPeer

View File

@@ -84,7 +84,7 @@ class DbSource extends BaseDbSource
return $oCriteria;
}
public function load($Uid, $ProUID='')
public function load($Uid, $ProUID = '')
{
try {
$oRow = DbSourcePeer::retrieveByPK($Uid, $ProUID);
@@ -203,5 +203,4 @@ class DbSource extends BaseDbSource
}
}
}
// DbSource

View File

@@ -14,7 +14,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'DB_SOURCE' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -22,6 +22,7 @@
*
* @package workflow.engine.classes.model
*/
class DbSourcePeer extends BaseDbSourcePeer {
class DbSourcePeer extends BaseDbSourcePeer
{
}
} // DbSourcePeer

View File

@@ -51,7 +51,7 @@ class Department extends BaseDepartment
* @return void
*/
function create ($aData)
public function create ($aData)
{
$con = Propel::getConnection( DepartmentPeer::DATABASE_NAME );
try {
@@ -171,8 +171,7 @@ class Department extends BaseDepartment
* @param string $ProUid the uid of the Prolication
* @return array $Fields the fields
*/
function Load ($DepUid)
public function Load ($DepUid)
{
$con = Propel::getConnection( DepartmentPeer::DATABASE_NAME );
try {
@@ -296,7 +295,7 @@ class Department extends BaseDepartment
* @return array $Fields the fields
*/
function existsDepartment ($DepUid)
public function existsDepartment ($DepUid)
{
$con = Propel::getConnection( DepartmentPeer::DATABASE_NAME );
$oPro = DepartmentPeer::retrieveByPk( $DepUid );
@@ -307,7 +306,7 @@ class Department extends BaseDepartment
}
}
function existsUserInDepartment ($depId, $userId)
public function existsUserInDepartment ($depId, $userId)
{
$con = Propel::getConnection( DepartmentPeer::DATABASE_NAME );
$oUser = UsersPeer::retrieveByPk( $userId );
@@ -320,7 +319,7 @@ class Department extends BaseDepartment
return false;
}
function updateDepartmentManager ($depId)
public function updateDepartmentManager ($depId)
{
$managerId = '';
$depParent = '';
@@ -374,7 +373,7 @@ class Department extends BaseDepartment
}
//add an user to a department and sync all about manager info
function addUserToDepartment ($depId, $userId, $manager, $updateManager = false)
public function addUserToDepartment ($depId, $userId, $manager, $updateManager = false)
{
try {
//update the field in user table
@@ -405,7 +404,7 @@ class Department extends BaseDepartment
// select departments
// this function is used to draw the hierachy tree view
function getDepartments ($DepParent)
public function getDepartments ($DepParent)
{
try {
$result = array ();
@@ -465,7 +464,7 @@ class Department extends BaseDepartment
* @return boolean $Fields true or false
*
*/
function checkDepartmentName ($departmentName, $parentUID, $departmentUID = '')
public function checkDepartmentName ($departmentName, $parentUID, $departmentUID = '')
{
$oCriteria = new Criteria( 'workflow' );
@@ -488,7 +487,7 @@ class Department extends BaseDepartment
return ($aRow) ? true : false;
}
function getUsersFromDepartment ($sDepUid, $sManagerUid)
public function getUsersFromDepartment ($sDepUid, $sManagerUid)
{
try {
$oCriteria = new Criteria( 'workflow' );
@@ -544,7 +543,7 @@ class Department extends BaseDepartment
* @param string $DepUid, $UsrUid
* @return array
*/
function removeUserFromDepartment ($DepUid, $UsrUid)
public function removeUserFromDepartment ($DepUid, $UsrUid)
{
$aFields = array ('USR_UID' => $UsrUid,'DEP_UID' => '','USR_REPORTS_TO' => ''
);
@@ -566,7 +565,7 @@ class Department extends BaseDepartment
* @param string $sGroupUID
* @return object
*/
function getAvailableUsersCriteria ($sGroupUID = '')
public function getAvailableUsersCriteria ($sGroupUID = '')
{
try {
$oCriteria = new Criteria( 'workflow' );
@@ -586,7 +585,7 @@ class Department extends BaseDepartment
* @param string $sDepUID
* @return object
*/
function cantUsersInDepartment ($sDepUID)
public function cantUsersInDepartment ($sDepUID)
{
try {
$c = new Criteria( 'workflow' );
@@ -604,7 +603,7 @@ class Department extends BaseDepartment
}
}
function loadByGroupname ($Groupname)
public function loadByGroupname ($Groupname)
{
$c = new Criteria( 'workflow' );
$del = DBAdapter::getStringDelimiter();
@@ -620,7 +619,7 @@ class Department extends BaseDepartment
}
//Added by Qennix
function getAllDepartmentsByUser ()
public function getAllDepartmentsByUser ()
{
$c = new Criteria( 'workflow' );
$c->addSelectColumn( UsersPeer::USR_UID );
@@ -638,7 +637,7 @@ class Department extends BaseDepartment
return $aRows;
}
function getDepartmentsForUser ($userUid)
public function getDepartmentsForUser ($userUid)
{
$criteria = new Criteria( 'workflow' );
$criteria->addSelectColumn( UsersPeer::DEP_UID );
@@ -669,5 +668,4 @@ class Department extends BaseDepartment
return $departments;
}
}
// Department

View File

@@ -2,10 +2,10 @@
/**
* DepartmentPeer.php
* @package workflow.engine.classes.model
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
*
* 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
@@ -15,13 +15,13 @@
* 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.,
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*
*/
// include base peer class
@@ -34,7 +34,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'DEPARTMENT' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -42,6 +42,7 @@
*
* @package workflow.engine.classes.model
*/
class DepartmentPeer extends BaseDepartmentPeer {
class DepartmentPeer extends BaseDepartmentPeer
{
}
} // DepartmentPeer

View File

@@ -10,7 +10,7 @@ require_once 'classes/model/om/BaseDimTimeComplete.php';
/**
* Skeleton subclass for representing a row from the 'DIM_TIME_COMPLETE' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -18,6 +18,7 @@ require_once 'classes/model/om/BaseDimTimeComplete.php';
*
* @package workflow.engine.classes.model
*/
class DimTimeComplete extends BaseDimTimeComplete {
class DimTimeComplete extends BaseDimTimeComplete
{
}
} // DimTimeComplete

View File

@@ -14,7 +14,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'DIM_TIME_COMPLETE' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -22,6 +22,7 @@
*
* @package workflow.engine.classes.model
*/
class DimTimeCompletePeer extends BaseDimTimeCompletePeer {
class DimTimeCompletePeer extends BaseDimTimeCompletePeer
{
}
} // DimTimeCompletePeer

View File

@@ -10,7 +10,7 @@ require_once 'classes/model/om/BaseDimTimeDelegate.php';
/**
* Skeleton subclass for representing a row from the 'DIM_TIME_DELEGATE' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -18,6 +18,7 @@ require_once 'classes/model/om/BaseDimTimeDelegate.php';
*
* @package workflow.engine.classes.model
*/
class DimTimeDelegate extends BaseDimTimeDelegate {
class DimTimeDelegate extends BaseDimTimeDelegate
{
}
} // DimTimeDelegate

View File

@@ -14,7 +14,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'DIM_TIME_DELEGATE' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -22,6 +22,7 @@
*
* @package workflow.engine.classes.model
*/
class DimTimeDelegatePeer extends BaseDimTimeDelegatePeer {
class DimTimeDelegatePeer extends BaseDimTimeDelegatePeer
{
}
} // DimTimeDelegatePeer

View File

@@ -150,7 +150,7 @@ class Dynaform extends BaseDynaform
* @return void
*/
function create ($aData)
public function create ($aData)
{
if (! isset( $aData['PRO_UID'] )) {
throw (new PropelException( 'The dynaform cannot be created. The PRO_UID is empty.' ));
@@ -223,7 +223,7 @@ class Dynaform extends BaseDynaform
*
*/
function createFromPMTable ($aData, $pmTableUid)
public function createFromPMTable ($aData, $pmTableUid)
{
$this->create( $aData );
$aData['DYN_UID'] = $this->getDynUid();
@@ -355,7 +355,7 @@ class Dynaform extends BaseDynaform
* @return array $Fields the fields
*/
function Load ($ProUid)
public function Load ($ProUid)
{
$con = Propel::getConnection( DynaformPeer::DATABASE_NAME );
try {
@@ -468,7 +468,7 @@ class Dynaform extends BaseDynaform
* @param string $sProUid the uid of the Prolication
*/
function dynaformExists ($DynUid)
public function dynaformExists ($DynUid)
{
$con = Propel::getConnection( TaskPeer::DATABASE_NAME );
try {
@@ -483,7 +483,7 @@ class Dynaform extends BaseDynaform
}
}
function getDynaformContent ($dynaformUid)
public function getDynaformContent ($dynaformUid)
{
$content = '';
$fields = $this->Load( $dynaformUid );
@@ -495,7 +495,7 @@ class Dynaform extends BaseDynaform
return $content;
}
function getDynaformFields ($dynaformUid)
public function getDynaformFields ($dynaformUid)
{
$content = '';
$fields = $this->Load( $dynaformUid );
@@ -510,7 +510,7 @@ class Dynaform extends BaseDynaform
return $G_FORM->fields;
}
function verifyExistingName ($sName, $sProUid)
public function verifyExistingName ($sName, $sProUid)
{
$sNameDyanform = urldecode( $sName );
$sProUid = urldecode( $sProUid );
@@ -540,5 +540,4 @@ class Dynaform extends BaseDynaform
return $flag;
}
}
// Dynaform

View File

@@ -2,10 +2,10 @@
/**
* DynaformPeer.php
* @package workflow.engine.classes.model
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
*
* 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
@@ -15,13 +15,13 @@
* 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.,
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*
*/
// include base peer class
@@ -34,7 +34,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'DYNAFORM' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -42,6 +42,7 @@
*
* @package workflow.engine.classes.model
*/
class DynaformPeer extends BaseDynaformPeer {
class DynaformPeer extends BaseDynaformPeer
{
}
} // DynaformPeer

View File

@@ -98,7 +98,7 @@ class Event extends BaseEvent
}
}
function create ($aData)
public function create ($aData)
{
if (! isset( $aData['EVN_UID'] ) || $aData['EVN_UID'] == '') {
$aData['EVN_UID'] = G::generateUniqueID();
@@ -226,7 +226,7 @@ class Event extends BaseEvent
}
}
function update ($aData)
public function update ($aData)
{
$oConnection = Propel::getConnection( EventPeer::DATABASE_NAME );
try {
@@ -362,7 +362,7 @@ class Event extends BaseEvent
}
}
function remove ($sUID)
public function remove ($sUID)
{
$oConnection = Propel::getConnection( EventPeer::DATABASE_NAME );
try {
@@ -407,7 +407,7 @@ class Event extends BaseEvent
}
}
function calculateEventsExecutionDate ()
public function calculateEventsExecutionDate ()
{
$line1 = '';
$line2 = '';
@@ -416,7 +416,7 @@ class Event extends BaseEvent
return $line1 . "<br>\n" . $line2;
}
function calculateExecutionDateSingle ()
public function calculateExecutionDateSingle ()
{
try {
$rowsCreated = 0;
@@ -537,7 +537,7 @@ class Event extends BaseEvent
}
}
function calculateExecutionDateMultiple ()
public function calculateExecutionDateMultiple ()
{
try {
$rowsCreated = 0;
@@ -647,9 +647,8 @@ class Event extends BaseEvent
}
}
function closeAppEvents ($PRO_UID, $APP_UID, $DEL_INDEX, $TAS_UID)
public function closeAppEvents ($PRO_UID, $APP_UID, $DEL_INDEX, $TAS_UID)
{
$aAppEvents = $this->getAppEvents( $APP_UID, $DEL_INDEX );
if ($aAppEvents) {
foreach ($aAppEvents as $aRow) {
@@ -661,10 +660,9 @@ class Event extends BaseEvent
}
}
}
}
function createAppEvents ($PRO_UID, $APP_UID, $DEL_INDEX, $TAS_UID)
public function createAppEvents ($PRO_UID, $APP_UID, $DEL_INDEX, $TAS_UID)
{
$aRows = Array ();
$aEventsRows = $this->getBy( $PRO_UID, $TAS_UID );
@@ -728,7 +726,7 @@ class Event extends BaseEvent
}
}
function verifyTaskbetween ($PRO_UID, $taskFrom, $taskTo, $taskVerify)
public function verifyTaskbetween ($PRO_UID, $taskFrom, $taskTo, $taskVerify)
{
$criteria = new Criteria( 'workflow' );
$criteria->addSelectColumn( RoutePeer::ROU_NEXT_TASK );
@@ -756,9 +754,8 @@ class Event extends BaseEvent
}
}
function getBy ($PRO_UID, $taskUid)
public function getBy ($PRO_UID, $taskUid)
{
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( EventPeer::EVN_UID );
$oCriteria->addSelectColumn( EventPeer::TAS_UID );
@@ -818,7 +815,7 @@ class Event extends BaseEvent
return (count( $aRows ) > 0) ? $aRows : false;
}
function getAppEvents ($APP_UID, $DEL_INDEX)
public function getAppEvents ($APP_UID, $DEL_INDEX)
{
//for single task event
$oCriteria = new Criteria( 'workflow' );
@@ -862,7 +859,7 @@ class Event extends BaseEvent
return (count( $aRows ) > 0) ? $aRows : false;
}
function toCalculateTime ($aData, $iDate = null)
public function toCalculateTime ($aData, $iDate = null)
{
G::LoadClass( 'dates' );
$oDates = new dates();
@@ -887,7 +884,7 @@ class Event extends BaseEvent
return $sActionDate;
}
function Exists ($sUid)
public function Exists ($sUid)
{
try {
$oObj = EventPeer::retrieveByPk( $sUid );
@@ -923,5 +920,4 @@ class Event extends BaseEvent
return $aRow;
}
}
// Event

View File

@@ -14,7 +14,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'EVENT' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -22,6 +22,7 @@
*
* @package workflow.engine.classes.model
*/
class EventPeer extends BaseEventPeer {
class EventPeer extends BaseEventPeer
{
}
} // EventPeer

View File

@@ -1,351 +1,351 @@
<?php
/**
* FieldCondition.php
*
* @package workflow.engine.classes.model
*/
require_once 'classes/model/om/BaseFieldCondition.php';
require_once 'classes/model/Dynaform.php';
/**
* Skeleton subclass for representing a row from the 'FIELD_CONDITION' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package workflow.engine.classes.model
*/
class FieldCondition extends BaseFieldCondition
{
public $oDynaformHandler;
/**
* Quick get all records into a criteria object
*
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
*/
public function get ($UID)
{
$obj = FieldConditionPeer::retrieveByPk( $UID );
if (! isset( $obj )) {
throw new Exception( "the record with UID: $UID doesn't exits!" );
}
<?php
/**
* FieldCondition.php
*
* @package workflow.engine.classes.model
*/
require_once 'classes/model/om/BaseFieldCondition.php';
require_once 'classes/model/Dynaform.php';
/**
* Skeleton subclass for representing a row from the 'FIELD_CONDITION' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package workflow.engine.classes.model
*/
class FieldCondition extends BaseFieldCondition
{
public $oDynaformHandler;
/**
* Quick get all records into a criteria object
*
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
*/
public function get ($UID)
{
$obj = FieldConditionPeer::retrieveByPk( $UID );
if (! isset( $obj )) {
throw new Exception( "the record with UID: $UID doesn't exits!" );
}
//TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
return $obj->toArray( BasePeer::TYPE_FIELDNAME );
}
/**
* Quick get all records into a criteria object
*
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
*/
public function getAllCriteriaByDynUid ($DYN_UID, $filter = 'all')
{
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_UID );
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_FUNCTION );
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_FIELDS );
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_CONDITION );
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_EVENTS );
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_EVENT_OWNERS );
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_STATUS );
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_DYN_UID );
$oCriteria->add( FieldConditionPeer::FCD_DYN_UID, $DYN_UID );
switch ($filter) {
case 'active':
$oCriteria->add( FieldConditionPeer::FCD_STATUS, '1', Criteria::EQUAL );
break;
}
return $oCriteria;
}
/**
* Quick get all records into a associative array
*
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
*/
public function getAllByDynUid ($DYN_UID, $filter = 'all')
{
$aRows = Array ();
$oCriteria = $this->getAllCriteriaByDynUid( $DYN_UID, $filter );
$oDataset = FieldConditionPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$aRows[] = $aRow;
$oDataset->next();
}
return $aRows;
}
/**
* Quick save a record
*
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
*/
public function quickSave ($aData)
{
$con = Propel::getConnection( FieldConditionPeer::DATABASE_NAME );
try {
$obj = null;
if (isset( $aData['FCD_UID'] ) && trim( $aData['FCD_UID'] ) != '') {
$obj = FieldConditionPeer::retrieveByPk( $aData['FCD_UID'] );
} else {
$aData['FCD_UID'] = G::generateUniqueID();
}
if (! is_object( $obj )) {
$obj = new FieldCondition();
}
$obj->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($obj->validate()) {
$result = $obj->save();
$con->commit();
return $result;
} else {
$e = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
$e->aValidationFailures = $obj->getValidationFailures();
throw ($e);
}
} catch (exception $e) {
$con->rollback();
throw ($e);
}
}
public function getConditionScript ($DYN_UID)
{
require_once 'classes/model/Dynaform.php';
G::LoadSystem( 'dynaformhandler' );
$oDynaform = DynaformPeer::retrieveByPk( $DYN_UID );
$PRO_UID = $oDynaform->getProUid();
$this->oDynaformHandler = new dynaFormHandler( PATH_DYNAFORM . "$PRO_UID/$DYN_UID" . '.xml' );
$aDynaformFields = $this->oDynaformHandler->getFieldNames();
for ($i = 0; $i < count( $aDynaformFields ); $i ++) {
$aDynaformFields[$i] = "'$aDynaformFields[$i]'";
}
$sDynaformFieldsAsStrings = implode( ',', $aDynaformFields );
$aRows = $this->getAllByDynUid( $DYN_UID, 'active' );
$sCode = '';
if (sizeof( $aRows ) != 0) {
foreach ($aRows as $aRow) {
$hashCond = md5( $aRow['FCD_UID'] );
$sCondition = $this->parseCondition( $aRow['FCD_CONDITION'] );
$sCondition = addslashes( $sCondition );
$sCode .= "function __condition__$hashCond() { ";
$sCode .= "if( eval(\"{$sCondition}\") ) { ";
$aFields = explode( ',', $aRow['FCD_FIELDS'] );
switch ($aRow['FCD_FUNCTION']) {
case 'show':
foreach ($aFields as $aField) {
$sCode .= "showRowById('$aField');";
}
break;
case 'showOnly':
$sCode .= "hideRowsById(Array($sDynaformFieldsAsStrings));";
foreach ($aFields as $aField) {
$sCode .= "showRowById('$aField');";
}
break;
case 'showAll':
$sCode .= "showRowsById(Array($sDynaformFieldsAsStrings));";
break;
case 'hide':
foreach ($aFields as $aField) {
$sCode .= "hideRowById('$aField');";
}
break;
case 'hideOnly':
$sCode .= "showRowsById(Array($sDynaformFieldsAsStrings));";
foreach ($aFields as $aField) {
$sCode .= "hideRowById('$aField');";
}
break;
case 'hideAll':
$aDynaFields = array ();
$aEventOwner = explode( ',', $aRow['FCD_EVENT_OWNERS'] );
foreach ($aDynaformFields as $sDynaformFields) {
if (! in_array( str_replace( "'", "", $sDynaformFields ), $aEventOwner )) {
$aDynaFields[] = $sDynaformFields;
}
}
$sDynaformFieldsAsStrings = implode( ',', $aDynaFields );
$sCode .= "hideRowsById(Array($sDynaformFieldsAsStrings));";
break;
}
$sCode .= " } ";
$sCode .= "} ";
$aFieldOwners = explode( ',', $aRow['FCD_EVENT_OWNERS'] );
$aEvents = explode( ',', $aRow['FCD_EVENTS'] );
if (in_array( 'onchange', $aEvents )) {
foreach ($aFieldOwners as $aField) {
return $obj->toArray( BasePeer::TYPE_FIELDNAME );
}
/**
* Quick get all records into a criteria object
*
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
*/
public function getAllCriteriaByDynUid ($DYN_UID, $filter = 'all')
{
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_UID );
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_FUNCTION );
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_FIELDS );
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_CONDITION );
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_EVENTS );
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_EVENT_OWNERS );
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_STATUS );
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_DYN_UID );
$oCriteria->add( FieldConditionPeer::FCD_DYN_UID, $DYN_UID );
switch ($filter) {
case 'active':
$oCriteria->add( FieldConditionPeer::FCD_STATUS, '1', Criteria::EQUAL );
break;
}
return $oCriteria;
}
/**
* Quick get all records into a associative array
*
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
*/
public function getAllByDynUid ($DYN_UID, $filter = 'all')
{
$aRows = Array ();
$oCriteria = $this->getAllCriteriaByDynUid( $DYN_UID, $filter );
$oDataset = FieldConditionPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$aRows[] = $aRow;
$oDataset->next();
}
return $aRows;
}
/**
* Quick save a record
*
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
*/
public function quickSave ($aData)
{
$con = Propel::getConnection( FieldConditionPeer::DATABASE_NAME );
try {
$obj = null;
if (isset( $aData['FCD_UID'] ) && trim( $aData['FCD_UID'] ) != '') {
$obj = FieldConditionPeer::retrieveByPk( $aData['FCD_UID'] );
} else {
$aData['FCD_UID'] = G::generateUniqueID();
}
if (! is_object( $obj )) {
$obj = new FieldCondition();
}
$obj->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($obj->validate()) {
$result = $obj->save();
$con->commit();
return $result;
} else {
$e = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
$e->aValidationFailures = $obj->getValidationFailures();
throw ($e);
}
} catch (exception $e) {
$con->rollback();
throw ($e);
}
}
public function getConditionScript ($DYN_UID)
{
require_once 'classes/model/Dynaform.php';
G::LoadSystem( 'dynaformhandler' );
$oDynaform = DynaformPeer::retrieveByPk( $DYN_UID );
$PRO_UID = $oDynaform->getProUid();
$this->oDynaformHandler = new dynaFormHandler( PATH_DYNAFORM . "$PRO_UID/$DYN_UID" . '.xml' );
$aDynaformFields = $this->oDynaformHandler->getFieldNames();
for ($i = 0; $i < count( $aDynaformFields ); $i ++) {
$aDynaformFields[$i] = "'$aDynaformFields[$i]'";
}
$sDynaformFieldsAsStrings = implode( ',', $aDynaformFields );
$aRows = $this->getAllByDynUid( $DYN_UID, 'active' );
$sCode = '';
if (sizeof( $aRows ) != 0) {
foreach ($aRows as $aRow) {
$hashCond = md5( $aRow['FCD_UID'] );
$sCondition = $this->parseCondition( $aRow['FCD_CONDITION'] );
$sCondition = addslashes( $sCondition );
$sCode .= "function __condition__$hashCond() { ";
$sCode .= "if( eval(\"{$sCondition}\") ) { ";
$aFields = explode( ',', $aRow['FCD_FIELDS'] );
switch ($aRow['FCD_FUNCTION']) {
case 'show':
foreach ($aFields as $aField) {
$sCode .= "showRowById('$aField');";
}
break;
case 'showOnly':
$sCode .= "hideRowsById(Array($sDynaformFieldsAsStrings));";
foreach ($aFields as $aField) {
$sCode .= "showRowById('$aField');";
}
break;
case 'showAll':
$sCode .= "showRowsById(Array($sDynaformFieldsAsStrings));";
break;
case 'hide':
foreach ($aFields as $aField) {
$sCode .= "hideRowById('$aField');";
}
break;
case 'hideOnly':
$sCode .= "showRowsById(Array($sDynaformFieldsAsStrings));";
foreach ($aFields as $aField) {
$sCode .= "hideRowById('$aField');";
}
break;
case 'hideAll':
$aDynaFields = array ();
$aEventOwner = explode( ',', $aRow['FCD_EVENT_OWNERS'] );
foreach ($aDynaformFields as $sDynaformFields) {
if (! in_array( str_replace( "'", "", $sDynaformFields ), $aEventOwner )) {
$aDynaFields[] = $sDynaformFields;
}
}
$sDynaformFieldsAsStrings = implode( ',', $aDynaFields );
$sCode .= "hideRowsById(Array($sDynaformFieldsAsStrings));";
break;
}
$sCode .= " } ";
$sCode .= "} ";
$aFieldOwners = explode( ',', $aRow['FCD_EVENT_OWNERS'] );
$aEvents = explode( ',', $aRow['FCD_EVENTS'] );
if (in_array( 'onchange', $aEvents )) {
foreach ($aFieldOwners as $aField) {
//verify the field type
$node = $this->oDynaformHandler->getNode( $aField );
$nodeType = $node->getAttribute( 'type' );
switch ($nodeType) {
case 'checkbox':
$sJSEvent = 'click';
break;
case 'text':
case 'textarea':
case 'currency':
case 'percentage':
$sJSEvent = 'blur';
break;
default:
$sJSEvent = 'change';
break;
}
$sCode .= "leimnud.event.add(getField('$aField'), '$sJSEvent', function() {";
$sCode .= " __condition__$hashCond(); ";
$sCode .= "}.extend(getField('$aField')));";
}
}
if (in_array( 'onload', $aEvents )) {
foreach ($aFieldOwners as $aField) {
$sCode .= " __condition__$hashCond(); ";
}
}
}
return $sCode;
} else {
return null;
}
}
public function parseCondition ($sCondition)
{
preg_match_all( '/@#[a-zA-Z0-9_.]+/', $sCondition, $result );
if (sizeof( $result[0] ) > 0) {
foreach ($result[0] as $fname) {
preg_match_all( '/(@#[a-zA-Z0-9_]+)\.([@#[a-zA-Z0-9_]+)/', $fname, $result2 );
if (isset( $result2[2][0] ) && $result2[1][0]) {
$sCondition = str_replace( $fname, "getField('" . str_replace( '@#', '', $result2[1][0] ) . "')." . $result2[2][0], $sCondition );
} else {
$field = str_replace( '@#', '', $fname );
$node = $this->oDynaformHandler->getNode( $field );
if (isset( $node )) {
$nodeType = $node->getAttribute( 'type' );
switch ($nodeType) {
case 'checkbox':
$sAtt = 'checked';
break;
default:
$sAtt = 'value';
}
} else {
$sAtt = 'value';
}
$sCondition = str_replace( $fname, "getField('" . $field . "').$sAtt", $sCondition );
}
}
}
return $sCondition;
}
public function create ($aData)
{
$oConnection = Propel::getConnection( FieldConditionPeer::DATABASE_NAME );
try {
$node = $this->oDynaformHandler->getNode( $aField );
$nodeType = $node->getAttribute( 'type' );
switch ($nodeType) {
case 'checkbox':
$sJSEvent = 'click';
break;
case 'text':
case 'textarea':
case 'currency':
case 'percentage':
$sJSEvent = 'blur';
break;
default:
$sJSEvent = 'change';
break;
}
$sCode .= "leimnud.event.add(getField('$aField'), '$sJSEvent', function() {";
$sCode .= " __condition__$hashCond(); ";
$sCode .= "}.extend(getField('$aField')));";
}
}
if (in_array( 'onload', $aEvents )) {
foreach ($aFieldOwners as $aField) {
$sCode .= " __condition__$hashCond(); ";
}
}
}
return $sCode;
} else {
return null;
}
}
public function parseCondition ($sCondition)
{
preg_match_all( '/@#[a-zA-Z0-9_.]+/', $sCondition, $result );
if (sizeof( $result[0] ) > 0) {
foreach ($result[0] as $fname) {
preg_match_all( '/(@#[a-zA-Z0-9_]+)\.([@#[a-zA-Z0-9_]+)/', $fname, $result2 );
if (isset( $result2[2][0] ) && $result2[1][0]) {
$sCondition = str_replace( $fname, "getField('" . str_replace( '@#', '', $result2[1][0] ) . "')." . $result2[2][0], $sCondition );
} else {
$field = str_replace( '@#', '', $fname );
$node = $this->oDynaformHandler->getNode( $field );
if (isset( $node )) {
$nodeType = $node->getAttribute( 'type' );
switch ($nodeType) {
case 'checkbox':
$sAtt = 'checked';
break;
default:
$sAtt = 'value';
}
} else {
$sAtt = 'value';
}
$sCondition = str_replace( $fname, "getField('" . $field . "').$sAtt", $sCondition );
}
}
}
return $sCondition;
}
public function create ($aData)
{
$oConnection = Propel::getConnection( FieldConditionPeer::DATABASE_NAME );
try {
// $aData['FCD_UID'] = '';
if (isset( $aData['FCD_UID'] ) && $aData['FCD_UID'] == '') {
unset( $aData['FCD_UID'] );
}
if (! isset( $aData['FCD_UID'] )) {
$aData['FCD_UID'] = G::generateUniqueID();
}
$oFieldCondition = new FieldCondition();
$oFieldCondition->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oFieldCondition->validate()) {
$oConnection->begin();
$iResult = $oFieldCondition->save();
$oConnection->commit();
return true;
} else {
$sMessage = '';
$aValidationFailures = $oFieldCondition->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 remove ($sUID)
{
$oConnection = Propel::getConnection( FieldConditionPeer::DATABASE_NAME );
try {
$oConnection->begin();
$this->setFcdUid( $sUID );
$iResult = $this->delete();
$oConnection->commit();
return $iResult;
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
public function fieldConditionExists ($sUid, $aDynaform)
{
try {
$found = false;
$obj = FieldConditionPeer::retrieveByPk( $sUid );
if (isset( $obj )) {
$aFields = $obj->toArray( BasePeer::TYPE_FIELDNAME );
foreach ($aDynaform as $key => $row) {
if ($row['DYN_UID'] == $aFields['FCD_DYN_UID']) {
$found = true;
}
}
}
if (isset( $aData['FCD_UID'] ) && $aData['FCD_UID'] == '') {
unset( $aData['FCD_UID'] );
}
if (! isset( $aData['FCD_UID'] )) {
$aData['FCD_UID'] = G::generateUniqueID();
}
$oFieldCondition = new FieldCondition();
$oFieldCondition->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oFieldCondition->validate()) {
$oConnection->begin();
$iResult = $oFieldCondition->save();
$oConnection->commit();
return true;
} else {
$sMessage = '';
$aValidationFailures = $oFieldCondition->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 remove ($sUID)
{
$oConnection = Propel::getConnection( FieldConditionPeer::DATABASE_NAME );
try {
$oConnection->begin();
$this->setFcdUid( $sUID );
$iResult = $this->delete();
$oConnection->commit();
return $iResult;
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
public function fieldConditionExists ($sUid, $aDynaform)
{
try {
$found = false;
$obj = FieldConditionPeer::retrieveByPk( $sUid );
if (isset( $obj )) {
$aFields = $obj->toArray( BasePeer::TYPE_FIELDNAME );
foreach ($aDynaform as $key => $row) {
if ($row['DYN_UID'] == $aFields['FCD_DYN_UID']) {
$found = true;
}
}
}
// return( get_class($obj) == 'FieldCondition') ;
return ($found);
} catch (Exception $oError) {
throw ($oError);
}
}
public function Exists ($sUid)
{
try {
$obj = FieldConditionPeer::retrieveByPk( $sUid );
return (is_object( $obj ) && get_class( $obj ) == 'FieldCondition');
} catch (Exception $oError) {
throw ($oError);
}
}
}
// FieldCondition
return ($found);
} catch (Exception $oError) {
throw ($oError);
}
}
public function Exists ($sUid)
{
try {
$obj = FieldConditionPeer::retrieveByPk( $sUid );
return (is_object( $obj ) && get_class( $obj ) == 'FieldCondition');
} catch (Exception $oError) {
throw ($oError);
}
}
}
// FieldCondition

View File

@@ -14,7 +14,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'FIELD_CONDITION' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -22,6 +22,7 @@
*
* @package workflow.engine.classes.model
*/
class FieldConditionPeer extends BaseFieldConditionPeer {
class FieldConditionPeer extends BaseFieldConditionPeer
{
}
} // FieldConditionPeer

View File

@@ -18,106 +18,102 @@ require_once 'classes/model/om/BaseFields.php';
*
* @package workflow.engine.classes.model
*/
class Fields extends BaseFields {
public function load($sUID) {
try {
$oFields = FieldsPeer::retrieveByPK($sUID);
if (!is_null($oFields)) {
$aFields = $oFields->toArray(BasePeer::TYPE_FIELDNAME);
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
return $aFields;
}
else {
throw(new Exception('This row doesn\'t exist!'));
}
}
catch (Exception $oError) {
throw($oError);
}
}
function create($aData) {
if (!isset($aData['FLD_UID'])) {
$aData['FLD_UID'] = G::generateUniqueID();
}
else {
if ($aData['FLD_UID'] == '') {
$aData['FLD_UID'] = G::generateUniqueID();
}
}
$oConnection = Propel::getConnection(FieldsPeer::DATABASE_NAME);
try {
$oFields = new Fields();
$oFields->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oFields->validate()) {
$oConnection->begin();
$iResult = $oFields->save();
$oConnection->commit();
return $aData['FLD_UID'];
}
else {
$sMessage = '';
$aValidationFailures = $oFields->getValidationFailures();
foreach($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
class Fields extends BaseFields
{
public function load($sUID)
{
try {
$oFields = FieldsPeer::retrieveByPK($sUID);
if (!is_null($oFields)) {
$aFields = $oFields->toArray(BasePeer::TYPE_FIELDNAME);
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
return $aFields;
} else {
throw(new Exception('This row doesn\'t exist!'));
}
} catch (Exception $oError) {
throw($oError);
}
throw(new Exception('The registry cannot be created!<br />' . $sMessage));
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
function update($aData) {
$oConnection = Propel::getConnection(FieldsPeer::DATABASE_NAME);
try {
$oFields = FieldsPeer::retrieveByPK($aData['FLD_UID']);
if (!is_null($oFields)) {
$oFields->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oFields->validate()) {
$oConnection->begin();
$iResult = $oFields->save();
$oConnection->commit();
return $iResult;
public function create($aData)
{
if (!isset($aData['FLD_UID'])) {
$aData['FLD_UID'] = G::generateUniqueID();
} else {
if ($aData['FLD_UID'] == '') {
$aData['FLD_UID'] = G::generateUniqueID();
}
}
else {
$sMessage = '';
$aValidationFailures = $oFields->getValidationFailures();
foreach($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw(new Exception('The registry cannot be updated!<br />'.$sMessage));
$oConnection = Propel::getConnection(FieldsPeer::DATABASE_NAME);
try {
$oFields = new Fields();
$oFields->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oFields->validate()) {
$oConnection->begin();
$iResult = $oFields->save();
$oConnection->commit();
return $aData['FLD_UID'];
} else {
$sMessage = '';
$aValidationFailures = $oFields->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 {
throw(new Exception('This row doesn\'t exist!'));
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
function remove($sUID) {
$oConnection = Propel::getConnection(FieldsPeer::DATABASE_NAME);
try {
$oFields = FieldsPeer::retrieveByPK($sUID);
if (!is_null($oFields)) {
$oConnection->begin();
$iResult = $oFields->delete();
$oConnection->commit();
return $iResult;
}
else {
throw(new Exception('This row doesn\'t exist!'));
}
public function update($aData)
{
$oConnection = Propel::getConnection(FieldsPeer::DATABASE_NAME);
try {
$oFields = FieldsPeer::retrieveByPK($aData['FLD_UID']);
if (!is_null($oFields)) {
$oFields->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oFields->validate()) {
$oConnection->begin();
$iResult = $oFields->save();
$oConnection->commit();
return $iResult;
} else {
$sMessage = '';
$aValidationFailures = $oFields->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);
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
public function remove($sUID)
{
$oConnection = Propel::getConnection(FieldsPeer::DATABASE_NAME);
try {
$oFields = FieldsPeer::retrieveByPK($sUID);
if (!is_null($oFields)) {
$oConnection->begin();
$iResult = $oFields->delete();
$oConnection->commit();
return $iResult;
} else {
throw(new Exception('This row doesn\'t exist!'));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
}
} // Fields
}

View File

@@ -14,7 +14,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'FIELDS' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -22,6 +22,7 @@
*
* @package workflow.engine.classes.model
*/
class FieldsPeer extends BaseFieldsPeer {
class FieldsPeer extends BaseFieldsPeer
{
}
} // FieldsPeer

View File

@@ -1,166 +1,165 @@
<?php
/**
* Gateway.php
*
* @package workflow.engine.classes.model
*/
require_once 'classes/model/om/BaseGateway.php';
/**
* Skeleton subclass for representing a row from the 'GATEWAY' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package workflow.engine.classes.model
*/
class Gateway extends BaseGateway
{
public function create ($aData)
{
$oConnection = Propel::getConnection( GatewayPeer::DATABASE_NAME );
try {
$sGatewayUID = G::generateUniqueID();
$aData['GAT_UID'] = $sGatewayUID;
$oGateway = new Gateway();
$oGateway->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oGateway->validate()) {
$oConnection->begin();
$iResult = $oGateway->save();
$oConnection->commit();
return $sGatewayUID;
} else {
$sMessage = '';
$aValidationFailures = $oGateway->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 load ($GatewayUid)
{
try {
$oRow = GatewayPeer::retrieveByPK( $GatewayUid );
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 '" . $GatewayUid . "' in table Gateway doesn't exist!" ));
}
} catch (Exception $oError) {
throw ($oError);
}
}
public function update ($fields)
{
$con = Propel::getConnection( GatewayPeer::DATABASE_NAME );
try {
$con->begin();
$this->load( $fields['GAT_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);
}
}
public function remove ($GatewayUid)
{
$oConnection = Propel::getConnection( GatewayPeer::DATABASE_NAME );
try {
$oGateWay = GatewayPeer::retrieveByPK( $GatewayUid );
if (! is_null( $oGateWay )) {
$oConnection->begin();
$iResult = $oGateWay->delete();
$oConnection->commit();
<?php
/**
* Gateway.php
*
* @package workflow.engine.classes.model
*/
require_once 'classes/model/om/BaseGateway.php';
/**
* Skeleton subclass for representing a row from the 'GATEWAY' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package workflow.engine.classes.model
*/
class Gateway extends BaseGateway
{
public function create ($aData)
{
$oConnection = Propel::getConnection( GatewayPeer::DATABASE_NAME );
try {
$sGatewayUID = G::generateUniqueID();
$aData['GAT_UID'] = $sGatewayUID;
$oGateway = new Gateway();
$oGateway->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oGateway->validate()) {
$oConnection->begin();
$iResult = $oGateway->save();
$oConnection->commit();
return $sGatewayUID;
} else {
$sMessage = '';
$aValidationFailures = $oGateway->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 load ($GatewayUid)
{
try {
$oRow = GatewayPeer::retrieveByPK( $GatewayUid );
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 '" . $GatewayUid . "' in table Gateway doesn't exist!" ));
}
} catch (Exception $oError) {
throw ($oError);
}
}
public function update ($fields)
{
$con = Propel::getConnection( GatewayPeer::DATABASE_NAME );
try {
$con->begin();
$this->load( $fields['GAT_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);
}
}
public function remove ($GatewayUid)
{
$oConnection = Propel::getConnection( GatewayPeer::DATABASE_NAME );
try {
$oGateWay = GatewayPeer::retrieveByPK( $GatewayUid );
if (! is_null( $oGateWay )) {
$oConnection->begin();
$iResult = $oGateWay->delete();
$oConnection->commit();
//return $iResult;
return true;
} else {
throw (new Exception( 'This row does not exist!' ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
/**
* verify if Gateway row specified in [GatUid] exists.
*
* @param string $sProUid the uid of the Prolication
*/
public function gatewayExists ($GatUid)
{
$con = Propel::getConnection( GatewayPeer::DATABASE_NAME );
try {
$oPro = GatewayPeer::retrieveByPk( $GatUid );
if (is_object( $oPro ) && get_class( $oPro ) == 'Gateway') {
return true;
} else {
return false;
}
} catch (Exception $oError) {
throw ($oError);
}
}
/**
* create a new Gateway
*
* @param array $aData with new values
* @return void
*/
public function createRow ($aData)
{
$con = Propel::getConnection( GatewayPeer::DATABASE_NAME );
try {
$con->begin();
$this->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($this->validate()) {
$this->setGatUid( (isset( $aData['GAT_UID'] ) ? $aData['GAT_UID'] : '') );
$this->setProUid( (isset( $aData['PRO_UID'] ) ? $aData['PRO_UID'] : '') );
$this->setTasUid( (isset( $aData['TAS_UID'] ) ? $aData['TAS_UID'] : '') );
$this->setGatNextTask( (isset( $aData['GAT_NEXT_TASK'] ) ? $aData['GAT_NEXT_TASK'] : '') );
$this->setGatX( (isset( $aData['GAT_X'] ) ? $aData['GAT_X'] : '') );
$this->setGatY( (isset( $aData['GAT_Y'] ) ? $aData['GAT_Y'] : '') );
$this->save();
$con->commit();
return;
} else {
$con->rollback();
$e = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
$e->aValidationFailures = $this->getValidationFailures();
throw ($e);
}
} catch (Exception $e) {
$con->rollback();
throw ($e);
}
}
}
// Gateway
return true;
} else {
throw (new Exception( 'This row does not exist!' ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
/**
* verify if Gateway row specified in [GatUid] exists.
*
* @param string $sProUid the uid of the Prolication
*/
public function gatewayExists ($GatUid)
{
$con = Propel::getConnection( GatewayPeer::DATABASE_NAME );
try {
$oPro = GatewayPeer::retrieveByPk( $GatUid );
if (is_object( $oPro ) && get_class( $oPro ) == 'Gateway') {
return true;
} else {
return false;
}
} catch (Exception $oError) {
throw ($oError);
}
}
/**
* create a new Gateway
*
* @param array $aData with new values
* @return void
*/
public function createRow ($aData)
{
$con = Propel::getConnection( GatewayPeer::DATABASE_NAME );
try {
$con->begin();
$this->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($this->validate()) {
$this->setGatUid( (isset( $aData['GAT_UID'] ) ? $aData['GAT_UID'] : '') );
$this->setProUid( (isset( $aData['PRO_UID'] ) ? $aData['PRO_UID'] : '') );
$this->setTasUid( (isset( $aData['TAS_UID'] ) ? $aData['TAS_UID'] : '') );
$this->setGatNextTask( (isset( $aData['GAT_NEXT_TASK'] ) ? $aData['GAT_NEXT_TASK'] : '') );
$this->setGatX( (isset( $aData['GAT_X'] ) ? $aData['GAT_X'] : '') );
$this->setGatY( (isset( $aData['GAT_Y'] ) ? $aData['GAT_Y'] : '') );
$this->save();
$con->commit();
return;
} else {
$con->rollback();
$e = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
$e->aValidationFailures = $this->getValidationFailures();
throw ($e);
}
} catch (Exception $e) {
$con->rollback();
throw ($e);
}
}
}

View File

@@ -14,7 +14,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'GATEWAY' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -22,6 +22,7 @@
*
* @package workflow.engine.classes.model
*/
class GatewayPeer extends BaseGatewayPeer {
class GatewayPeer extends BaseGatewayPeer
{
}
} // GatewayPeer

View File

@@ -101,7 +101,7 @@ class GroupUser extends BaseGroupUser
}
}
function getCountAllUsersByGroup ()
public function getCountAllUsersByGroup ()
{
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( GroupUserPeer::GRP_UID );
@@ -119,7 +119,7 @@ class GroupUser extends BaseGroupUser
return $aRows;
}
function getAllUserGroups ($usrUid)
public function getAllUserGroups ($usrUid)
{
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( GroupUserPeer::USR_UID, $usrUid );
@@ -143,5 +143,4 @@ class GroupUser extends BaseGroupUser
return $rows;
}
}
// GroupUser

View File

@@ -2,10 +2,10 @@
/**
* GroupUserPeer.php
* @package workflow.engine.classes.model
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
*
* 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
@@ -15,13 +15,13 @@
* 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.,
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*
*/
// include base peer class
@@ -34,7 +34,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'GROUP_USER' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -42,6 +42,7 @@
*
* @package workflow.engine.classes.model
*/
class GroupUserPeer extends BaseGroupUserPeer {
class GroupUserPeer extends BaseGroupUserPeer
{
}
} // GroupUserPeer

View File

@@ -96,8 +96,7 @@ class Groupwf extends BaseGroupwf
* @param array $aData $oData is not necessary
* @return void
*/
function create ($aData)
public function create ($aData)
{
//$oData is not necessary
$con = Propel::getConnection( GroupwfPeer::DATABASE_NAME );
@@ -153,8 +152,7 @@ class Groupwf extends BaseGroupwf
* @param string $ProUid the uid of the Prolication
* @return array $Fields the fields
*/
function Load ($ProUid)
public function Load ($ProUid)
{
$con = Propel::getConnection( GroupwfPeer::DATABASE_NAME );
try {
@@ -180,7 +178,6 @@ class Groupwf extends BaseGroupwf
* @return variant
*
*/
public function update ($aData)
{
$con = Propel::getConnection( GroupwfPeer::DATABASE_NAME );
@@ -245,7 +242,7 @@ class Groupwf extends BaseGroupwf
* @param string $sProUid the uid of the Prolication
*/
function GroupwfExists ($GrpUid)
public function GroupwfExists ($GrpUid)
{
$con = Propel::getConnection( GroupwfPeer::DATABASE_NAME );
try {
@@ -260,7 +257,7 @@ class Groupwf extends BaseGroupwf
}
}
function loadByGroupname ($Groupname)
public function loadByGroupname ($Groupname)
{
$c = new Criteria( 'workflow' );
$del = DBAdapter::getStringDelimiter();
@@ -275,7 +272,7 @@ class Groupwf extends BaseGroupwf
return $c;
}
function getAll ($start = null, $limit = null, $search = null)
public function getAll ($start = null, $limit = null, $search = null)
{
$totalCount = 0;
$criteria = new Criteria( 'workflow' );
@@ -325,7 +322,7 @@ class Groupwf extends BaseGroupwf
return $result;
}
function getAllGroup ($start = null, $limit = null, $search = null)
public function getAllGroup ($start = null, $limit = null, $search = null)
{
require_once PATH_RBAC . "model/RbacUsers.php";
require_once 'classes/model/TaskUser.php';
@@ -382,7 +379,7 @@ class Groupwf extends BaseGroupwf
);
}
function filterGroup ($filter, $start, $limit)
public function filterGroup ($filter, $start, $limit)
{
require_once 'classes/model/Groupwf.php';
require_once 'classes/model/TaskUser.php';
@@ -428,5 +425,4 @@ class Groupwf extends BaseGroupwf
}
}
// Groupwf

View File

@@ -2,10 +2,10 @@
/**
* GroupwfPeer.php
* @package workflow.engine.classes.model
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
*
* 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
@@ -15,13 +15,13 @@
* 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.,
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*
*/
// include base peer class
@@ -34,7 +34,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'GROUPWF' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -42,6 +42,7 @@
*
* @package workflow.engine.classes.model
*/
class GroupwfPeer extends BaseGroupwfPeer {
class GroupwfPeer extends BaseGroupwfPeer
{
}
} // GroupwfPeer

View File

@@ -2,10 +2,10 @@
/**
* Holiday.php
* @package workflow.engine.classes.model
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
*
* 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
@@ -15,13 +15,13 @@
* 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.,
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*
*/
require_once 'classes/model/om/BaseHoliday.php';
@@ -30,7 +30,7 @@ require_once 'classes/model/om/BaseHoliday.php';
/**
* Skeleton subclass for representing a row from the 'HOLIDAY' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -38,6 +38,7 @@ require_once 'classes/model/om/BaseHoliday.php';
*
* @package workflow.engine.classes.model
*/
class Holiday extends BaseHoliday {
class Holiday extends BaseHoliday
{
}
} // Holiday

View File

@@ -2,10 +2,10 @@
/**
* HolidayPeer.php
* @package workflow.engine.classes.model
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
*
* 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
@@ -15,13 +15,13 @@
* 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.,
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*
*/
// include base peer class
@@ -34,7 +34,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'HOLIDAY' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -42,6 +42,7 @@
*
* @package workflow.engine.classes.model
*/
class HolidayPeer extends BaseHolidayPeer {
class HolidayPeer extends BaseHolidayPeer
{
}
} // HolidayPeer