/** * Creates a new questionpool and returns the reference id * * Creates a new questionpool and returns the reference id * * @return integer Reference id of the newly created questionpool * @access public */ function createQuestionPool($name = "Dummy") { global $tree; $parent_ref = $tree->getParentId($_GET["ref_id"]); include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"; $qpl = new ilObjQuestionPool(); $qpl->setType("qpl"); $qpl->setTitle($name); $qpl->setDescription(""); $qpl->create(); $qpl->createReference(); $qpl->putInTree($parent_ref); $qpl->setPermissions($parent_ref); $qpl->setOnline(1); // must be online to be available $qpl->saveToDb(); return $qpl->getRefId(); }
/** * imports question(s) into the questionpool (after verification) */ function importVerifiedFileObject() { if ($_POST["questions_only"] == 1) { $newObj =& $this->object; } else { include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"; // create new questionpool object $newObj = new ilObjQuestionPool(0, true); // set type of questionpool object $newObj->setType($_GET["new_type"]); // set title of questionpool object to "dummy" $newObj->setTitle("dummy"); // set description of questionpool object $newObj->setDescription("questionpool import"); // create the questionpool class in the ILIAS database (object_data table) $newObj->create(true); // create a reference for the questionpool object in the ILIAS database (object_reference table) $newObj->createReference(); // put the questionpool object in the administration tree $newObj->putInTree($_GET["ref_id"]); // get default permissions and set the permissions for the questionpool object $newObj->setPermissions($_GET["ref_id"]); // notify the questionpool object and all its parent objects that a "new" object was created $newObj->notify("new", $_GET["ref_id"], $_GET["parent_non_rbac_id"], $_GET["ref_id"], $newObj->getRefId()); } // start parsing of QTI files include_once "./Services/QTI/classes/class.ilQTIParser.php"; $qtiParser = new ilQTIParser($_SESSION["qpl_import_qti_file"], IL_MO_PARSE_QTI, $newObj->getId(), $_POST["ident"]); $result = $qtiParser->startParsing(); // import page data if (strlen($_SESSION["qpl_import_xml_file"])) { include_once "./Modules/LearningModule/classes/class.ilContObjParser.php"; $contParser = new ilContObjParser($newObj, $_SESSION["qpl_import_xml_file"], $_SESSION["qpl_import_subdir"]); $contParser->setQuestionMapping($qtiParser->getImportMapping()); $contParser->startParsing(); } // set another question pool name (if possible) $qpl_name = $_POST["qpl_new"]; if (strcmp($qpl_name, $newObj->getTitle()) != 0 && strlen($qpl_name) > 0) { $newObj->setTitle($qpl_name); $newObj->update(); } // delete import directory include_once "./Services/Utilities/classes/class.ilUtil.php"; ilUtil::delDir(dirname(ilObjQuestionPool::_getImportDirectory())); if ($_POST["questions_only"] == 1) { $this->ctrl->redirect($this, "questions"); } else { ilUtil::sendSuccess($this->lng->txt("object_imported"), true); ilUtil::redirect("ilias.php?ref_id=" . $newObj->getRefId() . "&baseClass=ilObjQuestionPoolGUI"); } }