本文整理汇总了PHP中ilObjStyleSheet::writeCSSFile方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjStyleSheet::writeCSSFile方法的具体用法?PHP ilObjStyleSheet::writeCSSFile怎么用?PHP ilObjStyleSheet::writeCSSFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjStyleSheet
的用法示例。
在下文中一共展示了ilObjStyleSheet::writeCSSFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exportStyles
/**
* Export content style
*
* @param
* @return
*/
function exportStyles()
{
include_once "Services/Style/classes/class.ilObjStyleSheet.php";
// export content style sheet
if ($this->getContentStyleId() < 1) {
$cont_stylesheet = "./Services/COPage/css/content.css";
$css = fread(fopen($cont_stylesheet, 'r'), filesize($cont_stylesheet));
preg_match_all("/url\\(([^\\)]*)\\)/", $css, $files);
foreach (array_unique($files[1]) as $fileref) {
if (is_file(str_replace("..", ".", $fileref))) {
copy(str_replace("..", ".", $fileref), $this->content_style_img_dir . "/" . basename($fileref));
}
$css = str_replace($fileref, "images/" . basename($fileref), $css);
}
fwrite(fopen($this->content_style_dir . "/content.css", 'w'), $css);
} else {
$style = new ilObjStyleSheet($this->getContentStyleId());
$style->writeCSSFile($this->content_style_dir . "/content.css", "images");
$style->copyImagesToDir($this->content_style_img_dir);
}
// export syntax highlighting style
$syn_stylesheet = ilObjStyleSheet::getSyntaxStylePath();
copy($syn_stylesheet, $this->exp_dir . "/syntaxhighlight.css");
}
示例2: exportHTML
/**
* export html package
*/
function exportHTML($a_target_dir, $log, $a_zip_file = true, $a_export_format = "html")
{
global $tpl, $ilBench, $ilLocator, $ilUser;
// initialize temporary target directory
ilUtil::delDir($a_target_dir);
ilUtil::makeDir($a_target_dir);
$mob_dir = $a_target_dir . "/mobs";
ilUtil::makeDir($mob_dir);
$file_dir = $a_target_dir . "/files";
ilUtil::makeDir($file_dir);
$teximg_dir = $a_target_dir . "/teximg";
ilUtil::makeDir($teximg_dir);
$style_dir = $a_target_dir . "/style";
ilUtil::makeDir($style_dir);
$style_img_dir = $a_target_dir . "/style/images";
ilUtil::makeDir($style_img_dir);
$content_style_dir = $a_target_dir . "/content_style";
ilUtil::makeDir($content_style_dir);
$content_style_img_dir = $a_target_dir . "/content_style/images";
ilUtil::makeDir($content_style_img_dir);
$GLOBALS["teximgcnt"] = 0;
// export system style sheet
$location_stylesheet = ilUtil::getStyleSheetLocation("filesystem");
$style_name = $ilUser->prefs["style"] . ".css";
copy($location_stylesheet, $style_dir . "/" . $style_name);
$fh = fopen($location_stylesheet, "r");
$css = fread($fh, filesize($location_stylesheet));
preg_match_all("/url\\(([^\\)]*)\\)/", $css, $files);
foreach (array_unique($files[1]) as $fileref) {
$fileref = dirname($location_stylesheet) . "/" . $fileref;
if (is_file($fileref)) {
copy($fileref, $style_img_dir . "/" . basename($fileref));
}
}
fclose($fh);
$location_stylesheet = ilUtil::getStyleSheetLocation();
// export content style sheet
$ilBench->start("ExportHTML", "exportContentStyle");
if ($this->getStyleSheetId() < 1) {
$cont_stylesheet = "./Services/COPage/css/content.css";
$css = fread(fopen($cont_stylesheet, 'r'), filesize($cont_stylesheet));
preg_match_all("/url\\(([^\\)]*)\\)/", $css, $files);
foreach (array_unique($files[1]) as $fileref) {
if (is_file(str_replace("..", ".", $fileref))) {
copy(str_replace("..", ".", $fileref), $content_style_img_dir . "/" . basename($fileref));
}
$css = str_replace($fileref, "images/" . basename($fileref), $css);
}
fwrite(fopen($content_style_dir . "/content.css", 'w'), $css);
} else {
$style = new ilObjStyleSheet($this->getStyleSheetId());
$style->writeCSSFile($content_style_dir . "/content.css", "images");
$style->copyImagesToDir($content_style_img_dir);
}
$ilBench->stop("ExportHTML", "exportContentStyle");
// export syntax highlighting style
$syn_stylesheet = ilObjStyleSheet::getSyntaxStylePath();
copy($syn_stylesheet, $a_target_dir . "/syntaxhighlight.css");
// get learning module presentation gui class
include_once "./Modules/LearningModule/classes/class.ilLMPresentationGUI.php";
$_GET["cmd"] = "nop";
$lm_gui =& new ilLMPresentationGUI();
$lm_gui->setOfflineMode(true);
$lm_gui->setOfflineDirectory($a_target_dir);
$lm_gui->setExportFormat($a_export_format);
// export pages
$ilBench->start("ExportHTML", "exportHTMLPages");
$this->exportHTMLPages($lm_gui, $a_target_dir);
$ilBench->stop("ExportHTML", "exportHTMLPages");
// export glossary terms
$ilBench->start("ExportHTML", "exportHTMLGlossaryTerms");
$this->exportHTMLGlossaryTerms($lm_gui, $a_target_dir);
$ilBench->stop("ExportHTML", "exportHTMLGlossaryTerms");
// export all media objects
$ilBench->start("ExportHTML", "exportHTMLMediaObjects");
$linked_mobs = array();
foreach ($this->offline_mobs as $mob) {
if (ilObject::_exists($mob) && ilObject::_lookupType($mob) == "mob") {
$this->exportHTMLMOB($a_target_dir, $lm_gui, $mob, "_blank", $linked_mobs);
}
}
$linked_mobs2 = array();
// mobs linked in link areas
foreach ($linked_mobs as $mob) {
if (ilObject::_exists($mob)) {
$this->exportHTMLMOB($a_target_dir, $lm_gui, $mob, "_blank", $linked_mobs2);
}
}
$_GET["obj_type"] = "MediaObject";
$_GET["obj_id"] = $a_mob_id;
$_GET["cmd"] = "";
$ilBench->stop("ExportHTML", "exportHTMLMediaObjects");
// export all file objects
$ilBench->start("ExportHTML", "exportHTMLFileObjects");
foreach ($this->offline_files as $file) {
$this->exportHTMLFile($a_target_dir, $file);
}
//.........这里部分代码省略.........
示例3: getContentStylePath
/**
* get content style path
*
* static (to avoid full reading)
*/
function getContentStylePath($a_style_id)
{
global $ilias;
$rand = rand(1, 999999);
// check global fixed content style
$fixed_style = $ilias->getSetting("fixed_content_style_id");
if ($fixed_style > 0) {
$a_style_id = $fixed_style;
}
// check global default style
if ($a_style_id <= 0) {
$a_style_id = $ilias->getSetting("default_content_style_id");
}
if ($a_style_id > 0 && ilObject::_exists($a_style_id)) {
// check whether file is up to date
if (!ilObjStyleSheet::_lookupUpToDate($a_style_id)) {
$style = new ilObjStyleSheet($a_style_id);
$style->writeCSSFile();
}
return ilUtil::getWebspaceDir("output") . "/css/style_" . $a_style_id . ".css?dummy={$rand}";
} else {
return "./Services/COPage/css/content.css";
}
}
示例4: 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);
}
}