ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilCourseXMLParser Class Reference

Course XML Parser. More...

+ Inheritance diagram for ilCourseXMLParser:
+ Collaboration diagram for ilCourseXMLParser:

Public Member Functions

 __construct (ilObjCourse $a_course_obj, string $a_xml_file='')
 
 setMode (int $a_mode)
 
 getMode ()
 
 startParsing ()
 
 setHandlers ($a_xml_parser)
 
 handlerBeginTag ($a_xml_parser, string $a_name, array $a_attribs)
 
 __parseId ($a_id)
 
 handlerEndTag ($a_xml_parser, string $a_name)
 
 handlerCharacterData ($a_xml_parser, string $a_data)
 Character data handler. More...
 
- Public Member Functions inherited from ilMDSaxParser
 __construct (?string $a_xml_file='')
 
 enableMDParsing (bool $a_status)
 
 getMDParsingStatus ()
 
 setMDObject (ilMD $md)
 
 getMDObject ()
 
 inMetaData ()
 
 setHandlers ($a_xml_parser)
 Set event handlers. More...
 
 handlerBeginTag ($a_xml_parser, string $a_name, array $a_attribs)
 
 handlerEndTag ($a_xml_parser, string $a_name)
 
 handlerCharacterData ($a_xml_parser, string $a_data)
 
 __getCharacterData ()
 
 __pushParent (object $md_obj)
 
 __popParent ()
 
 __getParent ()
 
- Public Member Functions inherited from ilSaxParser
 __construct (?string $path_to_file='', ?bool $throw_exception=false)
 
 setXMLContent (string $a_xml_content)
 
 getXMLContent ()
 
 getInputType ()
 
 startParsing ()
 stores xml data in array More...
 
 createParser ()
 
 setHandlers ($a_xml_parser)
 
 parse ($a_xml_parser, $a_fp=null)
 

Data Fields

const MODE_SOAP = 1
 
const MODE_EXPORT = 2
 
- Data Fields inherited from ilSaxParser
string $xml_file
 
bool $throw_exception = false
 

Protected Attributes

ilSetting $setting
 
ilMD $md_obj = null
 
ilSaxController $sax_controller
 
ilCourseParticipants $course_members
 
ilCourseWaitingList $course_waiting_list
 
ilAdvancedMDValueParser $adv_md_handler = null
 
array $course_members_array = []
 
- Protected Attributes inherited from ilMDSaxParser
bool $md_in_md = false
 
string $md_chr_data = ''
 
ilMDIdentifier $md_ide = null
 
ilMDLanguage $md_lan = null
 
ilMDDescription $md_des = null
 
ilMDLifecycle $md_lif = null
 
ilMDContribute $md_con = null
 
ilMDEntity $md_ent = null
 
ilMDMetaMetadata $md_met = null
 
ilMDTechnical $md_tec = null
 
ilMDFormat $md_for = null
 
ilMDLocation $md_loc = null
 
ilMDRequirement $md_req = null
 
ilMDOrComposite $md_orc = null
 
ilMDEducational $md_edu = null
 
ilMDTypicalAgeRange $md_typ = null
 
ilMDRights $md_rig = null
 
ilMDRelation $md_rel = null
 
ilMDIdentifier_ $md_ide_ = null
 
ilMDAnnotation $md_ann = null
 
ilMDClassification $md_cla = null
 
ilMDTaxonPath $md_taxp = null
 
ilMDTaxon $md_tax = null
 
ilMDKeyword $md_key = null
 
array $md_parent = array()
 
ilMD $md = null
 
ilMDGeneral $md_gen = null
 
ilLogger $meta_log
 
- Protected Attributes inherited from ilSaxParser
ilLanguage $lng = null
 

Private Member Functions

 handleAdmin (array $a_attribs, array $id_data)
 attach or detach admin from course member More...
 
 handleTutor (array $a_attribs, array $id_data)
 
 handleMember (array $a_attribs, array $id_data)
 attach or detach user/member/admin from course member More...
 
 handleSubscriber (array $a_attribs, array $id_data)
 attach or detach members from subscribers More...
 
 handleWaitingList (array $a_attribs, array $id_data)
 attach or detach members from waitinglist More...
 

Private Attributes

int $mode = self::MODE_EXPORT
 
bool $in_meta_data = false
 
bool $in_availability = false
 
bool $in_registration = false
 
bool $in_period = false
 
bool $in_period_with_time = false
 
ilDateTime $period_start = null
 
ilDateTime $period_end = null
 
string $cdata = ''
 
string $current_container_setting = ''
 
ilObjCourse $course_obj
 
ilLogger $log
 

Additional Inherited Members

- Protected Member Functions inherited from ilMDSaxParser
 trimAndStripAttribs (array $attribs)
 
 trimAndStrip (string $input)
 
- Protected Member Functions inherited from ilSaxParser
 openXMLFile ()
 
 handleError (string $message)
 
 setThrowException (bool $throw_exception)
 

Detailed Description

Course XML Parser.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 26 of file class.ilCourseXMLParser.php.

Constructor & Destructor Documentation

◆ __construct()

ilCourseXMLParser::__construct ( ilObjCourse  $a_course_obj,
string  $a_xml_file = '' 
)

Definition at line 58 of file class.ilCourseXMLParser.php.

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ilCourseParticipants\_getInstanceByObjId(), and ilMDSaxParser\setMDObject().

59  {
60  global $DIC;
61 
62  parent::__construct($a_xml_file);
63  $this->sax_controller = new ilSaxController();
64  $this->log = $DIC->logger()->crs();
65  $this->setting = $DIC->settings();
66  $this->course_obj = $a_course_obj;
67  $this->course_members = ilCourseParticipants::_getInstanceByObjId($this->course_obj->getId());
68  $this->course_waiting_list = new ilCourseWaitingList($this->course_obj->getId());
69  // flip the array so we can use array_key_exists
70  $this->course_members_array = array_flip($this->course_members->getParticipants());
71 
72  $this->md_obj = new ilMD($this->course_obj->getId(), 0, 'crs');
73  $this->setMDObject($this->md_obj);
74  }
static _getInstanceByObjId(int $a_obj_id)
global $DIC
Definition: shib_login.php:22
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ __parseId()

ilCourseXMLParser::__parseId (   $a_id)

Definition at line 332 of file class.ilCourseXMLParser.php.

References $id, ilObjUser\_getImportedUserId(), and ilObjUser\_lookupLogin().

Referenced by handlerBeginTag().

332  : array
333  {
334  $fields = explode('_', $a_id);
335 
336  if (!is_array($fields) or
337  $fields[0] != 'il' or
338  !is_numeric($fields[1]) or
339  $fields[2] != 'usr' or
340  !is_numeric($fields[3])) {
341  return [];
342  }
343  if ($id = ilObjUser::_getImportedUserId($a_id)) {
344  return array('imported' => true,
345  'local' => false,
346  'usr_id' => $id
347  );
348  }
349  if ($fields[1] == $this->setting->get('inst_id', '0') && strlen(ilObjUser::_lookupLogin((int) $fields[3]))) {
350  return array('imported' => false,
351  'local' => true,
352  'usr_id' => (int) $fields[3]
353  );
354  }
355  return [];
356  }
static _getImportedUserId(string $i2_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static _lookupLogin(int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMode()

ilCourseXMLParser::getMode ( )

Definition at line 81 of file class.ilCourseXMLParser.php.

References $mode.

Referenced by handlerEndTag().

81  : int
82  {
83  return $this->mode;
84  }
+ Here is the caller graph for this function:

◆ handleAdmin()

ilCourseXMLParser::handleAdmin ( array  $a_attribs,
array  $id_data 
)
private

attach or detach admin from course member

Definition at line 361 of file class.ilCourseXMLParser.php.

References ilParticipants\IL_CRS_ADMIN.

Referenced by handlerBeginTag().

361  : void
362  {
363  if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach') {
364  // if action not set, or attach
365  if (!array_key_exists($id_data['usr_id'], $this->course_members_array)) {
366  // add only if member is not assigned yet
367  $this->course_members->add($id_data['usr_id'], ilParticipants::IL_CRS_ADMIN);
368  if (isset($a_attribs['notification']) && $a_attribs['notification'] == 'Yes') {
369  $this->course_members->updateNotification($id_data['usr_id'], true);
370  }
371  if (isset($a_attribs['passed']) && $a_attribs['passed'] == 'Yes') {
372  $this->course_members->updatePassed($id_data['usr_id'], true);
373  }
374  if (isset($a_attribs['contact']) && $a_attribs['contact'] == 'Yes') {
375  // default for new course admin/tutors is "no contact"
376  $this->course_members->updateContact($id_data['usr_id'], true);
377  }
378  $this->course_members_array[$id_data['usr_id']] = "added";
379  } else {
380  // update
381  if (isset($a_attribs['notification']) && $a_attribs['notification'] == 'Yes') {
382  $this->course_members->updateNotification($id_data['usr_id'], true);
383  }
384  if (isset($a_attribs['passed']) && $a_attribs['passed'] == 'Yes') {
385  $this->course_members->updatePassed($id_data['usr_id'], true);
386  }
387  if (isset($a_attribs['contact']) && $a_attribs['contact'] == 'Yes') {
388  $this->course_members->updateContact($id_data['usr_id'], true);
389  } elseif (isset($a_attribs['contact']) && $a_attribs['contact'] == 'No') {
390  $this->course_members->updateContact($id_data['usr_id'], false);
391  }
392  $this->course_members->updateBlocked($id_data['usr_id'], false);
393  }
394  } elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isAdmin($id_data['usr_id'])) {
395  // if action set and detach and is admin of course
396  $this->course_members->delete($id_data['usr_id']);
397  }
398  }
+ Here is the caller graph for this function:

◆ handleMember()

ilCourseXMLParser::handleMember ( array  $a_attribs,
array  $id_data 
)
private

attach or detach user/member/admin from course member

Definition at line 441 of file class.ilCourseXMLParser.php.

References ilParticipants\IL_CRS_MEMBER.

Referenced by handlerBeginTag().

441  : void
442  {
443  if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach') {
444  // if action not set, or set and attach
445  if (!array_key_exists($id_data['usr_id'], $this->course_members_array)) {
446  // add only if member is not yet assigned as tutor or admin
447  $this->course_members->add($id_data['usr_id'], ilParticipants::IL_CRS_MEMBER);
448  if (isset($a_attribs['blocked']) && $a_attribs['blocked'] == 'Yes') {
449  $this->course_members->updateBlocked($id_data['usr_id'], true);
450  }
451  if (isset($a_attribs['passed']) && $a_attribs['passed'] == 'Yes') {
452  $this->course_members->updatePassed($id_data['usr_id'], true);
453  }
454  $this->course_members_array[$id_data['usr_id']] = "added";
455  } else {
456  // the member does exist. Now update status etc. only
457  if (isset($a_attribs['blocked']) && $a_attribs['blocked'] == 'Yes') {
458  $this->course_members->updateBlocked($id_data['usr_id'], true);
459  }
460  if (isset($a_attribs['passed']) && $a_attribs['passed'] == 'Yes') {
461  $this->course_members->updatePassed($id_data['usr_id'], true);
462  }
463  }
464  } elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isMember($id_data['usr_id'])) {
465  // if action set and detach and is member of course
466  $this->course_members->delete($id_data['usr_id']);
467  }
468  }
+ Here is the caller graph for this function:

◆ handlerBeginTag()

ilCourseXMLParser::handlerBeginTag (   $a_xml_parser,
string  $a_name,
array  $a_attribs 
)

Implements ilSaxSubsetParser.

Definition at line 119 of file class.ilCourseXMLParser.php.

References __parseId(), ilContainerSortingSettings\_importContainerSortingSettings(), ilObject\_writeImportId(), ilContainerSortingSettings\getInstanceByObjId(), handleAdmin(), handleMember(), handleSubscriber(), handleTutor(), handleWaitingList(), ilCourseConstants\IL_CRS_SUBSCRIPTION_CONFIRMATION, ilCourseConstants\IL_CRS_SUBSCRIPTION_DEACTIVATED, ilCourseConstants\IL_CRS_SUBSCRIPTION_DIRECT, ilCourseConstants\IL_CRS_SUBSCRIPTION_LIMITED, ilCourseConstants\IL_CRS_SUBSCRIPTION_PASSWORD, ilCourseConstants\IL_CRS_SUBSCRIPTION_UNLIMITED, null, and ilMDSaxParser\trimAndStripAttribs().

119  : void
120  {
121  $a_attribs = $this->trimAndStripAttribs($a_attribs);
122  if ($this->in_meta_data) {
123  parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
124  return;
125  }
126 
127  switch ($a_name) {
128  case 'Course':
129  if (strlen($a_attribs['importId'] ?? '')) {
130  $this->log->write("CourseXMLParser: importId = " . $a_attribs['importId']);
131  $this->course_obj->setImportId($a_attribs['importId']);
132  ilObject::_writeImportId($this->course_obj->getId(), $a_attribs['importId']);
133  }
134  if (strlen($a_attribs['showMembers'] ?? '')) {
135  $this->course_obj->setShowMembers(
136  $a_attribs['showMembers'] == 'Yes'
137  );
138  }
139  break;
140 
141  case 'Admin':
142  if ($id_data = $this->__parseId($a_attribs['id'] ?? '')) {
143  if ($id_data['local'] or $id_data['imported']) {
144  $this->handleAdmin($a_attribs, $id_data);
145  }
146  }
147  break;
148 
149  case 'Tutor':
150  if ($id_data = $this->__parseId($a_attribs['id'] ?? '')) {
151  if ($id_data['local'] or $id_data['imported']) {
152  $this->handleTutor($a_attribs, $id_data);
153  }
154  }
155  break;
156 
157  case 'Member':
158  if ($id_data = $this->__parseId($a_attribs['id'] ?? '')) {
159  if ($id_data['local'] or $id_data['imported']) {
160  $this->handleMember($a_attribs, $id_data);
161  }
162  }
163  break;
164 
165  case 'Subscriber':
166  if ($id_data = $this->__parseId($a_attribs['id'] ?? '')) {
167  if ($id_data['local'] or $id_data['imported']) {
168  $this->handleSubscriber($a_attribs, $id_data);
169  }
170  }
171  break;
172 
173  case 'WaitingList':
174  if ($id_data = $this->__parseId($a_attribs['id'] ?? '')) {
175  if ($id_data['local'] or $id_data['imported']) {
176  $this->handleWaitingList($a_attribs, $id_data);
177  }
178  }
179  break;
180 
181  case 'Owner':
182  if ($id_data = $this->__parseId($a_attribs['id'] ?? '')) {
183  if ($id_data['local'] or $id_data['imported']) {
184  $this->course_obj->setOwner((int) ($id_data['usr_id'] ?? 0));
185  $this->course_obj->updateOwner();
186  }
187  }
188  break;
189 
190  case 'Settings':
191  break;
192  case 'Availability':
193  $this->in_availability = true;
194  break;
195 
196  case 'NotAvailable':
197  if ($this->in_availability) {
198  $this->course_obj->setOfflineStatus(true);
199  } elseif ($this->in_registration) {
200  $this->course_obj->setSubscriptionLimitationType(ilCourseConstants::IL_CRS_SUBSCRIPTION_DEACTIVATED);
201  }
202 
203  break;
204 
205  case 'Unlimited':
206  if ($this->in_availability) {
207  $this->course_obj->setOfflineStatus(false);
208  } elseif ($this->in_registration) {
209  $this->course_obj->setSubscriptionLimitationType(ilCourseConstants::IL_CRS_SUBSCRIPTION_UNLIMITED);
210  }
211 
212  break;
213  case 'TemporarilyAvailable':
214  if ($this->in_availability) {
215  $this->course_obj->setOfflineStatus(false);
216  } elseif ($this->in_registration) {
217  $this->course_obj->setSubscriptionLimitationType(ilCourseConstants::IL_CRS_SUBSCRIPTION_LIMITED);
218  }
219  break;
220 
221  case 'Start':
222  break;
223 
224  case 'End':
225  break;
226 
227  case 'Syllabus':
228  break;
229 
230  case 'TargetGroup':
231  break;
232 
233  case 'Contact':
234  break;
235 
236  case 'Name':
237  case 'Responsibility':
238  case 'Phone':
239  case 'Email':
240  case 'Consultation':
241  break;
242 
243  case 'Registration':
244  $this->in_registration = true;
245 
246  switch ($a_attribs['registrationType'] ?? '') {
247  case 'Confirmation':
248  $this->course_obj->setSubscriptionType(ilCourseConstants::IL_CRS_SUBSCRIPTION_CONFIRMATION);
249  break;
250 
251  case 'Direct':
252  $this->course_obj->setSubscriptionType(ilCourseConstants::IL_CRS_SUBSCRIPTION_DIRECT);
253  break;
254 
255  case 'Password':
256  $this->course_obj->setSubscriptionType(ilCourseConstants::IL_CRS_SUBSCRIPTION_PASSWORD);
257  break;
258  }
259 
260  $this->course_obj->setSubscriptionMaxMembers((int) ($a_attribs['maxMembers'] ?? 0));
261  $this->course_obj->enableSubscriptionMembershipLimitation($this->course_obj->getSubscriptionMaxMembers() > 0);
262  $this->course_obj->enableWaitingList(($a_attribs['waitingList'] ?? null) == 'Yes' ? true : false);
263  break;
264 
265  case 'Sort':
266  ilContainerSortingSettings::_importContainerSortingSettings($a_attribs, $this->course_obj->getId());
267 
268  //#17837
269  $this->course_obj->setOrderType(
270  ilContainerSortingSettings::getInstanceByObjId($this->course_obj->getId())->getSortMode()
271  );
272  break;
273 
274  case 'Disabled':
275  $this->course_obj->setSubscriptionLimitationType(ilCourseConstants::IL_CRS_SUBSCRIPTION_DEACTIVATED);
276  break;
277 
278  case "MetaData":
279  $this->in_meta_data = true;
280  parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
281  break;
282 
283  case 'ContainerSetting':
284  $this->current_container_setting = ($a_attribs['id'] ?? '');
285  break;
286 
287  case 'Period':
288  $this->in_period = true;
289  $this->in_period_with_time = (bool) ($a_attribs['withTime'] ?? false);
290  break;
291 
292  case 'WaitingListAutoFill':
293  case 'CancellationEnd':
294  case 'MinMembers':
295  case 'StatusDetermination':
296  case 'MailToMembersType':
297  break;
298 
299  case 'WelcomeMail':
300  if (array_key_exists('status', $a_attribs)) {
301  $this->course_obj->setAutoNotification((bool) $a_attribs['status']);
302  }
303  break;
304 
305  case 'CourseMap':
306  $this->course_obj->setEnableCourseMap((bool) $a_attribs['enabled'] ?? false);
307  $this->course_obj->setLatitude((string) $a_attribs['latitude'] ?? '');
308  $this->course_obj->setLongitude((string) $a_attribs['longitude'] ?? '');
309  $this->course_obj->setLocationZoom((int) $a_attribs['location_zoom'] ?? 0);
310  break;
311 
312  case 'TutorialSupportBlock':
313  if (isset($a_attribs['active'])) {
314  $this->course_obj->setTutorialSupportBlockSettingValue((int) $a_attribs['active']);
315  }
316  break;
317 
318  case 'SessionLimit':
319  if (isset($a_attribs['active'])) {
320  $this->course_obj->enableSessionLimit((bool) $a_attribs['active']);
321  }
322  if (isset($a_attribs['previous'])) {
323  $this->course_obj->setNumberOfPreviousSessions((int) $a_attribs['previous']);
324  }
325  if (isset($a_attribs['next'])) {
326  $this->course_obj->setNumberOfNextSessions((int) $a_attribs['next']);
327  }
328  break;
329  }
330  }
static _writeImportId(int $obj_id, string $import_id)
write import id to db (static)
handleWaitingList(array $a_attribs, array $id_data)
attach or detach members from waitinglist
handleAdmin(array $a_attribs, array $id_data)
attach or detach admin from course member
trimAndStripAttribs(array $attribs)
static _importContainerSortingSettings(array $attibs, int $obj_id)
sorting import for all container objects
handleSubscriber(array $a_attribs, array $id_data)
attach or detach members from subscribers
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
handleTutor(array $a_attribs, array $id_data)
handleMember(array $a_attribs, array $id_data)
attach or detach user/member/admin from course member
+ Here is the call graph for this function:

◆ handlerCharacterData()

ilCourseXMLParser::handlerCharacterData (   $a_xml_parser,
string  $a_name 
)

Character data handler.

Parameters
resource$a_xml_parserxml parser

Implements ilSaxSubsetParser.

Definition at line 684 of file class.ilCourseXMLParser.php.

684  : void
685  {
686  // call meta data handler
687  if ($this->in_meta_data) {
688  parent::handlerCharacterData($a_xml_parser, $a_data);
689  }
690  if ($a_data != "\n") {
691  // Replace multiple tabs with one space
692  $a_data = preg_replace("/\t+/", " ", $a_data);
693 
694  $this->cdata .= $a_data;
695  }
696  }

◆ handlerEndTag()

ilCourseXMLParser::handlerEndTag (   $a_xml_parser,
string  $a_name 
)

Implements ilSaxSubsetParser.

Definition at line 509 of file class.ilCourseXMLParser.php.

References $cdata, $current_container_setting, Vendor\Package\$e, ilContainer\_writeContainerSetting(), ilObjectTranslation\getInstance(), getMode(), IL_CAL_UNIX, and ilMDSaxParser\trimAndStrip().

509  : void
510  {
511  $this->cdata = $this->trimAndStrip((string) $this->cdata);
512  if ($this->in_meta_data) {
513  parent::handlerEndTag($a_xml_parser, $a_name);
514  }
515 
516  switch ($a_name) {
517  case 'Course':
518 
519  $this->log->write('CourseXMLParser: import_id = ' . $this->course_obj->getImportId());
520  /*
521  * This needs to be before MDUpdateListener, since otherwise container settings are
522  * overwritten by ilContainer::update in MDUpdateListener, see #24733.
523  */
524  $this->course_obj->readContainerSettings();
525  if ($this->getMode() === self::MODE_SOAP) {
526  $this->course_obj->MDUpdateListener('General');
527  $this->adv_md_handler->save();
528  }
529  // see #26169
530  $transl = ilObjectTranslation::getInstance($this->course_obj->getId());
531  if ($transl->getDefaultTitle() !== "") {
532  $this->course_obj->setTitle($transl->getDefaultTitle());
533  }
534  if ($transl->getDefaultDescription() !== "") {
535  $this->course_obj->setDescription($transl->getDefaultDescription());
536  }
537  $this->course_obj->update();
538  break;
539 
540  case 'Settings':
541  break;
542 
543  case 'Availability':
544  $this->in_availability = false;
545  break;
546 
547  case 'Registration':
548  $this->in_registration = false;
549  break;
550 
551  case 'Start':
552  if ($this->in_availability) {
553  $this->course_obj->setActivationStart((int) trim($this->cdata));
554  }
555  if ($this->in_registration) {
556  $this->course_obj->setSubscriptionStart((int) trim($this->cdata));
557  }
558  if ($this->in_period) {
559  if ((int) $this->cdata) {
560  if ($this->in_period_with_time) {
561  $this->period_start = new \ilDateTime((int) $this->cdata, IL_CAL_UNIX);
562  } else {
563  $this->period_start = new \ilDate((int) $this->cdata, IL_CAL_UNIX);
564  }
565  }
566  }
567  break;
568 
569  case 'End':
570  if ($this->in_availability) {
571  $this->course_obj->setActivationEnd((int) trim($this->cdata));
572  }
573  if ($this->in_registration) {
574  $this->course_obj->setSubscriptionEnd((int) trim($this->cdata));
575  }
576  if ($this->in_period) {
577  if ((int) $this->cdata) {
578  if ($this->in_period_with_time) {
579  $this->period_end = new \ilDateTime((int) $this->cdata, IL_CAL_UNIX);
580  } else {
581  $this->period_end = new \ilDate((int) $this->cdata, IL_CAL_UNIX);
582  }
583  }
584  }
585  break;
586 
587  case 'Syllabus':
588  $this->course_obj->setSyllabus(trim($this->cdata));
589  break;
590 
591  case 'TargetGroup':
592  $this->course_obj->setTargetGroup(trim($this->cdata));
593  break;
594 
595  case 'ImportantInformation':
596  $this->course_obj->setImportantInformation(trim($this->cdata));
597  break;
598 
599  case 'ViewMode':
600  $this->course_obj->setViewMode((int) trim($this->cdata));
601  break;
602 
603  case 'Name':
604  $this->course_obj->setContactName(trim($this->cdata));
605  break;
606 
607  case 'Responsibility':
608  $this->course_obj->setContactResponsibility(trim($this->cdata));
609  break;
610 
611  case 'Phone':
612  $this->course_obj->setContactPhone(trim($this->cdata));
613  break;
614 
615  case 'Email':
616  $this->course_obj->setContactEmail(trim($this->cdata));
617  break;
618 
619  case 'Consultation':
620  $this->course_obj->setContactConsultation(trim($this->cdata));
621  break;
622 
623  case 'Password':
624  $this->course_obj->setSubscriptionPassword(trim($this->cdata));
625  break;
626 
627  case 'MetaData':
628  $this->in_meta_data = false;
629  parent::handlerEndTag($a_xml_parser, $a_name);
630  break;
631 
632  case 'ContainerSetting':
633  if ($this->current_container_setting) {
635  $this->course_obj->getId(),
638  );
639  }
640  break;
641 
642  case 'Period':
643  $this->in_period = false;
644  try {
645  $this->course_obj->setCoursePeriod($this->period_start, $this->period_end);
646  } catch (Exception $e) {
647  $this->log->warning('invalid course period given');
648  }
649  break;
650 
651  case 'WaitingListAutoFill':
652  $this->course_obj->setWaitingListAutoFill((bool) $this->cdata);
653  break;
654 
655  case 'CancellationEnd':
656  if ((int) $this->cdata) {
657  $this->course_obj->setCancellationEnd(new ilDate((int) $this->cdata, IL_CAL_UNIX));
658  }
659  break;
660 
661  case 'MinMembers':
662  if ((int) $this->cdata) {
663  $this->course_obj->setSubscriptionMinMembers((int) $this->cdata);
664  }
665  break;
666 
667  case 'TimingMode':
668  $this->course_obj->setTimingMode((int) $this->cdata);
669  break;
670 
671  case 'StatusDetermination':
672  $this->course_obj->setStatusDetermination((int) $this->cdata);
673  break;
674 
675  case 'MailToMembersType':
676  $this->course_obj->setMailToMembersType((int) $this->cdata);
677  break;
678  }
679  $this->cdata = '';
680  }
trimAndStrip(string $input)
const IL_CAL_UNIX
static getInstance(int $obj_id)
static _writeContainerSetting(int $a_id, string $a_keyword, string $a_value)
+ Here is the call graph for this function:

◆ handleSubscriber()

ilCourseXMLParser::handleSubscriber ( array  $a_attribs,
array  $id_data 
)
private

attach or detach members from subscribers

Definition at line 473 of file class.ilCourseXMLParser.php.

Referenced by handlerBeginTag().

473  : void
474  {
475  if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach') {
476  // if action not set, or attach
477  if (!$this->course_members->isSubscriber($id_data['usr_id'])) {
478  // add only if not exist
479  $this->course_members->addSubscriber($id_data['usr_id']);
480  }
481  $this->course_members->updateSubscriptionTime($id_data['usr_id'], (int) ($a_attribs['subscriptionTime'] ?? 0));
482  } elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isSubscriber($id_data['usr_id'])) {
483  // if action set and detach and is subscriber
484  $this->course_members->deleteSubscriber($id_data["usr_id"]);
485  }
486  }
+ Here is the caller graph for this function:

◆ handleTutor()

ilCourseXMLParser::handleTutor ( array  $a_attribs,
array  $id_data 
)
private

Definition at line 400 of file class.ilCourseXMLParser.php.

References ilParticipants\IL_CRS_TUTOR.

Referenced by handlerBeginTag().

400  : void
401  {
402  if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach') {
403  // if action not set, or attach
404  if (!array_key_exists($id_data['usr_id'], $this->course_members_array)) {
405  // add only if member is not assigned yet
406  $this->course_members->add($id_data['usr_id'], ilParticipants::IL_CRS_TUTOR);
407  if (isset($a_attribs['notification']) && $a_attribs['notification'] == 'Yes') {
408  $this->course_members->updateNotification($id_data['usr_id'], true);
409  }
410  if (isset($a_attribs['passed']) && $a_attribs['passed'] == 'Yes') {
411  $this->course_members->updatePassed($id_data['usr_id'], true);
412  }
413  if (isset($a_attribs['contact']) && $a_attribs['contact'] == 'Yes') {
414  // default for new course admin/tutors is "no contact"
415  $this->course_members->updateContact($id_data['usr_id'], true);
416  }
417  $this->course_members_array[$id_data['usr_id']] = "added";
418  } else {
419  if (isset($a_attribs['notification']) && $a_attribs['notification'] == 'Yes') {
420  $this->course_members->updateNotification($id_data['usr_id'], true);
421  }
422  if (isset($a_attribs['passed']) && $a_attribs['passed'] == 'Yes') {
423  $this->course_members->updatePassed($id_data['usr_id'], true);
424  }
425  if (isset($a_attribs['contact']) && $a_attribs['contact'] == 'Yes') {
426  $this->course_members->updateContact($id_data['usr_id'], true);
427  } elseif (isset($a_attribs['contact']) && $a_attribs['contact'] == 'No') {
428  $this->course_members->updateContact($id_data['usr_id'], false);
429  }
430  $this->course_members->updateBlocked($id_data['usr_id'], false);
431  }
432  } elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isTutor($id_data['usr_id'])) {
433  // if action set and detach and is tutor of course
434  $this->course_members->delete($id_data['usr_id']);
435  }
436  }
+ Here is the caller graph for this function:

◆ handleWaitingList()

ilCourseXMLParser::handleWaitingList ( array  $a_attribs,
array  $id_data 
)
private

attach or detach members from waitinglist

Definition at line 491 of file class.ilCourseXMLParser.php.

Referenced by handlerBeginTag().

491  : void
492  {
493  if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach') {
494  // if action not set, or attach
495  if (!$this->course_waiting_list->isOnList($id_data['usr_id'])) {
496  // add only if not exists
497  $this->course_waiting_list->addToList($id_data['usr_id']);
498  }
499  $this->course_waiting_list->updateSubscriptionTime($id_data['usr_id'], (int) ($a_attribs['subscriptionTime'] ?? 0));
500  } elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_waiting_list->isOnList($id_data['usr_id'])) {
501  // if action set and detach and is on list
502  $this->course_waiting_list->removeFromList($id_data['usr_id']);
503  }
504  }
+ Here is the caller graph for this function:

◆ setHandlers()

ilCourseXMLParser::setHandlers (   $a_xml_parser)

Definition at line 106 of file class.ilCourseXMLParser.php.

106  : void
107  {
108  $this->sax_controller->setHandlers($a_xml_parser);
109  $this->sax_controller->setDefaultElementHandler($this);
110  $this->sax_controller->setElementHandler(
111  $this->adv_md_handler = new ilAdvancedMDValueParser($this->course_obj->getId()),
112  'AdvancedMetaData'
113  );
114  }

◆ setMode()

ilCourseXMLParser::setMode ( int  $a_mode)

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

76  : void
77  {
78  $this->mode = $a_mode;
79  }

◆ startParsing()

ilCourseXMLParser::startParsing ( )

Definition at line 86 of file class.ilCourseXMLParser.php.

References $general, and ilMDSaxParser\getMDObject().

86  : void
87  {
88  parent::startParsing();
89 
90  // rewrite autogenerated entry
91  $general = $this->getMDObject()->getGeneral();
92  $identifier_ids = $general->getIdentifierIds();
93  if (!isset($identifier_ids[0])) {
94  return;
95  }
96  $identifier = $general->getIdentifier($identifier_ids[0]);
97  $identifier->setEntry(
98  'il__' . $this->getMDObject()->getObjType() . '_' . $this->getMDObject()->getObjId()
99  );
100  $identifier->update();
101  }
$general
SECTIONS.
+ Here is the call graph for this function:

Field Documentation

◆ $adv_md_handler

ilAdvancedMDValueParser ilCourseXMLParser::$adv_md_handler = null
protected

Definition at line 55 of file class.ilCourseXMLParser.php.

◆ $cdata

string ilCourseXMLParser::$cdata = ''
private

Definition at line 42 of file class.ilCourseXMLParser.php.

Referenced by handlerEndTag().

◆ $course_members

ilCourseParticipants ilCourseXMLParser::$course_members
protected

Definition at line 53 of file class.ilCourseXMLParser.php.

◆ $course_members_array

array ilCourseXMLParser::$course_members_array = []
protected

Definition at line 56 of file class.ilCourseXMLParser.php.

◆ $course_obj

ilObjCourse ilCourseXMLParser::$course_obj
private

Definition at line 45 of file class.ilCourseXMLParser.php.

◆ $course_waiting_list

ilCourseWaitingList ilCourseXMLParser::$course_waiting_list
protected

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

◆ $current_container_setting

string ilCourseXMLParser::$current_container_setting = ''
private

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

Referenced by handlerEndTag().

◆ $in_availability

bool ilCourseXMLParser::$in_availability = false
private

Definition at line 34 of file class.ilCourseXMLParser.php.

◆ $in_meta_data

bool ilCourseXMLParser::$in_meta_data = false
private

Definition at line 33 of file class.ilCourseXMLParser.php.

◆ $in_period

bool ilCourseXMLParser::$in_period = false
private

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

◆ $in_period_with_time

bool ilCourseXMLParser::$in_period_with_time = false
private

Definition at line 37 of file class.ilCourseXMLParser.php.

◆ $in_registration

bool ilCourseXMLParser::$in_registration = false
private

Definition at line 35 of file class.ilCourseXMLParser.php.

◆ $log

ilLogger ilCourseXMLParser::$log
private

Definition at line 46 of file class.ilCourseXMLParser.php.

◆ $md_obj

ilMD ilCourseXMLParser::$md_obj = null
protected

Definition at line 51 of file class.ilCourseXMLParser.php.

◆ $mode

int ilCourseXMLParser::$mode = self::MODE_EXPORT
private

Definition at line 31 of file class.ilCourseXMLParser.php.

Referenced by getMode().

◆ $period_end

ilDateTime ilCourseXMLParser::$period_end = null
private

Definition at line 40 of file class.ilCourseXMLParser.php.

◆ $period_start

ilDateTime ilCourseXMLParser::$period_start = null
private

Definition at line 39 of file class.ilCourseXMLParser.php.

◆ $sax_controller

ilSaxController ilCourseXMLParser::$sax_controller
protected

Definition at line 52 of file class.ilCourseXMLParser.php.

◆ $setting

ilSetting ilCourseXMLParser::$setting
protected

Definition at line 47 of file class.ilCourseXMLParser.php.

◆ MODE_EXPORT

const ilCourseXMLParser::MODE_EXPORT = 2

Definition at line 29 of file class.ilCourseXMLParser.php.

◆ MODE_SOAP

const ilCourseXMLParser::MODE_SOAP = 1

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