CODE STYLE Format

Change format
This commit is contained in:
norahmollo
2012-10-19 18:50:57 +00:00
parent b17a5eff62
commit 9e9f4be8e6
5 changed files with 1342 additions and 1324 deletions

View File

@@ -1,231 +1,227 @@
<?php
/**
* ReportTable.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
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
require_once 'classes/model/Content.php';
require_once 'classes/model/om/BaseReportTable.php';
/**
* Skeleton subclass for representing a row from the 'REPORT_TABLE' 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 ReportTable extends BaseReportTable {
/**
* This value goes in the content table
* @var string
*/
protected $rep_tab_title = '';
/**
* Get the rep_tab_title column value.
* @return string
*/
public function getRepTabTitle() {
if ( $this->getRepTabUid() == "" ) {
throw ( new Exception( "Error in getRepTabTitle, the getRepTabUid() can't be blank") );
}
$lang = defined ( 'SYS_LANG' ) ? SYS_LANG : 'en';
$this->rep_tab_title = Content::load ( 'REP_TAB_TITLE', '', $this->getRepTabUid(), $lang );
return $this->rep_tab_title;
}
/**
* Set the rep_tab_title column value.
*
* @param string $v new value
* @return void
*/
public function setRepTabTitle($v)
{
if ( $this->getRepTabUid() == "" ) {
throw ( new Exception( "Error in setRepTabTitle, the setRepTabUid() can't be blank") );
}
$v=isset($v)?((string)$v):'';
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
if ($this->rep_tab_title !== $v || $v==="") {
$this->rep_tab_title = $v;
$res = Content::addContent( 'REP_TAB_TITLE', '', $this->getRepTabUid(), $lang, $this->rep_tab_title );
return $res;
}
return 0;
}
public function load($RepTabUid)
{
try {
$oRow = ReportTablePeer::retrieveByPK( $RepTabUid );
if (!is_null($oRow))
{
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
$this->setNew(false);
$this->setRepTabTitle($aFields['REP_TAB_TITLE']=$this->getRepTabTitle());
return $aFields;
}
else {
//throw( new Exception( "The row '$RepTabUid' in table ReportTable doesn't exist!" ));
return array();
}
}
catch (Exception $oError) {
throw($oError);
}
}
public function create($aData)
{
$con = Propel::getConnection(ReportTablePeer::DATABASE_NAME);
try
{
$con->begin();
if ( isset ( $aData['REP_TAB_UID'] ) && $aData['REP_TAB_UID']== '' )
unset ( $aData['REP_TAB_UID'] );
if ( !isset ( $aData['REP_TAB_UID'] ) )
$this->setRepTabUid(G::generateUniqueID());
else
$this->setRepTabUid($aData['REP_TAB_UID'] );
$this->setProUid($aData['PRO_UID']);
$this->setRepTabName($aData['REP_TAB_NAME']);
$this->setRepTabType($aData['REP_TAB_TYPE']);
if ( !isset ( $aData['REP_TAB_GRID'] ) )
$this->setRepTabGrid("");
else
$this->setRepTabGrid( $aData['REP_TAB_GRID'] );
if ( !isset ( $aData['REP_TAB_CONNECTION'] ) )
$this->setRepTabConnection("report");
else
$this->setRepTabConnection( $aData['REP_TAB_CONNECTION'] );
$this->setRepTabCreateDate(date('Y-m-d H:i:s'));
$this->setRepTabStatus('ACTIVE');
if($this->validate())
{
if ( !isset ( $aData['REP_TAB_TITLE'] ) )
$this->setRepTabTitle("");
else
$this->setRepTabTitle( $aData['REP_TAB_TITLE'] );
$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 update($fields)
{
$con = Propel::getConnection(ReportTablePeer::DATABASE_NAME);
try
{
$con->begin();
$this->load($fields['REP_TAB_UID']);
$this->fromArray($fields,BasePeer::TYPE_FIELDNAME);
$sDataBase = 'database_' . strtolower(DB_ADAPTER);
if(G::LoadSystemExist($sDataBase)){
G::LoadSystem($sDataBase);
$oDataBase = new database();
$oValidate = $oDataBase->getValidate($this->validate());
} else {
$oValidate = $this->validate();
}
// if($this->validate())
if($oValidate)
{
$contentResult=0;
if (array_key_exists("REP_TAB_TITLE", $fields)) $contentResult+=$this->setRepTabTitle($fields["REP_TAB_TITLE"]);
$result=$this->save();
$result=($result==0)?($contentResult>0?1:0):$result;
$con->commit();
return $result;
}
else
{
$con->rollback();
$validationE=new Exception("Failed Validation in class ".get_class($this).".");
$validationE->aValidationFailures = $this->getValidationFailures();
throw($validationE);
}
}
catch(Exception $e)
{
$con->rollback();
throw($e);
}
}
public function remove($RepTabUid)
{
$con = Propel::getConnection(ReportTablePeer::DATABASE_NAME);
try
{
$con->begin();
$oRepTab = ReportTablePeer::retrieveByPK( $RepTabUid );
if (!is_null($oRepTab)) {
Content::removeContent( 'REP_TAB_TITLE', '', $this->getRepTabUid());
$result = $oRepTab->delete();
$con->commit();
}
return $result;
}
catch(Exception $e)
{
$con->rollback();
throw($e);
}
}
function reportTableExists ( $RepTabUid ) {
$con = Propel::getConnection(ReportTablePeer::DATABASE_NAME);
try {
$oRepTabUid = ReportTablePeer::retrieveByPk( $RepTabUid );
if (is_object($oRepTabUid) && get_class ($oRepTabUid) == 'ReportTable' ) {
return true;
}
else {
return false;
}
}
catch (Exception $oError) {
throw($oError);
}
}
} // ReportTable
<?php
/**
* ReportTable.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
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
require_once 'classes/model/Content.php';
require_once 'classes/model/om/BaseReportTable.php';
/**
* Skeleton subclass for representing a row from the 'REPORT_TABLE' 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 ReportTable extends BaseReportTable
{
/**
* This value goes in the content table
*
* @var string
*/
protected $rep_tab_title = '';
/**
* Get the rep_tab_title column value.
*
* @return string
*/
public function getRepTabTitle ()
{
if ($this->getRepTabUid() == "") {
throw (new Exception( "Error in getRepTabTitle, the getRepTabUid() can't be blank" ));
}
$lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
$this->rep_tab_title = Content::load( 'REP_TAB_TITLE', '', $this->getRepTabUid(), $lang );
return $this->rep_tab_title;
}
/**
* Set the rep_tab_title column value.
*
* @param string $v new value
* @return void
*/
public function setRepTabTitle ($v)
{
if ($this->getRepTabUid() == "") {
throw (new Exception( "Error in setRepTabTitle, the setRepTabUid() can't be blank" ));
}
$v = isset( $v ) ? ((string) $v) : '';
$lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
if ($this->rep_tab_title !== $v || $v === "") {
$this->rep_tab_title = $v;
$res = Content::addContent( 'REP_TAB_TITLE', '', $this->getRepTabUid(), $lang, $this->rep_tab_title );
return $res;
}
return 0;
}
public function load ($RepTabUid)
{
try {
$oRow = ReportTablePeer::retrieveByPK( $RepTabUid );
if (! is_null( $oRow )) {
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
$this->setNew( false );
$this->setRepTabTitle( $aFields['REP_TAB_TITLE'] = $this->getRepTabTitle() );
return $aFields;
} else {
//throw( new Exception( "The row '$RepTabUid' in table ReportTable doesn't exist!" ));
return array ();
}
} catch (Exception $oError) {
throw ($oError);
}
}
public function create ($aData)
{
$con = Propel::getConnection( ReportTablePeer::DATABASE_NAME );
try {
$con->begin();
if (isset( $aData['REP_TAB_UID'] ) && $aData['REP_TAB_UID'] == '') {
unset( $aData['REP_TAB_UID'] );
}
if (! isset( $aData['REP_TAB_UID'] )) {
$this->setRepTabUid( G::generateUniqueID() );
} else {
$this->setRepTabUid( $aData['REP_TAB_UID'] );
}
$this->setProUid( $aData['PRO_UID'] );
$this->setRepTabName( $aData['REP_TAB_NAME'] );
$this->setRepTabType( $aData['REP_TAB_TYPE'] );
if (! isset( $aData['REP_TAB_GRID'] )) {
$this->setRepTabGrid( "" );
} else {
$this->setRepTabGrid( $aData['REP_TAB_GRID'] );
}
if (! isset( $aData['REP_TAB_CONNECTION'] )) {
$this->setRepTabConnection( "report" );
} else {
$this->setRepTabConnection( $aData['REP_TAB_CONNECTION'] );
}
$this->setRepTabCreateDate( date( 'Y-m-d H:i:s' ) );
$this->setRepTabStatus( 'ACTIVE' );
if ($this->validate()) {
if (! isset( $aData['REP_TAB_TITLE'] )) {
$this->setRepTabTitle( "" );
} else {
$this->setRepTabTitle( $aData['REP_TAB_TITLE'] );
}
$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 update ($fields)
{
$con = Propel::getConnection( ReportTablePeer::DATABASE_NAME );
try {
$con->begin();
$this->load( $fields['REP_TAB_UID'] );
$this->fromArray( $fields, BasePeer::TYPE_FIELDNAME );
$sDataBase = 'database_' . strtolower( DB_ADAPTER );
if (G::LoadSystemExist( $sDataBase )) {
G::LoadSystem( $sDataBase );
$oDataBase = new database();
$oValidate = $oDataBase->getValidate( $this->validate() );
} else {
$oValidate = $this->validate();
}
// if($this->validate())
if ($oValidate) {
$contentResult = 0;
if (array_key_exists( "REP_TAB_TITLE", $fields )) {
$contentResult += $this->setRepTabTitle( $fields["REP_TAB_TITLE"] );
}
$result = $this->save();
$result = ($result == 0) ? ($contentResult > 0 ? 1 : 0) : $result;
$con->commit();
return $result;
} else {
$con->rollback();
$validationE = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
$validationE->aValidationFailures = $this->getValidationFailures();
throw ($validationE);
}
} catch (Exception $e) {
$con->rollback();
throw ($e);
}
}
public function remove ($RepTabUid)
{
$con = Propel::getConnection( ReportTablePeer::DATABASE_NAME );
try {
$con->begin();
$oRepTab = ReportTablePeer::retrieveByPK( $RepTabUid );
if (! is_null( $oRepTab )) {
Content::removeContent( 'REP_TAB_TITLE', '', $this->getRepTabUid() );
$result = $oRepTab->delete();
$con->commit();
}
return $result;
} catch (Exception $e) {
$con->rollback();
throw ($e);
}
}
public function reportTableExists ($RepTabUid)
{
$con = Propel::getConnection( ReportTablePeer::DATABASE_NAME );
try {
$oRepTabUid = ReportTablePeer::retrieveByPk( $RepTabUid );
if (is_object( $oRepTabUid ) && get_class( $oRepTabUid ) == 'ReportTable') {
return true;
} else {
return false;
}
} catch (Exception $oError) {
throw ($oError);
}
}
}
// ReportTable

View File

@@ -1,216 +1,217 @@
<?php
/**
* Route.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
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
require_once 'classes/model/om/BaseRoute.php';
require_once 'classes/model/Content.php';
/**
* Skeleton subclass for representing a row from the 'ROUTE' 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 Route extends BaseRoute {
/*
<?php
/**
* Route.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
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
require_once 'classes/model/om/BaseRoute.php';
require_once 'classes/model/Content.php';
/**
* Skeleton subclass for representing a row from the 'ROUTE' 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 Route extends BaseRoute
{
/*
* Load the application document registry
* @param string $sRouUid
* @return variant
*/
public function load($sRouUid)
{
try {
$oRoute = RoutePeer::retrieveByPK($sRouUid);
if (!is_null($oRoute))
{
$aFields = $oRoute->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);
}
}
/**
* Create the application document registry
* @param array $aData
* @return string
**/
public function create($aData)
{
$oConnection = Propel::getConnection(RoutePeer::DATABASE_NAME);
try {
$sRouteUID = G::generateUniqueID();
$aData['ROU_UID'] = $sRouteUID;
$oRoute = new Route();
// validating default values
$aData['ROU_TO_LAST_USER'] = $this->validateValue(isset($aData['ROU_TO_LAST_USER']) ? $aData['ROU_TO_LAST_USER'] : '', array('TRUE', 'FALSE'), 'FALSE');
$aData['ROU_OPTIONAL'] = $this->validateValue(isset($aData['ROU_OPTIONAL']) ? $aData['ROU_OPTIONAL'] : '', array('TRUE', 'FALSE'), 'FALSE');
$aData['ROU_SEND_EMAIL'] = $this->validateValue(isset($aData['ROU_SEND_EMAIL']) ? $aData['ROU_SEND_EMAIL']: '', array('TRUE', 'FALSE'), 'TRUE');
$oRoute->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oRoute->validate()) {
$oConnection->begin();
$iResult = $oRoute->save();
$oConnection->commit();
return $sRouteUID;
}
else {
$sMessage = '';
$aValidationFailures = $oRoute->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);
}
}
/**
* Update the application document registry
* @param array $aData
* @return string
**/
public function update($aData)
{
$oConnection = Propel::getConnection(RoutePeer::DATABASE_NAME);
try {
$oRoute = RoutePeer::retrieveByPK($aData['ROU_UID']);
if (!is_null($oRoute))
{
// validating default values
if (isset($aData['ROU_TO_LAST_USER'])) {
$aData['ROU_TO_LAST_USER'] = $this->validateValue($aData['ROU_TO_LAST_USER'], array('TRUE', 'FALSE'), 'FALSE');
}
if (isset($aData['ROU_OPTIONAL'])) {
$aData['ROU_OPTIONAL'] = $this->validateValue($aData['ROU_OPTIONAL'], array('TRUE', 'FALSE'), 'FALSE');
}
if (isset($aData['ROU_SEND_EMAIL'])) {
$aData['ROU_SEND_EMAIL'] = $this->validateValue($aData['ROU_SEND_EMAIL'], array('TRUE', 'FALSE'), 'TRUE');
}
$oRoute->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oRoute->validate()) {
$oConnection->begin();
$iResult = $oRoute->save();
$oConnection->commit();
return $iResult;
}
else {
$sMessage = '';
$aValidationFailures = $oRoute->getValidationFailures();
foreach($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw(new Exception('The ROUTE tables cannot be updated!<br />'.$sMessage));
}
}
else {
throw(new Exception( "The row " . $aData['ROU_UID'] . " doesn't exist!" ));
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
/**
* Remove the application document registry
* @param array $aData
* @return string
**/
public function remove($sRouUid)
{
$oConnection = Propel::getConnection(RoutePeer::DATABASE_NAME);
try {
$oRoute = RoutePeer::retrieveByPK($sRouUid);
if (!is_null($oRoute))
{
$oConnection->begin();
$iResult = $oRoute->delete();
$oConnection->commit();
return $iResult;
}
else {
throw(new Exception('This row doesn\'t exist!'));
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
function routeExists ( $sRouUid ) {
$con = Propel::getConnection(RoutePeer::DATABASE_NAME);
try {
$oRouUid = RoutePeer::retrieveByPk( $sRouUid );
if (is_object($oRouUid) && get_class ($oRouUid) == 'Route' ) {
return true;
}
else {
return false;
}
}
catch (Exception $oError) {
throw($oError);
}
}
/**
* Validate value for a variable that only accepts some determinated values
*
* @param $value string - value to test
* @param $validValues array - list of valid values
* @param $default string default value, if the tested value is not valid the default value is returned
* @return the tested and accepted value
*/
function validateValue($value, $validValues, $default)
{
if (!in_array($value, $validValues)) {
$value = $default;
}
return $value;
}
} // Route
*/
public function load ($sRouUid)
{
try {
$oRoute = RoutePeer::retrieveByPK( $sRouUid );
if (! is_null( $oRoute )) {
$aFields = $oRoute->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);
}
}
/**
* Create the application document registry
*
* @param array $aData
* @return string
*
*/
public function create ($aData)
{
$oConnection = Propel::getConnection( RoutePeer::DATABASE_NAME );
try {
$sRouteUID = G::generateUniqueID();
$aData['ROU_UID'] = $sRouteUID;
$oRoute = new Route();
// validating default values
$aData['ROU_TO_LAST_USER'] = $this->validateValue( isset( $aData['ROU_TO_LAST_USER'] ) ? $aData['ROU_TO_LAST_USER'] : '', array ('TRUE','FALSE'
), 'FALSE' );
$aData['ROU_OPTIONAL'] = $this->validateValue( isset( $aData['ROU_OPTIONAL'] ) ? $aData['ROU_OPTIONAL'] : '', array ('TRUE','FALSE'
), 'FALSE' );
$aData['ROU_SEND_EMAIL'] = $this->validateValue( isset( $aData['ROU_SEND_EMAIL'] ) ? $aData['ROU_SEND_EMAIL'] : '', array ('TRUE','FALSE'
), 'TRUE' );
$oRoute->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oRoute->validate()) {
$oConnection->begin();
$iResult = $oRoute->save();
$oConnection->commit();
return $sRouteUID;
} else {
$sMessage = '';
$aValidationFailures = $oRoute->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);
}
}
/**
* Update the application document registry
*
* @param array $aData
* @return string
*
*/
public function update ($aData)
{
$oConnection = Propel::getConnection( RoutePeer::DATABASE_NAME );
try {
$oRoute = RoutePeer::retrieveByPK( $aData['ROU_UID'] );
if (! is_null( $oRoute )) {
// validating default values
if (isset( $aData['ROU_TO_LAST_USER'] )) {
$aData['ROU_TO_LAST_USER'] = $this->validateValue( $aData['ROU_TO_LAST_USER'], array ('TRUE','FALSE'
), 'FALSE' );
}
if (isset( $aData['ROU_OPTIONAL'] )) {
$aData['ROU_OPTIONAL'] = $this->validateValue( $aData['ROU_OPTIONAL'], array ('TRUE','FALSE'
), 'FALSE' );
}
if (isset( $aData['ROU_SEND_EMAIL'] )) {
$aData['ROU_SEND_EMAIL'] = $this->validateValue( $aData['ROU_SEND_EMAIL'], array ('TRUE','FALSE'
), 'TRUE' );
}
$oRoute->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oRoute->validate()) {
$oConnection->begin();
$iResult = $oRoute->save();
$oConnection->commit();
return $iResult;
} else {
$sMessage = '';
$aValidationFailures = $oRoute->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw (new Exception( 'The ROUTE tables cannot be updated!<br />' . $sMessage ));
}
} else {
throw (new Exception( "The row " . $aData['ROU_UID'] . " doesn't exist!" ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
/**
* Remove the application document registry
*
* @param array $aData
* @return string
*
*/
public function remove ($sRouUid)
{
$oConnection = Propel::getConnection( RoutePeer::DATABASE_NAME );
try {
$oRoute = RoutePeer::retrieveByPK( $sRouUid );
if (! is_null( $oRoute )) {
$oConnection->begin();
$iResult = $oRoute->delete();
$oConnection->commit();
return $iResult;
} else {
throw (new Exception( 'This row doesn\'t exist!' ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
public function routeExists ($sRouUid)
{
$con = Propel::getConnection( RoutePeer::DATABASE_NAME );
try {
$oRouUid = RoutePeer::retrieveByPk( $sRouUid );
if (is_object( $oRouUid ) && get_class( $oRouUid ) == 'Route') {
return true;
} else {
return false;
}
} catch (Exception $oError) {
throw ($oError);
}
}
/**
* Validate value for a variable that only accepts some determinated values
*
* @param $value string - value to test
* @param $validValues array - list of valid values
* @param $default string default value, if the tested value is not valid the default value is returned
* @return the tested and accepted value
*/
public function validateValue ($value, $validValues, $default)
{
if (! in_array( $value, $validValues )) {
$value = $default;
}
return $value;
}
}
// Route

View File

@@ -1,200 +1,193 @@
<?php
/**
* Stage.php
* @package workflow.engine.classes.model
*/
require_once 'classes/model/Content.php';
require_once 'classes/model/om/BaseStage.php';
/**
* Skeleton subclass for representing a row from the 'STAGE' 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 Stage extends BaseStage {
/**
* This value goes in the content table
* @var string
*/
protected $stg_title = '';
/**
* Get the stg_title column value.
* @return string
*/
public function getStgTitle() {
if ( $this->getStgUid() == "" ) {
throw ( new Exception( "Error in getStgTitle, the getStgUid() can't be blank") );
}
$lang = defined ( 'SYS_LANG' ) ? SYS_LANG : 'en';
$this->stg_title = Content::load ( 'STG_TITLE', '', $this->getStgUid(), $lang );
return $this->stg_title;
}
/**
* Set the stg_title column value.
*
* @param string $v new value
* @return void
*/
public function setStgTitle($v)
{
if ( $this->getStgUid() == "" ) {
throw ( new Exception( "Error in setStgTitle, the setStgUid() can't be blank") );
}
$v=isset($v)?((string)$v):'';
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
if ($this->stg_title !== $v || $v==="") {
$this->stg_title = $v;
$res = Content::addContent( 'STG_TITLE', '', $this->getStgUid(), $lang, $this->stg_title );
return $res;
}
return 0;
}
public function load($StgUid)
{
try {
$oRow = StagePeer::retrieveByPK( $StgUid );
if (!is_null($oRow))
{
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
$this->setNew(false);
$this->setStgTitle($aFields['STG_TITLE'] = $this->getStgTitle());
return $aFields;
}
else {
throw( new Exception( "The row '$StgUid' in table Stage doesn't exist!" ));
}
}
catch (Exception $oError) {
throw($oError);
}
}
public function create($aData) {
$oConnection = Propel::getConnection(StagePeer::DATABASE_NAME);
try {
if ( isset ( $aData['STG_UID'] ) && $aData['STG_UID']== '' )
unset ( $aData['STG_UID'] );
if ( !isset ( $aData['STG_UID'] ) )
$aData['STG_UID'] = G::generateUniqueID();
$oStage = new Stage();
$oStage->fromArray($aData, BasePeer::TYPE_FIELDNAME);
$oStage->setStgTitle($aData['STG_TITLE']);
if ($oStage->validate()) {
$oConnection->begin();
$iResult = $oStage->save();
$oConnection->commit();
return $aData['STG_UID'];
}
else {
$sMessage = '';
$aValidationFailures = $oStage->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($fields)
{
$con = Propel::getConnection(StagePeer::DATABASE_NAME);
try
{
$con->begin();
$this->load($fields['STG_UID']);
$this->fromArray($fields, BasePeer::TYPE_FIELDNAME);
if($this->validate())
{
$contentResult=0;
if (array_key_exists("STG_TITLE", $fields)) $contentResult+=$this->setStgTitle($fields["STG_TITLE"]);
$result=$this->save();
$result=($result==0)?($contentResult>0?1:0):$result;
$con->commit();
return $result;
}
else
{
$con->rollback();
$validationE=new Exception("Failed Validation in class ".get_class($this).".");
$validationE->aValidationFailures = $this->getValidationFailures();
throw($validationE);
}
}
catch(Exception $e)
{
$con->rollback();
throw($e);
}
}
public function remove($StgUid)
{
$con = Propel::getConnection(StagePeer::DATABASE_NAME);
try
{
$con->begin();
$oStage = StagePeer::retrieveByPK( $StgUid );
if (!is_null($oStage)) {
Content::removeContent( 'STG_TITLE', '', $this->getStgUid());
$result = $oStage->delete();
$con->commit();
}
return $result;
}
catch(Exception $e)
{
$con->rollback();
throw($e);
}
}
function reorderPositions($sProcessUID, $iIndex) {
try {
$oCriteria = new Criteria('workflow');
$oCriteria->add(StagePeer::PRO_UID, $sProcessUID);
$oCriteria->add(StagePeer::STG_INDEX, $iIndex, '>');
$oDataset = StagePeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$this->update(array('STG_UID' => $aRow['STG_UID'],
'PRO_UID' => $aRow['PRO_UID'],
'STG_POSX' => $aRow['STG_POSX'],
'STG_POSY' => $aRow['STG_POSY'],
'STG_INDEX' => $aRow['STG_INDEX'] - 1));
$oDataset->next();
}
}
catch (Exception $oException) {
throw $Exception;
}
}
function Exists ( $sUid ) {
try {
$oObj = StagePeer::retrieveByPk($sUid);
return (is_object($oObj) && get_class($oObj) == 'Stage');
}
catch (Exception $oError) {
throw($oError);
}
}
} // Stage
<?php
/**
* Stage.php
*
* @package workflow.engine.classes.model
*/
require_once 'classes/model/Content.php';
require_once 'classes/model/om/BaseStage.php';
/**
* Skeleton subclass for representing a row from the 'STAGE' 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 Stage extends BaseStage
{
/**
* This value goes in the content table
*
* @var string
*/
protected $stg_title = '';
/**
* Get the stg_title column value.
*
* @return string
*/
public function getStgTitle ()
{
if ($this->getStgUid() == "") {
throw (new Exception( "Error in getStgTitle, the getStgUid() can't be blank" ));
}
$lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
$this->stg_title = Content::load( 'STG_TITLE', '', $this->getStgUid(), $lang );
return $this->stg_title;
}
/**
* Set the stg_title column value.
*
* @param string $v new value
* @return void
*/
public function setStgTitle ($v)
{
if ($this->getStgUid() == "") {
throw (new Exception( "Error in setStgTitle, the setStgUid() can't be blank" ));
}
$v = isset( $v ) ? ((string) $v) : '';
$lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
if ($this->stg_title !== $v || $v === "") {
$this->stg_title = $v;
$res = Content::addContent( 'STG_TITLE', '', $this->getStgUid(), $lang, $this->stg_title );
return $res;
}
return 0;
}
public function load ($StgUid)
{
try {
$oRow = StagePeer::retrieveByPK( $StgUid );
if (! is_null( $oRow )) {
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
$this->setNew( false );
$this->setStgTitle( $aFields['STG_TITLE'] = $this->getStgTitle() );
return $aFields;
} else {
throw (new Exception( "The row '$StgUid' in table Stage doesn't exist!" ));
}
} catch (Exception $oError) {
throw ($oError);
}
}
public function create ($aData)
{
$oConnection = Propel::getConnection( StagePeer::DATABASE_NAME );
try {
if (isset( $aData['STG_UID'] ) && $aData['STG_UID'] == '') {
unset( $aData['STG_UID'] );
}
if (! isset( $aData['STG_UID'] )) {
$aData['STG_UID'] = G::generateUniqueID();
}
$oStage = new Stage();
$oStage->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
$oStage->setStgTitle( $aData['STG_TITLE'] );
if ($oStage->validate()) {
$oConnection->begin();
$iResult = $oStage->save();
$oConnection->commit();
return $aData['STG_UID'];
} else {
$sMessage = '';
$aValidationFailures = $oStage->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 ($fields)
{
$con = Propel::getConnection( StagePeer::DATABASE_NAME );
try {
$con->begin();
$this->load( $fields['STG_UID'] );
$this->fromArray( $fields, BasePeer::TYPE_FIELDNAME );
if ($this->validate()) {
$contentResult = 0;
if (array_key_exists( "STG_TITLE", $fields )) {
$contentResult += $this->setStgTitle( $fields["STG_TITLE"] );
}
$result = $this->save();
$result = ($result == 0) ? ($contentResult > 0 ? 1 : 0) : $result;
$con->commit();
return $result;
} else {
$con->rollback();
$validationE = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
$validationE->aValidationFailures = $this->getValidationFailures();
throw ($validationE);
}
} catch (Exception $e) {
$con->rollback();
throw ($e);
}
}
public function remove ($StgUid)
{
$con = Propel::getConnection( StagePeer::DATABASE_NAME );
try {
$con->begin();
$oStage = StagePeer::retrieveByPK( $StgUid );
if (! is_null( $oStage )) {
Content::removeContent( 'STG_TITLE', '', $this->getStgUid() );
$result = $oStage->delete();
$con->commit();
}
return $result;
} catch (Exception $e) {
$con->rollback();
throw ($e);
}
}
public function reorderPositions ($sProcessUID, $iIndex)
{
try {
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( StagePeer::PRO_UID, $sProcessUID );
$oCriteria->add( StagePeer::STG_INDEX, $iIndex, '>' );
$oDataset = StagePeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$this->update( array ('STG_UID' => $aRow['STG_UID'],'PRO_UID' => $aRow['PRO_UID'],'STG_POSX' => $aRow['STG_POSX'],'STG_POSY' => $aRow['STG_POSY'],'STG_INDEX' => $aRow['STG_INDEX'] - 1
) );
$oDataset->next();
}
} catch (Exception $oException) {
throw $Exception;
}
}
public function Exists ($sUid)
{
try {
$oObj = StagePeer::retrieveByPk( $sUid );
return (is_object( $oObj ) && get_class( $oObj ) == 'Stage');
} catch (Exception $oError) {
throw ($oError);
}
}
}
// Stage

View File

@@ -1,230 +1,229 @@
<?php
/**
* StepSupervisor.php
* @package workflow.engine.classes.model
*/
require_once 'classes/model/om/BaseStepSupervisor.php';
/**
* Skeleton subclass for representing a row from the 'STEP_SUPERVISOR' 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 StepSupervisor extends BaseStepSupervisor {
public function load($Uid)
{
try {
$oRow = StepSupervisorPeer::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 StepSupervisor doesn't exist!" ));
}
}
catch (Exception $oError) {
throw($oError);
}
}
function Exists ( $Uid ) {
try {
$oPro = StepSupervisorPeer::retrieveByPk( $Uid );
if (is_object($oPro) && get_class ($oPro) == 'StepSupervisor' ) {
return true;
}
else {
return false;
}
}
catch (Exception $oError) {
throw($oError);
}
}
/**
* Create the step supervisor registry
* @param array $aData
* @return boolean
**/
public function create($aData)
{
$oConnection = Propel::getConnection(StepSupervisorPeer::DATABASE_NAME);
try {
if ( isset ( $aData['STEP_UID'] ) && $aData['STEP_UID']== '' )
unset ( $aData['STEP_UID'] );
if ( !isset ( $aData['STEP_UID'] ) )
$aData['STEP_UID'] = G::generateUniqueID();
$oStepSupervisor = new StepSupervisor();
$oStepSupervisor->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oStepSupervisor->validate()) {
$oConnection->begin();
$iResult = $oStepSupervisor->save();
$oConnection->commit();
return true;
}
else {
$sMessage = '';
$aValidationFailures = $oStepSupervisor->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);
}
}
/**
* Update the step supervisor registry
* @param array $aData
* @return integer
**/
public function update($aData)
{
$oConnection = Propel::getConnection(StepSupervisorPeer::DATABASE_NAME);
try {
$oStepSupervisor = StepSupervisorPeer::retrieveByPK($aData['STEP_UID']);
if (!is_null($oStepSupervisor))
{
$oStepSupervisor->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oStepSupervisor->validate()) {
$oConnection->begin();
$iResult = $oStepSupervisor->save();
$oConnection->commit();
return $iResult;
}
else {
$sMessage = '';
$aValidationFailures = $oStepSupervisor->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);
}
}
/**
* Remove the step supervisor registry
* @param string $sStepUID
* @return integer
**/
public function remove($sStepUID)
{
$oConnection = Propel::getConnection(StepSupervisorPeer::DATABASE_NAME);
try {
$oConnection->begin();
$this->setStepUid($sStepUID);
$iResult = $this->delete();
$oConnection->commit();
return $iResult;
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
/**
* Get the next position for a atep
* @param string $sProcessUID
* @return integer
**/
function getNextPosition($sProcessUID, $sType) {
try {
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn('(COUNT(*) + 1) AS POSITION');
$oCriteria->add(StepSupervisorPeer::PRO_UID, $sProcessUID);
$oCriteria->add(StepSupervisorPeer::STEP_TYPE_OBJ, $sType);
$oDataset = StepSupervisorPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
return (int)$aRow['POSITION'];
}
catch (Exception $oException) {
throw $Exception;
}
}
/**
* Reorder the steps positions
* @param string $sProcessUID
* @param string $iPosition
**/
function reorderPositions($sProcessUID, $iPosition, $sType) {
try {
$oCriteria = new Criteria('workflow');
$oCriteria->add(StepSupervisorPeer::PRO_UID, $sProcessUID);
$oCriteria->add(StepSupervisorPeer::STEP_TYPE_OBJ, $sType);
$oCriteria->add(StepSupervisorPeer::STEP_POSITION, $iPosition, '>');
$oDataset = StepSupervisorPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();var_dump(StepSupervisorPeer::doCount($oCriteria));
while ($aRow = $oDataset->getRow()) {var_dump($aRow);echo "\n";
$this->update(array('STEP_UID' => $aRow['STEP_UID'],
'PRO_UID' => $aRow['PRO_UID'],
'STEP_TYPE_OBJ' => $aRow['STEP_TYPE_OBJ'],
'STEP_UID_OBJ' => $aRow['STEP_UID_OBJ'],
'STEP_POSITION' => $aRow['STEP_POSITION'] - 1));
$oDataset->next();
}
}
catch (Exception $oException) {
throw $Exception;
}
}
function removeByObject($sType, $sObjUid) {
try {
$oCriteria = new Criteria('workflow');
$oCriteria->add(StepSupervisorPeer::STEP_TYPE_OBJ, $sType);
$oCriteria->add(StepSupervisorPeer::STEP_UID_OBJ, $sObjUid);
StepSupervisorPeer::doDelete($oCriteria);
}
catch(Exception $e) {
throw($e);
}
}
function loadInfo($sObjUID){
$oCriteria = new Criteria('workflow');
$oCriteria->add(StepSupervisorPeer::STEP_UID_OBJ, $sObjUID);
$oDataset = StepSupervisorPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
return($aRow);
}
} // StepSupervisor
<?php
/**
* StepSupervisor.php
*
* @package workflow.engine.classes.model
*/
require_once 'classes/model/om/BaseStepSupervisor.php';
/**
* Skeleton subclass for representing a row from the 'STEP_SUPERVISOR' 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 StepSupervisor extends BaseStepSupervisor
{
public function load ($Uid)
{
try {
$oRow = StepSupervisorPeer::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 StepSupervisor doesn't exist!" ));
}
} catch (Exception $oError) {
throw ($oError);
}
}
public function Exists ($Uid)
{
try {
$oPro = StepSupervisorPeer::retrieveByPk( $Uid );
if (is_object( $oPro ) && get_class( $oPro ) == 'StepSupervisor') {
return true;
} else {
return false;
}
} catch (Exception $oError) {
throw ($oError);
}
}
/**
* Create the step supervisor registry
*
* @param array $aData
* @return boolean
*
*/
public function create ($aData)
{
$oConnection = Propel::getConnection( StepSupervisorPeer::DATABASE_NAME );
try {
if (isset( $aData['STEP_UID'] ) && $aData['STEP_UID'] == '') {
unset( $aData['STEP_UID'] );
}
if (! isset( $aData['STEP_UID'] )) {
$aData['STEP_UID'] = G::generateUniqueID();
}
$oStepSupervisor = new StepSupervisor();
$oStepSupervisor->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oStepSupervisor->validate()) {
$oConnection->begin();
$iResult = $oStepSupervisor->save();
$oConnection->commit();
return true;
} else {
$sMessage = '';
$aValidationFailures = $oStepSupervisor->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);
}
}
/**
* Update the step supervisor registry
*
* @param array $aData
* @return integer
*
*/
public function update ($aData)
{
$oConnection = Propel::getConnection( StepSupervisorPeer::DATABASE_NAME );
try {
$oStepSupervisor = StepSupervisorPeer::retrieveByPK( $aData['STEP_UID'] );
if (! is_null( $oStepSupervisor )) {
$oStepSupervisor->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oStepSupervisor->validate()) {
$oConnection->begin();
$iResult = $oStepSupervisor->save();
$oConnection->commit();
return $iResult;
} else {
$sMessage = '';
$aValidationFailures = $oStepSupervisor->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);
}
}
/**
* Remove the step supervisor registry
*
* @param string $sStepUID
* @return integer
*
*/
public function remove ($sStepUID)
{
$oConnection = Propel::getConnection( StepSupervisorPeer::DATABASE_NAME );
try {
$oConnection->begin();
$this->setStepUid( $sStepUID );
$iResult = $this->delete();
$oConnection->commit();
return $iResult;
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
/**
* Get the next position for a atep
*
* @param string $sProcessUID
* @return integer
*
*/
public function getNextPosition ($sProcessUID, $sType)
{
try {
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( '(COUNT(*) + 1) AS POSITION' );
$oCriteria->add( StepSupervisorPeer::PRO_UID, $sProcessUID );
$oCriteria->add( StepSupervisorPeer::STEP_TYPE_OBJ, $sType );
$oDataset = StepSupervisorPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aRow = $oDataset->getRow();
return (int) $aRow['POSITION'];
} catch (Exception $oException) {
throw $Exception;
}
}
/**
* Reorder the steps positions
*
* @param string $sProcessUID
* @param string $iPosition
*
*/
public function reorderPositions ($sProcessUID, $iPosition, $sType)
{
try {
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( StepSupervisorPeer::PRO_UID, $sProcessUID );
$oCriteria->add( StepSupervisorPeer::STEP_TYPE_OBJ, $sType );
$oCriteria->add( StepSupervisorPeer::STEP_POSITION, $iPosition, '>' );
$oDataset = StepSupervisorPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
var_dump( StepSupervisorPeer::doCount( $oCriteria ) );
while ($aRow = $oDataset->getRow()) {
var_dump( $aRow );
echo "\n";
$this->update( array ('STEP_UID' => $aRow['STEP_UID'],'PRO_UID' => $aRow['PRO_UID'],'STEP_TYPE_OBJ' => $aRow['STEP_TYPE_OBJ'],'STEP_UID_OBJ' => $aRow['STEP_UID_OBJ'],'STEP_POSITION' => $aRow['STEP_POSITION'] - 1
) );
$oDataset->next();
}
} catch (Exception $oException) {
throw $Exception;
}
}
public function removeByObject ($sType, $sObjUid)
{
try {
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( StepSupervisorPeer::STEP_TYPE_OBJ, $sType );
$oCriteria->add( StepSupervisorPeer::STEP_UID_OBJ, $sObjUid );
StepSupervisorPeer::doDelete( $oCriteria );
} catch (Exception $e) {
throw ($e);
}
}
public function loadInfo ($sObjUID)
{
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( StepSupervisorPeer::STEP_UID_OBJ, $sObjUID );
$oDataset = StepSupervisorPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aRow = $oDataset->getRow();
return ($aRow);
}
}
// StepSupervisor