ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilGroupXMLParser Class Reference

Group Import Parser. More...

+ Inheritance diagram for ilGroupXMLParser:
+ Collaboration diagram for ilGroupXMLParser:

Public Member Functions

 __construct (ilObjGroup $group, $a_xml, $a_parent_id)
 Constructor. More...
 
 __pushParentId ($a_id)
 
 __popParentId ()
 
 __getParentId ()
 
 setHandlers ($a_xml_parser)
 set event handlers More...
 
 startParsing ()
 start the parser More...
 
 handlerBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element More...
 
 handlerEndTag ($a_xml_parser, $a_name)
 End element handler. More...
 
 handlerCharacterData ($a_xml_parser, $a_data)
 handler for character data More...
 
 __save ()
 
 __assignMembers ()
 
 __parseId ($a_id)
 
 setMode ($mode)
 
 __initContainerSorting ($a_attribs, $a_group_id)
 
- Public Member Functions inherited from ilMDSaxParser
 __construct ($a_xml_file='')
 Constructor. More...
 
 enableMDParsing ($a_status)
 
 getMDParsingStatus ()
 
 setMDObject (&$md)
 
getMDObject ()
 
 inMetaData ()
 
 setHandlers ($a_xml_parser)
 set event handlers More...
 
 handlerBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element More...
 
 handlerEndTag ($a_xml_parser, $a_name)
 handler for end of element More...
 
 handlerCharacterData ($a_xml_parser, $a_data)
 handler for character data More...
 
 __getCharacterData ()
 
 __pushParent (&$md_obj)
 
 __popParent ()
 
 __getParent ()
 
 __construct ($a_xml_file='')
 Constructor. More...
 
 setMDObject (&$md)
 
 inMetaData ()
 
 handlerBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element More...
 
 handlerEndTag ($a_xml_parser, $a_name)
 handler for end of element More...
 
 handlerCharacterData ($a_xml_parser, $a_data)
 handler for character data More...
 
 __getCharacterData ()
 
 __pushParent (&$md_obj)
 
__popParent ()
 
__getParent ()
 
- Public Member Functions inherited from ilSaxParser
 __construct ($a_xml_file='', $throwException=false)
 Constructor setup ILIAS global object public. More...
 
 setXMLContent ($a_xml_content)
 
 getXMLContent ()
 
 getInputType ()
 
 startParsing ()
 stores xml data in array More...
 
 createParser ()
 create parser More...
 
 setOptions ($a_xml_parser)
 set parser options More...
 
 setHandlers ($a_xml_parser)
 set event handler should be overwritten by inherited class private More...
 
 openXMLFile ()
 open xml file More...
 
 parse ($a_xml_parser, $a_fp=null)
 parse xml file More...
 
 freeParser ($a_xml_parser)
 free xml parser handle More...
 
 setThrowException ($throwException)
 set error handling More...
 
- Public Member Functions inherited from PEAR
 __construct ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). More...
 
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes. More...
 
 isError ($data, $code=null)
 Tell whether a value is a PEAR error. More...
 
 expectError ($code=' *')
 This method is used to tell which errors you expect to get. More...
 
 popExpect ()
 This method pops one element off the expected error codes stack. More...
 
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available. More...
 
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack. More...
 
raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
 This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. More...
 
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options. More...
 
 staticPushErrorHandling ($mode, $options=null)
 
 staticPopErrorHandling ()
 
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack. More...
 
 popErrorHandling ()
 Pop the last error handler used. More...
 
 loadExtension ($ext)
 OS independant PHP extension load. More...
 

Data Fields

 $group_data
 
 $parent
 
 $counter
 
 $mode
 
 $grp
 
- Data Fields inherited from ilMDSaxParser
 $md_in_md = false
 
 $md_chr_data = ''
 
 $md_cur_el = null
 
 $md_parsing_enabled = null
 
 $md = null
 
 $md_gen
 
- Data Fields inherited from ilSaxParser
 $input_type = null
 
 $xml_content = ''
 
 $ilias
 
 $lng
 
 $xml_file
 
 $throwException = false
 
- Data Fields inherited from PEAR
 $_debug = false
 
 $_default_error_mode = null
 
 $_default_error_options = null
 
 $_default_error_handler = ''
 
 $_error_class = 'PEAR_Error'
 
 $_expected_errors = array()
 

Static Public Attributes

static $CREATE = 1
 
static $UPDATE = 2
 

Protected Attributes

 $log
 
 $sax_controller = null
 
 $advanced_md_value_parser = null
 
- Protected Attributes inherited from ilMDSaxParser
 $meta_log
 

Private Attributes

 $group_obj
 
 $lom_parsing_active = false
 
 $participants = null
 
 $current_container_setting
 
 $sort = null
 

Additional Inherited Members

- Static Public Member Functions inherited from PEAR
static & getStaticProperty ($class, $var)
 If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them. More...
 
static setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. More...
 
- Protected Member Functions inherited from ilMDSaxParser
 trimAndStripAttribs (array $attribs)
 
 trimAndStrip (string $input)
 
- Protected Member Functions inherited from ilSaxParser
 handleError ($message, $code)
 use given error handler to handle error message or internal ilias error message handle More...
 

Detailed Description

Group Import Parser.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id
class.ilGroupXMLParser.php 15678 2008-01-06 20:40:55Z akill

Definition at line 36 of file class.ilGroupXMLParser.php.

Constructor & Destructor Documentation

◆ __construct()

ilGroupXMLParser::__construct ( ilObjGroup  $group,
  $a_xml,
  $a_parent_id 
)

Constructor.

Parameters
string$a_xml_filexml file

public ilGroupXMLParser constructor.

Parameters
ilObjGroup$group
string$a_xml
int$a_parent_id

Definition at line 97 of file class.ilGroupXMLParser.php.

References $CREATE, $GLOBALS, ILIAS\GlobalScreen\Provider\__construct(), __pushParentId(), ilMDSaxParser\setMDObject(), and ilSaxParser\setXMLContent().

98  {
99  define('EXPORT_VERSION', 2);
100 
101  parent::__construct(null);
102 
103  $this->sax_controller = new ilSaxController();
104 
105  $this->mode = ilGroupXMLParser::$CREATE;
106  $this->group_obj = $group;
107  $this->log = $GLOBALS['DIC']->logger()->grp();
108 
109  $this->setXMLContent($a_xml);
110 
111  // init md parsing
112  $this->setMDObject(
113  new ilMD(
114  $this->group_obj->getId(),
115  $this->group_obj->getId(),
116  $this->group_obj->getType()
117  )
118  );
119 
120  // SET MEMBER VARIABLES
121  $this->__pushParentId($a_parent_id);
122  }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
Controller class for sax element handlers.
__construct(Container $dic, ilPlugin $plugin)
setXMLContent($a_xml_content)
+ Here is the call graph for this function:

Member Function Documentation

◆ __assignMembers()

ilGroupXMLParser::__assignMembers ( )

Definition at line 604 of file class.ilGroupXMLParser.php.

References $DIC, ilSaxParser\$ilias, $ilSetting, $ilUser, __parseId(), ilGroupParticipants\add(), IL_GRP_ADMIN, and IL_GRP_MEMBER.

Referenced by __save().

605  {
606  global $DIC;
607 
608  $ilias = $DIC['ilias'];
609  $ilUser = $DIC['ilUser'];
610  $ilSetting = $DIC['ilSetting'];
611 
612  $this->participants = new ilGroupParticipants($this->group_obj->getId());
613  $this->participants->add($ilUser->getId(), IL_GRP_ADMIN);
614  $this->participants->updateNotification($ilUser->getId(), $ilSetting->get('mail_grp_admin_notification', true));
615 
616  // attach ADMINs
617  if (isset($this->group_data["admin"]["attach"]) && count($this->group_data["admin"]["attach"])) {
618  foreach ($this->group_data["admin"]["attach"] as $user) {
619  if ($id_data = $this->__parseId($user)) {
620  if ($id_data['local'] or $id_data['imported']) {
621  $this->participants->add($id_data['usr_id'], IL_GRP_ADMIN);
622  if (in_array($user, (array) $this->group_data['notifications'])) {
623  $this->participants->updateNotification($id_data['usr_id'], true);
624  }
625  }
626  }
627  }
628  }
629  // detach ADMINs
630  if (isset($this->group_data["admin"]["detach"]) && count($this->group_data["admin"]["detach"])) {
631  foreach ($this->group_data["admin"]["detach"] as $user) {
632  if ($id_data = $this->__parseId($user)) {
633  if ($id_data['local'] or $id_data['imported']) {
634  if ($this->participants->isAssigned($id_data['usr_id'])) {
635  $this->participants->delete($id_data['usr_id']);
636  }
637  }
638  }
639  }
640  }
641  // MEMBER
642  if (isset($this->group_data["member"]["attach"]) && count($this->group_data["member"]["attach"])) {
643  foreach ($this->group_data["member"]["attach"] as $user) {
644  if ($id_data = $this->__parseId($user)) {
645  if ($id_data['local'] or $id_data['imported']) {
646  $this->participants->add($id_data['usr_id'], IL_GRP_MEMBER);
647  }
648  }
649  }
650  }
651 
652  if (isset($this->group_data["member"]["detach"]) && count($this->group_data["member"]["detach"])) {
653  foreach ($this->group_data["member"]["detach"] as $user) {
654  if ($id_data = $this->__parseId($user)) {
655  if ($id_data['local'] or $id_data['imported']) {
656  if ($this->participants->isAssigned($id_data['usr_id'])) {
657  $this->participants->delete($id_data['usr_id']);
658  }
659  }
660  }
661  }
662  }
663  return true;
664  }
const IL_GRP_ADMIN
const IL_GRP_MEMBER
add($a_usr_id, $a_role)
Add user to role.
global $DIC
Definition: goto.php:24
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __getParentId()

ilGroupXMLParser::__getParentId ( )

Definition at line 134 of file class.ilGroupXMLParser.php.

Referenced by __save().

135  {
136  return $this->parent[count($this->parent) - 1];
137  }
+ Here is the caller graph for this function:

◆ __initContainerSorting()

ilGroupXMLParser::__initContainerSorting (   $a_attribs,
  $a_group_id 
)

Definition at line 703 of file class.ilGroupXMLParser.php.

References ilContainerSortingSettings\_importContainerSortingSettings().

Referenced by __save(), and handlerBeginTag().

704  {
705  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
707  }
static _importContainerSortingSettings($attibs, $obj_id)
sorting import for all container objects
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __parseId()

ilGroupXMLParser::__parseId (   $a_id)

Definition at line 666 of file class.ilGroupXMLParser.php.

References $DIC, $GLOBALS, ilSaxParser\$ilias, ilObjUser\_getImportedUserId(), and ilObjUser\_lookupName().

Referenced by __assignMembers().

667  {
668  global $DIC;
669 
670  $ilias = $DIC['ilias'];
671 
672  $fields = explode('_', $a_id);
673 
674  if (!is_array($fields) or
675  $fields[0] != 'il' or
676  !is_numeric($fields[1]) or
677  $fields[2] != 'usr' or
678  !is_numeric($fields[3])) {
679  return false;
680  }
681  if ($id = ilObjUser::_getImportedUserId($a_id)) {
682  return array('imported' => true,
683  'local' => false,
684  'usr_id' => $id);
685  }
686  if (($fields[1] == $ilias->getSetting('inst_id', 0)) and ($user = ilObjUser::_lookupName($fields[3]))) {
687  if (strlen($user['login'])) {
688  return array('imported' => false,
689  'local' => true,
690  'usr_id' => $fields[3]);
691  }
692  }
693  $GLOBALS['DIC']->logger()->grp()->warning('Parsing id failed: ' . $a_id);
694  return false;
695  }
static _lookupName($a_user_id)
lookup user name
static _getImportedUserId($i2_id)
global $DIC
Definition: goto.php:24
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __popParentId()

ilGroupXMLParser::__popParentId ( )

Definition at line 128 of file class.ilGroupXMLParser.php.

129  {
130  array_pop($this->parent);
131 
132  return true;
133  }

◆ __pushParentId()

ilGroupXMLParser::__pushParentId (   $a_id)

Definition at line 124 of file class.ilGroupXMLParser.php.

Referenced by __construct(), and __save().

125  {
126  $this->parent[] = $a_id;
127  }
+ Here is the caller graph for this function:

◆ __save()

ilGroupXMLParser::__save ( )

mode can be create or update

Definition at line 435 of file class.ilGroupXMLParser.php.

References $CREATE, Vendor\Package\$e, __assignMembers(), ilUtil\__extractId(), __getParentId(), __initContainerSorting(), __pushParentId(), GRP_REGISTRATION_DEACTIVATED, GRP_REGISTRATION_DIRECT, GRP_REGISTRATION_PASSWORD, GRP_REGISTRATION_REQUEST, GRP_TYPE_CLOSED, GRP_TYPE_OPEN, IL_CAL_UNIX, and IL_INST_ID.

Referenced by handlerEndTag().

436  {
437  if ($this->group_imported) {
438  return true;
439  }
440 
441  $this->group_obj->setImportId($this->group_data["id"]);
442  $this->group_obj->setTitle($this->group_data["title"]);
443  $this->group_obj->setDescription($this->group_data["description"]);
444  $this->group_obj->setInformation((string) $this->group_data['information']);
445 
446  if (
447  $this->group_data['period_start'] &&
448  $this->group_data['period_end']) {
449  try {
450  if ($this->group_data['period_with_time']) {
451  $this->group_obj->setPeriod(
452  new \ilDateTime($this->group_data['period_start'], IL_CAL_UNIX),
453  new \ilDateTime($this->group_data['period_end'], IL_CAL_UNIX)
454  );
455  } else {
456  $this->group_obj->setPeriod(
457  new \ilDateTime($this->group_data['period_start'], IL_CAL_UNIX),
458  new \ilDateTime($this->group_data['period_end'], IL_CAL_UNIX)
459  );
460  }
461  } catch (Exception $e) {
462  $this->log->warning('Ignoring invalid group period settings: ');
463  $this->log->warning('Period start: ' . $this->group_data['period_start']);
464  $this->log->warning('Period end: ' . $this->group_data['period_end']);
465  }
466  }
467 
468  $ownerChanged = false;
469  if (isset($this->group_data["owner"])) {
470  $owner = $this->group_data["owner"];
471  if (!is_numeric($owner)) {
472  $owner = ilUtil::__extractId($owner, IL_INST_ID);
473  }
474  if (is_numeric($owner) && $owner > 0) {
475  $this->group_obj->setOwner($owner);
476  $ownerChanged = true;
477  }
478  }
479 
483  if ($this->mode == ilGroupXMLParser::$CREATE) {
484  $this->group_obj->createReference();
485  $this->group_obj->putInTree($this->__getParentId());
486  $this->group_obj->setPermissions($this->__getParentId());
487  if (
488  array_key_exists('type', $this->group_data) &&
489  $this->group_data['type'] == 'closed'
490  ) {
491  $this->group_obj->updateGroupType(GRP_TYPE_CLOSED);
492  }
493  } else {
494  if (
495  array_key_exists('type', $this->group_data) &&
496  $this->group_data['type'] == 'closed'
497  ) {
498  $this->group_obj->updateGroupType(GRP_TYPE_CLOSED);
499  } elseif (
500  array_key_exists('type', $this->group_data) &&
501  $this->group_data['type'] == 'open'
502  ) {
503  $this->group_obj->updateGroupType(GRP_TYPE_OPEN);
504  }
505  }
506  // SET GROUP SPECIFIC DATA
507  switch ($this->group_data['registration_type']) {
508  case 'direct':
509  case 'enabled':
510  $flag = GRP_REGISTRATION_DIRECT;
511  break;
512 
513  case 'disabled':
515  break;
516 
517  case 'confirmation':
518  $flag = GRP_REGISTRATION_REQUEST;
519  break;
520 
521  case 'password':
523  break;
524 
525  default:
526  $flag = GRP_REGISTRATION_DIRECT;
527  }
528  $this->group_obj->setRegistrationType($flag);
529 
530 
531  $registration_end = null;
532  if ($this->group_data['expiration_end']) {
533  $registration_end = new ilDateTime($this->group_data['expiration_end'], IL_CAL_UNIX);
534  }
535 
536  $registration_start = null;
537  if ($this->group_data['expiration_start']) {
538  $registration_start = new ilDateTime($this->group_data['expiration_start'], IL_CAL_UNIX);
539  }
540  if (
541  $registration_start instanceof ilDateTime &&
542  $registration_end instanceof ilDateTime
543  ) {
544  $this->group_obj->enableUnlimitedRegistration(false);
545  $this->group_obj->setRegistrationStart($registration_start);
546  $this->group_obj->setRegistrationEnd($registration_end);
547  } else {
548  $this->group_obj->enableUnlimitedRegistration(true);
549  }
550  $this->group_obj->setPassword($this->group_data['password']);
551  $this->group_obj->enableMembershipLimitation($this->group_data['max_members_enabled']);
552  $this->group_obj->setMaxMembers($this->group_data['max_members'] ? $this->group_data['max_members'] : 0);
553  $this->group_obj->enableWaitingList($this->group_data['waiting_list_enabled']);
554 
555  $this->group_obj->setWaitingListAutoFill($this->group_data['auto_wait']);
556  $this->group_obj->setCancellationEnd($this->group_data['cancel_end']);
557  $this->group_obj->setMinMembers($this->group_data['min_members']);
558  $this->group_obj->setShowMembers($this->group_data['show_members'] ? $this->group_data['show_members'] : 0);
559  $this->group_obj->setAutoNotification($this->group_data['auto_notification'] ? true : false);
560  $this->group_obj->setMailToMembersType((int) $this->group_data['mail_members_type']);
561 
562  $this->group_obj->enableRegistrationAccessCode((bool) $this->group_data['registration_code_enabled'] ?? false);
563  $this->group_obj->setRegistrationAccessCode((string) $this->group_data['registration_code'] ?? '');
564 
565  if (isset($this->group_data['view_mode'])) {
566  $this->group_obj->setViewMode((int) $this->group_data['view_mode']);
567  }
568  if (isset($this->group_data['session_limit'])) {
569  $this->group_obj->enableSessionLimit((bool) $this->group_data['session_limit']);
570  }
571  if (isset($this->group_data['session_previous'])) {
572  $this->group_obj->setNumberOfPreviousSessions((int) $this->group_data['session_previous']);
573  }
574  if (isset($this->group_data['session_next'])) {
575  $this->group_obj->setNumberOfNextSessions((int) $this->group_data['session_next']);
576  }
577 
578  $this->group_obj->setEnableGroupMap((bool) $this->group_data['map_enabled'] ?? false);
579  $this->group_obj->setLatitude((string) $this->group_data['map_latitude'] ?? '');
580  $this->group_obj->setLongitude((string) $this->group_data['map_longitude'] ?? '');
581  $this->group_obj->setLocationZoom((int) $this->group_data['map_location_zoom'] ?? 0);
582 
583  /*
584  * readContainerSettings needs to be called before update, otherwise container
585  * settings are overwritten by the default, see #24742.
586  */
587  $this->group_obj->readContainerSettings();
588  $this->group_obj->update();
589 
590  // ASSIGN ADMINS/MEMBERS
591  $this->__assignMembers();
592 
593  $this->__pushParentId($this->group_obj->getRefId());
594 
595  if ($this->sort) {
596  $this->__initContainerSorting($this->sort, $this->group_obj->getId());
597  }
598 
599  $this->group_imported = true;
600 
601  return true;
602  }
const GRP_TYPE_OPEN
const IL_INST_ID
Definition: constants.php:38
const GRP_REGISTRATION_DEACTIVATED
const IL_CAL_UNIX
const GRP_REGISTRATION_PASSWORD
const GRP_REGISTRATION_REQUEST
const GRP_TYPE_CLOSED
__initContainerSorting($a_attribs, $a_group_id)
const GRP_REGISTRATION_DIRECT
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handlerBeginTag()

ilGroupXMLParser::handlerBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

handler for begin of element

Implements ilSaxSubsetParser.

Definition at line 180 of file class.ilGroupXMLParser.php.

References $DIC, $GLOBALS, $ilErr, __initContainerSorting(), and ilMDSaxParser\trimAndStripAttribs().

181  {
182  global $DIC;
183 
184  $a_attribs = $this->trimAndStripAttribs($a_attribs);
185 
186  $ilErr = $DIC['ilErr'];
187 
188  if ($this->lom_parsing_active) {
189  parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
190  return;
191  }
192 
193  switch ($a_name) {
194  case "MetaData":
195  $this->lom_parsing_active = true;
196  parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
197  break;
198 
199 
200  // GROUP DATA
201  case "group":
202  $this->group_data["admin"] = array();
203  $this->group_data["member"] = array();
204 
205  $this->group_data["type"] = $a_attribs["type"];
206  $this->group_data["id"] = $a_attribs["id"];
207 
208  break;
209 
210  case 'title':
211  break;
212 
213  case "owner":
214  $this->group_data["owner"] = $a_attribs["id"];
215  break;
216 
217  case 'registration':
218  $this->group_data['registration_type'] = $a_attribs['type'];
219  $this->group_data['waiting_list_enabled'] = $a_attribs['waitingList'] == 'Yes' ? true : false;
220  break;
221 
222  case 'period':
223  $this->in_period = true;
224  $this->group_data['period_with_time'] = $a_attribs['withTime'];
225  break;
226 
227  case 'maxMembers':
228  $this->group_data['max_members_enabled'] = $a_attribs['enabled'] == 'Yes' ? true : false;
229  break;
230 
231  case "admin":
232  if (!isset($a_attribs['action']) || $a_attribs['action'] == "Attach") {
233  $this->group_data["admin"]["attach"][] = $a_attribs["id"];
234  } elseif (isset($a_attribs['action']) || $a_attribs['action'] == "Detach") {
235  $this->group_data["admin"]["detach"][] = $a_attribs["id"];
236  }
237 
238  if (isset($a_attribs['notification']) and $a_attribs['notification'] == 'Yes') {
239  $this->group_data['notifications'][] = $a_attribs['id'];
240  }
241 
242  break;
243 
244  case "member":
245  if (!isset($a_attribs['action']) || $a_attribs['action'] == "Attach") {
246  $GLOBALS['DIC']->logger()->grp()->debug('New member with id ' . $a_attribs['id']);
247  $this->group_data["member"]["attach"][] = $a_attribs["id"];
248  } elseif (isset($a_attribs['action']) || $a_attribs['action'] == "Detach") {
249  $GLOBALS['DIC']->logger()->grp()->debug('Deprecated member with id ' . $a_attribs['id']);
250  $this->group_data["member"]["detach"][] = $a_attribs["id"];
251  }
252 
253  break;
254 
255  case 'ContainerSetting':
256  $this->current_container_setting = $a_attribs['id'];
257  break;
258 
259  case 'Sort':
260 
261  if ($this->group_imported) {
262  $this->__initContainerSorting($a_attribs, $this->group_obj->getId());
263  } else {
264  $this->sort = $a_attribs;
265  }
266  break;
267 
268 
269  case 'SessionLimit':
270  if (isset($a_attribs['active'])) {
271  $this->group_data['session_limit'] = (bool) $a_attribs['active'];
272  }
273  if (isset($a_attribs['previous'])) {
274  $this->group_data['session_previous'] = (int) $a_attribs['previous'];
275  }
276  if (isset($a_attribs['next'])) {
277  $this->group_data['session_next'] = (int) $a_attribs['next'];
278  }
279  break;
280 
281  case 'GroupMap':
282  $this->group_data['map_enabled'] = (bool) $a_attribs['enabled'] ?? false;
283  $this->group_data['map_latitude'] = (string) $a_attribs['latitude'] ?? '';
284  $this->group_data['map_longitude'] = (string) $a_attribs['longitude'] ?? '';
285  $this->group_data['map_location_zoom'] = (int) $a_attribs['location_zoom'] ?? 0;
286  break;
287 
288  case 'RegistrationAccessCode':
289  $this->group_data['registration_code_enabled'] = (bool) $a_attribs['enabled'] ?? false;
290  $this->group_data['registration_code'] = (string) $a_attribs['code'] ?? '';
291  break;
292 
293  case 'WaitingListAutoFill':
294  case 'CancellationEnd':
295  case 'minMembers':
296  case 'mailMembersType':
297  break;
298  }
299  }
trimAndStripAttribs(array $attribs)
$ilErr
Definition: raiseError.php:18
global $DIC
Definition: goto.php:24
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
__initContainerSorting($a_attribs, $a_group_id)
+ Here is the call graph for this function:

◆ handlerCharacterData()

ilGroupXMLParser::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

handler for character data

Implements ilSaxSubsetParser.

Definition at line 420 of file class.ilGroupXMLParser.php.

421  {
422  if ($this->lom_parsing_active) {
423  parent::handlerCharacterData($a_xml_parser, $a_data);
424  }
425 
426  $a_data = str_replace("<", "&lt;", $a_data);
427  $a_data = str_replace(">", "&gt;", $a_data);
428 
429  if (!empty($a_data)) {
430  $this->cdata .= $a_data;
431  }
432  }

◆ handlerEndTag()

ilGroupXMLParser::handlerEndTag (   $a_xml_parser,
  $a_name 
)

End element handler.

public

Parameters
resource$a_xml_parserxml parser
string$a_nameelement name

Implements ilSaxSubsetParser.

Definition at line 302 of file class.ilGroupXMLParser.php.

References $current_container_setting, __save(), ilContainer\_writeContainerSetting(), IL_CAL_UNIX, and ilMDSaxParser\trimAndStrip().

303  {
304  $this->cdata = $this->trimAndStrip((string) $this->cdata);
305 
306  if ($this->lom_parsing_active) {
307  parent::handlerEndTag($a_xml_parser, $a_name);
308  }
309 
310  switch ($a_name) {
311  case 'MetaData':
312  $this->lom_parsing_active = false;
313  parent::handlerEndTag($a_xml_parser, $a_name);
314  break;
315 
316 
317  case "title":
318  $this->group_data["title"] = trim($this->cdata);
319  break;
320 
321  case "description":
322  $this->group_data["description"] = trim($this->cdata);
323  break;
324 
325  case 'information':
326  $this->group_data['information'] = trim($this->cdata);
327  break;
328 
329  case 'password':
330  $this->group_data['password'] = trim($this->cdata);
331  break;
332 
333  case 'maxMembers':
334  $this->group_data['max_members'] = trim($this->cdata);
335  break;
336 
337  case 'expiration':
338  $this->group_data['expiration_end'] = trim($this->cdata);
339  break;
340 
341  case 'start':
342  if ($this->in_period) {
343  $this->group_data['period_start'] = trim($this->cdata);
344  } else {
345  $this->group_data['expiration_start'] = trim($this->cdata);
346  }
347  break;
348 
349  case 'end':
350  if ($this->in_period) {
351  $this->group_data['period_end'] = trim($this->cdata);
352  } else {
353  $this->group_data['expiration_end'] = trim($this->cdata);
354  }
355  break;
356 
357  case 'period':
358  $this->in_period = false;
359  break;
360 
361  case "group":
362  // NOW SAVE THE NEW OBJECT (if it hasn't been imported)
363  $this->__save();
364  break;
365 
366  case 'ContainerSetting':
367  if ($this->current_container_setting) {
369  $this->group_obj->getId(),
371  trim($this->cdata)
372  );
373  }
374  break;
375 
376  case 'WaitingListAutoFill':
377  $this->group_data['auto_wait'] = trim($this->cdata);
378  break;
379 
380  case 'CancellationEnd':
381  if ((int) $this->cdata) {
382  $this->group_data['cancel_end'] = new ilDate((int) $this->cdata, IL_CAL_UNIX);
383  }
384  break;
385 
386  case 'minMembers':
387  if ((int) $this->cdata) {
388  $this->group_data['min_members'] = (int) $this->cdata;
389  }
390  break;
391 
392  case 'showMembers':
393  if ((int) $this->cdata) {
394  $this->group_data['show_members'] = (int) $this->cdata;
395  }
396  break;
397 
398  case 'admissionNotification':
399  if ((int) $this->cdata) {
400  $this->group_data['auto_notification'] = (bool) $this->cdata;
401  }
402  break;
403 
404  case 'mailMembersType':
405  $this->group_data['mail_members_type'] = (int) $this->cdata;
406  break;
407 
408  case 'ViewMode':
409  $this->group_data['view_mode'] = (int) $this->cdata;
410  break;
411 
412  }
413  $this->cdata = '';
414  }
trimAndStrip(string $input)
const IL_CAL_UNIX
Class for single dates.
static _writeContainerSetting($a_id, $a_keyword, $a_value)
+ Here is the call graph for this function:

◆ setHandlers()

ilGroupXMLParser::setHandlers (   $a_xml_parser)

set event handlers

Parameters
resourcereference to the xml parser public

Definition at line 146 of file class.ilGroupXMLParser.php.

147  {
148  $this->sax_controller->setHandlers($a_xml_parser);
149  $this->sax_controller->setDefaultElementHandler($this);
150 
151  $this->advanced_md_value_parser = new ilAdvancedMDValueParser(
152  $this->group_obj->getId()
153  );
154 
155  $this->sax_controller->setElementHandler(
156  $this->advanced_md_value_parser,
157  'AdvancedMetaData'
158  );
159  }

◆ setMode()

ilGroupXMLParser::setMode (   $mode)

Definition at line 698 of file class.ilGroupXMLParser.php.

References $mode.

699  {
700  $this->mode = $mode;
701  }

◆ startParsing()

ilGroupXMLParser::startParsing ( )

start the parser

Definition at line 165 of file class.ilGroupXMLParser.php.

References $CREATE.

166  {
167  parent::startParsing();
168 
169  if ($this->mode == ilGroupXMLParser::$CREATE) {
170  return is_object($this->group_obj) ? $this->group_obj->getRefId() : false;
171  } else {
172  return is_object($this->group_obj) ? $this->group_obj->update() : false;
173  }
174  }

Field Documentation

◆ $advanced_md_value_parser

ilGroupXMLParser::$advanced_md_value_parser = null
protected

Definition at line 66 of file class.ilGroupXMLParser.php.

◆ $counter

ilGroupXMLParser::$counter

Definition at line 77 of file class.ilGroupXMLParser.php.

◆ $CREATE

ilGroupXMLParser::$CREATE = 1
static

Definition at line 38 of file class.ilGroupXMLParser.php.

Referenced by __construct(), __save(), and startParsing().

◆ $current_container_setting

ilGroupXMLParser::$current_container_setting
private

Definition at line 70 of file class.ilGroupXMLParser.php.

Referenced by handlerEndTag().

◆ $group_data

ilGroupXMLParser::$group_data

Definition at line 73 of file class.ilGroupXMLParser.php.

◆ $group_obj

ilGroupXMLParser::$group_obj
private

Definition at line 49 of file class.ilGroupXMLParser.php.

◆ $grp

ilGroupXMLParser::$grp

Definition at line 80 of file class.ilGroupXMLParser.php.

◆ $log

ilGroupXMLParser::$log
protected

Definition at line 44 of file class.ilGroupXMLParser.php.

◆ $lom_parsing_active

ilGroupXMLParser::$lom_parsing_active = false
private

Definition at line 54 of file class.ilGroupXMLParser.php.

◆ $mode

ilGroupXMLParser::$mode

Definition at line 79 of file class.ilGroupXMLParser.php.

Referenced by setMode().

◆ $parent

ilGroupXMLParser::$parent

Definition at line 76 of file class.ilGroupXMLParser.php.

◆ $participants

ilGroupXMLParser::$participants = null
private

Definition at line 69 of file class.ilGroupXMLParser.php.

◆ $sax_controller

ilGroupXMLParser::$sax_controller = null
protected

Definition at line 60 of file class.ilGroupXMLParser.php.

◆ $sort

ilGroupXMLParser::$sort = null
private

Definition at line 71 of file class.ilGroupXMLParser.php.

◆ $UPDATE

ilGroupXMLParser::$UPDATE = 2
static

The documentation for this class was generated from the following file: