ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilCourseXMLParser Class Reference

Course XML Parser. More...

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

Public Member Functions

 __construct ($a_course_obj, $a_xml_file='')
 Constructor. More...
 
 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...
 
 __parseId ($a_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

 $lng
 
 $md_obj = null
 
- 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()
 

Private Member Functions

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

Private Attributes

 $current_container_setting
 

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 ilSaxParser
 handleError ($message, $code)
 use given error handler to handle error message or internal ilias error message handle More...
 
- Protected Attributes inherited from ilMDSaxParser
 $meta_log
 

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 43 of file class.ilCourseXMLParser.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
ilObject$a_content_objectmust be of type ilObjContentObject ilObjTest or ilObjQuestionPool
string$a_xml_filexml file
string$a_subdirsubdirectory in import directory public

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

References $ilLog, $lng, ilCourseParticipants\_getInstanceByObjId(), and ilMDSaxParser\setMDObject().

60  {
61  global $lng,$ilLog;
62 
63  parent::__construct($a_xml_file);
64 
65  $this->sax_controller = new ilSaxController();
66 
67  $this->log = $ilLog;
68 
69  $this->course_obj = $a_course_obj;
70  $this->course_members = ilCourseParticipants::_getInstanceByObjId($this->course_obj->getId());
71  $this->course_waiting_list = new ilCourseWaitingList($this->course_obj->getId());
72  // flip the array so we can use array_key_exists
73  $this->course_members_array = array_flip($this->course_members->getParticipants());
74 
75  $this->md_obj = new ilMD($this->course_obj->getId(),0,'crs');
76  $this->setMDObject($this->md_obj);
77 
78  $this->lng = $lng;
79  }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Controller class for sax element handlers.
+ Here is the call graph for this function:

Member Function Documentation

◆ __parseId()

ilCourseXMLParser::__parseId (   $a_id)

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

References ilSaxParser\$ilias, ilObjUser\_getImportedUserId(), ilObjUser\_lookupLogin(), and array.

Referenced by handlerBeginTag().

695  {
696  global $ilias;
697 
698  $fields = explode('_',$a_id);
699 
700  if(!is_array($fields) or
701  $fields[0] != 'il' or
702  !is_numeric($fields[1]) or
703  $fields[2] != 'usr' or
704  !is_numeric($fields[3]))
705  {
706  return false;
707  }
708  if($id = ilObjUser::_getImportedUserId($a_id))
709  {
710  return array('imported' => true,
711  'local' => false,
712  'usr_id' => $id);
713  }
714  if(($fields[1] == $ilias->getSetting('inst_id',0)) and strlen(ilObjUser::_lookupLogin($fields[3])))
715  {
716  return array('imported' => false,
717  'local' => true,
718  'usr_id' => $fields[3]);
719  }
720  return false;
721  }
static _lookupLogin($a_user_id)
lookup login
static _getImportedUserId($i2_id)
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleAdmin()

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

attach or detach admin from course member

Parameters
string$a_attribsattribute of a node
array$id_data

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

References IL_CRS_ADMIN.

Referenced by handlerBeginTag().

374  {
375  global $rbacadmin;
376 
377  if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach')
378  // if action not set, or attach
379  {
380  if (!array_key_exists($id_data['usr_id'], $this->course_members_array))
381  // add only if member is not assigned yet
382  {
383  $this->course_members->add($id_data['usr_id'],IL_CRS_ADMIN);
384  if($a_attribs['notification'] == 'Yes')
385  {
386  $this->course_members->updateNotification($id_data['usr_id'],true);
387  }
388  if($a_attribs['passed'] == 'Yes')
389  {
390  $this->course_members->updatePassed($id_data['usr_id'],true);
391  }
392  $this->course_members_array[$id_data['usr_id']] = "added";
393  }
394  else
395  // update
396  {
397  if($a_attribs['notification'] == 'Yes')
398  {
399  $this->course_members->updateNotification($id_data['usr_id'],true);
400  }
401  if($a_attribs['passed'] == 'Yes')
402  {
403  $this->course_members->updatePassed($id_data['usr_id'],true);
404  }
405  $this->course_members->updateBlocked($id_data['usr_id'],false);
406  }
407  }
408  elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isAdmin($id_data['usr_id']))
409  // if action set and detach and is admin of course
410  {
411  $this->course_members->delete($id_data['usr_id']);
412  }
413 
414  }
const IL_CRS_ADMIN
Base class for course and group participants.
+ Here is the caller graph for this function:

◆ handleMember()

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

attach or detach user/member/admin from course member

Parameters
array$a_attribsattributes of nod
array$id_data
int$roletypetype of role, which is courseMember->

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

References IL_CRS_MEMBER.

Referenced by handlerBeginTag().

326  {
327  if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach')
328  // if action not set, or set and attach
329  {
330  if (!array_key_exists($id_data['usr_id'], $this->course_members_array))
331  // add only if member is not yet assigned as tutor or admin
332  {
333  $this->course_members->add($id_data['usr_id'],IL_CRS_MEMBER);
334  if($a_attribs['blocked'] == 'Yes')
335  {
336  $this->course_members->updateBlocked($id_data['usr_id'],true);
337  }
338  if($a_attribs['passed'] == 'Yes')
339  {
340  $this->course_members->updatePassed($id_data['usr_id'],true);
341  }
342  $this->course_members_array[$id_data['usr_id']] = "added";
343  }
344  else
345  // the member does exist. Now update status etc. only
346  {
347  if($a_attribs['blocked'] == 'Yes')
348  {
349  $this->course_members->updateBlocked($id_data['usr_id'],true);
350  }
351  if($a_attribs['passed'] == 'Yes')
352  {
353  $this->course_members->updatePassed($id_data['usr_id'],true);
354  }
355  }
356  }
357  elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isMember($id_data['usr_id']))
358  // if action set and detach and is member of course
359  {
360  $this->course_members->delete($id_data['usr_id']);
361  }
362 
363  }
const IL_CRS_MEMBER
+ Here is the caller graph for this function:

◆ handlerBeginTag()

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

handler for begin of element

Parameters
resource$a_xml_parserxml parser
string$a_nameelement name
array$a_attribselement attributes array

Implements ilSaxSubsetParser.

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

References __parseId(), ilContainerSortingSettings\_importContainerSortingSettings(), ilObject\_writeImportId(), ilContainerSortingSettings\getInstanceByObjId(), handleAdmin(), handleMember(), handleSubscriber(), handleTutor(), handleWaitingList(), IL_CRS_ACTIVATION_LIMITED, IL_CRS_ACTIVATION_OFFLINE, IL_CRS_ACTIVATION_UNLIMITED, IL_CRS_SUBSCRIPTION_CONFIRMATION, IL_CRS_SUBSCRIPTION_DEACTIVATED, IL_CRS_SUBSCRIPTION_DIRECT, IL_CRS_SUBSCRIPTION_LIMITED, IL_CRS_SUBSCRIPTION_PASSWORD, and IL_CRS_SUBSCRIPTION_UNLIMITED.

109  {
110  if($this->in_meta_data)
111  {
112  parent::handlerBeginTag($a_xml_parser,$a_name,$a_attribs);
113  return;
114  }
115 
116  switch($a_name)
117  {
118  case 'Course':
119 
120  if(strlen($a_attribs['importId']))
121  {
122  $this->log->write("CourseXMLParser: importId = ".$a_attribs['importId']);
123  $this->course_obj->setImportId($a_attribs['importId']);
124  ilObject::_writeImportId($this->course_obj->getId(),$a_attribs['importId']);
125  }
126  if(strlen($a_attribs['showMembers']))
127  {
128  $this->course_obj->setShowMembers(
129  $a_attribs['showMembers'] == 'Yes' ? true : false
130  );
131  }
132  break;
133 
134  case 'Admin':
135  if($id_data = $this->__parseId($a_attribs['id']))
136  {
137  if($id_data['local'] or $id_data['imported'])
138  {
139  $this->handleAdmin($a_attribs, $id_data);
140  }
141  }
142  break;
143 
144  case 'Tutor':
145  if($id_data = $this->__parseId($a_attribs['id']))
146  {
147  if($id_data['local'] or $id_data['imported'])
148  {
149  $this->handleTutor($a_attribs, $id_data);
150 
151  }
152  }
153  break;
154 
155  case 'Member':
156  if($id_data = $this->__parseId($a_attribs['id']))
157  {
158  if($id_data['local'] or $id_data['imported'])
159  {
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  {
168  if($id_data['local'] or $id_data['imported'])
169  {
170  $this->handleSubscriber($a_attribs, $id_data);
171  }
172  }
173  break;
174 
175  case 'WaitingList':
176  if($id_data = $this->__parseId($a_attribs['id']))
177  {
178  if($id_data['local'] or $id_data['imported'])
179  {
180  $this->handleWaitingList($a_attribs, $id_data);
181  }
182  }
183  break;
184 
185  case 'Owner':
186  if($id_data = $this->__parseId($a_attribs['id']))
187  {
188  if($id_data['local'] or $id_data['imported'])
189  {
190  $this->course_obj->setOwner($id_data['usr_id']);
191  $this->course_obj->updateOwner();
192  }
193  }
194  break;
195 
196 
197  case 'Settings':
198  $this->in_settings = true;
199  break;
200  case 'Availability':
201  $this->in_availability = true;
202  break;
203 
204  case 'NotAvailable':
205  if($this->in_availability)
206  {
207  $this->course_obj->setActivationType(IL_CRS_ACTIVATION_OFFLINE);
208  }
209  elseif($this->in_registration)
210  {
211  $this->course_obj->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_DEACTIVATED);
212  }
213 
214  break;
215 
216  case 'Unlimited':
217  if($this->in_availability)
218  {
219  $this->course_obj->setOfflineStatus(false);
220  $this->course_obj->setActivationType(IL_CRS_ACTIVATION_UNLIMITED);
221  }
222  elseif($this->in_registration)
223  {
224  $this->course_obj->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_UNLIMITED);
225  }
226 
227  break;
228  case 'TemporarilyAvailable':
229  if($this->in_availability)
230  {
231  $this->course_obj->setOfflineStatus(false);
232  $this->course_obj->setActivationType(IL_CRS_ACTIVATION_LIMITED);
233  }
234  elseif($this->in_registration)
235  {
236  $this->course_obj->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_LIMITED);
237  }
238  break;
239 
240  case 'Start':
241  break;
242 
243  case 'End':
244  break;
245 
246  case 'Syllabus':
247  break;
248 
249  case 'Contact':
250  break;
251 
252  case 'Name':
253  case 'Responsibility':
254  case 'Phone':
255  case 'Email':
256  case 'Consultation':
257  break;
258 
259  case 'Registration':
260  $this->in_registration = true;
261 
262  switch($a_attribs['registrationType'])
263  {
264  case 'Confirmation':
265  $this->course_obj->setSubscriptionType(IL_CRS_SUBSCRIPTION_CONFIRMATION);
266  break;
267 
268  case 'Direct':
269  $this->course_obj->setSubscriptionType(IL_CRS_SUBSCRIPTION_DIRECT);
270  break;
271 
272  case 'Password':
273  $this->course_obj->setSubscriptionType(IL_CRS_SUBSCRIPTION_PASSWORD);
274  break;
275  }
276 
277  $this->course_obj->setSubscriptionMaxMembers((int) $a_attribs['maxMembers']);
278  $this->course_obj->enableSubscriptionMembershipLimitation($this->course_obj->getSubscriptionMaxMembers() > 0);
279  $this->course_obj->setSubscriptionNotify($a_attribs['notification'] == 'Yes' ? true : false);
280  $this->course_obj->enableWaitingList($a_attribs['waitingList'] == 'Yes' ? true : false);
281  break;
282 
283  case 'Sort':
284  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
285  ilContainerSortingSettings::_importContainerSortingSettings($a_attribs, $this->course_obj->getId());
286 
287  //#17837
288  $this->course_obj->setOrderType(
289  ilContainerSortingSettings::getInstanceByObjId($this->course_obj->getId())->getSortMode()
290  );
291  break;
292 
293  case 'Disabled':
294  $this->course_obj->getSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_DEACTIVATED);
295  break;
296 
297  case "MetaData":
298  $this->in_meta_data = true;
299  parent::handlerBeginTag($a_xml_parser,$a_name,$a_attribs);
300  break;
301 
302  case 'ContainerSetting':
303  $this->current_container_setting = $a_attribs['id'];
304  break;
305 
306  case 'Period':
307  $this->in_period = true;
308  break;
309 
310  case 'WaitingListAutoFill':
311  case 'CancellationEnd':
312  case 'MinMembers':
313  break;
314  }
315  }
const IL_CRS_ACTIVATION_LIMITED
const IL_CRS_SUBSCRIPTION_LIMITED
static _importContainerSortingSettings($attibs, $obj_id)
sorting import for all container objects
handleMember($a_attribs, $id_data)
attach or detach user/member/admin from course member
handleAdmin($a_attribs, $id_data)
attach or detach admin from course member
const IL_CRS_SUBSCRIPTION_CONFIRMATION
handleWaitingList($a_attribs, $id_data)
attach or detach members from waitinglist
const IL_CRS_SUBSCRIPTION_PASSWORD
const IL_CRS_ACTIVATION_OFFLINE
const IL_CRS_SUBSCRIPTION_UNLIMITED
handleTutor($a_attribs, $id_data)
attach or detach admin from course member
static _writeImportId($a_obj_id, $a_import_id)
write import id to db (static)
const IL_CRS_SUBSCRIPTION_DIRECT
static getInstanceByObjId($a_obj_id)
Get singleton instance.
handleSubscriber($a_attribs, $id_data)
attach or detach members from subscribers
const IL_CRS_SUBSCRIPTION_DEACTIVATED
const IL_CRS_ACTIVATION_UNLIMITED
+ Here is the call graph for this function:

◆ handlerCharacterData()

ilCourseXMLParser::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

handler for character data

Parameters
resource$a_xml_parserxml parser
string$a_datacharacter data

Implements ilSaxSubsetParser.

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

678  {
679  // call meta data handler
680  if($this->in_meta_data)
681  {
682  parent::handlerCharacterData($a_xml_parser,$a_data);
683  }
684  if($a_data != "\n")
685  {
686  // Replace multiple tabs with one space
687  $a_data = preg_replace("/\t+/"," ",$a_data);
688 
689  $this->cdata .= $a_data;
690  }
691  }

◆ handlerEndTag()

ilCourseXMLParser::handlerEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element

Parameters
resource$a_xml_parserxml parser
string$a_nameelement name

Implements ilSaxSubsetParser.

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

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

527  {
528  if($this->in_meta_data)
529  {
530  parent::handlerEndTag($a_xml_parser,$a_name);
531  }
532 
533  switch($a_name)
534  {
535  case 'Course':
536 
537  $this->log->write('CourseXMLParser: import_id = '.$this->course_obj->getImportId());
538  $this->course_obj->MDUpdateListener('General');
539  $this->course_obj->update();
540  $this->adv_md_handler->save();
541  break;
542 
543  case 'Settings':
544  $this->in_settings = false;
545  break;
546 
547  case 'Availability':
548  $this->in_availability = false;
549  break;
550 
551  case 'Registration':
552  $this->in_registration = false;
553  break;
554 
555 
556  case 'Start':
557  if($this->in_availability)
558  {
559  $this->course_obj->setActivationStart(trim($this->cdata));
560  }
561  if($this->in_registration)
562  {
563  $this->course_obj->setSubscriptionStart(trim($this->cdata));
564  }
565  if($this->in_period)
566  {
567  if((int)$this->cdata)
568  {
569  $this->course_obj->setCourseStart(new ilDate((int)$this->cdata, IL_CAL_UNIX));
570  }
571  }
572  break;
573 
574  case 'End':
575  if($this->in_availability)
576  {
577  $this->course_obj->setActivationEnd(trim($this->cdata));
578  }
579  if($this->in_registration)
580  {
581  $this->course_obj->setSubscriptionEnd(trim($this->cdata));
582  }
583  if($this->in_period)
584  {
585  if((int)$this->cdata)
586  {
587  $this->course_obj->setCourseEnd(new ilDate((int)$this->cdata, IL_CAL_UNIX));
588  }
589  }
590  break;
591 
592  case 'Syllabus':
593  $this->course_obj->setSyllabus(trim($this->cdata));
594  break;
595 
596 
597  case 'ImportantInformation':
598  $this->course_obj->setImportantInformation(trim($this->cdata));
599  break;
600 
601  case 'ViewMode':
602  $this->course_obj->setViewMode(trim($this->cdata));
603  break;
604 
605  case 'Name':
606  $this->course_obj->setContactName(trim($this->cdata));
607  break;
608 
609  case 'Responsibility':
610  $this->course_obj->setContactResponsibility(trim($this->cdata));
611  break;
612 
613  case 'Phone':
614  $this->course_obj->setContactPhone(trim($this->cdata));
615  break;
616 
617  case 'Email':
618  $this->course_obj->setContactEmail(trim($this->cdata));
619  break;
620 
621  case 'Consultation':
622  $this->course_obj->setContactConsultation(trim($this->cdata));
623  break;
624 
625  case 'Password':
626  $this->course_obj->setSubscriptionPassword(trim($this->cdata));
627  break;
628 
629  case 'MetaData':
630  $this->in_meta_data = false;
631  parent::handlerEndTag($a_xml_parser,$a_name);
632  break;
633 
634  case 'ContainerSetting':
635  if($this->current_container_setting)
636  {
638  $this->course_obj->getId(),
640  $this->cdata);
641  }
642  break;
643 
644  case 'Period':
645  $this->in_period = false;
646  break;
647 
648  case 'WaitingListAutoFill':
649  $this->course_obj->setWaitingListAutoFill($this->cdata);
650  break;
651 
652  case 'CancellationEnd':
653  if((int)$this->cdata)
654  {
655  $this->course_obj->setCancellationEnd(new ilDate((int)$this->cdata, IL_CAL_UNIX));
656  }
657  break;
658 
659  case 'MinMembers':
660  if((int)$this->cdata)
661  {
662  $this->course_obj->setSubscriptionMinMembers((int)$this->cdata);
663  }
664  break;
665  }
666  $this->cdata = '';
667 
668  return;
669  }
const IL_CAL_UNIX
Class for single dates.
static _writeContainerSetting($a_id, $a_keyword, $a_value)
+ Here is the call graph for this function:

◆ handleSubscriber()

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

attach or detach members from subscribers

Parameters
string$a_attribsattribute of a node
array$id_data

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

Referenced by handlerBeginTag().

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

◆ handleTutor()

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

attach or detach admin from course member

Parameters
string$a_attribsattribute of a node
array$id_data

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

References IL_CRS_TUTOR.

Referenced by handlerBeginTag().

424  {
425  if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach')
426  // if action not set, or attach
427  {
428  if (!array_key_exists($id_data['usr_id'], $this->course_members_array))
429  // add only if member is not assigned yet
430  {
431  $this->course_members->add($id_data['usr_id'],IL_CRS_TUTOR);
432  if($a_attribs['notification'] == 'Yes')
433  {
434  $this->course_members->updateNotification($id_data['usr_id'],true);
435  }
436  if($a_attribs['passed'] == 'Yes')
437  {
438  $this->course_members->updatePassed($id_data['usr_id'],true);
439  }
440  $this->course_members_array[$id_data['usr_id']] = "added";
441  }
442  else
443  {
444  if($a_attribs['notification'] == 'Yes')
445  {
446  $this->course_members->updateNotification($id_data['usr_id'],true);
447  }
448  if($a_attribs['passed'] == 'Yes')
449  {
450  $this->course_members->updatePassed($id_data['usr_id'],true);
451  }
452  $this->course_members->updateBlocked($id_data['usr_id'],false);
453  }
454  }
455  elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isTutor($id_data['usr_id']))
456  // if action set and detach and is tutor of course
457  {
458  $this->course_members->delete($id_data['usr_id']);
459  }
460 
461  }
const IL_CRS_TUTOR
+ Here is the caller graph for this function:

◆ handleWaitingList()

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

attach or detach members from waitinglist

Parameters
string$a_attribsattribute of a node
array$id_data

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

Referenced by handlerBeginTag().

499  {
500  if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach')
501  // if action not set, or attach
502  {
503  if (!$this->course_waiting_list->isOnList($id_data['usr_id']))
504  // add only if not exists
505  {
506  $this->course_waiting_list->addToList($id_data['usr_id']);
507  }
508  $this->course_waiting_list->updateSubscriptionTime($id_data['usr_id'],$a_attribs['subscriptionTime']);
509 
510  }
511  elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_waiting_list->isOnList($id_data['usr_id']))
512  // if action set and detach and is on list
513  {
514  $this->course_waiting_list->removeFromList($id_data['usr_id']);
515  }
516 
517  }
+ Here is the caller graph for this function:

◆ setHandlers()

ilCourseXMLParser::setHandlers (   $a_xml_parser)

set event handlers

Parameters
resourcereference to the xml parser public

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

88  {
89  $this->sax_controller->setHandlers($a_xml_parser);
90  $this->sax_controller->setDefaultElementHandler($this);
91 
92  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValueParser.php');
93  $this->sax_controller->setElementHandler(
94  $this->adv_md_handler = new ilAdvancedMDValueParser($this->course_obj->getId()),
95  'AdvancedMetaData');
96  }

Field Documentation

◆ $current_container_setting

ilCourseXMLParser::$current_container_setting
private

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

Referenced by handlerEndTag().

◆ $lng

ilCourseXMLParser::$lng

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

Referenced by __construct().

◆ $md_obj

ilCourseXMLParser::$md_obj = null

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


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