/**
  * editObjectPermission
  *
  * @param string $sOP_UID
  * @param string $sProcessUID
  * @return void
  */
 public function editExtObjectPermission($sProcessUID, $sOP_UID)
 {
     $oCriteria = new Criteria();
     $oCriteria->add(ObjectPermissionPeer::OP_UID, $sOP_UID);
     $oDataset = ObjectPermissionPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $aRows = $oDataset->getRow();
     $oCriteria = new Criteria();
     $oCriteria->add(GroupwfPeer::GRP_UID, $aRows['USR_UID']);
     if (GroupwfPeer::doCount($oCriteria) == 1) {
         $user = '******' . $aRows['USR_UID'];
     }
     $oCriteria = new Criteria();
     $oCriteria->add(UsersPeer::USR_UID, $aRows['USR_UID']);
     if (UsersPeer::doCount($oCriteria) == 1) {
         $user = '******' . $aRows['USR_UID'];
     }
     $aFields['LANG'] = SYS_LANG;
     $aFields['OP_UID'] = $aRows['OP_UID'];
     $aFields['PRO_UID'] = $aRows['PRO_UID'];
     $aFields['OP_CASE_STATUS'] = $aRows['OP_CASE_STATUS'];
     $aFields['TAS_UID'] = $aRows['TAS_UID'];
     $aFields['OP_GROUP_USER'] = $user;
     $aFields['OP_TASK_SOURCE'] = $aRows['OP_TASK_SOURCE'];
     $aFields['OP_PARTICIPATE'] = $aRows['OP_PARTICIPATE'];
     $aFields['OP_OBJ_TYPE'] = $aRows['OP_OBJ_TYPE'];
     $aFields['OP_ACTION'] = $aRows['OP_ACTION'];
     $lang = defined('SYS_LANG') ? SYS_LANG : 'en';
     $aFields['TASK_TARGET_NAME'] = Content::load('TAS_TITLE', '', $aRows['TAS_UID'], $lang);
     $aFields['TASK_SOURCE_NAME'] = Content::load('TAS_TITLE', '', $aRows['OP_TASK_SOURCE'], $lang);
     $oUser = UsersPeer::retrieveByPK($aRows['USR_UID']);
     if (!is_null($oUser)) {
         $aFields['USR_FULLNAME'] = $oUser->getUsrFirstname() . ' ' . $oUser->getUsrLastname();
     } else {
         throw new Exception("The row '" . $aRows['USR_UID'] . "' in table USER doesn't exist!");
     }
     switch ($aRows['OP_OBJ_TYPE']) {
         /*  case 'ANY':
                 $aFields['OP_OBJ_TYPE'] = '';
                 break;
             */
         case 'DYNAFORM':
             $aFields['DYNAFORM'] = $aRows['OP_OBJ_UID'];
             $aFields['DYNAFORM_NAME'] = Content::load('DYN_TITLE', '', $aRows['OP_OBJ_UID'], $lang);
             break;
         case 'INPUT':
             $aFields['INPUT'] = $aRows['OP_OBJ_UID'];
             $aFields['INPUT_NAME'] = Content::load('INP_DOC_TITLE', '', $aRows['OP_OBJ_UID'], $lang);
             break;
         case 'OUTPUT':
             $aFields['OUTPUT'] = $aRows['OP_OBJ_UID'];
             $aFields['OUTPUT_NAME'] = Content::load('OUT_DOC_TITLE', '', $aRows['OP_OBJ_UID'], $lang);
             break;
     }
     return $aFields;
 }
示例#2
0
 public function getOwnersByType($data)
 {
     $this->setResponseType('json');
     $result = new stdclass();
     $result->status = 'OK';
     try {
         switch ($data->type) {
             case 'EVERYBODY':
                 $result->total = 0;
                 $result->owners = array();
                 break;
             case 'USER':
                 require_once 'classes/model/Users.php';
                 $users = array();
                 $usersInstance = new Users();
                 $allUsers = $usersInstance->getAll();
                 foreach ($allUsers->data as $user) {
                     $users[] = array('OWNER_UID' => $user['USR_UID'], 'OWNER_NAME' => $user['USR_FIRSTNAME'] . ' ' . $user['USR_LASTNAME']);
                 }
                 usort($users, function ($str1, $str2) {
                     return strcmp(strtolower($str1["OWNER_NAME"]), strtolower($str2["OWNER_NAME"]));
                 });
                 $result->total = $allUsers->totalCount;
                 $result->owners = $users;
                 break;
             case 'DEPARTMENT':
                 require_once 'classes/model/Department.php';
                 require_once 'classes/model/Content.php';
                 $departments = array();
                 //SELECT
                 $criteria = new Criteria('workflow');
                 $criteria->setDistinct();
                 $criteria->addSelectColumn(DepartmentPeer::DEP_UID);
                 $criteria->addSelectColumn(ContentPeer::CON_VALUE);
                 //FROM
                 $conditions = array();
                 $conditions[] = array(DepartmentPeer::DEP_UID, ContentPeer::CON_ID);
                 $conditions[] = array(ContentPeer::CON_CATEGORY, DBAdapter::getStringDelimiter() . 'DEPO_TITLE' . DBAdapter::getStringDelimiter());
                 $conditions[] = array(ContentPeer::CON_LANG, DBAdapter::getStringDelimiter() . 'en' . DBAdapter::getStringDelimiter());
                 $criteria->addJoinMC($conditions, Criteria::LEFT_JOIN);
                 //WHERE
                 $criteria->add(DepartmentPeer::DEP_STATUS, 'ACTIVE');
                 //ORDER BY
                 $criteria->addAscendingOrderByColumn(ContentPeer::CON_VALUE);
                 $dataset = DepartmentPeer::doSelectRS($criteria);
                 $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
                 $dataset->next();
                 while ($row = $dataset->getRow()) {
                     $departments[] = array('OWNER_UID' => $row['DEP_UID'], 'OWNER_NAME' => $row['CON_VALUE']);
                     $dataset->next();
                 }
                 $result->total = DepartmentPeer::doCount($criteria);
                 $result->owners = $departments;
                 break;
             case 'GROUP':
                 require_once 'classes/model/Groupwf.php';
                 require_once 'classes/model/Content.php';
                 $groups = array();
                 //SELECT
                 $criteria = new Criteria('workflow');
                 $criteria->setDistinct();
                 $criteria->addSelectColumn(GroupwfPeer::GRP_UID);
                 $criteria->addSelectColumn(ContentPeer::CON_VALUE);
                 //FROM
                 $conditions = array();
                 $conditions[] = array(GroupwfPeer::GRP_UID, ContentPeer::CON_ID);
                 $conditions[] = array(ContentPeer::CON_CATEGORY, DBAdapter::getStringDelimiter() . 'GRP_TITLE' . DBAdapter::getStringDelimiter());
                 $conditions[] = array(ContentPeer::CON_LANG, DBAdapter::getStringDelimiter() . 'en' . DBAdapter::getStringDelimiter());
                 $criteria->addJoinMC($conditions, Criteria::LEFT_JOIN);
                 //WHERE
                 $criteria->add(GroupwfPeer::GRP_STATUS, 'ACTIVE');
                 //ORDER BY
                 $criteria->addAscendingOrderByColumn(ContentPeer::CON_VALUE);
                 $dataset = GroupwfPeer::doSelectRS($criteria);
                 $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
                 $dataset->next();
                 while ($row = $dataset->getRow()) {
                     $groups[] = array('OWNER_UID' => $row['GRP_UID'], 'OWNER_NAME' => $row['CON_VALUE']);
                     $dataset->next();
                 }
                 $result->total = GroupwfPeer::doCount($criteria);
                 $result->owners = $groups;
                 break;
         }
     } catch (Exception $error) {
         $result->status = 'ERROR';
         $result->message = $error->getMessage();
     }
     return $result;
 }
示例#3
0
 public function filterGroup($filter, $start, $limit)
 {
     require_once 'classes/model/Groupwf.php';
     require_once 'classes/model/TaskUser.php';
     require_once 'classes/model/GroupUser.php';
     G::LoadClass('configuration');
     $co = new Configurations();
     $config = $co->getConfiguration('groupList', 'pageSize', '', $_SESSION['USER_LOGGED']);
     $env = $co->getConfiguration('ENVIRONMENT_SETTINGS', '');
     $limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20;
     $start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;
     $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $limit_size;
     $filter = isset($_REQUEST['textFilter']) ? $_REQUEST['textFilter'] : '';
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(GroupwfPeer::GRP_UID);
     $oCriteria->addJoin(GroupwfPeer::GRP_UID, ContentPeer::CON_ID, Criteria::LEFT_JOIN);
     $oCriteria->add(ContentPeer::CON_CATEGORY, 'GRP_TITLE');
     $oCriteria->add(ContentPeer::CON_LANG, SYS_LANG);
     if ($filter != '') {
         $oCriteria->add(ContentPeer::CON_VALUE, '%' . $filter . '%', Criteria::LIKE);
     }
     $totalRows = GroupwfPeer::doCount($oCriteria);
     $oCriteria = new Criteria('workflow');
     $oCriteria->clearSelectColumns();
     $oCriteria->addSelectColumn(GroupwfPeer::GRP_UID);
     $oCriteria->addSelectColumn(GroupwfPeer::GRP_STATUS);
     $oCriteria->addSelectColumn(ContentPeer::CON_VALUE);
     $oCriteria->addAsColumn('GRP_TASKS', 0);
     $oCriteria->addAsColumn('GRP_USERS', 0);
     $oCriteria->addJoin(GroupwfPeer::GRP_UID, ContentPeer::CON_ID, Criteria::LEFT_JOIN);
     $oCriteria->add(ContentPeer::CON_CATEGORY, 'GRP_TITLE');
     $oCriteria->add(ContentPeer::CON_LANG, SYS_LANG);
     if ($filter != '') {
         $oCriteria->add(ContentPeer::CON_VALUE, '%' . $filter . '%', Criteria::LIKE);
     }
     $oCriteria->setOffset($start);
     $oCriteria->setLimit($limit);
     $oDataset = GroupwfPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
 }