4 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
56 public function __construct($a_id = 0, $a_call_by_reference =
true)
59 parent::__construct($a_id, $a_call_by_reference);
62 $this->skillServiceEnabled =
false;
68 public function create($a_upload =
false)
87 $result = parent::createReference();
113 include_once
"./Services/MetaData/classes/class.ilMD.php";
115 $md_gen =&$md->getGeneral();
116 if ($md_gen ==
false) {
117 include_once
"./Services/MetaData/classes/class.ilMDCreator.php";
119 $md_creator->setTitle($this->
getTitle());
120 $md_creator->setTitleLanguage($ilUser->getPref(
'language'));
121 $md_creator->create();
123 parent::updateMetaData();
131 public function read($a_force_db =
false)
133 parent::read($a_force_db);
144 public function delete()
147 if (!parent::delete()) {
157 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImportFails.php';
159 $qsaImportFails->deleteRegisteredImportFails();
168 if (count($questions)) {
169 foreach ($questions as $question_id) {
175 include_once
"./Services/Utilities/classes/class.ilUtil.php";
177 $directory = $qpl_data_dir .
"/qpl_" . $this->
getId();
178 if (is_dir($directory)) {
179 include_once
"./Services/Utilities/classes/class.ilUtil.php";
192 include_once
"./Modules/Test/classes/class.ilObjTest.php";
193 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
197 $question->delete($question_id);
222 "SELECT * FROM qpl_questionpool WHERE obj_fi = %s",
245 "SELECT id_questionpool FROM qpl_questionpool WHERE obj_fi = %s",
265 $next_id = $ilDB->nextId(
'qpl_questionpool');
268 'id_questionpool' =>
array(
'integer', $next_id),
290 if ($question_id < 1) {
295 "SELECT qpl_qst_type.type_tag FROM qpl_questions, qpl_qst_type WHERE qpl_questions.question_type_fi = qpl_qst_type.question_type_id AND qpl_questions.question_id = %s",
301 return $data[
"type_tag"];
314 return parent::getDescription();
322 parent::setDescription($a_description);
332 return parent::getTitle();
340 parent::setTitle($a_title);
355 "SELECT COUNT(solution_id) solution_count FROM tst_solutions WHERE question_fi = %s",
360 return $row[
"solution_count"];
365 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
366 if ($question_id > 0) {
370 $question_type_gui = $question_type .
"GUI";
371 $question_gui =
new $question_type_gui();
372 return $question_gui;
384 $newtitle = $question->object->getTitle();
385 if ($question->object->questionTitleExists($this->getId(), $question->object->getTitle())) {
387 while ($question->object->questionTitleExists($this->getId(), $question->object->getTitle() .
" ($counter)")) {
390 $newtitle = $question->object->getTitle() .
" ($counter)";
392 $new_id = $question->object->duplicate(
false, $newtitle);
408 if ($question_gui->object->getObjId() == $questionpool_to) {
413 $newtitle = $question_gui->object->getTitle();
414 if ($question_gui->object->questionTitleExists($this->getId(), $question_gui->object->getTitle())) {
416 while ($question_gui->object->questionTitleExists($this->getId(), $question_gui->object->getTitle() .
" ($counter)")) {
419 $newtitle = $question_gui->object->getTitle() .
" ($counter)";
421 return $question_gui->object->copyObject($this->
getId(), $newtitle);
434 $query_result = $ilDB->queryF(
435 "SELECT qpl_questions.*, qpl_qst_type.type_tag, qpl_qst_type.plugin, qpl_questions.tstamp updated FROM qpl_questions, qpl_qst_type WHERE qpl_questions.original_id IS NULL AND qpl_questions.tstamp > 0 AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id AND qpl_questions.obj_fi = %s",
441 if ($query_result->numRows()) {
442 while (
$row = $ilDB->fetchAssoc($query_result)) {
443 $row[
'ttype'] = $types[
$row[
'type_tag']];
444 if ($row[
"plugin"]) {
446 array_push(
$rows, $row);
449 array_push(
$rows, $row);
461 $xmlWriter->xmlStartTag(
'Settings');
463 $xmlWriter->xmlElement(
'ShowTaxonomies', null, (
int) $this->
getShowTaxonomies());
464 $xmlWriter->xmlElement(
'NavTaxonomy', null, (
int) $this->
getNavTaxonomyId());
467 $xmlWriter->xmlEndTag(
'Settings');
480 $this->mob_ids =
array();
481 $this->file_ids =
array();
484 $attrs[
"Type"] =
"Questionpool_Test";
485 $a_xml_writer->
xmlStartTag(
"ContentObject", $attrs);
494 $expLog->write(
date(
"[y-m-d H:i:s] ") .
"Start Export Page Objects");
495 $ilBench->start(
"ContentObjectExport",
"exportPageObjects");
497 $ilBench->stop(
"ContentObjectExport",
"exportPageObjects");
498 $expLog->write(
date(
"[y-m-d H:i:s] ") .
"Finished Export Page Objects");
501 $expLog->write(
date(
"[y-m-d H:i:s] ") .
"Start Export Media Objects");
502 $ilBench->start(
"ContentObjectExport",
"exportMediaObjects");
504 $ilBench->stop(
"ContentObjectExport",
"exportMediaObjects");
505 $expLog->write(
date(
"[y-m-d H:i:s] ") .
"Finished Export Media Objects");
508 $expLog->write(
date(
"[y-m-d H:i:s] ") .
"Start Export File Items");
509 $ilBench->start(
"ContentObjectExport",
"exportFileItems");
511 $ilBench->stop(
"ContentObjectExport",
"exportFileItems");
512 $expLog->write(
date(
"[y-m-d H:i:s] ") .
"Finished Export File Items");
517 $a_xml_writer->
xmlEndTag(
"ContentObject");
528 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
530 $assignmentList->setParentObjId($this->
getId());
531 $assignmentList->loadFromDb();
532 $assignmentList->loadAdditionalSkillData();
534 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentExporter.php';
536 $skillQuestionAssignmentExporter->setXmlWriter($a_xml_writer);
537 $skillQuestionAssignmentExporter->setQuestionIds($questions);
538 $skillQuestionAssignmentExporter->setAssignmentList($assignmentList);
539 $skillQuestionAssignmentExporter->export();
550 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
552 $md2xml->setExportMode(
true);
553 $md2xml->startExport();
554 $a_xml_writer->appendXML($md2xml->getXML());
559 if ($a_tag ==
"Identifier" && $a_param ==
"Entry") {
560 include_once
"./Services/Utilities/classes/class.ilUtil.php";
578 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
580 foreach ($questions as $question_id) {
581 $ilBench->start(
"ContentObjectExport",
"exportPageObject");
582 $expLog->write(
date(
"[y-m-d H:i:s] ") .
"Page Object " . $question_id);
585 $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
589 $ilBench->start(
"ContentObjectExport",
"exportPageObject_XML");
590 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
592 $page_object->buildDom();
593 $page_object->insertInstIntoIDs($a_inst);
594 $mob_ids = $page_object->collectMediaObjects(
false);
595 require_once
'Services/COPage/classes/class.ilPCFileList.php';
597 $xml = $page_object->getXMLFromDom(
false,
false,
false,
"",
true);
598 $xml = str_replace(
"&",
"&", $xml);
599 $a_xml_writer->appendXML($xml);
600 $page_object->freeDom();
603 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_XML");
606 $ilBench->start(
"ContentObjectExport",
"exportPageObject_CollectMedia");
608 foreach ($mob_ids as $mob_id) {
609 $this->mob_ids[$mob_id] = $mob_id;
611 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_CollectMedia");
614 $ilBench->start(
"ContentObjectExport",
"exportPageObject_CollectFileItems");
616 foreach ($file_ids as $file_id) {
617 $this->file_ids[$file_id] = $file_id;
619 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_CollectFileItems");
621 $a_xml_writer->xmlEndTag(
"PageObject");
624 $ilBench->stop(
"ContentObjectExport",
"exportPageObject");
636 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
638 foreach ($this->mob_ids as $mob_id) {
639 $expLog->write(
date(
"[y-m-d H:i:s] ") .
"Media Object " . $mob_id);
642 $media_obj->exportXML($a_xml_writer, $a_inst);
643 $media_obj->exportFiles($a_target_dir);
655 include_once(
"./Modules/File/classes/class.ilObjFile.php");
657 foreach ($this->file_ids as $file_id) {
658 $expLog->write(
date(
"[y-m-d H:i:s] ") .
"File Item " . $file_id);
659 $file_obj =
new ilObjFile($file_id,
false);
660 $file_obj->export($a_target_dir);
672 include_once
"./Services/Utilities/classes/class.ilUtil.php";
675 if (!is_writable($qpl_data_dir)) {
676 $this->
ilias->raiseError(
"Questionpool Data Directory (" . $qpl_data_dir
677 .
") not writeable.", $this->
ilias->error_obj->FATAL);
681 $qpl_dir = $qpl_data_dir .
"/qpl_" . $this->
getId();
683 if (!@is_dir($qpl_dir)) {
684 $this->
ilias->raiseError(
"Creation of Questionpool Directory failed.", $this->
ilias->error_obj->FATAL);
689 $this->
ilias->raiseError(
"Creation of Export Directory failed.", $this->
ilias->error_obj->FATAL);
693 $this->
ilias->raiseError(
"Creation of Export Directory failed.", $this->
ilias->error_obj->FATAL);
702 include_once
"./Services/Utilities/classes/class.ilUtil.php";
705 include_once(
"./Services/Export/classes/class.ilExport.php");
728 include_once
"./Services/Utilities/classes/class.ilUtil.php";
732 if (!is_writable($qpl_data_dir)) {
733 $ilias->raiseError(
"Questionpool Data Directory (" . $qpl_data_dir
734 .
") not writeable.", $ilias->error_obj->FATAL);
738 $qpl_dir = $qpl_data_dir .
"/qpl_import";
740 if (!@is_dir($qpl_dir)) {
741 $ilias->raiseError(
"Creation of Questionpool Directory failed.", $ilias->error_obj->FATAL);
751 if (strlen($a_import_dir)) {
752 $_SESSION[
"qpl_import_dir"] = $a_import_dir;
763 if (strlen(
$_SESSION[
"qpl_import_dir"])) {
784 "SELECT question_id FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.tstamp > 0 AND original_id IS NULL",
788 $questions =
array();
790 array_push($questions,
$row[
"question_id"]);
799 $query_result = $ilDB->queryF(
800 "SELECT question_id, qpl_qst_type.type_tag, qpl_qst_type.plugin FROM qpl_questions, qpl_qst_type WHERE original_id IS NULL AND qpl_questions.tstamp > 0 AND obj_fi = %s AND complete = %s AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id",
801 array(
'integer',
'text'),
804 $questions =
array();
805 if ($query_result->numRows()) {
806 while (
$row = $ilDB->fetchAssoc($query_result)) {
807 if (
$row[
"plugin"]) {
809 array_push($questions,
$row[
"question_id"]);
812 array_push($questions,
$row[
"question_id"]);
823 $row = $DIC->database()->fetchAssoc($DIC->database()->queryF(
824 "SELECT COUNT(question_id) cnt FROM qpl_questions WHERE question_id = %s AND obj_fi = %s",
825 array(
'integer',
'integer'),
829 return (
bool)
$row[
'cnt'];
838 if (!is_array($this->import_mapping)) {
841 return $this->import_mapping;
856 if (count($questions) > 0) {
857 foreach ($questions as
$key => $value) {
859 $xml .= $question->object->toXML();
861 if (count($questions) > 1) {
862 $xml = preg_replace(
"/<\/questestinterop>\s*<.xml.*?>\s*<questestinterop>/",
"",
$xml);
865 $xml = preg_replace(
"/(<\?xml[^>]*?>)/",
"\\1" .
"<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">",
$xml);
880 if ($complete_questions_only) {
882 "SELECT COUNT(question_id) question_count FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.tstamp > 0 AND original_id IS NULL AND complete = %s",
883 array(
'integer',
'text'),
884 array($questionpool_id, 1)
888 "SELECT COUNT(question_id) question_count FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.tstamp > 0 AND original_id IS NULL",
890 array($questionpool_id)
894 return $row[
"question_count"];
906 switch ($a_online_status) {
909 $this->online = $a_online_status;
919 if (strcmp($this->online,
"") == 0) {
956 "SELECT qpl_questionpool.isonline FROM qpl_questionpool,object_reference WHERE object_reference.ref_id = %s AND object_reference.obj_id = qpl_questionpool.obj_fi",
962 "SELECT isonline FROM qpl_questionpool WHERE obj_fi = %s",
969 return $row[
"isonline"];
986 "SELECT count(DISTINCT qpl_questions.points) equal_points FROM qpl_questions, object_reference WHERE object_reference.ref_id = %s AND qpl_questions.tstamp > 0 AND object_reference.obj_id = qpl_questions.obj_fi AND qpl_questions.original_id IS NULL",
992 "SELECT count(DISTINCT points) equal_points FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.tstamp > 0 AND qpl_questions.original_id IS NULL",
999 if (
$row[
"equal_points"] == 1) {
1018 if (array_key_exists(
"qpl_clipboard",
$_SESSION)) {
1020 foreach (
$_SESSION[
"qpl_clipboard"] as $question_object) {
1021 if (strcmp($question_object[
"action"],
"move") == 0) {
1023 "SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
1025 array($question_object[
"question_id"])
1027 if (
$result->numRows() == 1) {
1029 $source_questionpool =
$row[
"obj_fi"];
1031 $affectedRows = $ilDB->manipulateF(
1032 "UPDATE qpl_questions SET obj_fi = %s WHERE question_id = %s",
1033 array(
'integer',
'integer'),
1034 array($this->
getId(), $question_object[
"question_id"])
1036 if (!$affectedRows) {
1041 $source_path = CLIENT_WEB_DIR .
"/assessment/" . $source_questionpool .
"/" . $question_object[
"question_id"] .
"/";
1042 if (@is_dir($source_path)) {
1043 $target_path = CLIENT_WEB_DIR .
"/assessment/" . $this->
getId() .
"/";
1044 if (!@is_dir($target_path)) {
1045 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1048 rename($source_path, $target_path . $question_object[
"question_id"]);
1054 $new_question_id = $this->
copyQuestion($question_object[
"question_id"], $this->
getId());
1055 if (!$new_question_id) {
1076 if (!array_key_exists(
"qpl_clipboard",
$_SESSION)) {
1079 $_SESSION[
"qpl_clipboard"][$question_id] =
array(
"question_id" => $question_id,
"action" =>
"copy");
1090 if (!array_key_exists(
"qpl_clipboard",
$_SESSION)) {
1093 $_SESSION[
"qpl_clipboard"][$question_id] =
array(
"question_id" => $question_id,
"action" =>
"move");
1098 if (!isset(
$_SESSION[
'qpl_clipboard'])) {
1102 if (!isset(
$_SESSION[
'qpl_clipboard'][$deletedQuestionId])) {
1106 unset(
$_SESSION[
'qpl_clipboard'][$deletedQuestionId]);
1108 if (!count(
$_SESSION[
'qpl_clipboard'])) {
1124 include_once
"./Services/Object/classes/class.ilObject.php";
1148 $query_result = $ilDB->query(
"SELECT qpl_questions.*, qpl_qst_type.type_tag FROM qpl_questions, qpl_qst_type WHERE qpl_questions.question_type_fi = qpl_qst_type.question_type_id AND " . $ilDB->in(
'qpl_questions.question_id', $question_ids,
false,
'integer') .
" ORDER BY qpl_questions.title");
1149 if ($query_result->numRows()) {
1150 while (
$row = $ilDB->fetchAssoc($query_result)) {
1170 $query_result = $ilDB->query(
"SELECT qpl_questions.*, qpl_qst_type.type_tag FROM qpl_questions, qpl_qst_type WHERE qpl_questions.question_type_fi = qpl_qst_type.question_type_id AND " . $ilDB->in(
'qpl_questions.question_id', $question_ids,
false,
'integer') .
" ORDER BY qpl_questions.title");
1171 if ($query_result->numRows()) {
1172 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
1173 while (
$row = $ilDB->fetchAssoc($query_result)) {
1184 $duplicate_id = $question->object->duplicate(
true);
1185 if ($duplicate_id > 0) {
1187 $affectedRows = $ilDB->manipulateF(
1188 "UPDATE tst_solutions SET question_fi = %s WHERE question_fi = %s",
1189 array(
'integer',
'integer'),
1190 array($duplicate_id,
$row[
"question_id"])
1194 $affectedRows = $ilDB->manipulateF(
1195 "UPDATE tst_test_rnd_qst SET question_fi = %s WHERE question_fi = %s",
1196 array(
'integer',
'integer'),
1197 array($duplicate_id,
$row[
"question_id"])
1201 $affectedRows = $ilDB->manipulateF(
1202 "UPDATE tst_test_result SET question_fi = %s WHERE question_fi = %s",
1203 array(
'integer',
'integer'),
1204 array($duplicate_id,
$row[
"question_id"])
1208 $affectedRows = $ilDB->manipulateF(
1209 "UPDATE ass_log SET question_fi = %s WHERE question_fi = %s",
1210 array(
'integer',
'integer'),
1211 array($duplicate_id,
$row[
"question_id"])
1235 foreach (
$path as $item) {
1237 array_push($items, $item[
"title"]);
1241 $fullpath = join(
" > ", $items);
1242 include_once
"./Services/Utilities/classes/class.ilStr.php";
1243 if (strlen($fullpath) > 60) {
1255 public static function _getAvailableQuestionpools($use_object_id =
false, $equal_points =
false, $could_be_offline =
false, $showPath =
false, $with_questioncount =
false, $permission =
"read", $usr_id =
"")
1259 $result_array =
array();
1260 $permission = (strlen($permission) == 0) ?
"read" : $permission;
1268 if (count($obj_ids)) {
1269 $in = $ilDB->in(
'object_data.obj_id', $obj_ids,
false,
'integer');
1270 if ($could_be_offline) {
1271 $result = $ilDB->query(
"SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE " .
1272 "qpl_questionpool.obj_fi = object_data.obj_id AND $in ORDER BY object_data.title");
1275 "SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE " .
1276 "qpl_questionpool.obj_fi = object_data.obj_id AND $in AND qpl_questionpool.isonline = %s " .
1277 "ORDER BY object_data.title",
1284 if ($equal_points) {
1290 $ref_id = array_search(
$row[
"obj_fi"], $obj_ids);
1291 $title = (($showPath) ? $titles[$ref_id] :
$row[
"title"]);
1292 if ($with_questioncount) {
1293 $title .=
" [" . $row[
"questioncount"] .
" " . ($row[
"questioncount"] == 1 ? $lng->txt(
"ass_question") : $lng->txt(
"assQuestions")) .
"]";
1296 if ($use_object_id) {
1297 $result_array[$row[
"obj_fi"]] =
array(
1298 'qpl_id' => $row[
'obj_fi'],
1299 'qpl_title' => $row[
'title'],
1301 "count" => $row[
"questioncount"]
1305 'qpl_id' => $row[
'obj_fi'],
1306 'qpl_title' => $row[
'title'],
1308 "count" => $row[
"questioncount"]
1314 return $result_array;
1321 $questions =
array();
1323 "SELECT qpl_questions.question_id FROM qpl_questions WHERE qpl_questions.original_id IS NULL AND qpl_questions.tstamp > 0 AND qpl_questions.obj_fi = %s",
1328 array_push($questions,
$row[
"question_id"]);
1338 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree =
false)
1342 $newObj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
1347 if (!$cp_options->isRootNode($this->getRefId())) {
1353 $newObj->saveToDb();
1357 $questionIdsMap =
array();
1358 foreach ($questions as $question_id) {
1359 $newQuestionId = $newObj->copyQuestion($question_id, $newObj->getId());
1360 $questionIdsMap[$question_id] = $newQuestionId;
1364 include_once
"./Services/MetaData/classes/class.ilMD.php";
1366 $new_md =&$md->cloneMD($newObj->getId(), 0, $newObj->getType());
1369 $newObj->updateMetaData();
1371 require_once
'Modules/TestQuestionPool/classes/class.ilQuestionPoolTaxonomiesDuplicator.php';
1373 $duplicator->setSourceObjId($this->
getId());
1374 $duplicator->setSourceObjType($this->
getType());
1375 $duplicator->setTargetObjId($newObj->getId());
1376 $duplicator->setTargetObjType($newObj->getType());
1377 $duplicator->setQuestionIdMapping($questionIdsMap);
1378 $duplicator->duplicate($duplicator->getAllTaxonomiesForSourceObject());
1380 $duplicatedTaxKeyMap = $duplicator->getDuplicatedTaxonomiesKeysMap();
1381 $newObj->setNavTaxonomyId($duplicatedTaxKeyMap->getMappedTaxonomyId($this->getNavTaxonomyId()));
1382 $newObj->saveToDb();
1389 return self::_getQuestionTypes($all_tags, $fixOrder);
1397 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
1399 $lng->loadLanguageModule(
"assessment");
1400 $result = $ilDB->query(
"SELECT * FROM qpl_qst_type");
1403 if ($all_tags || (!in_array(
$row[
"question_type_id"], $forbidden_types))) {
1406 if (
$row[
"plugin"] == 0) {
1407 $types[$lng->txt(
$row[
"type_tag"])] =
$row;
1409 global $ilPluginAdmin;
1410 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"TestQuestionPool",
"qst");
1411 foreach ($pl_names as $pl_name) {
1413 if (strcmp($pl->getQuestionType(),
$row[
"type_tag"]) == 0) {
1414 $types[$pl->getQuestionTypeTranslation()] =
$row;
1421 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionTypeOrderer.php';
1424 $types = $orderer->getOrderedTypes();
1433 $query =
"SELECT type_tag FROM qpl_qst_type WHERE question_type_id = %s";
1434 $types =
array(
'integer');
1435 $values =
array($type_id);
1439 return $row[
'type_tag'];
1448 global $ilPluginAdmin;
1450 $lng->loadLanguageModule(
"assessment");
1451 $result = $ilDB->query(
"SELECT * FROM qpl_qst_type");
1454 if (
$row[
"plugin"] == 0) {
1455 $types[
$row[
'type_tag']] = $lng->txt($row[
"type_tag"]);
1457 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"TestQuestionPool",
"qst");
1458 foreach ($pl_names as $pl_name) {
1460 if (strcmp($pl->getQuestionType(),
$row[
"type_tag"]) == 0) {
1461 $types[
$row[
'type_tag']] = $pl->getQuestionTypeTranslation();
1489 $allowed_types =
array(
1490 "assSingleChoice" => 1,
1491 "assMultipleChoice" => 2,
1492 "assKprimChoice" => 3,
1493 "assClozeTest" => 4,
1494 "assMatchingQuestion" => 5,
1495 "assOrderingQuestion" => 6,
1496 "assOrderingHorizontal" => 7,
1497 "assImagemapQuestion" => 8,
1498 "assTextSubset" => 9,
1499 "assErrorText" => 10,
1504 foreach ($qtypes as $k =>
$t) {
1506 if (isset($allowed_types[
$t[
"type_tag"]])) {
1507 $t[
"order"] = $allowed_types[$t[
"type_tag"]];
1519 $questions =
array();
1521 "SELECT qpl_questions.*, qpl_qst_type.* FROM qpl_questions, qpl_qst_type WHERE qpl_questions.original_id IS NULL AND qpl_questions.obj_fi = %s AND qpl_questions.tstamp > 0 AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id",
1526 array_push($questions,
$row);
1541 "UPDATE qpl_questionpool SET questioncount = %s, tstamp = %s WHERE obj_fi = %s",
1542 array(
'integer',
'integer',
'integer'),
1556 global $ilPluginAdmin;
1558 $plugins = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"TestQuestionPool",
"qst");
1559 foreach ($plugins as $pluginName) {
1560 if ($pluginName == $questionType) {
1567 if ($plugin->getQuestionType() == $questionType) {
1582 require_once
'Modules/TestQuestionPool/classes/class.ilAssIncompleteQuestionPurger.php';
1584 $incompleteQuestionPurger->setOwnerId($ilUser->getId());
1585 $incompleteQuestionPurger->purge();
1595 require_once
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
1619 if (self::$isSkillManagementGloballyActivated === null) {
1620 include_once
'Services/Skill/classes/class.ilSkillManagementSettings.php';
1623 self::$isSkillManagementGloballyActivated = $skmgSet->isActivated();
1626 return self::$isSkillManagementGloballyActivated;
1631 require_once
'Modules/TestQuestionPool/classes/class.ilObjQuestionPoolXMLParser.php';
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
const ORDER_MODE_FIX
order mode with fixed priority for ordering
static _getAvailableQuestionpools($use_object_id=false, $equal_points=false, $could_be_offline=false, $showPath=false, $with_questioncount=false, $permission="read", $usr_id="")
Returns the available question pools for the active user.
static getPoolQuestionChangeListeners(ilDBInterface $db, $poolObjId)
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)
setTitle($a_title)
set title of glossary object
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
exportXMLPageObjects(&$a_xml_writer, $a_inst, &$expLog, $questions)
export page objects to xml (see ilias_co.dtd)
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
static _isWriteable($object_id, $user_id)
Returns true, if the question pool is writeable by a given user.
populateQuestionSkillAssignmentsXml(ilXmlWriter &$a_xml_writer, $questions)
const ORDER_MODE_ALPHA
order mode that orders by alphanumerical priority
exportFileItems($a_target_dir, &$expLog)
export files of file itmes
moveToClipboard($question_id)
Moves a question to the clipboard.
exportXMLMediaObjects(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
export media objects to xml (see ilias_co.dtd)
static _prepareCloneSelection($a_ref_ids, $new_type, $show_path=true)
Prepare copy wizard object selection.
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
addQuestionChangeListeners(assQuestion $question)
static _isUsedInRandomTest($question_id="")
Checks whether the question is used in a random test or not.
getQuestiontype($question_id)
Returns the question type of a question with a given id.
Skill management settings.
setNavTaxonomyId($navTaxonomyId)
static _lookupOnline($a_obj_id, $is_reference=false)
pasteFromClipboard()
Copies/Moves a question from the clipboard.
Abstract basic class which is to be extended by the concrete assessment question type classes...
objectToXmlWriter(ilXmlWriter &$a_xml_writer, $a_inst, $a_target_dir, &$expLog, $questions)
export pages of test to xml (see ilias_co.dtd)
static getQuestionTypeByTypeId($type_id)
static & _instanciateQuestionGUI($question_id)
Creates an instance of a question gui with a given question id.
static _getObjectsByOperations($a_obj_type, $a_operation, $a_usr_id=0, $limit=0)
Get all objects of a specific type and check access This function is not recursive, instead it parses the serialized rbac_pa entries.
getExportDirectory($type="")
get export directory of questionpool
getDescription()
get description of content object
deleteQuestion($question_id)
Deletes a question from the question pool.
createReference()
Creates a database reference id for the object (saves the object to the database and creates a refere...
createMetaData()
create meta data entry
_getFullPathToQpl($ref_id)
Retrieves the full path to a question pool with a given reference id.
getPrintviewQuestions()
Calculates the data for the print view of the questionpool.
static _getQuestionTypes($all_tags=false, $fixOrder=false)
& getQuestionDetails($question_ids)
Returns an array containing the qpl_question and qpl_qst_type fields for an array of question ids...
copyQuestion($question_id, $questionpool_to)
Copies a question into another question pool.
getImportMapping()
get array of (two) new created questions for import id
static subStr($a_str, $a_start, $a_length=null)
saveToDb()
Saves a ilObjQuestionpool object to a database.
static _getAllReferences($a_id)
get all reference ids of object
xmlEndTag($tag)
Writes an endtag.
setOnline($a_online_status)
Sets the questionpool online status.
exportXMLSettings($xmlWriter)
setSkillServiceEnabled($skillServiceEnabled)
modifyExportIdentifier($a_tag, $a_param, $a_value)
static _hasEqualPoints($a_obj_id, $is_reference=false)
Checks a question pool for questions with the same maximum points.
static & _getSelfAssessmentQuestionTypes($all_tags=false)
Get all self assessment question types.
duplicateQuestion($question_id)
Duplicates a question for a questionpool.
setShowTaxonomies($showTaxonomies)
questionsToXML($questions)
Returns a QTI xml representation of a list of questions.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
static _updateQuestionCount($object_id)
Updates the number of available questions for a question pool in the database.
getId()
get object id public
getQuestionTypes($all_tags=false, $fixOrder=false)
static _lookupObjId($a_id)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
__construct($a_id=0, $a_call_by_reference=true)
Constructor public.
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
static _getForbiddenQuestionTypes()
Returns the forbidden questiontypes for ILIAS.
cleanupClipboard($deletedQuestionId)
static _setImportDirectory($a_import_dir=null)
set import directory
redirection script todo: (a better solution should control the processing via a xml file) ...
update()
update object data
createExportDirectory()
creates data directory for export files (data_dir/qpl_data/qpl_<id>/export, depending on data directo...
& createQuestion($question_type, $question_id=-1)
checkQuestionParent($questionId)
copyToClipboard($question_id)
Copies a question to the clipboard.
read($a_force_db=false)
read object data from db into object
getType()
get object type public
Create styles array
The data for the language used.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
if(php_sapi_name() !='cli') $in
update($pash, $contents, Config $config)
getTitle()
get title of glossary object
isPluginActive($questionType)
Checks wheather or not a question plugin with a given name is active.
& getAllQuestions()
Retrieve an array containing all question ids of the questionpool.
static $isSkillManagementGloballyActivated
static getDataDir()
get data directory (outside webspace)
static _getQuestionCount($questionpool_id, $complete_questions_only=false)
Returns the number of questions in a question pool.
static isSkillManagementGloballyActivated()
getTaxonomyIds()
get ids of all taxonomies corresponding to current pool
loadFromDb()
Loads a ilObjQuestionpool object from a database.
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Creates a 1:1 copy of the object and places the copy in a given repository.
static _getExportDirectory($a_obj_id, $a_type="xml", $a_obj_type="", $a_entity="")
Get export directory for an repository object.
static insertInstIntoID($a_value)
inserts installation id into ILIAS id
deleteMetaData()
delete meta data entry
static getQuestionTypeTranslations()
static _getImportDirectory()
get import directory of lm
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
addQuestionChangeListener(ilQuestionChangeListener $listener)
static _createImportDirectory()
creates data directory for import files (data_dir/qpl_data/qpl_<id>/import, depending on data directo...
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
setDescription($a_description)
set description of content object
create($a_upload=false)
create questionpool object
isInUse($question_id)
Checks whether the question is in use or not.
& getDeleteableQuestionDetails($question_ids)
Returns an array containing the qpl_question and qpl_qst_type fields of deleteable questions for an a...