/** * create Group * * @param string $groupName * @return $result will return an object */ public function createGroup ($groupName) { try { if (trim( $groupName ) == '') { $result = new wsCreateGroupResponse( 25, G::loadTranslation( 'ID_GROUP_NAME_REQUIRED' ), '' ); return $result; } $group = new Groupwf(); $grpRow['GRP_TITLE'] = $groupName; $groupId = $group->create( $grpRow ); $data['GROUP_NAME'] = $groupName; $result = new wsCreateGroupResponse( 0, G::loadTranslation( 'ID_GROUP_CREATED_SUCCESSFULLY', SYS_LANG, $data ), $groupId ); return $result; } catch (Exception $e) { $result = wsCreateGroupResponse( 100, $e->getMessage(), '' ); return $result; } }
/** * Get Task User Rows from an array of data * * @param array $aTaskUser * @return array $aStepTrigger */ public function createGroupRow ($aGroupwf) { foreach ($aGroupwf as $key => $row) { $oGroupwf = new Groupwf(); if ($oGroupwf->GroupwfExists( $row['GRP_UID'] )) { $oGroupwf->remove( $row['GRP_UID'] ); } $res = $oGroupwf->create( $row ); } }
$oCriteria = $oGroup->loadByGroupname($_POST['GRP_NAME']); $oDataset = GroupwfPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $aRow = $oDataset->getRow(); $response = $aRow ? 'true' : 'false'; echo $response; break; case 'saveNewGroup': G::LoadClass('groups'); $newGroup['GRP_UID'] = ''; $newGroup['GRP_STATUS'] = G::toUpper($_POST['status']); $newGroup['GRP_TITLE'] = trim($_POST['name']); unset($newGroup['GRP_UID']); $group = new Groupwf(); $group->create($newGroup); echo '{success: true}'; break; case 'saveEditGroup': G::LoadClass('groups'); $editGroup['GRP_UID'] = $_POST['grp_uid']; $editGroup['GRP_STATUS'] = G::toUpper($_POST['status']); $editGroup['GRP_TITLE'] = trim($_POST['name']); $group = new Groupwf(); $group->update($editGroup); echo '{success: true}'; break; case 'deleteGroup': G::LoadClass('groups'); $group = new Groupwf(); if (!isset($_POST['GRP_UID'])) {
G::header('location: ../login/login'); die; break; case -2: G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::header('location: ../login/login'); die; break; default: G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header('location: ../login/login'); die; break; } } if (($RBAC_Response = $RBAC->userCanAccess("PM_USERS")) != 1) { return $RBAC_Response; } G::LoadClass('groups'); $G_MAIN_MENU = 'wf.login'; $G_MENU_SELECTED = ''; $group = new Groupwf(); if ($_POST['form']['GRP_UID'] === '') { $grpRow = $_POST['form']; unset($grpRow['GRP_UID']); $group->create($grpRow); //$_POST['form']['GRP_UID']=$group->getGrpUid(); //$group->update($_POST['form']); } else { $group->update($_POST['form']); }
/** * Create Group * * @param array $arrayData Data * * return array Return data of the new Group created */ public function create($arrayData) { try { $arrayData = array_change_key_case($arrayData, CASE_UPPER); unset($arrayData["GRP_UID"]); //Verify data $process = new \ProcessMaker\BusinessModel\Process(); $process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, true); $this->throwExceptionIfExistsTitle($arrayData["GRP_TITLE"], $this->arrayFieldNameForException["groupTitle"]); //Create $group = new \Groupwf(); $groupUid = $group->create($arrayData); //Return $arrayData = array_merge(array("GRP_UID" => $groupUid), $arrayData); if (!$this->formatFieldNameInUppercase) { $arrayData = array_change_key_case($arrayData, CASE_LOWER); } return $arrayData; } catch (\Exception $e) { throw $e; } }