Esempio n. 1
0
 /**
  * Get all properties of an Task
  * @var string $prj_uid. Uid for Process
  * @var string $act_uid. Uid for Activity
  * @var boolean $keyCaseToLower. Flag for case lower
  *
  * return object
  */
 public function getProperties($prj_uid, $act_uid, $keyCaseToLower = false, $groupData = true)
 {
     try {
         $prj_uid = $this->validateProUid($prj_uid);
         $taskUid = $this->validateActUid($act_uid);
         //G::LoadClass("configuration");
         require_once PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.configuration.php";
         $task = new \Task();
         $arrayDataAux = $task->load($taskUid);
         //$arrayDataAux["INDEX"] = 0;
         //$arrayDataAux["IFORM"] = 1;
         //$arrayDataAux["LANG"] = SYS_LANG;
         //Assignment rules
         if ($arrayDataAux["TAS_ASSIGN_TYPE"] == "SELF_SERVICE") {
             $arrayDataAux["TAS_ASSIGN_TYPE"] = !empty($arrayDataAux["TAS_GROUP_VARIABLE"]) ? "SELF_SERVICE_EVALUATE" : $arrayDataAux["TAS_ASSIGN_TYPE"];
         }
         //Timing control
         //Load Calendar Information
         $calendar = new \Calendar();
         $calendarInfo = $calendar->getCalendarFor("", "", $taskUid);
         //If the function returns a DEFAULT calendar it means that this object doesn"t have assigned any calendar
         $arrayDataAux["TAS_CALENDAR"] = $calendarInfo["CALENDAR_APPLIED"] != "DEFAULT" ? $calendarInfo["CALENDAR_UID"] : "";
         //Notifications
         $conf = new \Configurations();
         $conf->loadConfig($x, "TAS_EXTRA_PROPERTIES", $taskUid, "", "");
         $arrayDataAux["TAS_DEF_MESSAGE_TYPE"] = "text";
         $arrayDataAux["TAS_DEF_MESSAGE_TEMPLATE"] = "alert_message.html";
         if (isset($conf->aConfig["TAS_DEF_MESSAGE_TYPE"]) && isset($conf->aConfig["TAS_DEF_MESSAGE_TYPE"])) {
             $arrayDataAux["TAS_DEF_MESSAGE_TYPE"] = $conf->aConfig["TAS_DEF_MESSAGE_TYPE"];
             $arrayDataAux["TAS_DEF_MESSAGE_TEMPLATE"] = $conf->aConfig["TAS_DEF_MESSAGE_TEMPLATE"];
         }
         //Set data
         $arrayData = array();
         $keyCase = $keyCaseToLower ? CASE_LOWER : CASE_UPPER;
         if (!$groupData) {
             $arrayData = array_change_key_case($arrayDataAux, $keyCase);
             return $arrayData;
         }
         //Definition
         $arrayData["DEFINITION"] = array_change_key_case(array("TAS_PRIORITY_VARIABLE" => $arrayDataAux["TAS_PRIORITY_VARIABLE"], "TAS_DERIVATION_SCREEN_TPL" => $arrayDataAux["TAS_DERIVATION_SCREEN_TPL"]), $keyCase);
         //Assignment Rules
         $arrayData["ASSIGNMENT_RULES"] = array_change_key_case(array("TAS_ASSIGN_TYPE" => $arrayDataAux["TAS_ASSIGN_TYPE"], "TAS_ASSIGN_VARIABLE" => $arrayDataAux["TAS_ASSIGN_VARIABLE"], "TAS_GROUP_VARIABLE" => $arrayDataAux["TAS_GROUP_VARIABLE"], "TAS_SELFSERVICE_TIMEOUT" => $arrayDataAux["TAS_SELFSERVICE_TIMEOUT"], "TAS_SELFSERVICE_TIME" => $arrayDataAux["TAS_SELFSERVICE_TIME"], "TAS_SELFSERVICE_TIME_UNIT" => $arrayDataAux["TAS_SELFSERVICE_TIME_UNIT"], "TAS_SELFSERVICE_TRIGGER_UID" => $arrayDataAux["TAS_SELFSERVICE_TRIGGER_UID"], "TAS_SELFSERVICE_EXECUTION" => $arrayDataAux["TAS_SELFSERVICE_EXECUTION"]), $keyCase);
         //Timing control
         $arrayData["TIMING_CONTROL"] = array_change_key_case(array("TAS_TRANSFER_FLY" => $arrayDataAux["TAS_TRANSFER_FLY"], "TAS_DURATION" => $arrayDataAux["TAS_DURATION"], "TAS_TIMEUNIT" => $arrayDataAux["TAS_TIMEUNIT"], "TAS_TYPE_DAY" => $arrayDataAux["TAS_TYPE_DAY"], "TAS_CALENDAR" => $arrayDataAux["TAS_CALENDAR"]), $keyCase);
         //Permissions
         $arrayData["PERMISSIONS"] = array_change_key_case(array("TAS_TYPE" => $arrayDataAux["TAS_TYPE"]), $keyCase);
         //Case Labels
         $arrayData["CASE_LABELS"] = array_change_key_case(array("TAS_DEF_TITLE" => $arrayDataAux["TAS_DEF_TITLE"], "TAS_DEF_DESCRIPTION" => $arrayDataAux["TAS_DEF_DESCRIPTION"]), $keyCase);
         //Notifications
         $arrayData["NOTIFICATIONS"] = array_change_key_case(array("SEND_EMAIL" => $arrayDataAux["TAS_SEND_LAST_EMAIL"], "TAS_DEF_SUBJECT_MESSAGE" => $arrayDataAux["TAS_DEF_SUBJECT_MESSAGE"], "TAS_DEF_MESSAGE_TYPE" => $arrayDataAux["TAS_DEF_MESSAGE_TYPE"], "TAS_DEF_MESSAGE" => $arrayDataAux["TAS_DEF_MESSAGE"], "TAS_DEF_MESSAGE_TEMPLATE" => $arrayDataAux["TAS_DEF_MESSAGE_TEMPLATE"]), $keyCase);
         $arrayData = array_change_key_case($arrayData, $keyCase);
         return $arrayData;
     } catch (Exception $e) {
         throw $e;
     }
 }
Esempio n. 2
0
    /**
     * Get data of a Process
     *
     * @param string $processUid Unique id of Process
     *
     * return array Return an array with data of a Process
     */
    public function getProcess($processUid)
    {
        try {
            //Verify data
            $this->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);

            //Get data
            //Load Process
            $process = new \Process();
            $calendar = new \Calendar();

            $arrayProcessData = $process->load($processUid);
            $arrayCalendarInfo = $calendar->getCalendarFor($processUid, $processUid, $processUid);

            $arrayProcessData["PRO_ASSIGNMENT"] = ($arrayProcessData["PRO_ASSIGNMENT"] == "TRUE")? 1 : 0;
            $arrayProcessData["PRO_SUMMARY_DYNAFORM"] = (isset($arrayProcessData["PRO_DYNAFORMS"]["PROCESS"])? $arrayProcessData["PRO_DYNAFORMS"]["PROCESS"] : "");

            //If the function returns a DEFAULT calendar it means that this object doesn't have assigned any calendar
            $arrayProcessData["PRO_CALENDAR"] = ($arrayCalendarInfo["CALENDAR_APPLIED"] != "DEFAULT")? $arrayCalendarInfo["CALENDAR_UID"] : "";

            //Return
            unset($arrayProcessData["PRO_DYNAFORMS"]);
            unset($arrayProcessData["PRO_WIDTH"]);
            unset($arrayProcessData["PRO_HEIGHT"]);
            unset($arrayProcessData["PRO_TITLE_X"]);
            unset($arrayProcessData["PRO_TITLE_Y"]);
            unset($arrayProcessData["PRO_CATEGORY_LABEL"]);

            $processTitle = $arrayProcessData["PRO_TITLE"];
            $processDescription = $arrayProcessData["PRO_DESCRIPTION"];

            unset($arrayProcessData["PRO_UID"]);
            unset($arrayProcessData["PRO_TITLE"]);
            unset($arrayProcessData["PRO_DESCRIPTION"]);

            $arrayProcessData = array_merge(array("PRO_UID" => $processUid, "PRO_TITLE" => $processTitle, "PRO_DESCRIPTION" => $processDescription), $arrayProcessData);

            if (!$this->formatFieldNameInUppercase) {
                $arrayProcessData = array_change_key_case($arrayProcessData, CASE_LOWER);
            }

            return $arrayProcessData;
        } catch (\Exception $e) {
            throw $e;
        }
    }
Esempio n. 3
0
    /**

     * Get data of a from a record

     *

     * @param array $record Record

     *

     * return array Return an array with data User

     */

    public function getUserDataFromRecord(array $record)

    {

        try {

            //Get Calendar

            $calendar = new \Calendar();

            $calendarInfo = $calendar->getCalendarFor( $record["USR_UID"], "", "" );

            $aFields["USR_CALENDAR_UID"] = ($calendarInfo["CALENDAR_APPLIED"] != "DEFAULT") ? $calendarInfo["CALENDAR_UID"] : "";

            $aFields["USR_CALENDAR"] = ($aFields["USR_CALENDAR_UID"] != "") ? $calendar->calendarName( $aFields["USR_CALENDAR_UID"] ) : $aFields["USR_CALENDAR_UID"];



            //Get photo

            $pathPhotoUser = PATH_IMAGES_ENVIRONMENT_USERS . $record["USR_UID"] . ".gif";

            if (! file_exists( $pathPhotoUser )) {

                $pathPhotoUser = PATH_HOME . "public_html" . PATH_SEP . "images" . PATH_SEP . "user.gif";

            }



            return array(

                $this->getFieldNameByFormatFieldName("USR_UID")                => $record["USR_UID"],

                $this->getFieldNameByFormatFieldName("USR_USERNAME")           => $record["USR_USERNAME"],

                //$this->getFieldNameByFormatFieldName("USR_PASSWORD")           => $record["USR_PASSWORD"],

                $this->getFieldNameByFormatFieldName("USR_FIRSTNAME")          => $record["USR_FIRSTNAME"],

                $this->getFieldNameByFormatFieldName("USR_LASTNAME")           => $record["USR_LASTNAME"],

                $this->getFieldNameByFormatFieldName("USR_EMAIL")              => $record["USR_EMAIL"],

                $this->getFieldNameByFormatFieldName("USR_DUE_DATE")           => $record["USR_DUE_DATE"],

                $this->getFieldNameByFormatFieldName("USR_CREATE_DATE")        => $record["USR_CREATE_DATE"],

                $this->getFieldNameByFormatFieldName("USR_UPDATE_DATE")        => $record["USR_UPDATE_DATE"],

                $this->getFieldNameByFormatFieldName("USR_STATUS")             => $record["USR_STATUS"],

                $this->getFieldNameByFormatFieldName("USR_COUNTRY")            => $record["USR_COUNTRY"],

                $this->getFieldNameByFormatFieldName("USR_CITY")               => $record["USR_CITY"],

                $this->getFieldNameByFormatFieldName("USR_LOCATION")           => $record["USR_LOCATION"],

                $this->getFieldNameByFormatFieldName("USR_ADDRESS")            => $record["USR_ADDRESS"],

                $this->getFieldNameByFormatFieldName("USR_PHONE")              => $record["USR_PHONE"],

                $this->getFieldNameByFormatFieldName("USR_FAX")                => $record["USR_FAX"],

                $this->getFieldNameByFormatFieldName("USR_CELLULAR")           => $record["USR_CELLULAR"],

                $this->getFieldNameByFormatFieldName("USR_ZIP_CODE")           => $record["USR_ZIP_CODE"],

                $this->getFieldNameByFormatFieldName("DEP_UID")                => $record["DEP_UID"],

                $this->getFieldNameByFormatFieldName("USR_POSITION")           => $record["USR_POSITION"],

                $this->getFieldNameByFormatFieldName("USR_RESUME")             => $record["USR_RESUME"],

                $this->getFieldNameByFormatFieldName("USR_BIRTHDAY")           => $record["USR_BIRTHDAY"],

                $this->getFieldNameByFormatFieldName("USR_ROLE")               => $record["USR_ROLE"],

                $this->getFieldNameByFormatFieldName("USR_REPORTS_TO")         => $record["USR_REPORTS_TO"],

                $this->getFieldNameByFormatFieldName("USR_REPLACED_BY")        => $record["USR_REPLACED_BY"],

                $this->getFieldNameByFormatFieldName("USR_CALENDAR_UID")       => $aFields["USR_CALENDAR_UID"],

                $this->getFieldNameByFormatFieldName("USR_CALENDAR_NAME")           => $aFields["USR_CALENDAR"],

                $this->getFieldNameByFormatFieldName("USR_UX")                 => $record["USR_UX"],

                /*----------------------------------********---------------------------------*/

                $this->getFieldNameByFormatFieldName("USR_TOTAL_INBOX")        => $record["USR_TOTAL_INBOX"],

                $this->getFieldNameByFormatFieldName("USR_TOTAL_DRAFT")        => $record["USR_TOTAL_DRAFT"],

                $this->getFieldNameByFormatFieldName("USR_TOTAL_CANCELLED")    => $record["USR_TOTAL_CANCELLED"],

                $this->getFieldNameByFormatFieldName("USR_TOTAL_PARTICIPATED") => $record["USR_TOTAL_PARTICIPATED"],

                $this->getFieldNameByFormatFieldName("USR_TOTAL_PAUSED")       => $record["USR_TOTAL_PAUSED"],

                $this->getFieldNameByFormatFieldName("USR_TOTAL_COMPLETED")    => $record["USR_TOTAL_COMPLETED"],

                $this->getFieldNameByFormatFieldName("USR_TOTAL_UNASSIGNED")   => $record["USR_TOTAL_UNASSIGNED"],

                $this->getFieldNameByFormatFieldName("USR_PHOTO_PATH")   => $pathPhotoUser

            );

        } catch (\Exception $e) {

            throw $e;

        }

    }
Esempio n. 4
0
 /**
  * Get data of a from a record
  *
  * @param array $record Record
  *
  * return array Return an array with data User
  */
 public function getUserDataFromRecord(array $record)
 {
     try {
         //Get Calendar
         $calendar = new \Calendar();
         $calendarInfo = $calendar->getCalendarFor($record["USR_UID"], "", "");
         $aFields["USR_CALENDAR_UID"] = $calendarInfo["CALENDAR_APPLIED"] != "DEFAULT" ? $calendarInfo["CALENDAR_UID"] : "";
         $aFields["USR_CALENDAR"] = $aFields["USR_CALENDAR_UID"] != "" ? $calendar->calendarName($aFields["USR_CALENDAR_UID"]) : $aFields["USR_CALENDAR_UID"];
         //Get photo
         $pathPhotoUser = PATH_IMAGES_ENVIRONMENT_USERS . $record["USR_UID"] . ".gif";
         if (!file_exists($pathPhotoUser)) {
             $pathPhotoUser = PATH_HOME . "public_html" . PATH_SEP . "images" . PATH_SEP . "user.gif";
         }
         $arrayResult = [];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_UID')] = $record['USR_UID'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_USERNAME')] = $record['USR_USERNAME'];
         //$arrayResult[$this->getFieldNameByFormatFieldName('USR_PASSWORD')]           = $record['USR_PASSWORD'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_FIRSTNAME')] = $record['USR_FIRSTNAME'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_LASTNAME')] = $record['USR_LASTNAME'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_EMAIL')] = $record['USR_EMAIL'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_DUE_DATE')] = $record['USR_DUE_DATE'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_CREATE_DATE')] = $record['USR_CREATE_DATE'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_UPDATE_DATE')] = $record['USR_UPDATE_DATE'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_STATUS')] = $record['USR_STATUS'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_COUNTRY')] = $record['USR_COUNTRY'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_CITY')] = $record['USR_CITY'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_LOCATION')] = $record['USR_LOCATION'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_ADDRESS')] = $record['USR_ADDRESS'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_PHONE')] = $record['USR_PHONE'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_FAX')] = $record['USR_FAX'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_CELLULAR')] = $record['USR_CELLULAR'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_ZIP_CODE')] = $record['USR_ZIP_CODE'];
         $arrayResult[$this->getFieldNameByFormatFieldName('DEP_UID')] = $record['DEP_UID'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_POSITION')] = $record['USR_POSITION'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_RESUME')] = $record['USR_RESUME'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_BIRTHDAY')] = $record['USR_BIRTHDAY'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_ROLE')] = $record['USR_ROLE'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_REPORTS_TO')] = $record['USR_REPORTS_TO'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_REPLACED_BY')] = $record['USR_REPLACED_BY'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_CALENDAR_UID')] = $aFields['USR_CALENDAR_UID'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_CALENDAR_NAME')] = $aFields['USR_CALENDAR'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_UX')] = $record['USR_UX'];
         /*----------------------------------********---------------------------------*/
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_INBOX')] = $record['USR_TOTAL_INBOX'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_DRAFT')] = $record['USR_TOTAL_DRAFT'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_CANCELLED')] = $record['USR_TOTAL_CANCELLED'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_PARTICIPATED')] = $record['USR_TOTAL_PARTICIPATED'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_PAUSED')] = $record['USR_TOTAL_PAUSED'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_COMPLETED')] = $record['USR_TOTAL_COMPLETED'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_UNASSIGNED')] = $record['USR_TOTAL_UNASSIGNED'];
         $arrayResult[$this->getFieldNameByFormatFieldName('USR_PHOTO_PATH')] = $pathPhotoUser;
         if (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) {
             $arrayResult[$this->getFieldNameByFormatFieldName('USR_TIME_ZONE')] = trim($record['USR_TIME_ZONE']) != '' ? trim($record['USR_TIME_ZONE']) : \ProcessMaker\Util\System::getTimeZone();
         }
         //Return
         return $arrayResult;
     } catch (\Exception $e) {
         throw $e;
     }
 }