예제 #1
0
 /**
  * delete course and all related data	
  *
  * @access	public
  * @return	boolean	true if all object data were removed; false if only a references were removed
  */
 function delete()
 {
     global $ilAppEventHandler;
     // always call parent delete function first!!
     if (!parent::delete()) {
         return false;
     }
     // delete meta data
     $this->deleteMetaData();
     // put here course specific stuff
     $this->__deleteSettings();
     include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
     ilCourseParticipants::_deleteAllEntries($this->getId());
     $this->initCourseArchiveObject();
     $this->archives_obj->deleteAll();
     include_once './Modules/Course/classes/class.ilCourseObjective.php';
     ilCourseObjective::_deleteAll($this->getId());
     include_once './Modules/Course/classes/class.ilObjCourseGrouping.php';
     ilObjCourseGrouping::_deleteAll($this->getId());
     include_once './Modules/Course/classes/class.ilCourseFile.php';
     ilCourseFile::_deleteByCourse($this->getId());
     include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php';
     ilCourseDefinedFieldDefinition::_deleteByContainer($this->getId());
     $ilAppEventHandler->raise('Modules/Course', 'delete', array('object' => $this, 'obj_id' => $this->getId(), 'appointments' => $this->prepareAppointments('delete')));
     return true;
 }
 function updateCourse($sid, $course_id, $xml)
 {
     $this->initAuth($sid);
     $this->initIlias();
     if (!$this->__checkSession($sid)) {
         return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
     }
     if (!is_numeric($course_id)) {
         return $this->__raiseError('No valid course id given. Please choose an existing reference id of an ILIAS course', 'Client');
     }
     global $rbacsystem;
     if (($obj_type = ilObject::_lookupType(ilObject::_lookupObjId($course_id))) != 'crs') {
         $course_id = end($ref_ids = ilObject::_getAllReferences($course_id));
         if (ilObject::_lookupType(ilObject::_lookupObjId($course_id)) != 'crs') {
             return $this->__raiseError('Invalid course id. Object with id "' . $course_id . '" is not of type "course"', 'Client');
         }
     }
     if (!($tmp_course = ilObjectFactory::getInstanceByRefId($course_id, false))) {
         return $this->__raiseError('Cannot create course instance!', 'Server');
     }
     if (!$rbacsystem->checkAccess('write', $course_id)) {
         return $this->__raiseError('Check access failed. No permission to write course', 'Server');
     }
     // First delete old meta data
     include_once 'Services/MetaData/classes/class.ilMD.php';
     $md = new ilMD($tmp_course->getId(), 0, 'crs');
     $md->deleteAll();
     include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
     ilCourseParticipants::_deleteAllEntries($tmp_course->getId());
     include_once 'Modules/Course/classes/class.ilCourseWaitingList.php';
     ilCourseWaitingList::_deleteAll($tmp_course->getId());
     include_once 'Modules/Course/classes/class.ilCourseXMLParser.php';
     $xml_parser = new ilCourseXMLParser($tmp_course);
     $xml_parser->setXMLContent($xml);
     $xml_parser->startParsing();
     $tmp_course->MDUpdateListener('General');
     return true;
 }