ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 @access 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 @access 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...
 
 handlerBeginTag ($a_xml_parser, $a_name, $a_attribs)
 Start element handler. More...
 
 handlerEndTag ($a_xml_parser, $a_name)
 End element handler. More...
 
 handlerCharacterData ($a_xml_parser, $a_name)
 Character data handler. 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
 
 $log = 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 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 @access public

Reimplemented from ilSaxParser.

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

65 {
66 global $DIC;
67
68 $lng = $DIC['lng'];
69
70 parent::__construct($a_xml_file);
71
72 $this->sax_controller = new ilSaxController();
73
74 $this->log = $DIC->logger()->crs();
75
76 $this->course_obj = $a_course_obj;
77 $this->course_members = ilCourseParticipants::_getInstanceByObjId($this->course_obj->getId());
78 $this->course_waiting_list = new ilCourseWaitingList($this->course_obj->getId());
79 // flip the array so we can use array_key_exists
80 $this->course_members_array = array_flip($this->course_members->getParticipants());
81
82 $this->md_obj = new ilMD($this->course_obj->getId(), 0, 'crs');
83 $this->setMDObject($this->md_obj);
84
85 $this->lng = $lng;
86 }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Controller class for sax element handlers.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46

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

+ Here is the call graph for this function:

Member Function Documentation

◆ __parseId()

ilCourseXMLParser::__parseId (   $a_id)

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

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

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

Referenced by handlerBeginTag().

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

352 {
353 global $DIC;
354
355 $rbacadmin = $DIC['rbacadmin'];
356
357 if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach') {
358 // if action not set, or attach
359 if (!array_key_exists($id_data['usr_id'], $this->course_members_array)) {
360 // add only if member is not assigned yet
361 $this->course_members->add($id_data['usr_id'], IL_CRS_ADMIN);
362 if ($a_attribs['notification'] == 'Yes') {
363 $this->course_members->updateNotification($id_data['usr_id'], true);
364 }
365 if ($a_attribs['passed'] == 'Yes') {
366 $this->course_members->updatePassed($id_data['usr_id'], true);
367 }
368 if (isset($a_attribs['contact']) && $a_attribs['contact'] == 'Yes') {
369 // default for new course admin/tutors is "no contact"
370 $this->course_members->updateContact($id_data['usr_id'], true);
371 }
372 $this->course_members_array[$id_data['usr_id']] = "added";
373 } else {
374 // update
375 if ($a_attribs['notification'] == 'Yes') {
376 $this->course_members->updateNotification($id_data['usr_id'], true);
377 }
378 if ($a_attribs['passed'] == 'Yes') {
379 $this->course_members->updatePassed($id_data['usr_id'], true);
380 }
381 if (isset($a_attribs['contact']) && $a_attribs['contact'] == 'Yes') {
382 $this->course_members->updateContact($id_data['usr_id'], true);
383 } elseif (isset($a_attribs['contact']) && $a_attribs['contact'] == 'No') {
384 $this->course_members->updateContact($id_data['usr_id'], false);
385 }
386 $this->course_members->updateBlocked($id_data['usr_id'], false);
387 }
388 } elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isAdmin($id_data['usr_id'])) {
389 // if action set and detach and is admin of course
390 $this->course_members->delete($id_data['usr_id']);
391 }
392 }
const IL_CRS_ADMIN
Base class for course and group participants.

References $DIC, and IL_CRS_ADMIN.

Referenced by handlerBeginTag().

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

315 {
316 if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach') {
317 // if action not set, or set and attach
318 if (!array_key_exists($id_data['usr_id'], $this->course_members_array)) {
319 // add only if member is not yet assigned as tutor or admin
320 $this->course_members->add($id_data['usr_id'], IL_CRS_MEMBER);
321 if ($a_attribs['blocked'] == 'Yes') {
322 $this->course_members->updateBlocked($id_data['usr_id'], true);
323 }
324 if ($a_attribs['passed'] == 'Yes') {
325 $this->course_members->updatePassed($id_data['usr_id'], true);
326 }
327 $this->course_members_array[$id_data['usr_id']] = "added";
328 } else {
329 // the member does exist. Now update status etc. only
330 if ($a_attribs['blocked'] == 'Yes') {
331 $this->course_members->updateBlocked($id_data['usr_id'], true);
332 }
333 if ($a_attribs['passed'] == 'Yes') {
334 $this->course_members->updatePassed($id_data['usr_id'], true);
335 }
336 }
337 } elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isMember($id_data['usr_id'])) {
338 // if action set and detach and is member of course
339 $this->course_members->delete($id_data['usr_id']);
340 }
341 }
const IL_CRS_MEMBER

References IL_CRS_MEMBER.

Referenced by handlerBeginTag().

+ 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

Reimplemented from ilMDSaxParser.

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

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

References __parseId(), ilContainerSortingSettings\_importContainerSortingSettings(), ilObject\_writeImportId(), ilContainerSortingSettings\getInstanceByObjId(), handleAdmin(), handleMember(), handleSubscriber(), handleTutor(), handleWaitingList(), 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.

+ 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

Reimplemented from ilMDSaxParser.

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

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

◆ handlerEndTag()

ilCourseXMLParser::handlerEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element

Parameters
resource$a_xml_parserxml parser
string$a_nameelement name

Reimplemented from ilMDSaxParser.

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

492 {
493 if ($this->in_meta_data) {
494 parent::handlerEndTag($a_xml_parser, $a_name);
495 }
496
497 switch ($a_name) {
498 case 'Course':
499
500 $this->log->write('CourseXMLParser: import_id = ' . $this->course_obj->getImportId());
501 $this->course_obj->MDUpdateListener('General');
502 $this->course_obj->update();
503 $this->adv_md_handler->save();
504 break;
505
506 case 'Settings':
507 $this->in_settings = false;
508 break;
509
510 case 'Availability':
511 $this->in_availability = false;
512 break;
513
514 case 'Registration':
515 $this->in_registration = false;
516 break;
517
518
519 case 'Start':
520 if ($this->in_availability) {
521 $this->course_obj->setActivationStart(trim($this->cdata));
522 }
523 if ($this->in_registration) {
524 $this->course_obj->setSubscriptionStart(trim($this->cdata));
525 }
526 if ($this->in_period) {
527 if ((int) $this->cdata) {
528 if ($this->in_period_with_time) {
529 $this->period_start = new \ilDateTime((int) $this->cdata, IL_CAL_UNIX);
530 } else {
531 $this->period_start = new \ilDate((int) $this->cdata, IL_CAL_UNIX);
532 }
533 }
534 }
535 break;
536
537 case 'End':
538 if ($this->in_availability) {
539 $this->course_obj->setActivationEnd(trim($this->cdata));
540 }
541 if ($this->in_registration) {
542 $this->course_obj->setSubscriptionEnd(trim($this->cdata));
543 }
544 if ($this->in_period) {
545 if ((int) $this->cdata) {
546 if ($this->in_period_with_time) {
547 $this->period_end = new \ilDateTime((int) $this->cdata, IL_CAL_UNIX);
548 }
549 else {
550 $this->period_end = new \ilDate((int) $this->cdata, IL_CAL_UNIX);
551 }
552 }
553 }
554 break;
555
556 case 'Syllabus':
557 $this->course_obj->setSyllabus(trim($this->cdata));
558 break;
559
560 case 'TargetGroup':
561 $this->course_obj->setTargetGroup(trim($this->cdata));
562 break;
563
564 case 'ImportantInformation':
565 $this->course_obj->setImportantInformation(trim($this->cdata));
566 break;
567
568 case 'ViewMode':
569 $this->course_obj->setViewMode(trim($this->cdata));
570 break;
571
572 case 'Name':
573 $this->course_obj->setContactName(trim($this->cdata));
574 break;
575
576 case 'Responsibility':
577 $this->course_obj->setContactResponsibility(trim($this->cdata));
578 break;
579
580 case 'Phone':
581 $this->course_obj->setContactPhone(trim($this->cdata));
582 break;
583
584 case 'Email':
585 $this->course_obj->setContactEmail(trim($this->cdata));
586 break;
587
588 case 'Consultation':
589 $this->course_obj->setContactConsultation(trim($this->cdata));
590 break;
591
592 case 'Password':
593 $this->course_obj->setSubscriptionPassword(trim($this->cdata));
594 break;
595
596 case 'MetaData':
597 $this->in_meta_data = false;
598 parent::handlerEndTag($a_xml_parser, $a_name);
599 break;
600
601 case 'ContainerSetting':
602 if ($this->current_container_setting) {
604 $this->course_obj->getId(),
605 $this->current_container_setting,
606 $this->cdata
607 );
608 }
609 break;
610
611 case 'Period':
612 $this->in_period = false;
613 try {
614 $this->course_obj->setCoursePeriod($this->period_start, $this->period_end);
615 } catch (Exception $e) {
616 $this->log->warning('invalid course period given');
617 }
618 break;
619
620 case 'WaitingListAutoFill':
621 $this->course_obj->setWaitingListAutoFill($this->cdata);
622 break;
623
624 case 'CancellationEnd':
625 if ((int) $this->cdata) {
626 $this->course_obj->setCancellationEnd(new ilDate((int) $this->cdata, IL_CAL_UNIX));
627 }
628 break;
629
630 case 'MinMembers':
631 if ((int) $this->cdata) {
632 $this->course_obj->setSubscriptionMinMembers((int) $this->cdata);
633 }
634 break;
635
636 case 'ViewMode':
637 $this->course_obj->setViewMode((int) $this->cdata);
638 break;
639
640 case 'TimingMode':
641 $this->course_obj->setTimingMode((int) $this->cdata);
642 break;
643 }
644 $this->cdata = '';
645
646 return;
647 }
const IL_CAL_UNIX
static _writeContainerSetting($a_id, $a_keyword, $a_value)
Class for single dates.

References Vendor\Package\$e, ilContainer\_writeContainerSetting(), and IL_CAL_UNIX.

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

449 {
450 if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach') {
451 // if action not set, or attach
452 if (!$this->course_members->isSubscriber($id_data['usr_id'])) {
453 // add only if not exist
454 $this->course_members->addSubscriber($id_data['usr_id']);
455 }
456 $this->course_members->updateSubscriptionTime($id_data['usr_id'], $a_attribs['subscriptionTime']);
457 } elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isSubscriber($id_data['usr_id'])) {
458 // if action set and detach and is subscriber
459 $this->course_members->deleteSubscriber($id_data["usr_id"]);
460 }
461 }

Referenced by handlerBeginTag().

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

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

References IL_CRS_TUTOR.

Referenced by handlerBeginTag().

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

470 {
471 if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach') {
472 // if action not set, or attach
473 if (!$this->course_waiting_list->isOnList($id_data['usr_id'])) {
474 // add only if not exists
475 $this->course_waiting_list->addToList($id_data['usr_id']);
476 }
477 $this->course_waiting_list->updateSubscriptionTime($id_data['usr_id'], $a_attribs['subscriptionTime']);
478 } elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_waiting_list->isOnList($id_data['usr_id'])) {
479 // if action set and detach and is on list
480 $this->course_waiting_list->removeFromList($id_data['usr_id']);
481 }
482 }

Referenced by handlerBeginTag().

+ Here is the caller graph for this function:

◆ setHandlers()

ilCourseXMLParser::setHandlers (   $a_xml_parser)

set event handlers

Parameters
resourcereference to the xml parser @access public

Reimplemented from ilMDSaxParser.

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

95 {
96 $this->sax_controller->setHandlers($a_xml_parser);
97 $this->sax_controller->setDefaultElementHandler($this);
98
99 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValueParser.php');
100 $this->sax_controller->setElementHandler(
101 $this->adv_md_handler = new ilAdvancedMDValueParser($this->course_obj->getId()),
102 'AdvancedMetaData'
103 );
104 }

Field Documentation

◆ $current_container_setting

ilCourseXMLParser::$current_container_setting
private

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

◆ $lng

ilCourseXMLParser::$lng

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

Referenced by __construct().

◆ $log

ilCourseXMLParser::$log = null
private

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

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