25 include_once(
"Services/MetaData/classes/class.ilMDSaxParser.php");
26 include_once(
"Services/MetaData/classes/class.ilMD.php");
27 include_once(
'Services/Utilities/interfaces/interface.ilSaxSubsetParser.php');
28 include_once(
'Services/Utilities/classes/class.ilSaxController.php');
29 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
30 include_once
'Modules/Course/classes/class.ilCourseWaitingList.php';
31 include_once
'Modules/Course/classes/class.ilCourseConstants.php';
66 parent::__construct($a_xml_file);
72 $this->course_obj = $a_course_obj;
76 $this->course_members_array = array_flip($this->course_members->getParticipants());
78 $this->md_obj =
new ilMD($this->course_obj->getId(), 0,
'crs');
92 $this->sax_controller->setHandlers($a_xml_parser);
93 $this->sax_controller->setDefaultElementHandler($this);
95 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDValueParser.php');
96 $this->sax_controller->setElementHandler(
114 if ($this->in_meta_data) {
115 parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
122 if (strlen($a_attribs[
'importId'])) {
123 $this->log->write(
"CourseXMLParser: importId = " . $a_attribs[
'importId']);
124 $this->course_obj->setImportId($a_attribs[
'importId']);
127 if (strlen($a_attribs[
'showMembers'])) {
128 $this->course_obj->setShowMembers(
129 $a_attribs[
'showMembers'] ==
'Yes' ?
true :
false 135 if ($id_data = $this->
__parseId($a_attribs[
'id'])) {
136 if ($id_data[
'local']
or $id_data[
'imported']) {
143 if ($id_data = $this->
__parseId($a_attribs[
'id'])) {
144 if ($id_data[
'local']
or $id_data[
'imported']) {
151 if ($id_data = $this->
__parseId($a_attribs[
'id'])) {
152 if ($id_data[
'local']
or $id_data[
'imported']) {
159 if ($id_data = $this->
__parseId($a_attribs[
'id'])) {
160 if ($id_data[
'local']
or $id_data[
'imported']) {
167 if ($id_data = $this->
__parseId($a_attribs[
'id'])) {
168 if ($id_data[
'local']
or $id_data[
'imported']) {
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();
185 $this->in_settings =
true;
188 $this->in_availability =
true;
192 if ($this->in_availability) {
193 $this->course_obj->setOfflineStatus(
true);
194 } elseif ($this->in_registration) {
201 if ($this->in_availability) {
202 $this->course_obj->setOfflineStatus(
false);
203 } elseif ($this->in_registration) {
208 case 'TemporarilyAvailable':
209 if ($this->in_availability) {
210 $this->course_obj->setOfflineStatus(
false);
211 } elseif ($this->in_registration) {
229 case 'Responsibility':
236 $this->in_registration =
true;
238 switch ($a_attribs[
'registrationType']) {
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);
259 include_once
'./Services/Container/classes/class.ilContainerSortingSettings.php';
263 $this->course_obj->setOrderType(
273 $this->in_meta_data =
true;
274 parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
277 case 'ContainerSetting':
278 $this->current_container_setting = $a_attribs[
'id'];
282 $this->in_period =
true;
285 case 'WaitingListAutoFill':
286 case 'CancellationEnd':
302 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
'Attach') {
304 if (!array_key_exists($id_data[
'usr_id'], $this->course_members_array)) {
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);
310 if ($a_attribs[
'passed'] ==
'Yes') {
311 $this->course_members->updatePassed($id_data[
'usr_id'],
true);
313 $this->course_members_array[$id_data[
'usr_id']] =
"added";
316 if ($a_attribs[
'blocked'] ==
'Yes') {
317 $this->course_members->updateBlocked($id_data[
'usr_id'],
true);
319 if ($a_attribs[
'passed'] ==
'Yes') {
320 $this->course_members->updatePassed($id_data[
'usr_id'],
true);
323 } elseif (isset($a_attribs[
'action']) && $a_attribs[
'action'] ==
'Detach' && $this->course_members->isMember($id_data[
'usr_id'])) {
325 $this->course_members->delete($id_data[
'usr_id']);
341 $rbacadmin = $DIC[
'rbacadmin'];
343 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
'Attach') {
345 if (!array_key_exists($id_data[
'usr_id'], $this->course_members_array)) {
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);
351 if ($a_attribs[
'passed'] ==
'Yes') {
352 $this->course_members->updatePassed($id_data[
'usr_id'],
true);
354 if (isset($a_attribs[
'contact']) && $a_attribs[
'contact'] ==
'Yes') {
356 $this->course_members->updateContact($id_data[
'usr_id'],
true);
358 $this->course_members_array[$id_data[
'usr_id']] =
"added";
361 if ($a_attribs[
'notification'] ==
'Yes') {
362 $this->course_members->updateNotification($id_data[
'usr_id'],
true);
364 if ($a_attribs[
'passed'] ==
'Yes') {
365 $this->course_members->updatePassed($id_data[
'usr_id'],
true);
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);
372 $this->course_members->updateBlocked($id_data[
'usr_id'],
false);
374 } elseif (isset($a_attribs[
'action']) && $a_attribs[
'action'] ==
'Detach' && $this->course_members->isAdmin($id_data[
'usr_id'])) {
376 $this->course_members->delete($id_data[
'usr_id']);
390 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
'Attach') {
392 if (!array_key_exists($id_data[
'usr_id'], $this->course_members_array)) {
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);
398 if ($a_attribs[
'passed'] ==
'Yes') {
399 $this->course_members->updatePassed($id_data[
'usr_id'],
true);
401 if (isset($a_attribs[
'contact']) && $a_attribs[
'contact'] ==
'Yes') {
403 $this->course_members->updateContact($id_data[
'usr_id'],
true);
405 $this->course_members_array[$id_data[
'usr_id']] =
"added";
407 if ($a_attribs[
'notification'] ==
'Yes') {
408 $this->course_members->updateNotification($id_data[
'usr_id'],
true);
410 if ($a_attribs[
'passed'] ==
'Yes') {
411 $this->course_members->updatePassed($id_data[
'usr_id'],
true);
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);
418 $this->course_members->updateBlocked($id_data[
'usr_id'],
false);
420 } elseif (isset($a_attribs[
'action']) && $a_attribs[
'action'] ==
'Detach' && $this->course_members->isTutor($id_data[
'usr_id'])) {
422 $this->course_members->delete($id_data[
'usr_id']);
436 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
'Attach') {
438 if (!$this->course_members->isSubscriber($id_data[
'usr_id'])) {
440 $this->course_members->addSubscriber($id_data[
'usr_id']);
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'])) {
445 $this->course_members->deleteSubscriber($id_data[
"usr_id"]);
457 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
'Attach') {
459 if (!$this->course_waiting_list->isOnList($id_data[
'usr_id'])) {
461 $this->course_waiting_list->addToList($id_data[
'usr_id']);
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'])) {
466 $this->course_waiting_list->removeFromList($id_data[
'usr_id']);
479 if ($this->in_meta_data) {
480 parent::handlerEndTag($a_xml_parser, $a_name);
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();
493 $this->in_settings =
false;
497 $this->in_availability =
false;
501 $this->in_registration =
false;
506 if ($this->in_availability) {
507 $this->course_obj->setActivationStart(trim($this->cdata));
509 if ($this->in_registration) {
510 $this->course_obj->setSubscriptionStart(trim($this->cdata));
512 if ($this->in_period) {
513 if ((
int) $this->cdata) {
520 if ($this->in_availability) {
521 $this->course_obj->setActivationEnd(trim($this->cdata));
523 if ($this->in_registration) {
524 $this->course_obj->setSubscriptionEnd(trim($this->cdata));
526 if ($this->in_period) {
527 if ((
int) $this->cdata) {
534 $this->course_obj->setSyllabus(trim($this->cdata));
538 case 'ImportantInformation':
539 $this->course_obj->setImportantInformation(trim($this->cdata));
543 $this->course_obj->setViewMode(trim($this->cdata));
547 $this->course_obj->setContactName(trim($this->cdata));
550 case 'Responsibility':
551 $this->course_obj->setContactResponsibility(trim($this->cdata));
555 $this->course_obj->setContactPhone(trim($this->cdata));
559 $this->course_obj->setContactEmail(trim($this->cdata));
563 $this->course_obj->setContactConsultation(trim($this->cdata));
567 $this->course_obj->setSubscriptionPassword(trim($this->cdata));
571 $this->in_meta_data =
false;
572 parent::handlerEndTag($a_xml_parser, $a_name);
575 case 'ContainerSetting':
576 if ($this->current_container_setting) {
578 $this->course_obj->getId(),
586 $this->in_period =
false;
589 case 'WaitingListAutoFill':
590 $this->course_obj->setWaitingListAutoFill($this->cdata);
593 case 'CancellationEnd':
594 if ((
int) $this->cdata) {
595 $this->course_obj->setCancellationEnd(
new ilDate((
int) $this->cdata,
IL_CAL_UNIX));
600 if ((
int) $this->cdata) {
601 $this->course_obj->setSubscriptionMinMembers((
int) $this->cdata);
606 $this->course_obj->setViewMode((
int) $this->cdata);
610 $this->course_obj->setTimingMode((
int) $this->cdata);
627 if ($this->in_meta_data) {
628 parent::handlerCharacterData($a_xml_parser, $a_data);
630 if ($a_data !=
"\n") {
632 $a_data = preg_replace(
"/\t+/",
" ", $a_data);
634 $this->cdata .= $a_data;
645 $fields = explode(
'_', $a_id);
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])) {
655 return array(
'imported' =>
true,
660 return array(
'imported' =>
false,
662 'usr_id' => $fields[3]);
static _lookupLogin($a_user_id)
lookup login
__construct($a_course_obj, $a_xml_file='')
Constructor.
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
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
if(!array_key_exists('StateId', $_REQUEST)) $id
setHandlers($a_xml_parser)
set event handlers
handleAdmin($a_attribs, $id_data)
attach or detach admin from course member
$current_container_setting
const IL_CRS_SUBSCRIPTION_CONFIRMATION
handleWaitingList($a_attribs, $id_data)
attach or detach members from waitinglist
static _getImportedUserId($i2_id)
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
handlerEndTag($a_xml_parser, $a_name)
handler for end of element
const IL_CRS_SUBSCRIPTION_PASSWORD
const IL_CRS_SUBSCRIPTION_UNLIMITED
handleTutor($a_attribs, $id_data)
attach or detach admin from course member
const IL_CRS_ADMIN
Base class for course and group participants.
Interface definition for sax subset parsers.
Controller class for sax element handlers.
static _writeImportId($a_obj_id, $a_import_id)
write import id to db (static)
static _writeContainerSetting($a_id, $a_keyword, $a_value)
const IL_CRS_SUBSCRIPTION_DIRECT
static getInstanceByObjId($a_obj_id)
Get singleton instance.
handlerCharacterData($a_xml_parser, $a_data)
handler for character data
handleSubscriber($a_attribs, $id_data)
attach or detach members from subscribers
const IL_CRS_SUBSCRIPTION_DEACTIVATED