24 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
54 $this->
ilObject($a_id,$a_call_by_reference);
97 if (!parent::update())
110 include_once
"./Services/MetaData/classes/class.ilMD.php";
112 $md_gen =& $md->getGeneral();
113 if ($md_gen ==
false)
115 include_once
"./Services/MetaData/classes/class.ilMDCreator.php";
117 $md_creator->setTitle($this->
getTitle());
118 $md_creator->setTitleLanguage($ilUser->getPref(
'language'));
119 $md_creator->create();
129 function read($a_force_db =
false)
161 if (!parent::delete())
179 if (count($questions))
181 foreach ($questions as $question_id)
188 include_once
"./Services/Utilities/classes/class.ilUtil.php";
190 $directory = $qpl_data_dir.
"/qpl_".$this->
getId();
191 if (is_dir($directory))
193 include_once
"./Services/Utilities/classes/class.ilUtil.php";
221 return $roles ? $roles : array();
237 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
277 if ($a_node_id==
$_GET[
"ref_id"])
279 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
280 $parent_type = $parent_obj->getType();
281 if($parent_type == $this->
getType())
283 $a_node_id = (int) $tree->getParentId($a_node_id);
287 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
300 include_once
"./Modules/Test/classes/class.ilObjTest.php";
303 $question->delete($question_id);
317 $query = sprintf(
"SELECT * FROM qpl_questionpool WHERE obj_fi = %s",
318 $ilDB->quote($this->getId() .
"")
320 $result = $ilDB->query($query);
323 $row =
$result->fetchRow(MDB2_FETCHMODE_ASSOC);
339 $query = sprintf(
"SELECT * FROM qpl_questionpool WHERE obj_fi = %s",
340 $ilDB->quote($this->getId() .
"")
342 $result = $ilDB->query($query);
345 $query = sprintf(
"UPDATE qpl_questionpool SET online = %s WHERE obj_fi = %s",
346 $ilDB->quote($this->getOnline() .
""),
347 $ilDB->quote($this->getId() .
"")
349 $result = $ilDB->query($query);
353 $ilias->raiseError(
$result->getMessage());
358 $query = sprintf(
"INSERT INTO qpl_questionpool (online, obj_fi) VALUES (%s, %s)",
359 $ilDB->quote($this->getOnline() .
""),
360 $ilDB->quote($this->getId() .
"")
362 $result = $ilDB->query($query);
366 $ilias->raiseError(
$result->getMessage());
384 if ($question_id < 1)
389 $query = sprintf(
"SELECT qpl_question_type.type_tag FROM qpl_questions, qpl_question_type WHERE qpl_questions.question_type_fi = qpl_question_type.question_type_id AND qpl_questions.question_id = %s",
390 $ilDB->quote($question_id));
392 $result = $ilDB->query($query);
393 if ($result->numRows() == 1)
395 $data = $result->fetchRow(MDB2_FETCHMODE_OBJECT);
396 return $data->type_tag;
453 $query = sprintf(
"SELECT COUNT(solution_id) AS solution_count FROM tst_solutions WHERE question_fi = %s",
454 $ilDB->quote(
"$question_id"));
456 $result = $ilDB->query($query);
457 $row = $result->fetchRow(MDB2_FETCHMODE_OBJECT);
459 return $row->solution_count;
464 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
467 $question_type_gui = $question_type .
"GUI";
468 $question_gui =&
new $question_type_gui();
469 return $question_gui;
483 $newtitle = $question->object->getTitle();
484 if ($question->object->questionTitleExists($this->getId(), $question->object->getTitle()))
487 while ($question->object->questionTitleExists($this->getId(), $question->object->getTitle() .
" ($counter)"))
491 $newtitle = $question->object->getTitle() .
" ($counter)";
493 $question->object->duplicate(
false, $newtitle);
510 if ($question_gui->object->getObjId() == $questionpool_to)
518 $newtitle = $question_gui->object->getTitle();
519 if ($question_gui->object->questionTitleExists($this->getId(), $question_gui->object->getTitle()))
522 while ($question_gui->object->questionTitleExists($this->getId(), $question_gui->object->getTitle() .
" ($counter)"))
526 $newtitle = $question_gui->object->getTitle() .
" ($counter)";
528 $question_gui->object->copyObject($this->
getId(), $newtitle);
545 if (strlen($filter_text) > 0)
547 switch($sel_filter_type)
550 $where =
" AND qpl_questions.title LIKE " . $ilDB->quote(
"%" . $filter_text .
"%");
553 $where =
" AND qpl_questions.comment LIKE " . $ilDB->quote(
"%" . $filter_text .
"%");
556 $where =
" AND qpl_questions.author LIKE " . $ilDB->quote(
"%" . $filter_text .
"%");
564 include_once
"./Services/Utilities/classes/class.ilUtil.php";
568 $order =
" ORDER BY title $sortorder";
569 $images[
"title"] =
" <img src=\"" .
ilUtil::getImagePath(strtolower($sortorder) .
"_order.gif") .
"\" alt=\"" . $this->lng->txt(strtolower($sortorder) .
"ending_order").
"\" />";
572 $order =
" ORDER BY comment $sortorder";
573 $images[
"comment"] =
" <img src=\"" .
ilUtil::getImagePath(strtolower($sortorder) .
"_order.gif") .
"\" alt=\"" . $this->lng->txt(strtolower($sortorder) .
"ending_order").
"\" />";
576 $order =
" ORDER BY question_type_id $sortorder";
577 $images[
"type"] =
" <img src=\"" .
ilUtil::getImagePath(strtolower($sortorder) .
"_order.gif") .
"\" alt=\"" . $this->lng->txt(strtolower($sortorder) .
"ending_order").
"\" />";
580 $order =
" ORDER BY author $sortorder";
581 $images[
"author"] =
" <img src=\"" .
ilUtil::getImagePath(strtolower($sortorder) .
"_order.gif") .
"\" alt=\"" . $this->lng->txt(strtolower($sortorder) .
"ending_order").
"\" />";
584 $order =
" ORDER BY created $sortorder";
585 $images[
"created"] =
" <img src=\"" .
ilUtil::getImagePath(strtolower($sortorder) .
"_order.gif") .
"\" alt=\"" . $this->lng->txt(strtolower($sortorder) .
"ending_order").
"\" />";
588 $order =
" ORDER BY timestamp14 $sortorder";
589 $images[
"updated"] =
" <img src=\"" .
ilUtil::getImagePath(strtolower($sortorder) .
"_order.gif") .
"\" alt=\"" . $this->lng->txt(strtolower($sortorder) .
"ending_order").
"\" />";
592 $maxentries = $ilUser->prefs[
"hits_per_page"];
597 $query =
"SELECT qpl_questions.question_id, qpl_questions.TIMESTAMP + 0 AS timestamp14 FROM qpl_questions, qpl_question_type WHERE ISNULL(qpl_questions.original_id) AND qpl_questions.question_type_fi = qpl_question_type.question_type_id AND qpl_questions.obj_fi = " . $this->
getId() .
" $where$order$limit";
598 $query_result = $ilDB->query($query);
599 $max = $query_result->numRows();
600 if ($startrow > $max -1)
602 $startrow = $max - ($max % $maxentries);
604 else if ($startrow < 0)
608 $limit =
" LIMIT $startrow, $maxentries";
609 $query =
"SELECT qpl_questions.*, qpl_questions.TIMESTAMP + 0 AS timestamp14, qpl_question_type.type_tag, qpl_question_type.plugin FROM qpl_questions, qpl_question_type WHERE ISNULL(qpl_questions.original_id) AND qpl_questions.question_type_fi = qpl_question_type.question_type_id AND qpl_questions.obj_fi = " . $this->
getId() .
" $where$order$limit";
610 $query_result = $ilDB->query($query);
612 if ($query_result->numRows())
614 while ($row = $query_result->fetchRow(MDB2_FETCHMODE_ASSOC))
620 array_push($rows, $row);
625 array_push($rows, $row);
629 $nextrow = $startrow + $maxentries;
630 if ($nextrow > $max - 1)
632 $nextrow = $startrow;
634 $prevrow = $startrow - $maxentries;
642 "startrow" => $startrow,
643 "nextrow" => $nextrow,
644 "prevrow" => $prevrow,
645 "step" => $maxentries,
666 $order =
" ORDER BY title";
669 $order =
" ORDER BY comment,title";
672 $order =
" ORDER BY question_type_id,title";
675 $order =
" ORDER BY author,title";
678 $order =
" ORDER BY created,title";
681 $order =
" ORDER BY timestamp14,title";
684 $query =
"SELECT qpl_questions.*, qpl_questions.TIMESTAMP + 0 AS timestamp14, qpl_question_type.type_tag, qpl_question_type.plugin FROM qpl_questions, qpl_question_type WHERE ISNULL(qpl_questions.original_id) AND qpl_questions.question_type_fi = qpl_question_type.question_type_id AND qpl_questions.obj_fi = " . $this->
getId() .
" $order";
685 $query_result = $ilDB->query($query);
687 if ($query_result->numRows())
689 while ($row = $query_result->fetchRow(MDB2_FETCHMODE_ASSOC))
695 array_push($rows, $row);
700 array_push($rows, $row);
713 function exportPagesXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog, $questions)
717 $this->mob_ids = array();
718 $this->file_ids = array();
721 $attrs[
"Type"] =
"Questionpool_Test";
722 $a_xml_writer->xmlStartTag(
"ContentObject", $attrs);
728 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Page Objects");
729 $ilBench->start(
"ContentObjectExport",
"exportPageObjects");
731 $ilBench->stop(
"ContentObjectExport",
"exportPageObjects");
732 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Page Objects");
735 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Media Objects");
736 $ilBench->start(
"ContentObjectExport",
"exportMediaObjects");
738 $ilBench->stop(
"ContentObjectExport",
"exportMediaObjects");
739 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Media Objects");
742 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export File Items");
743 $ilBench->start(
"ContentObjectExport",
"exportFileItems");
745 $ilBench->stop(
"ContentObjectExport",
"exportFileItems");
746 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export File Items");
748 $a_xml_writer->xmlEndTag(
"ContentObject");
759 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
761 $md2xml->setExportMode(
true);
762 $md2xml->startExport();
763 $a_xml_writer->appendXML($md2xml->getXML());
768 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
770 include_once
"./Services/Utilities/classes/class.ilUtil.php";
788 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
790 foreach ($questions as $question_id)
792 $ilBench->start(
"ContentObjectExport",
"exportPageObject");
793 $expLog->write(date(
"[y-m-d H:i:s] ").
"Page Object ".$question_id);
796 $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
800 $ilBench->start(
"ContentObjectExport",
"exportPageObject_XML");
802 $page_object->buildDom();
803 $page_object->insertInstIntoIDs($a_inst);
804 $mob_ids = $page_object->collectMediaObjects(
false);
805 $file_ids = $page_object->collectFileItems();
806 $xml = $page_object->getXMLFromDom(
false,
false,
false,
"",
true);
807 $xml = str_replace(
"&",
"&", $xml);
808 $a_xml_writer->appendXML($xml);
809 $page_object->freeDom();
810 unset ($page_object);
812 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_XML");
815 $ilBench->start(
"ContentObjectExport",
"exportPageObject_CollectMedia");
817 foreach($mob_ids as $mob_id)
819 $this->mob_ids[$mob_id] = $mob_id;
821 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_CollectMedia");
824 $ilBench->start(
"ContentObjectExport",
"exportPageObject_CollectFileItems");
826 foreach($file_ids as $file_id)
828 $this->file_ids[$file_id] = $file_id;
830 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_CollectFileItems");
832 $a_xml_writer->xmlEndTag(
"PageObject");
835 $ilBench->stop(
"ContentObjectExport",
"exportPageObject");
849 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
851 foreach ($this->mob_ids as $mob_id)
853 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
857 $media_obj->exportXML($a_xml_writer, $a_inst);
858 $media_obj->exportFiles($a_target_dir);
870 include_once(
"./Modules/File/classes/class.ilObjFile.php");
872 foreach ($this->file_ids as $file_id)
874 $expLog->write(date(
"[y-m-d H:i:s] ").
"File Item ".$file_id);
875 $file_obj =
new ilObjFile($file_id,
false);
876 $file_obj->export($a_target_dir);
888 include_once
"./Services/Utilities/classes/class.ilUtil.php";
891 if(!is_writable($qpl_data_dir))
893 $this->ilias->raiseError(
"Questionpool Data Directory (".$qpl_data_dir
894 .
") not writeable.",$this->ilias->error_obj->FATAL);
898 $qpl_dir = $qpl_data_dir.
"/qpl_".$this->
getId();
900 if(!@is_dir($qpl_dir))
902 $this->ilias->raiseError(
"Creation of Questionpool Directory failed.",$this->ilias->error_obj->FATAL);
905 $export_dir = $qpl_dir.
"/export";
907 if(!@is_dir($export_dir))
909 $this->ilias->raiseError(
"Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
918 include_once
"./Services/Utilities/classes/class.ilUtil.php";
929 if (!@is_dir(
$dir) or
941 while ($entry =
$dir->read())
943 if ($entry !=
"." and
945 (substr($entry, -4) ==
".zip" or substr($entry, -4) ==
".xls") and
946 ereg(
"^[0-9]{10}_{2}[0-9]+_{2}(qpl__)*[0-9]+\.(zip|xls)\$", $entry))
970 include_once
"./Services/Utilities/classes/class.ilUtil.php";
974 if(!is_writable($qpl_data_dir))
976 $ilias->raiseError(
"Questionpool Data Directory (".$qpl_data_dir
977 .
") not writeable.",$ilias->error_obj->FATAL);
981 $qpl_dir = $qpl_data_dir.
"/qpl_import";
983 if(!@is_dir($qpl_dir))
985 $ilias->raiseError(
"Creation of Questionpool Directory failed.",$ilias->error_obj->FATAL);
994 include_once
"./Services/Utilities/classes/class.ilUtil.php";
996 if(@is_dir($import_dir))
1011 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1013 if(@is_dir($import_dir))
1034 $query = sprintf(
"SELECT question_id FROM qpl_questions WHERE obj_fi = %s AND original_id IS NULL",
1035 $ilDB->quote($this->getId())
1038 $result = $ilDB->query($query);
1039 $questions = array();
1041 while ($row =
$result->fetchRow(MDB2_FETCHMODE_ASSOC))
1043 array_push($questions, $row[
"question_id"]);
1052 $query = sprintf(
"SELECT question_id, qpl_question_type.type_tag, qpl_question_type.plugin FROM qpl_questions, qpl_question_type WHERE ISNULL(original_id) AND obj_fi = %s AND complete = %s AND qpl_questions.question_type_fi = qpl_question_type.question_type_id",
1053 $ilDB->quote($this->getId()),
1056 $query_result = $ilDB->query($query);
1057 $questions = array();
1058 if ($query_result->numRows())
1060 while ($row = $query_result->fetchRow(MDB2_FETCHMODE_ASSOC))
1066 array_push($questions, $row[
"question_id"]);
1071 array_push($questions, $row[
"question_id"]);
1084 if (!is_array($this->import_mapping))
1090 return $this->import_mapping;
1107 if (count($questions) > 0)
1109 foreach ($questions as $key => $value)
1112 $xml .= $question->object->toXML();
1114 if (count($questions) > 1)
1116 $xml = preg_replace(
"/<\/questestinterop>\s*<.xml.*?>\s*<questestinterop>/",
"", $xml);
1119 $xml = preg_replace(
"/(<\?xml[^>]*?>)/",
"\\1" .
"<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">", $xml);
1136 $query = sprintf(
"SELECT COUNT(question_id) AS question_count FROM qpl_questions WHERE obj_fi = %s AND ISNULL(original_id)",
1137 $ilDB->quote($questionpool_id .
"")
1139 if ($complete_questions_only)
1141 $query .=
" AND complete = '1'";
1143 $result = $ilDB->query($query);
1144 $row =
$result->fetchRow(MDB2_FETCHMODE_ASSOC);
1145 return $row[
"question_count"];
1159 switch ($a_online_status)
1163 $this->online = $a_online_status;
1173 if (strcmp($this->online,
"") == 0) $this->online =
"0";
1183 $query = sprintf(
"SELECT qpl_questionpool.online FROM qpl_questionpool,object_reference WHERE object_reference.ref_id = %s AND object_reference.obj_id = qpl_questionpool.obj_fi",
1184 $ilDB->quote($a_obj_id .
"")
1189 $query = sprintf(
"SELECT online FROM qpl_questionpool WHERE obj_fi = %s",
1190 $ilDB->quote($a_obj_id .
"")
1193 $result = $ilDB->query($query);
1196 $row =
$result->fetchRow(MDB2_FETCHMODE_ASSOC);
1197 return $row[
"online"];
1216 $query = sprintf(
"SELECT count(DISTINCT qpl_questions.points) AS equal_points FROM qpl_questions, object_reference WHERE object_reference.ref_id = %s AND object_reference.obj_id = qpl_questions.obj_fi AND qpl_questions.original_id IS NULL",
1217 $ilDB->quote($a_obj_id .
"")
1222 $query = sprintf(
"SELECT count(DISTINCT points) AS equal_points FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.original_id IS NULL",
1223 $ilDB->quote($a_obj_id .
"")
1226 $result = $ilDB->query($query);
1229 $row =
$result->fetchRow(MDB2_FETCHMODE_ASSOC);
1230 if ($row[
"equal_points"] == 1)
1253 if (array_key_exists(
"qpl_clipboard",
$_SESSION))
1255 foreach (
$_SESSION[
"qpl_clipboard"] as $question_object)
1257 if (strcmp($question_object[
"action"],
"move") == 0)
1259 $query = sprintf(
"SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
1260 $ilDB->quote($question_object[
"question_id"])
1262 $result = $ilDB->query($query);
1263 if ($result->numRows() == 1)
1265 $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
1266 $source_questionpool = $row[
"obj_fi"];
1268 $query = sprintf(
"UPDATE qpl_questions SET obj_fi = %s WHERE question_id = %s",
1269 $ilDB->quote($this->getId() .
""),
1270 $ilDB->quote($question_object[
"question_id"])
1272 $ilDB->query($query);
1275 $source_path = CLIENT_WEB_DIR .
"/assessment/" . $source_questionpool .
"/" . $question_object[
"question_id"] .
"/";
1276 if (@is_dir($source_path))
1278 $target_path = CLIENT_WEB_DIR .
"/assessment/" . $this->
getId() .
"/";
1279 if (!@is_dir($target_path))
1281 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1284 @rename($source_path, $target_path . $question_object[
"question_id"]);
1311 if (!array_key_exists(
"qpl_clipboard",
$_SESSION))
1315 $_SESSION[
"qpl_clipboard"][$question_id] = array(
"question_id" => $question_id,
"action" =>
"copy");
1328 if (!array_key_exists(
"qpl_clipboard",
$_SESSION))
1332 $_SESSION[
"qpl_clipboard"][$question_id] = array(
"question_id" => $question_id,
"action" =>
"move");
1349 $result_array = array();
1350 $query = sprintf(
"SELECT object_data.*, object_data.obj_id, object_reference.ref_id FROM object_data, object_reference WHERE object_data.obj_id = object_reference.obj_id AND object_data.obj_id = %s",
1351 $ilDB->quote($object_id .
"")
1353 $result = $ilDB->query($query);
1354 while ($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC))
1356 include_once
"./classes/class.ilObject.php";
1379 $whereclause = join($question_ids,
" OR qpl_questions.question_id = ");
1380 $whereclause =
" AND (qpl_questions.question_id = " . $whereclause .
")";
1381 $query =
"SELECT qpl_questions.*, qpl_question_type.type_tag FROM qpl_questions, qpl_question_type WHERE qpl_questions.question_type_fi = qpl_question_type.question_type_id$whereclause ORDER BY qpl_questions.title";
1382 $query_result = $ilDB->query($query);
1383 if ($query_result->numRows())
1385 while ($row = $query_result->fetchRow(MDB2_FETCHMODE_ASSOC))
1409 $whereclause = join($question_ids,
" OR qpl_questions.question_id = ");
1410 $whereclause =
" AND (qpl_questions.question_id = " . $whereclause .
")";
1411 $query =
"SELECT qpl_questions.*, qpl_question_type.type_tag FROM qpl_questions, qpl_question_type WHERE qpl_questions.question_type_fi = qpl_question_type.question_type_id$whereclause ORDER BY qpl_questions.title";
1412 $query_result = $ilDB->query($query);
1413 if ($query_result->numRows())
1415 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
1416 while ($row = $query_result->fetchRow(MDB2_FETCHMODE_ASSOC))
1431 $duplicate_id = $question->object->duplicate(
true);
1432 if ($duplicate_id > 0)
1435 $query = sprintf(
"UPDATE tst_solutions SET question_fi = %s WHERE question_fi = %s",
1436 $ilDB->quote($duplicate_id),
1437 $ilDB->quote($row[
"question_id"])
1439 $ilDB->query($query);
1442 $query = sprintf(
"UPDATE tst_test_random_question SET question_fi = %s WHERE question_fi = %s",
1443 $ilDB->quote($duplicate_id),
1444 $ilDB->quote($row[
"question_id"])
1446 $ilDB->query($query);
1449 $query = sprintf(
"UPDATE tst_test_result SET question_fi = %s WHERE question_fi = %s",
1450 $ilDB->quote($duplicate_id),
1451 $ilDB->quote($row[
"question_id"])
1453 $ilDB->query($query);
1456 $query = sprintf(
"UPDATE ass_log SET question_fi = %s WHERE question_fi = %s",
1457 $ilDB->quote($duplicate_id),
1458 $ilDB->quote($row[
"question_id"])
1460 $ilDB->query($query);
1487 $whereclause = join($question_ids,
" OR qpl_questions.question_id = ");
1488 $whereclause =
" AND (qpl_questions.question_id = " . $whereclause .
")";
1489 $query =
"SELECT qpl_questions.*, qpl_question_type.type_tag FROM qpl_questions, qpl_question_type WHERE qpl_questions.question_type_fi = qpl_question_type.question_type_id$whereclause ORDER BY qpl_questions.title";
1490 $query_result = $ilDB->query($query);
1491 if ($query_result->numRows())
1493 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
1494 while ($row = $query_result->fetchRow(MDB2_FETCHMODE_ASSOC))
1517 $path = $tree->getPathFull(
$ref_id);
1520 foreach ($path as $item)
1522 if (($counter > 0) && ($counter < count($path)-1))
1524 array_push($items, $item[
"title"]);
1528 $fullpath = join(
" > ", $items);
1529 include_once
"./Services/Utilities/classes/class.ilStr.php";
1530 if (strlen($fullpath) > 60)
1545 function &
_getAvailableQuestionpools($use_object_id = FALSE, $equal_points = FALSE, $could_be_offline = FALSE, $showPath = FALSE, $with_questioncount = FALSE, $permission =
"read")
1550 $result_array = array();
1551 $permission = (strlen($permission) == 0) ?
"read" : $permission;
1557 if ($could_be_offline)
1559 $query = sprintf(
"SELECT object_data.*, object_reference.ref_id, qpl_questionpool.questioncount FROM object_data, object_reference, qpl_questionpool WHERE object_data.obj_id = object_reference.obj_id AND object_reference.ref_id IN ('%s') AND qpl_questionpool.obj_fi = object_data.obj_id ORDER BY object_data.title",
1560 implode(
"','", $qpls)
1565 $query = sprintf(
"SELECT object_data.*, object_reference.ref_id, qpl_questionpool.questioncount FROM object_data, object_reference, qpl_questionpool WHERE object_data.obj_id = object_reference.obj_id AND object_reference.ref_id IN ('%s') AND qpl_questionpool.online = '1' AND qpl_questionpool.obj_fi = object_data.obj_id ORDER BY object_data.title",
1566 implode(
"','", $qpls)
1569 $result = $ilDB->query($query);
1570 while ($row =
$result->fetchRow(MDB2_FETCHMODE_ASSOC))
1582 $title = (($showPath) ? $titles[$row[
"ref_id"]] : $row[
"title"]);
1583 if ($with_questioncount)
1585 $title .=
" [" . $row[
"questioncount"] .
" " . ($row[
"questioncount"] == 1 ? $this->lng->txt(
"ass_question") : $this->lng->txt(
"assQuestions")) .
"]";
1590 $result_array[$row[
"obj_id"]] = array(
"title" =>
$title,
"count" => $row[
"questioncount"]);
1594 $result_array[$row[
"ref_id"]] = array(
"title" =>
$title,
"count" => $row[
"questioncount"]);
1599 return $result_array;
1606 $questions = array();
1607 $query = sprintf(
"SELECT qpl_questions.question_id FROM qpl_questions WHERE ISNULL(qpl_questions.original_id) AND qpl_questions.obj_fi = %s",
1608 $ilDB->quote($this->getId() .
"")
1610 $result = $ilDB->query($query);
1611 while ($row =
$result->fetchRow(MDB2_FETCHMODE_ASSOC))
1613 array_push($questions, $row[
"question_id"]);
1629 $newObj->saveToDb();
1632 foreach ($questions as $question_id)
1634 $newObj->copyQuestion($question_id, $newObj->getId());
1638 include_once
"./Services/MetaData/classes/class.ilMD.php";
1640 $new_md =& $md->cloneMD($newObj->getId(),0,$newObj->getType());
1643 $newObj->updateMetaData();
1657 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
1659 $lng->loadLanguageModule(
"assessment");
1660 $query =
"SELECT * FROM qpl_question_type";
1661 $result = $ilDB->query($query);
1663 while ($row =
$result->fetchRow(MDB2_FETCHMODE_ASSOC))
1665 if ($all_tags || (!in_array($row[
"question_type_id"], $forbidden_types)))
1669 if ($row[
"plugin"] == 0)
1671 if (strcmp($row[
"type_tag"],
"assFlashQuestion") != 0)
1673 $types[$lng->txt($row[
"type_tag"])] = $row;
1678 global $ilPluginAdmin;
1679 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"TestQuestionPool",
"qst");
1680 foreach ($pl_names as $pl_name)
1683 if (strcmp($pl->getQuestionType(), $row[
"type_tag"]) == 0)
1685 $types[$pl->getQuestionTypeTranslation()] = $row;
1699 $questions = array();
1700 $query = sprintf(
"SELECT qpl_questions.*, qpl_questions.TIMESTAMP+0 AS timestamp14, qpl_question_type.* FROM qpl_questions, qpl_question_type WHERE ISNULL(qpl_questions.original_id) AND qpl_questions.obj_fi = %s AND qpl_questions.question_type_fi = qpl_question_type.question_type_id",
1701 $ilDB->quote($this->getId() .
"")
1703 $result = $ilDB->query($query);
1704 while ($row =
$result->fetchRow(MDB2_FETCHMODE_ASSOC))
1706 array_push($questions, $row);
1722 $query = sprintf(
"UPDATE qpl_questionpool SET questioncount = %s WHERE obj_fi = %s",
1724 $ilDB->quote($object_id)
1726 $result = $ilDB->query($query);
1737 global $ilPluginAdmin;
1738 if ($ilPluginAdmin->isActive(
IL_COMP_MODULE,
"TestQuestionPool",
"qst", $a_pname))