24require_once(
"./Services/Xml/classes/class.ilSaxParser.php");
 
   25require_once(
'./Services/User/classes/class.ilObjUser.php');
 
   26include_once(
'./Services/Calendar/classes/class.ilDateTime.php');
 
   27include_once(
'./Modules/Group/classes/class.ilGroupParticipants.php');
 
   99        define(
'EXPORT_VERSION', 2);
 
  106        $this->group_obj = $group;
 
  107        $this->log = 
$GLOBALS[
'DIC']->logger()->grp();
 
  114                $this->group_obj->getId(),
 
  115                $this->group_obj->getId(),
 
  116                $this->group_obj->getType()
 
  126        $this->parent[] = $a_id;
 
  130        array_pop($this->parent);
 
  136        return $this->parent[count($this->parent) - 1];
 
  148        $this->sax_controller->setHandlers($a_xml_parser);
 
  149        $this->sax_controller->setDefaultElementHandler($this);
 
  152            $this->group_obj->getId()
 
  155        $this->sax_controller->setElementHandler(
 
  156            $this->advanced_md_value_parser,
 
  167        parent::startParsing();
 
  170            return is_object($this->group_obj) ? $this->group_obj->getRefId() : 
false;
 
  172            return is_object($this->group_obj) ? $this->group_obj->update() : 
false;
 
  188        if ($this->lom_parsing_active) {
 
  189            parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
 
  195                $this->lom_parsing_active = 
true;
 
  196                parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
 
  202                $this->group_data[
"admin"] = array();
 
  203                $this->group_data[
"member"] = array();
 
  205                $this->group_data[
"type"] = $a_attribs[
"type"];
 
  206                $this->group_data[
"id"] = $a_attribs[
"id"];
 
  214                $this->group_data[
"owner"] = $a_attribs[
"id"];
 
  218                $this->group_data[
'registration_type'] = $a_attribs[
'type'];
 
  219                $this->group_data[
'waiting_list_enabled'] = $a_attribs[
'waitingList'] == 
'Yes' ? 
true : 
false;
 
  223                $this->in_period = 
true;
 
  224                $this->group_data[
'period_with_time'] = $a_attribs[
'withTime'];
 
  228                $this->group_data[
'max_members_enabled'] = $a_attribs[
'enabled'] == 
'Yes' ? 
true : 
false;
 
  232                if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] == 
"Attach") {
 
  233                    $this->group_data[
"admin"][
"attach"][] = $a_attribs[
"id"];
 
  234                } elseif (isset($a_attribs[
'action']) || $a_attribs[
'action'] == 
"Detach") {
 
  235                    $this->group_data[
"admin"][
"detach"][] = $a_attribs[
"id"];
 
  238                if (isset($a_attribs[
'notification']) and $a_attribs[
'notification'] == 
'Yes') {
 
  239                    $this->group_data[
'notifications'][] = $a_attribs[
'id'];
 
  245                if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] == 
"Attach") {
 
  246                    $GLOBALS[
'DIC']->logger()->grp()->debug(
'New member with id ' . $a_attribs[
'id']);
 
  247                    $this->group_data[
"member"][
"attach"][] = $a_attribs[
"id"];
 
  248                } elseif (isset($a_attribs[
'action']) || $a_attribs[
'action'] == 
"Detach") {
 
  249                    $GLOBALS[
'DIC']->logger()->grp()->debug(
'Deprecated member with id ' . $a_attribs[
'id']);
 
  250                    $this->group_data[
"member"][
"detach"][] = $a_attribs[
"id"];
 
  255            case 'ContainerSetting':
 
  256                $this->current_container_setting = $a_attribs[
'id'];
 
  261                if ($this->group_imported) {
 
  264                    $this->sort = $a_attribs;
 
  270                if (isset($a_attribs[
'active'])) {
 
  271                    $this->group_data[
'session_limit'] = (bool) $a_attribs[
'active'];
 
  273                if (isset($a_attribs[
'previous'])) {
 
  274                    $this->group_data[
'session_previous'] = (int) $a_attribs[
'previous'];
 
  276                if (isset($a_attribs[
'next'])) {
 
  277                    $this->group_data[
'session_next'] = (int) $a_attribs[
'next'];
 
  282                $this->group_data[
'map_enabled'] = (bool) $a_attribs[
'enabled'] ?? 
false;
 
  283                $this->group_data[
'map_latitude'] = (string) $a_attribs[
'latitude'] ?? 
'';
 
  284                $this->group_data[
'map_longitude'] = (string) $a_attribs[
'longitude'] ?? 
'';
 
  285                $this->group_data[
'map_location_zoom'] = (int) $a_attribs[
'location_zoom'] ?? 0;
 
  288            case 'RegistrationAccessCode':
 
  289                $this->group_data[
'registration_code_enabled'] = (bool) $a_attribs[
'enabled'] ?? 
false;
 
  290                $this->group_data[
'registration_code'] = (string) $a_attribs[
'code'] ?? 
'';
 
  293            case 'WaitingListAutoFill':
 
  294            case 'CancellationEnd':
 
  296            case 'mailMembersType':
 
  304        $this->cdata = $this->
trimAndStrip((
string) $this->cdata);
 
  306        if ($this->lom_parsing_active) {
 
  307            parent::handlerEndTag($a_xml_parser, $a_name);
 
  312                $this->lom_parsing_active = 
false;
 
  313                parent::handlerEndTag($a_xml_parser, $a_name);
 
  318                $this->group_data[
"title"] = trim($this->cdata);
 
  322                $this->group_data[
"description"] = trim($this->cdata);
 
  326                $this->group_data[
'information'] = trim($this->cdata);
 
  330                $this->group_data[
'password'] = trim($this->cdata);
 
  334                $this->group_data[
'max_members'] = trim($this->cdata);
 
  338                $this->group_data[
'expiration_end'] = trim($this->cdata);
 
  342                if ($this->in_period) {
 
  343                    $this->group_data[
'period_start'] = trim($this->cdata);
 
  345                    $this->group_data[
'expiration_start'] = trim($this->cdata);
 
  350                if ($this->in_period) {
 
  351                    $this->group_data[
'period_end'] = trim($this->cdata);
 
  353                    $this->group_data[
'expiration_end'] = trim($this->cdata);
 
  358                $this->in_period = 
false;
 
  366            case 'ContainerSetting':
 
  367                if ($this->current_container_setting) {
 
  369                        $this->group_obj->getId(),
 
  370                        $this->current_container_setting,
 
  376            case 'WaitingListAutoFill':
 
  377                $this->group_data[
'auto_wait'] = trim($this->cdata);
 
  380            case 'CancellationEnd':
 
  381                if ((
int) $this->cdata) {
 
  387                if ((
int) $this->cdata) {
 
  388                    $this->group_data[
'min_members'] = (int) $this->cdata;
 
  393                if ((
int) $this->cdata) {
 
  394                    $this->group_data[
'show_members'] = (int) $this->cdata;
 
  398            case 'admissionNotification':
 
  399                if ((
int) $this->cdata) {
 
  400                    $this->group_data[
'auto_notification'] = (bool) $this->cdata;
 
  404            case 'mailMembersType':
 
  405                $this->group_data[
'mail_members_type'] = (int) $this->cdata;
 
  409                $this->group_data[
'view_mode'] = (int) $this->cdata;
 
  422        if ($this->lom_parsing_active) {
 
  423            parent::handlerCharacterData($a_xml_parser, $a_data);
 
  426        $a_data = str_replace(
"<", 
"<", $a_data);
 
  427        $a_data = str_replace(
">", 
">", $a_data);
 
  429        if (!empty($a_data)) {
 
  430            $this->cdata .= $a_data;
 
  437        if ($this->group_imported) {
 
  441        $this->group_obj->setImportId($this->group_data[
"id"]);
 
  442        $this->group_obj->setTitle($this->group_data[
"title"]);
 
  443        $this->group_obj->setDescription($this->group_data[
"description"]);
 
  444        $this->group_obj->setInformation((
string) $this->group_data[
'information']);
 
  447            $this->group_data[
'period_start'] &&
 
  448            $this->group_data[
'period_end']) {
 
  450                if ($this->group_data[
'period_with_time']) {
 
  451                    $this->group_obj->setPeriod(
 
  456                    $this->group_obj->setPeriod(
 
  461            } 
catch (Exception 
$e) {
 
  462                $this->log->warning(
'Ignoring invalid group period settings: ');
 
  463                $this->log->warning(
'Period start: ' . $this->group_data[
'period_start']);
 
  464                $this->log->warning(
'Period end: ' . $this->group_data[
'period_end']);
 
  468        $ownerChanged = 
false;
 
  469        if (isset($this->group_data[
"owner"])) {
 
  470            $owner = $this->group_data[
"owner"];
 
  471            if (!is_numeric($owner)) {
 
  474            if (is_numeric($owner) && $owner > 0) {
 
  475                $this->group_obj->setOwner($owner);
 
  476                $ownerChanged = 
true;
 
  484            $this->group_obj->createReference();
 
  488                array_key_exists(
'type', $this->group_data) &&
 
  489                $this->group_data[
'type'] == 
'closed' 
  495                array_key_exists(
'type', $this->group_data) &&
 
  496                $this->group_data[
'type'] == 
'closed' 
  500                array_key_exists(
'type', $this->group_data) &&
 
  501                $this->group_data[
'type'] == 
'open' 
  507        switch ($this->group_data[
'registration_type']) {
 
  528        $this->group_obj->setRegistrationType($flag);
 
  531        $registration_end = 
null;
 
  532        if ($this->group_data[
'expiration_end']) {
 
  536        $registration_start = 
null;
 
  537        if ($this->group_data[
'expiration_start']) {
 
  544            $this->group_obj->enableUnlimitedRegistration(
false);
 
  545            $this->group_obj->setRegistrationStart($registration_start);
 
  546            $this->group_obj->setRegistrationEnd($registration_end);
 
  548            $this->group_obj->enableUnlimitedRegistration(
true);
 
  550        $this->group_obj->setPassword($this->group_data[
'password']);
 
  551        $this->group_obj->enableMembershipLimitation($this->group_data[
'max_members_enabled']);
 
  552        $this->group_obj->setMaxMembers($this->group_data[
'max_members'] ? $this->group_data[
'max_members'] : 0);
 
  553        $this->group_obj->enableWaitingList($this->group_data[
'waiting_list_enabled']);
 
  555        $this->group_obj->setWaitingListAutoFill($this->group_data[
'auto_wait']);
 
  556        $this->group_obj->setCancellationEnd($this->group_data[
'cancel_end']);
 
  557        $this->group_obj->setMinMembers($this->group_data[
'min_members']);
 
  558        $this->group_obj->setShowMembers($this->group_data[
'show_members'] ? $this->group_data[
'show_members'] : 0);
 
  559        $this->group_obj->setAutoNotification($this->group_data[
'auto_notification'] ? 
true : 
false);
 
  560        $this->group_obj->setMailToMembersType((
int) $this->group_data[
'mail_members_type']);
 
  562        $this->group_obj->enableRegistrationAccessCode((
bool) $this->group_data[
'registration_code_enabled'] ?? 
false);
 
  563        $this->group_obj->setRegistrationAccessCode((
string) $this->group_data[
'registration_code'] ?? 
'');
 
  565        if (isset($this->group_data[
'view_mode'])) {
 
  566            $this->group_obj->setViewMode((
int) $this->group_data[
'view_mode']);
 
  568        if (isset($this->group_data[
'session_limit'])) {
 
  569            $this->group_obj->enableSessionLimit((
bool) $this->group_data[
'session_limit']);
 
  571        if (isset($this->group_data[
'session_previous'])) {
 
  572            $this->group_obj->setNumberOfPreviousSessions((
int) $this->group_data[
'session_previous']);
 
  574        if (isset($this->group_data[
'session_next'])) {
 
  575            $this->group_obj->setNumberOfNextSessions((
int) $this->group_data[
'session_next']);
 
  578        $this->group_obj->setEnableGroupMap((
bool) $this->group_data[
'map_enabled'] ?? 
false);
 
  579        $this->group_obj->setLatitude((
string) $this->group_data[
'map_latitude'] ?? 
'');
 
  580        $this->group_obj->setLongitude((
string) $this->group_data[
'map_longitude'] ?? 
'');
 
  581        $this->group_obj->setLocationZoom((
int) $this->group_data[
'map_location_zoom'] ?? 0);
 
  587        $this->group_obj->readContainerSettings();
 
  588        $this->group_obj->update();
 
  599        $this->group_imported = 
true;
 
  614        $this->participants->updateNotification(
$ilUser->getId(), 
$ilSetting->get(
'mail_grp_admin_notification', 
true));
 
  617        if (isset($this->group_data[
"admin"][
"attach"]) && count($this->group_data[
"admin"][
"attach"])) {
 
  618            foreach ($this->group_data[
"admin"][
"attach"] as $user) {
 
  619                if ($id_data = $this->
__parseId($user)) {
 
  620                    if ($id_data[
'local'] or $id_data[
'imported']) {
 
  621                        $this->participants->add($id_data[
'usr_id'], 
IL_GRP_ADMIN);
 
  622                        if (in_array($user, (array) $this->group_data[
'notifications'])) {
 
  623                            $this->participants->updateNotification($id_data[
'usr_id'], 
true);
 
  630        if (isset($this->group_data[
"admin"][
"detach"]) && count($this->group_data[
"admin"][
"detach"])) {
 
  631            foreach ($this->group_data[
"admin"][
"detach"] as $user) {
 
  632                if ($id_data = $this->
__parseId($user)) {
 
  633                    if ($id_data[
'local'] or $id_data[
'imported']) {
 
  634                        if ($this->participants->isAssigned($id_data[
'usr_id'])) {
 
  635                            $this->participants->delete($id_data[
'usr_id']);
 
  642        if (isset($this->group_data[
"member"][
"attach"]) && count($this->group_data[
"member"][
"attach"])) {
 
  643            foreach ($this->group_data[
"member"][
"attach"] as $user) {
 
  644                if ($id_data = $this->
__parseId($user)) {
 
  645                    if ($id_data[
'local'] or $id_data[
'imported']) {
 
  652        if (isset($this->group_data[
"member"][
"detach"]) && count($this->group_data[
"member"][
"detach"])) {
 
  653            foreach ($this->group_data[
"member"][
"detach"] as $user) {
 
  654                if ($id_data = $this->
__parseId($user)) {
 
  655                    if ($id_data[
'local'] or $id_data[
'imported']) {
 
  656                        if ($this->participants->isAssigned($id_data[
'usr_id'])) {
 
  657                            $this->participants->delete($id_data[
'usr_id']);
 
  672        $fields = explode(
'_', $a_id);
 
  674        if (!is_array($fields) or
 
  675           $fields[0] != 
'il' or
 
  676           !is_numeric($fields[1]) or
 
  677           $fields[2] != 
'usr' or
 
  678           !is_numeric($fields[3])) {
 
  682            return array(
'imported' => 
true,
 
  687            if (strlen($user[
'login'])) {
 
  688                return array(
'imported' => 
false,
 
  690                             'usr_id' => $fields[3]);
 
  693        $GLOBALS[
'DIC']->logger()->grp()->warning(
'Parsing id failed: ' . $a_id);
 
  705        include_once 
'./Services/Container/classes/class.ilContainerSortingSettings.php';
 
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
An exception for terminatinating execution or to throw for unit testing.
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.
const GRP_REGISTRATION_DIRECT
const GRP_REGISTRATION_PASSWORD
const GRP_REGISTRATION_DEACTIVATED
const GRP_REGISTRATION_REQUEST
static _importContainerSortingSettings($attibs, $obj_id)
sorting import for all container objects
static _writeContainerSetting($a_id, $a_keyword, $a_value)
@classDescription Date and time handling
$current_container_setting
setHandlers($a_xml_parser)
set event handlers
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
handlerCharacterData($a_xml_parser, $a_data)
handler for character data
$advanced_md_value_parser
__initContainerSorting($a_attribs, $a_group_id)
startParsing()
start the parser
handlerEndTag($a_xml_parser, $a_name)
handler for end of element
__construct(ilObjGroup $group, $a_xml, $a_parent_id)
Constructor.
trimAndStrip(string $input)
trimAndStripAttribs(array $attribs)
static _getImportedUserId($i2_id)
static _lookupName($a_user_id)
lookup user name
Controller class for sax element handlers.
setXMLContent($a_xml_content)
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.
Interface definition for sax subset parsers.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc