/** * @see \C5TL\Parser\DynamicItem::parseManual() */ public function parseManual(\Gettext\Translations $translations, $concrete5version) { if (class_exists('\\GroupSet', true)) { foreach (\GroupSet::getList() as $gs) { $this->addTranslation($translations, $gs->getGroupSetName(), 'GroupSetName'); } } }
public function get() { $r = parent::get(0, 0); $groupsets = array(); foreach ($r as $row) { $groupsets[] = GroupSet::getByID($row['gsID']); } return $groupsets; }
public static function add($gsName, $pkg = false) { $db = Loader::db(); $pkgID = 0; if (is_object($pkg)) { $pkgID = $pkg->getPackageID(); } $db->Execute('insert into GroupSets (gsName, pkgID) values (?,?)', array($gsName, $pkgID)); $id = $db->Insert_ID(); $gs = GroupSet::getByID($id); return $gs; }
public function load() { $db = Loader::db(); $gsID = $db->GetOne('select gsID from PermissionAccessEntityGroupSets where peID = ?', array($this->peID)); if ($gsID) { $gs = GroupSet::getByID($gsID); if (is_object($gs)) { $this->groupset = $gs; $this->label = $gs->getGroupSetName(); } } }
/** * Returns an array of package items (e.g. blocks, themes) */ public function getPackageItems() { $items = array(); Loader::model('single_page'); Loader::library('mail/importer'); Loader::model('job'); Loader::model('collection_types'); Loader::model('system/captcha/library'); Loader::model('system/antispam/library'); $items['attribute_categories'] = AttributeKeyCategory::getListByPackage($this); $items['permission_categories'] = PermissionKeyCategory::getListByPackage($this); $items['permission_access_entity_types'] = PermissionAccessEntityType::getListByPackage($this); $items['attribute_keys'] = AttributeKey::getListByPackage($this); $items['attribute_sets'] = AttributeSet::getListByPackage($this); $items['group_sets'] = GroupSet::getListByPackage($this); $items['page_types'] = CollectionType::getListByPackage($this); $items['mail_importers'] = MailImporter::getListByPackage($this); $items['configuration_values'] = Config::getListByPackage($this); $items['block_types'] = BlockTypeList::getByPackage($this); $items['page_themes'] = PageTheme::getListByPackage($this); $items['permissions'] = PermissionKey::getListByPackage($this); $items['single_pages'] = SinglePage::getListByPackage($this); $items['attribute_types'] = AttributeType::getListByPackage($this); $items['captcha_libraries'] = SystemCaptchaLibrary::getListByPackage($this); $items['antispam_libraries'] = SystemAntispamLibrary::getListByPackage($this); $items['jobs'] = Job::getListByPackage($this); $items['workflow_types'] = WorkflowType::getListByPackage($this); ksort($items); return $items; }
/** * Get all the groups the current user has permissions to see * * @param integer $start (optional - default: 0) * @param integer $max (optional - default: 20) * @param string $orderby (optional, either 'date', 'name' or 'moddate' - default: 'date') * @param string $sort (optional, either 'ASC' or 'DESC' - default: 'DESC') * @param string $style (optional - default 'long') may be 'short' or 'long' - how much of a user's details to load (long includes: tags and groups). * @param string $q the query term(s) * @return GroupSet or Error */ function getGroupsByGlobal($start = 0, $max = 20, $orderby = 'date', $sort = 'DESC', $style = 'long', $q = '') { global $CFG, $HUB_SQL; $params = array(); $params[0] = $CFG->USER_STATUS_ACTIVE; $params[1] = $CFG->USER_STATUS_REPORTED; $params[2] = $CFG->defaultUserID; $sql = $HUB_SQL->APILIB_GROUPS_BY_GLOBAL_PART1; if ($q != "") { $querySQL = getSearchQueryString($params, $q, true, false); $sql .= $HUB_SQL->AND . $querySQL; } $gs = new GroupSet(); return $gs->loadFromUsers($sql, $params, $start, $max, $orderby, $sort, $style); }
/** * Return a ConversationSet for all challenges in the database; */ function getConversationSetData($parts) { $groupSet = new GroupSet(); $allGroups = getGroupsByGlobal(0, -1, 'date', 'ASC'); if (!$allGroups instanceof Error) { $count = count($allGroups->groups); for ($i = 0; $i < $count; $i++) { $group = $allGroups->groups[$i]; if (!$group instanceof Error) { $groupdata = getConversationData($group->groupid); if (count($parts) > 3) { $subtype = check_param($parts[3], PARAM_ALPHA); $group->filter = $subtype; } if ($groupdata instanceof Group) { $groupSet->add($groupdata); } } } } return $groupSet; }
public function edit($gsID = false) { $gs = GroupSet::getByID($gsID); if (is_object($gs)) { $this->set('set', $gs); } else { $this->redirect('/dashboard/users/group_sets'); } }
<?php defined('C5_EXECUTE') or die("Access Denied."); if (Loader::helper('validation/token')->validate('process')) { $js = Loader::helper('json'); $obj = new stdClass(); $gs = GroupSet::getByID($_REQUEST['gsID']); if (is_object($gs)) { $pae = GroupSetPermissionAccessEntity::getOrCreate($gs); $obj->peID = $pae->getAccessEntityID(); $obj->label = $pae->getAccessEntityLabel(); } print $js->encode($obj); }
public function getRequestedSearchResults() { $userList = new UserList(); $userList->sortBy('uDateAdded', 'desc'); $userList->showInactiveUsers = true; $userList->showInvalidatedUsers = true; $columns = UserSearchColumnSet::getCurrent(); $this->set('columns', $columns); if ($_GET['keywords'] != '') { $userList->filterByKeywords($_GET['keywords']); } if ($_REQUEST['numResults'] && Loader::helper('validation/numbers')->integer($_REQUEST['numResults'])) { $userList->setItemsPerPage($_REQUEST['numResults']); } $pk = PermissionKey::getByHandle('access_user_search'); $asl = $pk->getMyAssignment(); $p = new Permissions(); $filterGIDs = array(); if ($asl->getGroupsAllowedPermission() == 'C') { $userList->filter('u.uID', USER_SUPER_ID, '<>'); $userList->addToQuery("left join UserGroups ugRequired on ugRequired.uID = u.uID "); if (in_array(REGISTERED_GROUP_ID, $asl->getGroupsAllowedArray())) { $userList->filter(false, '(ugRequired.gID in (' . implode(',', $asl->getGroupsAllowedArray()) . ') or ugRequired.gID is null)'); } else { $userList->filter('ugRequired.gID', $asl->getGroupsAllowedArray(), 'in'); } } if (isset($_REQUEST['gID']) && is_array($_REQUEST['gID'])) { foreach($_REQUEST['gID'] as $gID) { $g = Group::getByID($gID); if (is_object($g)) { if ($pk->validate($g) && (!in_array($g->getGroupID(), $filterGIDs))) { $filterGIDs[] = $g->getGroupID(); } } } } foreach($filterGIDs as $gID) { $userList->filterByGroupID($gID); } if (is_array($_REQUEST['selectedSearchField'])) { foreach($_REQUEST['selectedSearchField'] as $i => $item) { // due to the way the form is setup, index will always be one more than the arrays if ($item != '') { switch($item) { case 'is_active': if ($_GET['active'] === '0') { $userList->filterByIsActive(0); } else if ($_GET['active'] === '1') { $userList->filterByIsActive(1); } break; case "date_added": $dateFrom = $_REQUEST['date_from']; $dateTo = $_REQUEST['date_to']; if ($dateFrom != '') { $dateFrom = date('Y-m-d', strtotime($dateFrom)); $userList->filterByDateAdded($dateFrom, '>='); $dateFrom .= ' 00:00:00'; } if ($dateTo != '') { $dateTo = date('Y-m-d', strtotime($dateTo)); $dateTo .= ' 23:59:59'; $userList->filterByDateAdded($dateTo, '<='); } break; case "group_set": $gsID = $_REQUEST['gsID']; $gs = GroupSet::getByID($gsID); $groupsetids = array(-1); if (is_object($gs)) { $groups = $gs->getGroups(); } $userList->addToQuery('left join UserGroups ugs on u.uID = ugs.uID'); foreach($groups as $g) { if ($pk->validate($g) && (!in_array($g->getGroupID(), $groupsetids))) { $groupsetids[] = $g->getGroupID(); } } $instr = 'ugs.gID in (' . implode(',', $groupsetids) . ')'; $userList->filter(false, $instr); break; default: $akID = $item; $fak = UserAttributeKey::get($akID); $type = $fak->getAttributeType(); $cnt = $type->getController(); $cnt->setAttributeKey($fak); $cnt->searchForm($userList); break; } } } } return $userList; }