/** * @param string $prj_uid {@min 32} {@max 32} * @param ProcessFilesManagerStructurePost $request_data * @param string $prf_content * * @url POST /:prj_uid/file-manager */ public function doPostProcessFilesManager($prj_uid, ProcessFilesManagerStructurePost $request_data, $prf_content = null) { try { $userUid = $this->getUserId(); $request_data = (array) $request_data; $request_data = array_merge(array('prf_content' => $prf_content), $request_data); $filesManager = new \ProcessMaker\BusinessModel\FilesManager(); $arrayData = $filesManager->addProcessFilesManager($prj_uid, $userUid, $request_data); //Response $response = $arrayData; } catch (\Exception $e) { //response throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } return $response; }
/** * * @url GET /Templates/:proId */ public function getTemplates($proId) { $templates = array(); $path = PATH_DATA_MAILTEMPLATES . $proId . PATH_SEP; $userUid = $this->getUserId(); $filesManager = new \ProcessMaker\BusinessModel\FilesManager(); \G::verifyPath($path, true); if (defined('PARTNER_FLAG')) { if (!file_exists($path . 'actionsByEmailPartner.html')) { $data = array('prf_content' => '', 'prf_filename' => 'actionsByEmailPartner.html', 'prf_path' => 'templates'); $arrayData = $filesManager->addProcessFilesManager($proId, $userUid, $data); @copy(PATH_TPL . 'actionsByEmail' . PATH_SEP . 'actionsByEmailPartner.html', $path . 'actionsByEmail.html'); } } else { if (!file_exists($path . 'actionsByEmail.html')) { $data = array('prf_content' => '', 'prf_filename' => 'actionsByEmail.html', 'prf_path' => 'templates'); $arrayData = $filesManager->addProcessFilesManager($proId, $userUid, $data); @copy(PATH_TPL . 'actionsByEmail' . PATH_SEP . 'actionsByEmail.html', $path . 'actionsByEmail.html'); } } $directory = dir($path); while ($object = $directory->read()) { if ($object !== '.' && $object !== '..' && $object !== 'alert_message.html') { $templates[] = array('FILE' => $object, 'NAME' => $object); } } return $templates; }