24 include_once(
'Modules/Course/classes/class.ilFSStorageCourse.php');
67 $this->ARCHIVE_XML = 1;
68 $this->ARCHIVE_HTML = 2;
69 $this->ARCHIVE_PDF = 3;
79 return $this->archives;
84 return $this->archives[$a_id];
89 foreach($this->archives as $id => $archive)
91 if($archive[
'archive_type'] == $this->ARCHIVE_XML)
95 if($this->course_obj->getArchiveType() != $this->course_obj->ARCHIVE_DOWNLOAD and
96 $archive[
'archive_type'] == $this->ARCHIVE_PDF)
100 $public_archives[$id] = $archive;
103 return $public_archives ? $public_archives : array();
108 $this->archive_type = $a_type;
112 return $this->archive_type ? $this->archive_type : $this->ARCHIVE_XML;
117 $this->archive_date = $a_date;
121 return $this->archive_date ? $this->archive_date : time();
126 $this->archive_size = $a_size;
134 $this->archive_name = $a_name;
142 $this->archive_lang = $a_lang_code;
157 return $this->course_files_obj->getArchiveDirectory().
'/'.$archive[
'archive_name'].
'.zip';
161 return $this->course_files_obj->getArchiveDirectory().
'/'.$archive[
'archive_name'];
173 $this->
setType($this->ARCHIVE_XML);
174 $this->
setName(time().
'__'.$this->ilias->getSetting(
'inst_id').
'__crs_'.$this->course_obj->getId());
179 $this->course_files_obj->addArchiveSubDirectory($this->
getName());
184 $this->course_xml_writer->start();
185 $this->course_files_obj->writeArchiveFile($this->course_xml_writer->getXML(),$this->
getName().
'/'.$this->
getName().
'.xml');
190 $this->course_files_obj->addArchiveSubDirectory($this->
getName().
'/objects');
192 $this->copied_files = array();
193 $this->
__addZipFiles($this->course_obj->getRefId(), $a_selection);
196 include_once(
"./Services/Export/classes/class.ilExport.php");
198 $this->
getName().
'/index.html', $this->course_obj->getId(),$this->copied_files);
201 $this->
setSize($this->course_files_obj->zipArchive($this->getName(),$this->
getName().
'.zip'));
212 $this->
setType($this->ARCHIVE_HTML);
214 $this->
setName($this->
getDate().
'__'.$this->ilias->getSetting(
'inst_id').
'__crs_'.$this->course_obj->getId());
218 $this->course_files_obj->addArchiveSubDirectory($this->
getName());
221 $this->course_files_obj->addArchiveSubDirectory($this->
getName().
'/objects');
228 $this->course_files_obj->createArchiveOnlineVersion($this->
getName());
231 $this->
setSize($this->course_files_obj->zipArchive($this->getName(),$this->
getName().
'.zip'));
244 $next_id = $ilDB->nextId(
'crs_archives');
245 $query =
"INSERT INTO crs_archives (archive_id,course_id,archive_name,archive_type,archive_date,archive_size,archive_lang) ".
247 $ilDB->quote($next_id,
'integer').
", ".
248 $ilDB->quote($this->course_obj->getId(),
'integer').
",".
249 $ilDB->quote($this->getName(),
'text').
",".
250 $ilDB->quote($this->getType(),
'integer').
", ".
251 $ilDB->quote($this->getDate(),
'integer').
",".
252 $ilDB->quote($this->getSize(),
'integer').
",".
253 $ilDB->quote($this->getLanguage(),
'text').
261 function delete($a_id)
268 $this->course_files_obj->deleteArchive($this->archives[$a_id][
"archive_name"]);
270 $query =
"DELETE FROM crs_archives ".
271 "WHERE course_id = ".$ilDB->quote($this->course_obj->getId(),
'integer').
" ".
272 "AND archive_id = ".$ilDB->quote($a_id,
'integer').
" ";
289 if(!is_object($this->course_files_obj))
291 include_once(
'Modules/Course/classes/class.ilFSStorageCourse.php');
299 if(!is_object($this->course_xml_writer))
301 include_once
"./Modules/Course/classes/class.ilCourseXMLWriter.php";
316 $this->course_obj->initCourseItemObject();
317 $this->course_obj->items_obj->setParentId($a_parent_id);
319 foreach($this->course_obj->items_obj->getAllItems() as $item)
325 $action = $a_selection[$item[
'child']];
326 if ($a_selection ==
"")
331 if ($action ==
"omit")
336 if ($action ==
"create")
338 $abs_file_name = $tmp_obj->getXMLZip();
342 include_once(
"./Services/Export/classes/class.ilExport.php");
345 if (!@is_file($abs_file_name))
352 if ($abs_file_name !=
"")
355 $new_name = basename($abs_file_name);
356 $this->course_files_obj->copyFile($abs_file_name,$this->course_files_obj->getArchiveDirectory().
'/'.
357 $this->
getName().
'/'.$new_name);
358 if (is_file($this->course_files_obj->getArchiveDirectory().
'/'.
359 $this->
getName().
'/'.$new_name))
361 $this->copied_files[] = array(
"title" => $item[
'title'],
362 "file" => $new_name,
"type" => $item[
'type']);
374 $this->course_obj->initCourseItemObject();
375 $this->course_obj->items_obj->setParentId($a_parent_id);
377 foreach($this->course_obj->items_obj->getAllItems() as $item)
383 if($abs_dir_name = $tmp_obj->getHTMLDirectory())
385 $new_name =
'il_'.$this->ilias->getSetting(
'inst_id').
'_'.$tmp_obj->getType().
'_'.$item[
'obj_id'];
387 $this->course_files_obj->addDirectory($this->
getName().
'/objects/'.$new_name);
388 $this->course_files_obj->rCopy($abs_dir_name,$this->
getName().
'/objects/'.$new_name);
391 $this->html_files[
"$item[obj_id]"] =
"objects/".$new_name.
"/index.html";
407 $lng->loadLanguageModule(
'crs');
414 $tmp_tpl =&
new ilTemplate(
"tpl.crs_export.html",
true,
true,
'Modules/Course');
416 $this->course_files_obj->copyFile($tpl->tplPath.
'/'.$ilias->account->prefs[
"style"].
'.css',
417 $this->course_files_obj->getArchiveDirectory().
'/'.$this->
getName().
'/default.css');
419 $tmp_tpl->setVariable(
'TITLE',
$lng->txt(
'crs_export'));
420 $tmp_tpl->setVariable(
"CRS_STRUCTURE",
$lng->txt(
'crs_structure'));
423 $tmp_tpl->setVariable(
"DETAILS_TITLE",
$lng->txt(
"crs_details"));
426 $tmp_tpl->setVariable(
"TXT_SYLLABUS",
$lng->txt(
"crs_syllabus"));
427 $tmp_tpl->setVariable(
"TXT_CONTACT",
$lng->txt(
"crs_contact"));
428 $tmp_tpl->setVariable(
"TXT_CONTACT_NAME",
$lng->txt(
"crs_contact_name"));
429 $tmp_tpl->setVariable(
"TXT_CONTACT_RESPONSIBILITY",
$lng->txt(
"crs_contact_responsibility"));
430 $tmp_tpl->setVariable(
"TXT_CONTACT_EMAIL",
$lng->txt(
"crs_contact_email"));
431 $tmp_tpl->setVariable(
"TXT_CONTACT_PHONE",
$lng->txt(
"crs_contact_phone"));
432 $tmp_tpl->setVariable(
"TXT_CONTACT_CONSULTATION",
$lng->txt(
"crs_contact_consultation"));
433 $tmp_tpl->setVariable(
"TXT_DATES",
$lng->txt(
"crs_dates"));
434 $tmp_tpl->setVariable(
"TXT_ACTIVATION",
$lng->txt(
"crs_activation"));
435 $tmp_tpl->setVariable(
"TXT_SUBSCRIPTION",
$lng->txt(
"crs_subscription"));
436 $tmp_tpl->setVariable(
"TXT_ARCHIVE",
$lng->txt(
"crs_archive"));
439 $tmp_tpl->setVariable(
"SYLLABUS",nl2br($this->course_obj->getSyllabus() ?
440 $this->course_obj->getSyllabus() :
441 $lng->txt(
"crs_not_available")));
443 $tmp_tpl->setVariable(
"CONTACT_NAME",$this->course_obj->getContactName() ?
444 $this->course_obj->getContactName() :
445 $lng->txt(
"crs_not_available"));
446 $tmp_tpl->setVariable(
"CONTACT_RESPONSIBILITY",$this->course_obj->getContactResponsibility() ?
447 $this->course_obj->getContactResponsibility() :
448 $lng->txt(
"crs_not_available"));
449 $tmp_tpl->setVariable(
"CONTACT_PHONE",$this->course_obj->getContactPhone() ?
450 $this->course_obj->getContactPhone() :
451 $lng->txt(
"crs_not_available"));
452 $tmp_tpl->setVariable(
"CONTACT_CONSULTATION",nl2br($this->course_obj->getContactConsultation() ?
453 $this->course_obj->getContactConsultation() :
454 $lng->txt(
"crs_not_available")));
455 if($this->course_obj->getContactEmail())
457 $tmp_tpl->setCurrentBlock(
"email_link");
458 #$tmp_tpl->setVariable("EMAIL_LINK","ilias.php?baseClass=ilMailGUI&type=new&rcp_to=".$this->course_obj->getContactEmail());
459 $tmp_tpl->setVariable(
"CONTACT_EMAIL",$this->course_obj->getContactEmail());
460 $tmp_tpl->parseCurrentBlock();
464 $tmp_tpl->setCurrentBlock(
"no_mail");
465 $tmp_tpl->setVariable(
"NO_CONTACT_EMAIL",$this->course_obj->getContactEmail());
466 $tmp_tpl->parseCurrentBlock();
468 if($this->course_obj->getActivationUnlimitedStatus())
470 $tmp_tpl->setVariable(
"ACTIVATION",
$lng->txt(
'crs_unlimited'));
474 $str =
$lng->txt(
"crs_from").
" ".strftime(
"%Y-%m-%d %R",$this->course_obj->getActivationStart()).
" ".
475 $lng->txt(
"crs_to").
" ".strftime(
"%Y-%m-%d %R",$this->course_obj->getActivationEnd());
476 $tmp_tpl->setVariable(
"ACTIVATION",$str);
478 if($this->course_obj->getSubscriptionUnlimitedStatus())
480 $tmp_tpl->setVariable(
"SUBSCRIPTION",
$lng->txt(
'crs_unlimited'));
484 $str =
$lng->txt(
"crs_from").
" ".strftime(
"%Y-%m-%d %R",$this->course_obj->getSubscriptionStart()).
" ".
485 $lng->txt(
"crs_to").
" ".strftime(
"%Y-%m-%d %R",$this->course_obj->getSubscriptionEnd());
486 $tmp_tpl->setVariable(
"SUBSCRIPTION",$str);
488 if($this->course_obj->getArchiveType() == $this->course_obj->ARCHIVE_DISABLED)
490 $tmp_tpl->setVariable(
"ARCHIVE",
$lng->txt(
'crs_archive_disabled'));
494 $str =
$lng->txt(
"crs_from").
" ".strftime(
"%Y-%m-%d %R",$this->course_obj->getArchiveStart()).
" ".
495 $lng->txt(
"crs_to").
" ".strftime(
"%Y-%m-%d %R",$this->course_obj->getArchiveEnd());
496 $tmp_tpl->setVariable(
"ARCHIVE",$str);
499 $this->structure =
'';
501 $tmp_tpl->setVariable(
"STRUCTURE",$this->structure);
503 $this->course_files_obj->writeArchiveFile($tmp_tpl->get(),$this->
getName().
'/index.html');
510 $this->course_obj->initCourseItemObject();
511 $this->course_obj->items_obj->setParentId($a_parent_id);
513 $items = $this->course_obj->items_obj->getAllItems();
515 foreach($items as $key => $item)
525 $this->structure .=
"<ul>";
528 $this->structure .=
"<li>";
530 if(isset($this->html_files[
"$item[obj_id]"]))
532 $link =
"<a href=\"./".$this->html_files[
"$item[obj_id]"].
"\">".$item[
"title"].
"</a>";
536 $link = $item[
'title'];
538 $this->structure .= $link;
539 $this->structure .=
"</li>";
543 if($key == (count($items) - 1))
545 $this->structure .=
"</ul>";
571 $this->archives = array();
572 $query =
"SELECT * FROM crs_archives ".
573 "WHERE course_id = ".$ilDB->quote($this->course_obj->getId(),
'integer').
" ".
574 "ORDER BY archive_date DESC";
579 $this->archives[
$row->archive_id][
"archive_id"] =
$row->archive_id;
580 $this->archives[
$row->archive_id][
"archive_type"] =
$row->archive_type;
581 $this->archives[
$row->archive_id][
"archive_date"] =
$row->archive_date;
582 $this->archives[
$row->archive_id][
"archive_size"] =
$row->archive_size;
583 $this->archives[
$row->archive_id][
"archive_name"] =
$row->archive_name;
584 $this->archives[
$row->archive_id][
"archive_lang"] =
$row->archive_lang;