本文整理汇总了PHP中ilUtil::zip方法的典型用法代码示例。如果您正苦于以下问题:PHP ilUtil::zip方法的具体用法?PHP ilUtil::zip怎么用?PHP ilUtil::zip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilUtil
的用法示例。
在下文中一共展示了ilUtil::zip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildExportFile
/**
* Build export file
*
* @param
* @return
*/
function buildExportFile()
{
global $ilias;
// create export file
include_once "./Services/Export/classes/class.ilExport.php";
ilExport::_createExportDirectory($this->wiki->getId(), "html", "wiki");
$exp_dir = ilExport::_getExportDirectory($this->wiki->getId(), "html", "wiki");
$this->subdir = $this->wiki->getType() . "_" . $this->wiki->getId();
$this->export_dir = $exp_dir . "/" . $this->subdir;
// initialize temporary target directory
ilUtil::delDir($this->export_dir);
ilUtil::makeDir($this->export_dir);
// system style html exporter
include_once "./Services/Style/classes/class.ilSystemStyleHTMLExport.php";
$this->sys_style_html_export = new ilSystemStyleHTMLExport($this->export_dir);
$this->sys_style_html_export->addImage("icon_wiki.svg");
$this->sys_style_html_export->export();
// init co page html exporter
include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
$this->co_page_html_export = new ilCOPageHTMLExport($this->export_dir);
$this->co_page_html_export->setContentStyleId($this->wiki->getStyleSheetId());
$this->co_page_html_export->createDirectories();
$this->co_page_html_export->exportStyles();
$this->co_page_html_export->exportSupportScripts();
// export pages
$this->exportHTMLPages();
// zip everything
if (true) {
// zip it all
$date = time();
$zip_file = ilExport::_getExportDirectory($this->wiki->getId(), "html", "wiki") . "/" . $date . "__" . IL_INST_ID . "__" . $this->wiki->getType() . "_" . $this->wiki->getId() . ".zip";
ilUtil::zip($this->export_dir, $zip_file);
ilUtil::delDir($this->export_dir);
}
}
示例2: buildExportFile
/**
* Build export file
*
* @param
* @return
*/
function buildExportFile()
{
global $ilias;
// create export file
include_once "./Services/Export/classes/class.ilExport.php";
ilExport::_createExportDirectory($this->object->getId(), "html", "prtf");
$exp_dir = ilExport::_getExportDirectory($this->object->getId(), "html", "prtf");
$this->subdir = $this->object->getType() . "_" . $this->object->getId();
$this->export_dir = $exp_dir . "/" . $this->subdir;
// initialize temporary target directory
ilUtil::delDir($this->export_dir);
ilUtil::makeDir($this->export_dir);
// system style html exporter
include_once "./Services/Style/classes/class.ilSystemStyleHTMLExport.php";
$this->sys_style_html_export = new ilSystemStyleHTMLExport($this->export_dir);
// $this->sys_style_html_export->addImage("icon_prtf_b.png");
$this->sys_style_html_export->export();
// init co page html exporter
include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
$this->co_page_html_export = new ilCOPageHTMLExport($this->export_dir);
/* $this->co_page_html_export->setContentStyleId(
$this->object->getStyleSheetId()); */
$this->co_page_html_export->createDirectories();
$this->co_page_html_export->exportStyles();
$this->co_page_html_export->exportSupportScripts();
// banner / profile picture
$prfa_set = new ilSetting("prfa");
if ($prfa_set->get("banner")) {
$banner = $this->object->getImageFullPath();
copy($banner, $this->export_dir . "/" . basename($banner));
}
$ppic = ilObjUser::_getPersonalPicturePath($this->object->getOwner(), "big");
if ($ppic) {
$ppic = array_shift(explode("?", $ppic));
copy($ppic, $this->export_dir . "/" . basename($ppic));
}
// export pages
$this->exportHTMLPages();
// zip everything
if (true) {
// zip it all
$date = time();
$zip_file = ilExport::_getExportDirectory($this->object->getId(), "html", "prtf") . "/" . $date . "__" . IL_INST_ID . "__" . $this->object->getType() . "_" . $this->object->getId() . ".zip";
ilUtil::zip($this->export_dir, $zip_file);
ilUtil::delDir($this->export_dir);
}
return $zip_file;
}
示例3: exportObject
/**
* Export a container
*
* @param object $a_type
* @param object $a_obj_id
* @param object $a_target_release
* @return
*/
public function exportObject($a_type, $a_id, $a_target_release)
{
// Create base export directory
ilExport::_createExportDirectory($a_id, "xml", $a_type);
$export_dir = ilExport::_getExportDirectory($a_id, "xml", $a_type);
$ts = time();
$sub_dir = $ts . "__" . IL_INST_ID . "__" . $a_type . "_" . $a_id;
$this->cont_export_dir = $export_dir . DIRECTORY_SEPARATOR . $sub_dir;
ilUtil::makeDirParents($this->cont_export_dir);
$GLOBALS['ilLog']->write(__METHOD__ . ' using base directory: ' . $this->export_run_dir);
$this->manifestWriterBegin($a_type, $a_id, $a_target_release);
$this->addContainer();
$this->addSubitems($a_id, $a_type, $a_target_release);
$this->manifestWriterEnd($a_type, $a_id, $a_target_release);
ilUtil::zip($this->cont_export_dir, $this->cont_export_dir . '.zip');
ilUtil::delDir($this->cont_export_dir);
}
示例4: exportEntity
/**
* Export an ILIAS entity
*
* @param string $a_entity entity type, e.g. "sty"
* @param mixed $a_id entity id
* @param string $a_target_release target release
* @param string $a_component component that exports (e.g. "Services/Style")
*
* @return array success and info array
*/
function exportEntity($a_entity, $a_id, $a_target_release, $a_component, $a_title, $a_export_dir, $a_type_for_file = "")
{
global $objDefinition, $tpl;
if ($a_type_for_file == "") {
$a_type_for_file = $a_entity;
}
$comp = $a_component;
$c = explode("/", $comp);
$class = "il" . $c[1] . "Exporter";
// manifest writer
include_once "./Services/Xml/classes/class.ilXmlWriter.php";
$this->manifest_writer = new ilXmlWriter();
$this->manifest_writer->xmlHeader();
$this->manifest_writer->xmlStartTag('Manifest', array("MainEntity" => $a_entity, "Title" => $a_title, "TargetRelease" => $a_target_release, "InstallationId" => IL_INST_ID, "InstallationUrl" => ILIAS_HTTP_PATH));
$export_dir = $a_export_dir;
$ts = time();
// determine file name and subdirectory
$sub_dir = $ts . '__' . IL_INST_ID . '__' . $a_type_for_file . '_' . $a_id;
$new_file = $sub_dir . '.zip';
$this->export_run_dir = $export_dir . "/" . $sub_dir;
ilUtil::makeDirParents($this->export_run_dir);
$this->cnt = array();
$success = $this->processExporter($comp, $class, $a_entity, $a_target_release, $a_id);
$this->manifest_writer->xmlEndTag('Manifest');
$this->manifest_writer->xmlDumpFile($this->export_run_dir . "/manifest.xml", false);
// zip the file
ilUtil::zip($this->export_run_dir, $export_dir . "/" . $new_file);
ilUtil::delDir($this->export_run_dir);
return array("success" => $success, "file" => $new_file, "directory" => $export_dir);
}
示例5: buildExportFileXML
/**
* build xml export file
*/
function buildExportFileXML()
{
global $ilBench;
$ilBench->start("SurveyExport", "buildExportFile");
// create directories
$this->survey_obj->createExportDirectory();
include_once "./Services/Utilities/classes/class.ilUtil.php";
ilUtil::makeDir($this->export_dir . "/" . $this->subdir);
ilUtil::makeDir($this->export_dir . "/" . $this->subdir . "/objects");
// get Log File
$expDir = $this->survey_obj->getExportDirectory();
include_once "./Services/Logging/classes/class.ilLog.php";
$expLog = new ilLog($expDir, "export.log");
$expLog->delete();
$expLog->setLogFormat("");
$expLog->write(date("[y-m-d H:i:s] ") . "Start Export");
// write xml file
$xmlFile = fopen($this->export_dir . "/" . $this->subdir . "/" . $this->filename, "w");
fwrite($xmlFile, $this->survey_obj->toXML());
fclose($xmlFile);
// add media objects which were added with tiny mce
$this->exportXHTMLMediaObjects($this->export_dir . "/" . $this->subdir);
// zip the file
$ilBench->start("SurveyExport", "buildExportFileXML_zipFile");
ilUtil::zip($this->export_dir . "/" . $this->subdir, $this->export_dir . "/" . $this->subdir . ".zip");
$ilBench->stop("SurveyExport", "buildExportFileXML_zipFile");
if (@file_exists($this->export_dir . "/" . $this->subdir . ".zip")) {
// remove export directory and contents
if (@is_dir($this->export_dir . "/" . $this->subdir)) {
ilUtil::delDir($this->export_dir . "/" . $this->subdir);
}
}
$expLog->write(date("[y-m-d H:i:s] ") . "Finished Export");
$ilBench->stop("SurveyExport", "buildExportFile");
return $this->export_dir . "/" . $this->subdir . ".zip";
}
示例6: sendMultiFeedbackStructureFile
/**
* Create member status record for a new assignment for all participants
*/
function sendMultiFeedbackStructureFile()
{
global $ilDB;
// send and delete the zip file
$deliverFilename = trim(str_replace(" ", "_", $this->getTitle() . "_" . $this->getId()));
$deliverFilename = ilUtil::getASCIIFilename($deliverFilename);
$deliverFilename = "multi_feedback_" . $deliverFilename;
$exc = new ilObjExercise($this->getExerciseId(), false);
$cdir = getcwd();
// create temporary directoy
$tmpdir = ilUtil::ilTempnam();
ilUtil::makeDir($tmpdir);
$mfdir = $tmpdir . "/" . $deliverFilename;
ilUtil::makeDir($mfdir);
// create subfolders <lastname>_<firstname>_<id> for each participant
include_once "./Modules/Exercise/classes/class.ilExerciseMembers.php";
$exmem = new ilExerciseMembers($exc);
$mems = $exmem->getMembers();
foreach ($mems as $mem) {
$name = ilObjUser::_lookupName($mem);
$subdir = $name["lastname"] . "_" . $name["firstname"] . "_" . $name["login"] . "_" . $name["user_id"];
$subdir = ilUtil::getASCIIFilename($subdir);
ilUtil::makeDir($mfdir . "/" . $subdir);
}
// create the zip file
chdir($tmpdir);
$tmpzipfile = $tmpdir . "/multi_feedback.zip";
ilUtil::zip($tmpdir, $tmpzipfile, true);
chdir($cdir);
ilUtil::deliverFile($tmpzipfile, $deliverFilename . ".zip", "", false, true);
}
示例7: zipFile
function zipFile($a_rel_name, $a_zip_name)
{
ilUtil::zip($this->getGroupPath() . '/grp_' . $this->group_obj->getId() . '/' . $a_rel_name, $this->getGroupPath() . '/grp_' . $this->group_obj->getId() . '/' . $a_zip_name);
return true;
}
示例8: sendAndCreateSimpleExportFile
public function sendAndCreateSimpleExportFile()
{
$orgu_id = ilObjOrgUnit::getRootOrgId();
$orgu_ref_id = ilObjOrgUnit::getRootOrgRefId();
ilExport::_createExportDirectory($orgu_id, "xml", "orgu");
$export_dir = ilExport::_getExportDirectory($orgu_id, "xml", "orgu");
$ts = time();
// Workaround for test assessment
$sub_dir = $ts . '__' . IL_INST_ID . '__' . "orgu" . '_' . $orgu_id . "";
$new_file = $sub_dir . '.zip';
$export_run_dir = $export_dir . "/" . $sub_dir;
ilUtil::makeDirParents($export_run_dir);
$writer = $this->simpleExport($orgu_ref_id);
$writer->xmlDumpFile($export_run_dir . "/manifest.xml", false);
// zip the file
ilUtil::zip($export_run_dir, $export_dir . "/" . $new_file);
ilUtil::delDir($export_run_dir);
// Store info about export
include_once './Services/Export/classes/class.ilExportFileInfo.php';
$exp = new ilExportFileInfo($orgu_id);
$exp->setVersion(ILIAS_VERSION_NUMERIC);
$exp->setCreationDate(new ilDateTime($ts, IL_CAL_UNIX));
$exp->setExportType('xml');
$exp->setFilename($new_file);
$exp->create();
ilUtil::deliverFile($export_dir . "/" . $new_file, $new_file);
return array("success" => true, "file" => $new_file, "directory" => $export_dir);
}
示例9: buildExportFileXML
/**
* build export file (complete zip file)
*/
function buildExportFileXML()
{
global $ilBench;
$ilBench->start("GlossaryExport", "buildExportFile");
require_once "./Services/Xml/classes/class.ilXmlWriter.php";
$this->xml = new ilXmlWriter();
// set dtd definition
$this->xml->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_co_3_7.dtd\">");
// set generated comment
$this->xml->xmlSetGenCmt("Export of ILIAS Glossary " . $this->glo_obj->getId() . " of installation " . $this->inst . ".");
// set xml header
$this->xml->xmlHeader();
// create directories
$this->glo_obj->createExportDirectory();
ilUtil::makeDir($this->export_dir . "/" . $this->subdir);
ilUtil::makeDir($this->export_dir . "/" . $this->subdir . "/objects");
// get Log File
$expDir = $this->glo_obj->getExportDirectory();
$expLog = new ilLog($expDir, "export.log");
$expLog->delete();
$expLog->setLogFormat("");
$expLog->write(date("[y-m-d H:i:s] ") . "Start Export");
// get xml content
//echo "ContObjExport:".$this->inst_id.":<br>";
$ilBench->start("GlossaryExport", "buildExportFile_getXML");
$this->glo_obj->exportXML($this->xml, $this->inst_id, $this->export_dir . "/" . $this->subdir, $expLog);
$ilBench->stop("GlossaryExport", "buildExportFile_getXML");
// dump xml document to screen (only for debugging reasons)
/*
echo "<PRE>";
echo htmlentities($this->xml->xmlDumpMem($format));
echo "</PRE>";
*/
// dump xml document to file
$ilBench->start("GlossaryExport", "buildExportFile_dumpToFile");
$this->xml->xmlDumpFile($this->export_dir . "/" . $this->subdir . "/" . $this->filename, false);
$ilBench->stop("GlossaryExport", "buildExportFile_dumpToFile");
// zip the file
$ilBench->start("GlossaryExport", "buildExportFile_zipFile");
ilUtil::zip($this->export_dir . "/" . $this->subdir, $this->export_dir . "/" . $this->subdir . ".zip");
$ilBench->stop("GlossaryExport", "buildExportFile_zipFile");
// destroy writer object
$this->xml->_XmlWriter;
$expLog->write(date("[y-m-d H:i:s] ") . "Finished Export");
$ilBench->stop("GlossaryExport", "buildExportFile");
return $this->export_dir . "/" . $this->subdir . ".zip";
}
示例10: exportHTML
/**
* export html package
*/
function exportHTML($a_target_dir, $log)
{
global $ilias, $tpl;
// initialize temporary target directory
ilUtil::delDir($a_target_dir);
ilUtil::makeDir($a_target_dir);
include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
$this->co_page_html_export = new ilCOPageHTMLExport($a_target_dir);
$this->co_page_html_export->createDirectories();
// export system style sheet
$location_stylesheet = ilUtil::getStyleSheetLocation("filesystem");
$style_name = $ilias->account->prefs["style"] . ".css";
copy($location_stylesheet, $a_target_dir . "/" . $style_name);
$location_stylesheet = ilUtil::getStyleSheetLocation();
if ($this->getStyleSheetId() < 1) {
$cont_stylesheet = "Services/COPage/css/content.css";
copy($cont_stylesheet, $a_target_dir . "/content.css");
} else {
$content_style_img_dir = $a_target_dir . "/images";
ilUtil::makeDir($content_style_img_dir);
$style = new ilObjStyleSheet($this->getStyleSheetId());
$style->writeCSSFile($a_target_dir . "/content.css", "images");
$style->copyImagesToDir($content_style_img_dir);
}
// export syntax highlighting style
$syn_stylesheet = ilObjStyleSheet::getSyntaxStylePath();
copy($syn_stylesheet, $a_target_dir . "/syntaxhighlight.css");
// get glossary presentation gui class
include_once "./Modules/Glossary/classes/class.ilGlossaryPresentationGUI.php";
$_GET["cmd"] = "nop";
$glo_gui =& new ilGlossaryPresentationGUI();
$glo_gui->setOfflineMode(true);
$glo_gui->setOfflineDirectory($a_target_dir);
// could be implemented in the future if other export
// formats are supported (e.g. scorm)
//$glo_gui->setExportFormat($a_export_format);
// export terms
$this->exportHTMLGlossaryTerms($glo_gui, $a_target_dir);
// export all media objects
foreach ($this->offline_mobs as $mob) {
$this->exportHTMLMOB($a_target_dir, $glo_gui, $mob, "_blank");
}
$_GET["obj_type"] = "MediaObject";
$_GET["obj_id"] = $a_mob_id;
$_GET["cmd"] = "";
// export all file objects
foreach ($this->offline_files as $file) {
$this->exportHTMLFile($a_target_dir, $file);
}
// export images
$image_dir = $a_target_dir . "/images";
ilUtil::makeDir($image_dir);
ilUtil::makeDir($image_dir . "/browser");
copy(ilUtil::getImagePath("enlarge.svg", false, "filesystem"), $image_dir . "/enlarge.svg");
copy(ilUtil::getImagePath("browser/blank.png", false, "filesystem"), $image_dir . "/browser/plus.png");
copy(ilUtil::getImagePath("browser/blank.png", false, "filesystem"), $image_dir . "/browser/minus.png");
copy(ilUtil::getImagePath("browser/blank.png", false, "filesystem"), $image_dir . "/browser/blank.png");
copy(ilUtil::getImagePath("icon_st.svg", false, "filesystem"), $image_dir . "/icon_st.svg");
copy(ilUtil::getImagePath("icon_pg.svg", false, "filesystem"), $image_dir . "/icon_pg.svg");
copy(ilUtil::getImagePath("nav_arr_L.png", false, "filesystem"), $image_dir . "/nav_arr_L.png");
copy(ilUtil::getImagePath("nav_arr_R.png", false, "filesystem"), $image_dir . "/nav_arr_R.png");
// template workaround: reset of template
$tpl = new ilTemplate("tpl.main.html", true, true);
$tpl->setVariable("LOCATION_STYLESHEET", $location_stylesheet);
$tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
// zip everything
if (true) {
// zip it all
$date = time();
$zip_file = $this->getExportDirectory("html") . "/" . $date . "__" . IL_INST_ID . "__" . $this->getType() . "_" . $this->getId() . ".zip";
//echo "zip-".$a_target_dir."-to-".$zip_file;
ilUtil::zip($a_target_dir, $zip_file);
ilUtil::delDir($a_target_dir);
}
}
示例11: buildExportFileXML
/**
* build xml export file
*/
function buildExportFileXML()
{
global $ilBench;
$ilBench->start("ContentObjectExport", "buildExportFile");
require_once "./Services/Xml/classes/class.ilXmlWriter.php";
$this->xml = new ilXmlWriter();
// set dtd definition
$this->xml->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
// set generated comment
$this->xml->xmlSetGenCmt("Export of ILIAS Content Module " . $this->cont_obj->getId() . " of installation " . $this->inst . ".");
// set xml header
$this->xml->xmlHeader();
// create directories
$this->cont_obj->createExportDirectory();
ilUtil::makeDir($this->export_dir . "/" . $this->subdir);
ilUtil::makeDir($this->export_dir . "/" . $this->subdir . "/objects");
// get Log File
$expDir = $this->cont_obj->getExportDirectory();
$expLog = new ilLog($expDir, "export.log");
$expLog->delete();
$expLog->setLogFormat("");
$expLog->write(date("[y-m-d H:i:s] ") . "Start Export");
// get xml content
//echo "ContObjExport:".$this->inst_id.":<br>";
$ilBench->start("ContentObjectExport", "buildExportFile_getXML");
$this->cont_obj->exportXML($this->xml, $this->inst_id, $this->export_dir . "/" . $this->subdir, $expLog);
$ilBench->stop("ContentObjectExport", "buildExportFile_getXML");
// export style
if ($this->cont_obj->getStyleSheetId() > 0) {
include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
$style_obj = new ilObjStyleSheet($this->cont_obj->getStyleSheetId(), false);
//$style_obj->exportXML($this->export_dir."/".$this->subdir);
$style_obj->setExportSubDir("style");
$style_file = $style_obj->export();
if (is_file($style_file)) {
copy($style_file, $this->export_dir . "/" . $this->subdir . "/style.zip");
}
}
// dump xml document to screen (only for debugging reasons)
/*
echo "<PRE>";
echo htmlentities($this->xml->xmlDumpMem($format));
echo "</PRE>";
*/
// dump xml document to file
$this->xml->xmlDumpFile($this->export_dir . "/" . $this->subdir . "/" . $this->filename, false);
// help export (workaround to use ref id here)
if (ilObjContentObject::isOnlineHelpModule((int) $_GET["ref_id"])) {
include_once "./Services/Export/classes/class.ilExport.php";
$exp = new ilExport();
$exp->exportEntity("help", $this->cont_obj->getId(), "4.3.0", "Services/Help", "OnlineHelp", $this->export_dir . "/" . $this->subdir);
}
// zip the file
ilUtil::zip($this->export_dir . "/" . $this->subdir, $this->export_dir . "/" . $this->subdir . ".zip");
// destroy writer object
$this->xml->_XmlWriter;
$expLog->write(date("[y-m-d H:i:s] ") . "Finished Export");
$ilBench->stop("ContentObjectExport", "buildExportFile");
return $this->export_dir . "/" . $this->subdir . ".zip";
}
示例12: offlineexport
//.........这里部分代码省略.........
$_GET["frame"] = "maincontent";
$objRow["obj_id"] = ilObject::_lookupObjId($_GET["ref_id"]);
$_GET["obj_id"] = $objRow["obj_id"];
$query = "SELECT * FROM lm_data WHERE lm_id = " . $ilDB->quote($objRow["obj_id"], "integer") . " AND type='pg' ";
$result = $ilDB->query($query);
$page = 0;
$showpage = 0;
while (is_array($row = $ilDB->fetchAssoc($result))) {
$page++;
if ($_POST["pages"] == "all" || $_POST["pages"] == "fromto" && $page >= $_POST["pagefrom"] && $page <= $_POST["pageto"]) {
if ($showpage > 0) {
if ($_POST["type"] == "pdf") {
$output .= "<hr BREAK >\n";
}
if ($_POST["type"] == "print") {
$output .= "<p style=\"page-break-after:always\" />";
}
if ($_POST["type"] == "html") {
$output .= "<br><br><br><br>";
}
}
$showpage++;
$_GET["obj_id"] = $row["obj_id"];
$o = $this->layout("main.xml", false);
$output .= "<div xmlns:xhtml=\"http://www.w3.org/1999/xhtml\" class=\"ilc_PageTitle\">" . $this->lm->title . "</div><p>";
$output .= $o;
$output .= "\n<table cellpadding=0 cellspacing=0 border=0 width=100%><tr><td valign=top align=center>- " . $page . " -</td></tr></table>\n";
}
}
$printTpl = new ilTemplate("tpl.print.html", true, true, "Modules/LearningModule");
if ($_POST["type"] == "print") {
$printTpl->touchBlock("printreq");
$css1 = ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId());
$css2 = ilUtil::getStyleSheetLocation();
} else {
$css1 = "./css/delos.css";
$css2 = "./css/content.css";
}
$printTpl->setVariable("LOCATION_CONTENT_STYLESHEET", $css1);
$printTpl->setVariable("LOCATION_STYLESHEET", $css2);
$printTpl->setVariable("CONTENT", $output);
// syntax style
$printTpl->setCurrentBlock("SyntaxStyle");
$printTpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
$printTpl->parseCurrentBlock();
$html = $printTpl->get();
/**
* Check if export-directory exists
*/
$this->lm->createExportDirectory();
$export_dir = $this->lm->getExportDirectory();
/**
* create html-offline-directory
*/
$fileName = "offline";
$fileName = str_replace(" ", "_", $fileName);
if (!file_exists($export_dir . "/" . $fileName)) {
@mkdir($export_dir . "/" . $fileName);
@chmod($export_dir . "/" . $fileName, 0755);
@mkdir($export_dir . "/" . $fileName . "/css");
@chmod($export_dir . "/" . $fileName . "/css", 0755);
}
if ($_POST["type"] == "xml") {
//vd($_GET["ref_id"]);
$tmp_obj =& $this->ilias->obj_factory->getInstanceByRefId($_GET["ref_id"]);
if ($tmp_obj->getType() == "dbk") {
require_once "./Modules/LearningModule/classes/class.ilObjDlBook.php";
$dbk =& new ilObjDlBook($_GET["ref_id"]);
$dbk->export();
}
} else {
if ($_POST["type"] == "print") {
echo $html;
} else {
if ($_POST["type"] == "html") {
/**
* copy data into dir
* zip all end deliver zip-file for download
*/
$css1 = file("./templates/default/delos.css");
$css1 = implode($css1, "");
$fp = fopen($export_dir . "/" . $fileName . "/css/delos.css", "wb");
fwrite($fp, $css1);
fclose($fp);
$fp = fopen($export_dir . "/" . $fileName . "/" . $fileName . ".html", "wb");
fwrite($fp, $html);
fclose($fp);
ilUtil::zip($export_dir . "/" . $fileName, $export_dir . "/" . $fileName . ".zip");
ilUtil::deliverFile($export_dir . "/" . $fileName . ".zip", $fileName . ".zip");
} else {
if ($_POST["type"] == "pdf") {
ilUtil::html2pdf($html, $export_dir . "/" . $fileName . ".pdf");
ilUtil::deliverFile($export_dir . "/" . $fileName . ".pdf", $fileName . ".pdf");
}
}
}
}
exit;
}
}
示例13: buildExportFile
/**
* Build export file
*
* @param
* @return
*/
function buildExportFile()
{
global $ilias;
// create export file
include_once "./Services/Export/classes/class.ilExport.php";
ilExport::_createExportDirectory($this->object->getId(), "html", "prtf");
$exp_dir = ilExport::_getExportDirectory($this->object->getId(), "html", "prtf");
$this->subdir = $this->object->getType() . "_" . $this->object->getId();
$this->export_dir = $exp_dir . "/" . $this->subdir;
// initialize temporary target directory
ilUtil::delDir($this->export_dir);
ilUtil::makeDir($this->export_dir);
// system style html exporter
include_once "./Services/Style/classes/class.ilSystemStyleHTMLExport.php";
$this->sys_style_html_export = new ilSystemStyleHTMLExport($this->export_dir);
// $this->sys_style_html_export->addImage("icon_prtf.svg");
$this->sys_style_html_export->export();
// init co page html exporter
include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
$this->co_page_html_export = new ilCOPageHTMLExport($this->export_dir);
$this->co_page_html_export->setContentStyleId($this->object->getStyleSheetId());
$this->co_page_html_export->createDirectories();
$this->co_page_html_export->exportStyles();
$this->co_page_html_export->exportSupportScripts();
// banner
$prfa_set = new ilSetting("prfa");
if ($prfa_set->get("banner")) {
$banner = $this->object->getImageFullPath();
if ($banner) {
copy($banner, $this->export_dir . "/" . basename($banner));
}
}
// page element: profile picture
$ppic = ilObjUser::_getPersonalPicturePath($this->object->getOwner(), "big", true, true);
if ($ppic) {
$ppic = array_shift(explode("?", $ppic));
copy($ppic, $this->export_dir . "/" . basename($ppic));
}
// header image: profile picture
$ppic = ilObjUser::_getPersonalPicturePath($this->object->getOwner(), "xsmall", true, true);
if ($ppic) {
$ppic = array_shift(explode("?", $ppic));
copy($ppic, $this->export_dir . "/" . basename($ppic));
}
// export pages
$this->exportHTMLPages();
// add js/images/file to zip
$images = $files = $js_files = array();
foreach ($this->export_material as $items) {
$images = array_merge($images, $items["images"]);
$files = array_merge($files, $items["files"]);
$js_files = array_merge($js_files, $items["js"]);
}
foreach (array_unique($images) as $image) {
if (is_file($image)) {
copy($image, $this->export_dir . "/images/" . basename($image));
}
}
foreach (array_unique($js_files) as $js_file) {
if (is_file($js_file)) {
copy($js_file, $this->export_dir . "/js/" . basename($js_file));
}
}
foreach (array_unique($files) as $file) {
if (is_file($file)) {
copy($file, $this->export_dir . "/files/" . basename($file));
}
}
// zip everything
if (true) {
// zip it all
$date = time();
$zip_file = ilExport::_getExportDirectory($this->object->getId(), "html", "prtf") . "/" . $date . "__" . IL_INST_ID . "__" . $this->object->getType() . "_" . $this->object->getId() . ".zip";
ilUtil::zip($this->export_dir, $zip_file);
ilUtil::delDir($this->export_dir);
}
return $zip_file;
}
示例14: zipFile
function zipFile($a_rel_name, $a_zip_name)
{
ilUtil::zip($this->getCoursePath() . '/' . $a_rel_name, $this->getCoursePath() . '/' . $a_zip_name);
// RETURN filesize
return filesize($this->getCoursePath() . '/' . $a_zip_name);
}
示例15: buildExportFileXML
/**
* build xml export file
*/
function buildExportFileXML($questions = null)
{
global $ilBench;
$ilBench->start("SurveyQuestionpoolExport", "buildExportFile");
// create directories
$this->spl_obj->createExportDirectory();
include_once "./Services/Utilities/classes/class.ilUtil.php";
ilUtil::makeDir($this->export_dir . "/" . $this->subdir);
// get Log File
include_once "./Services/Logging/classes/class.ilLog.php";
$expLog = new ilLog($this->spl_obj->getExportDirectory(), "export.log");
$expLog->delete();
$expLog->setLogFormat("");
$expLog->write(date("[y-m-d H:i:s] ") . "Start Export");
// write qti file
$qti_file = fopen($this->export_dir . "/" . $this->subdir . "/" . $this->filename, "w");
fwrite($qti_file, $this->spl_obj->toXML($questions));
fclose($qti_file);
// destroy writer object
$this->xml->_XmlWriter;
ilUtil::zip($this->export_dir . "/" . $this->subdir, $this->export_dir . "/" . $this->subdir . ".zip");
$expLog->write(date("[y-m-d H:i:s] ") . "Finished Export");
$ilBench->stop("SurveyQuestionpoolExport", "buildExportFile");
return $this->export_dir . "/" . $this->subdir . ".zip";
}