Open Journal Systems  3.0.0
 All Data Structures 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 *
453  FROM users u
454  WHERE u.user_id NOT IN (
455  SELECT DISTINCT u.user_id
456  FROM users u, user_user_groups uug, user_groups ug
457  WHERE u.user_id = uug.user_id
458  AND ug.user_group_id = uug.user_group_id
459  AND ug.role_id = ?' .
460  ($contextId ? ' AND ug.context_id = ?' : '') .
461  ')' .
462  (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 ?)' : ''),
463  $params
464  );
465 
466  return new DAOResultFactory($result, $this->userDao, '_returnUserFromRowWithData');
467  }
468 
479  function getUsersById($userGroupId = null, $contextId = null, $searchType = null, $search = null, $searchMatch = null, $dbResultRange = null) {
480  $params = array();
481 
482  if ($contextId) $params[] = (int) $contextId;
483  if ($userGroupId) $params[] = (int) $userGroupId;
484 
485  $result = $this->retrieveRange(
486  'SELECT DISTINCT u.*
487  FROM users AS u
488  LEFT JOIN user_settings us ON (us.user_id = u.user_id AND us.setting_name = \'affiliation\')
489  LEFT JOIN user_interests ui ON (u.user_id = ui.user_id)
490  LEFT JOIN controlled_vocab_entry_settings cves ON (ui.controlled_vocab_entry_id = cves.controlled_vocab_entry_id)
491  LEFT JOIN user_user_groups uug ON (uug.user_id = u.user_id)
492  LEFT JOIN user_groups ug ON (ug.user_group_id = uug.user_group_id)
493  WHERE 1=1' .
494  ($contextId?' AND ug.context_id = ?':'') .
495  ($userGroupId?' AND ug.user_group_id = ?':'') .
496  $this->_getSearchSql($searchType, $search, $searchMatch, $params),
497  $params,
498  $dbResultRange
499  );
500 
501  return new DAOResultFactory($result, $this->userDao, '_returnUserFromRowWithData');
502  }
503 
504  //
505  // UserGroupAssignment related
506  //
511  function deleteAssignmentsByUserId($userId, $userGroupId = null) {
512  $this->userGroupAssignmentDao->deleteByUserId($userId, $userGroupId);
513  }
514 
519  function deleteAssignmentsByUserGroupId($userGroupId) {
520  $this->userGroupAssignmentDao->deleteAssignmentsByUserGroupId($userGroupId);
521  }
522 
528  function deleteAssignmentsByContextId($contextId, $userId = null) {
529  $this->userGroupAssignmentDao->deleteAssignmentsByContextId($contextId, $userId);
530  }
531 
537  function assignUserToGroup($userId, $groupId) {
538  $assignment = $this->userGroupAssignmentDao->newDataObject();
539  $assignment->setUserId($userId);
540  $assignment->setUserGroupId($groupId);
541  $this->userGroupAssignmentDao->insertObject($assignment);
542  }
550  function removeUserFromGroup($userId, $groupId, $contextId) {
551  $assignments = $this->userGroupAssignmentDao->getByUserId($userId, $contextId);
552  while ($assignment = $assignments->next()) {
553  if ($assignment->getUserGroupId() == $groupId) {
554  $this->userGroupAssignmentDao->deleteAssignment($assignment);
555  }
556  }
557  }
558 
564  function removeAllStagesFromGroup($contextId, $userGroupId) {
565  $assignedStages = $this->getAssignedStagesByUserGroupId($contextId, $userGroupId);
566  foreach($assignedStages as $stageId => $stageLocaleKey) {
567  $this->removeGroupFromStage($contextId, $userGroupId, $stageId);
568  }
569  }
577  function assignGroupToStage($contextId, $userGroupId, $stageId) {
578  $this->update(
579  'INSERT INTO user_group_stage (context_id, user_group_id, stage_id) VALUES (?, ?, ?)',
580  array((int) $contextId, (int) $userGroupId, (int) $stageId)
581  );
582  }
590  function removeGroupFromStage($contextId, $userGroupId, $stageId) {
591  $this->update(
592  'DELETE FROM user_group_stage WHERE context_id = ? AND user_group_id = ? AND stage_id = ?',
593  array((int) $contextId, (int) $userGroupId, (int) $stageId)
594  );
595  }
597  //
598  // Extra settings (not handled by rest of Dao)
599  //
608  function updateSetting($userGroupId, $name, $value, $type = null, $isLocalized = false) {
609  $keyFields = array('setting_name', 'locale', 'user_group_id');
610 
611  if (!$isLocalized) {
612  $value = $this->convertToDB($value, $type);
613  $this->replace('user_group_settings',
614  array(
615  'user_group_id' => (int) $userGroupId,
616  'setting_name' => $name,
617  'setting_value' => $value,
618  'setting_type' => $type,
619  'locale' => ''
620  ),
621  $keyFields
622  );
623  } else {
624  if (is_array($value)) foreach ($value as $locale => $localeValue) {
625  $this->update('DELETE FROM user_group_settings WHERE user_group_id = ? AND setting_name = ? AND locale = ?', array((int) $userGroupId, $name, $locale));
626  if (empty($localeValue)) continue;
627  $type = null;
628  $this->update('INSERT INTO user_group_settings
629  (user_group_id, setting_name, setting_value, setting_type, locale)
630  VALUES (?, ?, ?, ?, ?)',
631  array(
632  $userGroupId, $name, $this->convertToDB($localeValue, $type), $type, $locale
633  )
634  );
635  }
636  }
637  }
638 
639 
647  function getSetting($userGroupId, $name, $locale = null) {
648  $params = array((int) $userGroupId, $name);
649  if ($locale) $params[] = $locale;
650  $result = $this->retrieve(
651  'SELECT setting_name, setting_value, setting_type, locale
652  FROM user_group_settings
653  WHERE user_group_id = ? AND
654  setting_name = ?' .
655  ($locale?' AND locale = ?':''),
656  $params
657  );
658 
659  $recordCount = $result->RecordCount();
660  $returner = false;
661  if ($recordCount == 1) {
662  $row = $result->getRowAssoc(false);
663  $returner = $this->convertFromDB($row['setting_value'], $row['setting_type']);
664  } elseif ($recordCount > 1) {
665  $returner = array();
666  while (!$result->EOF) {
667  $returner[$row['locale']] = $this->convertFromDB($row['setting_value'], $row['setting_type']);
668  $result->MoveNext();
669  }
670  $result->Close();
671  }
672  return $returner;
673  }
674 
675  //
676  // Install/Defaults with settings
677  //
678 
685  function installSettings($contextId, $filename) {
686  $xmlParser = new XMLParser();
687  $tree = $xmlParser->parse($filename);
688 
689  if (!$tree) {
690  $xmlParser->destroy();
691  return false;
692  }
693 
694  foreach ($tree->getChildren() as $setting) {
695  $roleId = hexdec($setting->getAttribute('roleId'));
696  $nameKey = $setting->getAttribute('name');
697  $abbrevKey = $setting->getAttribute('abbrev');
698  $permitSelfRegistration = $setting->getAttribute('permitSelfRegistration');
699  $defaultStages = explode(',', $setting->getAttribute('stages'));
700  $userGroup = $this->newDataObject();
701 
702  // create a role associated with this user group
703  $userGroup = $this->newDataObject();
704  $userGroup->setRoleId($roleId);
705  $userGroup->setContextId($contextId);
706  $userGroup->setPermitSelfRegistration($permitSelfRegistration);
707  $userGroup->setDefault(true);
708 
709  // insert the group into the DB
710  $userGroupId = $this->insertObject($userGroup);
711 
712  // Install default groups for each stage
713  if (is_array($defaultStages)) { // test for groups with no stage assignments
714  foreach ($defaultStages as $stageId) {
715  if (!empty($stageId) && $stageId <= WORKFLOW_STAGE_ID_PRODUCTION && $stageId >= WORKFLOW_STAGE_ID_SUBMISSION) {
716  $this->assignGroupToStage($contextId, $userGroupId, $stageId);
717  }
718  }
719  }
720 
721  // add the i18n keys to the settings table so that they
722  // can be used when a new locale is added/reloaded
723  $this->updateSetting($userGroup->getId(), 'nameLocaleKey', $nameKey);
724  $this->updateSetting($userGroup->getId(), 'abbrevLocaleKey', $abbrevKey);
725 
726  // install the settings in the current locale for this context
727  $this->installLocale(AppLocale::getLocale(), $contextId);
728  }
729 
730  return true;
731  }
732 
738  function installLocale($locale, $contextId = null) {
739  $userGroups = $this->getByContextId($contextId);
740  while ($userGroup = $userGroups->next()) {
741  $nameKey = $this->getSetting($userGroup->getId(), 'nameLocaleKey');
742  $this->updateSetting($userGroup->getId(),
743  'name',
744  array($locale => __($nameKey, null, $locale)),
745  'string',
746  $locale,
747  true
748  );
749 
750  $abbrevKey = $this->getSetting($userGroup->getId(), 'abbrevLocaleKey');
751  $this->updateSetting($userGroup->getId(),
752  'abbrev',
753  array($locale => __($abbrevKey, null, $locale)),
754  'string',
755  $locale,
756  true
757  );
758  }
759  }
760 
765  function deleteSettingsByLocale($locale) {
766  return $this->update('DELETE FROM user_group_settings WHERE locale = ?', $locale);
767  }
768 
777  function _getSearchSql($searchType, $search, $searchMatch, &$params) {
778  $searchTypeMap = array(
779  USER_FIELD_FIRSTNAME => 'u.first_name',
780  USER_FIELD_LASTNAME => 'u.last_name',
781  USER_FIELD_USERNAME => 'u.username',
782  USER_FIELD_EMAIL => 'u.email',
783  USER_FIELD_AFFILIATION => 'us.setting_value',
784  );
785 
786  $searchSql = '';
787 
788  if (!empty($search)) {
789 
790  if (!isset($searchTypeMap[$searchType])) {
791  $str = $this->concat('u.first_name', 'u.last_name', 'u.email', 'COALESCE(us.setting_value,\'\')');
792  $concatFields = ' ( LOWER(' . $str . ') LIKE ? OR LOWER(cves.setting_value) LIKE ? ) ';
793 
794  $search = strtolower($search);
795 
796  $words = preg_split('{\s+}', $search);
797  $searchFieldMap = array();
798 
799  foreach ($words as $word) {
800  $searchFieldMap[] = $concatFields;
801  $term = '%' . $word . '%';
802  array_push($params, $term, $term);
803  }
804 
805  $searchSql .= ' AND ( ' . join(' AND ', $searchFieldMap) . ' ) ';
806  } else {
807  $fieldName = $searchTypeMap[$searchType];
808  switch ($searchMatch) {
809  case 'is':
810  $searchSql = "AND LOWER($fieldName) = LOWER(?)";
811  $params[] = $search;
812  break;
813  case 'contains':
814  $searchSql = "AND LOWER($fieldName) LIKE LOWER(?)";
815  $params[] = '%' . $search . '%';
816  break;
817  case 'startsWith':
818  $searchSql = "AND LOWER($fieldName) LIKE LOWER(?)";
819  $params[] = $search . '%';
820  break;
821  }
822  }
823  } else {
824  switch ($searchType) {
825  case USER_FIELD_USERID:
826  $searchSql = 'AND u.user_id = ?';
827  break;
828  case USER_FIELD_INITIAL:
829  $searchSql = 'AND LOWER(u.last_name) LIKE LOWER(?)';
830  break;
831  }
832  }
833 
834  $searchSql .= ' ORDER BY u.last_name, u.first_name'; // FIXME Add "sort field" parameter?
835 
836  return $searchSql;
837  }
838 
839  //
840  // Public helper methods
841  //
842 
854  function getUserGroupsByStage($contextId, $stageId, $omitAuthors = false, $omitReviewers = false, $roleId = null, $dbResultRange = null) {
855  $params = array((int) $contextId, (int) $stageId);
856  if ($omitAuthors) $params[] = ROLE_ID_AUTHOR;
857  if ($omitReviewers) $params[] = ROLE_ID_REVIEWER;
858  if ($roleId) $params[] = $roleId;
859  $result = $this->retrieveRange(
860  'SELECT ug.*
861  FROM user_groups ug
862  JOIN user_group_stage ugs ON (ug.user_group_id = ugs.user_group_id AND ug.context_id = ugs.context_id)
863  WHERE ugs.context_id = ? AND
864  ugs.stage_id = ?' .
865  ($omitAuthors?' AND ug.role_id <> ?':'') .
866  ($omitReviewers?' AND ug.role_id <> ?':'') .
867  ($roleId?' AND ug.role_id = ?':'') .
868  ' ORDER BY role_id ASC',
869  $params,
870  $dbResultRange
871  );
872 
873  return new DAOResultFactory($result, $this, '_returnFromRow');
874  }
875 
882  function getAssignedStagesByUserGroupId($contextId, $userGroupId) {
883  $result = $this->retrieve(
884  'SELECT stage_id
885  FROM user_group_stage
886  WHERE context_id = ? AND
887  user_group_id = ?',
888  array((int) $contextId, (int) $userGroupId)
889  );
890 
891  $returner = array();
892  while (!$result->EOF) {
893  $stageId = $result->Fields('stage_id');
894  $returner[$stageId] = WorkflowStageDAO::getTranslationKeyFromId($stageId);
895  $result->MoveNext();
896  }
897 
898  return $returner;
899  }
900 
907  function userGroupAssignedToStage($userGroupId, $stageId) {
908  $result = $this->retrieve(
909  'SELECT COUNT(*)
910  FROM user_group_stage
911  WHERE user_group_id = ? AND
912  stage_id = ?',
913  array((int) $userGroupId, (int) $stageId)
914  );
915 
916  $returner = isset($result->fields[0]) && $result->fields[0] > 0 ? true : false;
917 
918  $result->Close();
919  return $returner;
920  }
921 
929  function userAssignmentExists($contextId, $userId, $stageId) {
930  $result = $this->retrieve(
931  'SELECT COUNT(*)
932  FROM user_group_stage ugs,
933  user_user_groups uug
934  WHERE ugs.user_group_id = uug.user_group_id AND
935  ugs.context_id = ? AND
936  uug.user_id = ? AND
937  ugs.stage_id = ?',
938  array((int) $contextId, (int) $userId, (int) $stageId)
939  );
940 
941  $returner = isset($result->fields[0]) && $result->fields[0] > 0 ? true : false;
942 
943  $result->Close();
944  return $returner;
945  }
946 }
947 
948 ?>
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)
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)
updateDataObjectSettings($tableName, $dataObject, $idArray)
Definition: DAO.inc.php:474
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)
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)
getDataObjectSettings($tableName, $idFieldName, $idFieldValue, $dataObject)
Definition: DAO.inc.php:568
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)