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