ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCourseXMLParser Class Reference

Course XML Parser. More...

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

Public Member Functions

 ilCourseXMLParser ($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
 ilMDSaxParser ($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 ()
 
 ilMDSaxParser ($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
 ilSaxParser ($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
 PEAR ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). More...
 
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...
 
 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...
 
 setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. 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...
 

Additional Inherited Members

- 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

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.

Member Function Documentation

◆ __parseId()

ilCourseXMLParser::__parseId (   $a_id)

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

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

Referenced by handlerBeginTag().

670  {
671  global $ilias;
672 
673  $fields = explode('_',$a_id);
674 
675  if(!is_array($fields) or
676  $fields[0] != 'il' or
677  !is_numeric($fields[1]) or
678  $fields[2] != 'usr' or
679  !is_numeric($fields[3]))
680  {
681  return false;
682  }
683  if($id = ilObjUser::_getImportedUserId($a_id))
684  {
685  return array('imported' => true,
686  'local' => false,
687  'usr_id' => $id);
688  }
689  if(($fields[1] == $ilias->getSetting('inst_id',0)) and strlen(ilObjUser::_lookupLogin($fields[3])))
690  {
691  return array('imported' => false,
692  'local' => true,
693  'usr_id' => $fields[3]);
694  }
695  return false;
696  }
_getImportedUserId($i2_id)
_lookupLogin($a_user_id)
lookup login
+ 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 387 of file class.ilCourseXMLParser.php.

References IL_CRS_ADMIN.

Referenced by handlerBeginTag().

388  {
389  global $rbacadmin;
390 
391  if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach')
392  // if action not set, or attach
393  {
394  if (!array_key_exists($id_data['usr_id'], $this->course_members_array))
395  // add only if member is not assigned yet
396  {
397  $this->course_members->add($id_data['usr_id'],IL_CRS_ADMIN);
398  if($a_attribs['notification'] == 'Yes')
399  {
400  $this->course_members->updateNotification($id_data['usr_id'],true);
401  }
402  if($a_attribs['passed'] == 'Yes')
403  {
404  $this->course_members->updatePassed($id_data['usr_id'],true);
405  }
406  $this->course_members_array[$id_data['usr_id']] = "added";
407  }
408  else
409  // update
410  {
411  if($a_attribs['notification'] == 'Yes')
412  {
413  $this->course_members->updateNotification($id_data['usr_id'],true);
414  }
415  if($a_attribs['passed'] == 'Yes')
416  {
417  $this->course_members->updatePassed($id_data['usr_id'],true);
418  }
419  $this->course_members->updateBlocked($id_data['usr_id'],false);
420  }
421  }
422  elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isAdmin($id_data['usr_id']))
423  // if action set and detach and is admin of course
424  {
425  $this->course_members->delete($id_data['usr_id']);
426  }
427 
428  }
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 339 of file class.ilCourseXMLParser.php.

References IL_CRS_MEMBER.

Referenced by handlerBeginTag().

340  {
341  if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach')
342  // if action not set, or set and attach
343  {
344  if (!array_key_exists($id_data['usr_id'], $this->course_members_array))
345  // add only if member is not yet assigned as tutor or admin
346  {
347  $this->course_members->add($id_data['usr_id'],IL_CRS_MEMBER);
348  if($a_attribs['blocked'] == 'Yes')
349  {
350  $this->course_members->updateBlocked($id_data['usr_id'],true);
351  }
352  if($a_attribs['passed'] == 'Yes')
353  {
354  $this->course_members->updatePassed($id_data['usr_id'],true);
355  }
356  $this->course_members_array[$id_data['usr_id']] = "added";
357  }
358  else
359  // the member does exist. Now update status etc. only
360  {
361  if($a_attribs['blocked'] == 'Yes')
362  {
363  $this->course_members->updateBlocked($id_data['usr_id'],true);
364  }
365  if($a_attribs['passed'] == 'Yes')
366  {
367  $this->course_members->updatePassed($id_data['usr_id'],true);
368  }
369  }
370  }
371  elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isMember($id_data['usr_id']))
372  // if action set and detach and is member of course
373  {
374  $this->course_members->delete($id_data['usr_id']);
375  }
376 
377  }
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 106 of file class.ilCourseXMLParser.php.

References __parseId(), ilObject\_writeImportId(), handleAdmin(), handleMember(), handleSubscriber(), handleTutor(), handleWaitingList(), IL_CRS_ACTIVATION_LIMITED, IL_CRS_ACTIVATION_OFFLINE, IL_CRS_ACTIVATION_UNLIMITED, IL_CRS_ARCHIVE_DOWNLOAD, IL_CRS_ARCHIVE_NONE, IL_CRS_SUBSCRIPTION_CONFIRMATION, IL_CRS_SUBSCRIPTION_DEACTIVATED, IL_CRS_SUBSCRIPTION_DIRECT, IL_CRS_SUBSCRIPTION_LIMITED, IL_CRS_SUBSCRIPTION_PASSWORD, IL_CRS_SUBSCRIPTION_UNLIMITED, ilContainer\SORT_ACTIVATION, ilContainer\SORT_MANUAL, and ilContainer\SORT_TITLE.

107  {
108  if($this->in_meta_data)
109  {
110  parent::handlerBeginTag($a_xml_parser,$a_name,$a_attribs);
111  return;
112  }
113 
114  switch($a_name)
115  {
116  case 'Course':
117 
118  if(strlen($a_attribs['importId']))
119  {
120  $this->log->write("CourseXMLParser: importId = ".$a_attribs['importId']);
121  $this->course_obj->setImportId($a_attribs['importId']);
122  ilObject::_writeImportId($this->course_obj->getId(),$a_attribs['importId']);
123  }
124  if(strlen($a_attribs['showMembers']))
125  {
126  $this->course_obj->setShowMembers(
127  $a_attribs['showMembers'] == 'Yes' ? true : false
128  );
129  }
130  break;
131 
132  case 'Admin':
133  if($id_data = $this->__parseId($a_attribs['id']))
134  {
135  if($id_data['local'] or $id_data['imported'])
136  {
137  $this->handleAdmin($a_attribs, $id_data);
138  }
139  }
140  break;
141 
142  case 'Tutor':
143  if($id_data = $this->__parseId($a_attribs['id']))
144  {
145  if($id_data['local'] or $id_data['imported'])
146  {
147  $this->handleTutor($a_attribs, $id_data);
148 
149  }
150  }
151  break;
152 
153  case 'Member':
154  if($id_data = $this->__parseId($a_attribs['id']))
155  {
156  if($id_data['local'] or $id_data['imported'])
157  {
158  $this->handleMember($a_attribs, $id_data);
159  }
160  }
161  break;
162 
163  case 'Subscriber':
164  if($id_data = $this->__parseId($a_attribs['id']))
165  {
166  if($id_data['local'] or $id_data['imported'])
167  {
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  {
176  if($id_data['local'] or $id_data['imported'])
177  {
178  $this->handleWaitingList($a_attribs, $id_data);
179  }
180  }
181  break;
182 
183  case 'Owner':
184  if($id_data = $this->__parseId($a_attribs['id']))
185  {
186  if($id_data['local'] or $id_data['imported'])
187  {
188  $this->course_obj->setOwner($id_data['usr_id']);
189  $this->course_obj->updateOwner();
190  }
191  }
192  break;
193 
194 
195  case 'Settings':
196  $this->in_settings = true;
197  break;
198  case 'Availability':
199  $this->in_availability = true;
200  break;
201 
202  case 'NotAvailable':
203  if($this->in_availability)
204  {
205  $this->course_obj->setActivationType(IL_CRS_ACTIVATION_OFFLINE);
206  }
207  elseif($this->in_registration)
208  {
209  $this->course_obj->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_DEACTIVATED);
210  }
211 
212  break;
213 
214  case 'Unlimited':
215  if($this->in_availability)
216  {
217  $this->course_obj->setOfflineStatus(false);
218  $this->course_obj->setActivationType(IL_CRS_ACTIVATION_UNLIMITED);
219  }
220  elseif($this->in_registration)
221  {
222  $this->course_obj->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_UNLIMITED);
223  }
224 
225  break;
226  case 'TemporarilyAvailable':
227  if($this->in_availability)
228  {
229  $this->course_obj->setOfflineStatus(false);
230  $this->course_obj->setActivationType(IL_CRS_ACTIVATION_LIMITED);
231  }
232  elseif($this->in_registration)
233  {
234  $this->course_obj->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_LIMITED);
235  }
236  break;
237 
238  case 'Start':
239  break;
240 
241  case 'End':
242  break;
243 
244  case 'Syllabus':
245  break;
246 
247  case 'Contact':
248  break;
249 
250  case 'Name':
251  case 'Responsibility':
252  case 'Phone':
253  case 'Email':
254  case 'Consultation':
255  break;
256 
257  case 'Registration':
258  $this->in_registration = true;
259 
260  switch($a_attribs['registrationType'])
261  {
262  case 'Confirmation':
263  $this->course_obj->setSubscriptionType(IL_CRS_SUBSCRIPTION_CONFIRMATION);
264  break;
265 
266  case 'Direct':
267  $this->course_obj->setSubscriptionType(IL_CRS_SUBSCRIPTION_DIRECT);
268  break;
269 
270  case 'Password':
271  $this->course_obj->setSubscriptionType(IL_CRS_SUBSCRIPTION_PASSWORD);
272  break;
273  }
274 
275  $this->course_obj->setSubscriptionMaxMembers((int) $a_attribs['maxMembers']);
276  $this->course_obj->enableSubscriptionMembershipLimitation($this->course_obj->getSubscriptionMaxMembers() > 0);
277  $this->course_obj->setSubscriptionNotify($a_attribs['notification'] == 'Yes' ? true : false);
278  $this->course_obj->enableWaitingList($a_attribs['waitingList'] == 'Yes' ? true : false);
279  break;
280 
281  case 'Sort':
282  switch($a_attribs['type'])
283  {
284  case 'Manual':
285  $this->course_obj->setOrderType(ilContainer::SORT_MANUAL);
286  break;
287 
288  case 'Title':
289  $this->course_obj->setOrderType(ilContainer::SORT_TITLE);
290  break;
291 
292  case 'Activation':
293  $this->course_obj->setOrderType(ilContainer::SORT_ACTIVATION);
294  break;
295  }
296  break;
297 
298 
299  case 'Archive':
300  $this->in_archive = true;
301  switch($a_attribs['Access'])
302  {
303  case 'Disabled':
304  $this->course_obj->setArchiveType(IL_CRS_ARCHIVE_NONE);
305  break;
306 
307  case 'Read':
308  $this->course_obj->setArchiveType(IL_CRS_ARCHIVE_NONE);
309  #$this->course_obj->setViewMode(IL_CRS_VIEW_ARCHIVE);
310  break;
311 
312  case 'Download':
313  #$this->course_obj->setViewMode(IL_CRS_VIEW_ARCHIVE);
314  $this->course_obj->setArchiveType(IL_CRS_ARCHIVE_DOWNLOAD);
315  break;
316  }
317  break;
318 
319  case 'Disabled':
320  $this->course_obj->getSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_DEACTIVATED);
321  break;
322 
323  case "MetaData":
324  $this->in_meta_data = true;
325  parent::handlerBeginTag($a_xml_parser,$a_name,$a_attribs);
326  break;
327 
328  }
329  }
const IL_CRS_ACTIVATION_LIMITED
const IL_CRS_SUBSCRIPTION_LIMITED
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_ARCHIVE_NONE
const IL_CRS_SUBSCRIPTION_PASSWORD
_writeImportId($a_obj_id, $a_import_id)
write import id to db (static)
const IL_CRS_ACTIVATION_OFFLINE
const IL_CRS_SUBSCRIPTION_UNLIMITED
handleTutor($a_attribs, $id_data)
attach or detach admin from course member
const IL_CRS_ARCHIVE_DOWNLOAD
const IL_CRS_SUBSCRIPTION_DIRECT
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 652 of file class.ilCourseXMLParser.php.

653  {
654  // call meta data handler
655  if($this->in_meta_data)
656  {
657  parent::handlerCharacterData($a_xml_parser,$a_data);
658  }
659  if($a_data != "\n")
660  {
661  // Replace multiple tabs with one space
662  $a_data = preg_replace("/\t+/"," ",$a_data);
663 
664  $this->cdata .= $a_data;
665  }
666  }

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

541  {
542  if($this->in_meta_data)
543  {
544  parent::handlerEndTag($a_xml_parser,$a_name);
545  }
546 
547  switch($a_name)
548  {
549  case 'Course':
550 
551  $this->log->write('CourseXMLParser: import_id = '.$this->course_obj->getImportId());
552  $this->course_obj->MDUpdateListener('General');
553  $this->course_obj->update();
554  $this->adv_md_handler->save();
555  break;
556 
557  case 'Settings':
558  $this->in_settings = false;
559  break;
560 
561  case 'Availability':
562  $this->in_availability = false;
563  break;
564 
565  case 'Registration':
566  $this->in_registration = false;
567  break;
568 
569  case 'Archive':
570  $this->in_archive = false;
571  break;
572 
573  case 'Start':
574  if($this->in_availability)
575  {
576  $this->course_obj->setActivationStart(trim($this->cdata));
577  }
578  if($this->in_registration)
579  {
580  $this->course_obj->setSubscriptionStart(trim($this->cdata));
581  }
582  if($this->in_archive)
583  {
584  $this->course_obj->setArchiveStart(trim($this->cdata));
585  }
586  break;
587 
588  case 'End':
589  if($this->in_availability)
590  {
591  $this->course_obj->setActivationEnd(trim($this->cdata));
592  }
593  if($this->in_registration)
594  {
595  $this->course_obj->setSubscriptionEnd(trim($this->cdata));
596  }
597  if($this->in_archive)
598  {
599  $this->course_obj->setArchiveEnd(trim($this->cdata));
600  }
601  break;
602 
603  case 'Syllabus':
604  $this->course_obj->setSyllabus(trim($this->cdata));
605  break;
606 
607 
608  case 'ImportantInformation':
609  $this->course_obj->setImportantInformation(trim($this->cdata));
610  break;
611 
612  case 'Name':
613  $this->course_obj->setContactName(trim($this->cdata));
614  break;
615 
616  case 'Responsibility':
617  $this->course_obj->setContactResponsibility(trim($this->cdata));
618  break;
619 
620  case 'Phone':
621  $this->course_obj->setContactPhone(trim($this->cdata));
622  break;
623 
624  case 'Email':
625  $this->course_obj->setContactEmail(trim($this->cdata));
626  break;
627 
628  case 'Consultation':
629  $this->course_obj->setContactConsultation(trim($this->cdata));
630  break;
631 
632  case 'Password':
633  $this->course_obj->setSubscriptionPassword(trim($this->cdata));
634  break;
635 
636  case 'MetaData':
637  $this->in_meta_data = false;
638  parent::handlerEndTag($a_xml_parser,$a_name);
639  break;
640  }
641  $this->cdata = '';
642 
643  return;
644  }

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

Referenced by handlerBeginTag().

486  {
487  if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach')
488  // if action not set, or attach
489  {
490  if (!$this->course_members->isSubscriber($id_data['usr_id']))
491  // add only if not exist
492  {
493  $this->course_members->addSubscriber($id_data['usr_id']);
494  }
495  $this->course_members->updateSubscriptionTime($id_data['usr_id'],$a_attribs['subscriptionTime']);
496 
497  }
498  elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isSubscriber($id_data['usr_id']))
499  // if action set and detach and is subscriber
500  {
501  $this->course_members->deleteSubscriber($id_data["usr_id"]);
502  }
503 
504  }
+ 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 438 of file class.ilCourseXMLParser.php.

References IL_CRS_TUTOR.

Referenced by handlerBeginTag().

438  {
439  if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach')
440  // if action not set, or attach
441  {
442  if (!array_key_exists($id_data['usr_id'], $this->course_members_array))
443  // add only if member is not assigned yet
444  {
445  $this->course_members->add($id_data['usr_id'],IL_CRS_TUTOR);
446  if($a_attribs['notification'] == 'Yes')
447  {
448  $this->course_members->updateNotification($id_data['usr_id'],true);
449  }
450  if($a_attribs['passed'] == 'Yes')
451  {
452  $this->course_members->updatePassed($id_data['usr_id'],true);
453  }
454  $this->course_members_array[$id_data['usr_id']] = "added";
455  }
456  else
457  {
458  if($a_attribs['notification'] == 'Yes')
459  {
460  $this->course_members->updateNotification($id_data['usr_id'],true);
461  }
462  if($a_attribs['passed'] == 'Yes')
463  {
464  $this->course_members->updatePassed($id_data['usr_id'],true);
465  }
466  $this->course_members->updateBlocked($id_data['usr_id'],false);
467  }
468  }
469  elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isTutor($id_data['usr_id']))
470  // if action set and detach and is tutor of course
471  {
472  $this->course_members->delete($id_data['usr_id']);
473  }
474 
475  }
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 512 of file class.ilCourseXMLParser.php.

Referenced by handlerBeginTag().

513  {
514  if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach')
515  // if action not set, or attach
516  {
517  if (!$this->course_waiting_list->isOnList($id_data['usr_id']))
518  // add only if not exists
519  {
520  $this->course_waiting_list->addToList($id_data['usr_id']);
521  }
522  $this->course_waiting_list->updateSubscriptionTime($id_data['usr_id'],$a_attribs['subscriptionTime']);
523 
524  }
525  elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_waiting_list->isOnList($id_data['usr_id']))
526  // if action set and detach and is on list
527  {
528  $this->course_waiting_list->removeFromList($id_data['usr_id']);
529  }
530 
531  }
+ Here is the caller graph for this function:

◆ ilCourseXMLParser()

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

Constructor.

Parameters
object$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 57 of file class.ilCourseXMLParser.php.

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

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

◆ setHandlers()

ilCourseXMLParser::setHandlers (   $a_xml_parser)

set event handlers

Parameters
resourcereference to the xml parser public

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

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

Field Documentation

◆ $lng

ilCourseXMLParser::$lng

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

Referenced by ilCourseXMLParser().

◆ $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: