/**
  * Add XML archive
  *
  * @param	array		selection array: key is ref_id, value is "last_file", "omit" or "create"
  */
 function addXML($a_selection = "")
 {
     $this->setType($this->ARCHIVE_XML);
     $this->setName(time() . '__' . $this->ilias->getSetting('inst_id') . '__crs_' . $this->course_obj->getId());
     $this->setDate(time());
     // Step one create folder
     $this->initCourseFilesObject();
     $this->course_files_obj->addArchiveSubDirectory($this->getName());
     // Step two create course xml
     $this->initCourseXMLWriter();
     $this->course_xml_writer->start();
     $this->course_files_obj->writeArchiveFile($this->course_xml_writer->getXML(), $this->getName() . '/' . $this->getName() . '.xml');
     // Step three create child object xml
     // add objects directory
     $this->course_files_obj->addArchiveSubDirectory($this->getName() . '/objects');
     $this->copied_files = array();
     $this->__addZipFiles($this->course_obj->getRefId(), $a_selection);
     // Step four: Write index file
     include_once "./Services/Export/classes/class.ilExport.php";
     ilExport::_generateIndexFile($this->course_files_obj->getArchiveDirectory() . '/' . $this->getName() . '/index.html', $this->course_obj->getId(), $this->copied_files);
     // Step five zip
     $this->setSize($this->course_files_obj->zipArchive($this->getName(), $this->getName() . '.zip'));
     // Finally add entry in crs_archives table
     $this->add();
     return true;
 }