Open Journal Systems  3.0.0
 All Classes Namespaces Functions Variables Groups Pages
UserGroupDAO.inc.php
1 <?php
2 
18 import('lib.pkp.classes.security.UserGroup');
19 import('lib.pkp.classes.workflow.WorkflowStageDAO');
20 
21 class UserGroupDAO extends DAO {
23  var $userDao;
24 
27 
31  function UserGroupDAO() {
32  parent::DAO();
33  $this->userDao = DAORegistry::getDAO('UserDAO');
34  $this->userGroupAssignmentDao = DAORegistry::getDAO('UserGroupAssignmentDAO');
35  }
36 
41  function newDataObject() {
42  return new UserGroup();
43  }
44 
50  function _returnFromRow($row) {
51  $userGroup = $this->newDataObject();
52  $userGroup->setId($row['user_group_id']);
53  $userGroup->setRoleId($row['role_id']);
54  $userGroup->setContextId($row['context_id']);
55  $userGroup->setDefault($row['is_default']);
56  $userGroup->setShowTitle($row['show_title']);
57  $userGroup->setPermitSelfRegistration($row['permit_self_registration']);
58 
59  $this->getDataObjectSettings('user_group_settings', 'user_group_id', $row['user_group_id'], $userGroup);
60 
61  HookRegistry::call('UserGroupDAO::_returnFromRow', array(&$userGroup, &$row));
62 
63  return $userGroup;
64  }
65 
71  function insertObject($userGroup) {
72  $this->update(
73  'INSERT INTO user_groups
74  (role_id, context_id, is_default, show_title, permit_self_registration)
75  VALUES
76  (?, ?, ?, ?, ?)',
77  array(
78  (int) $userGroup->getRoleId(),
79  (int) $userGroup->getContextId(),
80  $userGroup->getDefault()?1:0,
81  $userGroup->getShowTitle()?1:0,
82  $userGroup->getPermitSelfRegistration()?1:0,
83  )
84  );
85 
86  $userGroup->setId($this->getInsertId());
87  $this->updateLocaleFields($userGroup);
88  return $this->getInsertId();
89  }
90 
95  function updateObject($userGroup) {
96  $this->update(
97  'UPDATE user_groups SET
98  role_id = ?,
99  context_id = ?,
100  is_default = ?,
101  show_title = ?,
102  permit_self_registration = ?
103  WHERE user_group_id = ?',
104  array(
105  (int) $userGroup->getRoleId(),
106  (int) $userGroup->getContextId(),
107  $userGroup->getDefault()?1:0,
108  $userGroup->getShowTitle()?1:0,
109  $userGroup->getPermitSelfRegistration()?1:0,
110  (int) $userGroup->getId(),
111  )
112  );
113 
114  $this->updateLocaleFields($userGroup);
115  }
116 
123  function deleteById($contextId, $userGroupId) {
124  $this->userGroupAssignmentDao->deleteAssignmentsByUserGroupId($userGroupId);
125  $this->update('DELETE FROM user_group_settings WHERE user_group_id = ?', (int) $userGroupId);
126  $this->update('DELETE FROM user_groups WHERE user_group_id = ?', (int) $userGroupId);
127  $this->removeAllStagesFromGroup($contextId, $userGroupId);
128  }
135  function deleteObject($userGroup) {
136  $this->deleteById($userGroup->getContextId(), $userGroup->getId());
137  }
138 
139 
144  function deleteByContextId($contextId) {
145  $result = $this->retrieve('SELECT user_group_id FROM user_groups WHERE context_id = ?', (int) $contextId);
146 
147  for ($i=1; !$result->EOF; $i++) {
148  list($userGroupId) = $result->fields;
149 
150  $this->update('DELETE FROM user_group_stage WHERE user_group_id = ?', (int) $userGroupId);
151  $this->update('DELETE FROM user_group_settings WHERE user_group_id = ?', (int) $userGroupId);
152  $this->update('DELETE FROM user_groups WHERE user_group_id = ?', (int) $userGroupId);
153 
154  $result->MoveNext();
155  }
156  }
157 
162  function getInsertId() {
163  return $this->_getInsertId('user_groups', 'user_group_id');
164  }
165 
170  function getLocaleFieldNames() {
171  return array('name', 'abbrev');
172  }
173 
178  function updateLocaleFields($userGroup) {
179  $this->updateDataObjectSettings('user_group_settings', $userGroup, array(
180  'user_group_id' => (int) $userGroup->getId()
181  ));
182  }
183 
189  function getById($userGroupId, $contextId = null) {
190  $params = array((int) $userGroupId);
191  if ($contextId !== null) $params[] = (int) $contextId;
192  $result = $this->retrieve(
193  'SELECT *
194  FROM user_groups
195  WHERE user_group_id = ?' . ($contextId !== null?' AND context_id = ?':''),
196  $params
197  );
198 
199  return $this->_returnFromRow($result->GetRowAssoc(false));
200  }
201 
207  function getDefaultByRoleId($contextId, $roleId) {
208  $allDefaults = $this->getByRoleId($contextId, $roleId, true);
209  if ($allDefaults->eof()) return false;
210  return $allDefaults->next();
211  }
212 
218  function isDefault($userGroupId) {
219  $result = $this->retrieve(
220  'SELECT is_default FROM user_groups
221  WHERE user_group_id = ?',
222  (int) $userGroupId
223  );
225  $result = $result->GetArray();
226  if (isset($result[0]['is_default'])) {
227  return $result[0]['is_default'];
228  } else {
229  return false;
230  }
231  }
232 
241  function getByRoleId($contextId, $roleId, $default = false, $dbResultRange = null) {
242  $params = array((int) $contextId, (int) $roleId);
243  if ($default) $params[] = 1; // true
244  $result = $this->retrieveRange(
245  'SELECT *
246  FROM user_groups
247  WHERE context_id = ? AND
248  role_id = ?
249  ' . ($default?' AND is_default = ?':''),
250  $params,
251  $dbResultRange
252  );
253 
254  return new DAOResultFactory($result, $this, '_returnFromRow');
255  }
256 
262  function getUserGroupIdsByRoleId($roleId, $contextId = null) {
263  $params = array((int) $roleId);
264  if ($contextId) $params[] = (int) $contextId;
265 
266  $result = $this->retrieve(
267  'SELECT user_group_id
268  FROM user_groups
269  WHERE role_id = ?
270  ' . ($contextId?' AND context_id = ?':''),
271  $params
272  );
273 
274  $userGroupIds = array();
275  while (!$result->EOF) {
276  $userGroupIds[] = (int) $result->fields[0];
277  $result->MoveNext();
278  }
279 
280  $result->Close();
281  return $userGroupIds;
282  }
283 
291  function userInGroup($userId, $userGroupId) {
292  $result = $this->retrieve(
293  'SELECT count(*)
294  FROM user_groups ug
295  JOIN user_user_groups uug ON ug.user_group_id = uug.user_group_id
296  WHERE
297  uug.user_id = ? AND
298  ug.user_group_id = ?',
299  array((int) $userId, (int) $userGroupId)
300  );
301 
302  // > 0 because user could belong to more than one user group with this role
303  $returner = isset($result->fields[0]) && $result->fields[0] > 0 ? true : false;
304 
305  $result->Close();
306  return $returner;
307  }
308 
315  function userInAnyGroup($userId, $contextId = null) {
316  $params = array((int) $userId);
317  if ($contextId) $params[] = (int) $contextId;
318 
319  $result = $this->retrieve(
320  'SELECT count(*)
321  FROM user_groups ug
322  JOIN user_user_groups uug ON ug.user_group_id = uug.user_group_id
323  WHERE uug.user_id = ?
324  ' . ($contextId?' AND ug.context_id = ?':''),
325  $params
326  );
327 
328  $returner = isset($result->fields[0]) && $result->fields[0] > 0 ? true : false;
329 
330  $result->Close();
331  return $returner;
332  }
333 
340  function getByUserId($userId, $contextId = null){
341  $params = array((int) $userId);
342  if ($contextId) $params[] = (int) $contextId;
343 
344  $result = $this->retrieve(
345  'SELECT ug.*
346  FROM user_groups ug
347  JOIN user_user_groups uug ON ug.user_group_id = uug.user_group_id
348  WHERE uug.user_id = ?
349  ' . ($contextId?' AND ug.context_id = ?':''),
350  $params
351  );
352 
353  return new DAOResultFactory($result, $this, '_returnFromRow');
354  }
355 
362  function contextHasGroup($contextId, $userGroupId) {
363  $result = $this->retrieve(
364  'SELECT count(*)
365  FROM user_groups ug
366  WHERE ug.user_group_id = ?
367  AND ug.context_id = ?',
368  array (
369  (int) $userGroupId,
370  (int) $contextId
371  )
372  );
373 
374  $returner = isset($result->fields[0]) && $result->fields[0] == 0 ? false : true;
375 
376  $result->Close();
377  return $returner;
378  }
379 
386  function getByContextId($contextId = null, $dbResultRange = null) {
387  $params = array();
388  if ($contextId) $params[] = (int) $contextId;
389 
390  $result = $this->retrieveRange(
391  'SELECT ug.*
392  FROM user_groups ug' .
393  ($contextId?' WHERE ug.context_id = ?':''),
394  $params,
395  $dbResultRange
396  );
397 
398  return new DAOResultFactory($result, $this, '_returnFromRow');
399  }
400 
406  function getContextUsersCount($contextId, $userGroupId = null, $roleId = null) {
407  $params = array((int) $contextId);
408  if ($userGroupId) $params[] = (int) $userGroupId;
409  if ($roleId) $params[] = (int) $roleId;
410  $result = $this->retrieve(
411  'SELECT COUNT(DISTINCT(uug.user_id))
412  FROM user_groups ug
413  JOIN user_user_groups uug ON ug.user_group_id = uug.user_group_id
414  WHERE context_id = ?' .
415  ($userGroupId?' AND ug.user_group_id = ?':'') .
416  ($roleId?' AND ug.role_id = ?':''),
417  $params
418  );
419 
420  $returner = $result->fields[0];
421 
422  $result->Close();
423  return (int) $returner;
424  }
425 
435  function getUsersByContextId($contextId, $searchType = null, $search = null, $searchMatch = null, $dbResultRange = null) {
436  return $this->getUsersById(null, $contextId, $searchType, $search, $searchMatch, $dbResultRange);
437  }
438 
446  function getUsersNotInRole($roleId, $contextId = null, $search = null) {
447  $params = array((int) $roleId);
448  if ($contextId) $params[] = (int) $contextId;
449  if(isset($search)) $params = array_merge($params, array_pad(array(), 5, '%' . $search . '%'));
450 
451  $result = $this->retrieve(
452  'SELECT DISTINCT u.*
453  FROM users u, user_groups ug, user_user_groups uug
454  WHERE ug.user_group_id = uug.user_group_id AND
455  u.user_id = uug.user_id AND
456  ug.role_id <> ?' .
457  ($contextId?' AND ug.context_id = ?':'') .
458  (isset($search) ? ' AND (u.first_name LIKE ? OR u.middle_name LIKE ? OR u.last_name LIKE ? OR u.email LIKE ? OR u.username LIKE ?)':''),
459  $params
460  );
461 
462  return new DAOResultFactory($result, $this->userDao, '_returnUserFromRowWithData');
463  }
464 
475  function getUsersById($userGroupId = null, $contextId = null, $searchType = null, $search = null, $searchMatch = null, $dbResultRange = null) {
476  $params = array();
477 
478  if ($contextId) $params[] = (int) $contextId;
479  if ($userGroupId) $params[] = (int) $userGroupId;
480 
481  $result = $this->retrieveRange(
482  'SELECT DISTINCT u.*
483  FROM users AS u
484  LEFT JOIN user_settings us ON (us.user_id = u.user_id AND us.setting_name = \'affiliation\')
485  LEFT JOIN user_interests ui ON (u.user_id = ui.user_id)
486  LEFT JOIN controlled_vocab_entry_settings cves ON (ui.controlled_vocab_entry_id = cves.controlled_vocab_entry_id)
487  LEFT JOIN user_user_groups uug ON (uug.user_id = u.user_id)
488  LEFT JOIN user_groups ug ON (ug.user_group_id = uug.user_group_id)
489  WHERE 1=1' .
490  ($contextId?' AND ug.context_id = ?':'') .
491  ($userGroupId?' AND ug.user_group_id = ?':'') .
492  $this->_getSearchSql($searchType, $search, $searchMatch, $params),
493  $params,
494  $dbResultRange
495  );
496 
497  return new DAOResultFactory($result, $this->userDao, '_returnUserFromRowWithData');
498  }
499 
500  //
501  // UserGroupAssignment related
502  //
507  function deleteAssignmentsByUserId($userId, $userGroupId = null) {
508  $this->userGroupAssignmentDao->deleteByUserId($userId, $userGroupId);
509  }
510 
515  function deleteAssignmentsByUserGroupId($userGroupId) {
516  $this->userGroupAssignmentDao->deleteAssignmentsByUserGroupId($userGroupId);
517  }
518 
524  function deleteAssignmentsByContextId($contextId, $userId = null) {
525  $this->userGroupAssignmentDao->deleteAssignmentsByContextId($contextId, $userId);
526  }
527 
533  function assignUserToGroup($userId, $groupId) {
534  $assignment = $this->userGroupAssignmentDao->newDataObject();
535  $assignment->setUserId($userId);
536  $assignment->setUserGroupId($groupId);
537  $this->userGroupAssignmentDao->insertObject($assignment);
538  }
546  function removeUserFromGroup($userId, $groupId, $contextId) {
547  $assignments = $this->userGroupAssignmentDao->getByUserId($userId, $contextId);
548  while ($assignment = $assignments->next()) {
549  if ($assignment->getUserGroupId() == $groupId) {
550  $this->userGroupAssignmentDao->deleteAssignment($assignment);
551  }
552  }
553  }
554 
560  function removeAllStagesFromGroup($contextId, $userGroupId) {
561  $assignedStages = $this->getAssignedStagesByUserGroupId($contextId, $userGroupId);
562  foreach($assignedStages as $stageId => $stageLocaleKey) {
563  $this->removeGroupFromStage($contextId, $userGroupId, $stageId);
564  }
565  }
573  function assignGroupToStage($contextId, $userGroupId, $stageId) {
574  $this->update(
575  'INSERT INTO user_group_stage (context_id, user_group_id, stage_id) VALUES (?, ?, ?)',
576  array((int) $contextId, (int) $userGroupId, (int) $stageId)
577  );
578  }
586  function removeGroupFromStage($contextId, $userGroupId, $stageId) {
587  $this->update(
588  'DELETE FROM user_group_stage WHERE context_id = ? AND user_group_id = ? AND stage_id = ?',
589  array((int) $contextId, (int) $userGroupId, (int) $stageId)
590  );
591  }
593  //
594  // Extra settings (not handled by rest of Dao)
595  //
604  function updateSetting($userGroupId, $name, $value, $type = null, $isLocalized = false) {
605  $keyFields = array('setting_name', 'locale', 'user_group_id');
606 
607  if (!$isLocalized) {
608  $value = $this->convertToDB($value, $type);
609  $this->replace('user_group_settings',
610  array(
611  'user_group_id' => (int) $userGroupId,
612  'setting_name' => $name,
613  'setting_value' => $value,
614  'setting_type' => $type,
615  'locale' => ''
616  ),
617  $keyFields
618  );
619  } else {
620  if (is_array($value)) foreach ($value as $locale => $localeValue) {
621  $this->update('DELETE FROM user_group_settings WHERE user_group_id = ? AND setting_name = ? AND locale = ?', array((int) $userGroupId, $name, $locale));
622  if (empty($localeValue)) continue;
623  $type = null;
624  $this->update('INSERT INTO user_group_settings
625  (user_group_id, setting_name, setting_value, setting_type, locale)
626  VALUES (?, ?, ?, ?, ?)',
627  array(
628  $userGroupId, $name, $this->convertToDB($localeValue, $type), $type, $locale
629  )
630  );
631  }
632  }
633  }
634 
635 
643  function getSetting($userGroupId, $name, $locale = null) {
644  $params = array((int) $userGroupId, $name);
645  if ($locale) $params[] = $locale;
646  $result = $this->retrieve(
647  'SELECT setting_name, setting_value, setting_type, locale
648  FROM user_group_settings
649  WHERE user_group_id = ? AND
650  setting_name = ?' .
651  ($locale?' AND locale = ?':''),
652  $params
653  );
654 
655  $recordCount = $result->RecordCount();
656  $returner = false;
657  if ($recordCount == 1) {
658  $row = $result->getRowAssoc(false);
659  $returner = $this->convertFromDB($row['setting_value'], $row['setting_type']);
660  } elseif ($recordCount > 1) {
661  $returner = array();
662  while (!$result->EOF) {
663  $returner[$row['locale']] = $this->convertFromDB($row['setting_value'], $row['setting_type']);
664  $result->MoveNext();
665  }
666  $result->Close();
667  }
668  return $returner;
669  }
670 
671  //
672  // Install/Defaults with settings
673  //
674 
681  function installSettings($contextId, $filename) {
682  $xmlParser = new XMLParser();
683  $tree = $xmlParser->parse($filename);
684 
685  if (!$tree) {
686  $xmlParser->destroy();
687  return false;
688  }
689 
690  foreach ($tree->getChildren() as $setting) {
691  $roleId = hexdec($setting->getAttribute('roleId'));
692  $nameKey = $setting->getAttribute('name');
693  $abbrevKey = $setting->getAttribute('abbrev');
694  $permitSelfRegistration = $setting->getAttribute('permitSelfRegistration');
695  $defaultStages = explode(',', $setting->getAttribute('stages'));
696  $userGroup = $this->newDataObject();
697 
698  // create a role associated with this user group
699  $userGroup = $this->newDataObject();
700  $userGroup->setRoleId($roleId);
701  $userGroup->setContextId($contextId);
702  $userGroup->setPermitSelfRegistration($permitSelfRegistration);
703  $userGroup->setDefault(true);
704 
705  // insert the group into the DB
706  $userGroupId = $this->insertObject($userGroup);
707 
708  // Install default groups for each stage
709  if (is_array($defaultStages)) { // test for groups with no stage assignments
710  foreach ($defaultStages as $stageId) {
711  if (!empty($stageId) && $stageId <= WORKFLOW_STAGE_ID_PRODUCTION && $stageId >= WORKFLOW_STAGE_ID_SUBMISSION) {
712  $this->assignGroupToStage($contextId, $userGroupId, $stageId);
713  }
714  }
715  }
716 
717  // add the i18n keys to the settings table so that they
718  // can be used when a new locale is added/reloaded
719  $this->updateSetting($userGroup->getId(), 'nameLocaleKey', $nameKey);
720  $this->updateSetting($userGroup->getId(), 'abbrevLocaleKey', $abbrevKey);
721 
722  // install the settings in the current locale for this context
723  $this->installLocale(AppLocale::getLocale(), $contextId);
724  }
725 
726  return true;
727  }
728 
734  function installLocale($locale, $contextId = null) {
735  $userGroups = $this->getByContextId($contextId);
736  while ($userGroup = $userGroups->next()) {
737  $nameKey = $this->getSetting($userGroup->getId(), 'nameLocaleKey');
738  $this->updateSetting($userGroup->getId(),
739  'name',
740  array($locale => __($nameKey, null, $locale)),
741  'string',
742  $locale,
743  true
744  );
745 
746  $abbrevKey = $this->getSetting($userGroup->getId(), 'abbrevLocaleKey');
747  $this->updateSetting($userGroup->getId(),
748  'abbrev',
749  array($locale => __($abbrevKey, null, $locale)),
750  'string',
751  $locale,
752  true
753  );
754  }
755  }
756 
761  function deleteSettingsByLocale($locale) {
762  return $this->update('DELETE FROM user_group_settings WHERE locale = ?', $locale);
763  }
764 
773  function _getSearchSql($searchType, $search, $searchMatch, &$params) {
774  $searchTypeMap = array(
775  USER_FIELD_FIRSTNAME => 'u.first_name',
776  USER_FIELD_LASTNAME => 'u.last_name',
777  USER_FIELD_USERNAME => 'u.username',
778  USER_FIELD_EMAIL => 'u.email',
779  USER_FIELD_AFFILIATION => 'us.setting_value',
780  );
781 
782  $searchSql = '';
783 
784  if (!empty($search)) {
785 
786  if (!isset($searchTypeMap[$searchType])) {
787  $str = $this->concat('u.first_name', 'u.last_name', 'u.email', 'us.setting_value');
788  $concatFields = ' ( LOWER(' . $str . ') LIKE ? OR LOWER(cves.setting_value) LIKE ? ) ';
789 
790  $search = strtolower($search);
791 
792  $words = preg_split('{\s+}', $search);
793  $searchFieldMap = array();
794 
795  foreach ($words as $word) {
796  $searchFieldMap[] = $concatFields;
797  $term = '%' . $word . '%';
798  array_push($params, $term, $term);
799  }
800 
801  $searchSql .= ' AND ( ' . join(' AND ', $searchFieldMap) . ' ) ';
802  } else {
803  $fieldName = $searchTypeMap[$searchType];
804  switch ($searchMatch) {
805  case 'is':
806  $searchSql = "AND LOWER($fieldName) = LOWER(?)";
807  $params[] = $search;
808  break;
809  case 'contains':
810  $searchSql = "AND LOWER($fieldName) LIKE LOWER(?)";
811  $params[] = '%' . $search . '%';
812  break;
813  case 'startsWith':
814  $searchSql = "AND LOWER($fieldName) LIKE LOWER(?)";
815  $params[] = $search . '%';
816  break;
817  }
818  }
819  } else {
820  switch ($searchType) {
821  case USER_FIELD_USERID:
822  $searchSql = 'AND u.user_id = ?';
823  break;
824  case USER_FIELD_INITIAL:
825  $searchSql = 'AND LOWER(u.last_name) LIKE LOWER(?)';
826  break;
827  }
828  }
829 
830  $searchSql .= ' ORDER BY u.last_name, u.first_name'; // FIXME Add "sort field" parameter?
831 
832  return $searchSql;
833  }
834 
835  //
836  // Public helper methods
837  //
838 
850  function getUserGroupsByStage($contextId, $stageId, $omitAuthors = false, $omitReviewers = false, $roleId = null, $dbResultRange = null) {
851  $params = array((int) $contextId, (int) $stageId);
852  if ($omitAuthors) $params[] = ROLE_ID_AUTHOR;
853  if ($omitReviewers) $params[] = ROLE_ID_REVIEWER;
854  if ($roleId) $params[] = $roleId;
855  $result = $this->retrieveRange(
856  'SELECT ug.*
857  FROM user_groups ug
858  JOIN user_group_stage ugs ON (ug.user_group_id = ugs.user_group_id AND ug.context_id = ugs.context_id)
859  WHERE ugs.context_id = ? AND
860  ugs.stage_id = ?' .
861  ($omitAuthors?' AND ug.role_id <> ?':'') .
862  ($omitReviewers?' AND ug.role_id <> ?':'') .
863  ($roleId?' AND ug.role_id = ?':'') .
864  ' ORDER BY role_id ASC',
865  $params,
866  $dbResultRange
867  );
868 
869  return new DAOResultFactory($result, $this, '_returnFromRow');
870  }
871 
878  function getAssignedStagesByUserGroupId($contextId, $userGroupId) {
879  $result = $this->retrieve(
880  'SELECT stage_id
881  FROM user_group_stage
882  WHERE context_id = ? AND
883  user_group_id = ?',
884  array((int) $contextId, (int) $userGroupId)
885  );
886 
887  $returner = array();
888  while (!$result->EOF) {
889  $stageId = $result->Fields('stage_id');
890  $returner[$stageId] = WorkflowStageDAO::getTranslationKeyFromId($stageId);
891  $result->MoveNext();
892  }
893 
894  return $returner;
895  }
896 
903  function userGroupAssignedToStage($userGroupId, $stageId) {
904  $result = $this->retrieve(
905  'SELECT COUNT(*)
906  FROM user_group_stage
907  WHERE user_group_id = ? AND
908  stage_id = ?',
909  array((int) $userGroupId, (int) $stageId)
910  );
911 
912  $returner = isset($result->fields[0]) && $result->fields[0] > 0 ? true : false;
913 
914  $result->Close();
915  return $returner;
916  }
917 
925  function userAssignmentExists($contextId, $userId, $stageId) {
926  $result = $this->retrieve(
927  'SELECT COUNT(*)
928  FROM user_group_stage ugs,
929  user_user_groups uug
930  WHERE ugs.user_group_id = uug.user_group_id AND
931  ugs.context_id = ? AND
932  uug.user_id = ? AND
933  ugs.stage_id = ?',
934  array((int) $contextId, (int) $userId, (int) $stageId)
935  );
936 
937  $returner = isset($result->fields[0]) && $result->fields[0] > 0 ? true : false;
938 
939  $result->Close();
940  return $returner;
941  }
942 }
943 
944 ?>
getUsersById($userGroupId=null, $contextId=null, $searchType=null, $search=null, $searchMatch=null, $dbResultRange=null)
static & getDAO($name, $dbconn=null)
getSetting($userGroupId, $name, $locale=null)
Operations for retrieving and modifying objects from a database.
Definition: DAO.inc.php:30
static getTranslationKeyFromId($stageId)
& retrieve($sql, $params=false, $callHooks=true)
Definition: DAO.inc.php:84
deleteSettingsByLocale($locale)
getByRoleId($contextId, $roleId, $default=false, $dbResultRange=null)
userInGroup($userId, $userGroupId)
isDefault($userGroupId)
assignUserToGroup($userId, $groupId)
deleteByContextId($contextId)
deleteAssignmentsByContextId($contextId, $userId=null)
removeAllStagesFromGroup($contextId, $userGroupId)
getUsersNotInRole($roleId, $contextId=null, $search=null)
getById($userGroupId, $contextId=null)
updateDataObjectSettings($tableName, &$dataObject, $idArray)
Definition: DAO.inc.php:474
getUserGroupsByStage($contextId, $stageId, $omitAuthors=false, $omitReviewers=false, $roleId=null, $dbResultRange=null)
& retrieveRange($sql, $params=false, $dbResultRange=null, $callHooks=true)
Definition: DAO.inc.php:174
getUsersByContextId($contextId, $searchType=null, $search=null, $searchMatch=null, $dbResultRange=null)
getAssignedStagesByUserGroupId($contextId, $userGroupId)
static getLocale()
deleteById($contextId, $userGroupId)
installSettings($contextId, $filename)
_getInsertId($table= '', $id= '')
Definition: DAO.inc.php:249
concat()
Definition: DAO.inc.php:53
static call($hookName, $args=null)
deleteObject($userGroup)
Describes user groups.
Wrapper around ADORecordSet providing &quot;factory&quot; features for generating objects from DAOs...
convertFromDB($value, $type)
Definition: DAO.inc.php:335
assignGroupToStage($contextId, $userGroupId, $stageId)
getByUserId($userId, $contextId=null)
installLocale($locale, $contextId=null)
removeGroupFromStage($contextId, $userGroupId, $stageId)
Generic class for parsing an XML document into a data structure.
getDefaultByRoleId($contextId, $roleId)
deleteAssignmentsByUserGroupId($userGroupId)
removeUserFromGroup($userId, $groupId, $contextId)
userGroupAssignedToStage($userGroupId, $stageId)
convertToDB($value, &$type)
Definition: DAO.inc.php:391
userAssignmentExists($contextId, $userId, $stageId)
getByContextId($contextId=null, $dbResultRange=null)
getDataObjectSettings($tableName, $idFieldName, $idFieldValue, &$dataObject)
Definition: DAO.inc.php:567
getUserGroupIdsByRoleId($roleId, $contextId=null)
Operations for retrieving and modifying User Groups and user group assignments.
replace($table, $arrFields, $keyCols)
Definition: DAO.inc.php:237
getContextUsersCount($contextId, $userGroupId=null, $roleId=null)
insertObject($userGroup)
userInAnyGroup($userId, $contextId=null)
update($sql, $params=false, $callHooks=true, $dieOnError=true)
Definition: DAO.inc.php:208
contextHasGroup($contextId, $userGroupId)
updateLocaleFields($userGroup)
_getSearchSql($searchType, $search, $searchMatch, &$params)
deleteAssignmentsByUserId($userId, $userGroupId=null)
updateSetting($userGroupId, $name, $value, $type=null, $isLocalized=false)
updateObject($userGroup)