/** * Checks if a dynaform was changed * * @param file $A * @param string $DYN_UID * @return array */ public function is_modified($A, $DYN_UID) { $file = G::decrypt($A, URL_KEY); try { /* Compare Properties */ $dynaform = new dynaform(); $dynaform->load($DYN_UID); $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); $sp = 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, 'ENABLETEMPLATE' => $form->enableTemplate, 'MODE' => $form->mode); $P = self::get_properties($A, $DYN_UID); if (!isset($P['DYN_TITLE'])) { $P['DYN_TITLE'] = $sp['DYN_TITLE']; } if (!isset($P['DYN_TYPE'])) { $P['DYN_TYPE'] = $sp['DYN_TYPE']; } if (!isset($P['DYN_DESCRIPTION'])) { $P['DYN_DESCRIPTION'] = $sp['DYN_DESCRIPTION']; } if (!isset($P['WIDTH'])) { $P['WIDTH'] = $sp['WIDTH']; } if (!isset($P['ENABLETEMPLATE'])) { $P['ENABLETEMPLATE'] = $sp['ENABLETEMPLATE']; } if (!isset($P['MODE'])) { $P['MODE'] = $sp['MODE']; } $modPro = $sp['DYN_TITLE'] != $P['DYN_TITLE'] || $sp['DYN_TYPE'] != $P['DYN_TYPE'] || $sp['DYN_DESCRIPTION'] != $P['DYN_DESCRIPTION']; /* || ($sp['WIDTH']!=$P['WIDTH']) || ($sp['ENABLETEMPLATE']!=$P['ENABLETEMPLATE']) || ($sp['MODE']!=$P['MODE']) */ /* Compare copies */ $fileOrigen = dynaformEditor::_getFilename($file); $copy = implode('', file(PATH_DYNAFORM . $file . '.xml')); $origen = implode('', file(PATH_DYNAFORM . $fileOrigen . '.xml')); $copyHTML = file_exists(PATH_DYNAFORM . $file . '.html') ? implode('', file(PATH_DYNAFORM . $file . '.html')) : false; $origenHTML = file_exists(PATH_DYNAFORM . $fileOrigen . '.html') ? implode('', file(PATH_DYNAFORM . $fileOrigen . '.html')) : false; $modFile = $copy !== $origen || $origenHTML && $copyHTML !== $origenHTML; //Return //return array("*message"=>sprintf("%s, (%s= %s %s):", $modPro?"1":"0" , $modFile?"1":"0", ($copy!==$origen)?"1":"0" , ($origenHTML && ($copyHTML!==$origenHTML))?"1":"0" )); //die("c'est fini"); return $modPro || $modFile; } catch (Exception $e) { return (array) $e; } }
unset($aData['DYN_UID']); } } else { $aData = $_POST; //For Extjs (Since we are not using form in ExtJS) $aFields = array(); $aVariables = array(); if (isset($aData['FIELDS'])) { $aFields = G::json_decode($_POST['FIELDS']); $aVariables = G::json_decode($_POST['VARIABLES']); } $aData['FIELDS'] = array(); for ($i = 0; $i < count($aFields); $i++) { $aData['FIELDS'][$i + 1]['FLD_NAME'] = $aFields[$i]; $aData['FIELDS'][$i + 1]['PRO_VARIABLE'] = $aVariables[$i]; } } //if ($aData['DYN_UID']==='') unset($aData['DYN_UID']); if (isset($aData['DYN_UID'])) { $dynaform->Save($aData); } else { if (!isset($aData['ADD_TABLE']) || $aData['ADD_TABLE'] == "") { $aFields = $dynaform->create($aData); } else { $aFields = $dynaform->createFromPMTable($aData, $aData['ADD_TABLE']); } $aData['DYN_UID'] = $dynaform->getDynUid(); $dynaform->update($aData); } echo $dynaform->getDynUid(); }
//TODO print "{$PRO_UID} doesn't exist, continue? yes"; } $dynaform = new dynaform(); if ($dynaform->exists($DYN_UID)) { $dynaform->load($DYN_UID); $_SESSION['CURRENT_DYN_UID'] = $DYN_UID; } else { /* New Dynaform * */ $dynaform->create(array('PRO_UID' => $PRO_UID)); } //creating SESSION for redirecting to new bpmn editor after closing Dynaform if (isset($_GET['bpmn']) && $_GET['bpmn'] == '1') { $_SESSION['dynaform_editor'] = 'bpmn'; } elseif (!isset($_GET['bpmn'])) { $_SESSION['dynaform_editor'] = 'processmap'; } $editor = new dynaformEditor($_POST); $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 = $_SESSION['dynaform_editor']; $editor->_setUseTemporalCopy(true); $editor->_render();
$PRO_UID = $frm['PRO_UID']; $DYN_UID = $frm['DYN_UID']; $DYN_TYPE = $frm['DYN_TYPE']; // checks if there are conditions attached to the dynaform $oFieldCondition = new FieldCondition(); $aConditions = $oFieldCondition->getAllByDynUid($DYN_UID); $dynaform = new dynaform(); $arrayData = array(); $arrayData["PRO_UID"] = $PRO_UID; $arrayData["DYN_TYPE"] = $DYN_TYPE; $arrayData["DYN_TITLE"] = $frm["DYN_TITLENEW"]; if (isset($frm["DYN_DESCRIPTIONNEW"])) { $arrayData["DYN_DESCRIPTION"] = $frm["DYN_DESCRIPTIONNEW"]; } $aFields = $dynaform->create($arrayData); $dynUid = $dynaform->getDynUid(); $hd = fopen(PATH_DYNAFORM . $PRO_UID . '/' . $DYN_UID . '.xml', "r"); $hd1 = fopen(PATH_DYNAFORM . $PRO_UID . '/' . $dynUid . '.xml', "w"); $templateFilename = PATH_DYNAFORM . $PRO_UID . '/' . $DYN_UID . '.html'; $templateFilename = $filter->xssFilterHard($templateFilename, 'path'); // also make a copy of the template file in case that the html edition is enabled if (file_exists($templateFilename)) { $templateHd = fopen($templateFilename, "r"); $templateHd1 = fopen(PATH_DYNAFORM . $PRO_UID . '/' . $dynUid . '.html', "w"); } // also copy all the necessarily conditions if there are any foreach ($aConditions as $condition) { $condition['FCD_UID'] = G::generateUniqueID(); $condition['FCD_DYN_UID'] = $dynUid; $oFieldCondition->quickSave($condition); }
$criteria->add(ContentPeer::CON_ID, $copyDynaformGridUid); $criteria->add(ContentPeer::CON_CATEGORY, "DYN_DESCRIPTION"); $criteria->add(ContentPeer::CON_LANG, SYS_LANG); $rsCriteria = ContentPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rsCriteria->next(); $row = $rsCriteria->getRow(); $copyDynGrdDescription = $row["CON_VALUE"]; //Create grid $dynaformGrid = new dynaform(); $aDataAux = $aData; $aDataAux["DYN_TYPE"] = "grid"; $aDataAux["DYN_TITLE"] = $copyDynGrdTitle . ($dynaFormAux->existsTitle($dynaform->getProUid(), $copyDynGrdTitle) ? " (" . $dynaform->getDynTitle() . ")" : ""); $aDataAux["DYN_DESCRIPTION"] = $copyDynGrdDescription; $aFields = $dynaformGrid->create($aDataAux); $dynaformGridUid = $dynaformGrid->getDynUid(); $aDataAux["DYN_UID"] = $dynaformGridUid; $dynaformGrid->update($aDataAux); //Copy files of the dynaform grid $fileGridXml = PATH_DYNAFORM . $aData["COPY_PROCESS_UID"] . PATH_SEP . $copyDynaformGridUid . ".xml"; if (file_exists($fileGridXml)) { $fileGridXmlCopy = PATH_DYNAFORM . $aData["PRO_UID"] . PATH_SEP . $dynaformGridUid . ".xml"; $fhGridXml = fopen($fileGridXml, "r"); $fhGridXmlCopy = fopen($fileGridXmlCopy, "w"); while (!feof($fhGridXml)) { $strLineAux = fgets($fhGridXml, 4096); $strLineAux = str_replace($aData["COPY_PROCESS_UID"] . "/" . $copyDynaformGridUid, $aData["PRO_UID"] . "/" . $dynaformGridUid, $strLineAux); fwrite($fhGridXmlCopy, $strLineAux); } fclose($fhGridXmlCopy); fclose($fhGridXml);
$response = new stdclass(); $response->status = isset($_SESSION['USER_LOGGED']); if (isset($_REQUEST['dynaformEditorParams'])) { $arrayParameterAux = unserialize(rawurldecode($_REQUEST["dynaformEditorParams"])); $arrayParameterAux["DYNAFORM_NAME"] = base64_decode($arrayParameterAux["DYNAFORM_NAME"]); $_SESSION["Current_Dynafom"]["Parameters"] = $arrayParameterAux; if (isset($_REQUEST['DYN_UID'])) { $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(); $tmp['Properties'] = $properties; $editor->_setTmpData($tmp); } } if (isset($_REQUEST['dynaformRestoreValues'])) {