24 require_once(
"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');
65 define(
'EXPORT_VERSION',2);
82 $this->parent[] = $a_id;
86 array_pop($this->parent);
92 return $this->parent[count($this->parent) - 1];
102 xml_set_object($a_xml_parser,$this);
103 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
104 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
116 return is_object($this->group_obj) ? $this->group_obj->getRefId() :
false;
120 return is_object($this->group_obj) ? $this->group_obj->update() :
false;
136 #if($a_attribs["exportVersion"] < EXPORT_VERSION)
138 # $ilErr->raiseError("!!! This export Version isn't supported, update your ILIAS 2 installation"
142 $this->group_data[
"admin"] = array();
143 $this->group_data[
"member"] = array();
145 $this->group_data[
"type"] = $a_attribs[
"type"];
146 $this->group_data[
"id"] = $a_attribs[
"id"];
154 $this->group_data[
"owner"] = $a_attribs[
"id"];
158 $this->group_data[
'registration_type'] = $a_attribs[
'type'];
159 $this->group_data[
'waiting_list_enabled'] = $a_attribs[
'waitingList'] ==
'Yes' ?
true :
false;
163 $this->group_data[
'max_members_enabled'] = $a_attribs[
'enabled'] ==
'Yes' ?
true :
false;
167 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
"Attach")
169 $this->group_data[
"admin"][
"attach"][] = $a_attribs[
"id"];
171 elseif (isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
"Detach")
173 $this->group_data[
"admin"][
"detach"][] = $a_attribs[
"id"];
176 if(isset($a_attribs[
'notification']) and $a_attribs[
'notification'] ==
'Yes')
178 $this->group_data[
'notifications'][] = $a_attribs[
'id'];
184 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
"Attach")
186 $this->group_data[
"member"][
"attach"][] = $a_attribs[
"id"];
187 } elseif (isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
"Detach")
189 $this->group_data[
"member"][
"detach"][] = $a_attribs[
"id"];
203 $this->file[
"fileName"] = $a_attribs[
"fileName"];
204 $this->file[
"id"] = $a_attribs[
"id"];
218 $this->group_data[
"title"] = trim($this->cdata);
222 $this->group_data[
"description"] = trim($this->cdata);
226 $this->group_data[
'information'] = trim($this->cdata);
230 $this->group_data[
'password'] = trim($this->cdata);
234 $this->group_data[
'max_members'] = trim($this->cdata);
238 $this->group_data[
'expiration_end'] = trim($this->cdata);
242 $this->group_data[
'expiration_start'] = trim($this->cdata);
246 $this->group_data[
'expiration_end'] = trim($this->cdata);
254 $this->folder = trim($this->cdata);
276 $a_data = str_replace(
"<",
"<",$a_data);
277 $a_data = str_replace(
">",
">",$a_data);
281 $this->cdata .= $a_data;
288 if($this->group_imported)
295 $this->group_obj->setImportId($this->group_data[
"id"]);
296 $this->group_obj->setTitle($this->group_data[
"title"]);
297 $this->group_obj->setDescription($this->group_data[
"description"]);
299 $ownerChanged =
false;
300 if (isset($this->group_data[
"owner"]))
302 $owner = $this->group_data[
"owner"];
303 if (!is_numeric($owner))
307 if (is_numeric($owner) && $owner > 0)
309 $this->group_obj->setOwner($owner);
310 $ownerChanged =
true;
319 $this->group_obj->create();
320 $this->group_obj->createReference();
323 $this->group_obj->initDefaultRoles();
328 switch($this->group_data[
'type'])
340 $this->group_obj->updateOwner();
341 if($this->group_obj->getGroupStatus() != $grp_status)
343 $this->group_obj->setGroupType($grp_status);
344 $this->group_obj->updateGroupType();
349 switch($this->group_data[
'registration_type'])
371 $this->group_obj->setRegistrationType($flag);
374 if($this->group_data[
'expiration_end'])
380 if($this->group_data[
'expiration_start'])
385 $this->group_obj->setRegistrationStart($start);
386 $this->group_obj->setRegistrationEnd($end);
387 $this->group_obj->setPassword($this->group_data[
'password']);
388 $this->group_obj->enableUnlimitedRegistration(!isset($this->group_data[
'expiration_end']));
389 $this->group_obj->enableMembershipLimitation($this->group_data[
'max_members_enabled']);
390 $this->group_obj->setMaxMembers($this->group_data[
'max_members'] ? $this->group_data[
'max_members'] : 0);
391 $this->group_obj->enableWaitingList($this->group_data[
'waiting_list_enabled']);
396 $this->group_obj->initGroupStatus($this->group_data[
"type"] ==
"open" ? 0 : 1);
399 $this->group_obj->update();
407 $this->group_imported =
true;
416 $this->folder_obj->setTitle($this->folder);
417 $this->folder_obj->create();
418 $this->folder_obj->createReference();
420 $this->folder_obj->initDefaultRoles();
433 $this->file_obj->setType(
"file");
434 $this->file_obj->setTitle($this->file[
"fileName"]);
435 $this->file_obj->setFileName($this->file[
"fileName"]);
436 $this->file_obj->create();
437 $this->file_obj->createReference();
442 $this->file_obj->createDirectory();
446 if($this->import_file_obj->findObjectFile($this->file[
"id"]))
448 $this->file_obj->copy($this->import_file_obj->getObjectFile(),$this->file[
"fileName"]);
451 unset($this->file_obj);
452 unset($this->import_file_obj);
463 $this->participants->add($ilUser->getId(),
IL_GRP_ADMIN);
464 $this->participants->updateNotification($ilUser->getId(),
true);
466 #print_r($this->group_data["admin"]["attach"]);
468 if (count($this->group_data[
"admin"][
"attach"]))
470 foreach($this->group_data[
"admin"][
"attach"] as
$user)
474 if($id_data[
'local'] or $id_data[
'imported'])
476 $this->participants->add($id_data[
'usr_id'],
IL_GRP_ADMIN);
477 if(in_array($user,(array) $this->group_data[
'notifications']))
479 $this->participants->updateNotification($id_data[
'usr_id'],
true);
486 if (count($this->group_data[
"admin"][
"detach"]))
488 foreach($this->group_data[
"admin"][
"detach"] as
$user)
492 if($id_data[
'local'] or $id_data[
'imported'])
494 if($this->participants->isAssigned($id_data[
'usr_id']))
496 $this->participants->delete($id_data[
'usr_id']);
503 if (count($this->group_data[
"member"][
"attach"]))
505 foreach($this->group_data[
"member"][
"attach"] as
$user)
509 if($id_data[
'local'] or $id_data[
'imported'])
517 if (count($this->group_data[
"member"][
"detach"]))
519 foreach($this->group_data[
"member"][
"detach"] as
$user)
523 if($id_data[
'local'] or $id_data[
'imported'])
525 if($this->participants->isAssigned($id_data[
'usr_id']))
527 $this->participants->delete($id_data[
'usr_id']);
538 include_once
"./Modules/Group/classes/class.ilObjGroup.php";
552 include_once
"./Modules/Folder/classes/class.ilObjFolder.php";
561 include_once
"classes/class.ilFileDataImportGroup.php";
570 include_once
"./Modules/File/classes/class.ilObjFile.php";
579 unset($this->folder_obj);
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]))
598 return array(
'imported' =>
true,
604 return array(
'imported' =>
false,
606 'usr_id' => $fields[3]);