/** * get all department * * @param none * @return $result will return an object */ public function departmentList () { try { $result = array (); $oCriteria = new Criteria( 'workflow' ); $oCriteria->add( DepartmentPeer::DEP_STATUS, 'ACTIVE' ); $oDataset = DepartmentPeer::doSelectRS( $oCriteria ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $oDepartment = new Department(); $aDepartment = $oDepartment->Load( $aRow['DEP_UID'] ); $node['guid'] = $aRow['DEP_UID']; $node['name'] = $aDepartment['DEPO_TITLE']; $node['parentUID'] = $aDepartment['DEP_PARENT']; $node['dn'] = $aDepartment['DEP_LDAP_DN']; //get the users from this department $c = new Criteria(); $c->clearSelectColumns(); $c->addSelectColumn( 'COUNT(*)' ); $c->add( UsersPeer::DEP_UID, $aRow['DEP_UID'] ); $rs = UsersPeer::doSelectRS( $c ); $rs->next(); $row = $rs->getRow(); $count = $row[0]; $node['users'] = $count; $result[] = $node; $oDataset->next(); } return $result; } catch (Exception $e) { $result[] = array ('guid' => $e->getMessage(),'name' => $e->getMessage() ); return $result; } }
switch ($access) { case -1: G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); 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; } $dept = new Department(); $DptoUid = isset($_GET['UID']) ? urldecode($_GET['UID']) : ''; if ($DptoUid) { $aFields = $dept->Load($DptoUid); } else { $aFields = array(); } $G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'departments/departments_Edit', '', $aFields, 'departments_Save'); G::RenderPage("publish", "raw");
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_MAIN_MENU = 'processmaker'; $G_SUB_MENU = 'users'; $G_ID_MENU_SELECTED = 'USERS'; $G_ID_SUB_MENU_SELECTED = 'DEPARTMENTS'; $G_PUBLISH = new Publisher(); $oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher->addExtJsScript('departments/departmentUsers', false); //adding a javascript file .js $oHeadPublisher->addContent('departments/departmentUsers'); //adding a html file .html. G::LoadClass('configuration'); $c = new Configurations(); $dep = new Department(); $dep->Load($_GET['dUID']); $depart = array(); $depart['DEP_UID'] = $dep->getDepUid(); $depart['DEP_TITLE'] = $dep->getDepTitle(); $depart['DEP_MANAGER'] = $dep->getDepManager(); $oHeadPublisher->assign('DEPARTMENT', $depart); $oHeadPublisher->assign('FORMATS', $c->getFormats()); G::RenderPage('publish', 'extJs');
$oUser = new Users(); $data = $oUser->loadDetailed($_REQUEST['USR_UID']); $data['USR_STATUS'] = G::LoadTranslation('ID_' . $data['USR_STATUS']); $oAppCache = new AppCacheView(); $aTypes = array(); $aTypes['to_do'] = 'CASES_INBOX'; $aTypes['draft'] = 'CASES_DRAFT'; $aTypes['cancelled'] = 'CASES_CANCELLED'; $aTypes['sent'] = 'CASES_SENT'; $aTypes['paused'] = 'CASES_PAUSED'; $aTypes['completed'] = 'CASES_COMPLETED'; $aTypes['selfservice'] = 'CASES_SELFSERVICE'; $aCount = $oAppCache->getAllCounters(array_keys($aTypes), $_REQUEST['USR_UID']); $dep = new Department(); if ($dep->existsDepartment($data['DEP_UID'])) { $dep->Load($data['DEP_UID']); $dep_name = $dep->getDepTitle(); } else { $dep_name = ''; } if ($data['USR_REPLACED_BY'] != '') { $user = new Users(); $u = $user->load($data['USR_REPLACED_BY']); $c = new Configurations(); $replaced_by = $c->usersNameFormat($u['USR_USERNAME'], $u['USR_FIRSTNAME'], $u['USR_LASTNAME']); } else { $replaced_by = ''; } $misc = array(); $misc['DEP_TITLE'] = $dep_name; $misc['REPLACED_NAME'] = $replaced_by;
$dep = new Department(); $dep->Load($DEP_UID); $dep_manager = $dep->getDepManager(); $manager = $dep_manager == '' ? true : false; foreach ($aUsers as $USR_UID) { $dep->addUserToDepartment($DEP_UID, $USR_UID, $manager, false); $manager = false; } $dep->updateDepartmentManager($DEP_UID); break; case 'deleteDepartmentToUserMultiple': $DEP_UID = $_REQUEST['DEP_UID']; $uSERS = $_REQUEST['USR_UID']; $aUsers = explode(',', $uSERS); $dep = new Department(); $dep->Load($DEP_UID); $manager = $dep->getDepManager(); foreach ($aUsers as $USR_UID) { $dep->removeUserFromDepartment($DEP_UID, $USR_UID); if ($USR_UID == $manager) { $editDepto['DEP_UID'] = $DEP_UID; $editDepto['DEP_MANAGER'] = ''; $dep->update($editDepto); $dep->updateDepartmentManager($DEP_UID); } } break; case 'updateSupervisor': $dep_manager = $_POST['USR_UID']; $dep_uid = $_POST['DEP_UID']; $editDepartment['DEP_UID'] = $dep_uid;
public function departmentRemoveUsers($departmentUid, array $arrayUserUid) { try { $department = new Department(); $department->Load($departmentUid); $departmentManagerUid = $department->getDepManager(); foreach ($arrayUserUid as $value) { $userUid = $value; $department->removeUserFromDepartment($departmentUid, $userUid); if ($userUid == $departmentManagerUid) { $department->update(array("DEP_UID" => $departmentUid, "DEP_MANAGER" => "")); $department->updateDepartmentManager($departmentUid); } } } catch (Exception $e) { throw $e; } }
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('departments'); $dbc = new DBConnection(); $ses = new DBSession($dbc); $Dpto = new Department(); $DptoUid = isset($_GET['SUID']) ? urldecode($_GET['SUID']) : ''; $DepParent = isset($_GET['SDEPPARENT']) ? urldecode($_GET['SDEPPARENT']) : ''; if (strlen($DptoUid) > 1 && strlen($DepParent) > 1) { $aFields = $Dpto->Load($DptoUid); } else { $infosubDto = $Dpto->Load($DptoUid); //print_r($infosubDto); $aFields = array('SUID' => $DptoUid, 'SDEPPARENT' => $DepParent); //print_r($aFields);print"<hr>"; } $G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'departments/subdep_Edit', '', $aFields, 'subdep_Save'); G::RenderPage("publish", "raw");