本文整理汇总了PHP中ilUtil::rCopy方法的典型用法代码示例。如果您正苦于以下问题:PHP ilUtil::rCopy方法的具体用法?PHP ilUtil::rCopy怎么用?PHP ilUtil::rCopy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilUtil
的用法示例。
在下文中一共展示了ilUtil::rCopy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importXmlRepresentation
function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
{
// see ilStyleExporter::getXmlRepresentation()
if (preg_match("/<StyleSheetExport><ImagePath>(.+)<\\/ImagePath>/", $a_xml, $hits)) {
$path = $hits[1];
$a_xml = str_replace($hits[0], "", $a_xml);
$a_xml = str_replace("</StyleSheetExport>", "", $a_xml);
}
// temp xml-file
$tmp_file = $this->getImportDirectory() . "/sty_" . $a_id . ".xml";
file_put_contents($tmp_file, $a_xml);
include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
$style = new ilObjStyleSheet();
$style->createFromXMLFile($tmp_file);
$new_id = $style->getId();
unlink($tmp_file);
// images
if ($path) {
$source = $this->getImportDirectory() . "/" . $path;
if (is_dir($source)) {
$target = $style->getImagesDirectory();
if (!is_dir($target)) {
ilUtil::makeDirParents($target);
}
ilUtil::rCopy($source, $target);
}
}
$a_mapping->addMapping("Services/Style", "sty", $a_id, $new_id);
}
示例2: getXmlRepresentation
public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
{
include_once "Services/Style/classes/class.ilObjStyleSheet.php";
$style = new ilObjStyleSheet($a_id, false);
// images
$target = $this->getAbsoluteExportDirectory();
if ($target && !is_dir($target)) {
ilUtil::makeDirParents($target);
}
ilUtil::rCopy($style->getImagesDirectory(), $target);
return "<StyleSheetExport>" . "<ImagePath>" . $this->getRelativeExportDirectory() . "</ImagePath>" . $style->getXML() . "</StyleSheetExport>";
}
示例3: exportScorm
/**
* Export (authoring) scorm package
*/
function exportScorm($a_inst, $a_target_dir, $ver, &$expLog)
{
$a_xml_writer = new ilXmlWriter();
// export metadata
$this->exportXMLMetaData($a_xml_writer);
$metadata_xml = $a_xml_writer->xmlDumpMem(false);
$a_xml_writer->_XmlWriter;
$xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/metadata.xsl");
$args = array('/_xml' => $metadata_xml, '/_xsl' => $xsl);
$xh = xslt_create();
$output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, NULL);
xslt_free($xh);
file_put_contents($a_target_dir . '/indexMD.xml', $output);
// export glossary
if ($this->getAssignedGlossary() != 0) {
ilUtil::makeDir($a_target_dir . "/glossary");
include_once "./Modules/Glossary/classes/class.ilObjGlossary.php";
include_once "./Modules/Glossary/classes/class.ilGlossaryExport.php";
$glo_xml_writer = new ilXmlWriter();
$glo_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
// set xml header
$glo_xml_writer->xmlHeader();
$glos = new ilObjGlossary($this->getAssignedGlossary(), false);
//$glos->exportHTML($a_target_dir."/glossary", $expLog);
$glos_export = new ilGlossaryExport($glos, "xml");
$glos->exportXML($glo_xml_writer, $glos_export->getInstId(), $a_target_dir . "/glossary", $expLog);
$glo_xml_writer->xmlDumpFile($a_target_dir . "/glossary/glossary.xml");
$glo_xml_writer->_XmlWriter;
}
$a_xml_writer = new ilXmlWriter();
// set dtd definition
$a_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
// set generated comment
$a_xml_writer->xmlSetGenCmt("Export of ILIAS Content Module " . $this->getId() . " of installation " . $a_inst . ".");
// set xml header
$a_xml_writer->xmlHeader();
global $ilBench;
$a_xml_writer->xmlStartTag("ContentObject", array("Type" => "SCORM2004LearningModule"));
// MetaData
$this->exportXMLMetaData($a_xml_writer);
$this->exportXMLStructureObjects($a_xml_writer, $a_inst, $expLog);
// SCO Objects
$expLog->write(date("[y-m-d H:i:s] ") . "Start Export Sco Objects");
$this->exportXMLScoObjects($a_inst, $a_target_dir, $ver, $expLog);
$expLog->write(date("[y-m-d H:i:s] ") . "Finished Export Sco Objects");
$a_xml_writer->xmlEndTag("ContentObject");
$a_xml_writer->xmlDumpFile($a_target_dir . '/index.xml', false);
if ($ver == "2004 4th") {
$revision = "4th";
$ver = "2004";
}
if ($ver == "2004 3rd") {
$revision = "3rd";
$ver = "2004";
}
// add content css (note: this is also done per item)
$css_dir = $a_target_dir . "/ilias_css_4_2";
ilUtil::makeDir($css_dir);
include_once "./Modules/Scorm2004/classes/class.ilScormExportUtil.php";
ilScormExportUtil::exportContentCSS($this, $css_dir);
// add manifest
include_once "./Modules/Scorm2004/classes/class.ilContObjectManifestBuilder.php";
$manifestBuilder = new ilContObjectManifestBuilder($this);
$manifestBuilder->buildManifest($ver, $revision);
$manifestBuilder->dump($a_target_dir);
$xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/module.xsl");
$args = array('/_xml' => file_get_contents($a_target_dir . "/imsmanifest.xml"), '/_xsl' => $xsl);
$xh = xslt_create();
$output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, NULL);
xslt_free($xh);
fputs(fopen($a_target_dir . '/index.html', 'w+'), $output);
// copy xsd files to target
switch ($ver) {
case "2004":
if ($revision == "3rd") {
ilUtil::rCopy('./Modules/Scorm2004/templates/xsd/adlcp_130_export_2004', $a_target_dir, false);
}
if ($revision == "4th") {
ilUtil::rCopy('./Modules/Scorm2004/templates/xsd/adlcp_130_export_2004_4th', $a_target_dir, false);
}
break;
case "12":
ilUtil::rCopy('./Modules/Scorm2004/templates/xsd/adlcp_120_export_12', $a_target_dir, false);
break;
}
$a_xml_writer->_XmlWriter;
}
示例4: export
/**
* export files of object to target directory
* note: target directory must be the export target directory,
* "/objects/il_<inst>_file_<file_id>/..." will be appended to this directory
*
* @param string $a_target_dir target directory
*/
function export($a_target_dir)
{
$subdir = "il_" . IL_INST_ID . "_file_" . $this->getId();
ilUtil::makeDir($a_target_dir . "/objects/" . $subdir);
$filedir = $this->getDirectory($this->getVersion());
if (@(!is_dir($filedir))) {
$filedir = $this->getDirectory();
}
ilUtil::rCopy($filedir, $a_target_dir . "/objects/" . $subdir);
}
示例5: rCopy
/**
* Copies content of a directory $a_sdir recursively to a directory $a_tdir
* @param string $a_sdir source directory
* @param string $a_tdir target directory
* @param boolean $preserveTimeAttributes if true, ctime will be kept.
*
* @return boolean TRUE for sucess, FALSE otherwise
* @access public
* @static
*
*/
public static function rCopy($a_sdir, $a_tdir, $preserveTimeAttributes = false)
{
// check if arguments are directories
if (!@is_dir($a_sdir) or !@is_dir($a_tdir)) {
return FALSE;
}
// read a_sdir, copy files and copy directories recursively
$dir = opendir($a_sdir);
while ($file = readdir($dir)) {
if ($file != "." and $file != "..") {
// directories
if (@is_dir($a_sdir . "/" . $file)) {
if (!@is_dir($a_tdir . "/" . $file)) {
if (!ilUtil::makeDir($a_tdir . "/" . $file)) {
return FALSE;
}
//chmod($a_tdir."/".$file, 0775);
}
if (!ilUtil::rCopy($a_sdir . "/" . $file, $a_tdir . "/" . $file)) {
return FALSE;
}
}
// files
if (@is_file($a_sdir . "/" . $file)) {
if (!copy($a_sdir . "/" . $file, $a_tdir . "/" . $file)) {
return FALSE;
}
if ($preserveTimeAttributes) {
touch($a_tdir . "/" . $file, filectime($a_sdir . "/" . $file));
}
}
}
}
return TRUE;
}
示例6: importRecord
/**
* Import record
*
* @param
* @return
*/
function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
{
//echo $a_entity;
//var_dump($a_rec);
switch ($a_entity) {
case "htlm":
include_once "./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLM.php";
if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['Id'])) {
$newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
} else {
$newObj = new ilObjFileBasedLM();
$newObj->setType("htlm");
$newObj->create(true);
}
$newObj->setTitle($a_rec["Title"]);
$newObj->setDescription($a_rec["Description"]);
$newObj->setStartFile($a_rec["StartFile"], true);
$newObj->update();
$this->current_obj = $newObj;
$dir = str_replace("..", "", $a_rec["Dir"]);
if ($dir != "" && $this->getImportDirectory() != "") {
$source_dir = $this->getImportDirectory() . "/" . $dir;
$target_dir = $newObj->getDataDirectory();
ilUtil::rCopy($source_dir, $target_dir);
}
$a_mapping->addMapping("Modules/HTMLLearningModule", "htlm", $a_rec["Id"], $newObj->getId());
$a_mapping->addMapping("Services/MetaData", "md", $a_rec["Id"] . ":0:htlm", $newObj->getId() . ":0:htlm");
break;
}
}
示例7: importRecord
/**
* Import record
*
* @param
* @return
*/
function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
{
//echo $a_entity;
//var_dump($a_rec);
switch ($a_entity) {
case "mob":
//var_dump($a_rec);
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
$newObj = new ilObjMediaObject();
$newObj->setType("mob");
$newObj->setTitle($a_rec["Title"]);
$newObj->setDescription($a_rec["Description"]);
$newObj->create();
$newObj->createDirectory();
ilObjMediaObject::_createThumbnailDirectory($newObj->getId());
$this->current_mob = $newObj;
$dir = str_replace("..", "", $a_rec["Dir"]);
if ($dir != "" && $this->getImportDirectory() != "") {
$source_dir = $this->getImportDirectory() . "/" . $dir;
$target_dir = $dir = ilObjMediaObject::_getDirectory($newObj->getId());
ilUtil::rCopy($source_dir, $target_dir);
}
$a_mapping->addMapping("Services/MediaObjects", "mob", $a_rec["Id"], $newObj->getId());
//echo "<br>++add++"."0:".$a_rec["Id"].":mob+0:".$newObj->getId().":mob"."+";
$a_mapping->addMapping("Services/MetaData", "md", "0:" . $a_rec["Id"] . ":mob", "0:" . $newObj->getId() . ":mob");
break;
case "mob_media_item":
// determine parent mob
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
$mob_id = (int) $a_mapping->getMapping("Services/MediaObjects", "mob", $a_rec["MobId"]);
if (is_object($this->current_mob) && $this->current_mob->getId() == $mob_id) {
$mob = $this->current_mob;
} else {
$mob = new ilObjMediaObject($mob_id);
}
include_once "./Services/MediaObjects/classes/class.ilMediaItem.php";
$newObj = new ilMediaItem();
$newObj->setMobId($mob_id);
$newObj->setWidth($a_rec["Width"]);
$newObj->setHeight($a_rec["Height"]);
$newObj->setCaption($a_rec["Caption"]);
$newObj->setNr($a_rec["Nr"]);
$newObj->setPurpose($a_rec["Purpose"]);
$newObj->setLocation($a_rec["Location"]);
$newObj->setLocationType($a_rec["LocationType"]);
$newObj->setFormat($a_rec["Format"]);
$newObj->setTextRepresentation($a_rec["TextRepresentation"]);
$newObj->create();
$this->current_media_item = $newObj;
$a_mapping->addMapping("Services/MediaObjects", "mob_media_item", $a_rec["Id"], $newObj->getId());
break;
case "mob_mi_parameter":
// get media item
include_once "./Services/MediaObjects/classes/class.ilMediaItem.php";
$med_id = (int) $a_mapping->getMapping("Services/MediaObjects", "mob_media_item", $a_rec["MiId"]);
if (is_object($this->current_media_item) && $this->current_media_item->getId() == $med_id) {
$med = $this->current_media_item;
} else {
$med = new ilMediaItem($med_id);
}
$med->writeParameter($a_rec["Name"], $a_rec["Value"]);
break;
case "mob_mi_map_area":
// get media item
include_once "./Services/MediaObjects/classes/class.ilMediaItem.php";
$med_id = (int) $a_mapping->getMapping("Services/MediaObjects", "mob_media_item", $a_rec["MiId"]);
if (is_object($this->current_media_item) && $this->current_media_item->getId() == $med_id) {
$med = $this->current_media_item;
} else {
$med = new ilMediaItem($med_id);
}
include_once "./Services/MediaObjects/classes/class.ilMapArea.php";
$map_area = new ilMapArea();
$map_area->setItemId($med_id);
$map_area->setNr($a_rec["Nr"]);
$map_area->setShape($a_rec["Shape"]);
$map_area->setCoords($a_rec["Coords"]);
$map_area->setLinkType($a_rec["LinkType"]);
$map_area->setTitle($a_rec["Title"]);
$map_area->setHref($a_rec["Href"]);
$map_area->setTarget($a_rec["Target"]);
$map_area->setType($a_rec["Type"]);
$map_area->setTargetFrame($a_rec["TargetFrame"]);
$map_area->setHighlightMode($a_rec["HighlightMode"]);
$map_area->setHighlightClass($a_rec["HighlightClass"]);
$map_area->create();
break;
}
}
示例8: cloneFromSource
/**
* Clone source client into current client
* @param array form data
* @return boolean
*/
function cloneFromSource($source_id)
{
// Getting source and targets
$source = new ilClient($source_id, $this->db_connections);
$source->init();
$target = $this->client;
// ************************************************
// ** COPY FILES
// Cleaning up datadir
if (!ilUtil::delDir($target->getDataDir())) {
$this->error = "Could not delete data dir {$target->getDataDir}()";
//return false;
}
// Create empty datadir
if (!ilUtil::makeDir($target->getDataDir())) {
$this->error = "could_not_create_base_data_dir :" . $target->getDataDir();
return false;
}
// Copying datadir
if (!ilUtil::rCopy($source->getDataDir(), $target->getDataDir())) {
$this->error = "clone_datadircopyfail";
$target->ini->write();
return false;
}
// Cleaning up Webspacedir
if (!ilUtil::delDir($target->getWebspaceDir())) {
$this->error = "Could not delete webspace dir {$target->getWebspaceDir}()";
//return false;
}
// Create empty Webspacedir
if (!ilUtil::makeDir($target->getWebspaceDir())) {
$this->error = "could_not_create_base_webspace_dir :" . $target->getWebspaceDir();
return false;
}
// Copying Webspacedir
if (!ilUtil::rCopy($source->getWebspaceDir(), $target->getWebspaceDir())) {
$this->error = "clone_websipacedircopyfail";
$target->ini->write();
return false;
}
// Restore ini file
$target->ini->write();
// ************************************************
// ** COPY DATABASE
$source->connect();
if (!$source->db) {
$this->error = "Source database connection failed.";
return false;
}
$target->connect();
if (!$target->db) {
$this->error = "Target database connection failed.";
return false;
}
$source->connect();
$srcTables = $source->db->query("SHOW TABLES");
$target->connect();
// drop all tables of the target db
$tarTables = $target->db->query("SHOW TABLES");
foreach ($tarTables->fetchAll() as $cTable) {
$target->db->query("DROP TABLE IF EXISTS " . $cTable[0]);
}
foreach ($srcTables->fetchAll() as $cTable) {
$drop = $target->db->query("DROP TABLE IF EXISTS " . $cTable[0]);
$create = $target->db->query("CREATE TABLE " . $cTable[0] . " LIKE " . $source->getDbName() . "." . $cTable[0]);
if (!$create) {
$error = true;
}
$insert = $target->db->query("INSERT INTO " . $cTable[0] . " SELECT * FROM " . $source->getDbName() . "." . $cTable[0]);
}
return true;
}
示例9: cloneAssignmentsOfExercise
/**
* Clone assignments of exercise
*
* @param
* @return
*/
function cloneAssignmentsOfExercise($a_old_exc_id, $a_new_exc_id)
{
$ass_data = ilExAssignment::getAssignmentDataOfExercise($a_old_exc_id);
foreach ($ass_data as $d) {
// clone assignment
$new_ass = new ilExAssignment();
$new_ass->setExerciseId($a_new_exc_id);
$new_ass->setTitle($d["title"]);
$new_ass->setDeadline($d["deadline"]);
$new_ass->setInstruction($d["instruction"]);
$new_ass->setMandatory($d["mandatory"]);
$new_ass->setOrderNr($d["order_val"]);
$new_ass->setStartTime($d["start_time"]);
$new_ass->setType($d["type"]);
$new_ass->setPeerReview($d["peer"]);
$new_ass->setPeerReviewMin($d["peer_min"]);
$new_ass->setPeerReviewDeadline($d["peer_dl"]);
$new_ass->setFeedbackFile($d["fb_file"]);
$new_ass->setFeedbackCron($d["fb_cron"]);
$new_ass->save();
// clone assignment files
include_once "./Modules/Exercise/classes/class.ilFSStorageExercise.php";
$old_storage = new ilFSStorageExercise($a_old_exc_id, (int) $d["id"]);
$new_storage = new ilFSStorageExercise($a_new_exc_id, (int) $new_ass->getId());
$new_storage->create();
if (is_dir($old_storage->getPath())) {
ilUtil::rCopy($old_storage->getPath(), $new_storage->getPath());
}
}
}
示例10: importRecord
/**
* Import record
*
* @param
* @return
*/
function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
{
switch ($a_entity) {
case "blog":
include_once "./Modules/Blog/classes/class.ilObjBlog.php";
// container copy
if ($new_id = $a_mapping->getMapping("Services/Container", "objs", $a_rec["Id"])) {
$newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
} else {
$newObj = new ilObjBlog();
$newObj->create();
}
$newObj->setTitle($a_rec["Title"]);
$newObj->setDescription($a_rec["Description"]);
$newObj->setNotesStatus($a_rec["Notes"]);
$newObj->setBackgroundColor($a_rec["BgColor"]);
$newObj->setFontColor($a_rec["FontColor"]);
$newObj->setProfilePicture($a_rec["Ppic"]);
$newObj->setRSS($a_rec["RssActive"]);
$newObj->setApproval($a_rec["Approval"]);
$newObj->setImage($a_rec["Img"]);
$newObj->setAbstractShorten($a_rec["AbsShorten"]);
$newObj->setAbstractShortenLength($a_rec["AbsShortenLen"]);
$newObj->setAbstractImage($a_rec["AbsImage"]);
$newObj->setAbstractImageWidth($a_rec["AbsImgWidth"]);
$newObj->setAbstractImageHeight($a_rec["AbsImgHeight"]);
$newObj->setNavMode($a_rec["NavMode"]);
$newObj->setNavModeListPostings($a_rec["NavListPost"]);
$newObj->setNavModeListMonths($a_rec["NavListMon"]);
$newObj->setKeywords($a_rec["Keywords"]);
$newObj->setAuthors($a_rec["Authors"]);
$newObj->setOrder(trim($a_rec["NavOrder"]) ? explode(";", $a_rec["NavOrder"]) : null);
$newObj->setOverviewPostings($a_rec["OvPost"]);
$newObj->update();
// handle image(s)
if ($a_rec["Img"]) {
$dir = str_replace("..", "", $a_rec["Dir"]);
if ($dir != "" && $this->getImportDirectory() != "") {
$source_dir = $this->getImportDirectory() . "/" . $dir;
$target_dir = ilObjBlog::initStorage($newObj->getId());
ilUtil::rCopy($source_dir, $target_dir);
}
}
if ($a_rec["Style"]) {
self::$style_map[$a_rec["Style"]][] = $newObj->getId();
}
$a_mapping->addMapping("Modules/Blog", "blog", $a_rec["Id"], $newObj->getId());
break;
case "blog_posting":
$blog_id = (int) $a_mapping->getMapping("Modules/Blog", "blog", $a_rec["BlogId"]);
if ($blog_id) {
include_once "./Modules/Blog/classes/class.ilBlogPosting.php";
$newObj = new ilBlogPosting();
$newObj->setBlogId($blog_id);
$newObj->setTitle($a_rec["Title"]);
$newObj->setCreated(new ilDateTime($a_rec["Created"], IL_CAL_DATETIME));
$newObj->setApproved($a_rec["Approved"]);
// parse export id into local id (if possible)
$author = $this->parseObjectExportId($a_rec["Author"], -1);
$newObj->setAuthor($author["id"]);
$newObj->create(true);
// keywords
$keywords = array();
for ($loop = 0; $loop < 1000; $loop++) {
if (isset($a_rec["Keyword" . $loop])) {
$keyword = trim($a_rec["Keyword" . $loop]);
if (strlen($keyword)) {
$keywords[] = $keyword;
}
}
}
if (sizeof($keywords)) {
$newObj->updateKeywords($keywords);
}
$a_mapping->addMapping("Services/COPage", "pg", "blp:" . $a_rec["Id"], "blp:" . $newObj->getId());
}
break;
}
}
示例11: copyFileItems
/**
* copy files of file items
*/
function copyFileItems()
{
$imp_dir = $this->content_object->getImportDirectory();
foreach ($this->file_item_mapping as $origin_id => $file_id) {
if (empty($origin_id)) {
continue;
}
$obj_dir = $origin_id;
$source_dir = $imp_dir . "/" . $this->subdir . "/objects/" . $obj_dir;
include_once "./Modules/File/classes/class.ilObjFile.php";
$file_obj = new ilObjFile($file_id, false);
//$target_dir = ilUtil::getDataDir()."/files/file_".$file_id;
$target_dir = $file_obj->getDirectory();
if (@is_dir($source_dir)) {
// make target directory
ilUtil::makeDir($target_dir);
//@mkdir($target_dir);
//@chmod($target_dir, 0755);
if (@is_dir($target_dir)) {
ilUtil::rCopy($source_dir, $target_dir);
}
}
$test = $file_obj->determineFilesize();
$file_obj->update();
}
}
示例12: exportHTMLMOB
/**
* Export media object to html
*/
function exportHTMLMOB($a_mob_id, &$a_linked_mobs)
{
global $tpl;
$source_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $a_mob_id;
if (@is_dir($source_dir)) {
ilUtil::makeDir($this->mobs_dir . "/mm_" . $a_mob_id);
ilUtil::rCopy($source_dir, $this->mobs_dir . "/mm_" . $a_mob_id);
}
// #12930 - fullscreen
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
$mob_obj = new ilObjMediaObject($a_mob_id);
if ($mob_obj->hasFullscreenItem()) {
// render media object html
$xh = xslt_create();
$output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, array("/_xml" => "<dummy>" . $mob_obj->getXML(IL_MODE_ALIAS) . $mob_obj->getXML(IL_MODE_OUTPUT) . "</dummy>", "/_xsl" => file_get_contents("./Services/COPage/xsl/page.xsl")), array("mode" => "fullscreen"));
xslt_free($xh);
unset($xh);
// render fullscreen html
$tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
$tpl = $this->getPreparedMainTemplate($tpl);
// adds js/css
$tpl->setCurrentBlock("ilMedia");
$tpl->setVariable("MEDIA_CONTENT", $output);
$output = $tpl->get();
unset($tpl);
// write file
$file = $this->exp_dir . "/fullscreen_" . $a_mob_id . ".html";
if (!($fp = @fopen($file, "w+"))) {
die("<b>Error</b>: Could not open \"" . $file . "\" for writing" . " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
}
chmod($file, 0770);
fwrite($fp, $output);
fclose($fp);
unset($fp);
unset($output);
}
$linked_mobs = $mob_obj->getLinkedMediaObjects();
$a_linked_mobs = array_merge($a_linked_mobs, $linked_mobs);
}
示例13: exportHTMLMOB
/**
* export media object to html
*/
function exportHTMLMOB($a_target_dir, &$a_glo_gui, $a_mob_id)
{
global $tpl;
$mob_dir = $a_target_dir . "/mobs";
$source_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $a_mob_id;
if (@is_dir($source_dir)) {
ilUtil::makeDir($mob_dir . "/mm_" . $a_mob_id);
ilUtil::rCopy($source_dir, $mob_dir . "/mm_" . $a_mob_id);
}
$tpl = new ilTemplate("tpl.main.html", true, true);
$tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
$_GET["obj_type"] = "MediaObject";
$_GET["mob_id"] = $a_mob_id;
$_GET["cmd"] = "";
$content =& $a_glo_gui->media();
$file = $a_target_dir . "/media_" . $a_mob_id . ".html";
// open file
if (!($fp = @fopen($file, "w+"))) {
die("<b>Error</b>: Could not open \"" . $file . "\" for writing" . " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
}
chmod($file, 0770);
fwrite($fp, $content);
fclose($fp);
// fullscreen
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
$mob_obj = new ilObjMediaObject($a_mob_id);
if ($mob_obj->hasFullscreenItem()) {
$tpl = new ilTemplate("tpl.main.html", true, true);
$tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
$_GET["mob_id"] = $a_mob_id;
$_GET["cmd"] = "fullscreen";
$content = $a_glo_gui->fullscreen();
$file = $a_target_dir . "/fullscreen_" . $a_mob_id . ".html";
// open file
if (!($fp = @fopen($file, "w+"))) {
die("<b>Error</b>: Could not open \"" . $file . "\" for writing" . " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
}
chmod($file, 0770);
fwrite($fp, $content);
fclose($fp);
}
}
示例14: addRecordsXml
/**
* Add records xml
*
* @param
* @return
*/
function addRecordsXml($a_writer, $a_prefixes, $a_entity, $a_schema_version, $a_ids, $a_field = "")
{
$types = $this->getXmlTypes($a_entity, $a_schema_version);
$this->readData($a_entity, $a_schema_version, $a_ids, $a_field);
if (is_array($this->data)) {
foreach ($this->data as $d) {
$a_writer->xmlStartTag($this->getDSPrefixString() . "Rec", array("Entity" => $this->getXmlEntityName($a_entity, $a_schema_version)));
// entity tag
$a_writer->xmlStartTag($this->getXmlEntityTag($a_entity, $a_schema_version));
$rec = $this->getXmlRecord($a_entity, $a_schema_version, $d);
foreach ($rec as $f => $c) {
switch ($types[$f]) {
case "directory":
if ($this->absolute_export_dir != "" && $this->relative_export_dir != "") {
ilUtil::makeDirParents($this->absolute_export_dir . "/dsDir_" . $this->dircnt);
ilUtil::rCopy($c, $this->absolute_export_dir . "/dsDir_" . $this->dircnt);
//echo "<br>copy-".$c."-".$this->absolute_export_dir."/dsDir_".$this->dircnt."-";
$c = $this->relative_export_dir . "/dsDir_" . $this->dircnt;
$this->dircnt++;
}
break;
}
// this changes schema/dtd
//$a_writer->xmlElement($a_prefixes[$a_entity].":".$f,
// array(), $c);
$a_writer->xmlElement($f, array(), $c);
}
$a_writer->xmlEndTag($this->getXmlEntityTag($a_entity, $a_schema_version));
$a_writer->xmlEndTag($this->getDSPrefixString() . "Rec");
$this->afterXmlRecordWriting($a_entity, $a_schema_version, $d);
// foreach record records of dependent entities (no record)
$deps = $this->getDependencies($a_entity, $a_schema_version, $rec, $a_ids);
if (is_array($deps)) {
foreach ($deps as $dp => $par) {
$this->addRecordsXml($a_writer, $a_prefixes, $dp, $a_schema_version, $par["ids"], $par["field"]);
}
}
}
} else {
if ($this->data === false) {
// false -> add records of dependent entities (no record)
$deps = $this->getDependencies($a_entity, $a_schema_version, null, $a_ids);
if (is_array($deps)) {
foreach ($deps as $dp => $par) {
$this->addRecordsXml($a_writer, $a_prefixes, $dp, $a_schema_version, $par["ids"], $par["field"]);
}
}
}
}
}
示例15: createOnlineVersion
function createOnlineVersion($a_rel_name)
{
ilUtil::makeDir(CLIENT_WEB_DIR . '/courses/' . $a_rel_name);
ilUtil::rCopy($this->getCoursePath() . '/' . $a_rel_name, CLIENT_WEB_DIR . '/courses/' . $a_rel_name);
return true;
}