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');
72 define(
'EXPORT_VERSION',2);
74 parent::__construct(null);
79 $this->log =
$GLOBALS[
'DIC']->logger()->grp();
111 xml_set_object($a_xml_parser,$this);
112 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
113 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
121 parent::startParsing();
125 return is_object($this->group_obj) ? $this->group_obj->getRefId() :
false;
129 return is_object($this->group_obj) ? $this->group_obj->update() :
false;
145 $this->group_data[
"admin"] =
array();
146 $this->group_data[
"member"] =
array();
148 $this->group_data[
"type"] = $a_attribs[
"type"];
149 $this->group_data[
"id"] = $a_attribs[
"id"];
157 $this->group_data[
"owner"] = $a_attribs[
"id"];
161 $this->group_data[
'registration_type'] = $a_attribs[
'type'];
162 $this->group_data[
'waiting_list_enabled'] = $a_attribs[
'waitingList'] ==
'Yes' ? true :
false;
166 $this->group_data[
'max_members_enabled'] = $a_attribs[
'enabled'] ==
'Yes' ? true :
false;
170 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
"Attach")
172 $this->group_data[
"admin"][
"attach"][] = $a_attribs[
"id"];
174 elseif (isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
"Detach")
176 $this->group_data[
"admin"][
"detach"][] = $a_attribs[
"id"];
179 if(isset($a_attribs[
'notification'])
and $a_attribs[
'notification'] ==
'Yes')
181 $this->group_data[
'notifications'][] = $a_attribs[
'id'];
187 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
"Attach")
189 $GLOBALS[
'ilLog']->write(__METHOD__.
': new member with id '.$a_attribs[
'id']);
190 $this->group_data[
"member"][
"attach"][] = $a_attribs[
"id"];
191 } elseif (isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
"Detach")
193 $GLOBALS[
'ilLog']->write(__METHOD__.
': deprecated member with id '.$a_attribs[
'id']);
194 $this->group_data[
"member"][
"detach"][] = $a_attribs[
"id"];
199 case 'ContainerSetting':
200 $this->current_container_setting = $a_attribs[
'id'];
205 if($this->group_imported)
211 $this->sort = $a_attribs;
216 case 'WaitingListAutoFill':
217 case 'CancellationEnd':
219 case 'mailMembersType':
230 $this->group_data[
"title"] = trim($this->cdata);
234 $this->group_data[
"description"] = trim($this->cdata);
238 $this->group_data[
'information'] = trim($this->cdata);
242 $this->group_data[
'password'] = trim($this->cdata);
246 $this->group_data[
'max_members'] = trim($this->cdata);
250 $this->group_data[
'expiration_end'] = trim($this->cdata);
254 $this->group_data[
'expiration_start'] = trim($this->cdata);
258 $this->group_data[
'expiration_end'] = trim($this->cdata);
266 case 'ContainerSetting':
267 if($this->current_container_setting)
275 $this->group_obj->getId(),
281 case 'WaitingListAutoFill':
282 $this->group_data[
'auto_wait'] = trim($this->cdata);
285 case 'CancellationEnd':
286 if((
int)$this->cdata)
293 if((
int)$this->cdata)
295 $this->group_data[
'min_members'] = (int)$this->cdata;
299 case 'mailMembersType':
300 $this->group_data[
'mail_members_type'] = (int) $this->cdata;
317 $a_data = str_replace(
"<",
"<",$a_data);
318 $a_data = str_replace(
">",
">",$a_data);
322 $this->cdata .= $a_data;
329 if($this->group_imported)
336 $this->group_obj->setImportId($this->group_data[
"id"]);
337 $this->group_obj->setTitle($this->group_data[
"title"]);
338 $this->group_obj->setDescription($this->group_data[
"description"]);
339 $this->group_obj->setInformation((
string) $this->group_data[
'information']);
341 $ownerChanged =
false;
342 if (isset($this->group_data[
"owner"]))
344 $owner = $this->group_data[
"owner"];
345 if (!is_numeric($owner))
349 if (is_numeric($owner) && $owner > 0)
351 $this->group_obj->setOwner($owner);
352 $ownerChanged =
true;
361 $this->group_obj->create();
362 $this->group_obj->createReference();
369 switch($this->group_data[
'type'])
381 $this->group_obj->updateOwner();
382 if($this->group_obj->getGroupStatus() != $grp_status)
384 $this->group_obj->setGroupType($grp_status);
385 $this->group_obj->updateGroupType();
390 switch($this->group_data[
'registration_type'])
412 $this->group_obj->setRegistrationType($flag);
415 if($this->group_data[
'expiration_end'])
421 if($this->group_data[
'expiration_start'])
426 $this->group_obj->setRegistrationStart(
$start);
427 $this->group_obj->setRegistrationEnd($end);
428 $this->group_obj->setPassword($this->group_data[
'password']);
429 $this->group_obj->enableUnlimitedRegistration(!isset($this->group_data[
'expiration_end']));
430 $this->group_obj->enableMembershipLimitation($this->group_data[
'max_members_enabled']);
431 $this->group_obj->setMaxMembers($this->group_data[
'max_members'] ? $this->group_data[
'max_members'] : 0);
432 $this->group_obj->enableWaitingList($this->group_data[
'waiting_list_enabled']);
434 $this->group_obj->setWaitingListAutoFill($this->group_data[
'auto_wait']);
435 $this->group_obj->setCancellationEnd($this->group_data[
'cancel_end']);
436 $this->group_obj->setMinMembers($this->group_data[
'min_members']);
438 $this->group_obj->setMailToMembersType((
int) $this->group_data[
'mail_members_type']);
442 $this->group_obj->initGroupStatus($this->group_data[
"type"] ==
"open" ? 0 : 1);
445 $this->group_obj->update();
457 $this->group_imported =
true;
468 $this->participants->updateNotification($ilUser->getId(),$ilSetting->get(
'mail_grp_admin_notification',
true));
471 if (count($this->group_data[
"admin"][
"attach"]))
473 foreach($this->group_data[
"admin"][
"attach"] as $user)
477 if($id_data[
'local']
or $id_data[
'imported'])
479 $this->participants->add($id_data[
'usr_id'],
IL_GRP_ADMIN);
480 if(in_array($user,(
array) $this->group_data[
'notifications']))
482 $this->participants->updateNotification($id_data[
'usr_id'],
true);
489 if (count($this->group_data[
"admin"][
"detach"]))
491 foreach($this->group_data[
"admin"][
"detach"] as $user)
495 if($id_data[
'local']
or $id_data[
'imported'])
497 if($this->participants->isAssigned($id_data[
'usr_id']))
499 $this->participants->delete($id_data[
'usr_id']);
506 if (count($this->group_data[
"member"][
"attach"]))
508 foreach($this->group_data[
"member"][
"attach"] as $user)
512 if($id_data[
'local']
or $id_data[
'imported'])
520 if (count($this->group_data[
"member"][
"detach"]))
522 foreach($this->group_data[
"member"][
"detach"] as $user)
526 if($id_data[
'local']
or $id_data[
'imported'])
528 if($this->participants->isAssigned($id_data[
'usr_id']))
530 $this->participants->delete($id_data[
'usr_id']);
541 include_once
"./Modules/Group/classes/class.ilObjGroup.php";
557 $fields = explode(
'_',$a_id);
559 if(!is_array($fields)
or 560 $fields[0] !=
'il' or 561 !is_numeric($fields[1])
or 562 $fields[2] !=
'usr' or 563 !is_numeric($fields[3]))
569 return array(
'imported' =>
true,
575 if(strlen($user[
'login']))
577 return array(
'imported' =>
false,
579 'usr_id' => $fields[3]);
582 $GLOBALS[
'ilLog']->write(__METHOD__.
' Parsing id failed: '.$a_id);
597 include_once
'./Services/Container/classes/class.ilContainerSortingSettings.php';
static _lookupName($a_user_id)
lookup user name
const GRP_REGISTRATION_DEACTIVATED
static _importContainerSortingSettings($attibs, $obj_id)
sorting import for all container objects
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
const GRP_REGISTRATION_PASSWORD
add($a_usr_id, $a_role)
Add user to course.
const GRP_REGISTRATION_REQUEST
static _getImportedUserId($i2_id)
startParsing()
start the parser
handlerEndTag($a_xml_parser, $a_name)
Base class for sax-based expat parsing extended classes need to overwrite the method setHandlers and ...
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
__initContainerSorting($a_attribs, $a_group_id)
handlerCharacterData($a_xml_parser, $a_data)
handler for character data
Create styles array
The data for the language used.
static _writeContainerSetting($a_id, $a_keyword, $a_value)
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
setHandlers($a_xml_parser)
set event handler should be overwritten by inherited class private
const GRP_REGISTRATION_DIRECT
setXMLContent($a_xml_content)
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.
__construct($a_xml, $a_parent_id)
Constructor.
$current_container_setting