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'];
167 $this->
setType($this->ARCHIVE_XML);
168 $this->
setName(time().
'__'.$this->ilias->getSetting(
'inst_id').
'__crs_'.$this->course_obj->getId());
173 $this->course_files_obj->addArchiveSubDirectory($this->
getName());
178 $this->course_xml_writer->start();
179 $this->course_files_obj->writeArchiveFile($this->course_xml_writer->getXML(),$this->
getName().
'/'.$this->
getName().
'.xml');
184 $this->course_files_obj->addArchiveSubDirectory($this->
getName().
'/objects');
190 $this->
setSize($this->course_files_obj->zipArchive($this->getName(),$this->
getName().
'.zip'));
201 $this->
setType($this->ARCHIVE_HTML);
203 $this->
setName($this->
getDate().
'__'.$this->ilias->getSetting(
'inst_id').
'__crs_'.$this->course_obj->getId());
207 $this->course_files_obj->addArchiveSubDirectory($this->
getName());
210 $this->course_files_obj->addArchiveSubDirectory($this->
getName().
'/objects');
217 $this->course_files_obj->createArchiveOnlineVersion($this->
getName());
220 $this->
setSize($this->course_files_obj->zipArchive($this->getName(),$this->
getName().
'.zip'));
233 $query =
"INSERT INTO crs_archives ".
234 "VALUES ('',".$ilDB->quote($this->course_obj->getId()).
",".$ilDB->quote($this->getName()).
",".$ilDB->quote($this->getType()).
", ".
235 $ilDB->quote($this->getDate()).
",".$ilDB->quote($this->getSize()).
",".$ilDB->quote($this->getLanguage()).
")";
237 $this->ilDB->query($query);
243 function delete($a_id)
250 $this->course_files_obj->deleteArchive($this->archives[$a_id][
"archive_name"]);
252 $query =
"DELETE FROM crs_archives ".
253 "WHERE course_id = ".$ilDB->quote($this->course_obj->getId()).
" ".
254 "AND archive_id = ".$ilDB->quote($a_id).
" ";
256 $this->ilDB->query($query);
272 if(!is_object($this->course_files_obj))
274 include_once(
'Modules/Course/classes/class.ilFSStorageCourse.php');
282 if(!is_object($this->course_xml_writer))
284 include_once
"./Modules/Course/classes/class.ilCourseXMLWriter.php";
293 $this->course_obj->initCourseItemObject();
294 $this->course_obj->items_obj->setParentId($a_parent_id);
296 foreach($this->course_obj->items_obj->getAllItems() as $item)
304 if($abs_file_name = $tmp_obj->getXMLZip())
306 $new_name =
'il_'.$this->ilias->getSetting(
'inst_id').
'_'.$tmp_obj->getType().
'_'.$item[
'obj_id'].
'.zip';
307 $this->course_files_obj->copyFile($abs_file_name,$this->course_files_obj->getArchiveDirectory().
'/'.
319 $this->course_obj->initCourseItemObject();
320 $this->course_obj->items_obj->setParentId($a_parent_id);
322 foreach($this->course_obj->items_obj->getAllItems() as $item)
328 if($abs_dir_name = $tmp_obj->getHTMLDirectory())
330 $new_name =
'il_'.$this->ilias->getSetting(
'inst_id').
'_'.$tmp_obj->getType().
'_'.$item[
'obj_id'];
332 $this->course_files_obj->addDirectory($this->
getName().
'/objects/'.$new_name);
333 $this->course_files_obj->rCopy($abs_dir_name,$this->
getName().
'/objects/'.$new_name);
336 $this->html_files[
"$item[obj_id]"] =
"objects/".$new_name.
"/index.html";
352 $lng->loadLanguageModule(
'crs');
359 $tmp_tpl =&
new ilTemplate(
"tpl.crs_export.html",
true,
true,
'Modules/Course');
361 $this->course_files_obj->copyFile($tpl->tplPath.
'/'.$ilias->account->prefs[
"style"].
'.css',
362 $this->course_files_obj->getArchiveDirectory().
'/'.$this->
getName().
'/default.css');
364 $tmp_tpl->setVariable(
'TITLE',
$lng->txt(
'crs_export'));
365 $tmp_tpl->setVariable(
"CRS_STRUCTURE",
$lng->txt(
'crs_structure'));
368 $tmp_tpl->setVariable(
"DETAILS_TITLE",
$lng->txt(
"crs_details"));
371 $tmp_tpl->setVariable(
"TXT_SYLLABUS",
$lng->txt(
"crs_syllabus"));
372 $tmp_tpl->setVariable(
"TXT_CONTACT",
$lng->txt(
"crs_contact"));
373 $tmp_tpl->setVariable(
"TXT_CONTACT_NAME",
$lng->txt(
"crs_contact_name"));
374 $tmp_tpl->setVariable(
"TXT_CONTACT_RESPONSIBILITY",
$lng->txt(
"crs_contact_responsibility"));
375 $tmp_tpl->setVariable(
"TXT_CONTACT_EMAIL",
$lng->txt(
"crs_contact_email"));
376 $tmp_tpl->setVariable(
"TXT_CONTACT_PHONE",
$lng->txt(
"crs_contact_phone"));
377 $tmp_tpl->setVariable(
"TXT_CONTACT_CONSULTATION",
$lng->txt(
"crs_contact_consultation"));
378 $tmp_tpl->setVariable(
"TXT_DATES",
$lng->txt(
"crs_dates"));
379 $tmp_tpl->setVariable(
"TXT_ACTIVATION",
$lng->txt(
"crs_activation"));
380 $tmp_tpl->setVariable(
"TXT_SUBSCRIPTION",
$lng->txt(
"crs_subscription"));
381 $tmp_tpl->setVariable(
"TXT_ARCHIVE",
$lng->txt(
"crs_archive"));
384 $tmp_tpl->setVariable(
"SYLLABUS",nl2br($this->course_obj->getSyllabus() ?
385 $this->course_obj->getSyllabus() :
386 $lng->txt(
"crs_not_available")));
388 $tmp_tpl->setVariable(
"CONTACT_NAME",$this->course_obj->getContactName() ?
389 $this->course_obj->getContactName() :
390 $lng->txt(
"crs_not_available"));
391 $tmp_tpl->setVariable(
"CONTACT_RESPONSIBILITY",$this->course_obj->getContactResponsibility() ?
392 $this->course_obj->getContactResponsibility() :
393 $lng->txt(
"crs_not_available"));
394 $tmp_tpl->setVariable(
"CONTACT_PHONE",$this->course_obj->getContactPhone() ?
395 $this->course_obj->getContactPhone() :
396 $lng->txt(
"crs_not_available"));
397 $tmp_tpl->setVariable(
"CONTACT_CONSULTATION",nl2br($this->course_obj->getContactConsultation() ?
398 $this->course_obj->getContactConsultation() :
399 $lng->txt(
"crs_not_available")));
400 if($this->course_obj->getContactEmail())
402 $tmp_tpl->setCurrentBlock(
"email_link");
403 #$tmp_tpl->setVariable("EMAIL_LINK","ilias.php?baseClass=ilMailGUI&type=new&rcp_to=".$this->course_obj->getContactEmail());
404 $tmp_tpl->setVariable(
"CONTACT_EMAIL",$this->course_obj->getContactEmail());
405 $tmp_tpl->parseCurrentBlock();
409 $tmp_tpl->setCurrentBlock(
"no_mail");
410 $tmp_tpl->setVariable(
"NO_CONTACT_EMAIL",$this->course_obj->getContactEmail());
411 $tmp_tpl->parseCurrentBlock();
413 if($this->course_obj->getActivationUnlimitedStatus())
415 $tmp_tpl->setVariable(
"ACTIVATION",
$lng->txt(
'crs_unlimited'));
419 $str =
$lng->txt(
"crs_from").
" ".strftime(
"%Y-%m-%d %R",$this->course_obj->getActivationStart()).
" ".
420 $lng->txt(
"crs_to").
" ".strftime(
"%Y-%m-%d %R",$this->course_obj->getActivationEnd());
421 $tmp_tpl->setVariable(
"ACTIVATION",$str);
423 if($this->course_obj->getSubscriptionUnlimitedStatus())
425 $tmp_tpl->setVariable(
"SUBSCRIPTION",
$lng->txt(
'crs_unlimited'));
429 $str =
$lng->txt(
"crs_from").
" ".strftime(
"%Y-%m-%d %R",$this->course_obj->getSubscriptionStart()).
" ".
430 $lng->txt(
"crs_to").
" ".strftime(
"%Y-%m-%d %R",$this->course_obj->getSubscriptionEnd());
431 $tmp_tpl->setVariable(
"SUBSCRIPTION",$str);
433 if($this->course_obj->getArchiveType() == $this->course_obj->ARCHIVE_DISABLED)
435 $tmp_tpl->setVariable(
"ARCHIVE",
$lng->txt(
'crs_archive_disabled'));
439 $str =
$lng->txt(
"crs_from").
" ".strftime(
"%Y-%m-%d %R",$this->course_obj->getArchiveStart()).
" ".
440 $lng->txt(
"crs_to").
" ".strftime(
"%Y-%m-%d %R",$this->course_obj->getArchiveEnd());
441 $tmp_tpl->setVariable(
"ARCHIVE",$str);
444 $this->structure =
'';
446 $tmp_tpl->setVariable(
"STRUCTURE",$this->structure);
448 $this->course_files_obj->writeArchiveFile($tmp_tpl->get(),$this->
getName().
'/index.html');
455 $this->course_obj->initCourseItemObject();
456 $this->course_obj->items_obj->setParentId($a_parent_id);
458 $items = $this->course_obj->items_obj->getAllItems();
460 foreach($items as $key => $item)
470 $this->structure .=
"<ul>";
473 $this->structure .=
"<li>";
475 if(isset($this->html_files[
"$item[obj_id]"]))
477 $link =
"<a href=\"./".$this->html_files[
"$item[obj_id]"].
"\">".$item[
"title"].
"</a>";
481 $link = $item[
'title'];
483 $this->structure .= $link;
484 $this->structure .=
"</li>";
488 if($key == (count($items) - 1))
490 $this->structure .=
"</ul>";
516 $this->archives = array();
517 $query =
"SELECT * FROM crs_archives ".
518 "WHERE course_id = ".$ilDB->quote($this->course_obj->getId()).
" ".
519 "ORDER BY archive_date DESC";
521 $res = $this->ilDB->query($query);
524 $this->archives[$row->archive_id][
"archive_id"] = $row->archive_id;
525 $this->archives[$row->archive_id][
"archive_type"] = $row->archive_type;
526 $this->archives[$row->archive_id][
"archive_date"] = $row->archive_date;
527 $this->archives[$row->archive_id][
"archive_size"] = $row->archive_size;
528 $this->archives[$row->archive_id][
"archive_name"] = $row->archive_name;
529 $this->archives[$row->archive_id][
"archive_lang"] = $row->archive_lang;