Ejemplo n.º 1
0
 /**
  * Get process and task properties
  *
  * @param object $httpData{type, UID}
  */
 public function getProperties($httpData)
 {
     switch ($httpData->type) {
         case 'process':
             require_once 'classes/model/ProcessCategory.php';
             require_once 'classes/model/CalendarDefinition.php';
             G::LoadClass('processMap');
             $oProcessMap = new processMap(new DBConnection());
             $process = $oProcessMap->editProcessNew($httpData->UID);
             $category = ProcessCategoryPeer::retrieveByPk($process['PRO_CATEGORY']);
             $categoryName = is_object($category) ? $category->getCategoryName() : '';
             $calendar = CalendarDefinitionPeer::retrieveByPk($process['PRO_CALENDAR']);
             $calendarName = is_object($calendar) ? $calendar->getCalendarName() : '';
             $properties['Title'] = $process['PRO_TITLE'];
             $properties['Description'] = $process['PRO_DESCRIPTION'];
             $properties['Calendar'] = $calendarName;
             $properties['Category'] = $categoryName;
             $properties['Debug'] = $process['PRO_DEBUG'] == '1' ? true : false;
             $this->sucess = true;
             $this->prop = $properties;
             break;
         case 'task':
             require_once 'classes/model/Task.php';
             $task = new Task();
             $taskData = $task->load($httpData->UID);
             $properties['Title'] = $taskData['TAS_TITLE'];
             $properties['Description'] = $taskData['TAS_DESCRIPTION'];
             $properties['Variable for case priority'] = $taskData['TAS_PRIORITY_VARIABLE'];
             $properties['Starting Task'] = $taskData['TAS_START'] == 'TRUE' ? true : false;
             $this->sucess = true;
             $this->prop = $properties;
             break;
     }
 }
Ejemplo n.º 2
0
 /**
  * Load the Process row specified in [pro_id] column value.
  *
  * @param string $ProUid the uid of the Prolication
  * @return array $Fields the fields
  */
 public function load($ProUid, $getAllLang = false)
 {
     $con = Propel::getConnection(ProcessPeer::DATABASE_NAME);
     try {
         $oPro = ProcessPeer::retrieveByPk($ProUid);
         if (is_object($oPro) && get_class($oPro) == 'Process') {
             $aFields = $oPro->toArray(BasePeer::TYPE_FIELDNAME);
             $this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
             //optimized to avoid double and multiple execution of the same query
             //        $aFields['PRO_TITLE']       = $oPro->getProTitle();
             //        $aFields['PRO_DESCRIPTION'] = $oPro->getProDescription();
             //        $this->pro_title = $aFields['PRO_TITLE'];
             //        $this->pro_description = $aFields['PRO_DESCRIPTION'];
             $lang = defined('SYS_LANG') ? SYS_LANG : 'en';
             $c = new Criteria();
             $c->clearSelectColumns();
             $c->addSelectColumn(ContentPeer::CON_CATEGORY);
             $c->addSelectColumn(ContentPeer::CON_VALUE);
             $c->add(ContentPeer::CON_ID, $ProUid);
             if (!$getAllLang) {
                 $c->add(ContentPeer::CON_LANG, $lang);
             }
             $rs = ProcessPeer::doSelectRS($c, Propel::getDbConnection('workflow_ro'));
             $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
             $rs->next();
             $row = $rs->getRow();
             while (is_array($row)) {
                 switch ($row['CON_CATEGORY']) {
                     case 'PRO_TITLE':
                         $aFields['PRO_TITLE'] = $row['CON_VALUE'];
                         $this->pro_title = $row['CON_VALUE'];
                         if ($row['CON_VALUE'] !== '') {
                             $this->setProTitle($aFields['PRO_TITLE']);
                         }
                         break;
                     case 'PRO_DESCRIPTION':
                         $aFields['PRO_DESCRIPTION'] = $row['CON_VALUE'];
                         $this->pro_description = $row['CON_VALUE'];
                         if ($row['CON_VALUE'] !== '') {
                             $this->setProDescription($aFields['PRO_DESCRIPTION']);
                         }
                         break;
                 }
                 $rs->next();
                 $row = $rs->getRow();
             }
             //If the prev script doesn't return anithing try to create the values based on EN
             if (!isset($aFields['PRO_TITLE'])) {
                 $aFields['PRO_TITLE'] = $oPro->getProTitle();
                 $this->setProTitle($aFields['PRO_TITLE']);
             }
             if (!isset($aFields['PRO_DESCRIPTION'])) {
                 $aFields['PRO_DESCRIPTION'] = $oPro->getProDescription();
                 $this->setProDescription($aFields['PRO_DESCRIPTION']);
             }
             //the following code is to copy the parent in old process, when the parent was empty.
             if ($oPro->getProParent() == '') {
                 $oPro->setProParent($oPro->getProUid());
                 $oPro->save();
             }
             //Get category Name, by default No category
             $aFields['PRO_CATEGORY_LABEL'] = G::LoadTranslation("ID_PROCESS_NO_CATEGORY");
             if ($aFields['PRO_CATEGORY'] != "") {
                 $oProCat = ProcessCategoryPeer::retrieveByPk($aFields['PRO_CATEGORY']);
                 if (is_object($oProCat) && get_class($oProCat) == 'ProcessCategory') {
                     $aFields['PRO_CATEGORY_LABEL'] = $oProCat->getCategoryName();
                 }
             }
             $aFields['PRO_DYNAFORMS'] = @unserialize($aFields['PRO_DYNAFORMS']);
             //Check if is BPMN process
             $aFields['PRO_BPMN'] = $this->isBpmnProcess($ProUid);
             return $aFields;
         } else {
             throw new Exception("The row '{$ProUid}' in table Process doesn't exist!");
         }
     } catch (Exception $oError) {
         throw $oError;
     }
 }
Ejemplo n.º 3
0
 public function exists($catUid)
 {
     $oProCat = ProcessCategoryPeer::retrieveByPk($catUid);
     return is_object($oProCat) && get_class($oProCat) == 'ProcessCategory';
 }