ILIAS  release_7 Revision v7.30-3-g800a261c036
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

 __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
 
 $course_obj
 
 $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 ilMDSaxParser
 trimAndStripAttribs (array $attribs)
 
 trimAndStrip (string $input)
 
- 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 69 of file class.ilCourseXMLParser.php.

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

70  {
71  global $DIC;
72 
73  $lng = $DIC['lng'];
74 
75  parent::__construct($a_xml_file);
76 
77  $this->sax_controller = new ilSaxController();
78 
79  $this->log = $DIC->logger()->crs();
80 
81  $this->course_obj = $a_course_obj;
82  $this->course_members = ilCourseParticipants::_getInstanceByObjId($this->course_obj->getId());
83  $this->course_waiting_list = new ilCourseWaitingList($this->course_obj->getId());
84  // flip the array so we can use array_key_exists
85  $this->course_members_array = array_flip($this->course_members->getParticipants());
86 
87  $this->md_obj = new ilMD($this->course_obj->getId(), 0, 'crs');
88  $this->setMDObject($this->md_obj);
89 
90  $this->lng = $lng;
91  }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
global $DIC
Definition: goto.php:24
Controller class for sax element handlers.
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ __parseId()

ilCourseXMLParser::__parseId (   $a_id)

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

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

Referenced by handlerBeginTag().

711  {
712  global $DIC;
713 
714  $ilias = $DIC['ilias'];
715 
716  $fields = explode('_', $a_id);
717 
718  if (!is_array($fields) or
719  $fields[0] != 'il' or
720  !is_numeric($fields[1]) or
721  $fields[2] != 'usr' or
722  !is_numeric($fields[3])) {
723  return false;
724  }
725  if ($id = ilObjUser::_getImportedUserId($a_id)) {
726  return array('imported' => true,
727  'local' => false,
728  'usr_id' => $id);
729  }
730  if (($fields[1] == $ilias->getSetting('inst_id', 0)) and strlen(ilObjUser::_lookupLogin($fields[3]))) {
731  return array('imported' => false,
732  'local' => true,
733  'usr_id' => $fields[3]);
734  }
735  return false;
736  }
static _lookupLogin($a_user_id)
lookup login
static _getImportedUserId($i2_id)
global $DIC
Definition: goto.php:24
+ 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 378 of file class.ilCourseXMLParser.php.

References $DIC, and IL_CRS_ADMIN.

Referenced by handlerBeginTag().

379  {
380  global $DIC;
381 
382  $rbacadmin = $DIC['rbacadmin'];
383 
384  if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach') {
385  // if action not set, or attach
386  if (!array_key_exists($id_data['usr_id'], $this->course_members_array)) {
387  // add only if member is not assigned yet
388  $this->course_members->add($id_data['usr_id'], IL_CRS_ADMIN);
389  if ($a_attribs['notification'] == 'Yes') {
390  $this->course_members->updateNotification($id_data['usr_id'], true);
391  }
392  if ($a_attribs['passed'] == 'Yes') {
393  $this->course_members->updatePassed($id_data['usr_id'], true);
394  }
395  if (isset($a_attribs['contact']) && $a_attribs['contact'] == 'Yes') {
396  // default for new course admin/tutors is "no contact"
397  $this->course_members->updateContact($id_data['usr_id'], true);
398  }
399  $this->course_members_array[$id_data['usr_id']] = "added";
400  } else {
401  // update
402  if ($a_attribs['notification'] == 'Yes') {
403  $this->course_members->updateNotification($id_data['usr_id'], true);
404  }
405  if ($a_attribs['passed'] == 'Yes') {
406  $this->course_members->updatePassed($id_data['usr_id'], true);
407  }
408  if (isset($a_attribs['contact']) && $a_attribs['contact'] == 'Yes') {
409  $this->course_members->updateContact($id_data['usr_id'], true);
410  } elseif (isset($a_attribs['contact']) && $a_attribs['contact'] == 'No') {
411  $this->course_members->updateContact($id_data['usr_id'], false);
412  }
413  $this->course_members->updateBlocked($id_data['usr_id'], false);
414  }
415  } elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isAdmin($id_data['usr_id'])) {
416  // if action set and detach and is admin of course
417  $this->course_members->delete($id_data['usr_id']);
418  }
419  }
global $DIC
Definition: goto.php:24
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 341 of file class.ilCourseXMLParser.php.

References IL_CRS_MEMBER.

Referenced by handlerBeginTag().

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

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, IL_CRS_SUBSCRIPTION_UNLIMITED, and ilMDSaxParser\trimAndStripAttribs().

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

696  {
697  // call meta data handler
698  if ($this->in_meta_data) {
699  parent::handlerCharacterData($a_xml_parser, $a_data);
700  }
701  if ($a_data != "\n") {
702  // Replace multiple tabs with one space
703  $a_data = preg_replace("/\t+/", " ", $a_data);
704 
705  $this->cdata .= $a_data;
706  }
707  }

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

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

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

Referenced by handlerBeginTag().

476  {
477  if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach') {
478  // if action not set, or attach
479  if (!$this->course_members->isSubscriber($id_data['usr_id'])) {
480  // add only if not exist
481  $this->course_members->addSubscriber($id_data['usr_id']);
482  }
483  $this->course_members->updateSubscriptionTime($id_data['usr_id'], $a_attribs['subscriptionTime']);
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  $this->course_members->deleteSubscriber($id_data["usr_id"]);
487  }
488  }
+ 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 429 of file class.ilCourseXMLParser.php.

References IL_CRS_TUTOR.

Referenced by handlerBeginTag().

430  {
431  if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach') {
432  // if action not set, or attach
433  if (!array_key_exists($id_data['usr_id'], $this->course_members_array)) {
434  // add only if member is not assigned yet
435  $this->course_members->add($id_data['usr_id'], IL_CRS_TUTOR);
436  if ($a_attribs['notification'] == 'Yes') {
437  $this->course_members->updateNotification($id_data['usr_id'], true);
438  }
439  if ($a_attribs['passed'] == 'Yes') {
440  $this->course_members->updatePassed($id_data['usr_id'], true);
441  }
442  if (isset($a_attribs['contact']) && $a_attribs['contact'] == 'Yes') {
443  // default for new course admin/tutors is "no contact"
444  $this->course_members->updateContact($id_data['usr_id'], true);
445  }
446  $this->course_members_array[$id_data['usr_id']] = "added";
447  } else {
448  if ($a_attribs['notification'] == 'Yes') {
449  $this->course_members->updateNotification($id_data['usr_id'], true);
450  }
451  if ($a_attribs['passed'] == 'Yes') {
452  $this->course_members->updatePassed($id_data['usr_id'], true);
453  }
454  if (isset($a_attribs['contact']) && $a_attribs['contact'] == 'Yes') {
455  $this->course_members->updateContact($id_data['usr_id'], true);
456  } elseif (isset($a_attribs['contact']) && $a_attribs['contact'] == 'No') {
457  $this->course_members->updateContact($id_data['usr_id'], false);
458  }
459  $this->course_members->updateBlocked($id_data['usr_id'], false);
460  }
461  } elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_members->isTutor($id_data['usr_id'])) {
462  // if action set and detach and is tutor of course
463  $this->course_members->delete($id_data['usr_id']);
464  }
465  }
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 496 of file class.ilCourseXMLParser.php.

Referenced by handlerBeginTag().

497  {
498  if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach') {
499  // if action not set, or attach
500  if (!$this->course_waiting_list->isOnList($id_data['usr_id'])) {
501  // add only if not exists
502  $this->course_waiting_list->addToList($id_data['usr_id']);
503  }
504  $this->course_waiting_list->updateSubscriptionTime($id_data['usr_id'], $a_attribs['subscriptionTime']);
505  } elseif (isset($a_attribs['action']) && $a_attribs['action'] == 'Detach' && $this->course_waiting_list->isOnList($id_data['usr_id'])) {
506  // if action set and detach and is on list
507  $this->course_waiting_list->removeFromList($id_data['usr_id']);
508  }
509  }
+ 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 99 of file class.ilCourseXMLParser.php.

100  {
101  $this->sax_controller->setHandlers($a_xml_parser);
102  $this->sax_controller->setDefaultElementHandler($this);
103 
104  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValueParser.php');
105  $this->sax_controller->setElementHandler(
106  $this->adv_md_handler = new ilAdvancedMDValueParser($this->course_obj->getId()),
107  'AdvancedMetaData'
108  );
109  }

Field Documentation

◆ $course_obj

ilCourseXMLParser::$course_obj
private

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

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

◆ $log

ilCourseXMLParser::$log = null
private

Definition at line 58 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: