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();
89 $this->parent[] = $a_id;
93 array_pop($this->parent);
99 return $this->parent[count($this->parent) - 1];
109 xml_set_object($a_xml_parser, $this);
110 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
111 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
119 parent::startParsing();
122 return is_object($this->group_obj) ? $this->group_obj->getRefId() :
false;
124 return is_object($this->group_obj) ? $this->group_obj->update() :
false;
139 $this->group_data[
"admin"] =
array();
140 $this->group_data[
"member"] =
array();
142 $this->group_data[
"type"] = $a_attribs[
"type"];
143 $this->group_data[
"id"] = $a_attribs[
"id"];
151 $this->group_data[
"owner"] = $a_attribs[
"id"];
155 $this->group_data[
'registration_type'] = $a_attribs[
'type'];
156 $this->group_data[
'waiting_list_enabled'] = $a_attribs[
'waitingList'] ==
'Yes' ? true :
false;
160 $this->in_period =
true;
164 $this->group_data[
'max_members_enabled'] = $a_attribs[
'enabled'] ==
'Yes' ? true :
false;
168 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
"Attach") {
169 $this->group_data[
"admin"][
"attach"][] = $a_attribs[
"id"];
170 } elseif (isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
"Detach") {
171 $this->group_data[
"admin"][
"detach"][] = $a_attribs[
"id"];
174 if (isset($a_attribs[
'notification']) and $a_attribs[
'notification'] ==
'Yes') {
175 $this->group_data[
'notifications'][] = $a_attribs[
'id'];
181 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
"Attach") {
182 $GLOBALS[
'DIC']->logger()->grp()->debug(
'New member with id ' . $a_attribs[
'id']);
183 $this->group_data[
"member"][
"attach"][] = $a_attribs[
"id"];
184 } elseif (isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
"Detach") {
185 $GLOBALS[
'DIC']->logger()->grp()->debug(
'Deprecated member with id ' . $a_attribs[
'id']);
186 $this->group_data[
"member"][
"detach"][] = $a_attribs[
"id"];
191 case 'ContainerSetting':
192 $this->current_container_setting = $a_attribs[
'id'];
197 if ($this->group_imported) {
200 $this->sort = $a_attribs;
205 case 'WaitingListAutoFill':
206 case 'CancellationEnd':
209 case 'mailMembersType':
219 $this->group_data[
"title"] = trim($this->cdata);
223 $this->group_data[
"description"] = trim($this->cdata);
227 $this->group_data[
'information'] = trim($this->cdata);
231 $this->group_data[
'password'] = trim($this->cdata);
235 $this->group_data[
'max_members'] = trim($this->cdata);
239 $this->group_data[
'expiration_end'] = trim($this->cdata);
243 if ($this->in_period) {
244 $this->group_data[
'period_start'] = trim($this->cdata);
246 $this->group_data[
'expiration_start'] = trim($this->cdata);
251 if ($this->in_period) {
252 $this->group_data[
'period_end'] = trim($this->cdata);
254 $this->group_data[
'expiration_end'] = trim($this->cdata);
259 $this->in_period =
false;
267 case 'ContainerSetting':
268 if ($this->current_container_setting) {
270 if (!($this->group_obj instanceof
ilObjGroup)) {
274 $this->group_obj->getId(),
281 case 'WaitingListAutoFill':
282 $this->group_data[
'auto_wait'] = trim($this->cdata);
285 case 'CancellationEnd':
286 if ((
int) $this->cdata) {
292 if ((
int) $this->cdata) {
293 $this->group_data[
'min_members'] = (int) $this->cdata;
298 if ((
int) $this->cdata) {
299 $this->group_data[
'show_members'] = (int) $this->cdata;
303 case 'mailMembersType':
304 $this->group_data[
'mail_members_type'] = (int) $this->cdata;
321 $a_data = str_replace(
"<",
"<", $a_data);
322 $a_data = str_replace(
">",
">", $a_data);
324 if (!empty($a_data)) {
325 $this->cdata .= $a_data;
332 if ($this->group_imported) {
338 $this->group_obj->setImportId($this->group_data[
"id"]);
339 $this->group_obj->setTitle($this->group_data[
"title"]);
340 $this->group_obj->setDescription($this->group_data[
"description"]);
341 $this->group_obj->setInformation((
string) $this->group_data[
'information']);
344 $this->group_data[
'period_start'] &&
345 $this->group_data[
'period_end']) {
346 $this->group_obj->setStart(
new ilDate($this->group_data[
'period_start'],
IL_CAL_UNIX));
347 $this->group_obj->setEnd(
new ilDate($this->group_data[
'period_end'],
IL_CAL_UNIX));
350 $ownerChanged =
false;
351 if (isset($this->group_data[
"owner"])) {
352 $owner = $this->group_data[
"owner"];
353 if (!is_numeric($owner)) {
356 if (is_numeric($owner) && $owner > 0) {
357 $this->group_obj->setOwner($owner);
358 $ownerChanged =
true;
366 $this->group_obj->create();
367 $this->group_obj->createReference();
371 array_key_exists(
'type', $this->group_data) &&
372 $this->group_data[
'type'] ==
'closed' 378 array_key_exists(
'type', $this->group_data) &&
379 $this->group_data[
'type'] ==
'closed' 383 array_key_exists(
'type', $this->group_data) &&
384 $this->group_data[
'type'] ==
'open' 390 switch ($this->group_data[
'registration_type']) {
411 $this->group_obj->setRegistrationType($flag);
414 if ($this->group_data[
'expiration_end']) {
419 if ($this->group_data[
'expiration_start']) {
423 $this->group_obj->setRegistrationStart($start);
424 $this->group_obj->setRegistrationEnd($end);
425 $this->group_obj->setPassword($this->group_data[
'password']);
426 $this->group_obj->enableUnlimitedRegistration(!isset($this->group_data[
'expiration_end']));
427 $this->group_obj->enableMembershipLimitation($this->group_data[
'max_members_enabled']);
428 $this->group_obj->setMaxMembers($this->group_data[
'max_members'] ? $this->group_data[
'max_members'] : 0);
429 $this->group_obj->enableWaitingList($this->group_data[
'waiting_list_enabled']);
431 $this->group_obj->setWaitingListAutoFill($this->group_data[
'auto_wait']);
432 $this->group_obj->setCancellationEnd($this->group_data[
'cancel_end']);
433 $this->group_obj->setMinMembers($this->group_data[
'min_members']);
434 $this->group_obj->setShowMembers($this->group_data[
'show_members'] ? $this->group_data[
'show_members'] : 0);
435 $this->group_obj->setMailToMembersType((
int) $this->group_data[
'mail_members_type']);
436 $this->group_obj->update();
447 $this->group_imported =
true;
458 $this->participants->updateNotification($ilUser->getId(), $ilSetting->get(
'mail_grp_admin_notification',
true));
461 if (isset($this->group_data[
"admin"][
"attach"]) && count($this->group_data[
"admin"][
"attach"])) {
462 foreach ($this->group_data[
"admin"][
"attach"] as $user) {
463 if ($id_data = $this->
__parseId($user)) {
464 if ($id_data[
'local'] or $id_data[
'imported']) {
465 $this->participants->add($id_data[
'usr_id'],
IL_GRP_ADMIN);
466 if (in_array($user, (
array) $this->group_data[
'notifications'])) {
467 $this->participants->updateNotification($id_data[
'usr_id'],
true);
474 if (isset($this->group_data[
"admin"][
"detach"]) && count($this->group_data[
"admin"][
"detach"])) {
475 foreach ($this->group_data[
"admin"][
"detach"] as $user) {
476 if ($id_data = $this->
__parseId($user)) {
477 if ($id_data[
'local'] or $id_data[
'imported']) {
478 if ($this->participants->isAssigned($id_data[
'usr_id'])) {
479 $this->participants->delete($id_data[
'usr_id']);
486 if (isset($this->group_data[
"member"][
"attach"]) && count($this->group_data[
"member"][
"attach"])) {
487 foreach ($this->group_data[
"member"][
"attach"] as $user) {
488 if ($id_data = $this->
__parseId($user)) {
489 if ($id_data[
'local'] or $id_data[
'imported']) {
496 if (isset($this->group_data[
"member"][
"detach"]) && count($this->group_data[
"member"][
"detach"])) {
497 foreach ($this->group_data[
"member"][
"detach"] as $user) {
498 if ($id_data = $this->
__parseId($user)) {
499 if ($id_data[
'local'] or $id_data[
'imported']) {
500 if ($this->participants->isAssigned($id_data[
'usr_id'])) {
501 $this->participants->delete($id_data[
'usr_id']);
512 include_once
"./Modules/Group/classes/class.ilObjGroup.php";
527 $fields = explode(
'_', $a_id);
529 if (!is_array($fields) or
530 $fields[0] !=
'il' or
531 !is_numeric($fields[1]) or
532 $fields[2] !=
'usr' or
533 !is_numeric($fields[3])) {
537 return array(
'imported' =>
true,
542 if (strlen($user[
'login'])) {
543 return array(
'imported' =>
false,
545 'usr_id' => $fields[3]);
548 $GLOBALS[
'DIC']->logger()->grp()->warning(
'Parsing id failed: ' . $a_id);
565 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.
if(!array_key_exists('StateId', $_REQUEST)) $id
const GRP_REGISTRATION_PASSWORD
const GRP_REGISTRATION_REQUEST
add($a_usr_id, $a_role)
Add user to role.
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