本文整理汇总了PHP中ilObjStyleSheet::import方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjStyleSheet::import方法的具体用法?PHP ilObjStyleSheet::import怎么用?PHP ilObjStyleSheet::import使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjStyleSheet
的用法示例。
在下文中一共展示了ilObjStyleSheet::import方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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;
}