Example #1
0
 /**
  * @url PUT /:prj_uid/trigger-wizard/:lib_name/:fn_name/:tri_uid
  *
  * @param string $prj_uid      {@min 32}{@max 32}
  * @param string $lib_name
  * @param string $fn_name
  * @param string $tri_uid      {@min 32}{@max 32}
  * @param array  $request_data
  */
 public function doPutTriggerWizard($prj_uid, $lib_name, $fn_name, $tri_uid, $request_data)
 {
     try {
         $triggerWizard = new \ProcessMaker\BusinessModel\TriggerWizard();
         $triggerWizard->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
         $triggerWizard->setArrayFieldNameForException($this->arrayFieldNameForException);
         $arrayData = $triggerWizard->update($lib_name, $fn_name, $tri_uid, $request_data);
     } catch (\Exception $e) {
         throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
     }
 }
Example #2
0
    /**
     * 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;
        }
    }