CODE STYLE some classes in classes/model
This commit is contained in:
@@ -775,5 +775,4 @@ class Task extends BaseTask
|
||||
return $event_uid;
|
||||
}
|
||||
}
|
||||
//Task
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
/**
|
||||
* TaskPeer.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 'TASK' 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 TaskPeer extends BaseTaskPeer {
|
||||
class TaskPeer extends BaseTaskPeer
|
||||
{
|
||||
}
|
||||
|
||||
} // TaskPeer
|
||||
|
||||
@@ -1,198 +1,197 @@
|
||||
<?php
|
||||
/**
|
||||
* TaskUser.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/BaseTaskUser.php';
|
||||
require_once 'classes/model/Content.php';
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'GROUP_USER' 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 input directory.
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
class TaskUser extends BaseTaskUser
|
||||
{
|
||||
|
||||
/**
|
||||
* Create the application document registry
|
||||
*
|
||||
* @param array $aData
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function create ($aData)
|
||||
{
|
||||
$oConnection = Propel::getConnection( TaskUserPeer::DATABASE_NAME );
|
||||
try {
|
||||
$taskUser = TaskUserPeer::retrieveByPK( $aData['TAS_UID'], $aData['USR_UID'], $aData['TU_TYPE'], $aData['TU_RELATION'] );
|
||||
|
||||
if (is_object( $taskUser )) {
|
||||
return - 1;
|
||||
}
|
||||
$oTaskUser = new TaskUser();
|
||||
$oTaskUser->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||
if ($oTaskUser->validate()) {
|
||||
$oConnection->begin();
|
||||
$iResult = $oTaskUser->save();
|
||||
$oConnection->commit();
|
||||
return $iResult;
|
||||
} else {
|
||||
$sMessage = '';
|
||||
$aValidationFailures = $oTaskUser->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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the application document registry
|
||||
*
|
||||
* @param string $sTasUid
|
||||
* @param string $sUserUid
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function remove ($sTasUid, $sUserUid, $iType, $iRelation)
|
||||
{
|
||||
$oConnection = Propel::getConnection( TaskUserPeer::DATABASE_NAME );
|
||||
try {
|
||||
$oTaskUser = TaskUserPeer::retrieveByPK( $sTasUid, $sUserUid, $iType, $iRelation );
|
||||
if (! is_null( $oTaskUser )) {
|
||||
$oConnection->begin();
|
||||
$iResult = $oTaskUser->delete();
|
||||
$oConnection->commit();
|
||||
return $iResult;
|
||||
} else {
|
||||
throw (new Exception( 'This row does not exist!' ));
|
||||
}
|
||||
} catch (Exception $oError) {
|
||||
$oConnection->rollback();
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
public function TaskUserExists ($sTasUid, $sUserUid, $iType, $iRelation)
|
||||
{
|
||||
$con = Propel::getConnection( TaskUserPeer::DATABASE_NAME );
|
||||
try {
|
||||
$oTaskUser = TaskUserPeer::retrieveByPk( $sTasUid, $sUserUid, $iType, $iRelation );
|
||||
if (is_object( $oTaskUser ) && get_class( $oTaskUser ) == 'TaskUser') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
public function getCountAllTaksByGroups ()
|
||||
{
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addAsColumn( 'GRP_UID', TaskUserPeer::USR_UID );
|
||||
$oCriteria->addSelectColumn( 'COUNT(*) AS CNT' );
|
||||
$oCriteria->add( TaskUserPeer::TU_TYPE, 1 );
|
||||
$oCriteria->add( TaskUserPeer::TU_RELATION, 2 );
|
||||
$oCriteria->addGroupByColumn( TaskUserPeer::USR_UID );
|
||||
$oDataset = TaskUserPeer::doSelectRS( $oCriteria );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$aRows = Array ();
|
||||
while ($oDataset->next()) {
|
||||
$row = $oDataset->getRow();
|
||||
$aRows[$row['GRP_UID']] = $row['CNT'];
|
||||
}
|
||||
return $aRows;
|
||||
}
|
||||
//erik: new functions
|
||||
public function getUsersTask ($TAS_UID, $TU_TYPE = 1)
|
||||
{
|
||||
require_once 'classes/model/Users.php';
|
||||
|
||||
$groupsTask = array ();
|
||||
$usersTask = array ();
|
||||
|
||||
<?php
|
||||
/**
|
||||
* TaskUser.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/BaseTaskUser.php';
|
||||
require_once 'classes/model/Content.php';
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'GROUP_USER' 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 input directory.
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
class TaskUser extends BaseTaskUser
|
||||
{
|
||||
|
||||
/**
|
||||
* Create the application document registry
|
||||
*
|
||||
* @param array $aData
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function create ($aData)
|
||||
{
|
||||
$oConnection = Propel::getConnection( TaskUserPeer::DATABASE_NAME );
|
||||
try {
|
||||
$taskUser = TaskUserPeer::retrieveByPK( $aData['TAS_UID'], $aData['USR_UID'], $aData['TU_TYPE'], $aData['TU_RELATION'] );
|
||||
|
||||
if (is_object( $taskUser )) {
|
||||
return - 1;
|
||||
}
|
||||
$oTaskUser = new TaskUser();
|
||||
$oTaskUser->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||
if ($oTaskUser->validate()) {
|
||||
$oConnection->begin();
|
||||
$iResult = $oTaskUser->save();
|
||||
$oConnection->commit();
|
||||
return $iResult;
|
||||
} else {
|
||||
$sMessage = '';
|
||||
$aValidationFailures = $oTaskUser->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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the application document registry
|
||||
*
|
||||
* @param string $sTasUid
|
||||
* @param string $sUserUid
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function remove ($sTasUid, $sUserUid, $iType, $iRelation)
|
||||
{
|
||||
$oConnection = Propel::getConnection( TaskUserPeer::DATABASE_NAME );
|
||||
try {
|
||||
$oTaskUser = TaskUserPeer::retrieveByPK( $sTasUid, $sUserUid, $iType, $iRelation );
|
||||
if (! is_null( $oTaskUser )) {
|
||||
$oConnection->begin();
|
||||
$iResult = $oTaskUser->delete();
|
||||
$oConnection->commit();
|
||||
return $iResult;
|
||||
} else {
|
||||
throw (new Exception( 'This row does not exist!' ));
|
||||
}
|
||||
} catch (Exception $oError) {
|
||||
$oConnection->rollback();
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
public function TaskUserExists ($sTasUid, $sUserUid, $iType, $iRelation)
|
||||
{
|
||||
$con = Propel::getConnection( TaskUserPeer::DATABASE_NAME );
|
||||
try {
|
||||
$oTaskUser = TaskUserPeer::retrieveByPk( $sTasUid, $sUserUid, $iType, $iRelation );
|
||||
if (is_object( $oTaskUser ) && get_class( $oTaskUser ) == 'TaskUser') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
public function getCountAllTaksByGroups ()
|
||||
{
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addAsColumn( 'GRP_UID', TaskUserPeer::USR_UID );
|
||||
$oCriteria->addSelectColumn( 'COUNT(*) AS CNT' );
|
||||
$oCriteria->add( TaskUserPeer::TU_TYPE, 1 );
|
||||
$oCriteria->add( TaskUserPeer::TU_RELATION, 2 );
|
||||
$oCriteria->addGroupByColumn( TaskUserPeer::USR_UID );
|
||||
$oDataset = TaskUserPeer::doSelectRS( $oCriteria );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$aRows = Array ();
|
||||
while ($oDataset->next()) {
|
||||
$row = $oDataset->getRow();
|
||||
$aRows[$row['GRP_UID']] = $row['CNT'];
|
||||
}
|
||||
return $aRows;
|
||||
}
|
||||
//erik: new functions
|
||||
public function getUsersTask ($TAS_UID, $TU_TYPE = 1)
|
||||
{
|
||||
require_once 'classes/model/Users.php';
|
||||
|
||||
$groupsTask = array ();
|
||||
$usersTask = array ();
|
||||
|
||||
//getting task's users
|
||||
$criteria = new Criteria( 'workflow' );
|
||||
$criteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
|
||||
$criteria->addSelectColumn( UsersPeer::USR_LASTNAME );
|
||||
$criteria->addSelectColumn( UsersPeer::USR_USERNAME );
|
||||
$criteria->addSelectColumn( TaskUserPeer::TAS_UID );
|
||||
$criteria->addSelectColumn( TaskUserPeer::USR_UID );
|
||||
$criteria->addSelectColumn( TaskUserPeer::TU_TYPE );
|
||||
$criteria->addSelectColumn( TaskUserPeer::TU_RELATION );
|
||||
$criteria->addJoin( TaskUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN );
|
||||
$criteria->add( TaskUserPeer::TAS_UID, $TAS_UID );
|
||||
$criteria->add( TaskUserPeer::TU_TYPE, $TU_TYPE );
|
||||
$criteria->add( TaskUserPeer::TU_RELATION, 1 );
|
||||
|
||||
$dataset = TaskUserPeer::doSelectRS( $criteria );
|
||||
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
|
||||
while ($dataset->next()) {
|
||||
$usersTask[] = $dataset->getRow();
|
||||
}
|
||||
$criteria = new Criteria( 'workflow' );
|
||||
$criteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
|
||||
$criteria->addSelectColumn( UsersPeer::USR_LASTNAME );
|
||||
$criteria->addSelectColumn( UsersPeer::USR_USERNAME );
|
||||
$criteria->addSelectColumn( TaskUserPeer::TAS_UID );
|
||||
$criteria->addSelectColumn( TaskUserPeer::USR_UID );
|
||||
$criteria->addSelectColumn( TaskUserPeer::TU_TYPE );
|
||||
$criteria->addSelectColumn( TaskUserPeer::TU_RELATION );
|
||||
$criteria->addJoin( TaskUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN );
|
||||
$criteria->add( TaskUserPeer::TAS_UID, $TAS_UID );
|
||||
$criteria->add( TaskUserPeer::TU_TYPE, $TU_TYPE );
|
||||
$criteria->add( TaskUserPeer::TU_RELATION, 1 );
|
||||
|
||||
$dataset = TaskUserPeer::doSelectRS( $criteria );
|
||||
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
|
||||
while ($dataset->next()) {
|
||||
$usersTask[] = $dataset->getRow();
|
||||
}
|
||||
//getting task's groups
|
||||
$delimiter = DBAdapter::getStringDelimiter();
|
||||
$criteria = new Criteria( 'workflow' );
|
||||
$criteria->addAsColumn( 'GRP_TITLE', 'CONTENT.CON_VALUE' );
|
||||
$criteria->addSelectColumn( TaskUserPeer::TAS_UID );
|
||||
$criteria->addSelectColumn( TaskUserPeer::USR_UID );
|
||||
$criteria->addSelectColumn( TaskUserPeer::TU_TYPE );
|
||||
$criteria->addSelectColumn( TaskUserPeer::TU_RELATION );
|
||||
$aConditions[] = array (TaskUserPeer::USR_UID,'CONTENT.CON_ID');
|
||||
$aConditions[] = array ('CONTENT.CON_CATEGORY',$delimiter . 'GRP_TITLE' . $delimiter);
|
||||
$aConditions[] = array ('CONTENT.CON_LANG',$delimiter . SYS_LANG . $delimiter);
|
||||
$criteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
|
||||
$criteria->add( TaskUserPeer::TAS_UID, $TAS_UID );
|
||||
$criteria->add( TaskUserPeer::TU_TYPE, $TU_TYPE );
|
||||
$criteria->add( TaskUserPeer::TU_RELATION, 2 );
|
||||
$dataset = TaskUserPeer::doSelectRS( $criteria );
|
||||
$dataset = TaskUserPeer::doSelectRS( $criteria );
|
||||
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
|
||||
while ($dataset->next()) {
|
||||
$usersTask[] = $dataset->getRow();
|
||||
}
|
||||
$result->data = $usersTask;
|
||||
$result->totalCount = sizeof( $usersTask );
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
// TaskUser
|
||||
|
||||
$delimiter = DBAdapter::getStringDelimiter();
|
||||
$criteria = new Criteria( 'workflow' );
|
||||
$criteria->addAsColumn( 'GRP_TITLE', 'CONTENT.CON_VALUE' );
|
||||
$criteria->addSelectColumn( TaskUserPeer::TAS_UID );
|
||||
$criteria->addSelectColumn( TaskUserPeer::USR_UID );
|
||||
$criteria->addSelectColumn( TaskUserPeer::TU_TYPE );
|
||||
$criteria->addSelectColumn( TaskUserPeer::TU_RELATION );
|
||||
$aConditions[] = array (TaskUserPeer::USR_UID,'CONTENT.CON_ID');
|
||||
$aConditions[] = array ('CONTENT.CON_CATEGORY',$delimiter . 'GRP_TITLE' . $delimiter);
|
||||
$aConditions[] = array ('CONTENT.CON_LANG',$delimiter . SYS_LANG . $delimiter);
|
||||
$criteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
|
||||
$criteria->add( TaskUserPeer::TAS_UID, $TAS_UID );
|
||||
$criteria->add( TaskUserPeer::TU_TYPE, $TU_TYPE );
|
||||
$criteria->add( TaskUserPeer::TU_RELATION, 2 );
|
||||
$dataset = TaskUserPeer::doSelectRS( $criteria );
|
||||
$dataset = TaskUserPeer::doSelectRS( $criteria );
|
||||
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
|
||||
while ($dataset->next()) {
|
||||
$usersTask[] = $dataset->getRow();
|
||||
}
|
||||
$result->data = $usersTask;
|
||||
$result->totalCount = sizeof( $usersTask );
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
/**
|
||||
* TaskUserPeer.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 'TASK_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 TaskUserPeer extends BaseTaskUserPeer {
|
||||
class TaskUserPeer extends BaseTaskUserPeer
|
||||
{
|
||||
}
|
||||
|
||||
} // TaskUserPeer
|
||||
|
||||
@@ -1,455 +1,465 @@
|
||||
<?php
|
||||
/**
|
||||
* Translation.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/BaseTranslation.php';
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'TRANSLATION' 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 Translation extends BaseTranslation
|
||||
{
|
||||
|
||||
public static $meta;
|
||||
public static $localeSeparator = '-';
|
||||
|
||||
private $envFilePath;
|
||||
|
||||
public function __construct ()
|
||||
{
|
||||
$this->envFilePath = PATH_DATA . "META-INF" . PATH_SEP . "translations.env";
|
||||
}
|
||||
|
||||
public function getAllCriteria ()
|
||||
{
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Translation.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/BaseTranslation.php';
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'TRANSLATION' 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 Translation extends BaseTranslation
|
||||
{
|
||||
|
||||
public static $meta;
|
||||
public static $localeSeparator = '-';
|
||||
|
||||
private $envFilePath;
|
||||
|
||||
public function __construct ()
|
||||
{
|
||||
$this->envFilePath = PATH_DATA . "META-INF" . PATH_SEP . "translations.env";
|
||||
}
|
||||
|
||||
public function getAllCriteria ()
|
||||
{
|
||||
|
||||
//SELECT * from TRANSLATION WHERE TRN_LANG = 'en' order by TRN_CATEGORY, TRN_ID
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( TranslationPeer::TRN_ID );
|
||||
$oCriteria->addSelectColumn( TranslationPeer::TRN_CATEGORY );
|
||||
$oCriteria->addSelectColumn( TranslationPeer::TRN_LANG );
|
||||
$oCriteria->addSelectColumn( TranslationPeer::TRN_VALUE );
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( TranslationPeer::TRN_ID );
|
||||
$oCriteria->addSelectColumn( TranslationPeer::TRN_CATEGORY );
|
||||
$oCriteria->addSelectColumn( TranslationPeer::TRN_LANG );
|
||||
$oCriteria->addSelectColumn( TranslationPeer::TRN_VALUE );
|
||||
//$c->add(TranslationPeer::TRN_LANG, 'en');
|
||||
|
||||
|
||||
return $oCriteria;
|
||||
}
|
||||
|
||||
public function getAll ($lang = 'en', $start = null, $limit = null, $search = null, $dateFrom = null, $dateTo = null)
|
||||
{
|
||||
$totalCount = 0;
|
||||
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( TranslationPeer::TRN_ID );
|
||||
$oCriteria->addSelectColumn( TranslationPeer::TRN_CATEGORY );
|
||||
$oCriteria->addSelectColumn( TranslationPeer::TRN_LANG );
|
||||
$oCriteria->addSelectColumn( TranslationPeer::TRN_VALUE );
|
||||
$oCriteria->addSelectColumn( TranslationPeer::TRN_UPDATE_DATE );
|
||||
$oCriteria->add( TranslationPeer::TRN_LANG, $lang );
|
||||
$oCriteria->add( TranslationPeer::TRN_CATEGORY, 'LABEL' );
|
||||
|
||||
|
||||
return $oCriteria;
|
||||
}
|
||||
|
||||
public function getAll ($lang = 'en', $start = null, $limit = null, $search = null, $dateFrom = null, $dateTo = null)
|
||||
{
|
||||
$totalCount = 0;
|
||||
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( TranslationPeer::TRN_ID );
|
||||
$oCriteria->addSelectColumn( TranslationPeer::TRN_CATEGORY );
|
||||
$oCriteria->addSelectColumn( TranslationPeer::TRN_LANG );
|
||||
$oCriteria->addSelectColumn( TranslationPeer::TRN_VALUE );
|
||||
$oCriteria->addSelectColumn( TranslationPeer::TRN_UPDATE_DATE );
|
||||
$oCriteria->add( TranslationPeer::TRN_LANG, $lang );
|
||||
$oCriteria->add( TranslationPeer::TRN_CATEGORY, 'LABEL' );
|
||||
//$oCriteria->addAscendingOrderByColumn ( 'TRN_CATEGORY' );
|
||||
$oCriteria->addAscendingOrderByColumn( 'TRN_ID' );
|
||||
|
||||
if ($search) {
|
||||
$oCriteria->add( $oCriteria->getNewCriterion( TranslationPeer::TRN_ID, "%$search%", Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( TranslationPeer::TRN_VALUE, "%$search%", Criteria::LIKE ) ) );
|
||||
}
|
||||
$oCriteria->addAscendingOrderByColumn( 'TRN_ID' );
|
||||
|
||||
if ($search) {
|
||||
$oCriteria->add( $oCriteria->getNewCriterion( TranslationPeer::TRN_ID, "%$search%", Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( TranslationPeer::TRN_VALUE, "%$search%", Criteria::LIKE ) ) );
|
||||
}
|
||||
// for date filter
|
||||
if (($dateFrom) && ($dateTo)) {
|
||||
$oCriteria->add( $oCriteria->getNewCriterion( TranslationPeer::TRN_UPDATE_DATE, "$dateFrom", Criteria::GREATER_EQUAL ) //LESS_EQUAL
|
||||
->addAnd( $oCriteria->getNewCriterion( TranslationPeer::TRN_UPDATE_DATE, "$dateTo", Criteria::LESS_EQUAL ) //GREATER_EQUAL
|
||||
) );
|
||||
}
|
||||
if (($dateFrom) && ($dateTo)) {
|
||||
$oCriteria->add(
|
||||
$oCriteria->getNewCriterion(
|
||||
TranslationPeer::TRN_UPDATE_DATE,
|
||||
"$dateFrom",
|
||||
Criteria::GREATER_EQUAL
|
||||
)->addAnd(
|
||||
$oCriteria->getNewCriterion(
|
||||
TranslationPeer::TRN_UPDATE_DATE,
|
||||
"$dateTo",
|
||||
Criteria::LESS_EQUAL
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
// end filter
|
||||
$c = clone $oCriteria;
|
||||
$c->clearSelectColumns();
|
||||
$c->addSelectColumn( 'COUNT(*)' );
|
||||
$oDataset = TranslationPeer::doSelectRS( $c );
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
if (is_array( $aRow )) {
|
||||
$totalCount = $aRow[0];
|
||||
}
|
||||
if ($start) {
|
||||
$oCriteria->setOffset( $start );
|
||||
}
|
||||
if ($limit) {
|
||||
$c = clone $oCriteria;
|
||||
$c->clearSelectColumns();
|
||||
$c->addSelectColumn( 'COUNT(*)' );
|
||||
$oDataset = TranslationPeer::doSelectRS( $c );
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
if (is_array( $aRow )) {
|
||||
$totalCount = $aRow[0];
|
||||
}
|
||||
if ($start) {
|
||||
$oCriteria->setOffset( $start );
|
||||
}
|
||||
if ($limit) {
|
||||
//&& !isset($seach) && !isset($search))
|
||||
$oCriteria->setLimit( $limit );
|
||||
}
|
||||
$rs = TranslationPeer::doSelectRS( $oCriteria );
|
||||
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$rows = Array ();
|
||||
while ($rs->next()) {
|
||||
$rows[] = $rs->getRow();
|
||||
}
|
||||
|
||||
$result->data = $rows;
|
||||
$result->totalCount = $totalCount;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
$oCriteria->setLimit( $limit );
|
||||
}
|
||||
$rs = TranslationPeer::doSelectRS( $oCriteria );
|
||||
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$rows = Array ();
|
||||
while ($rs->next()) {
|
||||
$rows[] = $rs->getRow();
|
||||
}
|
||||
|
||||
$result->data = $rows;
|
||||
$result->totalCount = $totalCount;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/* Load strings from a Database .
|
||||
* @author Fernando Ontiveros <fernando@colosa.com>
|
||||
* @parameter $languageId (es|en|...).
|
||||
*/
|
||||
|
||||
public function generateFileTranslation ($languageId = '')
|
||||
{
|
||||
$translation = Array ();
|
||||
$translationJS = Array ();
|
||||
|
||||
if ($languageId === '') {
|
||||
$languageId = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
|
||||
}
|
||||
$c = new Criteria();
|
||||
$c->add( TranslationPeer::TRN_LANG, $languageId );
|
||||
$c->addAscendingOrderByColumn( 'TRN_CATEGORY' );
|
||||
$c->addAscendingOrderByColumn( 'TRN_ID' );
|
||||
$tranlations = TranslationPeer::doSelect( $c );
|
||||
|
||||
$cacheFile = PATH_LANGUAGECONT . "translation." . $languageId;
|
||||
$cacheFileJS = PATH_CORE . 'js' . PATH_SEP . 'labels' . PATH_SEP . $languageId . ".js";
|
||||
|
||||
foreach ($tranlations as $key => $row) {
|
||||
if ($row->getTrnCategory() === 'LABEL') {
|
||||
$translation[$row->getTrnId()] = $row->getTrnValue();
|
||||
}
|
||||
if ($row->getTrnCategory() === 'JAVASCRIPT') {
|
||||
$translationJS[$row->getTrnId()] = $row->getTrnValue();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
if (! is_dir( dirname( $cacheFile ) )) {
|
||||
G::mk_dir( dirname( $cacheFile ) );
|
||||
}
|
||||
if (! is_dir( dirname( $cacheFileJS ) )) {
|
||||
G::mk_dir( dirname( $cacheFileJS ) );
|
||||
}
|
||||
$f = fopen( $cacheFile, 'w+' );
|
||||
fwrite( $f, "<?php\n" );
|
||||
fwrite( $f, '$translation =' . 'unserialize(\'' . addcslashes( serialize( $translation ), '\\\'' ) . "');\n" );
|
||||
fwrite( $f, "?>" );
|
||||
fclose( $f );
|
||||
|
||||
$json = new Services_JSON();
|
||||
|
||||
$f = fopen( $cacheFileJS, 'w' );
|
||||
fwrite( $f, "var G_STRINGS =" . $json->encode( $translationJS ) . ";\n" );
|
||||
fclose( $f );
|
||||
|
||||
$res['cacheFile'] = $cacheFile;
|
||||
$res['cacheFileJS'] = $cacheFileJS;
|
||||
$res['rows'] = count( $translation );
|
||||
$res['rowsJS'] = count( $translationJS );
|
||||
return $res;
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an array with
|
||||
* codError 0 - no error, < 0 error
|
||||
* rowsAffected 0,1 the number of rows affected
|
||||
* message message error.
|
||||
*/
|
||||
public function addTranslation ($category, $id, $languageId, $value)
|
||||
{
|
||||
* @author Fernando Ontiveros <fernando@colosa.com>
|
||||
* @parameter $languageId (es|en|...).
|
||||
*/
|
||||
public function generateFileTranslation ($languageId = '')
|
||||
{
|
||||
$translation = Array ();
|
||||
$translationJS = Array ();
|
||||
|
||||
if ($languageId === '') {
|
||||
$languageId = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
|
||||
}
|
||||
$c = new Criteria();
|
||||
$c->add( TranslationPeer::TRN_LANG, $languageId );
|
||||
$c->addAscendingOrderByColumn( 'TRN_CATEGORY' );
|
||||
$c->addAscendingOrderByColumn( 'TRN_ID' );
|
||||
$tranlations = TranslationPeer::doSelect( $c );
|
||||
|
||||
$cacheFile = PATH_LANGUAGECONT . "translation." . $languageId;
|
||||
$cacheFileJS = PATH_CORE . 'js' . PATH_SEP . 'labels' . PATH_SEP . $languageId . ".js";
|
||||
|
||||
foreach ($tranlations as $key => $row) {
|
||||
if ($row->getTrnCategory() === 'LABEL') {
|
||||
$translation[$row->getTrnId()] = $row->getTrnValue();
|
||||
}
|
||||
if ($row->getTrnCategory() === 'JAVASCRIPT') {
|
||||
$translationJS[$row->getTrnId()] = $row->getTrnValue();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
if (! is_dir( dirname( $cacheFile ) )) {
|
||||
G::mk_dir( dirname( $cacheFile ) );
|
||||
}
|
||||
if (! is_dir( dirname( $cacheFileJS ) )) {
|
||||
G::mk_dir( dirname( $cacheFileJS ) );
|
||||
}
|
||||
$f = fopen( $cacheFile, 'w+' );
|
||||
fwrite( $f, "<?php\n" );
|
||||
fwrite( $f, '$translation =' . 'unserialize(\'' . addcslashes( serialize( $translation ), '\\\'' ) . "');\n" );
|
||||
fwrite( $f, "?>" );
|
||||
fclose( $f );
|
||||
|
||||
$json = new Services_JSON();
|
||||
|
||||
$f = fopen( $cacheFileJS, 'w' );
|
||||
fwrite( $f, "var G_STRINGS =" . $json->encode( $translationJS ) . ";\n" );
|
||||
fclose( $f );
|
||||
|
||||
$res['cacheFile'] = $cacheFile;
|
||||
$res['cacheFileJS'] = $cacheFileJS;
|
||||
$res['rows'] = count( $translation );
|
||||
$res['rowsJS'] = count( $translationJS );
|
||||
return $res;
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an array with
|
||||
* codError 0 - no error, < 0 error
|
||||
* rowsAffected 0,1 the number of rows affected
|
||||
* message message error.
|
||||
*/
|
||||
public function addTranslation ($category, $id, $languageId, $value)
|
||||
{
|
||||
//if exists the row in the database propel will update it, otherwise will insert.
|
||||
$tr = TranslationPeer::retrieveByPK( $category, $id, $languageId );
|
||||
if (! (is_object( $tr ) && get_class( $tr ) == 'Translation')) {
|
||||
$tr = new Translation();
|
||||
}
|
||||
$tr->setTrnCategory( $category );
|
||||
$tr->setTrnId( $id );
|
||||
$tr->setTrnLang( $languageId );
|
||||
$tr->setTrnValue( $value );
|
||||
$tr->setTrnUpdateDate( date( 'Y-m-d' ) );
|
||||
|
||||
if ($tr->validate()) {
|
||||
$tr = TranslationPeer::retrieveByPK( $category, $id, $languageId );
|
||||
if (! (is_object( $tr ) && get_class( $tr ) == 'Translation')) {
|
||||
$tr = new Translation();
|
||||
}
|
||||
$tr->setTrnCategory( $category );
|
||||
$tr->setTrnId( $id );
|
||||
$tr->setTrnLang( $languageId );
|
||||
$tr->setTrnValue( $value );
|
||||
$tr->setTrnUpdateDate( date( 'Y-m-d' ) );
|
||||
|
||||
if ($tr->validate()) {
|
||||
// we save it, since we get no validation errors, or do whatever else you like.
|
||||
$res = $tr->save();
|
||||
} else {
|
||||
$res = $tr->save();
|
||||
} else {
|
||||
// Something went wrong. We can now get the validationFailures and handle them.
|
||||
$msg = '';
|
||||
$validationFailuresArray = $tr->getValidationFailures();
|
||||
foreach ($validationFailuresArray as $objValidationFailure) {
|
||||
$msg .= $objValidationFailure->getMessage() . "\n";
|
||||
}
|
||||
return array ('codError' => - 100,'rowsAffected' => 0,'message' => $msg);
|
||||
}
|
||||
return array ('codError' => 0,'rowsAffected' => $res,'message' => '');
|
||||
$msg = '';
|
||||
$validationFailuresArray = $tr->getValidationFailures();
|
||||
foreach ($validationFailuresArray as $objValidationFailure) {
|
||||
$msg .= $objValidationFailure->getMessage() . "\n";
|
||||
}
|
||||
return array ('codError' => - 100,'rowsAffected' => 0,'message' => $msg);
|
||||
}
|
||||
return array ('codError' => 0,'rowsAffected' => $res,'message' => '');
|
||||
//to do: uniform coderror structures for all classes
|
||||
}
|
||||
|
||||
public function remove ($sCategory, $sId, $sLang)
|
||||
{
|
||||
$oTranslation = TranslationPeer::retrieveByPK( $sCategory, $sId, $sLang );
|
||||
if ((is_object( $oTranslation ) && get_class( $oTranslation ) == 'Translation')) {
|
||||
$oTranslation->delete();
|
||||
}
|
||||
}
|
||||
|
||||
public function addTranslationEnvironment ($locale, $headers, $numRecords)
|
||||
{
|
||||
$filePath = $this->envFilePath;
|
||||
$environments = Array ();
|
||||
|
||||
if (file_exists( $filePath )) {
|
||||
$environments = unserialize( file_get_contents( $filePath ) );
|
||||
}
|
||||
|
||||
$environment['LOCALE'] = $locale;
|
||||
$environment['HEADERS'] = $headers;
|
||||
$environment['DATE'] = date( 'Y-m-d H:i:s' );
|
||||
$environment['NUM_RECORDS'] = $numRecords;
|
||||
$environment['LANGUAGE'] = $headers['X-Poedit-Language'];
|
||||
$environment['COUNTRY'] = $headers['X-Poedit-Country'];
|
||||
|
||||
if (strpos( $locale, self::$localeSeparator ) !== false) {
|
||||
list ($environment['LAN_ID'], $environment['IC_UID']) = explode( self::$localeSeparator, strtoupper( $locale ) );
|
||||
$environments[$environment['LAN_ID']][$environment['IC_UID']] = $environment;
|
||||
} else {
|
||||
$environment['LAN_ID'] = strtoupper( $locale );
|
||||
$environment['IC_UID'] = '';
|
||||
$environments[$locale]['__INTERNATIONAL__'] = $environment;
|
||||
}
|
||||
|
||||
file_put_contents( $filePath, serialize( $environments ) );
|
||||
}
|
||||
|
||||
public function removeTranslationEnvironment ($locale)
|
||||
{
|
||||
$filePath = $this->envFilePath;
|
||||
if (strpos( $locale, self::$localeSeparator ) !== false) {
|
||||
list ($LAN_ID, $IC_UID) = explode( '-', strtoupper( $locale ) );
|
||||
} else {
|
||||
$LAN_ID = $locale;
|
||||
$IC_UID = '__INTERNATIONAL__';
|
||||
}
|
||||
|
||||
if (file_exists( $filePath )) {
|
||||
$environments = unserialize( file_get_contents( $filePath ) );
|
||||
if (! isset( $environments[$LAN_ID][$IC_UID] )) {
|
||||
return null;
|
||||
}
|
||||
|
||||
unset( $environments[$LAN_ID][$IC_UID] );
|
||||
file_put_contents( $filePath, serialize( $environments ) );
|
||||
|
||||
if (file_exists( PATH_CORE . "META-INF" . PATH_SEP . "translation." . $locale )) {
|
||||
G::rm_dir( PATH_DATA . "META-INF" . PATH_SEP . "translation." . $locale );
|
||||
}
|
||||
if (file_exists( PATH_CORE . PATH_SEP . 'content' . PATH_SEP . 'translations' . PATH_SEP . 'processmaker' . $locale . '.po' )) {
|
||||
G::rm_dir( PATH_CORE . PATH_SEP . 'content' . PATH_SEP . 'translations' . PATH_SEP . 'processmaker' . $locale . '.po' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getTranslationEnvironments ()
|
||||
{
|
||||
$filePath = $this->envFilePath;
|
||||
$envs = Array ();
|
||||
|
||||
if (! file_exists( $filePath )) {
|
||||
}
|
||||
|
||||
public function remove ($sCategory, $sId, $sLang)
|
||||
{
|
||||
$oTranslation = TranslationPeer::retrieveByPK( $sCategory, $sId, $sLang );
|
||||
if ((is_object( $oTranslation ) && get_class( $oTranslation ) == 'Translation')) {
|
||||
$oTranslation->delete();
|
||||
}
|
||||
}
|
||||
|
||||
public function addTranslationEnvironment ($locale, $headers, $numRecords)
|
||||
{
|
||||
$filePath = $this->envFilePath;
|
||||
$environments = Array ();
|
||||
|
||||
if (file_exists( $filePath )) {
|
||||
$environments = unserialize( file_get_contents( $filePath ) );
|
||||
}
|
||||
|
||||
$environment['LOCALE'] = $locale;
|
||||
$environment['HEADERS'] = $headers;
|
||||
$environment['DATE'] = date( 'Y-m-d H:i:s' );
|
||||
$environment['NUM_RECORDS'] = $numRecords;
|
||||
$environment['LANGUAGE'] = $headers['X-Poedit-Language'];
|
||||
$environment['COUNTRY'] = $headers['X-Poedit-Country'];
|
||||
|
||||
if (strpos( $locale, self::$localeSeparator ) !== false) {
|
||||
list ($environment['LAN_ID'], $environment['IC_UID']) = explode( self::$localeSeparator, strtoupper( $locale ) );
|
||||
$environments[$environment['LAN_ID']][$environment['IC_UID']] = $environment;
|
||||
} else {
|
||||
$environment['LAN_ID'] = strtoupper( $locale );
|
||||
$environment['IC_UID'] = '';
|
||||
$environments[$locale]['__INTERNATIONAL__'] = $environment;
|
||||
}
|
||||
|
||||
file_put_contents( $filePath, serialize( $environments ) );
|
||||
}
|
||||
|
||||
public function removeTranslationEnvironment ($locale)
|
||||
{
|
||||
$filePath = $this->envFilePath;
|
||||
if (strpos( $locale, self::$localeSeparator ) !== false) {
|
||||
list ($LAN_ID, $IC_UID) = explode( '-', strtoupper( $locale ) );
|
||||
} else {
|
||||
$LAN_ID = $locale;
|
||||
$IC_UID = '__INTERNATIONAL__';
|
||||
}
|
||||
|
||||
if (file_exists( $filePath )) {
|
||||
$environments = unserialize( file_get_contents( $filePath ) );
|
||||
if (! isset( $environments[$LAN_ID][$IC_UID] )) {
|
||||
return null;
|
||||
}
|
||||
|
||||
unset( $environments[$LAN_ID][$IC_UID] );
|
||||
file_put_contents( $filePath, serialize( $environments ) );
|
||||
|
||||
if (file_exists( PATH_CORE . "META-INF" . PATH_SEP . "translation." . $locale )) {
|
||||
G::rm_dir( PATH_DATA . "META-INF" . PATH_SEP . "translation." . $locale );
|
||||
}
|
||||
if (file_exists( PATH_CORE . PATH_SEP . 'content' . PATH_SEP . 'translations' . PATH_SEP . 'processmaker' . $locale . '.po' )) {
|
||||
G::rm_dir( PATH_CORE . PATH_SEP . 'content' . PATH_SEP . 'translations' . PATH_SEP . 'processmaker' . $locale . '.po' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getTranslationEnvironments ()
|
||||
{
|
||||
$filePath = $this->envFilePath;
|
||||
$envs = Array ();
|
||||
|
||||
if (! file_exists( $filePath )) {
|
||||
//the transaltions table file doesn't exist, then build it
|
||||
|
||||
|
||||
if (! is_dir( dirname( $this->envFilePath ) )) {
|
||||
G::mk_dir( dirname( $this->envFilePath ) );
|
||||
}
|
||||
$translationsPath = PATH_CORE . "content" . PATH_SEP . 'translations' . PATH_SEP;
|
||||
$basePOFile = $translationsPath . 'english' . PATH_SEP . 'processmaker.en.po';
|
||||
|
||||
$params = self::getInfoFromPOFile( $basePOFile );
|
||||
$this->addTranslationEnvironment( $params['LOCALE'], $params['HEADERS'], $params['COUNT'] );
|
||||
//getting more lanuguage translations
|
||||
$files = glob( $translationsPath . "*.po" );
|
||||
foreach ($files as $file) {
|
||||
$params = self::getInfoFromPOFile( $file );
|
||||
$this->addTranslationEnvironment( $params['LOCALE'], $params['HEADERS'], $params['COUNT'] );
|
||||
}
|
||||
}
|
||||
$envs = unserialize( file_get_contents( $filePath ) );
|
||||
|
||||
$environments = Array ();
|
||||
foreach ($envs as $LAN_ID => $rec1) {
|
||||
foreach ($rec1 as $IC_UID => $rec2) {
|
||||
$environments[] = $rec2;
|
||||
}
|
||||
}
|
||||
|
||||
return $environments;
|
||||
|
||||
/*
|
||||
|
||||
|
||||
if (! is_dir( dirname( $this->envFilePath ) )) {
|
||||
G::mk_dir( dirname( $this->envFilePath ) );
|
||||
}
|
||||
$translationsPath = PATH_CORE . "content" . PATH_SEP . 'translations' . PATH_SEP;
|
||||
$basePOFile = $translationsPath . 'english' . PATH_SEP . 'processmaker.en.po';
|
||||
|
||||
$params = self::getInfoFromPOFile( $basePOFile );
|
||||
$this->addTranslationEnvironment( $params['LOCALE'], $params['HEADERS'], $params['COUNT'] );
|
||||
//getting more lanuguage translations
|
||||
$files = glob( $translationsPath . "*.po" );
|
||||
foreach ($files as $file) {
|
||||
$params = self::getInfoFromPOFile( $file );
|
||||
$this->addTranslationEnvironment( $params['LOCALE'], $params['HEADERS'], $params['COUNT'] );
|
||||
}
|
||||
}
|
||||
$envs = unserialize( file_get_contents( $filePath ) );
|
||||
|
||||
$environments = Array ();
|
||||
foreach ($envs as $LAN_ID => $rec1) {
|
||||
foreach ($rec1 as $IC_UID => $rec2) {
|
||||
$environments[] = $rec2;
|
||||
}
|
||||
}
|
||||
|
||||
return $environments;
|
||||
|
||||
/*
|
||||
G::LoadSystem('dbMaintenance');
|
||||
$o = new DataBaseMaintenance('localhost', 'root', 'atopml2005');
|
||||
$o->connect('wf_os');
|
||||
$r = $o->query('select * from ISO_COUNTRY');
|
||||
$r = $o->query('select * from ISO_COUNTRY');
|
||||
foreach ($r as $i=>$v) {
|
||||
$r[$i]['IC_NAME'] = utf8_encode($r[$i]['IC_NAME']);
|
||||
unset($r[$i]['IC_SORT_ORDER']);
|
||||
}
|
||||
$r1 = $o->query('select * from LANGUAGE');
|
||||
$r2 = Array();
|
||||
}
|
||||
$r1 = $o->query('select * from LANGUAGE');
|
||||
$r2 = Array();
|
||||
foreach ($r1 as $i=>$v) {
|
||||
$r2[$i]['LAN_NAME'] = utf8_encode($r1[$i]['LAN_NAME']);
|
||||
$r2[$i]['LAN_ID'] = utf8_encode($r1[$i]['LAN_ID']);
|
||||
}
|
||||
$s = Array('ISO_COUNTRY'=>$r, 'LANGUAGE'=>$r2);
|
||||
file_put_contents($translationsPath . 'pmos-translations.meta', serialize($s));
|
||||
*/
|
||||
}
|
||||
|
||||
public function getInfoFromPOFile ($file)
|
||||
{
|
||||
G::loadClass( 'i18n_po' );
|
||||
$POFile = new i18n_PO( $file );
|
||||
$POFile->readInit();
|
||||
$POHeaders = $POFile->getHeaders();
|
||||
|
||||
if ($POHeaders['X-Poedit-Country'] != '.') {
|
||||
$country = self::getTranslationMetaByCountryName( $POHeaders['X-Poedit-Country'] );
|
||||
} else {
|
||||
$country = '.';
|
||||
}
|
||||
$language = self::getTranslationMetaByLanguageName( $POHeaders['X-Poedit-Language'] );
|
||||
|
||||
if ($language !== false) {
|
||||
if ($country !== false) {
|
||||
if ($country != '.') {
|
||||
$LOCALE = $language['LAN_ID'] . '-' . $country['IC_UID'];
|
||||
} else if ($country == '.') {
|
||||
*/
|
||||
}
|
||||
|
||||
public function getInfoFromPOFile ($file)
|
||||
{
|
||||
G::loadClass( 'i18n_po' );
|
||||
$POFile = new i18n_PO( $file );
|
||||
$POFile->readInit();
|
||||
$POHeaders = $POFile->getHeaders();
|
||||
|
||||
if ($POHeaders['X-Poedit-Country'] != '.') {
|
||||
$country = self::getTranslationMetaByCountryName( $POHeaders['X-Poedit-Country'] );
|
||||
} else {
|
||||
$country = '.';
|
||||
}
|
||||
$language = self::getTranslationMetaByLanguageName( $POHeaders['X-Poedit-Language'] );
|
||||
|
||||
if ($language !== false) {
|
||||
if ($country !== false) {
|
||||
if ($country != '.') {
|
||||
$LOCALE = $language['LAN_ID'] . '-' . $country['IC_UID'];
|
||||
} elseif ($country == '.') {
|
||||
//this a trsnlation file with a language international, no country name was set
|
||||
$LOCALE = $language['LAN_ID'];
|
||||
} else
|
||||
throw new Exception( 'PO File Error: "' . $file . '" has a invalid country definition!' );
|
||||
} else
|
||||
throw new Exception( 'PO File Error: "' . $file . '" has a invalid country definition!' );
|
||||
} else
|
||||
throw new Exception( 'PO File Error: "' . $file . '" has a invalid language definition!' );
|
||||
|
||||
$countItems = 0;
|
||||
try {
|
||||
while ($rowTranslation = $POFile->getTranslation()) {
|
||||
$countItems ++;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$countItems = '-';
|
||||
}
|
||||
return Array ('LOCALE' => $LOCALE,'HEADERS' => $POHeaders,'COUNT' => $countItems);
|
||||
}
|
||||
|
||||
public function getTranslationEnvironment ($locale)
|
||||
{
|
||||
$filePath = $this->envFilePath;
|
||||
$environments = Array ();
|
||||
|
||||
if (! file_exists( $filePath )) {
|
||||
throw new Exception( "The file $filePath doesn't exist" );
|
||||
}
|
||||
|
||||
$environments = unserialize( file_get_contents( $filePath ) );
|
||||
if (strpos( $locale, self::$localeSeparator ) !== false) {
|
||||
list ($LAN_ID, $IC_UID) = explode( self::localeSeparator, strtoupper( $locale ) );
|
||||
} else {
|
||||
$LAN_ID = $locale;
|
||||
$IC_UID = '__INTERNATIONAL__';
|
||||
}
|
||||
|
||||
if (isset( $environments[$LAN_ID][$IC_UID] )) {
|
||||
return $environments[$LAN_ID][$IC_UID];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function saveTranslationEnvironment ($locale, $data)
|
||||
{
|
||||
$filePath = $this->envFilePath;
|
||||
$environments = Array ();
|
||||
|
||||
if (! file_exists( $filePath )) {
|
||||
throw new Exception( "The file $filePath doesn't exist" );
|
||||
}
|
||||
|
||||
$environments = unserialize( file_get_contents( $filePath ) );
|
||||
if (strpos( $locale, self::$localeSeparator ) !== false) {
|
||||
list ($LAN_ID, $IC_UID) = explode( self::localeSeparator, strtoupper( $locale ) );
|
||||
} else {
|
||||
$LAN_ID = $locale;
|
||||
$IC_UID = '__INTERNATIONAL__';
|
||||
}
|
||||
|
||||
$environments[$LAN_ID][$IC_UID] = $data;
|
||||
file_put_contents( $filePath, serialize( $environments ) );
|
||||
}
|
||||
|
||||
public function getTranslationMeta ()
|
||||
{
|
||||
$translationsPath = PATH_CORE . "content" . PATH_SEP . 'translations' . PATH_SEP;
|
||||
$translationsTable = unserialize( file_get_contents( $translationsPath . 'pmos-translations.meta' ) );
|
||||
return $translationsTable;
|
||||
}
|
||||
|
||||
public function getTranslationMetaByCountryName ($IC_NAME)
|
||||
{
|
||||
$translationsTable = self::getTranslationMeta();
|
||||
|
||||
foreach ($translationsTable['ISO_COUNTRY'] as $row) {
|
||||
if ($row['IC_NAME'] == $IC_NAME) {
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getTranslationMetaByLanguageName ($LAN_NAME)
|
||||
{
|
||||
$translationsTable = self::getTranslationMeta();
|
||||
|
||||
foreach ($translationsTable['LANGUAGE'] as $row) {
|
||||
if ($row['LAN_NAME'] == $LAN_NAME) {
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Translation
|
||||
|
||||
$LOCALE = $language['LAN_ID'];
|
||||
} else {
|
||||
throw new Exception( 'PO File Error: "' . $file . '" has a invalid country definition!' );
|
||||
}
|
||||
} else {
|
||||
throw new Exception( 'PO File Error: "' . $file . '" has a invalid country definition!' );
|
||||
}
|
||||
} else {
|
||||
throw new Exception( 'PO File Error: "' . $file . '" has a invalid language definition!' );
|
||||
}
|
||||
$countItems = 0;
|
||||
try {
|
||||
while ($rowTranslation = $POFile->getTranslation()) {
|
||||
$countItems ++;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$countItems = '-';
|
||||
}
|
||||
return Array ('LOCALE' => $LOCALE,'HEADERS' => $POHeaders,'COUNT' => $countItems);
|
||||
}
|
||||
|
||||
public function getTranslationEnvironment ($locale)
|
||||
{
|
||||
$filePath = $this->envFilePath;
|
||||
$environments = Array ();
|
||||
|
||||
if (! file_exists( $filePath )) {
|
||||
throw new Exception( "The file $filePath doesn't exist" );
|
||||
}
|
||||
|
||||
$environments = unserialize( file_get_contents( $filePath ) );
|
||||
if (strpos( $locale, self::$localeSeparator ) !== false) {
|
||||
list ($LAN_ID, $IC_UID) = explode( self::localeSeparator, strtoupper( $locale ) );
|
||||
} else {
|
||||
$LAN_ID = $locale;
|
||||
$IC_UID = '__INTERNATIONAL__';
|
||||
}
|
||||
|
||||
if (isset( $environments[$LAN_ID][$IC_UID] )) {
|
||||
return $environments[$LAN_ID][$IC_UID];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function saveTranslationEnvironment ($locale, $data)
|
||||
{
|
||||
$filePath = $this->envFilePath;
|
||||
$environments = Array ();
|
||||
|
||||
if (! file_exists( $filePath )) {
|
||||
throw new Exception( "The file $filePath doesn't exist" );
|
||||
}
|
||||
|
||||
$environments = unserialize( file_get_contents( $filePath ) );
|
||||
if (strpos( $locale, self::$localeSeparator ) !== false) {
|
||||
list ($LAN_ID, $IC_UID) = explode( self::localeSeparator, strtoupper( $locale ) );
|
||||
} else {
|
||||
$LAN_ID = $locale;
|
||||
$IC_UID = '__INTERNATIONAL__';
|
||||
}
|
||||
|
||||
$environments[$LAN_ID][$IC_UID] = $data;
|
||||
file_put_contents( $filePath, serialize( $environments ) );
|
||||
}
|
||||
|
||||
public function getTranslationMeta ()
|
||||
{
|
||||
$translationsPath = PATH_CORE . "content" . PATH_SEP . 'translations' . PATH_SEP;
|
||||
$translationsTable = unserialize( file_get_contents( $translationsPath . 'pmos-translations.meta' ) );
|
||||
return $translationsTable;
|
||||
}
|
||||
|
||||
public function getTranslationMetaByCountryName ($IC_NAME)
|
||||
{
|
||||
$translationsTable = self::getTranslationMeta();
|
||||
|
||||
foreach ($translationsTable['ISO_COUNTRY'] as $row) {
|
||||
if ($row['IC_NAME'] == $IC_NAME) {
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getTranslationMetaByLanguageName ($LAN_NAME)
|
||||
{
|
||||
$translationsTable = self::getTranslationMeta();
|
||||
|
||||
foreach ($translationsTable['LANGUAGE'] as $row) {
|
||||
if ($row['LAN_NAME'] == $LAN_NAME) {
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
/**
|
||||
* TranslationPeer.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 'TRANSLATION' 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 TranslationPeer extends BaseTranslationPeer {
|
||||
class TranslationPeer extends BaseTranslationPeer
|
||||
{
|
||||
}
|
||||
|
||||
} // TranslationPeer
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
/**
|
||||
* Triggers.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/Content.php';
|
||||
@@ -31,7 +31,7 @@ require_once 'classes/model/om/BaseTriggers.php';
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'TRIGGER' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
@@ -39,297 +39,290 @@ require_once 'classes/model/om/BaseTriggers.php';
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
class Triggers extends BaseTriggers {
|
||||
/**
|
||||
* This value goes in the content table
|
||||
* @var string
|
||||
*/
|
||||
protected $tri_title = '';
|
||||
/**
|
||||
* Get the tri_title column value.
|
||||
* @return string
|
||||
*/
|
||||
public function getTriTitle()
|
||||
{
|
||||
if ( $this->getTriUid() == "" ) {
|
||||
throw ( new Exception( "Error in getTriTitle, the getTriUid() can't be blank") );
|
||||
}
|
||||
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
|
||||
$this->tri_title = Content::load ( 'TRI_TITLE', '', $this->getTriUid(), $lang );
|
||||
return $this->tri_title;
|
||||
}
|
||||
/**
|
||||
* Set the tri_title column value.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setTriTitle($v)
|
||||
{
|
||||
if ( $this->getTriUid() == "" ) {
|
||||
throw ( new Exception( "Error in setTriTitle, the getTriUid() can't be blank") );
|
||||
}
|
||||
$v=isset($v)?((string)$v):'';
|
||||
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
|
||||
if ($this->tri_title !== $v || $v==="") {
|
||||
$this->tri_title = $v;
|
||||
class Triggers extends BaseTriggers
|
||||
{
|
||||
/**
|
||||
* This value goes in the content table
|
||||
* @var string
|
||||
*/
|
||||
protected $tri_title = '';
|
||||
|
||||
$res = Content::addContent( 'TRI_TITLE', '', $this->getTriUid(), $lang, $this->tri_title );
|
||||
return $res;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* This value goes in the content table
|
||||
* @var string
|
||||
*/
|
||||
protected $tri_description = '';
|
||||
/**
|
||||
* Get the tri_description column value.
|
||||
* @return string
|
||||
*/
|
||||
public function getTriDescription()
|
||||
{
|
||||
if ( $this->getTriUid() == "" ) {
|
||||
throw ( new Exception( "Error in getTriDescription, the getTriUid() can't be blank") );
|
||||
}
|
||||
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
|
||||
$this->tri_description = Content::load ( 'TRI_DESCRIPTION', '', $this->getTriUid(), $lang );
|
||||
return $this->tri_description;
|
||||
}
|
||||
/**
|
||||
* Set the tri_description column value.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setTriDescription($v)
|
||||
{
|
||||
if ( $this->getTriUid() == "" ) {
|
||||
throw ( new Exception( "Error in setTriDescription, the getTriUid() can't be blank") );
|
||||
}
|
||||
$v=isset($v)?((string)$v):'';
|
||||
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
|
||||
if ($this->tri_description !== $v || $v==="") {
|
||||
$this->tri_description = $v;
|
||||
|
||||
$res = Content::addContent( 'TRI_DESCRIPTION', '', $this->getTriUid(), $lang, $this->tri_description );
|
||||
return $res;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public function load($TriUid)
|
||||
{
|
||||
try {
|
||||
$oRow = TriggersPeer::retrieveByPK( $TriUid );
|
||||
if (!is_null($oRow))
|
||||
{
|
||||
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
|
||||
$this->setNew(false);
|
||||
$this->setTriTitle($aFields['TRI_TITLE']=$this->getTriTitle());
|
||||
$this->setTriDescription($aFields['TRI_DESCRIPTION']=$this->getTriDescription());
|
||||
return $aFields;
|
||||
}
|
||||
else {
|
||||
throw( new Exception( "The row '$TriUid' in table TRIGGERS doesn't exist!" ));
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
throw($oError);
|
||||
}
|
||||
}
|
||||
public function create($aData)
|
||||
{
|
||||
$con = Propel::getConnection(TriggersPeer::DATABASE_NAME);
|
||||
try
|
||||
/**
|
||||
* Get the tri_title column value.
|
||||
* @return string
|
||||
*/
|
||||
public function getTriTitle()
|
||||
{
|
||||
$con->begin();
|
||||
if ( isset ( $aData['TRI_UID'] ) && $aData['TRI_UID']== '' )
|
||||
unset ( $aData['TRI_UID'] );
|
||||
if ( !isset ( $aData['TRI_UID'] ) )
|
||||
$this->setTriUid(G::generateUniqueID());
|
||||
else
|
||||
$this->setTriUid($aData['TRI_UID'] );
|
||||
|
||||
$this->setProUid($aData['PRO_UID']);
|
||||
$this->setTriType("SCRIPT");
|
||||
if ($this->getTriUid() == "") {
|
||||
throw ( new Exception( "Error in getTriTitle, the getTriUid() can't be blank") );
|
||||
}
|
||||
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
|
||||
$this->tri_title = Content::load ( 'TRI_TITLE', '', $this->getTriUid(), $lang );
|
||||
return $this->tri_title;
|
||||
}
|
||||
|
||||
if ( !isset ( $aData['TRI_WEBBOT'] ) )
|
||||
$this->setTriWebbot("");
|
||||
else
|
||||
$this->setTriWebbot( $aData['TRI_WEBBOT'] );
|
||||
|
||||
if($this->validate())
|
||||
{
|
||||
if ( !isset ( $aData['TRI_TITLE'] ) )
|
||||
$this->setTriTitle("");
|
||||
else
|
||||
$this->setTriTitle( $aData['TRI_TITLE'] );
|
||||
|
||||
if ( !isset ( $aData['TRI_DESCRIPTION'] ) )
|
||||
$this->setTriDescription("");
|
||||
else
|
||||
$this->setTriDescription( $aData['TRI_DESCRIPTION'] );
|
||||
|
||||
if ( !isset ( $aData['TRI_PARAM'] ) )
|
||||
$this->setTriParam("");
|
||||
else
|
||||
$this->setTriParam( $aData['TRI_PARAM'] );
|
||||
|
||||
$result=$this->save();
|
||||
$con->commit();
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$con->rollback();
|
||||
throw(new Exception("Failed Validation in class ".get_class($this)."."));
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
/**
|
||||
* Set the tri_title column value.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setTriTitle($v)
|
||||
{
|
||||
$con->rollback();
|
||||
throw($e);
|
||||
if ($this->getTriUid() == "") {
|
||||
throw ( new Exception( "Error in setTriTitle, the getTriUid() can't be blank") );
|
||||
}
|
||||
$v=isset($v)?((string)$v):'';
|
||||
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
|
||||
if ($this->tri_title !== $v || $v==="") {
|
||||
$this->tri_title = $v;
|
||||
$res = Content::addContent( 'TRI_TITLE', '', $this->getTriUid(), $lang, $this->tri_title );
|
||||
return $res;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
public function update($fields)
|
||||
{
|
||||
$con = Propel::getConnection(TriggersPeer::DATABASE_NAME);
|
||||
try
|
||||
{
|
||||
$con->begin();
|
||||
$this->load($fields['TRI_UID']);
|
||||
$this->fromArray($fields,BasePeer::TYPE_FIELDNAME);
|
||||
if($this->validate())
|
||||
{
|
||||
$contentResult=0;
|
||||
if (array_key_exists("TRI_TITLE", $fields)) $contentResult+=$this->setTriTitle($fields["TRI_TITLE"]);
|
||||
if (array_key_exists("TRI_DESCRIPTION", $fields)) $contentResult+=$this->setTriDescription($fields["TRI_DESCRIPTION"]);
|
||||
$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($TriUid)
|
||||
{
|
||||
$con = Propel::getConnection(TriggersPeer::DATABASE_NAME);
|
||||
try
|
||||
{
|
||||
$result = false;
|
||||
$con->begin();
|
||||
$oTri = TriggersPeer::retrieveByPK( $TriUid );
|
||||
if (!is_null($oTri)) {
|
||||
Content::removeContent( 'TRI_TITLE', '', $this->getTriUid());
|
||||
Content::removeContent( 'TRI_DESCRIPTION', '', $this->getTriUid());
|
||||
$result = $oTri->delete();
|
||||
$con->commit();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
$con->rollback();
|
||||
throw($e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* verify if Trigger row specified in [sUid] exists.
|
||||
*
|
||||
* @param string $sUid the uid of the Prolication
|
||||
*/
|
||||
|
||||
function TriggerExists ( $sUid ) {
|
||||
$con = Propel::getConnection(TriggersPeer::DATABASE_NAME);
|
||||
try {
|
||||
$oObj = TriggersPeer::retrieveByPk( $sUid );
|
||||
if (is_object($oObj) && get_class ($oObj) == 'Triggers' ) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
throw($oError);
|
||||
}
|
||||
}
|
||||
|
||||
function verifyDependecies($TRI_UID){
|
||||
require_once "classes/model/Event.php";
|
||||
require_once "classes/model/StepTrigger.php";
|
||||
|
||||
$oResult = new stdClass();
|
||||
$oResult->dependencies = Array();
|
||||
|
||||
$oCriteria = new Criteria();
|
||||
$oCriteria->addSelectColumn(EventPeer::EVN_UID);
|
||||
$oCriteria->addSelectColumn(EventPeer::TRI_UID);
|
||||
$oCriteria->add(EventPeer::EVN_ACTION, '', Criteria::NOT_EQUAL);
|
||||
$oCriteria->add(EventPeer::TRI_UID, $TRI_UID);
|
||||
|
||||
|
||||
$oDataset = EventPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
/**
|
||||
* This value goes in the content table
|
||||
* @var string
|
||||
*/
|
||||
protected $tri_description = '';
|
||||
/**
|
||||
* Get the tri_description column value.
|
||||
* @return string
|
||||
*/
|
||||
|
||||
$aRows = Array();
|
||||
while( $oDataset->next() ) {
|
||||
array_push($aRows, $oDataset->getRow());
|
||||
public function getTriDescription()
|
||||
{
|
||||
if ($this->getTriUid() == "") {
|
||||
throw ( new Exception( "Error in getTriDescription, the getTriUid() can't be blank") );
|
||||
}
|
||||
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
|
||||
$this->tri_description = Content::load ( 'TRI_DESCRIPTION', '', $this->getTriUid(), $lang );
|
||||
return $this->tri_description;
|
||||
}
|
||||
|
||||
$oResult->dependencies['Events'] = Array();
|
||||
if(count($aRows) == 0){
|
||||
$oResult->code = 0;
|
||||
} else {
|
||||
$oResult->code = 1;
|
||||
foreach($aRows as $row){
|
||||
$oTrigger = TriggersPeer::retrieveByPK($row['TRI_UID']);
|
||||
array_push($oResult->dependencies['Events'], Array('UID'=>($oTrigger->getTriUid()), 'DESCRIPTION'=>($oTrigger->getTriTitle())));
|
||||
}
|
||||
}
|
||||
|
||||
//for tasks dependencies
|
||||
$oCriteria = new Criteria();
|
||||
$oCriteria->addSelectColumn(StepTriggerPeer::TAS_UID);
|
||||
$oCriteria->addSelectColumn(StepTriggerPeer::TRI_UID);
|
||||
$oCriteria->add(StepTriggerPeer::TRI_UID, $TRI_UID);
|
||||
|
||||
$oDataset = StepTriggerPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$aRows = Array();
|
||||
while( $oDataset->next() ) {
|
||||
array_push($aRows, $oDataset->getRow());
|
||||
/**
|
||||
* Set the tri_description column value.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setTriDescription($v)
|
||||
{
|
||||
if ($this->getTriUid() == "") {
|
||||
throw ( new Exception( "Error in setTriDescription, the getTriUid() can't be blank") );
|
||||
}
|
||||
$v=isset($v)?((string)$v):'';
|
||||
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
|
||||
if ($this->tri_description !== $v || $v==="") {
|
||||
$this->tri_description = $v;
|
||||
$res = Content::addContent( 'TRI_DESCRIPTION', '', $this->getTriUid(), $lang, $this->tri_description );
|
||||
return $res;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
$oResult->dependencies['Tasks'] = Array();
|
||||
if($oResult->code == 0 && count($aRows) == 0){
|
||||
$oResult->code = 0;
|
||||
} else if(count($aRows) > 0){
|
||||
$oResult->code = 1;
|
||||
foreach($aRows as $row){
|
||||
$oTask = TaskPeer::retrieveByPK($row['TAS_UID']);
|
||||
array_push($oResult->dependencies['Tasks'], Array('UID'=>($oTask->getTasUid()), 'DESCRIPTION'=>($oTask->getTasTitle())));
|
||||
}
|
||||
|
||||
public function load($TriUid)
|
||||
{
|
||||
try {
|
||||
$oRow = TriggersPeer::retrieveByPK( $TriUid );
|
||||
if (!is_null($oRow)) {
|
||||
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
|
||||
$this->setNew(false);
|
||||
$this->setTriTitle($aFields['TRI_TITLE']=$this->getTriTitle());
|
||||
$this->setTriDescription($aFields['TRI_DESCRIPTION']=$this->getTriDescription());
|
||||
return $aFields;
|
||||
} else {
|
||||
throw( new Exception( "The row '$TriUid' in table TRIGGERS doesn't exist!" ));
|
||||
}
|
||||
} catch (Exception $oError) {
|
||||
throw($oError);
|
||||
}
|
||||
}
|
||||
|
||||
return $oResult;
|
||||
}
|
||||
|
||||
} // Trigger
|
||||
?>
|
||||
|
||||
public function create($aData)
|
||||
{
|
||||
$con = Propel::getConnection(TriggersPeer::DATABASE_NAME);
|
||||
try {
|
||||
$con->begin();
|
||||
if (isset ( $aData['TRI_UID'] ) && $aData['TRI_UID']== '') {
|
||||
unset ( $aData['TRI_UID'] );
|
||||
}
|
||||
if ( !isset ( $aData['TRI_UID'] ) ) {
|
||||
$this->setTriUid(G::generateUniqueID());
|
||||
} else {
|
||||
$this->setTriUid($aData['TRI_UID'] );
|
||||
}
|
||||
|
||||
$this->setProUid($aData['PRO_UID']);
|
||||
$this->setTriType("SCRIPT");
|
||||
|
||||
if (!isset ( $aData['TRI_WEBBOT'] )) {
|
||||
$this->setTriWebbot("");
|
||||
} else {
|
||||
$this->setTriWebbot( $aData['TRI_WEBBOT'] );
|
||||
}
|
||||
|
||||
if ($this->validate()) {
|
||||
if (!isset ( $aData['TRI_TITLE'] )) {
|
||||
$this->setTriTitle("");
|
||||
} else {
|
||||
$this->setTriTitle( $aData['TRI_TITLE'] );
|
||||
}
|
||||
if (!isset ( $aData['TRI_DESCRIPTION'] )) {
|
||||
$this->setTriDescription("");
|
||||
} else {
|
||||
$this->setTriDescription( $aData['TRI_DESCRIPTION'] );
|
||||
}
|
||||
if (!isset ( $aData['TRI_PARAM'] )) {
|
||||
$this->setTriParam("");
|
||||
} else {
|
||||
$this->setTriParam( $aData['TRI_PARAM'] );
|
||||
}
|
||||
$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(TriggersPeer::DATABASE_NAME);
|
||||
try {
|
||||
$con->begin();
|
||||
$this->load($fields['TRI_UID']);
|
||||
$this->fromArray($fields,BasePeer::TYPE_FIELDNAME);
|
||||
if ($this->validate()) {
|
||||
$contentResult=0;
|
||||
if (array_key_exists("TRI_TITLE", $fields)) {
|
||||
$contentResult+=$this->setTriTitle($fields["TRI_TITLE"]);
|
||||
}
|
||||
if (array_key_exists("TRI_DESCRIPTION", $fields)) {
|
||||
$contentResult+=$this->setTriDescription($fields["TRI_DESCRIPTION"]);
|
||||
}
|
||||
$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($TriUid)
|
||||
{
|
||||
$con = Propel::getConnection(TriggersPeer::DATABASE_NAME);
|
||||
try {
|
||||
$result = false;
|
||||
$con->begin();
|
||||
$oTri = TriggersPeer::retrieveByPK( $TriUid );
|
||||
if (!is_null($oTri)) {
|
||||
Content::removeContent( 'TRI_TITLE', '', $this->getTriUid());
|
||||
Content::removeContent( 'TRI_DESCRIPTION', '', $this->getTriUid());
|
||||
$result = $oTri->delete();
|
||||
$con->commit();
|
||||
}
|
||||
return $result;
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw($e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* verify if Trigger row specified in [sUid] exists.
|
||||
*
|
||||
* @param string $sUid the uid of the Prolication
|
||||
*/
|
||||
public function TriggerExists ($sUid)
|
||||
{
|
||||
$con = Propel::getConnection(TriggersPeer::DATABASE_NAME);
|
||||
try {
|
||||
$oObj = TriggersPeer::retrieveByPk( $sUid );
|
||||
if (is_object($oObj) && get_class ($oObj) == 'Triggers' ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (Exception $oError) {
|
||||
throw($oError);
|
||||
}
|
||||
}
|
||||
|
||||
public function verifyDependecies($TRI_UID)
|
||||
{
|
||||
require_once "classes/model/Event.php";
|
||||
require_once "classes/model/StepTrigger.php";
|
||||
|
||||
$oResult = new stdClass();
|
||||
$oResult->dependencies = Array();
|
||||
|
||||
$oCriteria = new Criteria();
|
||||
$oCriteria->addSelectColumn(EventPeer::EVN_UID);
|
||||
$oCriteria->addSelectColumn(EventPeer::TRI_UID);
|
||||
$oCriteria->add(EventPeer::EVN_ACTION, '', Criteria::NOT_EQUAL);
|
||||
$oCriteria->add(EventPeer::TRI_UID, $TRI_UID);
|
||||
|
||||
$oDataset = EventPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$aRows = Array();
|
||||
while ($oDataset->next()) {
|
||||
array_push($aRows, $oDataset->getRow());
|
||||
}
|
||||
|
||||
$oResult->dependencies['Events'] = Array();
|
||||
if (count($aRows) == 0) {
|
||||
$oResult->code = 0;
|
||||
} else {
|
||||
$oResult->code = 1;
|
||||
foreach ($aRows as $row) {
|
||||
$oTrigger = TriggersPeer::retrieveByPK($row['TRI_UID']);
|
||||
array_push($oResult->dependencies['Events'], Array('UID'=>($oTrigger->getTriUid()), 'DESCRIPTION'=>($oTrigger->getTriTitle())));
|
||||
}
|
||||
}
|
||||
|
||||
//for tasks dependencies
|
||||
$oCriteria = new Criteria();
|
||||
$oCriteria->addSelectColumn(StepTriggerPeer::TAS_UID);
|
||||
$oCriteria->addSelectColumn(StepTriggerPeer::TRI_UID);
|
||||
$oCriteria->add(StepTriggerPeer::TRI_UID, $TRI_UID);
|
||||
|
||||
$oDataset = StepTriggerPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$aRows = Array();
|
||||
while ( $oDataset->next() ) {
|
||||
array_push($aRows, $oDataset->getRow());
|
||||
}
|
||||
|
||||
$oResult->dependencies['Tasks'] = Array();
|
||||
if ($oResult->code == 0 && count($aRows) == 0) {
|
||||
$oResult->code = 0;
|
||||
} elseif (count($aRows) > 0) {
|
||||
$oResult->code = 1;
|
||||
foreach ($aRows as $row) {
|
||||
$oTask = TaskPeer::retrieveByPK($row['TAS_UID']);
|
||||
array_push($oResult->dependencies['Tasks'], Array('UID'=>($oTask->getTasUid()), 'DESCRIPTION'=>($oTask->getTasTitle())));
|
||||
}
|
||||
}
|
||||
return $oResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
/**
|
||||
* TriggersPeer.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,26 +15,26 @@
|
||||
* 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
|
||||
require_once 'classes/model/om/BaseTriggersPeer.php';
|
||||
// include base peer class
|
||||
require_once 'classes/model/om/BaseTriggersPeer.php';
|
||||
|
||||
// include object class
|
||||
include_once 'classes/model/Triggers.php';
|
||||
// include object class
|
||||
include_once 'classes/model/Triggers.php';
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'TRIGGERS' 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 TriggersPeer extends BaseTriggersPeer {
|
||||
class TriggersPeer extends BaseTriggersPeer
|
||||
{
|
||||
}
|
||||
|
||||
} // TriggersPeer
|
||||
|
||||
@@ -44,7 +44,7 @@ require_once 'classes/model/IsoLocation.php';
|
||||
class Users extends BaseUsers
|
||||
{
|
||||
|
||||
function create ($aData)
|
||||
public function create ($aData)
|
||||
{
|
||||
$con = Propel::getConnection( UsersPeer::DATABASE_NAME );
|
||||
try {
|
||||
@@ -175,7 +175,7 @@ class Users extends BaseUsers
|
||||
}
|
||||
}
|
||||
|
||||
function remove ($UsrUid)
|
||||
public function remove ($UsrUid)
|
||||
{
|
||||
$con = Propel::getConnection( UsersPeer::DATABASE_NAME );
|
||||
try {
|
||||
@@ -190,7 +190,7 @@ class Users extends BaseUsers
|
||||
}
|
||||
}
|
||||
|
||||
function loadByUsername ($sUsername)
|
||||
public function loadByUsername ($sUsername)
|
||||
{
|
||||
$c = new Criteria( 'workflow' );
|
||||
$del = DBAdapter::getStringDelimiter();
|
||||
@@ -204,7 +204,7 @@ class Users extends BaseUsers
|
||||
return $c;
|
||||
}
|
||||
|
||||
function loadByUsernameInArray ($sUsername)
|
||||
public function loadByUsernameInArray ($sUsername)
|
||||
{
|
||||
$c = $this->loadByUsername( $sUsername );
|
||||
$rs = UsersPeer::doSelectRS( $c );
|
||||
@@ -296,7 +296,7 @@ class Users extends BaseUsers
|
||||
}
|
||||
}
|
||||
|
||||
function getAvailableUsersCriteria ($sGroupUID = '')
|
||||
public function getAvailableUsersCriteria ($sGroupUID = '')
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -317,7 +317,7 @@ class Users extends BaseUsers
|
||||
*
|
||||
* @return array of all active users
|
||||
*/
|
||||
function getAll ($start = null, $limit = null, $search = null)
|
||||
public function getAll ($start = null, $limit = null, $search = null)
|
||||
{
|
||||
$totalCount = 0;
|
||||
$criteria = new Criteria( 'workflow' );
|
||||
@@ -380,5 +380,4 @@ class Users extends BaseUsers
|
||||
return $aFields;
|
||||
}
|
||||
}
|
||||
// Users
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
/**
|
||||
* UsersPeer.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 'USERS' 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 UsersPeer extends BaseUsersPeer {
|
||||
class UsersPeer extends BaseUsersPeer
|
||||
{
|
||||
}
|
||||
|
||||
} // UsersPeer
|
||||
|
||||
@@ -22,12 +22,12 @@ class UsersProperties extends BaseUsersProperties
|
||||
public $usrID = '';
|
||||
public $lang = 'en';
|
||||
|
||||
function __construct ()
|
||||
public function __construct ()
|
||||
{
|
||||
$this->lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
|
||||
}
|
||||
|
||||
function UserPropertyExists ($sUserUID)
|
||||
public function UserPropertyExists ($sUserUID)
|
||||
{
|
||||
$oUserProperty = UsersPropertiesPeer::retrieveByPk( $sUserUID );
|
||||
if (! is_null( $oUserProperty ) && is_object( $oUserProperty ) && get_class( $oUserProperty ) == 'UsersProperties') {
|
||||
@@ -436,5 +436,4 @@ class UsersProperties extends BaseUsersProperties
|
||||
return $baseUrl . $url;
|
||||
}
|
||||
}
|
||||
// UsersProperties
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'USERS_PROPERTIES' 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 UsersPropertiesPeer extends BaseUsersPropertiesPeer {
|
||||
class UsersPropertiesPeer extends BaseUsersPropertiesPeer
|
||||
{
|
||||
}
|
||||
|
||||
} // UsersPropertiesPeer
|
||||
|
||||
Reference in New Issue
Block a user