From f07f0d1e7de8c5168da95630e3c747416c3e46ab Mon Sep 17 00:00:00 2001 From: Fernando Ontiveros Date: Tue, 9 Oct 2012 13:43:23 -0400 Subject: [PATCH] CODE STYLE class.xmlfield_Image.php and class.xmlfield_InputPM.php --- .../engine/classes/class.xmlfield_Image.php | 40 +- .../engine/classes/class.xmlfield_InputPM.php | 784 +++++++++--------- 2 files changed, 423 insertions(+), 401 deletions(-) diff --git a/workflow/engine/classes/class.xmlfield_Image.php b/workflow/engine/classes/class.xmlfield_Image.php index a01eedeb0..51f2f5c3b 100755 --- a/workflow/engine/classes/class.xmlfield_Image.php +++ b/workflow/engine/classes/class.xmlfield_Image.php @@ -1,6 +1,8 @@ . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. @@ -26,23 +28,27 @@ // DEPRECATED this class is also part of the xmlform package this class will be also removed // in future releases of pm, its discouraged the inclusion this class in the future from a // external file like this - /** +/** + * * @package workflow.engine.classes */ class XmlForm_Field_Image extends XmlForm_Field { - var $file = ''; - var $home = 'public_html'; - var $withoutLabel = false; - function render( $value, $owner = null ) - { - $url = G::replaceDataField($this->file, $owner->values); - if ($this->home === "methods") $url = G::encryptlink( SYS_URI . $url ); - if ($this->home === "public_html") $url ='/' . $url ; - return 'style)?'style="'.$this->style.'"':'') - .' alt ="'.htmlentities($value,ENT_QUOTES,'utf-8').'"/>'; - } - } -?> \ No newline at end of file + public $file = ''; + public $home = 'public_html'; + public $withoutLabel = false; + + public function render ($value, $owner = null) + { + $url = G::replaceDataField( $this->file, $owner->values ); + if ($this->home === "methods") { + $url = G::encryptlink( SYS_URI . $url ); + } + if ($this->home === "public_html") { + $url = '/' . $url; + } + return 'style) ? 'style="' . $this->style . '"' : '') . ' alt ="' . htmlentities( $value, ENT_QUOTES, 'utf-8' ) . '"/>'; + } +} + diff --git a/workflow/engine/classes/class.xmlfield_InputPM.php b/workflow/engine/classes/class.xmlfield_InputPM.php index 1d4b22ddf..e5ec93b83 100755 --- a/workflow/engine/classes/class.xmlfield_InputPM.php +++ b/workflow/engine/classes/class.xmlfield_InputPM.php @@ -1,6 +1,8 @@ . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. @@ -27,125 +29,129 @@ class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText { - var $size=15; - var $maxLength=64; - var $validate='Any'; - var $mask = ''; - var $defaultValue=''; - var $required=false; - var $dependentFields=''; - var $linkField=''; -//Possible values:(-|UPPER|LOWER|CAPITALIZE) - var $strTo=''; - var $readOnly=false; - var $sqlConnection=0; - var $sql=''; - var $sqlOption=array(); - //Atributes only for grids - var $formula = ''; - var $function = ''; - var $replaceTags = 0; - var $showVars = 0; - var $process = ''; - var $symbol = '@@'; + public $size = 15; + public $maxLength = 64; + public $validate = 'Any'; + public $mask = ''; + public $defaultValue = ''; + public $required = false; + public $dependentFields = ''; + public $linkField = ''; + //Possible values:(-|UPPER|LOWER|CAPITALIZE) + public $strTo = ''; + public $readOnly = false; + public $sqlConnection = 0; + public $sql = ''; + public $sqlOption = array (); + //Atributes only for grids + public $formula = ''; + public $function = ''; + public $replaceTags = 0; + public $showVars = 0; + public $process = ''; + public $symbol = '@@'; - /** - * Function render - * @author Julio Cesar Laura Avendano - * @access public - * @parameter string value - * @parameter string owner - * @return string - */ - function render( $value = NULL , $owner = NULL ) - { - //$this->executeSQL(); - //if (isset($this->sqlOption)) { - // reset($this->sqlOption); - // $firstElement=key($this->sqlOption); - // if (isset($firstElement)) $value = $firstElement; - //} - //NOTE: string functions must be in G class - if ($this->strTo==='UPPER') - $value = strtoupper($value); - if ($this->strTo==='LOWER') - $value = strtolower($value); - //if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value); - $onkeypress = G::replaceDataField( $this->onkeypress, $owner->values ); - if ($this->replaceTags == 1) { - $value = G::replaceDataField( $value, $owner->values ); + /** + * Function render + * + * @author Julio Cesar Laura Avendano + * @access public + * @param eter string value + * @param eter string owner + * @return string + */ + public function render ($value = null, $owner = null) + { + //$this->executeSQL(); + //if (isset($this->sqlOption)) { + // reset($this->sqlOption); + // $firstElement=key($this->sqlOption); + // if (isset($firstElement)) $value = $firstElement; + //} + //NOTE: string functions must be in G class + if ($this->strTo === 'UPPER') { + $value = strtoupper( $value ); + } + if ($this->strTo === 'LOWER') { + $value = strtolower( $value ); + } + //if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value); + $onkeypress = G::replaceDataField( $this->onkeypress, $owner->values ); + if ($this->replaceTags == 1) { + $value = G::replaceDataField( $value, $owner->values ); + } + if ($this->showVars == 1) { + $this->process = G::replaceDataField( $this->process, $owner->values ); + //$sShowVars = ' ' . $this->symbol . ''; + $sShowVars = ' '; + } else { + $sShowVars = ''; + } + if ($this->mode === 'edit') { + if ($this->readOnly) { + return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' readOnly="readOnly" style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars; + } else { + return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars; + } + } elseif ($this->mode === 'view') { + return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' style="display:none;' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + } else { + return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + } } - if ($this->showVars == 1) { - $this->process = G::replaceDataField($this->process, $owner->values ); - //$sShowVars = ' ' . $this->symbol . ''; - $sShowVars = ' '; - } - else { - $sShowVars = ''; - } - if ($this->mode==='edit') { - if ($this->readOnly) - return 'htmlentities( $value , ENT_COMPAT, 'utf-8').'\' readOnly="readOnly" style="'.htmlentities( $this->style , ENT_COMPAT, 'utf-8').'" onkeypress="'.htmlentities( $onkeypress , ENT_COMPAT, 'utf-8').'"/>' . $sShowVars; - else - return 'htmlentities( $value , ENT_COMPAT, 'utf-8').'\' style="'.htmlentities( $this->style , ENT_COMPAT, 'utf-8').'" onkeypress="'.htmlentities( $onkeypress , ENT_COMPAT, 'utf-8').'"/>' . $sShowVars; - } elseif ($this->mode==='view') { - return 'htmlentities( $value , ENT_COMPAT, 'utf-8').'\' style="display:none;'.htmlentities( $this->style , ENT_COMPAT, 'utf-8').'" onkeypress="'.htmlentities( $onkeypress , ENT_COMPAT, 'utf-8').'"/>' . - $this->htmlentities( $value , ENT_COMPAT, 'utf-8'); - } else { - return $this->htmlentities( $value , ENT_COMPAT, 'utf-8'); - } - } - /** - * Function renderGrid - * @author Julio Cesar Laura Avendano - * @access public - * @parameter array values - * @parameter string owner - * @return string - */ - function renderGrid( $values=array() , $owner ) - { - $result=array(); - $r=1; - foreach($values as $v) { - if ($this->replaceTags == 1) { - $v = G::replaceDataField( $v, $owner->values ); - } - if ($this->showVars == 1) { - $this->process = G::replaceDataField($this->process, $owner->values ); - //$sShowVars = ' ' . $this->symbol . ''; - $sShowVars = ' '; - } - else { - $sShowVars = ''; - } - if ($this->mode==='edit') { - if ($this->readOnly) - $result[] = '' . $sShowVars; - else - $result[] = '' . $sShowVars; - } elseif ($this->mode==='view') { - $result[] = $this->htmlentities( $v , ENT_COMPAT, 'utf-8'); - } else { - $result[] = $this->htmlentities( $v , ENT_COMPAT, 'utf-8'); - } - $r++; + /** + * Function renderGrid + * + * @author Julio Cesar Laura Avendano + * @access public + * @param eter array values + * @param eter string owner + * @return string + */ + public function renderGrid ($values = array(), $owner) + { + $result = array (); + $r = 1; + foreach ($values as $v) { + if ($this->replaceTags == 1) { + $v = G::replaceDataField( $v, $owner->values ); + } + if ($this->showVars == 1) { + $this->process = G::replaceDataField( $this->process, $owner->values ); + //$sShowVars = ' ' . $this->symbol . ''; + $sShowVars = ' '; + } else { + $sShowVars = ''; + } + if ($this->mode === 'edit') { + if ($this->readOnly) { + $result[] = '' . $sShowVars; + } else { + $result[] = '' . $sShowVars; + } + } elseif ($this->mode === 'view') { + $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); + } else { + $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); + } + $r ++; + } + return $result; } - return $result; - } - /** - * Function attachEvents - * @access public - * @parameter string $element - * @return string - */ - function attachEvents($element) - { - return "myForm.aElements[i] = new G_Text(myForm, $element,'{$this->name}'); + /** + * Function attachEvents + * + * @access public + * @param eter string $element + * @return string + */ + public function attachEvents ($element) + { + return "myForm.aElements[i] = new G_Text(myForm, $element,'{$this->name}'); myForm.aElements[i].setAttributes(" . $this->getAttributes() . ");"; - } + } } /** @@ -153,86 +159,87 @@ class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText */ class XmlForm_Field_TextareaPM extends XmlForm_Field { - var $rows = 12; - var $cols = 40; - var $required = false; - var $readOnly = false; - var $wrap = 'OFF'; - var $showVars = 0; - var $process = ''; - var $symbol = '@@'; + public $rows = 12; + public $cols = 40; + public $required = false; + public $readOnly = false; + public $wrap = 'OFF'; + public $showVars = 0; + public $process = ''; + public $symbol = '@@'; - /** - * Function render - * @author Julio Cesar Laura Avendao - * @access public - * @parameter string value - * @parameter string owner - * @return string - */ - function render( $value = NULL, $owner ) - { - if ($this->showVars == 1) { - $this->process = G::replaceDataField($this->process, $owner->values ); - $sShowVars = ' '; + /** + * Function render + * + * @author Julio Cesar Laura Avendao + * @access public + * @param eter string value + * @param eter string owner + * @return string + */ + public function render ($value = null, $owner) + { + if ($this->showVars == 1) { + $this->process = G::replaceDataField( $this->process, $owner->values ); + $sShowVars = ' '; + } else { + $sShowVars = ''; + } + if ($this->mode === 'edit') { + if ($this->readOnly) { + return '' . $sShowVars; + } else { + return '' . $sShowVars; + } + } elseif ($this->mode === 'view') { + return ''; + } else { + return ''; + } } - else { - $sShowVars = ''; - } - if ($this->mode==='edit') { - if ($this->readOnly) - return '' . $sShowVars; - else - return '' . $sShowVars; - } elseif ($this->mode==='view') { - return ''; - } else { - return ''; - } - } - /** - * Function renderGrid - * @author Julio Cesar Laura Avendano - * @access public - * @parameter string values - * @parameter string owner - * @return string - */ - function renderGrid( $values = NULL , $owner ) - { - $result=array(); - $r=1; - foreach($values as $v) { - if ($this->showVars == 1) { - $this->process = G::replaceDataField($this->process, $owner->values ); - //$sShowVars = ' ' . $this->symbol . ''; - $sShowVars = ' '; - } - else { - $sShowVars = ''; - } - if ($this->mode==='edit') { - if ($this->readOnly) - $result[] = 'htmlentities( $v , ENT_COMPAT, 'utf-8').'\' readOnly="readOnly"/>' . $sShowVars; - else - $result[] = 'htmlentities( $v , ENT_COMPAT, 'utf-8').'\' />' . $sShowVars; - } elseif ($this->mode==='view') { - if(stristr($_SERVER['HTTP_USER_AGENT'], 'iPhone')){ - //$result[] = '
'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'
'; - $result[] = $this->htmlentities( $v , ENT_COMPAT, 'utf-8'); - } - else{ - //$result[] = '
'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'
'; - $result[] = $this->htmlentities( $v , ENT_COMPAT, 'utf-8'); - } - } else{ - $result[] = $this->htmlentities( $v , ENT_COMPAT, 'utf-8'); - } - $r++; + /** + * Function renderGrid + * + * @author Julio Cesar Laura Avendano + * @access public + * @param eter string values + * @param eter string owner + * @return string + */ + public function renderGrid ($values = null, $owner) + { + $result = array (); + $r = 1; + foreach ($values as $v) { + if ($this->showVars == 1) { + $this->process = G::replaceDataField( $this->process, $owner->values ); + //$sShowVars = ' ' . $this->symbol . ''; + $sShowVars = ' '; + } else { + $sShowVars = ''; + } + if ($this->mode === 'edit') { + if ($this->readOnly) { + $result[] = 'htmlentities( $v, ENT_COMPAT, 'utf-8' ) . '\' readOnly="readOnly"/>' . $sShowVars; + } else { + $result[] = 'htmlentities( $v, ENT_COMPAT, 'utf-8' ) . '\' />' . $sShowVars; + } + } elseif ($this->mode === 'view') { + if (stristr( $_SERVER['HTTP_USER_AGENT'], 'iPhone' )) { + //$result[] = '
'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'
'; + $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); + } else { + //$result[] = '
'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'
'; + $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); + } + } else { + $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); + } + $r ++; + } + return $result; } - return $result; - } } /** @@ -240,230 +247,239 @@ class XmlForm_Field_TextareaPM extends XmlForm_Field */ class XmlForm_Field_hours extends XmlForm_Field_SimpleText { - var $size = 15; - var $maxLength = 64; - var $validate = 'Any'; - var $mask = ''; - var $defaultValue = ''; - var $required = false; - var $dependentFields= ''; - var $linkField = ''; -//Possible values:(-|UPPER|LOWER|CAPITALIZE) - var $strTo = ''; - var $readOnly = false; - var $sqlConnection = 0; - var $sql = ''; - var $sqlOption = array(); - //Atributes only for grids - var $formula = ''; - var $function = ''; - var $replaceTags = 0; - var $showVars = 0; - var $process = ''; - var $symbol = '@@'; + public $size = 15; + public $maxLength = 64; + public $validate = 'Any'; + public $mask = ''; + public $defaultValue = ''; + public $required = false; + public $dependentFields = ''; + public $linkField = ''; + //Possible values:(-|UPPER|LOWER|CAPITALIZE) + public $strTo = ''; + public $readOnly = false; + public $sqlConnection = 0; + public $sql = ''; + public $sqlOption = array (); + //Atributes only for grids + public $formula = ''; + public $function = ''; + public $replaceTags = 0; + public $showVars = 0; + public $process = ''; + public $symbol = '@@'; - /** - * Function render - * @author Julio Cesar Laura Avendano - * @access public - * @parameter string value - * @parameter string owner - * @return string - */ - function render( $value = NULL , $owner = NULL ) - { - if ($this->strTo==='UPPER') - $value = strtoupper($value); - if ($this->strTo==='LOWER') - $value = strtolower($value); - //if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value); - $onkeypress = G::replaceDataField( $this->onkeypress, $owner->values ); - if ($this->replaceTags == 1) { - $value = G::replaceDataField( $value, $owner->values ); + /** + * Function render + * + * @author Julio Cesar Laura Avendano + * @access public + * @param eter string value + * @param eter string owner + * @return string + */ + public function render ($value = null, $owner = null) + { + if ($this->strTo === 'UPPER') { + $value = strtoupper( $value ); + } + if ($this->strTo === 'LOWER') { + $value = strtolower( $value ); + } + //if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value); + $onkeypress = G::replaceDataField( $this->onkeypress, $owner->values ); + if ($this->replaceTags == 1) { + $value = G::replaceDataField( $value, $owner->values ); + } + if ($this->showVars == 1) { + $this->process = G::replaceDataField( $this->process, $owner->values ); + //$sShowVars = ' ' . $this->symbol . ''; + $sShowVars = ' '; + } else { + $sShowVars = ''; + } + if ($this->mode === 'edit') { + if ($this->readOnly) { + return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' readOnly="readOnly" style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars; + } else { + return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars; + } + } elseif ($this->mode === 'view') { + return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' style="display:none;' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + } else { + return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + } } - if ($this->showVars == 1) { - $this->process = G::replaceDataField($this->process, $owner->values ); - //$sShowVars = ' ' . $this->symbol . ''; - $sShowVars = ' '; - } - else { - $sShowVars = ''; - } - if ($this->mode==='edit') { - if ($this->readOnly) - return 'htmlentities( $value , ENT_COMPAT, 'utf-8').'\' readOnly="readOnly" style="'.htmlentities( $this->style , ENT_COMPAT, 'utf-8').'" onkeypress="'.htmlentities( $onkeypress , ENT_COMPAT, 'utf-8').'"/>' . $sShowVars; - else - return 'htmlentities( $value , ENT_COMPAT, 'utf-8').'\' style="'.htmlentities( $this->style , ENT_COMPAT, 'utf-8').'" onkeypress="'.htmlentities( $onkeypress , ENT_COMPAT, 'utf-8').'"/>' . $sShowVars; - } elseif ($this->mode==='view') { - return 'htmlentities( $value , ENT_COMPAT, 'utf-8').'\' style="display:none;'.htmlentities( $this->style , ENT_COMPAT, 'utf-8').'" onkeypress="'.htmlentities( $onkeypress , ENT_COMPAT, 'utf-8').'"/>' . - $this->htmlentities( $value , ENT_COMPAT, 'utf-8'); - } else { - return $this->htmlentities( $value , ENT_COMPAT, 'utf-8'); - } - } - /** - * Function renderGrid - * @author Julio Cesar Laura Avendano - * @access public - * @parameter array values - * @parameter string owner - * @return string - */ - function renderGrid( $values=array() , $owner ) - { - $result=array(); - $r=1; - foreach($values as $v) { - if ($this->replaceTags == 1) { - $v = G::replaceDataField( $v, $owner->values ); - } - if ($this->showVars == 1) { - $this->process = G::replaceDataField($this->process, $owner->values ); - //$sShowVars = ' ' . $this->symbol . ''; - $sShowVars = ' '; - } - else { - $sShowVars = ''; - } - if ($this->mode==='edit') { - if ($this->readOnly) - $result[] = '' . $sShowVars; - else - $result[] = '' . $sShowVars; - } elseif ($this->mode==='view') { - $result[] = '

'.$this->htmlentities( number_format($v, 2), ENT_COMPAT, 'utf-8').'

'; - } else { - $result[] = '

'.$this->htmlentities( number_format($v, 2), ENT_COMPAT, 'utf-8').'

'; - } - $r++; + /** + * Function renderGrid + * + * @author Julio Cesar Laura Avendano + * @access public + * @param eter array values + * @param eter string owner + * @return string + */ + public function renderGrid ($values = array(), $owner) + { + $result = array (); + $r = 1; + foreach ($values as $v) { + if ($this->replaceTags == 1) { + $v = G::replaceDataField( $v, $owner->values ); + } + if ($this->showVars == 1) { + $this->process = G::replaceDataField( $this->process, $owner->values ); + //$sShowVars = ' ' . $this->symbol . ''; + $sShowVars = ' '; + } else { + $sShowVars = ''; + } + if ($this->mode === 'edit') { + if ($this->readOnly) { + $result[] = '' . $sShowVars; + } else { + $result[] = '' . $sShowVars; + } + } elseif ($this->mode === 'view') { + $result[] = '

' . $this->htmlentities( number_format( $v, 2 ), ENT_COMPAT, 'utf-8' ) . '

'; + } else { + $result[] = '

' . $this->htmlentities( number_format( $v, 2 ), ENT_COMPAT, 'utf-8' ) . '

'; + } + $r ++; + } + return $result; } - return $result; - } - /** - * Function attachEvents - * @access public - * @parameter string $element - * @return string - */ - function attachEvents($element) - { - return "myForm.aElements[i] = new G_Text(myForm, $element,'{$this->name}'); + /** + * Function attachEvents + * + * @access public + * @param eter string $element + * @return string + */ + public function attachEvents ($element) + { + return "myForm.aElements[i] = new G_Text(myForm, $element,'{$this->name}'); myForm.aElements[i].setAttributes(" . $this->getAttributes() . ");"; - } + } } - /** - * Function getDynaformsVars - * @access public - * @parameter string $sProcessUID - * @parameter boolean $bSystemVars - * @return array - */ - function getDynaformsVars($sProcessUID, $bSystemVars = true, $bIncMulSelFields = 0) - { - $aFields = array(); - $aFieldsNames = array(); +/** + * Function getDynaformsVars + * + * @access public + * @param eter string $sProcessUID + * @param eter boolean $bSystemVars + * @return array + */ +public function getDynaformsVars ($sProcessUID, $bSystemVars = true, $bIncMulSelFields = 0) +{ + $aFields = array (); + $aFieldsNames = array (); if ($bSystemVars) { - $aAux = G::getSystemConstants(); - foreach ($aAux as $sName => $sValue) { - $aFields[] = array('sName' => $sName, 'sType' => 'system', 'sLabel'=> 'System variable'); - } - //we're adding the ping variable to the system list - $aFields[] = array('sName' => 'PIN', 'sType' => 'system', 'sLabel' => 'System variable'); + $aAux = G::getSystemConstants(); + foreach ($aAux as $sName => $sValue) { + $aFields[] = array ('sName' => $sName,'sType' => 'system','sLabel' => 'System variable' + ); + } + //we're adding the ping variable to the system list + $aFields[] = array ('sName' => 'PIN','sType' => 'system','sLabel' => 'System variable' + ); } - $aInvalidTypes = array('title', 'subtitle', 'link', 'file', 'button', 'reset', 'submit', 'javascript'); - $aMultipleSelectionFields = array('listbox', 'checkgroup', 'grid'); + $aInvalidTypes = array ('title','subtitle','link','file','button','reset','submit','javascript' + ); + $aMultipleSelectionFields = array ('listbox','checkgroup','grid' + ); if ($bIncMulSelFields != 0) { - $aInvalidTypes = array_merge($aInvalidTypes, $aMultipleSelectionFields); + $aInvalidTypes = array_merge( $aInvalidTypes, $aMultipleSelectionFields ); } require_once 'classes/model/Dynaform.php'; - $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn(DynaformPeer::DYN_FILENAME); - $oCriteria->add(DynaformPeer::PRO_UID, $sProcessUID); - $oCriteria->add(DynaformPeer::DYN_TYPE, 'xmlform'); - $oDataset = DynaformPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->addSelectColumn( DynaformPeer::DYN_FILENAME ); + $oCriteria->add( DynaformPeer::PRO_UID, $sProcessUID ); + $oCriteria->add( DynaformPeer::DYN_TYPE, 'xmlform' ); + $oDataset = DynaformPeer::doSelectRS( $oCriteria ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->next(); while ($aRow = $oDataset->getRow()) { - if (file_exists(PATH_DYNAFORM . PATH_SEP . $aRow['DYN_FILENAME'] . '.xml')) { - $G_FORM = new Form($aRow['DYN_FILENAME'], PATH_DYNAFORM, SYS_LANG); - if (($G_FORM->type == 'xmlform') || ($G_FORM->type == '')) { - foreach($G_FORM->fields as $k => $v) { - if (!in_array($v->type, $aInvalidTypes)) { - if (!in_array($k, $aFieldsNames)) { - $aFields[] = array('sName' => $k, - 'sType' => $v->type, - 'sLabel'=> ($v->type != 'grid' ? $v->label : '[ ' . G::LoadTranslation('ID_GRID') . ' ]') - ); - $aFieldsNames[] = $k; - } + if (file_exists( PATH_DYNAFORM . PATH_SEP . $aRow['DYN_FILENAME'] . '.xml' )) { + $G_FORM = new Form( $aRow['DYN_FILENAME'], PATH_DYNAFORM, SYS_LANG ); + if (($G_FORM->type == 'xmlform') || ($G_FORM->type == '')) { + foreach ($G_FORM->fields as $k => $v) { + if (! in_array( $v->type, $aInvalidTypes )) { + if (! in_array( $k, $aFieldsNames )) { + $aFields[] = array ('sName' => $k,'sType' => $v->type,'sLabel' => ($v->type != 'grid' ? $v->label : '[ ' . G::LoadTranslation( 'ID_GRID' ) . ' ]') + ); + $aFieldsNames[] = $k; + } + } + } } - } } - } - $oDataset->next(); + $oDataset->next(); } return $aFields; - } +} - /** - * Function getGridsVars - * @access public - * @parameter string $sProcessUID - * @return array - */ - function getGridsVars($sProcessUID) - { - $aFields = array(); - $aFieldsNames = array(); +/** + * Function getGridsVars + * + * @access public + * @param eter string $sProcessUID + * @return array + */ +public function getGridsVars ($sProcessUID) +{ + $aFields = array (); + $aFieldsNames = array (); require_once 'classes/model/Dynaform.php'; - $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn(DynaformPeer::DYN_FILENAME); - $oCriteria->add(DynaformPeer::PRO_UID, $sProcessUID); - $oDataset = DynaformPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->addSelectColumn( DynaformPeer::DYN_FILENAME ); + $oCriteria->add( DynaformPeer::PRO_UID, $sProcessUID ); + $oDataset = DynaformPeer::doSelectRS( $oCriteria ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->next(); while ($aRow = $oDataset->getRow()) { - $G_FORM = new Form($aRow['DYN_FILENAME'], PATH_DYNAFORM, SYS_LANG); - if ($G_FORM->type == 'xmlform') { - foreach($G_FORM->fields as $k => $v) { - if ($v->type == 'grid') { - if (!in_array($k, $aFieldsNames)) { - $aFields[] = array('sName' => $k, 'sXmlForm' => str_replace($sProcessUID . '/', '', $v->xmlGrid)); - $aFieldsNames[] = $k; + $G_FORM = new Form( $aRow['DYN_FILENAME'], PATH_DYNAFORM, SYS_LANG ); + if ($G_FORM->type == 'xmlform') { + foreach ($G_FORM->fields as $k => $v) { + if ($v->type == 'grid') { + if (! in_array( $k, $aFieldsNames )) { + $aFields[] = array ('sName' => $k,'sXmlForm' => str_replace( $sProcessUID . '/', '', $v->xmlGrid ) + ); + $aFieldsNames[] = $k; + } + } } - } } - } - $oDataset->next(); + $oDataset->next(); } return $aFields; - } +} /** * Class XmlForm_Field_CheckBoxTable */ class XmlForm_Field_CheckBoxTable extends XmlForm_Field_Checkbox { - /** - * Function render - * @author The Answer - * @access public - * @parameter string value - * @parameter string owner - * @return string - */ - function render( $value = NULL , $owner = NULL ) - { - //$optionName = $owner->values['USR_UID']; - $optionName = $value; - $onclick = (($this->onclick)? ' onclick="' . G::replaceDataField( $this->onclick, $owner->values ) . '" ' : ''); - $html =' '; - return $html; - } + + /** + * Function render + * + * @author The Answer + * @access public + * @param eter string value + * @param eter string owner + * @return string + */ + public function render ($value = null, $owner = null) + { + //$optionName = $owner->values['USR_UID']; + $optionName = $value; + $onclick = (($this->onclick) ? ' onclick="' . G::replaceDataField( $this->onclick, $owner->values ) . '" ' : ''); + $html = ' '; + return $html; + } } -?> +