コード例 #1
0
ファイル: Light.php プロジェクト: nhenderson/processmaker
    /**
     * @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;
    }
コード例 #2
0
ファイル: Light.php プロジェクト: rrsc/processmaker
    /**
     * 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;
    }
コード例 #3
0
ファイル: Activity.php プロジェクト: hpx2206/processmaker-1
    /**

     * @url GET /: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"));



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



            $step = new \ProcessMaker\Services\Api\Project\Activity\Step();



            for ($i = 0; $i < count($response); $i++) {

                $response[$i]["triggers"] = $step->doGetActivityStepTriggers($response[$i]["step_uid"], $act_uid, $prj_uid);

            }



            return $response;

        } catch (\Exception $e) {

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

        }

    }
コード例 #4
0
ファイル: Process.php プロジェクト: emildev35/processmaker
 /**
  * @url GET /:processUid/activity/:activityUid/extended
  */
 public function getActivityExtended($activityUid, $processUid)
 {
     $response = array();
     try {
         $task2 = new \ProcessMaker\BusinessModel\Task();
         $arrayData = array("_extended" => array("properties" => $task2->getProperties($activityUid, true), "steps" => array("steps" => $task2->getSteps($activityUid, true), "conditions" => "...", "triggers" => $task2->getTriggers($activityUid, true), "users" => $task2->getUsers($activityUid, 1, true), "users_adhoc" => $task2->getUsers($activityUid, 2, true))));
         //Response
         $response["success"] = true;
         $response["message"] = "Extended loaded successfully";
         $response["data"] = array("activity" => $arrayData);
     } catch (\Exception $e) {
         //Response
         $response["success"] = false;
         $response["message"] = $e->getMessage();
     }
     return $response;
 }