Adding Exporter for BPMN Projects (2nd commit)
This commit is contained in:
@@ -54,12 +54,12 @@ class BpmnBound extends BaseBpmnBound
|
|||||||
$rs = BpmnBoundPeer::doSelectRS($c);
|
$rs = BpmnBoundPeer::doSelectRS($c);
|
||||||
$rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
$activities = array();
|
$bounds = array();
|
||||||
|
|
||||||
while ($rs->next()) {
|
while ($rs->next()) {
|
||||||
$activities[] = $changeCaseTo !== CASE_UPPER ? array_change_key_case($rs->getRow(), CASE_LOWER) : $rs->getRow();
|
$bounds[] = $changeCaseTo !== CASE_UPPER ? array_change_key_case($rs->getRow(), CASE_LOWER) : $rs->getRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $activities;
|
return $bounds;
|
||||||
}
|
}
|
||||||
} // BpmnBound
|
} // BpmnBound
|
||||||
|
|||||||
@@ -24,6 +24,27 @@ class BpmnDiagram extends BaseBpmnDiagram
|
|||||||
return BpmnDiagramPeer::doSelect($c);
|
return BpmnDiagramPeer::doSelect($c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getAll($prjUid = null, $start = null, $limit = null, $filter = '', $changeCaseTo = CASE_UPPER)
|
||||||
|
{
|
||||||
|
$c = new Criteria('workflow');
|
||||||
|
$c->addSelectColumn("BPMN_DIAGRAM.*");
|
||||||
|
|
||||||
|
if (! is_null($prjUid)) {
|
||||||
|
$c->add(BpmnDiagramPeer::PRJ_UID, $prjUid, Criteria::EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$rs = BpmnDiagramPeer::doSelectRS($c);
|
||||||
|
$rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
|
$diagrams = array();
|
||||||
|
|
||||||
|
while ($rs->next()) {
|
||||||
|
$diagrams[] = $changeCaseTo !== CASE_UPPER ? array_change_key_case($rs->getRow(), CASE_LOWER) : $rs->getRow();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $diagrams;
|
||||||
|
}
|
||||||
|
|
||||||
// Overrides
|
// Overrides
|
||||||
|
|
||||||
public function toArray($type = BasePeer::TYPE_FIELDNAME)
|
public function toArray($type = BasePeer::TYPE_FIELDNAME)
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class BpmnFlow extends BaseBpmnFlow
|
|||||||
return BpmnFlowPeer::doSelect($c);
|
return BpmnFlowPeer::doSelect($c);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getAll($prjUid = null, $start = null, $limit = null, $filter = '', $changeCaseTo = CASE_UPPER)
|
public static function getAll($prjUid = null, $start = null, $limit = null, $filter = '', $changeCaseTo = CASE_UPPER, $decodeState = true)
|
||||||
{
|
{
|
||||||
//TODO implement $start, $limit and $filter
|
//TODO implement $start, $limit and $filter
|
||||||
$c = new Criteria('workflow');
|
$c = new Criteria('workflow');
|
||||||
@@ -80,7 +80,9 @@ class BpmnFlow extends BaseBpmnFlow
|
|||||||
|
|
||||||
while ($rs->next()) {
|
while ($rs->next()) {
|
||||||
$flow = $rs->getRow();
|
$flow = $rs->getRow();
|
||||||
$flow["FLO_STATE"] = @json_decode($flow["FLO_STATE"], true);
|
if ($decodeState) {
|
||||||
|
$flow["FLO_STATE"] = @json_decode($flow["FLO_STATE"], true);
|
||||||
|
}
|
||||||
//$flow["FLO_IS_INMEDIATE"] = $flow["FLO_IS_INMEDIATE"] == 1 ? true : false;
|
//$flow["FLO_IS_INMEDIATE"] = $flow["FLO_IS_INMEDIATE"] == 1 ? true : false;
|
||||||
$flow = $changeCaseTo !== CASE_UPPER ? array_change_key_case($flow, CASE_LOWER) : $flow;
|
$flow = $changeCaseTo !== CASE_UPPER ? array_change_key_case($flow, CASE_LOWER) : $flow;
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,26 @@ class BpmnProcess extends BaseBpmnProcess
|
|||||||
return BpmnProcessPeer::doSelect($c);
|
return BpmnProcessPeer::doSelect($c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getAll($prjUid = null, $start = null, $limit = null, $filter = '', $changeCaseTo = CASE_UPPER)
|
||||||
|
{
|
||||||
|
$c = new Criteria('workflow');
|
||||||
|
$c->addSelectColumn("BPMN_PROCESS.*");
|
||||||
|
|
||||||
|
if (! is_null($prjUid)) {
|
||||||
|
$c->add(BpmnProcessPeer::PRJ_UID, $prjUid, Criteria::EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$rs = BpmnProcessPeer::doSelectRS($c);
|
||||||
|
$rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
|
$processes = array();
|
||||||
|
while ($rs->next()) {
|
||||||
|
$processes[] = $changeCaseTo !== CASE_UPPER ? array_change_key_case($rs->getRow(), CASE_LOWER) : $rs->getRow();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $processes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Overrides
|
// Overrides
|
||||||
|
|
||||||
|
|||||||
@@ -28,20 +28,19 @@ abstract class Exporter
|
|||||||
|
|
||||||
|
|
||||||
$bpmnStruct["ACTIVITY"] = \BpmnActivity::getAll($this->prjUid);
|
$bpmnStruct["ACTIVITY"] = \BpmnActivity::getAll($this->prjUid);
|
||||||
//$data["BPMN_STRUCTURE"]["BPMN_BOUND"] = $this->bwap->getBounds();
|
$bpmnStruct["BOUND"] = \BpmnBound::getAll($this->prjUid);
|
||||||
// $data["bpmn_data"] = $this->bwap->getProject();
|
$bpmnStruct["DATA"] = array();
|
||||||
// $data["bpmn_diagram"] = $this->bwap->getProject();
|
$bpmnStruct["DIAGRAM"] = \BpmnDiagram::getAll($this->prjUid);
|
||||||
// $data["bpmn_documentation"] = $this->bwap->getProject();
|
$bpmnStruct["DOCUMENTATION"] = array();
|
||||||
$bpmnStruct["BPMN_EVENT"] = \BpmnEvent::getAll($this->prjUid);
|
$bpmnStruct["BPMN_EVENT"] = \BpmnEvent::getAll($this->prjUid);
|
||||||
// $data["bpmn_extension"] = $this->bwap->getProject();
|
$bpmnStruct["EXTENSION"] = array();
|
||||||
// $data["bpmn_flow"] = $this->bwap->getProject();
|
$bpmnStruct["FLOW"] = \BpmnFlow::getAll($this->prjUid, null, null, "", CASE_UPPER, false);
|
||||||
$bpmnStruct["BPMN_GATEWAY"] = \BpmnGateway::getAll($this->prjUid);
|
$bpmnStruct["BPMN_GATEWAY"] = \BpmnGateway::getAll($this->prjUid);
|
||||||
// $data["bpmn_lane"] = $this->bwap->getProject();
|
$bpmnStruct["LANE"] = array();
|
||||||
// $data["bpmn_laneset"] = $this->bwap->getProject();
|
$bpmnStruct["LANESET"] = array();
|
||||||
// $data["bpmn_participant"] = $this->bwap->getProject();
|
$bpmnStruct["PARTICIPANT"] = array();
|
||||||
// $data["bpmn_process"] = $this->bwap->getProject();
|
$bpmnStruct["PROCESS"] = \BpmnProcess::getAll($this->prjUid);
|
||||||
// $data["bpmn_project"] = $this->bwap->getProject();
|
$bpmnStruct["PROJECT"] = array(\BpmnProjectPeer::retrieveByPK($this->prjUid)->toArray());
|
||||||
|
|
||||||
|
|
||||||
\G::LoadClass( 'processes' );
|
\G::LoadClass( 'processes' );
|
||||||
$oProcess = new \Processes();
|
$oProcess = new \Processes();
|
||||||
@@ -68,7 +67,7 @@ abstract class Exporter
|
|||||||
$htmlFile = PATH_DYNAFORM . $dynaform['DYN_FILENAME'] . '.html';
|
$htmlFile = PATH_DYNAFORM . $dynaform['DYN_FILENAME'] . '.html';
|
||||||
|
|
||||||
if (file_exists($htmlFile)) {
|
if (file_exists($htmlFile)) {
|
||||||
$dynaforms[] = array(
|
$data["WORKFLOW_FILES"]["DYNAFORMS"][] = array(
|
||||||
"filename" => $dynaform['DYN_FILENAME'] . '.html',
|
"filename" => $dynaform['DYN_FILENAME'] . '.html',
|
||||||
"filepath" => $dynaform['DYN_FILENAME'] . '.html',
|
"filepath" => $dynaform['DYN_FILENAME'] . '.html',
|
||||||
"file_content" => file_get_contents($htmlFile)
|
"file_content" => file_get_contents($htmlFile)
|
||||||
@@ -77,33 +76,29 @@ abstract class Exporter
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getting templates files
|
// getting templates files
|
||||||
$templates = array();
|
$workspaceTargetDirs = array("TEMPLATES" => "mailTemplates", "PUBLIC" => "public");
|
||||||
$workspaceDir = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP;
|
$workspaceDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP;
|
||||||
$templatesDir = $workspaceDir . 'mailTemplates' . PATH_SEP . $this->prjUid;
|
|
||||||
$templatesFiles = \G::rglob("*", 0, $templatesDir);
|
|
||||||
|
|
||||||
foreach ($templatesFiles as $templatesFile) {
|
foreach ($workspaceTargetDirs as $target => $workspaceTargetDir) {
|
||||||
if (is_dir($templatesFile)) continue;
|
$templatesDir = $workspaceDir . $workspaceTargetDir . PATH_SEP . $this->prjUid;
|
||||||
|
$templatesFiles = \G::rglob("*", 0, $templatesDir);
|
||||||
|
|
||||||
$templates[] = array(
|
foreach ($templatesFiles as $templatesFile) {
|
||||||
"filename" => basename($templatesFile),
|
if (is_dir($templatesFile)) continue;
|
||||||
"filepath" => str_replace($templatesDir, "", $templatesFile),
|
|
||||||
"file_content" => file_get_contents($templatesFile)
|
$data["WORKFLOW_FILES"][$target][] = array(
|
||||||
);
|
"filename" => basename($templatesFile),
|
||||||
|
"filepath" => str_replace($templatesDir, "", $templatesFile),
|
||||||
|
"file_content" => file_get_contents($templatesFile)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$data["WORKFLOW_FILES"]["DYNAFORMS"] = $dynaforms;
|
|
||||||
$data["WORKFLOW_FILES"]["TEMPLATES"] = $templates;
|
|
||||||
$data["WORKFLOW_FILES"]["PUBLIC"] = array();
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSystemInfo()
|
public function getSystemInfo()
|
||||||
{
|
{
|
||||||
//$sysInfo = \System::getSysInfo();
|
|
||||||
//print_r($sysInfo); die;
|
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
"vendor" => "ProcessMaker",
|
"vendor" => "ProcessMaker",
|
||||||
"codename" => "Michelangelo",
|
"codename" => "Michelangelo",
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class XmlExporter extends Exporter
|
|||||||
foreach ($recordData as $key => $value) {
|
foreach ($recordData as $key => $value) {
|
||||||
$columnNode = $this->dom->createElement(strtoupper($key));
|
$columnNode = $this->dom->createElement(strtoupper($key));
|
||||||
|
|
||||||
|
if (is_array($value)) {print_r($value); die;}
|
||||||
if (preg_match('/^[\w\s]+$/', $value, $match) || empty($value)) {
|
if (preg_match('/^[\w\s]+$/', $value, $match) || empty($value)) {
|
||||||
$textNode = $this->dom->createTextNode($value);
|
$textNode = $this->dom->createTextNode($value);
|
||||||
} else {
|
} else {
|
||||||
@@ -77,8 +78,6 @@ class XmlExporter extends Exporter
|
|||||||
|
|
||||||
// workflow dynaforms files
|
// workflow dynaforms files
|
||||||
foreach ($data["WORKFLOW_FILES"] as $elementName => $elementData) {
|
foreach ($data["WORKFLOW_FILES"] as $elementName => $elementData) {
|
||||||
//$wfFilesNode = $this->dom->createElement($elementName);
|
|
||||||
|
|
||||||
foreach ($elementData as $fileData) {
|
foreach ($elementData as $fileData) {
|
||||||
$fileNode = $this->dom->createElement("FILE");
|
$fileNode = $this->dom->createElement("FILE");
|
||||||
$fileNode->setAttribute("target", strtolower($elementName));
|
$fileNode->setAttribute("target", strtolower($elementName));
|
||||||
@@ -97,8 +96,6 @@ class XmlExporter extends Exporter
|
|||||||
|
|
||||||
$workflowFilesNode->appendChild($fileNode);
|
$workflowFilesNode->appendChild($fileNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
//$workflowFilesNode->appendChild($wfFilesNode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->rootNode->appendChild($workflowFilesNode);
|
$this->rootNode->appendChild($workflowFilesNode);
|
||||||
|
|||||||
Reference in New Issue
Block a user