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');
 
  102        define(
'EXPORT_VERSION', 2);
 
  104        parent::__construct(
null);
 
  109        $this->group_obj = $group;
 
  110        $this->log = 
$GLOBALS[
'DIC']->logger()->grp();
 
  117                $this->group_obj->getId(),
 
  118                $this->group_obj->getId(),
 
  119                $this->group_obj->getType()
 
  129        $this->parent[] = $a_id;
 
  133        array_pop($this->parent);
 
  139        return $this->parent[count($this->parent) - 1];
 
  151        $this->sax_controller->setHandlers($a_xml_parser);
 
  152        $this->sax_controller->setDefaultElementHandler($this);
 
  155            $this->group_obj->getId()
 
  158        $this->sax_controller->setElementHandler(
 
  159            $this->advanced_md_value_parser,
 
  170        parent::startParsing();
 
  173            return is_object($this->group_obj) ? $this->group_obj->getRefId() : 
false;
 
  175            return is_object($this->group_obj) ? $this->group_obj->update() : 
false;
 
  189        if ($this->lom_parsing_active) {
 
  190            parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
 
  196                $this->lom_parsing_active = 
true;
 
  197                parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
 
  203                $this->group_data[
"admin"] = array();
 
  204                $this->group_data[
"member"] = array();
 
  206                $this->group_data[
"type"] = $a_attribs[
"type"];
 
  207                $this->group_data[
"id"] = $a_attribs[
"id"];
 
  215                $this->group_data[
"owner"] = $a_attribs[
"id"];
 
  219                $this->group_data[
'registration_type'] = $a_attribs[
'type'];
 
  220                $this->group_data[
'waiting_list_enabled'] = $a_attribs[
'waitingList'] == 
'Yes' ? true : 
false;
 
  224                $this->in_period = 
true;
 
  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;
 
  269            case 'WaitingListAutoFill':
 
  270            case 'CancellationEnd':
 
  272            case 'mailMembersType':
 
  280        if ($this->lom_parsing_active) {
 
  281            parent::handlerEndTag($a_xml_parser, $a_name);
 
  286                $this->lom_parsing_active = 
false;
 
  287                parent::handlerEndTag($a_xml_parser, $a_name);
 
  292                $this->group_data[
"title"] = trim($this->cdata);
 
  296                $this->group_data[
"description"] = trim($this->cdata);
 
  300                $this->group_data[
'information'] = trim($this->cdata);
 
  304                $this->group_data[
'password'] = trim($this->cdata);
 
  308                $this->group_data[
'max_members'] = trim($this->cdata);
 
  312                $this->group_data[
'expiration_end'] = trim($this->cdata);
 
  316                if ($this->in_period) {
 
  317                    $this->group_data[
'period_start'] = trim($this->cdata);
 
  319                    $this->group_data[
'expiration_start'] = trim($this->cdata);
 
  324                if ($this->in_period) {
 
  325                    $this->group_data[
'period_end'] = trim($this->cdata);
 
  327                    $this->group_data[
'expiration_end'] = trim($this->cdata);
 
  332                $this->in_period = 
false;
 
  340            case 'ContainerSetting':
 
  341                if ($this->current_container_setting) {
 
  343                        $this->group_obj->getId(),
 
  344                        $this->current_container_setting,
 
  350            case 'WaitingListAutoFill':
 
  351                $this->group_data[
'auto_wait'] = trim($this->cdata);
 
  354            case 'CancellationEnd':
 
  355                if ((
int) $this->cdata) {
 
  361                if ((
int) $this->cdata) {
 
  362                    $this->group_data[
'min_members'] = (int) $this->cdata;
 
  367                if ((
int) $this->cdata) {
 
  368                    $this->group_data[
'show_members'] = (int) $this->cdata;
 
  372            case 'mailMembersType':
 
  373                $this->group_data[
'mail_members_type'] = (int) $this->cdata;
 
  386        if ($this->lom_parsing_active) {
 
  387            parent::handlerCharacterData($a_xml_parser, $a_data);
 
  390        $a_data = str_replace(
"<", 
"<", $a_data);
 
  391        $a_data = str_replace(
">", 
">", $a_data);
 
  393        if (!empty($a_data)) {
 
  394            $this->cdata .= $a_data;
 
  401        if ($this->group_imported) {
 
  405        $this->group_obj->setImportId($this->group_data[
"id"]);
 
  406        $this->group_obj->setTitle($this->group_data[
"title"]);
 
  407        $this->group_obj->setDescription($this->group_data[
"description"]);
 
  408        $this->group_obj->setInformation((
string) $this->group_data[
'information']);
 
  411            $this->group_data[
'period_start'] &&
 
  412            $this->group_data[
'period_end']) {
 
  413            $this->group_obj->setStart(
new ilDate($this->group_data[
'period_start'], 
IL_CAL_UNIX));
 
  414            $this->group_obj->setEnd(
new ilDate($this->group_data[
'period_end'], 
IL_CAL_UNIX));
 
  417        $ownerChanged = 
false;
 
  418        if (isset($this->group_data[
"owner"])) {
 
  419            $owner = $this->group_data[
"owner"];
 
  420            if (!is_numeric($owner)) {
 
  423            if (is_numeric($owner) && $owner > 0) {
 
  424                $this->group_obj->setOwner($owner);
 
  425                $ownerChanged = 
true;
 
  433            $this->group_obj->createReference();
 
  437                array_key_exists(
'type', $this->group_data) &&
 
  438                $this->group_data[
'type'] == 
'closed' 
  444                array_key_exists(
'type', $this->group_data) &&
 
  445                $this->group_data[
'type'] == 
'closed' 
  449                array_key_exists(
'type', $this->group_data) &&
 
  450                $this->group_data[
'type'] == 
'open' 
  456        switch ($this->group_data[
'registration_type']) {
 
  477        $this->group_obj->setRegistrationType($flag);
 
  480        if ($this->group_data[
'expiration_end']) {
 
  485        if ($this->group_data[
'expiration_start']) {
 
  489        $this->group_obj->setRegistrationStart(
$start);
 
  490        $this->group_obj->setRegistrationEnd(
$end);
 
  491        $this->group_obj->setPassword($this->group_data[
'password']);
 
  492        $this->group_obj->enableUnlimitedRegistration(!isset($this->group_data[
'expiration_end']));
 
  493        $this->group_obj->enableMembershipLimitation($this->group_data[
'max_members_enabled']);
 
  494        $this->group_obj->setMaxMembers($this->group_data[
'max_members'] ? $this->group_data[
'max_members'] : 0);
 
  495        $this->group_obj->enableWaitingList($this->group_data[
'waiting_list_enabled']);
 
  497        $this->group_obj->setWaitingListAutoFill($this->group_data[
'auto_wait']);
 
  498        $this->group_obj->setCancellationEnd($this->group_data[
'cancel_end']);
 
  499        $this->group_obj->setMinMembers($this->group_data[
'min_members']);
 
  500        $this->group_obj->setShowMembers($this->group_data[
'show_members'] ? $this->group_data[
'show_members'] : 0);
 
  501        $this->group_obj->setMailToMembersType((
int) $this->group_data[
'mail_members_type']);
 
  502        $this->group_obj->update();
 
  513        $this->group_imported = 
true;
 
  528        $this->participants->updateNotification(
$ilUser->getId(), 
$ilSetting->get(
'mail_grp_admin_notification', 
true));
 
  531        if (isset($this->group_data[
"admin"][
"attach"]) && count($this->group_data[
"admin"][
"attach"])) {
 
  532            foreach ($this->group_data[
"admin"][
"attach"] as 
$user) {
 
  533                if ($id_data = $this->
__parseId($user)) {
 
  534                    if ($id_data[
'local'] or $id_data[
'imported']) {
 
  535                        $this->participants->add($id_data[
'usr_id'], 
IL_GRP_ADMIN);
 
  536                        if (in_array(
$user, (array) $this->group_data[
'notifications'])) {
 
  537                            $this->participants->updateNotification($id_data[
'usr_id'], 
true);
 
  544        if (isset($this->group_data[
"admin"][
"detach"]) && count($this->group_data[
"admin"][
"detach"])) {
 
  545            foreach ($this->group_data[
"admin"][
"detach"] as 
$user) {
 
  546                if ($id_data = $this->
__parseId($user)) {
 
  547                    if ($id_data[
'local'] or $id_data[
'imported']) {
 
  548                        if ($this->participants->isAssigned($id_data[
'usr_id'])) {
 
  549                            $this->participants->delete($id_data[
'usr_id']);
 
  556        if (isset($this->group_data[
"member"][
"attach"]) && count($this->group_data[
"member"][
"attach"])) {
 
  557            foreach ($this->group_data[
"member"][
"attach"] as 
$user) {
 
  558                if ($id_data = $this->
__parseId($user)) {
 
  559                    if ($id_data[
'local'] or $id_data[
'imported']) {
 
  566        if (isset($this->group_data[
"member"][
"detach"]) && count($this->group_data[
"member"][
"detach"])) {
 
  567            foreach ($this->group_data[
"member"][
"detach"] as 
$user) {
 
  568                if ($id_data = $this->
__parseId($user)) {
 
  569                    if ($id_data[
'local'] or $id_data[
'imported']) {
 
  570                        if ($this->participants->isAssigned($id_data[
'usr_id'])) {
 
  571                            $this->participants->delete($id_data[
'usr_id']);
 
  586        $fields = explode(
'_', $a_id);
 
  588        if (!is_array($fields) or
 
  589           $fields[0] != 
'il' or
 
  590           !is_numeric($fields[1]) or
 
  591           $fields[2] != 
'usr' or
 
  592           !is_numeric($fields[3])) {
 
  596            return array(
'imported' => 
true,
 
  601            if (strlen(
$user[
'login'])) {
 
  602                return array(
'imported' => 
false,
 
  604                             'usr_id' => $fields[3]);
 
  607        $GLOBALS[
'DIC']->logger()->grp()->warning(
'Parsing id failed: ' . $a_id);
 
  619        include_once 
'./Services/Container/classes/class.ilContainerSortingSettings.php';
 
An exception for terminatinating execution or to throw for unit testing.
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.
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.
if(!array_key_exists('StateId', $_REQUEST)) $id
Interface definition for sax subset parsers.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.