19 declare(strict_types=1);
    74         $this->
user = $DIC->user();
    75         $this->rbacreview = $DIC->rbac()->review();
    79         $this->group_obj = $group;
    80         $this->log = $DIC->logger()->grp();
    86                 $this->group_obj->getId(),
    87                 $this->group_obj->getId(),
    88                 $this->group_obj->getType()
    98         $this->parent[] = $a_id;
   102         array_pop($this->parent);
   107         return $this->parent[count($this->parent) - 1];
   116         $this->sax_controller->setHandlers($a_xml_parser);
   117         $this->sax_controller->setDefaultElementHandler($this);
   120             $this->group_obj->getId()
   123         $this->sax_controller->setElementHandler(
   124             $this->advanced_md_value_parser,
   136         parent::startParsing();
   139             $status = is_object($this->group_obj) ? $this->group_obj->getRefId() : 
false;
   141             $status = is_object($this->group_obj) ? $this->group_obj->update() : 
false;
   143         $this->after_parsing_status = $status;
   147         $identifier_ids = 
$general->getIdentifierIds();
   148         if (!isset($identifier_ids[0])) {
   151         $identifier = 
$general->getIdentifier($identifier_ids[0]);
   152         $identifier->setEntry(
   155         $identifier->update();
   168     public function handlerBeginTag($a_xml_parser, 
string $a_name, array $a_attribs): void
   176         if ($this->lom_parsing_active) {
   177             parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
   183                 $this->lom_parsing_active = 
true;
   184                 parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
   190                 $this->group_data[
"admin"] = array();
   191                 $this->group_data[
"member"] = array();
   193                 $this->group_data[
"type"] = $a_attribs[
"type"];
   194                 $this->group_data[
"id"] = $a_attribs[
"id"];
   202                 $this->group_data[
"owner"] = $a_attribs[
"id"];
   206                 $this->group_data[
'registration_type'] = $a_attribs[
'type'];
   207                 $this->group_data[
'waiting_list_enabled'] = $a_attribs[
'waitingList'] == 
'Yes' ? true : 
false;
   211                 $this->in_period = 
true;
   212                 $this->group_data[
'period_with_time'] = $a_attribs[
'withTime'];
   216                 $this->group_data[
'max_members_enabled'] = $a_attribs[
'enabled'] == 
'Yes' ? true : 
false;
   220                 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] == 
"Attach") {
   221                     $this->group_data[
"admin"][
"attach"][] = $a_attribs[
"id"];
   222                 } elseif (isset($a_attribs[
'action']) || $a_attribs[
'action'] == 
"Detach") {
   223                     $this->group_data[
"admin"][
"detach"][] = $a_attribs[
"id"];
   226                 if (isset($a_attribs[
'notification']) and $a_attribs[
'notification'] == 
'Yes') {
   227                     $this->group_data[
'notifications'][] = $a_attribs[
'id'];
   233                 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] == 
"Attach") {
   234                     $GLOBALS[
'DIC']->logger()->grp()->debug(
'New member with id ' . $a_attribs[
'id']);
   235                     $this->group_data[
"member"][
"attach"][] = $a_attribs[
"id"];
   236                 } elseif (isset($a_attribs[
'action']) || $a_attribs[
'action'] == 
"Detach") {
   237                     $GLOBALS[
'DIC']->logger()->grp()->debug(
'Deprecated member with id ' . $a_attribs[
'id']);
   238                     $this->group_data[
"member"][
"detach"][] = $a_attribs[
"id"];
   243             case 'ContainerSetting':
   244                 $this->current_container_setting = $a_attribs[
'id'];
   249                 if ($this->group_imported) {
   252                     $this->sort = $a_attribs;
   258                 if (isset($a_attribs[
'active'])) {
   259                     $this->group_data[
'session_limit'] = (bool) $a_attribs[
'active'];
   261                 if (isset($a_attribs[
'previous'])) {
   262                     $this->group_data[
'session_previous'] = (
int) $a_attribs[
'previous'];
   264                 if (isset($a_attribs[
'next'])) {
   265                     $this->group_data[
'session_next'] = (
int) $a_attribs[
'next'];
   270                 $this->group_data[
'map_enabled'] = (bool) $a_attribs[
'enabled'] ?? 
false;
   271                 $this->group_data[
'map_latitude'] = (string) $a_attribs[
'latitude'] ?? 
'';
   272                 $this->group_data[
'map_longitude'] = (string) $a_attribs[
'longitude'] ?? 
'';
   273                 $this->group_data[
'map_location_zoom'] = (
int) $a_attribs[
'location_zoom'] ?? 0;
   276             case 'RegistrationAccessCode':
   277                 $this->group_data[
'registration_code_enabled'] = (bool) $a_attribs[
'enabled'] ?? 
false;
   278                 $this->group_data[
'registration_code'] = (string) $a_attribs[
'code'] ?? 
'';
   281             case 'WaitingListAutoFill':
   282             case 'CancellationEnd':
   284             case 'mailMembersType':
   291         $this->cdata = $this->
trimAndStrip((
string) $this->cdata);
   293         if ($this->lom_parsing_active) {
   294             parent::handlerEndTag($a_xml_parser, $a_name);
   299                 $this->lom_parsing_active = 
false;
   300                 parent::handlerEndTag($a_xml_parser, $a_name);
   305                 $this->group_data[
"title"] = trim($this->cdata);
   309                 $this->group_data[
"description"] = trim($this->cdata);
   313                 $this->group_data[
'information'] = trim($this->cdata);
   317                 $this->group_data[
'password'] = trim($this->cdata);
   321                 $this->group_data[
'max_members'] = trim($this->cdata);
   325                 $this->group_data[
'expiration_end'] = trim($this->cdata);
   329                 if ($this->in_period) {
   330                     $this->group_data[
'period_start'] = trim($this->cdata);
   332                     $this->group_data[
'expiration_start'] = trim($this->cdata);
   337                 if ($this->in_period) {
   338                     $this->group_data[
'period_end'] = trim($this->cdata);
   340                     $this->group_data[
'expiration_end'] = trim($this->cdata);
   345                 $this->in_period = 
false;
   352             case 'ContainerSetting':
   353                 if ($this->current_container_setting) {
   355                         $this->group_obj->getId(),
   362             case 'WaitingListAutoFill':
   363                 $this->group_data[
'auto_wait'] = trim($this->cdata);
   366             case 'CancellationEnd':
   367                 if ((
int) $this->cdata) {
   373                 if ((
int) $this->cdata) {
   374                     $this->group_data[
'min_members'] = (
int) $this->cdata;
   380                     $this->group_data[
'show_members'] = (
int) $this->cdata;
   384             case 'admissionNotification':
   386                     $this->group_data[
'auto_notification'] = (bool) $this->cdata;
   390             case 'mailMembersType':
   391                 $this->group_data[
'mail_members_type'] = (
int) $this->cdata;
   395                 $this->group_data[
'view_mode'] = (
int) $this->cdata;
   407         if ($this->lom_parsing_active) {
   408             parent::handlerCharacterData($a_xml_parser, $a_data);
   411         $a_data = str_replace(
"<", 
"<", $a_data);
   412         $a_data = str_replace(
">", 
">", $a_data);
   414         if (!empty($a_data)) {
   415             $this->cdata .= $a_data;
   421         if ($this->group_imported) {
   425         $this->group_obj->setImportId($this->group_data[
"id"] ?? 
'');
   426         $this->group_obj->setTitle($this->group_data[
"title"] ?? 
'');
   427         $this->group_obj->setDescription($this->group_data[
"description"] ?? 
'');
   428         $this->group_obj->setInformation((
string) $this->group_data[
'information']);
   430         if (isset($this->group_data[
'period_start']) && isset($this->group_data[
'period_end'])) {
   432                 if ($this->group_data[
'period_with_time'] ?? 
false) {
   433                     $this->group_obj->setPeriod(
   438                     $this->group_obj->setPeriod(
   444                 $this->log->warning(
'Ignoring invalid group period settings: ');
   445                 $this->log->warning(
'Period start: ' . $this->group_data[
'period_start']);
   446                 $this->log->warning(
'Period end: ' . $this->group_data[
'period_end']);
   450         $ownerChanged = 
false;
   451         if (isset($this->group_data[
"owner"])) {
   452             $owner = $this->group_data[
"owner"];
   453             if (!is_numeric($owner)) {
   456             if (is_numeric($owner) && $owner > 0) {
   457                 $this->group_obj->setOwner((
int) $owner);
   458                 $ownerChanged = 
true;
   466             $this->group_obj->createReference();
   468             $this->group_obj->setPermissions($this->
getParentId());
   470                 array_key_exists(
'type', $this->group_data) &&
   471                 $this->group_data[
'type'] == 
'closed'   473                 $this->group_obj->updateGroupType(
   479                 array_key_exists(
'type', $this->group_data) &&
   480                 $this->group_data[
'type'] == 
'closed'   482                 $this->group_obj->updateGroupType(
   486                 array_key_exists(
'type', $this->group_data) &&
   487                 $this->group_data[
'type'] == 
'open'   489                 $this->group_obj->updateGroupType(
   495         switch ($this->group_data[
'registration_type'] ?? 
'') {
   516         $this->group_obj->setRegistrationType($flag);
   519         $registration_end = null;
   520         if ($this->group_data[
'expiration_end'] ?? 
false) {
   524         $registration_start = null;
   525         if ($this->group_data[
'expiration_start'] ?? 
false) {
   532             $this->group_obj->enableUnlimitedRegistration(
false);
   533             $this->group_obj->setRegistrationStart($registration_start);
   534             $this->group_obj->setRegistrationEnd($registration_end);
   536             $this->group_obj->enableUnlimitedRegistration(
true);
   538         $this->group_obj->setPassword($this->group_data[
'password'] ?? 
'');
   539         $this->group_obj->enableMembershipLimitation((
bool) ($this->group_data[
'max_members_enabled'] ?? 
false));
   540         $this->group_obj->setMaxMembers((
int) ($this->group_data[
'max_members'] ?? 0));
   541         $this->group_obj->enableWaitingList((
bool) ($this->group_data[
'waiting_list_enabled'] ?? 
false));
   542         $this->group_obj->setWaitingListAutoFill((
bool) ($this->group_data[
'auto_wait'] ?? 
false));
   543         $this->group_obj->setCancellationEnd($this->group_data[
'cancel_end'] ?? null);
   544         $this->group_obj->setMinMembers((
int) ($this->group_data[
'min_members'] ?? 0));
   545         $this->group_obj->setShowMembers((
bool) ($this->group_data[
'show_members'] ?? 
false));
   546         $this->group_obj->setAutoNotification((
bool) (($this->group_data[
'auto_notification'] ?? 
false)));
   547         $this->group_obj->setMailToMembersType((
int) ($this->group_data[
'mail_members_type'] ?? 0));
   548         $this->group_obj->enableRegistrationAccessCode((
bool) ($this->group_data[
'registration_code_enabled'] ?? 
false));
   549         $this->group_obj->setRegistrationAccessCode((
string) ($this->group_data[
'registration_code'] ?? 
''));
   550         if (isset($this->group_data[
'view_mode'])) {
   551             $this->group_obj->setViewMode((
int) $this->group_data[
'view_mode']);
   553         if (isset($this->group_data[
'session_limit'])) {
   554             $this->group_obj->enableSessionLimit((
bool) $this->group_data[
'session_limit']);
   556         if (isset($this->group_data[
'session_previous'])) {
   557             $this->group_obj->setNumberOfPreviousSessions((
int) $this->group_data[
'session_previous']);
   559         if (isset($this->group_data[
'session_next'])) {
   560             $this->group_obj->setNumberOfNextSessions((
int) $this->group_data[
'session_next']);
   563         $this->group_obj->setEnableGroupMap((
bool) ($this->group_data[
'map_enabled'] ?? 
false));
   564         $this->group_obj->setLatitude((
string) ($this->group_data[
'map_latitude'] ?? 
''));
   565         $this->group_obj->setLongitude((
string) ($this->group_data[
'map_longitude'] ?? 
''));
   566         $this->group_obj->setLocationZoom((
int) ($this->group_data[
'map_location_zoom'] ?? 0));
   572         $this->group_obj->readContainerSettings();
   573         $this->group_obj->update();
   584         $this->group_imported = 
true;
   593         $this->participants->updateNotification($this->
user->getId(), (bool) $this->
settings->get(
'mail_grp_admin_notification', 
"1"));
   596         if (isset($this->group_data[
"admin"][
"attach"]) && count($this->group_data[
"admin"][
"attach"])) {
   597             foreach ($this->group_data[
"admin"][
"attach"] as $user) {
   598                 if ($id_data = $this->
parseId($user)) {
   599                     if ($id_data[
'local'] or $id_data[
'imported']) {
   601                         if (isset($this->group_data[
'notifications']) && in_array($user, (array) $this->group_data[
'notifications'])) {
   602                             $this->participants->updateNotification($id_data[
'usr_id'], 
true);
   609         if (isset($this->group_data[
"admin"][
"detach"]) && count($this->group_data[
"admin"][
"detach"])) {
   610             foreach ($this->group_data[
"admin"][
"detach"] as $user) {
   611                 if ($id_data = $this->
parseId($user)) {
   612                     if ($id_data[
'local'] or $id_data[
'imported']) {
   613                         if ($this->participants->isAssigned($id_data[
'usr_id'])) {
   614                             $this->participants->delete($id_data[
'usr_id']);
   621         if (isset($this->group_data[
"member"][
"attach"]) && count($this->group_data[
"member"][
"attach"])) {
   622             foreach ($this->group_data[
"member"][
"attach"] as $user) {
   623                 if ($id_data = $this->
parseId($user)) {
   624                     if ($id_data[
'local'] or $id_data[
'imported']) {
   631         if (isset($this->group_data[
"member"][
"detach"]) && count($this->group_data[
"member"][
"detach"])) {
   632             foreach ($this->group_data[
"member"][
"detach"] as $user) {
   633                 if ($id_data = $this->
parseId($user)) {
   634                     if ($id_data[
'local'] or $id_data[
'imported']) {
   635                         if ($this->participants->isAssigned($id_data[
'usr_id'])) {
   636                             $this->participants->delete($id_data[
'usr_id']);
   646         $fields = explode(
'_', $a_id);
   647         $usr_id = (
int) $fields[3];
   649         if (!is_array($fields) or
   650            $fields[0] != 
'il' or
   651            !is_numeric($fields[1]) or
   652            $fields[2] != 
'usr' or
   653            !is_numeric($usr_id)) {
   657             return array(
'imported' => 
true,
   662             if (strlen($user[
'login'])) {
   663                 return array(
'imported' => 
false,
   665                              'usr_id' => $usr_id);
   668         $this->log->warning(
'Parsing id failed: ' . $a_id);
 
const GRP_REGISTRATION_DEACTIVATED
 
trimAndStrip(string $input)
 
handlerCharacterData($a_xml_parser, string $a_data)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
trimAndStripAttribs(array $attribs)
 
static _lookupName(int $a_user_id)
lookup user name 
 
static _importContainerSortingSettings(array $attibs, int $obj_id)
sorting import for all container objects 
 
const GRP_REGISTRATION_REQUEST
 
const GRP_REGISTRATION_PASSWORD
 
handlerEndTag($a_xml_parser, string $a_name)
End element handler. 
 
ilGroupParticipants $participants
 
const GRP_REGISTRATION_DIRECT
 
ilAdvancedMDValueParser $advanced_md_value_parser
 
static _writeContainerSetting(int $a_id, string $a_keyword, string $a_value)
 
add(int $a_usr_id, int $a_role)
 
__construct(ilObjGroup $group, string $a_xml, int $a_parent_id)
 
handlerBeginTag($a_xml_parser, string $a_name, array $a_attribs)
 
string $current_container_setting
 
Interface definition for sax subset parsers. 
 
Controller class for sax element handlers. 
 
static _getImportedUserId(string $i2_id)
 
ilSaxController $sax_controller
 
static __extractId(string $ilias_id, int $inst_id)
extract ref id from role title, e.g. 
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
setHandlers($a_xml_parser)
 
initContainerSorting(array $a_attribs, int $a_group_id)
 
setXMLContent(string $a_xml_content)