24 include_once(
'Modules/Course/classes/class.ilFSStorageCourse.php');
66 $this->ARCHIVE_XML = 1;
67 $this->ARCHIVE_HTML = 2;
68 $this->ARCHIVE_PDF = 3;
78 return $this->archives;
83 return $this->archives[$a_id];
88 foreach($this->archives as $id => $archive)
90 if($archive[
'archive_type'] == $this->ARCHIVE_XML)
94 if($this->course_obj->getArchiveType() != $this->course_obj->ARCHIVE_DOWNLOAD and
95 $archive[
'archive_type'] == $this->ARCHIVE_PDF)
99 $public_archives[$id] = $archive;
102 return $public_archives ? $public_archives : array();
107 $this->archive_type = $a_type;
111 return $this->archive_type ? $this->archive_type : $this->ARCHIVE_XML;
116 $this->archive_date = $a_date;
120 return $this->archive_date ? $this->archive_date : time();
125 $this->archive_size = $a_size;
133 $this->archive_name = $a_name;
141 $this->archive_lang = $a_lang_code;
156 return $this->course_files_obj->getArchiveDirectory().
'/'.$archive[
'archive_name'].
'.zip';
160 return $this->course_files_obj->getArchiveDirectory().
'/'.$archive[
'archive_name'];
172 $this->
setType($this->ARCHIVE_XML);
173 $this->
setName(time().
'__'.$this->ilias->getSetting(
'inst_id').
'__crs_'.$this->course_obj->getId());
178 $this->course_files_obj->addArchiveSubDirectory($this->
getName());
183 $this->course_xml_writer->start();
184 $this->course_files_obj->writeArchiveFile($this->course_xml_writer->getXML(),$this->
getName().
'/'.$this->
getName().
'.xml');
189 $this->course_files_obj->addArchiveSubDirectory($this->
getName().
'/objects');
191 $this->copied_files = array();
192 $this->
__addZipFiles($this->course_obj->getRefId(), $a_selection);
195 include_once(
"./Services/Export/classes/class.ilExport.php");
197 $this->
getName().
'/index.html', $this->course_obj->getId(),$this->copied_files);
200 $this->
setSize($this->course_files_obj->zipArchive($this->getName(),$this->
getName().
'.zip'));
211 $this->
setType($this->ARCHIVE_HTML);
213 $this->
setName($this->
getDate().
'__'.$this->ilias->getSetting(
'inst_id').
'__crs_'.$this->course_obj->getId());
217 $this->course_files_obj->addArchiveSubDirectory($this->
getName());
220 $this->course_files_obj->addArchiveSubDirectory($this->
getName().
'/objects');
227 $this->course_files_obj->createArchiveOnlineVersion($this->
getName());
230 $this->
setSize($this->course_files_obj->zipArchive($this->getName(),$this->
getName().
'.zip'));
243 $next_id = $ilDB->nextId(
'crs_archives');
244 $query =
"INSERT INTO crs_archives (archive_id,course_id,archive_name,archive_type,archive_date,archive_size,archive_lang) ".
246 $ilDB->quote($next_id,
'integer').
", ".
247 $ilDB->quote($this->course_obj->getId(),
'integer').
",".
248 $ilDB->quote($this->getName(),
'text').
",".
249 $ilDB->quote($this->getType(),
'integer').
", ".
250 $ilDB->quote($this->getDate(),
'integer').
",".
251 $ilDB->quote($this->getSize(),
'integer').
",".
252 $ilDB->quote($this->getLanguage(),
'text').
260 function delete($a_id)
267 $this->course_files_obj->deleteArchive($this->archives[$a_id][
"archive_name"]);
269 $query =
"DELETE FROM crs_archives ".
270 "WHERE course_id = ".$ilDB->quote($this->course_obj->getId(),
'integer').
" ".
271 "AND archive_id = ".$ilDB->quote($a_id,
'integer').
" ";
288 if(!is_object($this->course_files_obj))
290 include_once(
'Modules/Course/classes/class.ilFSStorageCourse.php');
298 if(!is_object($this->course_xml_writer))
300 include_once
"./Modules/Course/classes/class.ilCourseXMLWriter.php";
315 $this->course_obj->initCourseItemObject();
316 $this->course_obj->items_obj->setParentId($a_parent_id);
318 foreach($this->course_obj->items_obj->getAllItems() as $item)
324 $action = $a_selection[$item[
'child']];
325 if ($a_selection ==
"")
330 if ($action ==
"omit")
335 if ($action ==
"create")
337 $abs_file_name = $tmp_obj->getXMLZip();
341 include_once(
"./Services/Export/classes/class.ilExport.php");
344 if (!@is_file($abs_file_name))
351 if ($abs_file_name !=
"")
354 $new_name = basename($abs_file_name);
355 $this->course_files_obj->copyFile($abs_file_name,$this->course_files_obj->getArchiveDirectory().
'/'.
356 $this->
getName().
'/'.$new_name);
357 if (is_file($this->course_files_obj->getArchiveDirectory().
'/'.
358 $this->
getName().
'/'.$new_name))
360 $this->copied_files[] = array(
"title" => $item[
'title'],
361 "file" => $new_name,
"type" => $item[
'type']);
373 $this->course_obj->initCourseItemObject();
374 $this->course_obj->items_obj->setParentId($a_parent_id);
376 foreach($this->course_obj->items_obj->getAllItems() as $item)
382 if($abs_dir_name = $tmp_obj->getHTMLDirectory())
384 $new_name =
'il_'.$this->ilias->getSetting(
'inst_id').
'_'.$tmp_obj->getType().
'_'.$item[
'obj_id'];
386 $this->course_files_obj->addDirectory($this->
getName().
'/objects/'.$new_name);
387 $this->course_files_obj->rCopy($abs_dir_name,$this->
getName().
'/objects/'.$new_name);
390 $this->html_files[
"$item[obj_id]"] =
"objects/".$new_name.
"/index.html";
406 $lng->loadLanguageModule(
'crs');
413 $tmp_tpl =&
new ilTemplate(
"tpl.crs_export.html",
true,
true,
'Modules/Course');
415 $this->course_files_obj->copyFile($tpl->tplPath.
'/'.$ilias->account->prefs[
"style"].
'.css',
416 $this->course_files_obj->getArchiveDirectory().
'/'.$this->
getName().
'/default.css');
418 $tmp_tpl->setVariable(
'TITLE',
$lng->txt(
'crs_export'));
419 $tmp_tpl->setVariable(
"CRS_STRUCTURE",
$lng->txt(
'crs_structure'));
422 $tmp_tpl->setVariable(
"DETAILS_TITLE",
$lng->txt(
"crs_details"));
425 $tmp_tpl->setVariable(
"TXT_SYLLABUS",
$lng->txt(
"crs_syllabus"));
426 $tmp_tpl->setVariable(
"TXT_CONTACT",
$lng->txt(
"crs_contact"));
427 $tmp_tpl->setVariable(
"TXT_CONTACT_NAME",
$lng->txt(
"crs_contact_name"));
428 $tmp_tpl->setVariable(
"TXT_CONTACT_RESPONSIBILITY",
$lng->txt(
"crs_contact_responsibility"));
429 $tmp_tpl->setVariable(
"TXT_CONTACT_EMAIL",
$lng->txt(
"crs_contact_email"));
430 $tmp_tpl->setVariable(
"TXT_CONTACT_PHONE",
$lng->txt(
"crs_contact_phone"));
431 $tmp_tpl->setVariable(
"TXT_CONTACT_CONSULTATION",
$lng->txt(
"crs_contact_consultation"));
432 $tmp_tpl->setVariable(
"TXT_DATES",
$lng->txt(
"crs_dates"));
433 $tmp_tpl->setVariable(
"TXT_ACTIVATION",
$lng->txt(
"crs_activation"));
434 $tmp_tpl->setVariable(
"TXT_SUBSCRIPTION",
$lng->txt(
"crs_subscription"));
435 $tmp_tpl->setVariable(
"TXT_ARCHIVE",
$lng->txt(
"crs_archive"));
438 $tmp_tpl->setVariable(
"SYLLABUS",nl2br($this->course_obj->getSyllabus() ?
439 $this->course_obj->getSyllabus() :
440 $lng->txt(
"crs_not_available")));
442 $tmp_tpl->setVariable(
"CONTACT_NAME",$this->course_obj->getContactName() ?
443 $this->course_obj->getContactName() :
444 $lng->txt(
"crs_not_available"));
445 $tmp_tpl->setVariable(
"CONTACT_RESPONSIBILITY",$this->course_obj->getContactResponsibility() ?
446 $this->course_obj->getContactResponsibility() :
447 $lng->txt(
"crs_not_available"));
448 $tmp_tpl->setVariable(
"CONTACT_PHONE",$this->course_obj->getContactPhone() ?
449 $this->course_obj->getContactPhone() :
450 $lng->txt(
"crs_not_available"));
451 $tmp_tpl->setVariable(
"CONTACT_CONSULTATION",nl2br($this->course_obj->getContactConsultation() ?
452 $this->course_obj->getContactConsultation() :
453 $lng->txt(
"crs_not_available")));
454 if($this->course_obj->getContactEmail())
456 $tmp_tpl->setCurrentBlock(
"email_link");
457 #$tmp_tpl->setVariable("EMAIL_LINK","ilias.php?baseClass=ilMailGUI&type=new&rcp_to=".$this->course_obj->getContactEmail());
458 $tmp_tpl->setVariable(
"CONTACT_EMAIL",$this->course_obj->getContactEmail());
459 $tmp_tpl->parseCurrentBlock();
463 $tmp_tpl->setCurrentBlock(
"no_mail");
464 $tmp_tpl->setVariable(
"NO_CONTACT_EMAIL",$this->course_obj->getContactEmail());
465 $tmp_tpl->parseCurrentBlock();
467 if($this->course_obj->getActivationUnlimitedStatus())
469 $tmp_tpl->setVariable(
"ACTIVATION",
$lng->txt(
'crs_unlimited'));
473 $str =
$lng->txt(
"crs_from").
" ".strftime(
"%Y-%m-%d %R",$this->course_obj->getActivationStart()).
" ".
474 $lng->txt(
"crs_to").
" ".strftime(
"%Y-%m-%d %R",$this->course_obj->getActivationEnd());
475 $tmp_tpl->setVariable(
"ACTIVATION",$str);
477 if($this->course_obj->getSubscriptionUnlimitedStatus())
479 $tmp_tpl->setVariable(
"SUBSCRIPTION",
$lng->txt(
'crs_unlimited'));
483 $str =
$lng->txt(
"crs_from").
" ".strftime(
"%Y-%m-%d %R",$this->course_obj->getSubscriptionStart()).
" ".
484 $lng->txt(
"crs_to").
" ".strftime(
"%Y-%m-%d %R",$this->course_obj->getSubscriptionEnd());
485 $tmp_tpl->setVariable(
"SUBSCRIPTION",$str);
487 if($this->course_obj->getArchiveType() == $this->course_obj->ARCHIVE_DISABLED)
489 $tmp_tpl->setVariable(
"ARCHIVE",
$lng->txt(
'crs_archive_disabled'));
493 $str =
$lng->txt(
"crs_from").
" ".strftime(
"%Y-%m-%d %R",$this->course_obj->getArchiveStart()).
" ".
494 $lng->txt(
"crs_to").
" ".strftime(
"%Y-%m-%d %R",$this->course_obj->getArchiveEnd());
495 $tmp_tpl->setVariable(
"ARCHIVE",$str);
498 $this->structure =
'';
500 $tmp_tpl->setVariable(
"STRUCTURE",$this->structure);
502 $this->course_files_obj->writeArchiveFile($tmp_tpl->get(),$this->
getName().
'/index.html');
509 $this->course_obj->initCourseItemObject();
510 $this->course_obj->items_obj->setParentId($a_parent_id);
512 $items = $this->course_obj->items_obj->getAllItems();
514 foreach($items as
$key => $item)
524 $this->structure .=
"<ul>";
527 $this->structure .=
"<li>";
529 if(isset($this->html_files[
"$item[obj_id]"]))
531 $link =
"<a href=\"./".$this->html_files[
"$item[obj_id]"].
"\">".$item[
"title"].
"</a>";
535 $link = $item[
'title'];
537 $this->structure .= $link;
538 $this->structure .=
"</li>";
542 if(
$key == (count($items) - 1))
544 $this->structure .=
"</ul>";
570 $this->archives = array();
571 $query =
"SELECT * FROM crs_archives ".
572 "WHERE course_id = ".$ilDB->quote($this->course_obj->getId(),
'integer').
" ".
573 "ORDER BY archive_date DESC";
578 $this->archives[
$row->archive_id][
"archive_id"] =
$row->archive_id;
579 $this->archives[
$row->archive_id][
"archive_type"] =
$row->archive_type;
580 $this->archives[
$row->archive_id][
"archive_date"] =
$row->archive_date;
581 $this->archives[
$row->archive_id][
"archive_size"] =
$row->archive_size;
582 $this->archives[
$row->archive_id][
"archive_name"] =
$row->archive_name;
583 $this->archives[
$row->archive_id][
"archive_lang"] =
$row->archive_lang;