/** * 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(); }