ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 ()
 
 __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 ()
 
- 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
 

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

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

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

+ Here is the call graph for this function:

Member Function Documentation

◆ __parseId()

ilCourseXMLParser::__parseId (   $a_id)

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

640 {
641 global $DIC;
642
643 $ilias = $DIC['ilias'];
644
645 $fields = explode('_', $a_id);
646
647 if (!is_array($fields) or
648 $fields[0] != 'il' or
649 !is_numeric($fields[1]) or
650 $fields[2] != 'usr' or
651 !is_numeric($fields[3])) {
652 return false;
653 }
654 if ($id = ilObjUser::_getImportedUserId($a_id)) {
655 return array('imported' => true,
656 'local' => false,
657 'usr_id' => $id);
658 }
659 if (($fields[1] == $ilias->getSetting('inst_id', 0)) and strlen(ilObjUser::_lookupLogin($fields[3]))) {
660 return array('imported' => false,
661 'local' => true,
662 'usr_id' => $fields[3]);
663 }
664 return false;
665 }
static _getImportedUserId($i2_id)
static _lookupLogin($a_user_id)
lookup login
if(!array_key_exists('StateId', $_REQUEST)) $id

References $DIC, $id, 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 337 of file class.ilCourseXMLParser.php.

338 {
339 global $DIC;
340
341 $rbacadmin = $DIC['rbacadmin'];
342
343 if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach') {
344 // if action not set, or attach
345 if (!array_key_exists($id_data['usr_id'], $this->course_members_array)) {
346 // add only if member is not assigned yet
347 $this->course_members->add($id_data['usr_id'], IL_CRS_ADMIN);
348 if ($a_attribs['notification'] == 'Yes') {
349 $this->course_members->updateNotification($id_data['usr_id'], true);
350 }
351 if ($a_attribs['passed'] == 'Yes') {
352 $this->course_members->updatePassed($id_data['usr_id'], true);
353 }
354 if (isset($a_attribs['contact']) && $a_attribs['contact'] == 'Yes') {
355 // default for new course admin/tutors is "no contact"
356 $this->course_members->updateContact($id_data['usr_id'], true);
357 }
358 $this->course_members_array[$id_data['usr_id']] = "added";
359 } else {
360 // update
361 if ($a_attribs['notification'] == 'Yes') {
362 $this->course_members->updateNotification($id_data['usr_id'], true);
363 }
364 if ($a_attribs['passed'] == 'Yes') {
365 $this->course_members->updatePassed($id_data['usr_id'], true);
366 }
367 if (isset($a_attribs['contact']) && $a_attribs['contact'] == 'Yes') {
368 $this->course_members->updateContact($id_data['usr_id'], true);
369 } elseif (isset($a_attribs['contact']) && $a_attribs['contact'] == 'No') {
370 $this->course_members->updateContact($id_data['usr_id'], false);
371 }
372 $this->course_members->updateBlocked($id_data['usr_id'], false);
373 }
374 } elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isAdmin($id_data['usr_id'])) {
375 // if action set and detach and is admin of course
376 $this->course_members->delete($id_data['usr_id']);
377 }
378 }
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 300 of file class.ilCourseXMLParser.php.

301 {
302 if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach') {
303 // if action not set, or set and attach
304 if (!array_key_exists($id_data['usr_id'], $this->course_members_array)) {
305 // add only if member is not yet assigned as tutor or admin
306 $this->course_members->add($id_data['usr_id'], IL_CRS_MEMBER);
307 if ($a_attribs['blocked'] == 'Yes') {
308 $this->course_members->updateBlocked($id_data['usr_id'], true);
309 }
310 if ($a_attribs['passed'] == 'Yes') {
311 $this->course_members->updatePassed($id_data['usr_id'], true);
312 }
313 $this->course_members_array[$id_data['usr_id']] = "added";
314 } else {
315 // the member does exist. Now update status etc. only
316 if ($a_attribs['blocked'] == 'Yes') {
317 $this->course_members->updateBlocked($id_data['usr_id'], true);
318 }
319 if ($a_attribs['passed'] == 'Yes') {
320 $this->course_members->updatePassed($id_data['usr_id'], true);
321 }
322 }
323 } elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isMember($id_data['usr_id'])) {
324 // if action set and detach and is member of course
325 $this->course_members->delete($id_data['usr_id']);
326 }
327 }
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 112 of file class.ilCourseXMLParser.php.

113 {
114 if ($this->in_meta_data) {
115 parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
116 return;
117 }
118
119 switch ($a_name) {
120 case 'Course':
121
122 if (strlen($a_attribs['importId'])) {
123 $this->log->write("CourseXMLParser: importId = " . $a_attribs['importId']);
124 $this->course_obj->setImportId($a_attribs['importId']);
125 ilObject::_writeImportId($this->course_obj->getId(), $a_attribs['importId']);
126 }
127 if (strlen($a_attribs['showMembers'])) {
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 if ($id_data['local'] or $id_data['imported']) {
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 if ($id_data['local'] or $id_data['imported']) {
145 $this->handleTutor($a_attribs, $id_data);
146 }
147 }
148 break;
149
150 case 'Member':
151 if ($id_data = $this->__parseId($a_attribs['id'])) {
152 if ($id_data['local'] or $id_data['imported']) {
153 $this->handleMember($a_attribs, $id_data);
154 }
155 }
156 break;
157
158 case 'Subscriber':
159 if ($id_data = $this->__parseId($a_attribs['id'])) {
160 if ($id_data['local'] or $id_data['imported']) {
161 $this->handleSubscriber($a_attribs, $id_data);
162 }
163 }
164 break;
165
166 case 'WaitingList':
167 if ($id_data = $this->__parseId($a_attribs['id'])) {
168 if ($id_data['local'] or $id_data['imported']) {
169 $this->handleWaitingList($a_attribs, $id_data);
170 }
171 }
172 break;
173
174 case 'Owner':
175 if ($id_data = $this->__parseId($a_attribs['id'])) {
176 if ($id_data['local'] or $id_data['imported']) {
177 $this->course_obj->setOwner($id_data['usr_id']);
178 $this->course_obj->updateOwner();
179 }
180 }
181 break;
182
183
184 case 'Settings':
185 $this->in_settings = true;
186 break;
187 case 'Availability':
188 $this->in_availability = true;
189 break;
190
191 case 'NotAvailable':
192 if ($this->in_availability) {
193 $this->course_obj->setOfflineStatus(true);
194 } elseif ($this->in_registration) {
195 $this->course_obj->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_DEACTIVATED);
196 }
197
198 break;
199
200 case 'Unlimited':
201 if ($this->in_availability) {
202 $this->course_obj->setOfflineStatus(false);
203 } elseif ($this->in_registration) {
204 $this->course_obj->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_UNLIMITED);
205 }
206
207 break;
208 case 'TemporarilyAvailable':
209 if ($this->in_availability) {
210 $this->course_obj->setOfflineStatus(false);
211 } elseif ($this->in_registration) {
212 $this->course_obj->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_LIMITED);
213 }
214 break;
215
216 case 'Start':
217 break;
218
219 case 'End':
220 break;
221
222 case 'Syllabus':
223 break;
224
225 case 'Contact':
226 break;
227
228 case 'Name':
229 case 'Responsibility':
230 case 'Phone':
231 case 'Email':
232 case 'Consultation':
233 break;
234
235 case 'Registration':
236 $this->in_registration = true;
237
238 switch ($a_attribs['registrationType']) {
239 case 'Confirmation':
240 $this->course_obj->setSubscriptionType(IL_CRS_SUBSCRIPTION_CONFIRMATION);
241 break;
242
243 case 'Direct':
244 $this->course_obj->setSubscriptionType(IL_CRS_SUBSCRIPTION_DIRECT);
245 break;
246
247 case 'Password':
248 $this->course_obj->setSubscriptionType(IL_CRS_SUBSCRIPTION_PASSWORD);
249 break;
250 }
251
252 $this->course_obj->setSubscriptionMaxMembers((int) $a_attribs['maxMembers']);
253 $this->course_obj->enableSubscriptionMembershipLimitation($this->course_obj->getSubscriptionMaxMembers() > 0);
254 $this->course_obj->setSubscriptionNotify($a_attribs['notification'] == 'Yes' ? true : false);
255 $this->course_obj->enableWaitingList($a_attribs['waitingList'] == 'Yes' ? true : false);
256 break;
257
258 case 'Sort':
259 include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
260 ilContainerSortingSettings::_importContainerSortingSettings($a_attribs, $this->course_obj->getId());
261
262 //#17837
263 $this->course_obj->setOrderType(
264 ilContainerSortingSettings::getInstanceByObjId($this->course_obj->getId())->getSortMode()
265 );
266 break;
267
268 case 'Disabled':
269 $this->course_obj->getSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_DEACTIVATED);
270 break;
271
272 case "MetaData":
273 $this->in_meta_data = true;
274 parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
275 break;
276
277 case 'ContainerSetting':
278 $this->current_container_setting = $a_attribs['id'];
279 break;
280
281 case 'Period':
282 $this->in_period = true;
283 break;
284
285 case 'WaitingListAutoFill':
286 case 'CancellationEnd':
287 case 'MinMembers':
288 break;
289 }
290 }
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 624 of file class.ilCourseXMLParser.php.

625 {
626 // call meta data handler
627 if ($this->in_meta_data) {
628 parent::handlerCharacterData($a_xml_parser, $a_data);
629 }
630 if ($a_data != "\n") {
631 // Replace multiple tabs with one space
632 $a_data = preg_replace("/\t+/", " ", $a_data);
633
634 $this->cdata .= $a_data;
635 }
636 }

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

478 {
479 if ($this->in_meta_data) {
480 parent::handlerEndTag($a_xml_parser, $a_name);
481 }
482
483 switch ($a_name) {
484 case 'Course':
485
486 $this->log->write('CourseXMLParser: import_id = ' . $this->course_obj->getImportId());
487 $this->course_obj->MDUpdateListener('General');
488 $this->course_obj->update();
489 $this->adv_md_handler->save();
490 break;
491
492 case 'Settings':
493 $this->in_settings = false;
494 break;
495
496 case 'Availability':
497 $this->in_availability = false;
498 break;
499
500 case 'Registration':
501 $this->in_registration = false;
502 break;
503
504
505 case 'Start':
506 if ($this->in_availability) {
507 $this->course_obj->setActivationStart(trim($this->cdata));
508 }
509 if ($this->in_registration) {
510 $this->course_obj->setSubscriptionStart(trim($this->cdata));
511 }
512 if ($this->in_period) {
513 if ((int) $this->cdata) {
514 $this->course_obj->setCourseStart(new ilDate((int) $this->cdata, IL_CAL_UNIX));
515 }
516 }
517 break;
518
519 case 'End':
520 if ($this->in_availability) {
521 $this->course_obj->setActivationEnd(trim($this->cdata));
522 }
523 if ($this->in_registration) {
524 $this->course_obj->setSubscriptionEnd(trim($this->cdata));
525 }
526 if ($this->in_period) {
527 if ((int) $this->cdata) {
528 $this->course_obj->setCourseEnd(new ilDate((int) $this->cdata, IL_CAL_UNIX));
529 }
530 }
531 break;
532
533 case 'Syllabus':
534 $this->course_obj->setSyllabus(trim($this->cdata));
535 break;
536
537
538 case 'ImportantInformation':
539 $this->course_obj->setImportantInformation(trim($this->cdata));
540 break;
541
542 case 'ViewMode':
543 $this->course_obj->setViewMode(trim($this->cdata));
544 break;
545
546 case 'Name':
547 $this->course_obj->setContactName(trim($this->cdata));
548 break;
549
550 case 'Responsibility':
551 $this->course_obj->setContactResponsibility(trim($this->cdata));
552 break;
553
554 case 'Phone':
555 $this->course_obj->setContactPhone(trim($this->cdata));
556 break;
557
558 case 'Email':
559 $this->course_obj->setContactEmail(trim($this->cdata));
560 break;
561
562 case 'Consultation':
563 $this->course_obj->setContactConsultation(trim($this->cdata));
564 break;
565
566 case 'Password':
567 $this->course_obj->setSubscriptionPassword(trim($this->cdata));
568 break;
569
570 case 'MetaData':
571 $this->in_meta_data = false;
572 parent::handlerEndTag($a_xml_parser, $a_name);
573 break;
574
575 case 'ContainerSetting':
576 if ($this->current_container_setting) {
578 $this->course_obj->getId(),
579 $this->current_container_setting,
580 $this->cdata
581 );
582 }
583 break;
584
585 case 'Period':
586 $this->in_period = false;
587 break;
588
589 case 'WaitingListAutoFill':
590 $this->course_obj->setWaitingListAutoFill($this->cdata);
591 break;
592
593 case 'CancellationEnd':
594 if ((int) $this->cdata) {
595 $this->course_obj->setCancellationEnd(new ilDate((int) $this->cdata, IL_CAL_UNIX));
596 }
597 break;
598
599 case 'MinMembers':
600 if ((int) $this->cdata) {
601 $this->course_obj->setSubscriptionMinMembers((int) $this->cdata);
602 }
603 break;
604
605 case 'ViewMode':
606 $this->course_obj->setViewMode((int) $this->cdata);
607 break;
608
609 case 'TimingMode':
610 $this->course_obj->setTimingMode((int) $this->cdata);
611 break;
612 }
613 $this->cdata = '';
614
615 return;
616 }
const IL_CAL_UNIX
static _writeContainerSetting($a_id, $a_keyword, $a_value)
Class for single dates.

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

435 {
436 if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach') {
437 // if action not set, or attach
438 if (!$this->course_members->isSubscriber($id_data['usr_id'])) {
439 // add only if not exist
440 $this->course_members->addSubscriber($id_data['usr_id']);
441 }
442 $this->course_members->updateSubscriptionTime($id_data['usr_id'], $a_attribs['subscriptionTime']);
443 } elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isSubscriber($id_data['usr_id'])) {
444 // if action set and detach and is subscriber
445 $this->course_members->deleteSubscriber($id_data["usr_id"]);
446 }
447 }

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

389 {
390 if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach') {
391 // if action not set, or attach
392 if (!array_key_exists($id_data['usr_id'], $this->course_members_array)) {
393 // add only if member is not assigned yet
394 $this->course_members->add($id_data['usr_id'], IL_CRS_TUTOR);
395 if ($a_attribs['notification'] == 'Yes') {
396 $this->course_members->updateNotification($id_data['usr_id'], true);
397 }
398 if ($a_attribs['passed'] == 'Yes') {
399 $this->course_members->updatePassed($id_data['usr_id'], true);
400 }
401 if (isset($a_attribs['contact']) && $a_attribs['contact'] == 'Yes') {
402 // default for new course admin/tutors is "no contact"
403 $this->course_members->updateContact($id_data['usr_id'], true);
404 }
405 $this->course_members_array[$id_data['usr_id']] = "added";
406 } else {
407 if ($a_attribs['notification'] == 'Yes') {
408 $this->course_members->updateNotification($id_data['usr_id'], true);
409 }
410 if ($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 $this->course_members->updateContact($id_data['usr_id'], true);
415 } elseif (isset($a_attribs['contact']) && $a_attribs['contact'] == 'No') {
416 $this->course_members->updateContact($id_data['usr_id'], false);
417 }
418 $this->course_members->updateBlocked($id_data['usr_id'], false);
419 }
420 } elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isTutor($id_data['usr_id'])) {
421 // if action set and detach and is tutor of course
422 $this->course_members->delete($id_data['usr_id']);
423 }
424 }
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 455 of file class.ilCourseXMLParser.php.

456 {
457 if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach') {
458 // if action not set, or attach
459 if (!$this->course_waiting_list->isOnList($id_data['usr_id'])) {
460 // add only if not exists
461 $this->course_waiting_list->addToList($id_data['usr_id']);
462 }
463 $this->course_waiting_list->updateSubscriptionTime($id_data['usr_id'], $a_attribs['subscriptionTime']);
464 } elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_waiting_list->isOnList($id_data['usr_id'])) {
465 // if action set and detach and is on list
466 $this->course_waiting_list->removeFromList($id_data['usr_id']);
467 }
468 }

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

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

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().

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