diff --git a/workflow/engine/classes/class.xmlfield_InputPM.php b/workflow/engine/classes/class.xmlfield_InputPM.php index 1bae9495b..b5272cb36 100755 --- a/workflow/engine/classes/class.xmlfield_InputPM.php +++ b/workflow/engine/classes/class.xmlfield_InputPM.php @@ -25,7 +25,7 @@ * Coral Gables, FL, 33134, USA, or email info@colosa.com. * * @package workflow.engine.classes - */ + **/ class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText { @@ -432,6 +432,7 @@ function getGridsVars ($sProcessUID) { $aFields = array (); $aFieldsNames = array (); + require_once 'classes/model/Dynaform.php'; $oCriteria = new Criteria( 'workflow' ); $oCriteria->addSelectColumn( DynaformPeer::DYN_FILENAME ); @@ -445,8 +446,7 @@ function getGridsVars ($sProcessUID) 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 ) - ); + $aFields[] = array ('sName' => $k,'sXmlForm' => str_replace( $sProcessUID . '/', '', $v->xmlGrid )); $aFieldsNames[] = $k; } } @@ -456,6 +456,51 @@ function getGridsVars ($sProcessUID) } return $aFields; } +/* +function getVarsGrid () +{ + + $aFields = array (); + $aFieldsNames = array (); + require_once 'classes/model/Dynaform.php'; + + $aFields = new Dynaform(); + //$aFields->getDynaformFields( $caseId ); + $aFields->getDynaformFields( '45855056550a69a8cbeed24036053462' ); + G::pr($aFields); + return $aFields; +} +*/ + +function getVarsGrid ($proUid, $dynUid) +{ + G::LoadClass( 'dynaformhandler' ); + G::LoadClass( 'AppSolr' ); + + $dynaformFields = array (); + + if (is_file( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'.$dynUid. '.xml' ) && filesize( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'. $dynUid .'.xml' ) > 0) { + $dyn = new dynaFormHandler( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/' .$proUid. '/' . $dynUid .'.xml' ); + $dynaformFields[] = $dyn->getFields(); + } + + $dynaformFieldTypes = array (); + + foreach ($dynaformFields as $aDynFormFields) { + foreach ($aDynFormFields as $field) { + + if ($field->getAttribute( 'validate' ) == 'Int') { + $dynaformFieldTypes[$field->nodeName] = 'Int'; + } elseif ($field->getAttribute( 'validate' ) == 'Real') { + $dynaformFieldTypes[$field->nodeName] = 'Real'; + } else { + $dynaformFieldTypes[$field->nodeName] = $field->getAttribute( 'type' ); + } + } + } + return $dynaformFieldTypes; +} + /** * Class XmlForm_Field_CheckBoxTable diff --git a/workflow/engine/methods/processes/processes_Ajax.php b/workflow/engine/methods/processes/processes_Ajax.php index eaf6c3c28..d93ecb72b 100755 --- a/workflow/engine/methods/processes/processes_Ajax.php +++ b/workflow/engine/methods/processes/processes_Ajax.php @@ -552,6 +552,36 @@ try { $_REQUEST['prefix'] = $_REQUEST['prefix']!=null?$_REQUEST['prefix']:'ID_TO_STRING'; echo G::LoadTranslation($_REQUEST['prefix']); break; + + case 'getGridList': + G::LoadClass('xmlfield_InputPM'); + $proUid= isset( $_REQUEST['PRO_UID'] )?$_REQUEST['PRO_UID']:''; + + $aFields = getGridsVars( $proUid ); + + $aVariables = array(); + foreach ($aFields as $key => $value){ + $aVariables[] = $aFields[$key]; + } + echo Bootstrap::json_encode( $aVariables ); + break; + + case 'getVariableGrid': + G::LoadClass('xmlfield_InputPM'); + + $proUid= isset( $_REQUEST['PRO_UID'] )?$_REQUEST['PRO_UID']:''; + $dynUid= isset( $_REQUEST['DYN_UID'] )?$_REQUEST['DYN_UID']:''; + + $aFields = getVarsGrid($proUid, $dynUid); + + $aVariables = array(); + + foreach ($aFields as $key => $value) { + $aVariables[] = $key; + } + + echo Bootstrap::json_encode( $aVariables ); + break; /* case 'saveFile': global $G_PUBLISH;