Esempio n. 1
0
    /**
     * @url GET /project/:prj_uid/activity/:act_uid/steps
     *
     * @param string $act_uid {@min 32}{@max 32}
     * @param string $prj_uid {@min 32}{@max 32}
     */
    public function doGetActivitySteps($act_uid, $prj_uid)
    {
        try {
            $task = new \ProcessMaker\BusinessModel\Task();
            $task->setFormatFieldNameInUppercase(false);
            $task->setArrayParamException(array("taskUid" => "act_uid", "stepUid" => "step_uid"));

            $activitySteps = $task->getSteps($act_uid);
            $_SESSION['PROCESS'] = $prj_uid;
            $dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
            $dynaForm->setFormatFieldNameInUppercase(false);
            $oMobile = new \ProcessMaker\BusinessModel\Light();
            $step = new \ProcessMaker\Services\Api\Project\Activity\Step();
            \G::LoadClass("pmDynaform");
            $pmDynaForm = new \pmDynaform();
            $response = array();
            for ($i = 0; $i < count($activitySteps); $i++) {
                if ($activitySteps[$i]['step_type_obj'] == "DYNAFORM") {
                    $dataForm = $dynaForm->getDynaForm($activitySteps[$i]['step_uid_obj']);
                    $result   = $this->parserDataDynaForm($dataForm);
                    $result['formContent'] = (isset($result['formContent']) && $result['formContent'] != null)?json_decode($result['formContent']):"";
                    $pmDynaForm->jsonr($result['formContent']);
                    $result['index']        = $i;
                    $result['stepId']       = $activitySteps[$i]["step_uid"];
                    $result['stepUidObj']   = $activitySteps[$i]["step_uid_obj"];
                    $result['stepMode']     = $activitySteps[$i]['step_mode'];
                    $result['stepPosition'] = $activitySteps[$i]['step_position'];
                    $trigger = $oMobile->statusTriggers($step->doGetActivityStepTriggers($activitySteps[$i]["step_uid"], $act_uid, $prj_uid));
                    $result["triggers"]    = $trigger;
                    $response[] = $result;
                }
            }
        } catch (\Exception $e) {
            throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
        }
        return $response;
    }
Esempio n. 2
0
    /**
     * Method get list start case
     *
     * @param $userId User id
     * @return array
     * @throws \Exception
     */
    public function getProcessListStartCase($userId)
    {
        $response = null;
        try {
            $oProcess = new \Process();
            $oCase    = new \Cases();

            //Get ProcessStatistics Info
            $start   = 0;
            $limit   = '';
            $proData = $oProcess->getAllProcesses( $start, $limit, null, null, false, true );

            $processListInitial = $oCase->getStartCasesPerType( $userId, 'category' );

            $processList = array ();
            foreach ($processListInitial as $key => $procInfo) {
                if (isset( $procInfo['pro_uid'] )) {
                    if (trim( $procInfo['cat'] ) == "") {
                        $procInfo['cat'] = "_OTHER_";
                    }
                    $processList[$procInfo['catname']][$procInfo['value']] = $procInfo;
                }
            }

            ksort( $processList );
            foreach ($processList as $key => $processInfo) {
                ksort( $processList[$key] );
            }

            foreach ($proData as $key => $proInfo) {
                $proData[$proInfo['PRO_UID']] = $proInfo;
            }

            $task = new \ProcessMaker\BusinessModel\Task();
            $task->setFormatFieldNameInUppercase(false);
            $task->setArrayParamException(array("taskUid" => "act_uid", "stepUid" => "step_uid"));
            $step = new \ProcessMaker\Services\Api\Project\Activity\Step();
            $response = array();
            foreach ($processList as $key => $processInfo) {
                $tempTreeChildren = array ();
                foreach ($processList[$key] as $keyChild => $processInfoChild) {
                    $tempTreeChild['text']      = htmlentities($keyChild, ENT_QUOTES, 'UTF-8'); //ellipsis ( $keyChild, 50 );
                    $tempTreeChild['processId'] = $processInfoChild['pro_uid'];
                    $tempTreeChild['taskId']    = $processInfoChild['uid'];
                    $forms = $task->getSteps($processInfoChild['uid']);
                    $newForm = array();
                    $c = 0;
                    foreach ($forms as $k => $form) {
                        if ($form['step_type_obj'] == "DYNAFORM") {
                            $newForm[$c]['formId'] = $form['step_uid_obj'];
                            $newForm[$c]['index'] = $c+1;
                            $newForm[$c]['title'] = $form['obj_title'];
                            $newForm[$c]['description'] = $form['obj_description'];
                            $newForm[$c]['stepId']      = $form["step_uid"];
                            $newForm[$c]['stepMode']    = $form['step_mode'];
                            $trigger = $this->statusTriggers($step->doGetActivityStepTriggers($form["step_uid"], $tempTreeChild['taskId'], $tempTreeChild['processId']));
                            $newForm[$c]["triggers"]    = $trigger;
                            $c++;
                        }
                    }
                    $tempTreeChild['forms'] = $newForm;
                    if (isset( $proData[$processInfoChild['pro_uid']] )) {
                        $tempTreeChildren[] = $tempTreeChild;
                    }
                }
                $response = array_merge($response, $tempTreeChildren);
            }
        } catch (\Exception $e) {
            throw $e;
        }
        return $response;
    }
Esempio n. 3
0
    /**

     * @url GET /:prj_uid/activity/:act_uid/available-steps

     *

     * @param string $act_uid {@min 32}{@max 32}

     * @param string $prj_uid {@min 32}{@max 32}

     */

    public function doGetActivityAvailableSteps($act_uid, $prj_uid)

    {

        try {

            $task = new \ProcessMaker\BusinessModel\Task();

            $task->setFormatFieldNameInUppercase(false);

            $task->setArrayParamException(array("taskUid" => "act_uid"));



            $response = $task->getAvailableSteps($act_uid);



            return $response;

        } catch (\Exception $e) {

            throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));

        }

    }
Esempio n. 4
0
 /**
  * @url PUT /:prj_uid/activity/validate-active-cases
  *
  * @param string $prj_uid {@min 32}{@max 32}
  */
 public function doGetActivityValidateSelfService($prj_uid, $request_data = array())
 {
     try {
         $task = new \ProcessMaker\BusinessModel\Task();
         $task->setFormatFieldNameInUppercase(false);
         $task->setArrayParamException(array("taskUid" => "act_uid"));
         $response = $task->getValidateSelfService($request_data);
         return $response;
     } catch (\Exception $e) {
         throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
     }
 }