24 require_once(
"./Services/Xml/classes/class.ilSaxParser.php");
25 require_once(
'./Services/User/classes/class.ilObjUser.php');
26 include_once(
'./Services/Calendar/classes/class.ilDateTime.php');
27 include_once(
'./Modules/Group/classes/class.ilGroupParticipants.php');
67 define(
'EXPORT_VERSION',2);
84 $this->parent[] = $a_id;
88 array_pop($this->parent);
94 return $this->parent[count($this->parent) - 1];
104 xml_set_object($a_xml_parser,$this);
105 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
106 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
118 return is_object($this->group_obj) ? $this->group_obj->getRefId() :
false;
122 return is_object($this->group_obj) ? $this->group_obj->update() :
false;
138 #if($a_attribs["exportVersion"] < EXPORT_VERSION)
140 # $ilErr->raiseError("!!! This export Version isn't supported, update your ILIAS 2 installation"
144 $this->group_data[
"admin"] = array();
145 $this->group_data[
"member"] = array();
147 $this->group_data[
"type"] = $a_attribs[
"type"];
148 $this->group_data[
"id"] = $a_attribs[
"id"];
156 $this->group_data[
"owner"] = $a_attribs[
"id"];
160 $this->group_data[
'registration_type'] = $a_attribs[
'type'];
161 $this->group_data[
'waiting_list_enabled'] = $a_attribs[
'waitingList'] ==
'Yes' ?
true :
false;
165 $this->group_data[
'max_members_enabled'] = $a_attribs[
'enabled'] ==
'Yes' ?
true :
false;
169 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
"Attach")
171 $this->group_data[
"admin"][
"attach"][] = $a_attribs[
"id"];
173 elseif (isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
"Detach")
175 $this->group_data[
"admin"][
"detach"][] = $a_attribs[
"id"];
178 if(isset($a_attribs[
'notification']) and $a_attribs[
'notification'] ==
'Yes')
180 $this->group_data[
'notifications'][] = $a_attribs[
'id'];
186 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
"Attach")
188 $GLOBALS[
'ilLog']->write(__METHOD__.
': new member with id '.$a_attribs[
'id']);
189 $this->group_data[
"member"][
"attach"][] = $a_attribs[
"id"];
190 } elseif (isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
"Detach")
192 $GLOBALS[
'ilLog']->write(__METHOD__.
': deprecated member with id '.$a_attribs[
'id']);
193 $this->group_data[
"member"][
"detach"][] = $a_attribs[
"id"];
207 $this->file[
"fileName"] = $a_attribs[
"fileName"];
208 $this->file[
"id"] = $a_attribs[
"id"];
214 case 'ContainerSetting':
215 $this->current_container_setting = $a_attribs[
'id'];
220 if($this->group_imported)
226 $this->sort = $a_attribs;
239 $this->group_data[
"title"] = trim($this->cdata);
243 $this->group_data[
"description"] = trim($this->cdata);
247 $this->group_data[
'information'] = trim($this->cdata);
251 $this->group_data[
'password'] = trim($this->cdata);
255 $this->group_data[
'max_members'] = trim($this->cdata);
259 $this->group_data[
'expiration_end'] = trim($this->cdata);
263 $this->group_data[
'expiration_start'] = trim($this->cdata);
267 $this->group_data[
'expiration_end'] = trim($this->cdata);
275 $this->folder = trim($this->cdata);
284 case 'ContainerSetting':
285 if($this->current_container_setting)
293 $this->group_obj->getId(),
312 $a_data = str_replace(
"<",
"<",$a_data);
313 $a_data = str_replace(
">",
">",$a_data);
317 $this->cdata .= $a_data;
324 if($this->group_imported)
331 $this->group_obj->setImportId($this->group_data[
"id"]);
332 $this->group_obj->setTitle($this->group_data[
"title"]);
333 $this->group_obj->setDescription($this->group_data[
"description"]);
335 $ownerChanged =
false;
336 if (isset($this->group_data[
"owner"]))
338 $owner = $this->group_data[
"owner"];
339 if (!is_numeric($owner))
343 if (is_numeric($owner) && $owner > 0)
345 $this->group_obj->setOwner($owner);
346 $ownerChanged =
true;
355 $this->group_obj->create();
356 $this->group_obj->createReference();
363 switch($this->group_data[
'type'])
375 $this->group_obj->updateOwner();
376 if($this->group_obj->getGroupStatus() != $grp_status)
378 $this->group_obj->setGroupType($grp_status);
379 $this->group_obj->updateGroupType();
384 switch($this->group_data[
'registration_type'])
406 $this->group_obj->setRegistrationType($flag);
409 if($this->group_data[
'expiration_end'])
415 if($this->group_data[
'expiration_start'])
420 $this->group_obj->setRegistrationStart($start);
421 $this->group_obj->setRegistrationEnd($end);
422 $this->group_obj->setPassword($this->group_data[
'password']);
423 $this->group_obj->enableUnlimitedRegistration(!isset($this->group_data[
'expiration_end']));
424 $this->group_obj->enableMembershipLimitation($this->group_data[
'max_members_enabled']);
425 $this->group_obj->setMaxMembers($this->group_data[
'max_members'] ? $this->group_data[
'max_members'] : 0);
426 $this->group_obj->enableWaitingList($this->group_data[
'waiting_list_enabled']);
431 $this->group_obj->initGroupStatus($this->group_data[
"type"] ==
"open" ? 0 : 1);
434 $this->group_obj->update();
446 $this->group_imported =
true;
455 $this->folder_obj->setTitle($this->folder);
456 $this->folder_obj->create();
457 $this->folder_obj->createReference();
471 $this->file_obj->setType(
"file");
472 $this->file_obj->setTitle($this->file[
"fileName"]);
473 $this->file_obj->setFileName($this->file[
"fileName"]);
474 $this->file_obj->create();
475 $this->file_obj->createReference();
480 $this->file_obj->createDirectory();
484 if($this->import_file_obj->findObjectFile($this->file[
"id"]))
486 $this->file_obj->copy($this->import_file_obj->getObjectFile(),$this->file[
"fileName"]);
489 unset($this->file_obj);
490 unset($this->import_file_obj);
501 $this->participants->updateNotification($ilUser->getId(),
true);
504 if (count($this->group_data[
"admin"][
"attach"]))
506 foreach($this->group_data[
"admin"][
"attach"] as $user)
510 if($id_data[
'local'] or $id_data[
'imported'])
512 $this->participants->add($id_data[
'usr_id'],
IL_GRP_ADMIN);
513 if(in_array($user,(array) $this->group_data[
'notifications']))
515 $this->participants->updateNotification($id_data[
'usr_id'],
true);
522 if (count($this->group_data[
"admin"][
"detach"]))
524 foreach($this->group_data[
"admin"][
"detach"] as $user)
528 if($id_data[
'local'] or $id_data[
'imported'])
530 if($this->participants->isAssigned($id_data[
'usr_id']))
532 $this->participants->delete($id_data[
'usr_id']);
539 if (count($this->group_data[
"member"][
"attach"]))
541 foreach($this->group_data[
"member"][
"attach"] as $user)
545 if($id_data[
'local'] or $id_data[
'imported'])
553 if (count($this->group_data[
"member"][
"detach"]))
555 foreach($this->group_data[
"member"][
"detach"] as $user)
559 if($id_data[
'local'] or $id_data[
'imported'])
561 if($this->participants->isAssigned($id_data[
'usr_id']))
563 $this->participants->delete($id_data[
'usr_id']);
574 include_once
"./Modules/Group/classes/class.ilObjGroup.php";
588 include_once
"./Modules/Folder/classes/class.ilObjFolder.php";
597 include_once
"./Modules/Group/classes/class.ilFileDataImportGroup.php";
606 include_once
"./Modules/File/classes/class.ilObjFile.php";
615 unset($this->folder_obj);
622 $fields = explode(
'_',$a_id);
624 if(!is_array($fields) or
625 $fields[0] !=
'il' or
626 !is_numeric($fields[1]) or
627 $fields[2] !=
'usr' or
628 !is_numeric($fields[3]))
634 return array(
'imported' =>
true,
640 if(strlen($user[
'login']))
642 return array(
'imported' =>
false,
644 'usr_id' => $fields[3]);
647 $GLOBALS[
'ilLog']->write(__METHOD__.
' Parsing id failed: '.$a_id);
662 include_once
'./Services/Container/classes/class.ilContainerSortingSettings.php';