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');
40 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
41 include_once
'Modules/Course/classes/class.ilCourseWaitingList.php';
67 $this->course_obj =& $a_course_obj;
71 $this->course_members_array = array_flip($this->course_members->getParticipants());
73 $this->md_obj =
new ilMD($this->course_obj->getId(),0,
'crs');
88 $this->sax_controller->setHandlers($a_xml_parser);
89 $this->sax_controller->setDefaultElementHandler($this);
91 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDValueParser.php');
92 $this->sax_controller->setElementHandler(
109 if($this->in_meta_data)
120 if(strlen($a_attribs[
'importId']))
122 $this->log->write(
"CourseXMLParser: importId = ".$a_attribs[
'importId']);
123 $this->course_obj->setImportId($a_attribs[
'importId']);
126 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']))
137 if($id_data[
'local'] or $id_data[
'imported'])
145 if($id_data = $this->
__parseId($a_attribs[
'id']))
147 if($id_data[
'local'] or $id_data[
'imported'])
156 if($id_data = $this->
__parseId($a_attribs[
'id']))
158 if($id_data[
'local'] or $id_data[
'imported'])
166 if($id_data = $this->
__parseId($a_attribs[
'id']))
168 if($id_data[
'local'] or $id_data[
'imported'])
176 if($id_data = $this->
__parseId($a_attribs[
'id']))
178 if($id_data[
'local'] or $id_data[
'imported'])
187 $this->in_settings =
true;
190 $this->in_availability =
true;
194 if($this->in_availability)
198 elseif($this->in_registration)
206 if($this->in_availability)
210 elseif($this->in_registration)
216 case 'TemporarilyAvailable':
217 if($this->in_availability)
221 elseif($this->in_registration)
240 case 'Responsibility':
247 $this->in_registration =
true;
249 switch($a_attribs[
'registrationType'])
263 $this->course_obj->setSubscriptionMaxMembers((
int) $a_attribs[
'maxMembers']);
264 $this->course_obj->setSubscriptionNotify($a_attribs[
'notification'] ==
'Yes' ?
true :
false);
265 $this->course_obj->enableWaitingList($a_attribs[
'waitingList'] ==
'Yes' ?
true :
false);
269 switch($a_attribs[
'type'])
287 $this->in_archive =
true;
288 switch($a_attribs[
'Access'])
296 #$this->course_obj->setViewMode(IL_CRS_VIEW_ARCHIVE);
300 #$this->course_obj->setViewMode(IL_CRS_VIEW_ARCHIVE);
311 $this->in_meta_data =
true;
328 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
'Attach')
331 if (!array_key_exists($id_data[
'usr_id'], $this->course_members_array))
334 $this->course_members->add($id_data[
'usr_id'],
IL_CRS_MEMBER);
335 if($a_attribs[
'blocked'] ==
'Yes')
337 $this->course_members->updateBlocked($id_data[
'usr_id'],
true);
339 if($a_attribs[
'passed'] ==
'Yes')
341 $this->course_members->updatePassed($id_data[
'usr_id'],
true);
343 $this->course_members_array[$id_data[
'usr_id']] =
"added";
348 if($a_attribs[
'blocked'] ==
'Yes')
350 $this->course_members->updateBlocked($id_data[
'usr_id'],
true);
352 if($a_attribs[
'passed'] ==
'Yes')
354 $this->course_members->updatePassed($id_data[
'usr_id'],
true);
358 elseif (isset($a_attribs[
'action']) && $a_attribs[
'action'] ==
'Detach' && $this->course_members->isMember($id_data[
'usr_id']))
361 $this->course_members->delete($id_data[
'usr_id']);
378 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
'Attach')
381 if (!array_key_exists($id_data[
'usr_id'], $this->course_members_array))
384 $this->course_members->add($id_data[
'usr_id'],
IL_CRS_ADMIN);
385 if($a_attribs[
'notification'] ==
'Yes')
387 $this->course_members->updateNotification($id_data[
'usr_id'],
true);
389 if($a_attribs[
'passed'] ==
'Yes')
391 $this->course_members->updatePassed($id_data[
'usr_id'],
true);
393 $this->course_members_array[$id_data[
'usr_id']] =
"added";
398 if($a_attribs[
'notification'] ==
'Yes')
400 $this->course_members->updateNotification($id_data[
'usr_id'],
true);
402 if($a_attribs[
'passed'] ==
'Yes')
404 $this->course_members->updatePassed($id_data[
'usr_id'],
true);
406 $this->course_members->updateBlocked($id_data[
'usr_id'],
false);
409 elseif (isset($a_attribs[
'action']) && $a_attribs[
'action'] ==
'Detach' && $this->course_members->isAdmin($id_data[
'usr_id']))
412 $this->course_members->delete($id_data[
'usr_id']);
426 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
'Attach')
429 if (!array_key_exists($id_data[
'usr_id'], $this->course_members_array))
432 $this->course_members->add($id_data[
'usr_id'],
IL_CRS_TUTOR);
433 if($a_attribs[
'notification'] ==
'Yes')
435 $this->course_members->updateNotification($id_data[
'usr_id'],
true);
437 if($a_attribs[
'passed'] ==
'Yes')
439 $this->course_members->updatePassed($id_data[
'usr_id'],
true);
441 $this->course_members_array[$id_data[
'usr_id']] =
"added";
445 if($a_attribs[
'notification'] ==
'Yes')
447 $this->course_members->updateNotification($id_data[
'usr_id'],
true);
449 if($a_attribs[
'passed'] ==
'Yes')
451 $this->course_members->updatePassed($id_data[
'usr_id'],
true);
453 $this->course_members->updateBlocked($id_data[
'usr_id'],
false);
456 elseif (isset($a_attribs[
'action']) && $a_attribs[
'action'] ==
'Detach' && $this->course_members->isTutor($id_data[
'usr_id']))
459 $this->course_members->delete($id_data[
'usr_id']);
473 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
'Attach')
476 if (!$this->course_members->isSubscriber($id_data[
'usr_id']))
479 $this->course_members->addSubscriber($id_data[
'usr_id']);
481 $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']))
487 $this->course_members->deleteSubscriber($id_data[
"usr_id"]);
500 if (!isset($a_attribs[
'action']) || $a_attribs[
'action'] ==
'Attach')
503 if (!$this->course_waiting_list->isOnList($id_data[
'usr_id']))
506 $this->course_waiting_list->addToList($id_data[
'usr_id']);
508 $this->course_waiting_list->updateSubscriptionTime($id_data[
'usr_id'],$a_attribs[
'subscriptionTime']);
511 elseif (isset($a_attribs[
'action']) && $a_attribs[
'action'] ==
'Detach' && $this->course_waiting_list->isOnList($id_data[
'usr_id']))
514 $this->course_waiting_list->removeFromList($id_data[
'usr_id']);
528 if($this->in_meta_data)
537 $this->log->write(
'CourseXMLParser: import_id = '.$this->course_obj->getImportId());
538 $this->course_obj->updateSettings();
539 $this->adv_md_handler->save();
543 $this->in_settings =
false;
547 $this->in_availability =
false;
551 $this->in_registration =
false;
555 $this->in_archive =
false;
559 if($this->in_availability)
561 $this->course_obj->setActivationStart(trim($this->cdata));
563 if($this->in_registration)
565 $this->course_obj->setSubscriptionStart(trim($this->cdata));
567 if($this->in_archive)
569 $this->course_obj->setArchiveStart(trim($this->cdata));
574 if($this->in_availability)
576 $this->course_obj->setActivationEnd(trim($this->cdata));
578 if($this->in_registration)
580 $this->course_obj->setSubscriptionEnd(trim($this->cdata));
582 if($this->in_archive)
584 $this->course_obj->setArchiveEnd(trim($this->cdata));
589 $this->course_obj->setSyllabus(trim($this->cdata));
593 case 'ImportantInformation':
594 $this->course_obj->setImportantInformation(trim($this->cdata));
598 $this->course_obj->setContactName(trim($this->cdata));
601 case 'Responsibility':
602 $this->course_obj->setContactResponsibility(trim($this->cdata));
606 $this->course_obj->setContactPhone(trim($this->cdata));
610 $this->course_obj->setContactEmail(trim($this->cdata));
614 $this->course_obj->setContactConsultation(trim($this->cdata));
618 $this->course_obj->setSubscriptionPassword(trim($this->cdata));
622 $this->in_meta_data =
false;
640 if($this->in_meta_data)
647 $a_data = preg_replace(
"/\t+/",
" ",$a_data);
649 $this->cdata .= $a_data;
658 $fields = explode(
'_',$a_id);
660 if(!is_array($fields) or
661 $fields[0] !=
'il' or
662 !is_numeric($fields[1]) or
663 $fields[2] !=
'usr' or
664 !is_numeric($fields[3]))
670 return array(
'imported' =>
true,
676 return array(
'imported' =>
false,
678 'usr_id' => $fields[3]);