/** * @url GET /:prj_uid/trigger-wizard/:lib_name * @url GET /:prj_uid/trigger-wizard/:lib_name/:fn_name * * @param string $prj_uid {@min 32}{@max 32} * @param string $lib_name * @param string $fn_name */ public function doGetTriggerWizard($prj_uid, $lib_name, $fn_name = "") { try { $triggerWizard = new \ProcessMaker\BusinessModel\TriggerWizard(); $triggerWizard->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase); $triggerWizard->setArrayFieldNameForException($this->arrayFieldNameForException); $response = $fn_name == "" ? $triggerWizard->getLibrary($lib_name) : $triggerWizard->getMethod($lib_name, $fn_name); return $response; } catch (\Exception $e) { throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } }
/** * Get all Libraries * * @param string $processUid Unique id of Process * * return array Return an array with all Libraries */ public function getLibraries($processUid) { try { $arrayLibrary = array(); //Verify data $this->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]); //Get data \G::LoadClass("triggerLibrary"); $triggerWizard = new \ProcessMaker\BusinessModel\TriggerWizard(); $triggerWizard->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase); $triggerWizard->setArrayFieldNameForException($this->arrayFieldNameForException); $triggerLibrary = \triggerLibrary::getSingleton(); $library = $triggerLibrary->getRegisteredClasses(); ksort($library); foreach ($library as $key => $value) { $libraryName = (preg_match("/^class\.?(.*)\.pmFunctions\.php$/", $key, $arrayMatch))? ((isset($arrayMatch[1]) && $arrayMatch[1] != "")? $arrayMatch[1] : "pmFunctions") : $key; $arrayLibrary[] = $triggerWizard->getLibrary($libraryName); } //Return return $arrayLibrary; } catch (\Exception $e) { throw $e; } }