/** * Get Data Generate * * @access public * @param string $pro_uid, Process Uid * @param string $tas_uid, Task Uid * @param string $dyn_uid, Dynaform Uid * @return string * * @author Brayan Pereyra (Cochalo) <*****@*****.**> * @copyright Colosa - Bolivia */ public function getDataGenerate($pro_uid, $tas_uid, $dyn_uid) { G::LoadClass ('case'); G::LoadClass ('pmFunctions'); G::LoadClass ("configuration"); $hasTextArea = false; $conf = new \Configurations(); $generalConfCasesList = $conf->getConfiguration("ENVIRONMENT_SETTINGS", ""); if (isset($generalConfCasesList["casesListDateFormat"]) && !empty($generalConfCasesList["casesListDateFormat"])) { $dateFormat = $generalConfCasesList["casesListDateFormat"]; } else { $dateFormat = "Y/m/d"; } $oDyna = new \Dynaform(); $dataTask = $oDyna->load($dyn_uid); if ($dataTask['DYN_VERSION'] > 0) { G::LoadClass("pmDynaform"); $pmDyna = new \pmDynaform(array('APP_DATA' => array())); $pmDyna->fields["CURRENT_DYNAFORM"] = $dyn_uid; $json = G::json_decode($dataTask["DYN_CONTENT"]); $pmDyna->jsonr($json); $fieldsDyna = $json->items[0]->items; $xmlfrm = new \stdclass(); $xmlfrm->fields = array(); foreach ($fieldsDyna as $key => $value) { if ($value[0]->type == 'title' || $value[0]->type == 'submit') { continue; } $temp = new \stdclass(); $temp->type = $value[0]->type; $temp->label = $value[0]->label; $temp->name = $value[0]->name; $temp->required = (isset($value[0]->required)) ? $value[0]->required : 0; $temp->mode = (isset($value[0]->mode)) ? $value[0]->mode : 'edit'; if (!empty($value[0]->options)) { $temp->storeData = '['; foreach ($value[0]->options as $valueOption) { $temp->storeData .= '["' . $valueOption['value'] . '", "' . $valueOption['label'] . '"],'; } $temp->storeData = substr($temp->storeData,0,-1); $temp->storeData .= ']'; } $temp->readOnly = ($temp->mode == 'view') ? "1" : "0"; $temp->colWidth = 200; $xmlfrm->fields[] = $temp; } } else { $filename = $pro_uid . PATH_SEP . $dyn_uid . ".xml"; if (!class_exists('Smarty')) { require_once(PATH_THIRDPARTY . 'smarty' . PATH_SEP . 'libs' . PATH_SEP . 'Smarty.class.php'); } $xmlfrm = new \XmlForm(); $xmlfrm->home = PATH_DYNAFORM; $xmlfrm->parseFile($filename, SYS_LANG, true); } $caseColumns = array(); $caseReaderFields = array(); $dropList = array(); $comboBoxYesNoList = array(); $caseColumns[] = array("header" => "APP_UID", "dataIndex" => "APP_UID", "width" => 100, "hidden" => true, "hideable" => false); $caseColumns[] = array("header" => "#", "dataIndex" => "APP_NUMBER", "width" => 40, "sortable" => true); $caseColumns[] = array("header" => G::LoadTranslation("ID_TITLE"), "dataIndex" => "APP_TITLE", "width" => 180, "renderer" => "renderTitle", "sortable" => true); $caseColumns[] = array("header" => G::LoadTranslation("ID_SUMMARY"), "width" => 60, "renderer" => "renderSummary", "align" => "center"); $caseColumns[] = array("header" => "DEL_INDEX", "dataIndex" => "DEL_INDEX", "width" => 100, "hidden" => true, "hideable" => false); $caseReaderFields[] = array("name" => "APP_UID"); $caseReaderFields[] = array("name" => "APP_NUMBER"); $caseReaderFields[] = array("name" => "APP_TITLE"); $caseReaderFields[] = array("name" => "DEL_INDEX"); //$caseColumns[] = array("header" => "FLAG", "dataIndex" => "FLAG", "width" => 55, "xtype"=>"checkcolumn"); //$caseReaderFields[] = array("name" => "FLAG", "type"=>"bool"); foreach ($xmlfrm->fields as $index => $value) { $field = $value; $editor = null; $renderer = null; $readOnly = (isset($field->readOnly))? $field->readOnly : null; $required = (isset($field->required))? $field->required : null; $validate = (isset($field->validate))? strtolower($field->validate) : null; $fieldReadOnly = ($readOnly . "" == "1")? "readOnly: true," : null; $fieldRequired = ($required . "" == "1")? "allowBlank: false," : null; $fieldValidate = ($validate == "alpha" || $validate == "alphanum" || $validate == "email" || $validate == "int" || $validate == "real")? "vtype: \"$validate\"," : null; $fieldLabel = (($fieldRequired != null)? "<span style='color: red;'>*</span> ": null) . $field->label; $fieldDisabled = ($field->mode != "edit")? "true" : "false"; switch ($field->type) { case "dropdown": $dropList[] = $field->name; $align = "left"; if (empty($field->storeData)) { $editor = "* new Ext.form.ComboBox({ id: \"cbo" . $field->name . "_" . $pro_uid . "\", valueField: 'value', displayField: 'text', /*store: comboStore,*/ store: new Ext.data.JsonStore({ storeId: \"store" . $field->name . "_" . $pro_uid . "\", proxy: new Ext.data.HttpProxy({ url: 'proxyDataCombobox' }), root: 'records', fields: [{name: 'value'}, {name: 'text'} ] }), triggerAction: 'all', mode: 'local', editable: false, disabled: $fieldDisabled, lazyRender: false, $fieldReadOnly $fieldRequired $fieldValidate cls: \"\" }) *"; } else { $editor = "* new Ext.form.ComboBox({ id: \"cbo" . $field->name . "_" . $pro_uid . "\", typeAhead: true, autocomplete:true, editable:false, lazyRender:true, mode:'local', triggerAction:'all', forceSelection:true, valueField: 'value', displayField: 'text', store:new Ext.data.SimpleStore({ fields: [{name: 'value'}, {name: 'text'}], data: " . htmlspecialchars_decode($field->storeData) . ", sortInfo:{field:'text',direction:'ASC'} }), $fieldReadOnly $fieldRequired $fieldValidate cls: \"\" }) *"; } $editor = eregi_replace("[\n|\r|\n\r]", ' ', $editor); $width = $field->colWidth; $caseColumns[] = array("xtype" => "combocolumn", "gridId" => "gridId", "header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "frame" => "true", "clicksToEdit" => "1"); $caseReaderFields[] = array("name" => $field->name); break; case "date": //minValue: '01/01/06', //disabledDays: [0, 6], //disabledDaysText: 'Plants are not available on the weekends' $align = "center"; $size = 100; if (isset($field->size)) { $size = $field->size * 10; } $width = $size; $editor = "* new Ext.form.DateField({ format: \"$dateFormat\", $fieldReadOnly $fieldRequired $fieldValidate cls: \"\" }) *"; //$renderer = "* formatDate *"; $renderer = "* function (value){ return Ext.isDate(value)? value.dateFormat('{$dateFormat}') : value; } *"; if ($field->mode != "edit") { $editor = null; } $caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "editor" => $editor, "renderer" => $renderer, "frame" => true, "clicksToEdit" => 1, "sortable" => true); $caseReaderFields[] = array("name" => $field->name, "type" => "date"); break; case "currency": //align: 'right', //renderer: 'usMoney', //allowBlank: false, //allowNegative: false, $align = 'right'; $size = 100; if (isset($field->size)) { $size = $field->size * 10; } $width = $size; $editor = "* new Ext.form.NumberField({ maxValue: 1000000, allowDecimals: true, allowNegative: true, $fieldReadOnly $fieldRequired $fieldValidate cls: \"\" }) *"; if ($field->mode != "edit") { $editor = null; } $caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "frame" => true, "clicksToEdit" => 1, "sortable" => true); $caseReaderFields[] = array("name" => $field->name); break; case "percentage": $align = 'right'; $size = 100; if (isset($field->size)) { $size = $field->size * 10; } $width = $size; $editor = "* new Ext.form.NumberField({ maxValue: 100, allowDecimals: true, $fieldReadOnly $fieldRequired $fieldValidate cls: \"\" }) *"; $renderer = "* function (value){ return (value + ' %'); } *"; if ($field->mode != "edit") { $editor = null; } $caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "renderer" => $renderer, "frame" => true, "clicksToEdit" => 1, "sortable" => true); $caseReaderFields[] = array("name" => $field->name); break; case "textarea": $align = 'left'; $size = 200; if (isset($field->size)) { $size = $field->size * 15; } $width = $size; $editor = "* new Ext.form.TextArea({ growMin: 60, growMax: 1000, grow: true, autoHeight: true, disabled: $fieldDisabled, enterIsSpecial: false, preventScrollbars: false, $fieldReadOnly $fieldRequired $fieldValidate cls: \"\" }) *"; $renderer = "* function (value) { return (value); } *"; $caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "renderer" => $renderer, "frame" => true, "clicksToEdit" => 1, "sortable" => true); $caseReaderFields[] = array("name" => $field->name); $hasTextArea = true; break; case "link": $align = 'center'; $size = 100; if (isset($field->size)) { $size = $field->size * 10; } $width = $size; $editor = null; $renderer = "* function (value) { return linkRenderer(value); } *"; $caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "renderer" => $renderer, "frame" => true, "hidden" => false, "hideable" => false, "clicksToEdit" => 1, "sortable" => true); $caseReaderFields[] = array("name" => $field->name); break; case "hidden": $align = 'left'; $size = 100; if (isset($field->size)) { $size = $field->size * 10; } $width = $size; $editor = "* new Ext.form.TextField({ allowBlank: false }) *"; $caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)$width, "align" => $align, "editor" => $editor, "frame" => "true", "hidden" => "true", "hideable" => false, "clicksToEdit" => "1"); $caseReaderFields[] = array("name" => $field->name); break; case "yesno": $align = "right"; $size = 100; if (isset($field->size)) { $size = $field->size * 10; } $width = $size; $dropList[] = $field->name; $comboBoxYesNoList[] = $field->name; $editor="* new Ext.form.ComboBox({ id: \"cbo" . $field->name . "_" . $pro_uid . "\", valueField: 'value', displayField: 'text', store: new Ext.data.ArrayStore({ storeId: \"store" . $field->name . "_" . $pro_uid . "\", fields: ['value', 'text'], data: [[1, 'YES'], [0, 'NO'] ] }), typeAhead: true, triggerAction: 'all', mode: 'local', editable: false, disabled : $fieldDisabled, lazyRender: true, $fieldReadOnly $fieldRequired $fieldValidate cls: \"\" }) *"; /* $renderer = "* function(value) { idx = this.editor.store.find(this.editor.valueField, value); if (currentFieldEdited == '{$field->name}') { if (rec = this.editor.store.getAt(idx)) { rowLabels['{$field->name}'] = rec.get(this.editor.displayField); return rec.get(this.editor.displayField); } else { return value; } } else { if (typeof(currentFieldEdited) == 'undefined') { return value; } else { return (rowLabels['{$field->name}']); } } } *"; */ //$caseColumns[] = array('header' => $fieldLabel, 'dataIndex' => $field->name, 'width' => (int)$width, 'align' => $align, 'editor' => $editor, 'renderer' => $renderer, 'frame' => 'true', 'clicksToEdit' => '1'); $caseColumns[] = array("xtype" => "combocolumn", "gridId" => "gridId", "header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "frame" => "true", "clicksToEdit" => "1"); $caseReaderFields[] = array("name" => $field->name); break; case "text": default: $align = "left"; $size = 100; if (isset($field->size)) { $size = $field->size * 10; } $width = $size; $editor = "* new Ext.form.TextField({ $fieldReadOnly $fieldRequired $fieldValidate cls: \"\"}) *"; if ($field->mode != "edit" && $field->mode != "parent") { $editor = null; } $caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "frame" => true, "clicksToEdit" => 1, "sortable" => true); $caseReaderFields[] = array("name" => $field->name); } } @unlink(PATH_C . "ws" . PATH_SEP . SYS_SYS . PATH_SEP . "xmlform" . PATH_SEP . $pro_uid . PATH_SEP . $dyn_uid . "." . SYS_LANG); $array ['columnModel'] = $caseColumns; $array ['readerFields'] = $caseReaderFields; $array ["dropList"] = $dropList; $array ["comboBoxYesNoList"] = $comboBoxYesNoList; $array ['hasTextArea'] = $hasTextArea; $temp = G::json_encode($array); //$temp = str_replace("***","'",$temp); $temp = str_replace('"*','', $temp); $temp = str_replace('*"','', $temp); $temp = str_replace('\t','', $temp); $temp = str_replace('\n','', $temp); $temp = str_replace('\/','/', $temp); $temp = str_replace('\"','"', $temp); $temp = str_replace('"checkcolumn"','\'checkcolumn\'',$temp); print $temp; die(); }
if ($user == 0) { throw new Exception(G::LoadTranslation('ID_TASK') . "'" . $TaskFields['TAS_TITLE'] . "'" . G::LoadTranslation('ID_NOT_HAVE_USERS')); } $http = G::is_https() ? "https://" : "http://"; $sContent = ''; $infoProcess = new Process(); $resultProcess = $infoProcess->load($sPRO_UID); if ($withWS) { //creating sys.info; $SITE_PUBLIC_PATH = ''; if (file_exists($SITE_PUBLIC_PATH . '')) { } //creating the first file require_once 'classes/model/Dynaform.php'; $oDynaform = new Dynaform(); $aDynaform = $oDynaform->load($sDYNAFORM); $dynTitle = str_replace(' ', '_', str_replace('/', '_', $aDynaform['DYN_TITLE'])); $sContent = "<?php\n"; $sContent .= "global \$_DBArray;\n"; $sContent .= "if (!isset(\$_DBArray)) {\n"; $sContent .= " \$_DBArray = array();\n"; $sContent .= "}\n"; $sContent .= "\$_SESSION['PROCESS'] = '" . $sPRO_UID . "';\n"; $sContent .= "\$_SESSION['CURRENT_DYN_UID'] = '" . $sDYNAFORM . "';\n"; $sContent .= "\$G_PUBLISH = new Publisher;\n"; $sContent .= "\$G_PUBLISH->AddContent('dynaform', 'xmlform', '" . $sPRO_UID . '/' . $sDYNAFORM . "', '', array(), '" . $dynTitle . 'Post.php' . "');\n"; $sContent .= "G::RenderPage('publish', 'blank');"; file_put_contents($pathProcess . $dynTitle . '.php', $sContent); //creating the second file, the post file who receive the post form. $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl'; $template = new TemplatePower($pluginTpl);
/** * Get data of a Step * * @param string $stepUid Unique id of Step * * return array Return an array with data of a Step */ public function getStep($stepUid) { try { $arrayStep = array(); //Verify data $this->throwExceptionIfNotExistsStep($stepUid); //Get data //Call plugin $pluginRegistry = &\PMPluginRegistry::getSingleton(); $externalSteps = $pluginRegistry->getSteps(); $criteria = new \Criteria("workflow"); $criteria->add(\StepPeer::STEP_UID, $stepUid, \Criteria::EQUAL); $rsCriteria = \StepPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $rsCriteria->next(); $row = $rsCriteria->getRow(); $titleObj = ""; $descriptionObj = ""; switch ($row["STEP_TYPE_OBJ"]) { case "DYNAFORM": $dynaform = new \Dynaform(); $arrayData = $dynaform->load($row["STEP_UID_OBJ"]); $titleObj = $arrayData["DYN_TITLE"]; $descriptionObj = $arrayData["DYN_DESCRIPTION"]; break; case "INPUT_DOCUMENT": $inputDocument = new \InputDocument(); $arrayData = $inputDocument->getByUid($row["STEP_UID_OBJ"]); if ($arrayData === false) { return $arrayStep; } $titleObj = $arrayData["INP_DOC_TITLE"]; $descriptionObj = $arrayData["INP_DOC_DESCRIPTION"]; break; case "OUTPUT_DOCUMENT": $outputDocument = new \OutputDocument(); $arrayData = $outputDocument->getByUid($row["STEP_UID_OBJ"]); if ($arrayData === false) { return $arrayStep; } $titleObj = $arrayData["OUT_DOC_TITLE"]; $descriptionObj = $arrayData["OUT_DOC_DESCRIPTION"]; break; case "EXTERNAL": $titleObj = "unknown " . $row["STEP_UID"]; if (is_array($externalSteps) && count($externalSteps) > 0) { foreach ($externalSteps as $key => $value) { if ($value->sStepId == $row["STEP_UID_OBJ"]) { $titleObj = $value->sStepTitle; } } } break; } //Return $arrayStep = array( $this->getFieldNameByFormatFieldName("STEP_UID") => $stepUid, $this->getFieldNameByFormatFieldName("STEP_TYPE_OBJ") => $row["STEP_TYPE_OBJ"], $this->getFieldNameByFormatFieldName("STEP_UID_OBJ") => $row["STEP_UID_OBJ"], $this->getFieldNameByFormatFieldName("STEP_CONDITION") => $row["STEP_CONDITION"], $this->getFieldNameByFormatFieldName("STEP_POSITION") => (int)($row["STEP_POSITION"]), $this->getFieldNameByFormatFieldName("STEP_MODE") => $row["STEP_MODE"], $this->getFieldNameByFormatFieldName("OBJ_TITLE") => $titleObj, $this->getFieldNameByFormatFieldName("OBJ_DESCRIPTION") => $descriptionObj ); return $arrayStep; } catch (\Exception $e) { throw $e; } }
/** * getCaseTrackerObjectsCriteria * * @param string $sProcessUID * @return object(Criteria) $oCriteria */ public function getExtCaseTrackerObjectsCriteria($start, $limit, $sProcessUID) { $aObjects = array(); $aObjects[] = array('CTO_TITLE' => 'char', 'CTO_UID' => 'char', 'CTO_TYPE_OBJ' => 'char', 'CTO_UID_OBJ' => 'char', 'CTO_CONDITION' => 'char', 'CTO_POSITION' => 'integer'); $oCriteria = new Criteria('workflow'); $oCriteria->add(CaseTrackerObjectPeer::PRO_UID, $sProcessUID); $oCriteria->addAscendingOrderByColumn(CaseTrackerObjectPeer::CTO_POSITION); $this->tmpCriteria = clone $oCriteria; if ($start != '') { $oCriteria->setOffset($start); } if ($limit != '') { $oCriteria->setLimit($limit); } $oDataset = CaseTrackerObjectPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { try { switch ($aRow['CTO_TYPE_OBJ']) { case 'DYNAFORM': $oDynaform = new Dynaform(); $aFields = $oDynaform->load($aRow['CTO_UID_OBJ']); $sTitle = $aFields['DYN_TITLE']; break; case 'INPUT_DOCUMENT': $oInputDocument = new InputDocument(); $aFields = $oInputDocument->load($aRow['CTO_UID_OBJ']); $sTitle = $aFields['INP_DOC_TITLE']; break; case 'OUTPUT_DOCUMENT': $oOutputDocument = new OutputDocument(); $aFields = $oOutputDocument->load($aRow['CTO_UID_OBJ']); $sTitle = $aFields['OUT_DOC_TITLE']; break; } $aObjects[] = array('CTO_TITLE' => $sTitle, 'CTO_UID' => $aRow['CTO_UID'], 'CTO_TYPE_OBJ' => $aRow['CTO_TYPE_OBJ'], 'CTO_UID_OBJ' => $aRow['CTO_UID_OBJ'], 'CTO_CONDITION' => $aRow['CTO_CONDITION'], 'CTO_POSITION' => $aRow['CTO_POSITION']); } catch (Exception $oError) { //Nothing } $oDataset->next(); } // return $aObjects; global $_DBArray; $_DBArray = isset($_SESSION['_DBArray']) ? $_SESSION['_DBArray'] : ''; $_DBArray['objects'] = $aObjects; $_SESSION['_DBArray'] = $_DBArray; G::LoadClass('ArrayPeer'); $oCriteria = new Criteria('dbarray'); $oCriteria->setDBArrayTable('objects'); $oCriteria->addAscendingOrderByColumn('CTO_POSITION'); return $aObjects; }
function save($params) { require_once 'classes/model/Event.php'; global $G_FORM; $sPRO_UID = $params->pro_uid; $sEVN_UID = $params->evn_uid; $sDYNAFORM = $params->initDyna; $sWS_USER = trim($params->username); $sWS_PASS = trim($params->password); $sWS_ROUNDROBIN = ''; $sWE_USR = ''; $xDYNA = $params->dynaform; if ($xDYNA != '') { $pro_uid = $params->pro_uid; $filename = $xDYNA; $filename = $filename . '.php'; unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . $filename); unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . str_replace(".php", "Post", $filename) . ".php"); } //return $params; G::LoadClass("system"); $pathProcess = PATH_DATA_SITE . 'public' . PATH_SEP . $sPRO_UID . PATH_SEP; G::mk_dir($pathProcess, 0777); $oEvent = new Event(); $oEvent->load($sEVN_UID); $sTASKS = $oEvent->getEvnTasUidTo(); $oTask = new Task(); $oTask->load($sTASKS); $tas_title = $oTask->getTasTitle(); if (G::is_https()) { $http = 'https://'; } else { $http = 'http://'; } $sContent = ''; $SITE_PUBLIC_PATH = ''; if (file_exists($SITE_PUBLIC_PATH . '')) { } require_once 'classes/model/Dynaform.php'; $oDynaform = new Dynaform(); $aDynaform = $oDynaform->load($sDYNAFORM); $dynTitle = str_replace(' ', '_', str_replace('/', '_', $aDynaform['DYN_TITLE'])); $sContent = "<?php\n"; $sContent .= "global \$_DBArray;\n"; $sContent .= "if (!isset(\$_DBArray)) {\n"; $sContent .= " \$_DBArray = array();\n"; $sContent .= "}\n"; $sContent .= "\$_SESSION['PROCESS'] = '" . $sPRO_UID . "';\n"; $sContent .= "\$_SESSION['CURRENT_DYN_UID'] = '" . $sDYNAFORM . "';\n"; $sContent .= "\$G_PUBLISH = new Publisher;\n"; $sContent .= "\$G_PUBLISH->AddContent('dynaform', 'xmlform', '" . $sPRO_UID . '/' . $sDYNAFORM . "', '', array(), '" . $dynTitle . 'Post.php' . "');\n"; $sContent .= "G::RenderPage('publish', 'blank');"; file_put_contents($pathProcess . $dynTitle . '.php', $sContent); //creating the second file, the post file who receive the post form. $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl'; $template = new TemplatePower($pluginTpl); $template->prepare(); $template->assign('wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'); $template->assign('wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload'); $template->assign('processUid', $sPRO_UID); $template->assign('dynaformUid', $sDYNAFORM); $template->assign('taskUid', $sTASKS); $template->assign('wsUser', $sWS_USER); $template->assign('wsPass', 'md5:' . md5($sWS_PASS)); $template->assign('wsRoundRobin', $sWS_ROUNDROBIN); if ($sWE_USR == "2") { $template->assign('USR_VAR', "\$cInfo = ws_getCaseInfo(\$caseId);\n\t \$USR_UID = \$cInfo->currentUsers->userId;"); } else { $template->assign('USR_VAR', '$USR_UID = -1;'); } $template->assign('dynaform', $dynTitle); $template->assign('timestamp', date('l jS \\of F Y h:i:s A')); $template->assign('ws', SYS_SYS); $template->assign('version', System::getVersion()); $fileName = $pathProcess . $dynTitle . 'Post.php'; file_put_contents($fileName, $template->getOutputContent()); //creating the third file, only if this wsClient.php file doesn't exists. $fileName = $pathProcess . 'wsClient.php'; $pluginTpl = PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . 'ws' . PATH_SEP . 'wsClient.php'; if (file_exists($fileName)) { if (filesize($fileName) != filesize($pluginTpl)) { @copy($fileName, $pathProcess . 'wsClient.php.bck'); @unlink($fileName); $template = new TemplatePower($pluginTpl); $template->prepare(); file_put_contents($fileName, $template->getOutputContent()); } } else { $template = new TemplatePower($pluginTpl); $template->prepare(); file_put_contents($fileName, $template->getOutputContent()); } require_once 'classes/model/Event.php'; $oEvent = new Event(); $aDataEvent = array(); $aDataEvent['EVN_UID'] = $sEVN_UID; $aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE'; $aDataEvent['EVN_ACTION'] = $sDYNAFORM; $aDataEvent['EVN_CONDITIONS'] = $sWS_USER; $output = $oEvent->update($aDataEvent); $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; $this->success = true; $this->msg = G::LoadTranslation('ID_WEB_ENTRY_SUCCESS_NEW'); $this->W_LINK = $link; $this->TAS_TITLE = $tas_title; $this->DYN_TITLE = $dynTitle; $this->USR_UID = $sWS_USER; }
/** * Get all Case Tracker Objects of a Process * * @param string $processUid Unique id of Process * * return array Return an array with all Case Tracker Objects of a Process */ public function getCaseTrackerObjects($processUid) { try { $arrayCaseTrackerObject = array(); //Verify data $process = new \ProcessMaker\BusinessModel\Process(); $process->throwExceptionIfNotExistsProcess($processUid, "prj_uid"); $dynaform = new \Dynaform(); $inputDocument = new \InputDocument(); $outputDocument = new \OutputDocument(); $arrayCaseTrackerObject = array(); $criteria = new \Criteria("workflow"); $criteria->add(\CaseTrackerObjectPeer::PRO_UID, $processUid, \Criteria::EQUAL); $rsCriteria = \CaseTrackerObjectPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $titleObj = ""; $descriptionObj = ""; switch ($row["CTO_TYPE_OBJ"]) { case "DYNAFORM": $arrayData = $dynaform->load($row["CTO_UID_OBJ"]); $titleObj = $arrayData["DYN_TITLE"]; $descriptionObj = $arrayData["DYN_DESCRIPTION"]; break; case "INPUT_DOCUMENT": $arrayData = $inputDocument->getByUid($row["CTO_UID_OBJ"]); $titleObj = $arrayData["INP_DOC_TITLE"]; $descriptionObj = $arrayData["INP_DOC_DESCRIPTION"]; break; case "OUTPUT_DOCUMENT": $arrayData = $outputDocument->getByUid($row["CTO_UID_OBJ"]); $titleObj = $arrayData["OUT_DOC_TITLE"]; $descriptionObj = $arrayData["OUT_DOC_DESCRIPTION"]; break; } $arrayCaseTrackerObject[] = array("cto_uid" => $row["CTO_UID"], "cto_type_obj" => $row["CTO_TYPE_OBJ"], "cto_uid_obj" => $row["CTO_UID_OBJ"], "cto_condition" => $row["CTO_CONDITION"], "cto_position" => (int) $row["CTO_POSITION"], "obj_title" => $titleObj, "obj_description" => $descriptionObj); } $arrayCaseTrackerObject = \ProcessMaker\Util\ArrayUtil::sort($arrayCaseTrackerObject, array("cto_position"), SORT_ASC); return $arrayCaseTrackerObject; } catch (\Exception $e) { throw $e; } }
$oTree->name = 'Triggers'; $oTree->showSign = false; $oCriteria = new Criteria('workflow'); $oCriteria->add(StepPeer::PRO_UID, $_SESSION['PROCESS']); $oCriteria->add(StepPeer::TAS_UID, $_SESSION['TASK']); $oCriteria->addAscendingOrderByColumn(StepPeer::STEP_POSITION); $oDataset = StepPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $i = 0; while ($aRow = $oDataset->getRow()) { switch ($aRow['STEP_TYPE_OBJ']) { case 'DYNAFORM': require_once 'classes/model/Dynaform.php'; $oObject = new Dynaform(); $aFields = $oObject->load($aRow['STEP_UID_OBJ']); $aRow['STEP_NAME'] = $aFields['DYN_TITLE']; break; case 'INPUT_DOCUMENT': require_once 'classes/model/InputDocument.php'; $oObject = new InputDocument(); $aFields = $oObject->load($aRow['STEP_UID_OBJ']); $aRow['STEP_NAME'] = $aFields['INP_DOC_TITLE']; break; case 'OUTPUT_DOCUMENT': require_once 'classes/model/OutputDocument.php'; $oObject = new OutputDocument(); $aFields = $oObject->load($aRow['STEP_UID_OBJ']); $aRow['STEP_NAME'] = $aFields['OUT_DOC_TITLE']; break; case 'EXTERNAL':
*/ try { require_once 'classes/model/Dynaform.php'; require_once 'classes/model/Process.php'; $currentDynUid = ''; if (isset($_GET['DYNUIDPRINT']) && $_GET['DYNUIDPRINT'] != '') { $currentDynUid = $_GET['DYNUIDPRINT']; } elseif (isset($_SESSION['DYN_UID_PRINT'])) { $currentDynUid = $_SESSION['DYN_UID_PRINT']; } elseif (isset($_SESSION['CURRENT_DYN_UID'])) { $currentDynUid = $_SESSION['CURRENT_DYN_UID']; } elseif (isset($_SESSION['CONDITION_DYN_UID'])) { $currentDynUid = $_SESSION['CONDITION_DYN_UID']; } $oDynaform = new Dynaform(); $aDyn = $oDynaform->load($currentDynUid); G::LoadClass('case'); $oCase = new Cases(); if (isset($_SESSION['APPLICATION'])) { $Fields = $oCase->loadCase($_SESSION['APPLICATION']); $Fields['APP_DATA'] = array_merge($Fields['APP_DATA'], G::getSystemConstants()); } else { $Fields['APP_DATA'] = array(); } $G_MAIN_MENU = 'processmaker'; $G_ID_MENU_SELECTED = 'USERS'; $G_PUBLISH = new Publisher(); $idProcess = isset($Fields['APP_DATA']['PROCESS']) ? $Fields['APP_DATA']['PROCESS'] : $_SESSION['PROCESS']; $oProcess = new Process(); $aProcessFieds = $oProcess->load($idProcess); $sProcess = $oProcess->getProTitle();
/** * Get data of a Case Tracker Object * * @param string $caseTrackerObjectUid Unique id of Case Tracker Object * * return array Return an array with data of a Case Tracker Object */ public function getCaseTrackerObject($caseTrackerObjectUid) { try { //Verify data $caseTrackerObject = new \CaseTrackerObject(); if (!$caseTrackerObject->caseTrackerObjectExists($caseTrackerObjectUid)) { throw new \Exception(\G::LoadTranslation("ID_CASE_TRACKER_OBJECT_DOES_NOT_EXIST", array(strtolower("CTO_UID"), $caseTrackerObjectUid))); } //Get data $dynaform = new \Dynaform(); $inputDocument = new \InputDocument(); $outputDocument = new \OutputDocument(); $criteria = new \Criteria("workflow"); $criteria->add(\CaseTrackerObjectPeer::CTO_UID, $caseTrackerObjectUid, \Criteria::EQUAL); $rsCriteria = \CaseTrackerObjectPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $rsCriteria->next(); $row = $rsCriteria->getRow(); $titleObj = ""; $descriptionObj = ""; switch ($row["CTO_TYPE_OBJ"]) { case "DYNAFORM": $arrayData = $dynaform->load($row["CTO_UID_OBJ"]); $titleObj = $arrayData["DYN_TITLE"]; $descriptionObj = $arrayData["DYN_DESCRIPTION"]; break; case "INPUT_DOCUMENT": $arrayData = $inputDocument->getByUid($row["CTO_UID_OBJ"]); $titleObj = $arrayData["INP_DOC_TITLE"]; $descriptionObj = $arrayData["INP_DOC_DESCRIPTION"]; break; case "OUTPUT_DOCUMENT": $arrayData = $outputDocument->getByUid($row["CTO_UID_OBJ"]); $titleObj = $arrayData["OUT_DOC_TITLE"]; $descriptionObj = $arrayData["OUT_DOC_DESCRIPTION"]; break; } return array("cto_uid" => $row["CTO_UID"], "cto_type_obj" => $row["CTO_TYPE_OBJ"], "cto_uid_obj" => $row["CTO_UID_OBJ"], "cto_condition" => $row["CTO_CONDITION"], "cto_position" => (int) $row["CTO_POSITION"], "obj_title" => $titleObj, "obj_description" => $descriptionObj); } catch (\Exception $e) { throw $e; } }
/** * generateJrxmlFromDynaform * * @param string $outDocUid * @param string $dynaformUid * @param object $template * @return void */ function generateJrxmlFromDynaform($outDocUid, $dynaformUid, $template) { require_once 'classes/model/Dynaform.php'; $dyn = new Dynaform(); $aFields = $dyn->load($dynaformUid); $xmlFields = $dyn->getDynaformFields($dynaformUid); $reportTpl = PATH_TPL . 'javaBridgePM/classic.xml'; $reportFilename = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $outDocUid . '.jrxml'; foreach ($xmlFields as $key => $val) { if ($val->type == 'submit' || $val->type == 'button' || $val->type == 'title' || $val->type == 'subtitle') { unset($xmlFields[$key]); } } //$sqlSentence = 'SELECT * from ' . $tableName; $sqlSentence = 'dynaform/'; $template = new TemplatePower($reportTpl); $template->prepare(); $template->assign('sqlSentence', $sqlSentence); $template->assign('tableName', $aFields['DYN_TITLE']); $template->assign('heightDetail', count($xmlFields) * 15 + 20); $template->assign('PAGE_NUMBER', '{PAGE_NUMBER}'); $logoReporte = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/images/processmaker.logo.jpg'; $template->assign('logoReporte', $logoReporte); foreach ($xmlFields as $key => $val) { $template->newBlock('fields'); $template->assign('fieldName', $key); } $posX = 140; $posLabelX = 5; $posY = 10; foreach ($xmlFields as $key => $val) { $template->newBlock('detailFields'); $template->assign('fieldName', '{' . $key . '}'); $template->assign('fieldLabel', $key); $template->assign('labelPosX', $posLabelX); $template->assign('fieldPosX', $posX); $template->assign('fieldPosY', $posY); $posY += 15; } $content = $template->getOutputContent(); $iSize = file_put_contents($reportFilename, $content); printf("saved %s bytes in file %s \n", $iSize, $reportFilename); }
<?php $response = new stdclass(); $response->status = isset($_SESSION['USER_LOGGED']); if (isset($_REQUEST['dynaformEditorParams'])) { $arrayParameterAux = @unserialize(rawurldecode($_REQUEST["dynaformEditorParams"])); if (!empty($arrayParameterAux) && isset($arrayParameterAux["DYNAFORM_NAME"])) { $arrayParameterAux["DYNAFORM_NAME"] = base64_decode($arrayParameterAux["DYNAFORM_NAME"]); $_SESSION["Current_Dynafom"]["Parameters"] = $arrayParameterAux; if (isset($_REQUEST['DYN_UID'])) { if (class_exists('Dynaform')) { require_once 'classes/model/Dynaform.php'; } $dynaform = new Dynaform(); $dynaform->load($_REQUEST['DYN_UID']); G::LoadClass('dynaformEditor'); $editor = new dynaformEditor(array()); $editor->file = $dynaform->getDynFilename(); $editor->home = PATH_DYNAFORM; $editor->title = $dynaform->getDynTitle(); $editor->dyn_uid = $dynaform->getDynUid(); $editor->pro_uid = $dynaform->getProUid(); $editor->dyn_type = $dynaform->getDynType(); $editor->dyn_title = $dynaform->getDynTitle(); $editor->dyn_description = $dynaform->getDynDescription(); $editor->dyn_editor = 'processmap'; $editor->_setUseTemporalCopy(true); $A = isset($_SESSION['Current_Dynafom']['Parameters']['URL']) ? $_SESSION['Current_Dynafom']['Parameters']['URL'] : ''; $form = new Form($dynaform->getProUid() . '/' . $dynaform->getDynUid(), PATH_DYNAFORM, SYS_LANG, true); $properties = array('A' => $A, 'DYN_UID' => $dynaform->getDynUid(), 'PRO_UID' => $dynaform->getProUid(), 'DYN_TITLE' => $dynaform->getDynTitle(), 'DYN_TYPE' => $dynaform->getDynType(), 'DYN_DESCRIPTION' => $dynaform->getDynDescription(), 'WIDTH' => $form->width, 'MODE' => $form->mode, 'PRINTDYNAFORM' => $form->printdynaform, 'ADJUSTGRIDSWIDTH' => $form->adjustgridswidth, 'NEXTSTEPSAVE' => $form->nextstepsave); $tmp = $editor->_getTmpData();
/** * Get list for Process Permissions * * @var string $pro_uid. Uid for Process * @var string $op_uid. Uid for Process Permission * * @access public * @author Brayan Pereyra (Cochalo) <*****@*****.**> * @copyright Colosa - Bolivia * * @return array */ public function getProcessPermissions($pro_uid, $op_uid = '') { $pro_uid = $this->validateProUid($pro_uid); if ($op_uid != '') { $op_uid = $this->validateOpUid($op_uid); } G::LoadClass('case'); Cases::verifyTable(); $aObjectsPermissions = array(); $oCriteria = new \Criteria('workflow'); $oCriteria->add(ObjectPermissionPeer::PRO_UID, $pro_uid); if ($op_uid != '') { $oCriteria->add(ObjectPermissionPeer::OP_UID, $op_uid); } $oDataset = ObjectPermissionPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { //Obtain task target if ($aRow['TAS_UID'] != '' && $aRow['TAS_UID'] != '0') { try { $oTask = new \Task(); $aFields = $oTask->load($aRow['TAS_UID']); $sTaskTarget = $aFields['TAS_TITLE']; } catch (\Exception $oError) { $sTaskTarget = 'All Tasks'; } } else { $sTaskTarget = G::LoadTranslation('ID_ANY_TASK'); } //Obtain user or group if ($aRow['OP_USER_RELATION'] == 1) { $oUser = new \Users(); $aFields = $oUser->load($aRow['USR_UID']); $sUserGroup = $aFields['USR_FIRSTNAME'] . ' ' . $aFields['USR_LASTNAME'] . ' (' . $aFields['USR_USERNAME'] . ')'; } else { $oGroup = new \Groupwf(); if ($aRow['USR_UID'] != '') { try { $aFields = $oGroup->load($aRow['USR_UID']); $sUserGroup = $aFields['GRP_TITLE']; } catch (\Exception $oError) { $sUserGroup = '(GROUP DELETED)'; } } else { $sUserGroup = G::LoadTranslation('ID_ANY'); } } //Obtain task source if ($aRow['OP_TASK_SOURCE'] != '' && $aRow['OP_TASK_SOURCE'] != '0') { try { $oTask = new \Task(); $aFields = $oTask->load($aRow['OP_TASK_SOURCE']); $sTaskSource = $aFields['TAS_TITLE']; } catch (\Exception $oError) { $sTaskSource = 'All Tasks'; } } else { $sTaskSource = G::LoadTranslation('ID_ANY_TASK'); } //Obtain object and type switch ($aRow['OP_OBJ_TYPE']) { case 'ALL': $sObjectType = G::LoadTranslation('ID_ALL'); $sObject = G::LoadTranslation('ID_ALL'); break; case 'ANY': //For backward compatibility (some process with ANY instead of ALL $sObjectType = G::LoadTranslation('ID_ALL'); $sObject = G::LoadTranslation('ID_ALL'); break; /* case 'ANY_DYNAFORM': $sObjectType = G::LoadTranslation('ID_ANY_DYNAFORM'); $sObject = G::LoadTranslation('ID_ALL'); break; case 'ANY_INPUT': $sObjectType = G::LoadTranslation('ID_ANY_INPUT'); $sObject = G::LoadTranslation('ID_ALL'); break; case 'ANY_OUTPUT': $sObjectType = G::LoadTranslation('ID_ANY_OUTPUT'); $sObject = G::LoadTranslation('ID_ALL'); break; */ /* case 'ANY_DYNAFORM': $sObjectType = G::LoadTranslation('ID_ANY_DYNAFORM'); $sObject = G::LoadTranslation('ID_ALL'); break; case 'ANY_INPUT': $sObjectType = G::LoadTranslation('ID_ANY_INPUT'); $sObject = G::LoadTranslation('ID_ALL'); break; case 'ANY_OUTPUT': $sObjectType = G::LoadTranslation('ID_ANY_OUTPUT'); $sObject = G::LoadTranslation('ID_ALL'); break; */ case 'DYNAFORM': $sObjectType = G::LoadTranslation('ID_DYNAFORM'); if ($aRow['OP_OBJ_UID'] != '' && $aRow['OP_OBJ_UID'] != '0') { $oDynaform = new \Dynaform(); $aFields = $oDynaform->load($aRow['OP_OBJ_UID']); $sObject = $aFields['DYN_TITLE']; } else { $sObject = G::LoadTranslation('ID_ALL'); } break; case 'INPUT': $sObjectType = G::LoadTranslation('ID_INPUT_DOCUMENT'); if ($aRow['OP_OBJ_UID'] != '' && $aRow['OP_OBJ_UID'] != '0') { $oInputDocument = new \InputDocument(); $aFields = $oInputDocument->load($aRow['OP_OBJ_UID']); $sObject = $aFields['INP_DOC_TITLE']; } else { $sObject = G::LoadTranslation('ID_ALL'); } break; case 'OUTPUT': $sObjectType = G::LoadTranslation('ID_OUTPUT_DOCUMENT'); if ($aRow['OP_OBJ_UID'] != '' && $aRow['OP_OBJ_UID'] != '0') { $oOutputDocument = new \OutputDocument(); $aFields = $oOutputDocument->load($aRow['OP_OBJ_UID']); $sObject = $aFields['OUT_DOC_TITLE']; } else { $sObject = G::LoadTranslation('ID_ALL'); } break; case 'CASES_NOTES': $sObjectType = G::LoadTranslation('ID_CASES_NOTES'); $sObject = 'N/A'; break; case 'MSGS_HISTORY': $sObjectType = G::LoadTranslation('MSGS_HISTORY'); $sObject = G::LoadTranslation('ID_ALL'); break; default: $sObjectType = G::LoadTranslation('ID_ALL'); $sObject = G::LoadTranslation('ID_ALL'); break; } //Participated if ($aRow['OP_PARTICIPATE'] == 0) { $sParticipated = G::LoadTranslation('ID_NO'); } else { $sParticipated = G::LoadTranslation('ID_YES'); } //Obtain action (permission) $sAction = G::LoadTranslation('ID_' . $aRow['OP_ACTION']); //Add to array $arrayTemp = array(); $arrayTemp = array_merge($aRow, array('OP_UID' => $aRow['OP_UID'], 'TASK_TARGET' => $sTaskTarget, 'GROUP_USER' => $sUserGroup, 'TASK_SOURCE' => $sTaskSource, 'OBJECT_TYPE' => $sObjectType, 'OBJECT' => $sObject, 'PARTICIPATED' => $sParticipated, 'ACTION' => $sAction, 'OP_CASE_STATUS' => $aRow['OP_CASE_STATUS'])); $aObjectsPermissions[] = array_change_key_case($arrayTemp, CASE_LOWER); $oDataset->next(); } if ($op_uid != '' && empty($aObjectsPermissions)) { throw new \Exception(\G::LoadTranslation("ID_ROW_DOES_NOT_EXIST")); } elseif ($op_uid != '' && !empty($aObjectsPermissions)) { $aObjectsPermissions = array_change_key_case($aObjectsPermissions, CASE_LOWER); return current($aObjectsPermissions); } $aObjectsPermissions = array_change_key_case($aObjectsPermissions, CASE_LOWER); return $aObjectsPermissions; }
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. * */ try { require_once 'classes/model/Dynaform.php'; require_once 'classes/model/Process.php'; $oDynaform = new Dynaform(); $aDyn = $oDynaform->load($_SESSION['CURRENT_DYN_UID']); G::LoadClass('case'); $oCase = new Cases(); if (isset($_SESSION['APPLICATION'])) { $Fields = $oCase->loadCase($_SESSION['APPLICATION']); $Fields['APP_DATA'] = array_merge($Fields['APP_DATA'], G::getSystemConstants()); } else { $Fields['APP_DATA'] = array(); } $G_MAIN_MENU = 'processmaker'; $G_ID_MENU_SELECTED = 'USERS'; $G_PUBLISH = new Publisher(); $idProcess = isset($Fields['APP_DATA']['PROCESS']) ? $Fields['APP_DATA']['PROCESS'] : $_SESSION['PROCESS']; $oProcess = new Process(); $aProcessFieds = $oProcess->load($idProcess); $sProcess = $oProcess->getProTitle();