setSystemId($systemId) ->setFlowId($flowId); } /** * @param string $systemId * @param string $flowId * @return array|void */ public static function get_records($systemId = "", $flowId = "") { // var_dump($_SERVER['DOCUMENT_ROOT']); $where = " "; $where .= !empty($systemId) ? (" and system_id like '" . $systemId . "%'") : ""; $where .= !empty($flowId) ? (" and flow_id like '" . $flowId . "%'") : ""; $where = $where == "where " ? "" : $where; return DB::result("SELECT system_id,flow_id,creator,create_date, wf_file,wf_layout,wf_version,wf_name FROM workflow_items where 1=1 " . $where, false); } public function save() { #这里针对主机 $directory = self::PREFIX_SAVE_DIR . $this->getSystemId(); if (!file_exists($directory)) { mkdir($directory, 0777, true); chmod($directory, 0777); } $this->setWfFile($this->getFlowId() . ".json"); $path = $directory . "/" . $this->getWfFile(); echo $path; DB::query("delete from workflow_items where system_id='" . $this->getSystemId() . "' and flow_id='" . $this->getFlowId() . "'"); DB::insert_table("workflow_items", array( 'system_id' => $this->getsystemid(), 'flow_id' => $this->getflowid(), 'creator' => $this->getcreator(), 'wf_name' => $this->getwffile(), 'wf_version' => $this->getwfversion(), 'wf_layout' => "null", 'wf_file' => $path )); file_put_contents($path, $this->getFlowChart()); } public function parseFcToFields($flowChart = null) { $flowChart = empty($flowChart) ? $this->getFlowChart() : $flowChart; $_flowChart = json_decode($flowChart, true); $this->setWfVersion($_flowChart['version'])->setSystemId($_flowChart['systemId']) ->setFlowChart($flowChart)->setFlowId($_flowChart['flowId'])->setWfName($_flowChart['flowName']); return $this; } public function setFlowChart($flowChart) { $this->flow_chart = $flowChart; return $this; } /** * @return mixed */ public function getSystemId() { return $this->system_id; } /** * @param mixed $system_id * @return WorkFLowItems */ public function setSystemId($system_id) { $this->system_id = $system_id; return $this; } /** * @return mixed */ public function getFlowId() { return $this->flow_id; } /** * @param mixed $flow_id * @return WorkFLowItems */ public function setFlowId($flow_id) { $this->flow_id = $flow_id; return $this; } /** * @return mixed */ public function getCreator() { return $this->creator; } /** * @param mixed $creator * @return WorkFLowItems */ public function setCreator($creator) { $this->creator = $creator; return $this; } /** * @return mixed */ public function getCreateDate() { return $this->create_date; } /** * @param mixed $create_date * @return WorkFLowItems */ public function setCreateDate($create_date) { $this->create_date = $create_date; return $this; } /** * @return mixed */ public function getWfFile() { return $this->wf_file; } /** * @param mixed $wf_file * @return WorkFLowItems */ public function setWfFile($wf_file) { $this->wf_file = $wf_file; return $this; } /** * @return mixed */ public function getWfLayout() { return $this->wf_layout; } /** * @param mixed $wf_layout * @return WorkFLowItems */ public function setWfLayout($wf_layout) { $this->wf_layout = $wf_layout; return $this; } /** * @return mixed */ public function getWfVersion() { return $this->wf_version; } /** * @param mixed $wf_version * @return WorkFLowItems */ public function setWfVersion($wf_version) { $this->wf_version = $wf_version; return $this; } /** * @return mixed */ public function getWfName() { return $this->wf_name; } /** * @param mixed $wf_name * @return WorkFLowItems */ public function setWfName($wf_name) { $this->wf_name = $wf_name; return $this; } /** * @return mixed */ public function getFlowChart() { return $this->flow_chart; } }