本文整理汇总了PHP中ilObjStyleSheet::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjStyleSheet::getId方法的具体用法?PHP ilObjStyleSheet::getId怎么用?PHP ilObjStyleSheet::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjStyleSheet
的用法示例。
在下文中一共展示了ilObjStyleSheet::getId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ilClone
/**
* clone style sheet (note: styles have no ref ids and return an object id)
*
* @access public
* @return integer new obj id
*/
function ilClone()
{
global $log, $lng;
$lng->loadLanguageModule("style");
$new_obj = new ilObjStyleSheet();
$new_obj->setTitle($this->getTitle() . " (" . $lng->txt("sty_acopy") . ")");
$new_obj->setType($this->getType());
$new_obj->setDescription($this->getDescription());
$new_obj->create($this->getId());
$new_obj->writeStyleSetting("disable_auto_margins", $this->lookupStyleSetting("disable_auto_margins"));
return $new_obj->getId();
}
示例3: importStyleObject
/**
* import style sheet
*/
function importStyleObject()
{
// check file
$source = $_FILES["stylefile"]["tmp_name"];
if ($source == 'none' || !$source) {
$this->ilias->raiseError("No file selected!", $this->ilias->error_obj->MESSAGE);
}
// check correct file type
$info = pathinfo($_FILES["stylefile"]["name"]);
if (strtolower($info["extension"]) != "zip" && strtolower($info["extension"]) != "xml") {
$this->ilias->raiseError("File must be a zip or xml file!", $this->ilias->error_obj->MESSAGE);
}
$class_name = "ilObjStyleSheet";
require_once "./Services/Style/classes/class.ilObjStyleSheet.php";
$newObj = new ilObjStyleSheet();
//$newObj->setTitle();
//$newObj->setDescription($_POST["style_description"]);
$newObj->import($_FILES["stylefile"]);
//$newObj->createFromXMLFile($_FILES["stylefile"]["tmp_name"]);
// assign style to style sheet folder,
// if parent is style sheet folder
if ($_GET["ref_id"] > 0) {
$fold =& ilObjectFactory::getInstanceByRefId($_GET["ref_id"]);
if ($fold->getType() == "stys") {
$fold->addStyle($newObj->getId());
$fold->update();
ilObjStyleSheet::_writeStandard($newObj->getId(), "1");
$this->ctrl->redirectByClass("ilobjstylesettingsgui", "editContentStyles");
}
}
return $newObj->getId();
}
示例4: importFromDirectory
/**
* Import lm from directory
*
* @param
* @return
*/
function importFromDirectory($a_directory, $a_validate = true)
{
global $lng;
// determine filename of xml file
$subdir = basename($a_directory);
$xml_file = $a_directory . "/" . $subdir . ".xml";
// check directory exists within zip file
if (!is_dir($a_directory)) {
return sprintf($lng->txt("cont_no_subdir_in_zip"), $subdir);
}
// check whether xml file exists within zip file
if (!is_file($xml_file)) {
return sprintf($lng->txt("cont_zip_file_invalid"), $subdir . "/" . $subdir . ".xml");
}
// import questions
$qti_file = $a_directory . "/qti.xml";
$qtis = array();
if (is_file($qti_file)) {
include_once "./Services/QTI/classes/class.ilQTIParser.php";
include_once "./Modules/Test/classes/class.ilObjTest.php";
$qtiParser = new ilQTIParser($qti_file, IL_MO_VERIFY_QTI, 0, "");
$result = $qtiParser->startParsing();
$founditems =& $qtiParser->getFoundItems();
$testObj = new ilObjTest(0, true);
if (count($founditems) > 0) {
$qtiParser = new ilQTIParser($qti_file, IL_MO_PARSE_QTI, 0, "");
$qtiParser->setTestObject($testObj);
$result = $qtiParser->startParsing();
$qtis = array_merge($qtis, $qtiParser->getImportMapping());
}
}
include_once "./Modules/LearningModule/classes/class.ilContObjParser.php";
$contParser = new ilContObjParser($this, $xml_file, $subdir, $qmapping);
$contParser->setQuestionMapping($qtis);
$contParser->startParsing();
ilObject::_writeImportId($this->getId(), $this->getImportId());
$this->MDUpdateListener('General');
// import style
$style_file = $a_directory . "/style.xml";
$style_zip_file = $a_directory . "/style.zip";
if (is_file($style_zip_file)) {
require_once "./Services/Style/classes/class.ilObjStyleSheet.php";
$style = new ilObjStyleSheet();
$style->import($style_zip_file);
$this->writeStyleSheetId($style->getId());
} else {
if (is_file($style_file)) {
require_once "./Services/Style/classes/class.ilObjStyleSheet.php";
$style = new ilObjStyleSheet();
$style->import($style_file);
$this->writeStyleSheetId($style->getId());
}
}
// // validate
if ($a_validate) {
$mess = $this->validatePages();
}
if ($mess == "") {
// handle internal links to this learning module
include_once "./Modules/LearningModule/classes/class.ilLMPage.php";
ilLMPage::_handleImportRepositoryLinks($this->getImportId(), $this->getType(), $this->getRefId());
}
return $mess;
}