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 $GLOBALS[
'ilLog']->write(__METHOD__.
': new member with id '.$a_attribs[
'id']);
187 $this->group_data[
"member"][
"attach"][] = $a_attribs[
"id"];
188 } elseif (isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
"Detach")
190 $GLOBALS[
'ilLog']->write(__METHOD__.
': deprecated member with id '.$a_attribs[
'id']);
191 $this->group_data[
"member"][
"detach"][] = $a_attribs[
"id"];
205 $this->file[
"fileName"] = $a_attribs[
"fileName"];
206 $this->file[
"id"] = $a_attribs[
"id"];
220 $this->group_data[
"title"] = trim($this->cdata);
224 $this->group_data[
"description"] = trim($this->cdata);
228 $this->group_data[
'information'] = trim($this->cdata);
232 $this->group_data[
'password'] = trim($this->cdata);
236 $this->group_data[
'max_members'] = trim($this->cdata);
240 $this->group_data[
'expiration_end'] = trim($this->cdata);
244 $this->group_data[
'expiration_start'] = trim($this->cdata);
248 $this->group_data[
'expiration_end'] = trim($this->cdata);
256 $this->folder = trim($this->cdata);
278 $a_data = str_replace(
"<",
"<",$a_data);
279 $a_data = str_replace(
">",
">",$a_data);
283 $this->cdata .= $a_data;
290 if($this->group_imported)
297 $this->group_obj->setImportId($this->group_data[
"id"]);
298 $this->group_obj->setTitle($this->group_data[
"title"]);
299 $this->group_obj->setDescription($this->group_data[
"description"]);
301 $ownerChanged =
false;
302 if (isset($this->group_data[
"owner"]))
304 $owner = $this->group_data[
"owner"];
305 if (!is_numeric($owner))
309 if (is_numeric($owner) && $owner > 0)
311 $this->group_obj->setOwner($owner);
312 $ownerChanged =
true;
321 $this->group_obj->create();
322 $this->group_obj->createReference();
329 switch($this->group_data[
'type'])
341 $this->group_obj->updateOwner();
342 if($this->group_obj->getGroupStatus() != $grp_status)
344 $this->group_obj->setGroupType($grp_status);
345 $this->group_obj->updateGroupType();
350 switch($this->group_data[
'registration_type'])
372 $this->group_obj->setRegistrationType($flag);
375 if($this->group_data[
'expiration_end'])
381 if($this->group_data[
'expiration_start'])
386 $this->group_obj->setRegistrationStart($start);
387 $this->group_obj->setRegistrationEnd($end);
388 $this->group_obj->setPassword($this->group_data[
'password']);
389 $this->group_obj->enableUnlimitedRegistration(!isset($this->group_data[
'expiration_end']));
390 $this->group_obj->enableMembershipLimitation($this->group_data[
'max_members_enabled']);
391 $this->group_obj->setMaxMembers($this->group_data[
'max_members'] ? $this->group_data[
'max_members'] : 0);
392 $this->group_obj->enableWaitingList($this->group_data[
'waiting_list_enabled']);
397 $this->group_obj->initGroupStatus($this->group_data[
"type"] ==
"open" ? 0 : 1);
400 $this->group_obj->update();
408 $this->group_imported =
true;
417 $this->folder_obj->setTitle($this->folder);
418 $this->folder_obj->create();
419 $this->folder_obj->createReference();
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->updateNotification($ilUser->getId(),
true);
466 if (count($this->group_data[
"admin"][
"attach"]))
468 foreach($this->group_data[
"admin"][
"attach"] as $user)
472 if($id_data[
'local'] or $id_data[
'imported'])
474 $this->participants->add($id_data[
'usr_id'],
IL_GRP_ADMIN);
475 if(in_array($user,(array) $this->group_data[
'notifications']))
477 $this->participants->updateNotification($id_data[
'usr_id'],
true);
484 if (count($this->group_data[
"admin"][
"detach"]))
486 foreach($this->group_data[
"admin"][
"detach"] as $user)
490 if($id_data[
'local'] or $id_data[
'imported'])
492 if($this->participants->isAssigned($id_data[
'usr_id']))
494 $this->participants->delete($id_data[
'usr_id']);
501 if (count($this->group_data[
"member"][
"attach"]))
503 foreach($this->group_data[
"member"][
"attach"] as $user)
507 if($id_data[
'local'] or $id_data[
'imported'])
515 if (count($this->group_data[
"member"][
"detach"]))
517 foreach($this->group_data[
"member"][
"detach"] as $user)
521 if($id_data[
'local'] or $id_data[
'imported'])
523 if($this->participants->isAssigned($id_data[
'usr_id']))
525 $this->participants->delete($id_data[
'usr_id']);
536 include_once
"./Modules/Group/classes/class.ilObjGroup.php";
550 include_once
"./Modules/Folder/classes/class.ilObjFolder.php";
559 include_once
"classes/class.ilFileDataImportGroup.php";
568 include_once
"./Modules/File/classes/class.ilObjFile.php";
577 unset($this->folder_obj);
584 $fields = explode(
'_',$a_id);
586 if(!is_array($fields) or
587 $fields[0] !=
'il' or
588 !is_numeric($fields[1]) or
589 $fields[2] !=
'usr' or
590 !is_numeric($fields[3]))
596 return array(
'imported' =>
true,
602 if(strlen($user[
'login']))
604 return array(
'imported' =>
false,
606 'usr_id' => $fields[3]);
609 $GLOBALS[
'ilLog']->write(__METHOD__.
' Parsing id failed: '.$a_id);