This commit is contained in:
dheeyi
2016-03-21 18:05:02 -04:00
parent 3f26b11f9a
commit b735ee25ad
3 changed files with 17 additions and 33 deletions

View File

@@ -31,13 +31,21 @@ try {
$_GET["pro_uid"] = $proUid->pro_uid;
$_GET["objects"] = $proUid->objects;
}
if (\BpmnProject::exists($_GET["pro_uid"])) {
if (\BpmnProject::exists($_GET["pro_uid"]) && isset($_GET['objects'])) {
$_GET["objects"] = \G::json_decode($_GET['objects']);
$exportObjects = new \ProcessMaker\BusinessModel\Migrator\ExportObjects();
$getListObject = \G::json_decode($exportObjects->objectList());
if(sizeof($getListObject->data) === sizeof($_GET['objects'])){
$exporter = new ProcessMaker\Exporter\XmlExporter($_GET["pro_uid"]);
$getProjectName = $exporter->truncateName($exporter->getProjectName(),false);
$version = ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx") + 1;
$outputFilename = sprintf("%s-%s.%s", str_replace(" ","_",$getProjectName), $version, "pmx");
$outputFilename = $exporter->saveExport($outputDir . $outputFilename);
}else{
$granularExporter = new \ProcessMaker\BusinessModel\Migrator\GranularExporter($_GET['pro_uid']);
$outputFilename = $granularExporter->export($_GET['objects']);
}
} else {
$oProcess = new Processes();
$proFields = $oProcess->serializeProcess($_GET["pro_uid"]);

View File

@@ -52,31 +52,8 @@ class DynaformsMigrator implements Importable, Exportable
try {
$oData = new \StdClass();
$oData->dynaforms = $this->processes->getDynaformRows($prj_uid);
$workflowFile = array();
foreach ($oData->dynaforms as $dynaform) {
$dynFile = PATH_DYNAFORM . $dynaform['DYN_FILENAME'] . '.xml';
$workflowFile['DYNAFORMS'][] = array(
"filename" => $dynaform['DYN_TITLE'],
"filepath" => $dynaform['DYN_FILENAME'] . '.xml',
"file_content" => file_get_contents($dynFile)
);
$htmlFile = PATH_DYNAFORM . $dynaform['DYN_FILENAME'] . '.html';
if (file_exists($htmlFile)) {
$workflowFile['DYNAFORMS'][] = array(
"filename" => $dynaform['DYN_FILENAME'] . '.html',
"filepath" => $dynaform['DYN_FILENAME'] . '.html',
"file_content" => file_get_contents($htmlFile)
);
}
}
$result = array(
'workflow-definition' => (array)$oData,
'workflow-files' => $workflowFile
'workflow-definition' => (array)$oData
);
return $result;

View File

@@ -145,12 +145,11 @@ class Project extends Api
{
$objects = \G::json_decode($objects);
$granularExporter = new GranularExporter($prj_uid);
$outputFilename = $granularExporter->export($objects->objectList);
$outputFilename = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" .
$outputFilename = $granularExporter->export($objects);
$outputFilename = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'files' . PATH_SEP . 'output' .
PATH_SEP . $outputFilename;
$httpStream = new HttpStream();
$fileExtension = pathinfo($outputFilename, PATHINFO_EXTENSION);
$httpStream->loadFromFile($outputFilename);
$httpStream->setHeader("Content-Type", "application/xml; charset=UTF-8");
$httpStream->send();