Merge pull request #832 from Jennydmz/master
CODE STYLE, checking in detail...
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* AppDelegation.php
|
* AppDelegation.php
|
||||||
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
@@ -41,10 +42,12 @@ G::LoadClass("dates");
|
|||||||
*
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
class AppDelegation extends BaseAppDelegation {
|
class AppDelegation extends BaseAppDelegation
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create an application delegation
|
* create an application delegation
|
||||||
|
*
|
||||||
* @param $sProUid process Uid
|
* @param $sProUid process Uid
|
||||||
* @param $sAppUid Application Uid
|
* @param $sAppUid Application Uid
|
||||||
* @param $sTasUid Task Uid
|
* @param $sTasUid Task Uid
|
||||||
@@ -104,27 +107,26 @@ class AppDelegation extends BaseAppDelegation {
|
|||||||
|
|
||||||
$this->setDelTaskDueDate( $delTaskDueDate['DUE_DATE'] ); // Due date formatted
|
$this->setDelTaskDueDate( $delTaskDueDate['DUE_DATE'] ); // Due date formatted
|
||||||
|
|
||||||
|
|
||||||
if ((defined( "DEBUG_CALENDAR_LOG" )) && (DEBUG_CALENDAR_LOG)) {
|
if ((defined( "DEBUG_CALENDAR_LOG" )) && (DEBUG_CALENDAR_LOG)) {
|
||||||
$this->setDelData( $delTaskDueDate['DUE_DATE_LOG'] ); // Log of actions made by Calendar Engine
|
$this->setDelData( $delTaskDueDate['DUE_DATE_LOG'] ); // Log of actions made by Calendar Engine
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$this->setDelData( '' );
|
$this->setDelData( '' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// this condition assures that an internal delegation like a subprocess dont have an initial date setted
|
// this condition assures that an internal delegation like a subprocess dont have an initial date setted
|
||||||
if ( $delIndex == 1 && !$isSubprocess ) { //the first delegation, init date this should be now for draft applications, in other cases, should be null.
|
if ($delIndex == 1 && ! $isSubprocess) {
|
||||||
|
//the first delegation, init date this should be now for draft applications, in other cases, should be null.
|
||||||
$this->setDelInitDate( 'now' );
|
$this->setDelInitDate( 'now' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->validate()) {
|
if ($this->validate()) {
|
||||||
try {
|
try {
|
||||||
$res = $this->save();
|
$res = $this->save();
|
||||||
}
|
} catch (PropelException $e) {
|
||||||
catch ( PropelException $e ) {
|
|
||||||
throw ($e);
|
throw ($e);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Something went wrong. We can now get the validationFailures and handle them.
|
// Something went wrong. We can now get the validationFailures and handle them.
|
||||||
$msg = '';
|
$msg = '';
|
||||||
$validationFailuresArray = $this->getValidationFailures();
|
$validationFailuresArray = $this->getValidationFailures();
|
||||||
@@ -157,7 +159,8 @@ class AppDelegation extends BaseAppDelegation {
|
|||||||
* @return array $Fields the fields
|
* @return array $Fields the fields
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function Load ( $AppUid, $sDelIndex ) {
|
function Load ($AppUid, $sDelIndex)
|
||||||
|
{
|
||||||
$con = Propel::getConnection( AppDelegationPeer::DATABASE_NAME );
|
$con = Propel::getConnection( AppDelegationPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oAppDel = AppDelegationPeer::retrieveByPk( $AppUid, $sDelIndex );
|
$oAppDel = AppDelegationPeer::retrieveByPk( $AppUid, $sDelIndex );
|
||||||
@@ -165,21 +168,21 @@ class AppDelegation extends BaseAppDelegation {
|
|||||||
$aFields = $oAppDel->toArray( BasePeer::TYPE_FIELDNAME );
|
$aFields = $oAppDel->toArray( BasePeer::TYPE_FIELDNAME );
|
||||||
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
||||||
return $aFields;
|
return $aFields;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw (new Exception( "The row '$AppUid, $sDelIndex' in table AppDelegation doesn't exist!" ));
|
throw (new Exception( "The row '$AppUid, $sDelIndex' in table AppDelegation doesn't exist!" ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the application row
|
* Update the application row
|
||||||
|
*
|
||||||
* @param array $aData
|
* @param array $aData
|
||||||
* @return variant
|
* @return variant
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
public function update ($aData)
|
public function update ($aData)
|
||||||
{
|
{
|
||||||
@@ -193,26 +196,25 @@ class AppDelegation extends BaseAppDelegation {
|
|||||||
$res = $oApp->save();
|
$res = $oApp->save();
|
||||||
$con->commit();
|
$con->commit();
|
||||||
return $res;
|
return $res;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$msg = '';
|
$msg = '';
|
||||||
foreach($this->getValidationFailures() as $objValidationFailure)
|
foreach ($this->getValidationFailures() as $objValidationFailure) {
|
||||||
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
||||||
|
}
|
||||||
|
|
||||||
throw (new PropelException( 'The row cannot be created!', new PropelException( $msg ) ));
|
throw (new PropelException( 'The row cannot be created!', new PropelException( $msg ) ));
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
throw (new Exception( "This AppDelegation row doesn't exist!" ));
|
throw (new Exception( "This AppDelegation row doesn't exist!" ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove($sApplicationUID, $iDelegationIndex) {
|
function remove ($sApplicationUID, $iDelegationIndex)
|
||||||
|
{
|
||||||
$oConnection = Propel::getConnection( StepTriggerPeer::DATABASE_NAME );
|
$oConnection = Propel::getConnection( StepTriggerPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oConnection->begin();
|
$oConnection->begin();
|
||||||
@@ -222,8 +224,7 @@ class AppDelegation extends BaseAppDelegation {
|
|||||||
}
|
}
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch(Exception $e) {
|
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw ($e);
|
throw ($e);
|
||||||
}
|
}
|
||||||
@@ -238,24 +239,21 @@ class AppDelegation extends BaseAppDelegation {
|
|||||||
|
|
||||||
$aData['TAS_UID'] = $this->getTasUid();
|
$aData['TAS_UID'] = $this->getTasUid();
|
||||||
//Added to allow User defined Timing Control at Run time from Derivation screen
|
//Added to allow User defined Timing Control at Run time from Derivation screen
|
||||||
if(isset($sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY']) && $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] == 'true')
|
if (isset( $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] ) && $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] == 'true') {
|
||||||
{
|
|
||||||
$aData['TAS_DURATION'] = $sNextTasParam['NEXT_TASK']['TAS_DURATION'];
|
$aData['TAS_DURATION'] = $sNextTasParam['NEXT_TASK']['TAS_DURATION'];
|
||||||
$aData['TAS_TIMEUNIT'] = $sNextTasParam['NEXT_TASK']['TAS_TIMEUNIT'];
|
$aData['TAS_TIMEUNIT'] = $sNextTasParam['NEXT_TASK']['TAS_TIMEUNIT'];
|
||||||
$aData['TAS_TYPE_DAY'] = $sNextTasParam['NEXT_TASK']['TAS_TYPE_DAY'];
|
$aData['TAS_TYPE_DAY'] = $sNextTasParam['NEXT_TASK']['TAS_TYPE_DAY'];
|
||||||
|
|
||||||
if (isset( $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'] ) && $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'] != '') {
|
if (isset( $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'] ) && $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'] != '') {
|
||||||
$aCalendarUID = $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'];
|
$aCalendarUID = $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$aCalendarUID = '';
|
$aCalendarUID = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
//Updating the task Table , so that user will see updated values in the assign screen in consequent cases
|
//Updating the task Table , so that user will see updated values in the assign screen in consequent cases
|
||||||
$oTask = new Task();
|
$oTask = new Task();
|
||||||
$oTask->update( $aData );
|
$oTask->update( $aData );
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (is_null( $task )) {
|
if (is_null( $task )) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -267,16 +265,9 @@ class AppDelegation extends BaseAppDelegation {
|
|||||||
|
|
||||||
//use the dates class to calculate dates
|
//use the dates class to calculate dates
|
||||||
$dates = new dates();
|
$dates = new dates();
|
||||||
$iDueDate = $dates->calculateDate(
|
$iDueDate = $dates->calculateDate( $this->getDelDelegateDate(), $aData['TAS_DURATION'], $aData['TAS_TIMEUNIT'], //hours or days, ( we only accept this two types or maybe weeks
|
||||||
$this->getDelDelegateDate(),
|
|
||||||
$aData['TAS_DURATION'],
|
|
||||||
$aData['TAS_TIMEUNIT'], //hours or days, ( we only accept this two types or maybe weeks
|
|
||||||
$aData['TAS_TYPE_DAY'], //working or calendar days
|
$aData['TAS_TYPE_DAY'], //working or calendar days
|
||||||
$this->getUsrUid(),
|
$this->getUsrUid(), $task->getProUid(), $aData['TAS_UID'], $aCalendarUID );
|
||||||
$task->getProUid(),
|
|
||||||
$aData['TAS_UID'],
|
|
||||||
$aCalendarUID
|
|
||||||
);
|
|
||||||
|
|
||||||
return $iDueDate;
|
return $iDueDate;
|
||||||
}
|
}
|
||||||
@@ -297,10 +288,11 @@ class AppDelegation extends BaseAppDelegation {
|
|||||||
$c->addSelectColumn( AppDelegationPeer::DEL_INDEX );
|
$c->addSelectColumn( AppDelegationPeer::DEL_INDEX );
|
||||||
$c->addSelectColumn( AppDelegationPeer::DEL_DELEGATE_DATE );
|
$c->addSelectColumn( AppDelegationPeer::DEL_DELEGATE_DATE );
|
||||||
$c->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE );
|
$c->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE );
|
||||||
$c->add(AppDelegationPeer::DEL_INIT_DATE, NULL, Criteria::ISNULL);
|
$c->add( AppDelegationPeer::DEL_INIT_DATE, null, Criteria::ISNULL );
|
||||||
$c->add(AppDelegationPeer::DEL_FINISH_DATE, NULL, Criteria::ISNOTNULL);
|
$c->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNOTNULL );
|
||||||
//$c->add(AppDelegationPeer::DEL_INDEX, 1);
|
//$c->add(AppDelegationPeer::DEL_INDEX, 1);
|
||||||
|
|
||||||
|
|
||||||
$rs = AppDelegationPeer::doSelectRS( $c );
|
$rs = AppDelegationPeer::doSelectRS( $c );
|
||||||
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
$rs->next();
|
$rs->next();
|
||||||
@@ -314,10 +306,11 @@ class AppDelegation extends BaseAppDelegation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$oAppDel = AppDelegationPeer::retrieveByPk( $row['APP_UID'], $row['DEL_INDEX'] );
|
$oAppDel = AppDelegationPeer::retrieveByPk( $row['APP_UID'], $row['DEL_INDEX'] );
|
||||||
if ( isset ($row['DEL_FINISH_DATE']) )
|
if (isset( $row['DEL_FINISH_DATE'] )) {
|
||||||
$oAppDel->setDelInitDate( $row['DEL_FINISH_DATE'] );
|
$oAppDel->setDelInitDate( $row['DEL_FINISH_DATE'] );
|
||||||
else
|
} else {
|
||||||
$oAppDel->setDelInitDate( $row['DEL_INIT_DATE'] );
|
$oAppDel->setDelInitDate( $row['DEL_INIT_DATE'] );
|
||||||
|
}
|
||||||
$oAppDel->save();
|
$oAppDel->save();
|
||||||
|
|
||||||
$rs->next();
|
$rs->next();
|
||||||
@@ -325,6 +318,7 @@ class AppDelegation extends BaseAppDelegation {
|
|||||||
}
|
}
|
||||||
//walk in all rows with DEL_STARTED = 0 or DEL_FINISHED = 0
|
//walk in all rows with DEL_STARTED = 0 or DEL_FINISHED = 0
|
||||||
|
|
||||||
|
|
||||||
$c = new Criteria( 'workflow' );
|
$c = new Criteria( 'workflow' );
|
||||||
$c->clearSelectColumns();
|
$c->clearSelectColumns();
|
||||||
$c->addSelectColumn( AppDelegationPeer::APP_UID );
|
$c->addSelectColumn( AppDelegationPeer::APP_UID );
|
||||||
@@ -348,6 +342,7 @@ class AppDelegation extends BaseAppDelegation {
|
|||||||
//$c->add(AppDelegationPeer::APP_UID, '7694483844a37bfeb0931b1063501289');
|
//$c->add(AppDelegationPeer::APP_UID, '7694483844a37bfeb0931b1063501289');
|
||||||
//$c->add(AppDelegationPeer::DEL_STARTED, 0);
|
//$c->add(AppDelegationPeer::DEL_STARTED, 0);
|
||||||
|
|
||||||
|
|
||||||
$cton1 = $c->getNewCriterion( AppDelegationPeer::DEL_STARTED, 0 );
|
$cton1 = $c->getNewCriterion( AppDelegationPeer::DEL_STARTED, 0 );
|
||||||
$cton2 = $c->getNewCriterion( AppDelegationPeer::DEL_FINISHED, 0 );
|
$cton2 = $c->getNewCriterion( AppDelegationPeer::DEL_FINISHED, 0 );
|
||||||
$cton1->addOR( $cton2 );
|
$cton1->addOR( $cton2 );
|
||||||
@@ -361,6 +356,7 @@ class AppDelegation extends BaseAppDelegation {
|
|||||||
//print "<table colspacing='2' border='1'>";
|
//print "<table colspacing='2' border='1'>";
|
||||||
//print "<tr><td>iDelegateDate </td><td>iInitDate </td><td>iDueDate </td><td>iFinishDate </td><td>isStarted </td><td>isFinished </td><td>isDelayed </td><td>queueDuration </td><td>delDuration </td><td>delayDuration</td></tr>";
|
//print "<tr><td>iDelegateDate </td><td>iInitDate </td><td>iDueDate </td><td>iFinishDate </td><td>isStarted </td><td>isFinished </td><td>isDelayed </td><td>queueDuration </td><td>delDuration </td><td>delayDuration</td></tr>";
|
||||||
|
|
||||||
|
|
||||||
$now = strtotime( 'now' );
|
$now = strtotime( 'now' );
|
||||||
while (is_array( $row )) {
|
while (is_array( $row )) {
|
||||||
if ($cron == 1) {
|
if ($cron == 1) {
|
||||||
@@ -386,12 +382,12 @@ class AppDelegation extends BaseAppDelegation {
|
|||||||
|
|
||||||
//if the task is not started
|
//if the task is not started
|
||||||
if ($isStarted == 0) {
|
if ($isStarted == 0) {
|
||||||
if ( $row['DEL_INIT_DATE'] != NULL && $row['DEL_INIT_DATE'] != '' ) {
|
if ($row['DEL_INIT_DATE'] != null && $row['DEL_INIT_DATE'] != '') {
|
||||||
$oAppDel->setDelStarted( 1 );
|
$oAppDel->setDelStarted( 1 );
|
||||||
$queueDuration = $this->getDiffDate( $iInitDate, $iDelegateDate );
|
$queueDuration = $this->getDiffDate( $iInitDate, $iDelegateDate );
|
||||||
$oAppDel->setDelQueueDuration( $queueDuration );
|
$oAppDel->setDelQueueDuration( $queueDuration );
|
||||||
}
|
} else {
|
||||||
else {//the task was not started
|
//the task was not started
|
||||||
$queueDuration = $this->getDiffDate( $now, $iDelegateDate );
|
$queueDuration = $this->getDiffDate( $now, $iDelegateDate );
|
||||||
$oAppDel->setDelQueueDuration( $queueDuration );
|
$oAppDel->setDelQueueDuration( $queueDuration );
|
||||||
|
|
||||||
@@ -410,7 +406,7 @@ class AppDelegation extends BaseAppDelegation {
|
|||||||
|
|
||||||
//if the task was not finished
|
//if the task was not finished
|
||||||
if ($isFinished == 0) {
|
if ($isFinished == 0) {
|
||||||
if ( $row['DEL_FINISH_DATE'] != NULL && $row['DEL_FINISH_DATE'] != '') {
|
if ($row['DEL_FINISH_DATE'] != null && $row['DEL_FINISH_DATE'] != '') {
|
||||||
$oAppDel->setAppOverduePercentage( $overduePercentage );
|
$oAppDel->setAppOverduePercentage( $overduePercentage );
|
||||||
$oAppDel->setDelFinished( 1 );
|
$oAppDel->setDelFinished( 1 );
|
||||||
|
|
||||||
@@ -420,18 +416,17 @@ class AppDelegation extends BaseAppDelegation {
|
|||||||
if ($iDueDate < $iFinishDate) {
|
if ($iDueDate < $iFinishDate) {
|
||||||
$oAppDel->setDelDelayed( 1 );
|
$oAppDel->setDelDelayed( 1 );
|
||||||
$delayDuration = $this->getDiffDate( $iFinishDate, $iDueDate );
|
$delayDuration = $this->getDiffDate( $iFinishDate, $iDueDate );
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$oAppDel->setDelDelayed( 0 );
|
$oAppDel->setDelDelayed( 0 );
|
||||||
$delayDuration = 0;
|
$delayDuration = 0;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else { //the task was not completed
|
//the task was not completed
|
||||||
if ( $row['DEL_INIT_DATE'] != NULL && $row['DEL_INIT_DATE'] != '' ) {
|
if ($row['DEL_INIT_DATE'] != null && $row['DEL_INIT_DATE'] != '') {
|
||||||
$delDuration = $this->getDiffDate( $now, $iInitDate );
|
$delDuration = $this->getDiffDate( $now, $iInitDate );
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
$delDuration = $this->getDiffDate( $now, $iDelegateDate );
|
$delDuration = $this->getDiffDate( $now, $iDelegateDate );
|
||||||
|
}
|
||||||
$oAppDel->setDelDuration( $delDuration );
|
$oAppDel->setDelDuration( $delDuration );
|
||||||
|
|
||||||
//we are putting negative number if the task is not delayed, and positive number for the time the task is delayed
|
//we are putting negative number if the task is not delayed, and positive number for the time the task is delayed
|
||||||
@@ -453,6 +448,7 @@ class AppDelegation extends BaseAppDelegation {
|
|||||||
//print "<tr><td>$iDelegateDate </td><td>$iInitDate </td><td>$iDueDate </td><td>$iFinishDate </td><td>$isStarted </td><td>$isFinished </td><td>$isDelayed</td><td>$queueDuration </td><td>$delDuration </td>" .
|
//print "<tr><td>$iDelegateDate </td><td>$iInitDate </td><td>$iDueDate </td><td>$iFinishDate </td><td>$isStarted </td><td>$isFinished </td><td>$isDelayed</td><td>$queueDuration </td><td>$delDuration </td>" .
|
||||||
// "<td>$delayDuration</td><td>$overduePercentage</td><td>" . $row['DEL_INDEX'] . " $RES </td></tr>";
|
// "<td>$delayDuration</td><td>$overduePercentage</td><td>" . $row['DEL_INDEX'] . " $RES </td></tr>";
|
||||||
|
|
||||||
|
|
||||||
//UPDATE APP_DELEGATION SET DEL_DELAYED = 0
|
//UPDATE APP_DELEGATION SET DEL_DELAYED = 0
|
||||||
//where
|
//where
|
||||||
// APP_OVERDUE_PERCENTAGE < 0
|
// APP_OVERDUE_PERCENTAGE < 0
|
||||||
@@ -460,13 +456,13 @@ class AppDelegation extends BaseAppDelegation {
|
|||||||
$row = $rs->getRow();
|
$row = $rs->getRow();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
error_log( $oError->getMessage() );
|
error_log( $oError->getMessage() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLastDeleration($APP_UID){
|
function getLastDeleration ($APP_UID)
|
||||||
|
{
|
||||||
$c = new Criteria( 'workflow' );
|
$c = new Criteria( 'workflow' );
|
||||||
$c->addSelectColumn( AppDelegationPeer::APP_UID );
|
$c->addSelectColumn( AppDelegationPeer::APP_UID );
|
||||||
$c->addSelectColumn( AppDelegationPeer::DEL_INDEX );
|
$c->addSelectColumn( AppDelegationPeer::DEL_INDEX );
|
||||||
@@ -489,4 +485,6 @@ class AppDelegation extends BaseAppDelegation {
|
|||||||
$rs->next();
|
$rs->next();
|
||||||
return $rs->getRow();
|
return $rs->getRow();
|
||||||
}
|
}
|
||||||
} // AppDelegation
|
}
|
||||||
|
// AppDelegation
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Dynaform.php
|
* Dynaform.php
|
||||||
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
@@ -40,15 +41,18 @@ G::LoadClass('dynaFormField');
|
|||||||
*
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
class Dynaform extends BaseDynaform {
|
class Dynaform extends BaseDynaform
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* This value goes in the content table
|
* This value goes in the content table
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $dyn_title = '';
|
protected $dyn_title = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [Dyn_title] column value.
|
* Get the [Dyn_title] column value.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getDynTitle ()
|
public function getDynTitle ()
|
||||||
@@ -87,14 +91,17 @@ class Dynaform extends BaseDynaform {
|
|||||||
|
|
||||||
} // set()
|
} // set()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This value goes in the content table
|
* This value goes in the content table
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $dyn_description = '';
|
protected $dyn_description = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [Dyn_description] column value.
|
* Get the [Dyn_description] column value.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getDynDescription ()
|
public function getDynDescription ()
|
||||||
@@ -133,6 +140,7 @@ class Dynaform extends BaseDynaform {
|
|||||||
|
|
||||||
} // set()
|
} // set()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the Dynaform
|
* Creates the Dynaform
|
||||||
*
|
*
|
||||||
@@ -142,18 +150,21 @@ class Dynaform extends BaseDynaform {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function create ($aData ) {
|
function create ($aData)
|
||||||
|
{
|
||||||
if (! isset( $aData['PRO_UID'] )) {
|
if (! isset( $aData['PRO_UID'] )) {
|
||||||
throw (new PropelException( 'The dynaform cannot be created. The PRO_UID is empty.' ));
|
throw (new PropelException( 'The dynaform cannot be created. The PRO_UID is empty.' ));
|
||||||
}
|
}
|
||||||
$con = Propel::getConnection( DynaformPeer::DATABASE_NAME );
|
$con = Propel::getConnection( DynaformPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
if ( isset ( $aData['DYN_UID'] ) && $aData['DYN_UID']== '' )
|
if (isset( $aData['DYN_UID'] ) && $aData['DYN_UID'] == '') {
|
||||||
unset( $aData['DYN_UID'] );
|
unset( $aData['DYN_UID'] );
|
||||||
if ( !isset ( $aData['DYN_UID'] ) )
|
}
|
||||||
|
if (! isset( $aData['DYN_UID'] )) {
|
||||||
$dynUid = (G::generateUniqueID());
|
$dynUid = (G::generateUniqueID());
|
||||||
else
|
} else {
|
||||||
$dynUid = $aData['DYN_UID'];
|
$dynUid = $aData['DYN_UID'];
|
||||||
|
}
|
||||||
$this->setDynUid( $dynUid );
|
$this->setDynUid( $dynUid );
|
||||||
$this->setProUid( $aData['PRO_UID'] );
|
$this->setProUid( $aData['PRO_UID'] );
|
||||||
$this->setDynType( isset( $aData['DYN_TYPE'] ) ? $aData['DYN_TYPE'] : 'xmlform' );
|
$this->setDynType( isset( $aData['DYN_TYPE'] ) ? $aData['DYN_TYPE'] : 'xmlform' );
|
||||||
@@ -163,15 +174,17 @@ class Dynaform extends BaseDynaform {
|
|||||||
$con->begin();
|
$con->begin();
|
||||||
$res = $this->save();
|
$res = $this->save();
|
||||||
|
|
||||||
if (isset ( $aData['DYN_TITLE'] ) )
|
if (isset( $aData['DYN_TITLE'] )) {
|
||||||
$this->setDynTitle( $aData['DYN_TITLE'] );
|
$this->setDynTitle( $aData['DYN_TITLE'] );
|
||||||
else
|
} else {
|
||||||
$this->setDynTitle( 'Default Dynaform Title' );
|
$this->setDynTitle( 'Default Dynaform Title' );
|
||||||
|
}
|
||||||
|
|
||||||
if (isset ( $aData['DYN_DESCRIPTION'] ) )
|
if (isset( $aData['DYN_DESCRIPTION'] )) {
|
||||||
$this->setDynDescription( $aData['DYN_DESCRIPTION'] );
|
$this->setDynDescription( $aData['DYN_DESCRIPTION'] );
|
||||||
else
|
} else {
|
||||||
$this->setDynDescription( 'Default Dynaform Description' );
|
$this->setDynDescription( 'Default Dynaform Description' );
|
||||||
|
}
|
||||||
|
|
||||||
$con->commit();
|
$con->commit();
|
||||||
$sXml = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
|
$sXml = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
|
||||||
@@ -182,22 +195,22 @@ class Dynaform extends BaseDynaform {
|
|||||||
fwrite( $oFile, $sXml );
|
fwrite( $oFile, $sXml );
|
||||||
fclose( $oFile );
|
fclose( $oFile );
|
||||||
return $this->getDynUid();
|
return $this->getDynUid();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$msg = '';
|
$msg = '';
|
||||||
foreach($this->getValidationFailures() as $objValidationFailure)
|
foreach ($this->getValidationFailures() as $objValidationFailure) {
|
||||||
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
||||||
|
}
|
||||||
throw (new PropelException( 'The row cannot be created!', new PropelException( $msg ) ));
|
throw (new PropelException( 'The row cannot be created!', new PropelException( $msg ) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch (Exception $e) {
|
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
throw ($e);
|
throw ($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* Creates a Dynaform based on a PMTable
|
* Creates a Dynaform based on a PMTable
|
||||||
*
|
*
|
||||||
@@ -210,7 +223,8 @@ class Dynaform extends BaseDynaform {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function createFromPMTable ( $aData, $pmTableUid ) {
|
function createFromPMTable ($aData, $pmTableUid)
|
||||||
|
{
|
||||||
$this->create( $aData );
|
$this->create( $aData );
|
||||||
$aData['DYN_UID'] = $this->getDynUid();
|
$aData['DYN_UID'] = $this->getDynUid();
|
||||||
//krumo(BasePeer::getFieldnames('Content'));
|
//krumo(BasePeer::getFieldnames('Content'));
|
||||||
@@ -221,11 +235,12 @@ class Dynaform extends BaseDynaform {
|
|||||||
$keys = '';
|
$keys = '';
|
||||||
if (isset( $aData['FIELDS'] )) {
|
if (isset( $aData['FIELDS'] )) {
|
||||||
foreach ($aData['FIELDS'] as $iRow => $row) {
|
foreach ($aData['FIELDS'] as $iRow => $row) {
|
||||||
if ($keys!='')
|
if ($keys != '') {
|
||||||
$keys = $keys . '|' . $row['PRO_VARIABLE'];
|
$keys = $keys . '|' . $row['PRO_VARIABLE'];
|
||||||
else
|
} else {
|
||||||
$keys = $row['PRO_VARIABLE'];
|
$keys = $row['PRO_VARIABLE'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$keys = ' ';
|
$keys = ' ';
|
||||||
}
|
}
|
||||||
@@ -242,6 +257,7 @@ class Dynaform extends BaseDynaform {
|
|||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
// Determines the engine to use
|
// Determines the engine to use
|
||||||
// For a description of a table
|
// For a description of a table
|
||||||
$sDataBase = 'database_' . strtolower( DB_ADAPTER );
|
$sDataBase = 'database_' . strtolower( DB_ADAPTER );
|
||||||
@@ -267,7 +283,8 @@ class Dynaform extends BaseDynaform {
|
|||||||
if ($aData['DYN_TYPE'] == 'xmlform') {
|
if ($aData['DYN_TYPE'] == 'xmlform') {
|
||||||
$labels = array ();
|
$labels = array ();
|
||||||
$options = array ();
|
$options = array ();
|
||||||
$attributes = array('XMLNODE_NAME_OLD' => '', 'XMLNODE_NAME' => $pmConnectionName, 'TYPE' => 'pmconnection', 'PMTABLE' => $pmTableUid, 'KEYS'=>$keys);
|
$attributes = array ('XMLNODE_NAME_OLD' => '','XMLNODE_NAME' => $pmConnectionName,'TYPE' => 'pmconnection','PMTABLE' => $pmTableUid,'KEYS' => $keys
|
||||||
|
);
|
||||||
$fieldXML->Save( $attributes, $labels, $options );
|
$fieldXML->Save( $attributes, $labels, $options );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,7 +316,8 @@ class Dynaform extends BaseDynaform {
|
|||||||
}
|
}
|
||||||
$fieldName = $res->get( 'Field' );
|
$fieldName = $res->get( 'Field' );
|
||||||
$defaultValue = $res->get( 'Default' );
|
$defaultValue = $res->get( 'Default' );
|
||||||
$labels = array ( SYS_LANG => $fieldName );
|
$labels = array (SYS_LANG => $fieldName
|
||||||
|
);
|
||||||
$options = array ();
|
$options = array ();
|
||||||
$type = explode( '(', $res->get( 'Type' ) );
|
$type = explode( '(', $res->get( 'Type' ) );
|
||||||
|
|
||||||
@@ -315,30 +333,21 @@ class Dynaform extends BaseDynaform {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ($aData['DYN_TYPE'] == 'xmlform') {
|
if ($aData['DYN_TYPE'] == 'xmlform') {
|
||||||
$attributes = array(
|
$attributes = array ('XMLNODE_NAME_OLD' => '','XMLNODE_NAME' => $fieldName,'TYPE' => $type,'PMCONNECTION' => $pmConnectionName,'PMFIELD' => $fieldName,'REQUIRED' => $required,'DEFAULTVALUE' => $defaultValue
|
||||||
'XMLNODE_NAME_OLD' => '',
|
|
||||||
'XMLNODE_NAME' => $fieldName,
|
|
||||||
'TYPE' => $type,
|
|
||||||
'PMCONNECTION' => $pmConnectionName,
|
|
||||||
'PMFIELD' => $fieldName,
|
|
||||||
'REQUIRED' => $required,
|
|
||||||
'DEFAULTVALUE' => $defaultValue
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$attributes = array(
|
$attributes = array ('XMLNODE_NAME_OLD' => '','XMLNODE_NAME' => $fieldName,'TYPE' => $type,'REQUIRED' => $required,'DEFAULTVALUE' => $defaultValue
|
||||||
'XMLNODE_NAME_OLD' => '',
|
|
||||||
'XMLNODE_NAME' => $fieldName,
|
|
||||||
'TYPE' => $type,
|
|
||||||
'REQUIRED' => $required,
|
|
||||||
'DEFAULTVALUE' => $defaultValue
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$fieldXML->Save( $attributes, $labels, $options );
|
$fieldXML->Save( $attributes, $labels, $options );
|
||||||
}
|
}
|
||||||
$labels = array ( SYS_LANG => 'Submit' );
|
$labels = array (SYS_LANG => 'Submit'
|
||||||
$attributes = array('XMLNODE_NAME_OLD' => '', 'XMLNODE_NAME' => 'SUBMIT', 'TYPE' => 'submit');
|
);
|
||||||
|
$attributes = array ('XMLNODE_NAME_OLD' => '','XMLNODE_NAME' => 'SUBMIT','TYPE' => 'submit'
|
||||||
|
);
|
||||||
$fieldXML->Save( $attributes, $labels, $options );
|
$fieldXML->Save( $attributes, $labels, $options );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the Dynaform row specified in [dyn_id] column value.
|
* Load the Dynaform row specified in [dyn_id] column value.
|
||||||
*
|
*
|
||||||
@@ -346,7 +355,8 @@ class Dynaform extends BaseDynaform {
|
|||||||
* @return array $Fields the fields
|
* @return array $Fields the fields
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function Load ( $ProUid ) {
|
function Load ($ProUid)
|
||||||
|
{
|
||||||
$con = Propel::getConnection( DynaformPeer::DATABASE_NAME );
|
$con = Propel::getConnection( DynaformPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oPro = DynaformPeer::retrieveByPk( $ProUid );
|
$oPro = DynaformPeer::retrieveByPk( $ProUid );
|
||||||
@@ -358,21 +368,21 @@ class Dynaform extends BaseDynaform {
|
|||||||
$this->setDynTitle( $oPro->getDynTitle() );
|
$this->setDynTitle( $oPro->getDynTitle() );
|
||||||
$this->setDynDescription( $oPro->getDynDescription() );
|
$this->setDynDescription( $oPro->getDynDescription() );
|
||||||
return $aFields;
|
return $aFields;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw (new Exception( "The row '$ProUid' in table Dynaform doesn't exist!" ));
|
throw (new Exception( "The row '$ProUid' in table Dynaform doesn't exist!" ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the Prolication row
|
* Update the Prolication row
|
||||||
|
*
|
||||||
* @param array $aData
|
* @param array $aData
|
||||||
* @return variant
|
* @return variant
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
public function update ($aData)
|
public function update ($aData)
|
||||||
{
|
{
|
||||||
@@ -383,35 +393,37 @@ class Dynaform extends BaseDynaform {
|
|||||||
if (is_object( $oPro ) && get_class( $oPro ) == 'Dynaform') {
|
if (is_object( $oPro ) && get_class( $oPro ) == 'Dynaform') {
|
||||||
$oPro->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
$oPro->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
if ($oPro->validate()) {
|
if ($oPro->validate()) {
|
||||||
if ( isset ( $aData['DYN_TITLE'] ) )
|
if (isset( $aData['DYN_TITLE'] )) {
|
||||||
$oPro->setDynTitle( $aData['DYN_TITLE'] );
|
$oPro->setDynTitle( $aData['DYN_TITLE'] );
|
||||||
if ( isset ( $aData['DYN_DESCRIPTION'] ) )
|
}
|
||||||
|
if (isset( $aData['DYN_DESCRIPTION'] )) {
|
||||||
$oPro->setDynDescription( $aData['DYN_DESCRIPTION'] );
|
$oPro->setDynDescription( $aData['DYN_DESCRIPTION'] );
|
||||||
|
}
|
||||||
$res = $oPro->save();
|
$res = $oPro->save();
|
||||||
$con->commit();
|
$con->commit();
|
||||||
return $res;
|
return $res;
|
||||||
}
|
} else {
|
||||||
else {
|
foreach ($this->getValidationFailures() as $objValidationFailure) {
|
||||||
foreach($this->getValidationFailures() as $objValidationFailure)
|
|
||||||
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
||||||
|
}
|
||||||
throw (new PropelException( 'The row cannot be created!', new PropelException( $msg ) ));
|
throw (new PropelException( 'The row cannot be created!', new PropelException( $msg ) ));
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
throw (new Exception( "The row '" . $aData['DYN_UID'] . "' in table Dynaform doesn't exist!" ));
|
throw (new Exception( "The row '" . $aData['DYN_UID'] . "' in table Dynaform doesn't exist!" ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the Prolication document registry
|
* Remove the Prolication document registry
|
||||||
|
*
|
||||||
* @param array $aData or string $ProUid
|
* @param array $aData or string $ProUid
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
public function remove ($ProUid)
|
public function remove ($ProUid)
|
||||||
{
|
{
|
||||||
if (is_array( $ProUid )) {
|
if (is_array( $ProUid )) {
|
||||||
@@ -419,8 +431,7 @@ class Dynaform extends BaseDynaform {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$oPro = DynaformPeer::retrieveByPK( $ProUid );
|
$oPro = DynaformPeer::retrieveByPK( $ProUid );
|
||||||
if (!is_null($oPro))
|
if (! is_null( $oPro )) {
|
||||||
{
|
|
||||||
Content::removeContent( 'DYN_TITLE', '', $oPro->getDynUid() );
|
Content::removeContent( 'DYN_TITLE', '', $oPro->getDynUid() );
|
||||||
Content::removeContent( 'DYN_DESCRIPTION', '', $oPro->getDynUid() );
|
Content::removeContent( 'DYN_DESCRIPTION', '', $oPro->getDynUid() );
|
||||||
$iResult = $oPro->delete();
|
$iResult = $oPro->delete();
|
||||||
@@ -437,12 +448,10 @@ class Dynaform extends BaseDynaform {
|
|||||||
unlink( PATH_DYNAFORM . $oPro->getProUid() . PATH_SEP . $oPro->getDynUid() . '_tmp0.html' );
|
unlink( PATH_DYNAFORM . $oPro->getProUid() . PATH_SEP . $oPro->getDynUid() . '_tmp0.html' );
|
||||||
}
|
}
|
||||||
return $iResult;
|
return $iResult;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw (new Exception( "The row '$ProUid' in table Dynaform doesn't exist!" ));
|
throw (new Exception( "The row '$ProUid' in table Dynaform doesn't exist!" ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -459,23 +468,23 @@ class Dynaform extends BaseDynaform {
|
|||||||
* @param string $sProUid the uid of the Prolication
|
* @param string $sProUid the uid of the Prolication
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function dynaformExists ( $DynUid ) {
|
function dynaformExists ($DynUid)
|
||||||
|
{
|
||||||
$con = Propel::getConnection( TaskPeer::DATABASE_NAME );
|
$con = Propel::getConnection( TaskPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oDyn = DynaformPeer::retrieveByPk( $DynUid );
|
$oDyn = DynaformPeer::retrieveByPk( $DynUid );
|
||||||
if (is_object( $oDyn ) && get_class( $oDyn ) == 'Dynaform') {
|
if (is_object( $oDyn ) && get_class( $oDyn ) == 'Dynaform') {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDynaformContent( $dynaformUid) {
|
function getDynaformContent ($dynaformUid)
|
||||||
|
{
|
||||||
$content = '';
|
$content = '';
|
||||||
$fields = $this->Load( $dynaformUid );
|
$fields = $this->Load( $dynaformUid );
|
||||||
$filename = PATH_DYNAFORM . $fields['PRO_UID'] . PATH_SEP . $fields['DYN_UID'] . '.xml';
|
$filename = PATH_DYNAFORM . $fields['PRO_UID'] . PATH_SEP . $fields['DYN_UID'] . '.xml';
|
||||||
@@ -486,7 +495,8 @@ class Dynaform extends BaseDynaform {
|
|||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDynaformFields( $dynaformUid) {
|
function getDynaformFields ($dynaformUid)
|
||||||
|
{
|
||||||
$content = '';
|
$content = '';
|
||||||
$fields = $this->Load( $dynaformUid );
|
$fields = $this->Load( $dynaformUid );
|
||||||
$filename = PATH_DYNAFORM . $fields['PRO_UID'] . PATH_SEP . $fields['DYN_UID'] . '.xml';
|
$filename = PATH_DYNAFORM . $fields['PRO_UID'] . PATH_SEP . $fields['DYN_UID'] . '.xml';
|
||||||
@@ -500,7 +510,8 @@ class Dynaform extends BaseDynaform {
|
|||||||
return $G_FORM->fields;
|
return $G_FORM->fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
function verifyExistingName($sName,$sProUid){
|
function verifyExistingName ($sName, $sProUid)
|
||||||
|
{
|
||||||
$sNameDyanform = urldecode( $sName );
|
$sNameDyanform = urldecode( $sName );
|
||||||
$sProUid = urldecode( $sProUid );
|
$sProUid = urldecode( $sProUid );
|
||||||
$oCriteria = new Criteria( 'workflow' );
|
$oCriteria = new Criteria( 'workflow' );
|
||||||
@@ -528,5 +539,6 @@ class Dynaform extends BaseDynaform {
|
|||||||
}
|
}
|
||||||
return $flag;
|
return $flag;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// Dynaform
|
||||||
|
|
||||||
} // Dynaform
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Groupwf.php
|
* Groupwf.php
|
||||||
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
@@ -38,9 +39,11 @@ require_once 'classes/model/Content.php';
|
|||||||
*
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
class Groupwf extends BaseGroupwf {
|
class Groupwf extends BaseGroupwf
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* This value goes in the content table
|
* This value goes in the content table
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
//protected $grp_title = '';
|
//protected $grp_title = '';
|
||||||
@@ -48,6 +51,7 @@ class Groupwf extends BaseGroupwf {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [grp_title] column value.
|
* Get the [grp_title] column value.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getGrpTitle ()
|
public function getGrpTitle ()
|
||||||
@@ -85,6 +89,7 @@ class Groupwf extends BaseGroupwf {
|
|||||||
|
|
||||||
} // set()
|
} // set()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the Group
|
* Creates the Group
|
||||||
*
|
*
|
||||||
@@ -92,47 +97,51 @@ class Groupwf extends BaseGroupwf {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function create ($aData ) {
|
function create ($aData)
|
||||||
|
{
|
||||||
//$oData is not necessary
|
//$oData is not necessary
|
||||||
$con = Propel::getConnection( GroupwfPeer::DATABASE_NAME );
|
$con = Propel::getConnection( GroupwfPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
if ( isset ( $aData['GRP_UID'] ) )
|
if (isset( $aData['GRP_UID'] )) {
|
||||||
$this->setGrpUid( $aData['GRP_UID'] );
|
$this->setGrpUid( $aData['GRP_UID'] );
|
||||||
else
|
} else {
|
||||||
$this->setGrpUid( G::generateUniqueID() );
|
$this->setGrpUid( G::generateUniqueID() );
|
||||||
|
}
|
||||||
|
|
||||||
if ( isset ( $aData['GRP_STATUS'] ) )
|
if (isset( $aData['GRP_STATUS'] )) {
|
||||||
$this->setGrpStatus( $aData['GRP_STATUS'] );
|
$this->setGrpStatus( $aData['GRP_STATUS'] );
|
||||||
else
|
} else {
|
||||||
$this->setGrpStatus( 'ACTIVE' );
|
$this->setGrpStatus( 'ACTIVE' );
|
||||||
|
}
|
||||||
|
|
||||||
if ( isset ( $aData['GRP_LDAP_DN'] ) )
|
if (isset( $aData['GRP_LDAP_DN'] )) {
|
||||||
$this->setGrpLdapDn( $aData['GRP_LDAP_DN'] );
|
$this->setGrpLdapDn( $aData['GRP_LDAP_DN'] );
|
||||||
else
|
} else {
|
||||||
$this->setGrpLdapDn( '' );
|
$this->setGrpLdapDn( '' );
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->validate()) {
|
if ($this->validate()) {
|
||||||
$con->begin();
|
$con->begin();
|
||||||
$res = $this->save();
|
$res = $this->save();
|
||||||
|
|
||||||
if (isset ( $aData['GRP_TITLE'] ) )
|
if (isset( $aData['GRP_TITLE'] )) {
|
||||||
$this->setGrpTitle( $aData['GRP_TITLE'] );
|
$this->setGrpTitle( $aData['GRP_TITLE'] );
|
||||||
else
|
} else {
|
||||||
$this->setGrpTitle( 'Default Group Title' );
|
$this->setGrpTitle( 'Default Group Title' );
|
||||||
|
}
|
||||||
|
|
||||||
$con->commit();
|
$con->commit();
|
||||||
return $this->getGrpUid();
|
return $this->getGrpUid();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$msg = '';
|
$msg = '';
|
||||||
foreach($this->getValidationFailures() as $objValidationFailure)
|
foreach ($this->getValidationFailures() as $objValidationFailure) {
|
||||||
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
||||||
|
}
|
||||||
|
|
||||||
throw (new PropelException( 'The row cannot be created!', new PropelException( $msg ) ));
|
throw (new PropelException( 'The row cannot be created!', new PropelException( $msg ) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch (Exception $e) {
|
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
throw ($e);
|
throw ($e);
|
||||||
}
|
}
|
||||||
@@ -145,7 +154,8 @@ class Groupwf extends BaseGroupwf {
|
|||||||
* @return array $Fields the fields
|
* @return array $Fields the fields
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function Load ( $ProUid ) {
|
function Load ($ProUid)
|
||||||
|
{
|
||||||
$con = Propel::getConnection( GroupwfPeer::DATABASE_NAME );
|
$con = Propel::getConnection( GroupwfPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oPro = GroupwfPeer::retrieveByPk( $ProUid );
|
$oPro = GroupwfPeer::retrieveByPk( $ProUid );
|
||||||
@@ -155,21 +165,21 @@ class Groupwf extends BaseGroupwf {
|
|||||||
$aFields['GRP_TITLE'] = $oPro->getGrpTitle();
|
$aFields['GRP_TITLE'] = $oPro->getGrpTitle();
|
||||||
$this->setGrpTitle( $oPro->getGrpTitle() );
|
$this->setGrpTitle( $oPro->getGrpTitle() );
|
||||||
return $aFields;
|
return $aFields;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw (new Exception( "The row '$ProUid' in table Group doesn't exist!" ));
|
throw (new Exception( "The row '$ProUid' in table Group doesn't exist!" ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the Group row
|
* Update the Group row
|
||||||
|
*
|
||||||
* @param array $aData
|
* @param array $aData
|
||||||
* @return variant
|
* @return variant
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
public function update ($aData)
|
public function update ($aData)
|
||||||
{
|
{
|
||||||
@@ -180,35 +190,36 @@ class Groupwf extends BaseGroupwf {
|
|||||||
if (is_object( $oPro ) && get_class( $oPro ) == 'Groupwf') {
|
if (is_object( $oPro ) && get_class( $oPro ) == 'Groupwf') {
|
||||||
$oPro->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
$oPro->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
if ($oPro->validate()) {
|
if ($oPro->validate()) {
|
||||||
if ( isset ( $aData['GRP_TITLE'] ) )
|
if (isset( $aData['GRP_TITLE'] )) {
|
||||||
$oPro->setGrpTitle( $aData['GRP_TITLE'] );
|
$oPro->setGrpTitle( $aData['GRP_TITLE'] );
|
||||||
|
}
|
||||||
$res = $oPro->save();
|
$res = $oPro->save();
|
||||||
$con->commit();
|
$con->commit();
|
||||||
return $res;
|
return $res;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$msg = '';
|
$msg = '';
|
||||||
foreach($this->getValidationFailures() as $objValidationFailure)
|
foreach ($this->getValidationFailures() as $objValidationFailure) {
|
||||||
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
||||||
|
}
|
||||||
|
|
||||||
throw (new PropelException( 'The row cannot be created!', new PropelException( $msg ) ));
|
throw (new PropelException( 'The row cannot be created!', new PropelException( $msg ) ));
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
throw (new Exception( "The row '" . $aData['GRP_UID'] . "' in table Group doesn't exist!" ));
|
throw (new Exception( "The row '" . $aData['GRP_UID'] . "' in table Group doesn't exist!" ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the Prolication document registry
|
* Remove the Prolication document registry
|
||||||
|
*
|
||||||
* @param array $aData or string $ProUid
|
* @param array $aData or string $ProUid
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
public function remove ($ProUid)
|
public function remove ($ProUid)
|
||||||
{
|
{
|
||||||
if (is_array( $ProUid )) {
|
if (is_array( $ProUid )) {
|
||||||
@@ -216,17 +227,14 @@ class Groupwf extends BaseGroupwf {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$oPro = GroupwfPeer::retrieveByPK( $ProUid );
|
$oPro = GroupwfPeer::retrieveByPK( $ProUid );
|
||||||
if (!is_null($oPro))
|
if (! is_null( $oPro )) {
|
||||||
{
|
|
||||||
Content::removeContent( 'GRP_TITLE', '', $oPro->getGrpUid() );
|
Content::removeContent( 'GRP_TITLE', '', $oPro->getGrpUid() );
|
||||||
Content::removeContent( 'GRP_DESCRIPTION', '', $oPro->getGrpUid() );
|
Content::removeContent( 'GRP_DESCRIPTION', '', $oPro->getGrpUid() );
|
||||||
return $oPro->delete();
|
return $oPro->delete();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw (new Exception( "The row '$ProUid' in table Group doesn't exist!" ));
|
throw (new Exception( "The row '$ProUid' in table Group doesn't exist!" ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -237,23 +245,23 @@ class Groupwf extends BaseGroupwf {
|
|||||||
* @param string $sProUid the uid of the Prolication
|
* @param string $sProUid the uid of the Prolication
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function GroupwfExists ( $GrpUid ) {
|
function GroupwfExists ($GrpUid)
|
||||||
|
{
|
||||||
$con = Propel::getConnection( GroupwfPeer::DATABASE_NAME );
|
$con = Propel::getConnection( GroupwfPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oPro = GroupwfPeer::retrieveByPk( $GrpUid );
|
$oPro = GroupwfPeer::retrieveByPk( $GrpUid );
|
||||||
if (is_object( $oPro ) && get_class( $oPro ) == 'Groupwf') {
|
if (is_object( $oPro ) && get_class( $oPro ) == 'Groupwf') {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadByGroupname ( $Groupname ) {
|
function loadByGroupname ($Groupname)
|
||||||
|
{
|
||||||
$c = new Criteria( 'workflow' );
|
$c = new Criteria( 'workflow' );
|
||||||
$del = DBAdapter::getStringDelimiter();
|
$del = DBAdapter::getStringDelimiter();
|
||||||
|
|
||||||
@@ -292,20 +300,24 @@ class Groupwf extends BaseGroupwf {
|
|||||||
$dataset->next();
|
$dataset->next();
|
||||||
$rowCount = $dataset->getRow();
|
$rowCount = $dataset->getRow();
|
||||||
|
|
||||||
if( is_array($rowCount) )
|
if (is_array( $rowCount )) {
|
||||||
$totalCount = $rowCount[0];
|
$totalCount = $rowCount[0];
|
||||||
|
}
|
||||||
|
|
||||||
if( $start )
|
if ($start) {
|
||||||
$criteria->setOffset( $start );
|
$criteria->setOffset( $start );
|
||||||
if( $limit )
|
}
|
||||||
|
if ($limit) {
|
||||||
$criteria->setLimit( $limit );
|
$criteria->setLimit( $limit );
|
||||||
|
}
|
||||||
|
|
||||||
$rs = GroupwfPeer::doSelectRS( $criteria );
|
$rs = GroupwfPeer::doSelectRS( $criteria );
|
||||||
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
|
|
||||||
$rows = Array ();
|
$rows = Array ();
|
||||||
while( $rs->next() )
|
while ($rs->next()) {
|
||||||
$rows[] = $rs->getRow();
|
$rows[] = $rs->getRow();
|
||||||
|
}
|
||||||
|
|
||||||
$result->data = $rows;
|
$result->data = $rows;
|
||||||
$result->totalCount = $totalCount;
|
$result->totalCount = $totalCount;
|
||||||
@@ -366,7 +378,8 @@ class Groupwf extends BaseGroupwf {
|
|||||||
$groups[] = $oDataset->getRow();
|
$groups[] = $oDataset->getRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
return array('rows' => $groups, 'totalCount'=>$totalRows);
|
return array ('rows' => $groups,'totalCount' => $totalRows
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterGroup ($filter, $start, $limit)
|
function filterGroup ($filter, $start, $limit)
|
||||||
@@ -414,6 +427,6 @@ class Groupwf extends BaseGroupwf {
|
|||||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// Groupwf
|
||||||
|
|
||||||
|
|
||||||
} // Groupwf
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Language.php
|
* Language.php
|
||||||
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
@@ -41,7 +42,8 @@ require_once 'classes/model/Translation.php';
|
|||||||
*
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
class Language extends BaseLanguage {
|
class Language extends BaseLanguage
|
||||||
|
{
|
||||||
|
|
||||||
function load ($sLanUid)
|
function load ($sLanUid)
|
||||||
{
|
{
|
||||||
@@ -52,12 +54,10 @@ class Language extends BaseLanguage {
|
|||||||
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
||||||
$this->setNew( false );
|
$this->setNew( false );
|
||||||
return $aFields;
|
return $aFields;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw (new Exception( 'This row doesn\'t exist!' ));
|
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,13 +73,11 @@ class Language extends BaseLanguage {
|
|||||||
$iResult = $this->save();
|
$iResult = $this->save();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
return $iResult;
|
return $iResult;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw (new Exception( 'Failed Validation in class ' . get_class( $this ) . '.' ));
|
throw (new Exception( 'Failed Validation in class ' . get_class( $this ) . '.' ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch(Exception $e) {
|
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw ($e);
|
throw ($e);
|
||||||
}
|
}
|
||||||
@@ -98,8 +96,9 @@ class Language extends BaseLanguage {
|
|||||||
|
|
||||||
$oContent = new Content();
|
$oContent = new Content();
|
||||||
$rows = Array ();
|
$rows = Array ();
|
||||||
while ($oDataset->next())
|
while ($oDataset->next()) {
|
||||||
array_push( $rows, $oDataset->getRow() );
|
array_push( $rows, $oDataset->getRow() );
|
||||||
|
}
|
||||||
|
|
||||||
return $rows;
|
return $rows;
|
||||||
}
|
}
|
||||||
@@ -149,8 +148,10 @@ class Language extends BaseLanguage {
|
|||||||
$language = new Language();
|
$language = new Language();
|
||||||
$langRecord = $language->findByLanName( $langName );
|
$langRecord = $language->findByLanName( $langName );
|
||||||
|
|
||||||
if( ! isset($langRecord['LAN_ID']) ) //if the language doesn't exist abort
|
if (! isset( $langRecord['LAN_ID'] )) {
|
||||||
|
//if the language doesn't exist abort
|
||||||
throw new Exception( 'The .po file has a invalid X-Poedit-Language definition!' );
|
throw new Exception( 'The .po file has a invalid X-Poedit-Language definition!' );
|
||||||
|
}
|
||||||
|
|
||||||
$languageID = $langRecord['LAN_ID'];
|
$languageID = $langRecord['LAN_ID'];
|
||||||
|
|
||||||
@@ -160,8 +161,10 @@ class Language extends BaseLanguage {
|
|||||||
$isoCountry = new IsoCountry();
|
$isoCountry = new IsoCountry();
|
||||||
$countryRecord = $isoCountry->findByIcName( $countryName );
|
$countryRecord = $isoCountry->findByIcName( $countryName );
|
||||||
|
|
||||||
if( ! isset($countryRecord['IC_UID']) ) //if the language doesn't exist abort
|
if (! isset( $countryRecord['IC_UID'] )) {
|
||||||
|
//if the language doesn't exist abort
|
||||||
throw new Exception( 'The .po file has a invalid X-Poedit-Country definition!' );
|
throw new Exception( 'The .po file has a invalid X-Poedit-Country definition!' );
|
||||||
|
}
|
||||||
|
|
||||||
$countryID = $countryRecord['IC_UID'];
|
$countryID = $countryRecord['IC_UID'];
|
||||||
//define locale
|
//define locale
|
||||||
@@ -185,22 +188,25 @@ class Language extends BaseLanguage {
|
|||||||
|
|
||||||
foreach ($POFile->translatorComments as $a => $aux) {
|
foreach ($POFile->translatorComments as $a => $aux) {
|
||||||
$aux = trim( $aux );
|
$aux = trim( $aux );
|
||||||
if ( $aux == 'TRANSLATION')
|
if ($aux == 'TRANSLATION') {
|
||||||
$identifier = $aux;
|
$identifier = $aux;
|
||||||
else {
|
} else {
|
||||||
$var = explode( '/', $aux );
|
$var = explode( '/', $aux );
|
||||||
if ($var[0]=='LABEL')
|
if ($var[0] == 'LABEL') {
|
||||||
$context = $aux;
|
|
||||||
if ($var[0]=='JAVASCRIPT')
|
|
||||||
$context = $aux;
|
$context = $aux;
|
||||||
}
|
}
|
||||||
if (preg_match('/^([\w-]+)\/([\w-]+\/*[\w-]*\.xml\?)/', $aux, $match))
|
if ($var[0] == 'JAVASCRIPT') {
|
||||||
$identifier = $aux;
|
|
||||||
else{
|
|
||||||
if (preg_match('/^([\w-]+)\/([\w-]+\/*[\w-]*\.xml$)/', $aux, $match))
|
|
||||||
$context = $aux;
|
$context = $aux;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (preg_match( '/^([\w-]+)\/([\w-]+\/*[\w-]*\.xml\?)/', $aux, $match )) {
|
||||||
|
$identifier = $aux;
|
||||||
|
} else {
|
||||||
|
if (preg_match( '/^([\w-]+)\/([\w-]+\/*[\w-]*\.xml$)/', $aux, $match )) {
|
||||||
|
$context = $aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$reference = $POFile->references[0];
|
$reference = $POFile->references[0];
|
||||||
|
|
||||||
@@ -208,20 +214,14 @@ class Language extends BaseLanguage {
|
|||||||
if ($identifier == 'TRANSLATION') {
|
if ($identifier == 'TRANSLATION') {
|
||||||
if ($updateDB) {
|
if ($updateDB) {
|
||||||
list ($category, $id) = explode( '/', $context );
|
list ($category, $id) = explode( '/', $context );
|
||||||
$result = $oTranslation->addTranslation(
|
$result = $oTranslation->addTranslation( $category, $id, $LOCALE, trim( stripcslashes( str_replace( chr( 10 ), '', $rowTranslation['msgstr'] ) ) ) );
|
||||||
$category,
|
|
||||||
$id,
|
|
||||||
$LOCALE,
|
|
||||||
trim(stripcslashes(str_replace(chr(10), '', $rowTranslation['msgstr'])))
|
|
||||||
);
|
|
||||||
if ($result['codError'] == 0) {
|
if ($result['codError'] == 0) {
|
||||||
$countItemsSuccess ++;
|
$countItemsSuccess ++;
|
||||||
} else {
|
} else {
|
||||||
$errorMsg .= $id . ': ' . $result['message'] . "\n";
|
$errorMsg .= $id . ': ' . $result['message'] . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // is a Xml update
|
||||||
// is a Xml update
|
|
||||||
elseif ($updateXml) {
|
elseif ($updateXml) {
|
||||||
|
|
||||||
$xmlForm = $context;
|
$xmlForm = $context;
|
||||||
@@ -234,8 +234,7 @@ class Language extends BaseLanguage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (count( $match ) < 4) {
|
if (count( $match ) < 4) {
|
||||||
$near = isset($rowTranslation['msgid']) ? $rowTranslation['msgid'] :
|
$near = isset( $rowTranslation['msgid'] ) ? $rowTranslation['msgid'] : (isset( $rowTranslation['msgstr'] ) ? $rowTranslation['msgstr'] : '');
|
||||||
(isset($rowTranslation['msgstr']) ? $rowTranslation['msgstr'] : '');
|
|
||||||
$errorMsg .= "Invalid Translation reference: \"$reference\", near -> " . $near . "\n";
|
$errorMsg .= "Invalid Translation reference: \"$reference\", near -> " . $near . "\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -246,23 +245,28 @@ class Language extends BaseLanguage {
|
|||||||
|
|
||||||
$codes = explode( '-', $reference );
|
$codes = explode( '-', $reference );
|
||||||
|
|
||||||
if( sizeof($codes) == 2 ) { //is a normal node
|
if (sizeof( $codes ) == 2) {
|
||||||
$dynaform->addChilds($fieldName, Array($LOCALE=>stripcslashes(str_replace(chr(10), '', $rowTranslation['msgstr']))));
|
//is a normal node
|
||||||
} else if( sizeof($codes) > 2 ) { //is a node child for a language node
|
$dynaform->addChilds( $fieldName, Array ($LOCALE => stripcslashes( str_replace( chr( 10 ), '', $rowTranslation['msgstr'] ) )
|
||||||
|
) );
|
||||||
|
} elseif (sizeof( $codes ) > 2) {
|
||||||
|
//is a node child for a language node
|
||||||
$name = $match[3] == "''" ? '' : $match[3];
|
$name = $match[3] == "''" ? '' : $match[3];
|
||||||
$childNode = Array(
|
$childNode = Array (Array ('name' => 'option','value' => $rowTranslation['msgstr'],'attributes' => Array ('name' => $name
|
||||||
Array('name'=>'option', 'value'=>$rowTranslation['msgstr'], 'attributes'=>Array('name'=>$name))
|
)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$dynaform->addChilds($fieldName, Array($LOCALE=>NULL), $childNode);
|
$dynaform->addChilds( $fieldName, Array ($LOCALE => null
|
||||||
|
), $childNode );
|
||||||
}
|
}
|
||||||
$countItemsSuccess ++;
|
$countItemsSuccess ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$oLanguage = new Language();
|
$oLanguage = new Language();
|
||||||
$oLanguage->update(array('LAN_ID' => $languageID, 'LAN_ENABLED' => '1'));
|
$oLanguage->update( array ('LAN_ID' => $languageID,'LAN_ENABLED' => '1'
|
||||||
|
) );
|
||||||
|
|
||||||
$trn = new Translation();
|
$trn = new Translation();
|
||||||
$trn->generateFileTranslation( $LOCALE );
|
$trn->generateFileTranslation( $LOCALE );
|
||||||
@@ -277,8 +281,7 @@ class Language extends BaseLanguage {
|
|||||||
$results->errMsg = $errorMsg;
|
$results->errMsg = $errorMsg;
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -294,6 +297,7 @@ class Language extends BaseLanguage {
|
|||||||
//$timer = new Benchmark_Timer();
|
//$timer = new Benchmark_Timer();
|
||||||
//$timer->start();
|
//$timer->start();
|
||||||
|
|
||||||
|
|
||||||
//creating the .po file
|
//creating the .po file
|
||||||
$sPOFile = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . MAIN_POFILE . '.' . $_GET['LOCALE'] . '.po';
|
$sPOFile = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . MAIN_POFILE . '.' . $_GET['LOCALE'] . '.po';
|
||||||
|
|
||||||
@@ -311,8 +315,9 @@ class Language extends BaseLanguage {
|
|||||||
$iCountry = new IsoCountry();
|
$iCountry = new IsoCountry();
|
||||||
$iCountryRecord = $iCountry->findById( $IC_UID );
|
$iCountryRecord = $iCountry->findById( $IC_UID );
|
||||||
|
|
||||||
if( ! isset($iCountryRecord['IC_UID']) )
|
if (! isset( $iCountryRecord['IC_UID'] )) {
|
||||||
throw new Exception( "Country Target ID '{$_GET['LAN_ID']}' doesn't exist!" );
|
throw new Exception( "Country Target ID '{$_GET['LAN_ID']}' doesn't exist!" );
|
||||||
|
}
|
||||||
|
|
||||||
$sCountry = $iCountryRecord['IC_NAME'];
|
$sCountry = $iCountryRecord['IC_NAME'];
|
||||||
} else {
|
} else {
|
||||||
@@ -322,8 +327,9 @@ class Language extends BaseLanguage {
|
|||||||
|
|
||||||
$langRecord = $language->findById( $LAN_ID );
|
$langRecord = $language->findById( $LAN_ID );
|
||||||
|
|
||||||
if( ! isset($langRecord['LAN_NAME']) )
|
if (! isset( $langRecord['LAN_NAME'] )) {
|
||||||
throw new Exception( "Language Target ID \"{$LAN_ID}\" doesn't exist!" );
|
throw new Exception( "Language Target ID \"{$LAN_ID}\" doesn't exist!" );
|
||||||
|
}
|
||||||
|
|
||||||
$sLanguage = $langRecord['LAN_NAME'];
|
$sLanguage = $langRecord['LAN_NAME'];
|
||||||
|
|
||||||
@@ -344,8 +350,10 @@ class Language extends BaseLanguage {
|
|||||||
//$timer->setMarker('end making po headers');
|
//$timer->setMarker('end making po headers');
|
||||||
//export translation
|
//export translation
|
||||||
|
|
||||||
|
|
||||||
$aLabels = array ();
|
$aLabels = array ();
|
||||||
$aMsgids = array('' => true);
|
$aMsgids = array ('' => true
|
||||||
|
);
|
||||||
|
|
||||||
// selecting all translations records of base language 'en' on TRANSLATIONS table
|
// selecting all translations records of base language 'en' on TRANSLATIONS table
|
||||||
$oCriteria = new Criteria( 'workflow' );
|
$oCriteria = new Criteria( 'workflow' );
|
||||||
@@ -358,7 +366,8 @@ class Language extends BaseLanguage {
|
|||||||
|
|
||||||
$targetLangRecords = array ();
|
$targetLangRecords = array ();
|
||||||
// retrieve the translation for the target language
|
// retrieve the translation for the target language
|
||||||
if( $LAN_ID != 'en' ) { // only if it is different language than base language 'en'
|
if ($LAN_ID != 'en') {
|
||||||
|
// only if it is different language than base language 'en'
|
||||||
$c = new Criteria( 'workflow' );
|
$c = new Criteria( 'workflow' );
|
||||||
$c->addSelectColumn( TranslationPeer::TRN_CATEGORY );
|
$c->addSelectColumn( TranslationPeer::TRN_CATEGORY );
|
||||||
$c->addSelectColumn( TranslationPeer::TRN_ID );
|
$c->addSelectColumn( TranslationPeer::TRN_ID );
|
||||||
@@ -373,39 +382,34 @@ class Language extends BaseLanguage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// get the respective translation for each english label
|
// get the respective translation for each english label
|
||||||
while ($oDataset->next()) {
|
while ($oDataset->next()) {
|
||||||
$aRow1 = $oDataset->getRow();
|
$aRow1 = $oDataset->getRow();
|
||||||
$trnCategory = trim( $aRow1['TRN_CATEGORY'] );
|
$trnCategory = trim( $aRow1['TRN_CATEGORY'] );
|
||||||
|
|
||||||
|
|
||||||
# Validation, validate that the TRN_CATEGORY contains valid characteres
|
# Validation, validate that the TRN_CATEGORY contains valid characteres
|
||||||
preg_match( "/^[0-9a-zA-Z_-]+/", $trnCategory, $sTestResult );
|
preg_match( "/^[0-9a-zA-Z_-]+/", $trnCategory, $sTestResult );
|
||||||
|
|
||||||
// IF the translations id "TRN_ID" has invalid characteres or has not accepted categories
|
// IF the translations id "TRN_ID" has invalid characteres or has not accepted categories
|
||||||
if ($sTestResult[0] !== $trnCategory || ($trnCategory != 'LABEL' && $trnCategory != 'JAVASCRIPT')) {
|
if ($sTestResult[0] !== $trnCategory || ($trnCategory != 'LABEL' && $trnCategory != 'JAVASCRIPT')) {
|
||||||
$oTranslation = new Translation;
|
$oTranslation = new Translation();
|
||||||
$oTranslation->remove( $aRow1['TRN_CATEGORY'], $aRow1['TRN_ID'], 'en' ); //remove not accepted translations
|
$oTranslation->remove( $aRow1['TRN_CATEGORY'], $aRow1['TRN_ID'], 'en' ); //remove not accepted translations
|
||||||
continue; //jump to next iteration
|
continue; //jump to next iteration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// retrieve the translation for the target language
|
// retrieve the translation for the target language
|
||||||
if( $LAN_ID != 'en' ){ // only if it is different language than base language 'en'
|
if ($LAN_ID != 'en') {
|
||||||
|
// only if it is different language than base language 'en'
|
||||||
if (isset( $targetLangRecords[$aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']] )) {
|
if (isset( $targetLangRecords[$aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']] )) {
|
||||||
$msgstr = $targetLangRecords[$aRow1['TRN_CATEGORY'].'/'.$aRow1['TRN_ID']] != ''
|
$msgstr = $targetLangRecords[$aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']] != '' ? $targetLangRecords[$aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']] : $aRow1['TRN_VALUE'];
|
||||||
? $targetLangRecords[$aRow1['TRN_CATEGORY'].'/'.$aRow1['TRN_ID']]: $aRow1['TRN_VALUE'];
|
|
||||||
} else {
|
} else {
|
||||||
$msgstr = $aRow1['TRN_VALUE'];
|
$msgstr = $aRow1['TRN_VALUE'];
|
||||||
}
|
}
|
||||||
} else { //if not just copy the same
|
} else {
|
||||||
|
//if not just copy the same
|
||||||
$msgstr = $aRow1['TRN_VALUE'];
|
$msgstr = $aRow1['TRN_VALUE'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$msgid = trim( $aRow1['TRN_VALUE'] );
|
$msgid = trim( $aRow1['TRN_VALUE'] );
|
||||||
$msgstr = trim( $msgstr );
|
$msgstr = trim( $msgstr );
|
||||||
|
|
||||||
@@ -423,9 +427,13 @@ class Language extends BaseLanguage {
|
|||||||
|
|
||||||
//$timer->setMarker('end making 1th .po from db');
|
//$timer->setMarker('end making 1th .po from db');
|
||||||
|
|
||||||
|
|
||||||
//now find labels in xmlforms
|
//now find labels in xmlforms
|
||||||
/************/
|
/**
|
||||||
$aExceptionFields = array('', 'javascript', 'hidden', 'phpvariable', 'private', 'toolbar', 'xmlmenu', 'toolbutton', 'cellmark', 'grid', 'CheckboxTable');
|
* *********
|
||||||
|
*/
|
||||||
|
$aExceptionFields = array ('','javascript','hidden','phpvariable','private','toolbar','xmlmenu','toolbutton','cellmark','grid','CheckboxTable'
|
||||||
|
);
|
||||||
|
|
||||||
//find all xml files into PATH_XMLFORM
|
//find all xml files into PATH_XMLFORM
|
||||||
$aXMLForms = glob( PATH_XMLFORM . '*/*.xml' );
|
$aXMLForms = glob( PATH_XMLFORM . '*/*.xml' );
|
||||||
@@ -459,18 +467,18 @@ class Language extends BaseLanguage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Getting the Base Origin Text
|
// Getting the Base Origin Text
|
||||||
if( ! is_array($arrayNode[$_BASE_LANG]) )
|
if (! is_array( $arrayNode[$_BASE_LANG] )) {
|
||||||
$originNodeText = trim( $arrayNode[$_BASE_LANG] );
|
$originNodeText = trim( $arrayNode[$_BASE_LANG] );
|
||||||
else {
|
} else {
|
||||||
$langNode = $arrayNode[$_BASE_LANG][0];
|
$langNode = $arrayNode[$_BASE_LANG][0];
|
||||||
$originNodeText = $langNode['__nodeText__'];
|
$originNodeText = $langNode['__nodeText__'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getting the Base Target Text
|
// Getting the Base Target Text
|
||||||
if (isset( $arrayNode[$_TARGET_LANG] )) {
|
if (isset( $arrayNode[$_TARGET_LANG] )) {
|
||||||
if( ! is_array($arrayNode[$_TARGET_LANG]) )
|
if (! is_array( $arrayNode[$_TARGET_LANG] )) {
|
||||||
$targetNodeText = trim( $arrayNode[$_TARGET_LANG] );
|
$targetNodeText = trim( $arrayNode[$_TARGET_LANG] );
|
||||||
else {
|
} else {
|
||||||
$langNode = $arrayNode[$_TARGET_LANG][0];
|
$langNode = $arrayNode[$_TARGET_LANG][0];
|
||||||
$targetNodeText = $langNode['__nodeText__'];
|
$targetNodeText = $langNode['__nodeText__'];
|
||||||
}
|
}
|
||||||
@@ -484,9 +492,9 @@ class Language extends BaseLanguage {
|
|||||||
$msgid = $originNodeText;
|
$msgid = $originNodeText;
|
||||||
|
|
||||||
// if the nodeName already exists in the po file, we need to create other msgid
|
// if the nodeName already exists in the po file, we need to create other msgid
|
||||||
if( isset($aMsgids[$msgid]) )
|
if (isset( $aMsgids[$msgid] )) {
|
||||||
$msgid = '[' . $xmlFormFile . '?' . $nodeName . '] ' . $originNodeText;
|
$msgid = '[' . $xmlFormFile . '?' . $nodeName . '] ' . $originNodeText;
|
||||||
|
}
|
||||||
$poFile->addTranslatorComment( $xmlFormFile . '?' . $nodeName );
|
$poFile->addTranslatorComment( $xmlFormFile . '?' . $nodeName );
|
||||||
$poFile->addTranslatorComment( $xmlFormFile );
|
$poFile->addTranslatorComment( $xmlFormFile );
|
||||||
$poFile->addReference( $nodeType . ' - ' . $nodeName );
|
$poFile->addReference( $nodeType . ' - ' . $nodeName );
|
||||||
@@ -499,6 +507,7 @@ class Language extends BaseLanguage {
|
|||||||
|
|
||||||
$originOptionNode = $arrayNode[$_BASE_LANG][0]['option']; //get the options
|
$originOptionNode = $arrayNode[$_BASE_LANG][0]['option']; //get the options
|
||||||
|
|
||||||
|
|
||||||
$targetOptionExists = false;
|
$targetOptionExists = false;
|
||||||
if (isset( $arrayNode[$_TARGET_LANG] ) && isset( $arrayNode[$_TARGET_LANG][0] ) && isset( $arrayNode[$_TARGET_LANG][0]['option'] )) {
|
if (isset( $arrayNode[$_TARGET_LANG] ) && isset( $arrayNode[$_TARGET_LANG][0] ) && isset( $arrayNode[$_TARGET_LANG][0]['option'] )) {
|
||||||
$targetOptionNode = $arrayNode[$_TARGET_LANG][0]['option'];
|
$targetOptionNode = $arrayNode[$_TARGET_LANG][0]['option'];
|
||||||
@@ -537,6 +546,7 @@ class Language extends BaseLanguage {
|
|||||||
}
|
}
|
||||||
} //end foreach
|
} //end foreach
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -547,15 +557,16 @@ class Language extends BaseLanguage {
|
|||||||
//die;
|
//die;
|
||||||
//g::pr($profiling);
|
//g::pr($profiling);
|
||||||
|
|
||||||
|
|
||||||
G::streamFile( $sPOFile, true );
|
G::streamFile( $sPOFile, true );
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} // Language
|
// Language
|
||||||
|
|
||||||
|
|
||||||
function getMatchDropdownOptionValue($name, $options){
|
function getMatchDropdownOptionValue ($name, $options)
|
||||||
|
{
|
||||||
foreach ($options as $option) {
|
foreach ($options as $option) {
|
||||||
if ($name == $option['name']) {
|
if ($name == $option['name']) {
|
||||||
return $option['__nodeText__'];
|
return $option['__nodeText__'];
|
||||||
@@ -563,3 +574,4 @@ class Language extends BaseLanguage {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
require_once 'classes/model/om/BaseUsersProperties.php';
|
require_once 'classes/model/om/BaseUsersProperties.php';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skeleton subclass for representing a row from the 'USERS_PROPERTIES' table.
|
* Skeleton subclass for representing a row from the 'USERS_PROPERTIES' table.
|
||||||
*
|
*
|
||||||
@@ -14,6 +13,7 @@ require_once 'classes/model/om/BaseUsersProperties.php';
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
class UsersProperties extends BaseUsersProperties
|
class UsersProperties extends BaseUsersProperties
|
||||||
@@ -34,8 +34,7 @@ class UsersProperties extends BaseUsersProperties
|
|||||||
$this->fields = $oUserProperty->toArray( BasePeer::TYPE_FIELDNAME );
|
$this->fields = $oUserProperty->toArray( BasePeer::TYPE_FIELDNAME );
|
||||||
$this->fromArray( $this->fields, BasePeer::TYPE_FIELDNAME );
|
$this->fromArray( $this->fields, BasePeer::TYPE_FIELDNAME );
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,8 +46,7 @@ class UsersProperties extends BaseUsersProperties
|
|||||||
$aFields = $oUserProperty->toArray( BasePeer::TYPE_FIELDNAME );
|
$aFields = $oUserProperty->toArray( BasePeer::TYPE_FIELDNAME );
|
||||||
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
||||||
return $aFields;
|
return $aFields;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw new Exception( "User with $sUserUID does not exist!" );
|
throw new Exception( "User with $sUserUID does not exist!" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,8 +62,7 @@ class UsersProperties extends BaseUsersProperties
|
|||||||
$iResult = $oUserProperty->save();
|
$iResult = $oUserProperty->save();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sMessage = '';
|
$sMessage = '';
|
||||||
$aValidationFailures = $oUserProperty->getValidationFailures();
|
$aValidationFailures = $oUserProperty->getValidationFailures();
|
||||||
foreach ($aValidationFailures as $oValidationFailure) {
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
@@ -73,8 +70,7 @@ class UsersProperties extends BaseUsersProperties
|
|||||||
}
|
}
|
||||||
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
@@ -92,8 +88,7 @@ class UsersProperties extends BaseUsersProperties
|
|||||||
$iResult = $oUserProperty->save();
|
$iResult = $oUserProperty->save();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
return $iResult;
|
return $iResult;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sMessage = '';
|
$sMessage = '';
|
||||||
$aValidationFailures = $oUserProperty->getValidationFailures();
|
$aValidationFailures = $oUserProperty->getValidationFailures();
|
||||||
foreach ($aValidationFailures as $oValidationFailure) {
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
@@ -101,12 +96,10 @@ class UsersProperties extends BaseUsersProperties
|
|||||||
}
|
}
|
||||||
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
|
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw (new Exception( 'This row doesn\'t exist!' ));
|
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
@@ -123,8 +116,7 @@ class UsersProperties extends BaseUsersProperties
|
|||||||
$aUserProperty['USR_LOGGED_NEXT_TIME'] = 0;
|
$aUserProperty['USR_LOGGED_NEXT_TIME'] = 0;
|
||||||
}
|
}
|
||||||
$this->create( $aUserProperty );
|
$this->create( $aUserProperty );
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$aUserProperty = $this->fields;
|
$aUserProperty = $this->fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,8 +148,7 @@ class UsersProperties extends BaseUsersProperties
|
|||||||
}
|
}
|
||||||
if (function_exists( 'mb_strlen' )) {
|
if (function_exists( 'mb_strlen' )) {
|
||||||
$iLength = mb_strlen( $sPassword );
|
$iLength = mb_strlen( $sPassword );
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$iLength = strlen( $sPassword );
|
$iLength = strlen( $sPassword );
|
||||||
}
|
}
|
||||||
$aErrors = array ();
|
$aErrors = array ();
|
||||||
@@ -198,7 +189,6 @@ class UsersProperties extends BaseUsersProperties
|
|||||||
return $aErrors;
|
return $aErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get user location
|
* get user location
|
||||||
* defined by precedence plugin->ux->default
|
* defined by precedence plugin->ux->default
|
||||||
@@ -264,7 +254,7 @@ class UsersProperties extends BaseUsersProperties
|
|||||||
$url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . SYS_SKIN . '/main';
|
$url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . SYS_SKIN . '/main';
|
||||||
global $RBAC;
|
global $RBAC;
|
||||||
G::loadClass( 'configuration' );
|
G::loadClass( 'configuration' );
|
||||||
$oConf = new Configurations;
|
$oConf = new Configurations();
|
||||||
$oConf->loadConfig( $x, 'USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED'], '' );
|
$oConf->loadConfig( $x, 'USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED'], '' );
|
||||||
if (sizeof( $oConf->aConfig ) > 0) {
|
if (sizeof( $oConf->aConfig ) > 0) {
|
||||||
if ($oConf->aConfig['DEFAULT_MENU'] == 'PM_USERS') {
|
if ($oConf->aConfig['DEFAULT_MENU'] == 'PM_USERS') {
|
||||||
@@ -318,8 +308,9 @@ class UsersProperties extends BaseUsersProperties
|
|||||||
|
|
||||||
if (class_exists( 'redirectDetail' )) {
|
if (class_exists( 'redirectDetail' )) {
|
||||||
//to do: complete the validation
|
//to do: complete the validation
|
||||||
if(isset($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE']))
|
if (isset( $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'] )) {
|
||||||
$userRole = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'];
|
$userRole = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'];
|
||||||
|
}
|
||||||
|
|
||||||
$oPluginRegistry = &PMPluginRegistry::getSingleton();
|
$oPluginRegistry = &PMPluginRegistry::getSingleton();
|
||||||
$aRedirectLogin = $oPluginRegistry->getRedirectLogins();
|
$aRedirectLogin = $oPluginRegistry->getRedirectLogins();
|
||||||
@@ -337,6 +328,7 @@ class UsersProperties extends BaseUsersProperties
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* New feature - User Experience Redirector
|
* New feature - User Experience Redirector
|
||||||
|
*
|
||||||
* @author Erik Amaru Ortiz <erik@colosa.com>
|
* @author Erik Amaru Ortiz <erik@colosa.com>
|
||||||
*/
|
*/
|
||||||
public function _getUXLocation ()
|
public function _getUXLocation ()
|
||||||
@@ -383,13 +375,14 @@ class UsersProperties extends BaseUsersProperties
|
|||||||
{
|
{
|
||||||
global $RBAC;
|
global $RBAC;
|
||||||
G::loadClass( 'configuration' );
|
G::loadClass( 'configuration' );
|
||||||
$oConf = new Configurations;
|
$oConf = new Configurations();
|
||||||
$oConf->loadConfig( $x, 'USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED'], '' );
|
$oConf->loadConfig( $x, 'USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED'], '' );
|
||||||
|
|
||||||
$baseUrl = '/sys' . SYS_SYS . '/' . $this->lang . '/' . SYS_SKIN . '/';
|
$baseUrl = '/sys' . SYS_SYS . '/' . $this->lang . '/' . SYS_SKIN . '/';
|
||||||
$url = '';
|
$url = '';
|
||||||
|
|
||||||
if( sizeof($oConf->aConfig) > 0) { // this user has a configuration record
|
if (sizeof( $oConf->aConfig ) > 0) {
|
||||||
|
// this user has a configuration record
|
||||||
// backward compatibility, because now, we don't have user and dashboard menu.
|
// backward compatibility, because now, we don't have user and dashboard menu.
|
||||||
if ($oConf->aConfig['DEFAULT_MENU'] == 'PM_USERS') {
|
if ($oConf->aConfig['DEFAULT_MENU'] == 'PM_USERS') {
|
||||||
$oConf->aConfig['DEFAULT_MENU'] = 'PM_SETUP';
|
$oConf->aConfig['DEFAULT_MENU'] = 'PM_SETUP';
|
||||||
@@ -427,24 +420,21 @@ class UsersProperties extends BaseUsersProperties
|
|||||||
if (empty( $url )) {
|
if (empty( $url )) {
|
||||||
if ($RBAC->userCanAccess( 'PM_FACTORY' ) == 1) {
|
if ($RBAC->userCanAccess( 'PM_FACTORY' ) == 1) {
|
||||||
$url = 'processes/main';
|
$url = 'processes/main';
|
||||||
}
|
} elseif ($RBAC->userCanAccess( 'PM_SETUP' ) == 1) {
|
||||||
else if ($RBAC->userCanAccess('PM_SETUP') == 1) {
|
|
||||||
$url = 'setup/main';
|
$url = 'setup/main';
|
||||||
}
|
} elseif ($RBAC->userCanAccess( 'PM_CASES' ) == 1) {
|
||||||
else if ($RBAC->userCanAccess('PM_CASES') == 1) {
|
|
||||||
$url = 'cases/main';
|
$url = 'cases/main';
|
||||||
}
|
} elseif ($RBAC->userCanAccess( 'PM_USERS' ) == 1) {
|
||||||
else if ($RBAC->userCanAccess('PM_USERS') == 1) {
|
|
||||||
$url = 'setup/main';
|
$url = 'setup/main';
|
||||||
}
|
} elseif ($RBAC->userCanAccess( 'PM_DASHBOARD' ) == 1) {
|
||||||
else if ($RBAC->userCanAccess('PM_DASHBOARD') == 1) {
|
|
||||||
$url = 'dashboard/dashboard';
|
$url = 'dashboard/dashboard';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$url = 'users/myInfo';
|
$url = 'users/myInfo';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $baseUrl . $url;
|
return $baseUrl . $url;
|
||||||
}
|
}
|
||||||
} // UsersProperties
|
}
|
||||||
|
// UsersProperties
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* class.pmTrSharepoint.php
|
* class.pmTrSharepoint.php
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
G::LoadSystem( "soapNtlm" );
|
G::LoadSystem( "soapNtlm" );
|
||||||
|
|
||||||
class wscaller {
|
class wscaller
|
||||||
|
{
|
||||||
|
|
||||||
private $wsdlurl;
|
private $wsdlurl;
|
||||||
private $soapObj;
|
private $soapObj;
|
||||||
@@ -14,18 +14,21 @@ class wscaller {
|
|||||||
private $auth;
|
private $auth;
|
||||||
private $clientStream;
|
private $clientStream;
|
||||||
|
|
||||||
function setAuthUser($auth) {
|
function setAuthUser ($auth)
|
||||||
|
{
|
||||||
//print "<br>- auth Setup";
|
//print "<br>- auth Setup";
|
||||||
$this->auth = $auth;
|
$this->auth = $auth;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setwsdlurl($wsdl) {
|
function setwsdlurl ($wsdl)
|
||||||
|
{
|
||||||
//print "<br>- wsdl Setup";
|
//print "<br>- wsdl Setup";
|
||||||
$this->wsdlurl = $wsdl;
|
$this->wsdlurl = $wsdl;
|
||||||
//var_dump($wsdl);
|
//var_dump($wsdl);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadSOAPClient() {
|
function loadSOAPClient ()
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
// we unregister the current HTTP wrapper
|
// we unregister the current HTTP wrapper
|
||||||
stream_wrapper_unregister( 'http' );
|
stream_wrapper_unregister( 'http' );
|
||||||
@@ -35,16 +38,18 @@ class wscaller {
|
|||||||
stream_wrapper_register( 'http', 'PMServiceProviderNTLMStream' ) or die( "Failed to register protocol" );
|
stream_wrapper_register( 'http', 'PMServiceProviderNTLMStream' ) or die( "Failed to register protocol" );
|
||||||
|
|
||||||
// $this->client = new PMServiceNTLMSoapClient($this->wsdlurl, array('trace' => 1, 'auth' => $this->auth));// Hugo's code
|
// $this->client = new PMServiceNTLMSoapClient($this->wsdlurl, array('trace' => 1, 'auth' => $this->auth));// Hugo's code
|
||||||
$this->client = new PMServiceNTLMSoapClient($this->wsdlurl, array('trace' => 1)); // Ankit's Code
|
$this->client = new PMServiceNTLMSoapClient( $this->wsdlurl, array ('trace' => 1
|
||||||
|
) ); // Ankit's Code
|
||||||
$this->client->setAuthClient( $this->auth );
|
$this->client->setAuthClient( $this->auth );
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
echo $e;
|
echo $e;
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function callWsMethod($methodName, $paramArray) {
|
function callWsMethod ($methodName, $paramArray)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($methodName == 'DeleteDws' || $methodName == 'GetListCollection') {
|
if ($methodName == 'DeleteDws' || $methodName == 'GetListCollection') {
|
||||||
@@ -62,47 +67,45 @@ class wscaller {
|
|||||||
}
|
}
|
||||||
stream_wrapper_restore( 'http' );
|
stream_wrapper_restore( 'http' );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DestinationUrlCollection {
|
class DestinationUrlCollection
|
||||||
|
{
|
||||||
|
|
||||||
public $string;
|
public $string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
class FieldInformation {
|
class FieldInformation
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
class FieldInformationCollection {
|
class FieldInformationCollection
|
||||||
|
{
|
||||||
public $FieldInformation;
|
public $FieldInformation;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class pmTrSharepointClass{
|
class pmTrSharepointClass
|
||||||
|
{
|
||||||
function __construct($server, $auth) {
|
function __construct ($server, $auth)
|
||||||
set_include_path(
|
{
|
||||||
PATH_PLUGINS . 'pmTrSharepoint' . PATH_SEPARATOR .
|
set_include_path( PATH_PLUGINS . 'pmTrSharepoint' . PATH_SEPARATOR . get_include_path() );
|
||||||
get_include_path()
|
|
||||||
);
|
|
||||||
$this->server = $server;
|
$this->server = $server;
|
||||||
$this->auth = $auth;
|
$this->auth = $auth;
|
||||||
$this->dwsObj = new wscaller();
|
$this->dwsObj = new wscaller();
|
||||||
$this->dwsObj->setAuthUser( $this->auth );
|
$this->dwsObj->setAuthUser( $this->auth );
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDWS($name, $users, $title, $documents) {
|
function createDWS ($name, $users, $title, $documents)
|
||||||
|
{
|
||||||
//print "<br>- Method createDWS";
|
//print "<br>- Method createDWS";
|
||||||
$this->dwsObj->setwsdlurl( $this->server . "/_vti_bin/Dws.asmx?WSDL" );
|
$this->dwsObj->setwsdlurl( $this->server . "/_vti_bin/Dws.asmx?WSDL" );
|
||||||
|
|
||||||
$this->dwsObj->loadSOAPClient();
|
$this->dwsObj->loadSOAPClient();
|
||||||
|
|
||||||
$paramArray = array('name' => '', 'users' => '', 'title' => $name, 'documents' => '');
|
$paramArray = array ('name' => '','users' => '','title' => $name,'documents' => ''
|
||||||
|
);
|
||||||
|
|
||||||
$methodName = 'CreateDws';
|
$methodName = 'CreateDws';
|
||||||
|
|
||||||
@@ -124,7 +127,8 @@ class pmTrSharepointClass{
|
|||||||
return $result; */
|
return $result; */
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteDWS($dwsname) {
|
function deleteDWS ($dwsname)
|
||||||
|
{
|
||||||
//print "<br>- Method createDWS";
|
//print "<br>- Method createDWS";
|
||||||
$url = $this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL";
|
$url = $this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL";
|
||||||
$this->dwsObj->setwsdlurl( $url );
|
$this->dwsObj->setwsdlurl( $url );
|
||||||
@@ -138,17 +142,20 @@ class pmTrSharepointClass{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function createFolderDWS($dwsname, $dwsFolderName) {
|
function createFolderDWS ($dwsname, $dwsFolderName)
|
||||||
|
{
|
||||||
//print "<br>- Method createDWS";
|
//print "<br>- Method createDWS";
|
||||||
$this->dwsObj->setwsdlurl( $this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL" );
|
$this->dwsObj->setwsdlurl( $this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL" );
|
||||||
|
|
||||||
$this->dwsObj->loadSOAPClient();
|
$this->dwsObj->loadSOAPClient();
|
||||||
|
|
||||||
$url = "Shared Documents/$dwsFolderName";
|
$url = "Shared Documents/$dwsFolderName";
|
||||||
$paramArray = array('url' => $url);
|
$paramArray = array ('url' => $url
|
||||||
|
);
|
||||||
|
|
||||||
# $paramArray = array('name' => '', 'users' => '', 'title' => $name, 'documents' => '');
|
# $paramArray = array('name' => '', 'users' => '', 'title' => $name, 'documents' => '');
|
||||||
|
|
||||||
|
|
||||||
$methodName = 'CreateFolder';
|
$methodName = 'CreateFolder';
|
||||||
|
|
||||||
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray );
|
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray );
|
||||||
@@ -156,17 +163,20 @@ class pmTrSharepointClass{
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteFolderDWS($dwsname, $folderName) {
|
function deleteFolderDWS ($dwsname, $folderName)
|
||||||
|
{
|
||||||
//print "<br>- Method createDWS";
|
//print "<br>- Method createDWS";
|
||||||
$this->dwsObj->setwsdlurl( $this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL" );
|
$this->dwsObj->setwsdlurl( $this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL" );
|
||||||
|
|
||||||
$this->dwsObj->loadSOAPClient();
|
$this->dwsObj->loadSOAPClient();
|
||||||
|
|
||||||
$url = "Shared Documents/$folderName";
|
$url = "Shared Documents/$folderName";
|
||||||
$paramArray = array('url' => $url);
|
$paramArray = array ('url' => $url
|
||||||
|
);
|
||||||
|
|
||||||
# $paramArray = array('name' => '', 'users' => '', 'title' => $name, 'documents' => '');
|
# $paramArray = array('name' => '', 'users' => '', 'title' => $name, 'documents' => '');
|
||||||
|
|
||||||
|
|
||||||
$methodName = 'DeleteFolder';
|
$methodName = 'DeleteFolder';
|
||||||
|
|
||||||
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray );
|
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray );
|
||||||
@@ -174,13 +184,15 @@ class pmTrSharepointClass{
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function findDWSdoc($dwsname, $guid) {
|
function findDWSdoc ($dwsname, $guid)
|
||||||
|
{
|
||||||
//print "<br>- Method createDWS";
|
//print "<br>- Method createDWS";
|
||||||
$this->dwsObj->setwsdlurl( $this->server . $dwsName . "/_vti_bin/Dws.asmx?WSDL" );
|
$this->dwsObj->setwsdlurl( $this->server . $dwsName . "/_vti_bin/Dws.asmx?WSDL" );
|
||||||
|
|
||||||
$this->dwsObj->loadSOAPClient();
|
$this->dwsObj->loadSOAPClient();
|
||||||
|
|
||||||
$paramArray = array('id' => '$guid');
|
$paramArray = array ('id' => '$guid'
|
||||||
|
);
|
||||||
|
|
||||||
$methodName = 'FindDwsDoc';
|
$methodName = 'FindDwsDoc';
|
||||||
|
|
||||||
@@ -188,13 +200,15 @@ class pmTrSharepointClass{
|
|||||||
var_dump( $result );
|
var_dump( $result );
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDWSData($newFileName, $dwsname, $lastUpdate) {
|
function getDWSData ($newFileName, $dwsname, $lastUpdate)
|
||||||
|
{
|
||||||
//print "<br>- Method getDWSData<br />";
|
//print "<br>- Method getDWSData<br />";
|
||||||
$url = $this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL";
|
$url = $this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL";
|
||||||
$this->dwsObj->setwsdlurl( $url );
|
$this->dwsObj->setwsdlurl( $url );
|
||||||
if ($this->dwsObj->loadSOAPClient()) {
|
if ($this->dwsObj->loadSOAPClient()) {
|
||||||
$doc = "Shared Documents";
|
$doc = "Shared Documents";
|
||||||
$paramArray = array('document' => '', 'lastUpdate' => '');
|
$paramArray = array ('document' => '','lastUpdate' => ''
|
||||||
|
);
|
||||||
$methodName = 'GetDwsData';
|
$methodName = 'GetDwsData';
|
||||||
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray );
|
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray );
|
||||||
var_dump( $result );
|
var_dump( $result );
|
||||||
@@ -209,7 +223,8 @@ class pmTrSharepointClass{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function uploadDocumentDWS($dwsname, $folderName, $sourceUrl, $filename) {
|
function uploadDocumentDWS ($dwsname, $folderName, $sourceUrl, $filename)
|
||||||
|
{
|
||||||
//print "<br>- Method createDWS";
|
//print "<br>- Method createDWS";
|
||||||
$url = $this->server . "/" . $dwsname . "/_vti_bin/Copy.asmx?WSDL";
|
$url = $this->server . "/" . $dwsname . "/_vti_bin/Copy.asmx?WSDL";
|
||||||
$this->dwsObj->setwsdlurl( $url );
|
$this->dwsObj->setwsdlurl( $url );
|
||||||
@@ -234,7 +249,9 @@ class pmTrSharepointClass{
|
|||||||
$content = fread( $filep, $fileLength );
|
$content = fread( $filep, $fileLength );
|
||||||
//$content = base64_encode($content);
|
//$content = base64_encode($content);
|
||||||
|
|
||||||
$paramArray = array('SourceUrl' => $imgfile, 'DestinationUrls' => $destUrlObj, 'Fields' => $fieldInfoCollObj, 'Stream' => $content);
|
|
||||||
|
$paramArray = array ('SourceUrl' => $imgfile,'DestinationUrls' => $destUrlObj,'Fields' => $fieldInfoCollObj,'Stream' => $content
|
||||||
|
);
|
||||||
$methodName = 'CopyIntoItems';
|
$methodName = 'CopyIntoItems';
|
||||||
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray );
|
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray );
|
||||||
var_dump( $result );
|
var_dump( $result );
|
||||||
@@ -246,7 +263,8 @@ class pmTrSharepointClass{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDWSMetaData($newFileName, $dwsname, $id) {
|
function getDWSMetaData ($newFileName, $dwsname, $id)
|
||||||
|
{
|
||||||
//print "<br>- Method createDWS";
|
//print "<br>- Method createDWS";
|
||||||
$url = $this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL";
|
$url = $this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL";
|
||||||
$this->dwsObj->setwsdlurl( $url );
|
$this->dwsObj->setwsdlurl( $url );
|
||||||
@@ -254,30 +272,33 @@ class pmTrSharepointClass{
|
|||||||
$this->dwsObj->loadSOAPClient();
|
$this->dwsObj->loadSOAPClient();
|
||||||
|
|
||||||
$doc = "Shared Documents/$newFileName";
|
$doc = "Shared Documents/$newFileName";
|
||||||
$paramArray = array('document' => $doc, 'id' => '', 'minimal' => False);
|
$paramArray = array ('document' => $doc,'id' => '','minimal' => false
|
||||||
|
);
|
||||||
|
|
||||||
$methodName = 'GetDwsMetaData';
|
$methodName = 'GetDwsMetaData';
|
||||||
|
|
||||||
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray );
|
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray );
|
||||||
$sResult = $result->GetDwsMetaDataResult;
|
$sResult = $result->GetDwsMetaDataResult;
|
||||||
$errorReturn = strpos( $sResult, "Error" );
|
$errorReturn = strpos( $sResult, "Error" );
|
||||||
if(isset($sResult) && !$errorReturn)
|
if (isset( $sResult ) && ! $errorReturn) {
|
||||||
{
|
|
||||||
$serializeResult = serialize( $sResult ); // serializing the Array for Returning.
|
$serializeResult = serialize( $sResult ); // serializing the Array for Returning.
|
||||||
var_dump( $serializeResult );
|
var_dump( $serializeResult );
|
||||||
return $serializeResult;
|
return $serializeResult;
|
||||||
|
} else {
|
||||||
|
return $sResult;
|
||||||
}
|
}
|
||||||
else return $sResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDWSDocumentVersions($newFileName, $dwsname) {
|
function getDWSDocumentVersions ($newFileName, $dwsname)
|
||||||
|
{
|
||||||
//print "<br>- Method createDWS";
|
//print "<br>- Method createDWS";
|
||||||
$this->dwsObj->setwsdlurl( $this->server . "/" . $dwsname . "/_vti_bin/Versions.asmx?WSDL" );
|
$this->dwsObj->setwsdlurl( $this->server . "/" . $dwsname . "/_vti_bin/Versions.asmx?WSDL" );
|
||||||
|
|
||||||
$this->dwsObj->loadSOAPClient();
|
$this->dwsObj->loadSOAPClient();
|
||||||
|
|
||||||
$doc = "Shared Documents/$newFileName";
|
$doc = "Shared Documents/$newFileName";
|
||||||
$paramArray = array('fileName' => $doc);
|
$paramArray = array ('fileName' => $doc
|
||||||
|
);
|
||||||
|
|
||||||
$methodName = 'GetVersions';
|
$methodName = 'GetVersions';
|
||||||
|
|
||||||
@@ -286,14 +307,16 @@ class pmTrSharepointClass{
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteDWSDocVersion($newFileName, $dwsname, $versionNum) {
|
function deleteDWSDocVersion ($newFileName, $dwsname, $versionNum)
|
||||||
|
{
|
||||||
//print "<br>- Method createDWS";
|
//print "<br>- Method createDWS";
|
||||||
$this->dwsObj->setwsdlurl( $this->server . "/" . $dwsname . "/_vti_bin/Versions.asmx?WSDL" );
|
$this->dwsObj->setwsdlurl( $this->server . "/" . $dwsname . "/_vti_bin/Versions.asmx?WSDL" );
|
||||||
|
|
||||||
$this->dwsObj->loadSOAPClient();
|
$this->dwsObj->loadSOAPClient();
|
||||||
|
|
||||||
$doc = "Shared Documents/$newFileName";
|
$doc = "Shared Documents/$newFileName";
|
||||||
$paramArray = array('fileName' => $doc, 'fileVersion' => $versionNum);
|
$paramArray = array ('fileName' => $doc,'fileVersion' => $versionNum
|
||||||
|
);
|
||||||
|
|
||||||
$methodName = 'DeleteVersion';
|
$methodName = 'DeleteVersion';
|
||||||
|
|
||||||
@@ -304,14 +327,11 @@ class pmTrSharepointClass{
|
|||||||
$xmlArray = @G::json_decode( @G::json_encode( $xmlNew ), 1 ); // used to convert Objects to array
|
$xmlArray = @G::json_decode( @G::json_encode( $xmlNew ), 1 ); // used to convert Objects to array
|
||||||
$versionCount = count( $xmlArray['result'] );
|
$versionCount = count( $xmlArray['result'] );
|
||||||
|
|
||||||
if($versionCount>1)
|
if ($versionCount > 1) {
|
||||||
{
|
for ($i = 0; $i < $versionCount; $i ++) {
|
||||||
for($i=0;$i<$versionCount;$i++)
|
|
||||||
{
|
|
||||||
$version[] = $xmlArray['result'][$i]['@attributes']['version'];
|
$version[] = $xmlArray['result'][$i]['@attributes']['version'];
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$version[] = $xmlArray['result']['@attributes']['version'];
|
$version[] = $xmlArray['result']['@attributes']['version'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,14 +343,16 @@ class pmTrSharepointClass{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteAllDWSDocVersion($newFileName, $dwsname) {
|
function deleteAllDWSDocVersion ($newFileName, $dwsname)
|
||||||
|
{
|
||||||
//print "<br>- Method createDWS";
|
//print "<br>- Method createDWS";
|
||||||
$this->dwsObj->setwsdlurl( $this->server . "/" . $dwsname . "/_vti_bin/Versions.asmx?WSDL" );
|
$this->dwsObj->setwsdlurl( $this->server . "/" . $dwsname . "/_vti_bin/Versions.asmx?WSDL" );
|
||||||
|
|
||||||
$this->dwsObj->loadSOAPClient();
|
$this->dwsObj->loadSOAPClient();
|
||||||
|
|
||||||
$doc = "Shared Documents/$newFileName";
|
$doc = "Shared Documents/$newFileName";
|
||||||
$paramArray = array('fileName' => $doc);
|
$paramArray = array ('fileName' => $doc
|
||||||
|
);
|
||||||
|
|
||||||
$methodName = 'DeleteAllVersions';
|
$methodName = 'DeleteAllVersions';
|
||||||
|
|
||||||
@@ -346,7 +368,8 @@ class pmTrSharepointClass{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDWSFolderItems($dwsname, $strFolderUrl) {
|
function getDWSFolderItems ($dwsname, $strFolderUrl)
|
||||||
|
{
|
||||||
$pmTrSharepointClassObj = new pmTrSharepointClass();
|
$pmTrSharepointClassObj = new pmTrSharepointClass();
|
||||||
//print "<br>- Method getDWSFolderItems";
|
//print "<br>- Method getDWSFolderItems";
|
||||||
$url = $this->server . "/" . $dwsname . "/_vti_bin/SiteData.asmx?WSDL";
|
$url = $this->server . "/" . $dwsname . "/_vti_bin/SiteData.asmx?WSDL";
|
||||||
@@ -355,7 +378,8 @@ class pmTrSharepointClass{
|
|||||||
$this->dwsObj->loadSOAPClient();
|
$this->dwsObj->loadSOAPClient();
|
||||||
|
|
||||||
#$doc = "Shared Documents/$newFileName";
|
#$doc = "Shared Documents/$newFileName";
|
||||||
$paramArray = array('strFolderUrl' => $strFolderUrl);
|
$paramArray = array ('strFolderUrl' => $strFolderUrl
|
||||||
|
);
|
||||||
|
|
||||||
$methodName = 'EnumerateFolder';
|
$methodName = 'EnumerateFolder';
|
||||||
|
|
||||||
@@ -384,7 +408,8 @@ class pmTrSharepointClass{
|
|||||||
return "There is some error";
|
return "There is some error";
|
||||||
}
|
}
|
||||||
|
|
||||||
function downloadDocumentDWS($dwsname, $fileName, $fileLocation) {
|
function downloadDocumentDWS ($dwsname, $fileName, $fileLocation)
|
||||||
|
{
|
||||||
//print "<br>- Method createDWS";
|
//print "<br>- Method createDWS";
|
||||||
$url = $this->server . "/" . $dwsname . "/_vti_bin/Copy.asmx?WSDL";
|
$url = $this->server . "/" . $dwsname . "/_vti_bin/Copy.asmx?WSDL";
|
||||||
$this->dwsObj->setwsdlurl( $url );
|
$this->dwsObj->setwsdlurl( $url );
|
||||||
@@ -392,7 +417,8 @@ class pmTrSharepointClass{
|
|||||||
$this->dwsObj->loadSOAPClient();
|
$this->dwsObj->loadSOAPClient();
|
||||||
|
|
||||||
$CompleteUrl = $this->server . "/" . $dwsname . "/Shared Documents/" . $fileName;
|
$CompleteUrl = $this->server . "/" . $dwsname . "/Shared Documents/" . $fileName;
|
||||||
$paramArray = array('Url' => $CompleteUrl);
|
$paramArray = array ('Url' => $CompleteUrl
|
||||||
|
);
|
||||||
|
|
||||||
$methodName = 'GetItem';
|
$methodName = 'GetItem';
|
||||||
|
|
||||||
@@ -403,7 +429,7 @@ class pmTrSharepointClass{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* In the Below line of code, we are coping the files at our local Directory using the php file methods.
|
* In the Below line of code, we are coping the files at our local Directory using the php file methods.
|
||||||
* */
|
*/
|
||||||
$imgfile = $fileLocation . "/" . $fileName;
|
$imgfile = $fileLocation . "/" . $fileName;
|
||||||
$filep = fopen( $imgfile, 'w' );
|
$filep = fopen( $imgfile, 'w' );
|
||||||
//$content = fwrite($filep, $latestResult);
|
//$content = fwrite($filep, $latestResult);
|
||||||
@@ -411,7 +437,8 @@ class pmTrSharepointClass{
|
|||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFolderUrlContent($newResult) {
|
function getFolderUrlContent ($newResult)
|
||||||
|
{
|
||||||
$needleStart = '/';
|
$needleStart = '/';
|
||||||
$needleCount = substr_count( $newResult, $needleStart );
|
$needleCount = substr_count( $newResult, $needleStart );
|
||||||
|
|
||||||
@@ -423,11 +450,10 @@ class pmTrSharepointClass{
|
|||||||
$newResultPos ++;
|
$newResultPos ++;
|
||||||
$actualResult = substr( $newResult, $newResultPos );
|
$actualResult = substr( $newResult, $newResultPos );
|
||||||
return $actualResult;
|
return $actualResult;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$actualResult = substr( $newResult, $urlStartPos );
|
$actualResult = substr( $newResult, $urlStartPos );
|
||||||
return $actualResult;
|
return $actualResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user