4include_once 
"./Modules/Test/classes/inc.AssessmentConstants.php";
 
   54                $this->
ilObject($a_id,$a_call_by_reference);
 
   81                $result = parent::createReference();
 
   95                if (!parent::update())
 
  108                include_once 
"./Services/MetaData/classes/class.ilMD.php";
 
  110                $md_gen =& $md->getGeneral();
 
  111                if ($md_gen == 
false)
 
  113                        include_once 
"./Services/MetaData/classes/class.ilMDCreator.php";
 
  115                        $md_creator->setTitle($this->
getTitle());
 
  116                        $md_creator->setTitleLanguage(
$ilUser->getPref(
'language'));
 
  117                        $md_creator->create();
 
  119                parent::updateMetaData();
 
  127        function read($a_force_db = 
false)
 
  129                parent::read($a_force_db);
 
  143                if (!parent::delete())
 
  161                if (count($questions))
 
  163                        foreach ($questions as $question_id)
 
  170                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  172                $directory = $qpl_data_dir.
"/qpl_".$this->
getId();
 
  173                if (is_dir($directory))
 
  175                        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  194        function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
 
  234                if ($a_node_id==
$_GET[
"ref_id"])
 
  236                        $parent_obj =& $this->
ilias->obj_factory->getInstanceByRefId($a_node_id);
 
  237                        $parent_type = $parent_obj->getType();
 
  238                        if($parent_type == $this->
getType())
 
  240                                $a_node_id = (int) $tree->getParentId($a_node_id);
 
  244                parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
 
  255                include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
  256                include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  260                $question->delete($question_id);
 
  285                $result = 
$ilDB->queryF(
"SELECT * FROM qpl_questionpool WHERE obj_fi = %s",
 
  287                        array($this->
getId())
 
  307                $result = 
$ilDB->queryF(
"SELECT id_questionpool FROM qpl_questionpool WHERE obj_fi = %s",
 
  309                        array($this->
getId())
 
  314                        $result = $ilDB->update(
'qpl_questionpool',
 
  316                                        'isonline'                      => array(
'text', $this->
getOnline()),
 
  319                                        'tstamp'                        => array(
'integer', time())
 
  322                                        'obj_fi'                        => array(
'integer', $this->
getId())
 
  328                        $next_id = 
$ilDB->nextId(
'qpl_questionpool');
 
  331                                'id_questionpool'       => array(
'integer', $next_id),
 
  332                                'isonline'                      => array(
'text', $this->
getOnline()),
 
  335                                'tstamp'                        => array(
'integer', time()),
 
  336                                'obj_fi'                        => array(
'integer', $this->
getId())
 
  352                if ($question_id < 1)
 
  357                $result = 
$ilDB->queryF(
"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",
 
  364                        return $data[
"type_tag"];
 
  379                return parent::getDescription();
 
  387                parent::setDescription($a_description);
 
  397                return parent::getTitle();
 
  405                parent::setTitle($a_title);
 
  419                $result = 
$ilDB->queryF(
"SELECT COUNT(solution_id) solution_count FROM tst_solutions WHERE question_fi = %s",
 
  424                return $row[
"solution_count"];
 
  429                include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  432                $question_type_gui = $question_type . 
"GUI";
 
  433                $question_gui =& 
new $question_type_gui();
 
  434                return $question_gui;
 
  446                $newtitle = $question->object->getTitle(); 
 
  447                if ($question->object->questionTitleExists($this->getId(), $question->object->getTitle()))
 
  450                        while ($question->object->questionTitleExists($this->getId(), $question->object->getTitle() . 
" ($counter)"))
 
  454                        $newtitle = $question->object->getTitle() . 
" ($counter)";
 
  456                $new_id = $question->object->duplicate(
false, $newtitle);
 
  472                if ($question_gui->object->getObjId() == $questionpool_to)
 
  480                        $newtitle = $question_gui->object->getTitle(); 
 
  481                        if ($question_gui->object->questionTitleExists($this->getId(), $question_gui->object->getTitle()))
 
  484                                while ($question_gui->object->questionTitleExists($this->getId(), $question_gui->object->getTitle() . 
" ($counter)"))
 
  488                                $newtitle = $question_gui->object->getTitle() . 
" ($counter)";
 
  490                        return $question_gui->object->copyObject($this->
getId(), $newtitle);
 
  503                $query_result = 
$ilDB->queryF(
"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",
 
  505                        array($this->
getId())
 
  509                if ($query_result->numRows())
 
  511                        while (
$row = 
$ilDB->fetchAssoc($query_result))
 
  513                                $row[
'ttype'] = $types[
$row[
'type_tag']];
 
  518                                                array_push($rows, 
$row);
 
  523                                        array_push($rows, 
$row);
 
  536        function exportPagesXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog, $questions)
 
  540                $this->mob_ids = array();
 
  541                $this->file_ids = array();
 
  544                $attrs[
"Type"] = 
"Questionpool_Test";
 
  545                $a_xml_writer->xmlStartTag(
"ContentObject", $attrs);
 
  551                $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Page Objects");
 
  552                $ilBench->start(
"ContentObjectExport", 
"exportPageObjects");
 
  554                $ilBench->stop(
"ContentObjectExport", 
"exportPageObjects");
 
  555                $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Page Objects");
 
  558                $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Media Objects");
 
  559                $ilBench->start(
"ContentObjectExport", 
"exportMediaObjects");
 
  561                $ilBench->stop(
"ContentObjectExport", 
"exportMediaObjects");
 
  562                $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Media Objects");
 
  565                $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export File Items");
 
  566                $ilBench->start(
"ContentObjectExport", 
"exportFileItems");
 
  568                $ilBench->stop(
"ContentObjectExport", 
"exportFileItems");
 
  569                $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export File Items");
 
  571                $a_xml_writer->xmlEndTag(
"ContentObject");
 
  582                include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
 
  584                $md2xml->setExportMode(
true);
 
  585                $md2xml->startExport();
 
  586                $a_xml_writer->appendXML($md2xml->getXML());
 
  591                if ($a_tag == 
"Identifier" && $a_param == 
"Entry")
 
  593                        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  611                include_once 
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
 
  613                foreach ($questions as $question_id)
 
  615                        $ilBench->start(
"ContentObjectExport", 
"exportPageObject");
 
  616                        $expLog->write(date(
"[y-m-d H:i:s] ").
"Page Object ".$question_id);
 
  619                        $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
 
  623                        $ilBench->start(
"ContentObjectExport", 
"exportPageObject_XML");
 
  624                        include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
 
  626                        $page_object->buildDom();
 
  627                        $page_object->insertInstIntoIDs($a_inst);
 
  628                        $mob_ids = $page_object->collectMediaObjects(
false);
 
  629                        require_once 
'Services/COPage/classes/class.ilPCFileList.php';
 
  631                        $xml = $page_object->getXMLFromDom(
false, 
false, 
false, 
"", 
true);
 
  632                        $xml = str_replace(
"&",
"&", $xml);
 
  633                        $a_xml_writer->appendXML($xml);
 
  634                        $page_object->freeDom();
 
  635                        unset ($page_object);
 
  637                        $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_XML");
 
  640                        $ilBench->start(
"ContentObjectExport", 
"exportPageObject_CollectMedia");
 
  642                        foreach($mob_ids as $mob_id)
 
  644                                $this->mob_ids[$mob_id] = $mob_id;
 
  646                        $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_CollectMedia");
 
  649                        $ilBench->start(
"ContentObjectExport", 
"exportPageObject_CollectFileItems");
 
  651                        foreach($file_ids as $file_id)
 
  653                                $this->file_ids[$file_id] = $file_id;
 
  655                        $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_CollectFileItems");
 
  657                        $a_xml_writer->xmlEndTag(
"PageObject");
 
  660                        $ilBench->stop(
"ContentObjectExport", 
"exportPageObject");
 
  674                include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
  676                foreach ($this->mob_ids as $mob_id)
 
  678                        $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
 
  682                                $media_obj->exportXML($a_xml_writer, $a_inst);
 
  683                                $media_obj->exportFiles($a_target_dir);
 
  695                include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
  697                foreach ($this->file_ids as $file_id)
 
  699                        $expLog->write(date(
"[y-m-d H:i:s] ").
"File Item ".$file_id);
 
  700                        $file_obj = 
new ilObjFile($file_id, 
false);
 
  701                        $file_obj->export($a_target_dir);
 
  713                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  716                if(!is_writable($qpl_data_dir))
 
  718                        $this->
ilias->raiseError(
"Questionpool Data Directory (".$qpl_data_dir
 
  719                                .
") not writeable.",$this->
ilias->error_obj->FATAL);
 
  723                $qpl_dir = $qpl_data_dir.
"/qpl_".$this->
getId();
 
  725                if(!@is_dir($qpl_dir))
 
  727                        $this->
ilias->raiseError(
"Creation of Questionpool Directory failed.",$this->
ilias->error_obj->FATAL);
 
  733                        $this->
ilias->raiseError(
"Creation of Export Directory failed.",$this->
ilias->error_obj->FATAL);
 
  738                        $this->
ilias->raiseError(
"Creation of Export Directory failed.",$this->
ilias->error_obj->FATAL);
 
  747                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  752                                $export_dir = 
ilUtil::getDataDir().
"/qpl_data".
"/qpl_".$this->getId().
"/export_$type";
 
  770                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  774                if(!is_writable($qpl_data_dir))
 
  776                        $ilias->raiseError(
"Questionpool Data Directory (".$qpl_data_dir
 
  777                                .
") not writeable.",
$ilias->error_obj->FATAL);
 
  781                $qpl_dir = $qpl_data_dir.
"/qpl_import";
 
  783                if(!@is_dir($qpl_dir))
 
  785                        $ilias->raiseError(
"Creation of Questionpool Directory failed.",
$ilias->error_obj->FATAL);
 
  795                if (strlen($a_import_dir))
 
  797                        $_SESSION[
"qpl_import_dir"] = $a_import_dir;
 
  831                $result = 
$ilDB->queryF(
"SELECT question_id FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.tstamp > 0 AND original_id IS NULL",
 
  833                        array($this->
getId())
 
  835                $questions = array();
 
  838                        array_push($questions, 
$row[
"question_id"]);
 
  847                $query_result = 
$ilDB->queryF(
"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",
 
  848                        array(
'integer',
'text'),
 
  849                        array($this->
getId(), 1)
 
  851                $questions = array();
 
  852                if ($query_result->numRows())
 
  854                        while (
$row = 
$ilDB->fetchAssoc($query_result))
 
  860                                                array_push($questions, 
$row[
"question_id"]);
 
  865                                        array_push($questions, 
$row[
"question_id"]);
 
  878                if (!is_array($this->import_mapping))
 
  884                        return $this->import_mapping;
 
  899                if (count($questions) > 0)
 
  901                        foreach ($questions as $key => $value)
 
  904                                $xml .= $question->object->toXML();
 
  906                        if (count($questions) > 1)
 
  908                                $xml = preg_replace(
"/<\/questestinterop>\s*<.xml.*?>\s*<questestinterop>/", 
"", $xml);
 
  911                $xml = preg_replace(
"/(<\?xml[^>]*?>)/", 
"\\1" . 
"<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">", $xml);
 
  926                if ($complete_questions_only)
 
  928                        $result = 
$ilDB->queryF(
"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",
 
  929                                array(
'integer', 
'text'),
 
  930                                array($questionpool_id, 1)
 
  935                        $result = 
$ilDB->queryF(
"SELECT COUNT(question_id) question_count FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.tstamp > 0 AND original_id IS NULL",
 
  937                                array($questionpool_id)
 
  941                return $row[
"question_count"];
 
  953                switch ($a_online_status)
 
  957                                $this->online = $a_online_status;
 
  967                if (strcmp($this->online, 
"") == 0) $this->online = 
"0";
 
 1002                        $result = 
$ilDB->queryF(
"SELECT qpl_questionpool.isonline FROM qpl_questionpool,object_reference WHERE object_reference.ref_id = %s AND object_reference.obj_id = qpl_questionpool.obj_fi",
 
 1009                        $result = 
$ilDB->queryF(
"SELECT isonline FROM qpl_questionpool WHERE obj_fi = %s",
 
 1017                        return $row[
"isonline"];
 
 1034                        $result = 
$ilDB->queryF(
"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",
 
 1041                        $result = 
$ilDB->queryF(
"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",
 
 1049                        if (
$row[
"equal_points"] == 1)
 
 1071                if (array_key_exists(
"qpl_clipboard", 
$_SESSION))
 
 1074                        foreach (
$_SESSION[
"qpl_clipboard"] as $question_object)
 
 1076                                if (strcmp($question_object[
"action"], 
"move") == 0)
 
 1078                                        $result = 
$ilDB->queryF(
"SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
 
 1080                                                array($question_object[
"question_id"])
 
 1085                                                $source_questionpool = 
$row[
"obj_fi"];
 
 1087                                                $affectedRows = 
$ilDB->manipulateF(
"UPDATE qpl_questions SET obj_fi = %s WHERE question_id = %s",
 
 1088                                                        array(
'integer',
'integer'),
 
 1089                                                        array($this->
getId(), $question_object[
"question_id"])
 
 1097                                                $source_path = CLIENT_WEB_DIR . 
"/assessment/" . $source_questionpool . 
"/" . $question_object[
"question_id"] . 
"/";
 
 1098                                                if (@is_dir($source_path))
 
 1100                                                        $target_path = CLIENT_WEB_DIR . 
"/assessment/" . $this->
getId() . 
"/";
 
 1101                                                        if (!@is_dir($target_path))
 
 1103                                                                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 1106                                                        @rename($source_path, $target_path . $question_object[
"question_id"]);
 
 1114                                        $new_question_id = $this->
copyQuestion($question_object[
"question_id"], $this->
getId());
 
 1115                                        if(!$new_question_id)
 
 1137                if (!array_key_exists(
"qpl_clipboard", 
$_SESSION))
 
 1141                $_SESSION[
"qpl_clipboard"][$question_id] = array(
"question_id" => $question_id, 
"action" => 
"copy");
 
 1152                if (!array_key_exists(
"qpl_clipboard", 
$_SESSION))
 
 1156                $_SESSION[
"qpl_clipboard"][$question_id] = array(
"question_id" => $question_id, 
"action" => 
"move");
 
 1161                if( !isset(
$_SESSION[
'qpl_clipboard']) )
 
 1166                if( !isset(
$_SESSION[
'qpl_clipboard'][$deletedQuestionId]) )
 
 1171                unset(
$_SESSION[
'qpl_clipboard'][$deletedQuestionId]);
 
 1173                if( !count(
$_SESSION[
'qpl_clipboard']) )
 
 1190                include_once 
"./Services/Object/classes/class.ilObject.php";
 
 1217                $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");
 
 1218                if ($query_result->numRows())
 
 1220                        while (
$row = 
$ilDB->fetchAssoc($query_result))
 
 1241                $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");
 
 1242                if ($query_result->numRows())
 
 1244                        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 1245                        while (
$row = 
$ilDB->fetchAssoc($query_result))
 
 1260                                        $duplicate_id = $question->object->duplicate(
true);
 
 1261                                        if ($duplicate_id > 0)
 
 1264                                                $affectedRows = 
$ilDB->manipulateF(
"UPDATE tst_solutions SET question_fi = %s WHERE question_fi = %s",
 
 1265                                                        array(
'integer',
'integer'),
 
 1266                                                        array($duplicate_id, 
$row[
"question_id"])
 
 1270                                                $affectedRows = 
$ilDB->manipulateF(
"UPDATE tst_test_rnd_qst SET question_fi = %s WHERE question_fi = %s",
 
 1271                                                        array(
'integer',
'integer'),
 
 1272                                                        array($duplicate_id, 
$row[
"question_id"])
 
 1276                                                $affectedRows = 
$ilDB->manipulateF(
"UPDATE tst_test_result SET question_fi = %s WHERE question_fi = %s",
 
 1277                                                        array(
'integer',
'integer'),
 
 1278                                                        array($duplicate_id, 
$row[
"question_id"])
 
 1282                                                $affectedRows = 
$ilDB->manipulateF(
"UPDATE ass_log SET question_fi = %s WHERE question_fi = %s",
 
 1283                                                        array(
'integer',
'integer'),
 
 1284                                                        array($duplicate_id, 
$row[
"question_id"])
 
 1308                foreach (
$path as $item)
 
 1310                        if (($counter > 0) && ($counter < count(
$path)-1))
 
 1312                                array_push($items, $item[
"title"]);
 
 1316                $fullpath = join(
" > ", $items);
 
 1317                include_once 
"./Services/Utilities/classes/class.ilStr.php";
 
 1318                if (strlen($fullpath) > 60)
 
 1331        function &
_getAvailableQuestionpools($use_object_id = FALSE, $equal_points = FALSE, $could_be_offline = FALSE, $showPath = FALSE, $with_questioncount = FALSE, $permission = 
"read", $usr_id = 
"")
 
 1335                $result_array = array();
 
 1336                $permission = (strlen($permission) == 0) ? 
"read" : $permission;
 
 1345                if (count($obj_ids))
 
 1347                        $in = 
$ilDB->in(
'object_data.obj_id', $obj_ids, 
false, 
'integer');
 
 1348                        if ($could_be_offline)
 
 1350                                $result = 
$ilDB->query(
"SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE ".
 
 1351                                        "qpl_questionpool.obj_fi = object_data.obj_id AND $in ORDER BY object_data.title");
 
 1355                                $result = 
$ilDB->queryF(
"SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE ".
 
 1356                                        "qpl_questionpool.obj_fi = object_data.obj_id AND $in AND qpl_questionpool.isonline = %s ".
 
 1357                                        "ORDER BY object_data.title",
 
 1376                                        if ($with_questioncount)
 
 1378                                                $title .= 
" [" . 
$row[
"questioncount"] . 
" " . (
$row[
"questioncount"] == 1 ? 
$lng->txt(
"ass_question") : 
$lng->txt(
"assQuestions")) . 
"]";
 
 1383                                                $result_array[
$row[
"obj_fi"]] = array(
 
 1384                                                        'qpl_id' => 
$row[
'obj_fi'],
 
 1385                                                        'qpl_title' => 
$row[
'title'],
 
 1387                                                        "count" => 
$row[
"questioncount"]
 
 1392                                                $result_array[
$ref_id] = array(
 
 1393                                                        'qpl_id' => 
$row[
'obj_fi'],
 
 1394                                                        'qpl_title' => 
$row[
'title'],
 
 1396                                                        "count" => 
$row[
"questioncount"]
 
 1402                return $result_array;
 
 1409                $questions = array();
 
 1410                $result = 
$ilDB->queryF(
"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",
 
 1412                        array($this->
getId())
 
 1416                        array_push($questions, 
$row[
"question_id"]);
 
 1430                $newObj = parent::cloneObject($a_target_id,$a_copy_id);
 
 1435                if(!$cp_options->isRootNode($this->getRefId()))
 
 1441                $newObj->saveToDb();
 
 1445                $questionIdsMap = array();
 
 1446                foreach ($questions as $question_id)
 
 1448                        $newQuestionId = $newObj->copyQuestion($question_id, $newObj->getId());
 
 1449                        $questionIdsMap[$question_id] = $newQuestionId;
 
 1453                include_once 
"./Services/MetaData/classes/class.ilMD.php";
 
 1455                $new_md =& $md->cloneMD($newObj->getId(),0,$newObj->getType());
 
 1458                $newObj->updateMetaData();
 
 1460                require_once 
'Modules/TestQuestionPool/classes/class.ilQuestionPoolTaxonomiesDuplicator.php';
 
 1462                $duplicator->setSourceObjId($this->
getId());
 
 1463                $duplicator->setSourceObjType($this->
getType());
 
 1464                $duplicator->setTargetObjId($newObj->getId());
 
 1465                $duplicator->setTargetObjType($newObj->getType());
 
 1466                $duplicator->setQuestionIdMapping($questionIdsMap);
 
 1467                $duplicator->duplicate();
 
 1469                $duplicatedTaxKeyMap = $duplicator->getDuplicatedTaxonomiesKeysMap();
 
 1470                $newObj->setNavTaxonomyId($duplicatedTaxKeyMap->getMappedTaxonomyId($this->getNavTaxonomyId()));
 
 1471                $newObj->saveToDb();
 
 1486                include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 1488                $lng->loadLanguageModule(
"assessment");
 
 1493                        if ($all_tags || (!in_array(
$row[
"question_type_id"], $forbidden_types)))
 
 1497                                if (
$row[
"plugin"] == 0)
 
 1503                                        global $ilPluginAdmin;
 
 1504                                        $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE, 
"TestQuestionPool", 
"qst");
 
 1505                                        foreach ($pl_names as $pl_name)
 
 1508                                                if (strcmp($pl->getQuestionType(), 
$row[
"type_tag"]) == 0)
 
 1510                                                        $types[$pl->getQuestionTypeTranslation()] = 
$row;
 
 1517                require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionTypeOrderer.php';
 
 1520                $types = $orderer->getOrderedTypes();
 
 1527            $query = 
"SELECT type_tag FROM qpl_qst_type WHERE question_type_id = %s";
 
 1528            $types = array(
'integer');
 
 1529            $values = array($type_id);
 
 1532                return $row[
'type_tag'];
 
 1541                global $ilPluginAdmin;
 
 1543                $lng->loadLanguageModule(
"assessment");
 
 1548                        if (
$row[
"plugin"] == 0)
 
 1550                                $types[
$row[
'type_tag']] = 
$lng->txt(
$row[
"type_tag"]);
 
 1554                                $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE, 
"TestQuestionPool", 
"qst");
 
 1555                                foreach ($pl_names as $pl_name)
 
 1558                                        if (strcmp($pl->getQuestionType(), 
$row[
"type_tag"]) == 0)
 
 1560                                                $types[
$row[
'type_tag']] = $pl->getQuestionTypeTranslation();
 
 1588                $allowed_types = array(
 
 1589                        "assSingleChoice" => 1,
 
 1590                        "assMultipleChoice" => 2,
 
 1591                        "assKprimChoice" => 3,
 
 1592                        "assClozeTest" => 4,
 
 1593                        "assMatchingQuestion" => 5,
 
 1594                        "assOrderingQuestion" => 6,
 
 1595                        "assOrderingHorizontal" => 7,
 
 1596                        "assImagemapQuestion" => 8,
 
 1597                        "assTextSubset" => 9,
 
 1598                        "assErrorText" => 10
 
 1602                foreach($qtypes as $k => 
$t)
 
 1605                        if (isset($allowed_types[
$t[
"type_tag"]]))
 
 1607                                $t[
"order"] = $allowed_types[
$t[
"type_tag"]];
 
 1619                $questions = array();
 
 1620                $result = 
$ilDB->queryF(
"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",
 
 1622                        array($this->
getId())
 
 1626                        array_push($questions, 
$row);
 
 1640                $result = 
$ilDB->manipulateF(
"UPDATE qpl_questionpool SET questioncount = %s, tstamp = %s WHERE obj_fi = %s",
 
 1641                        array(
'integer',
'integer',
'integer'),
 
 1654                global $ilPluginAdmin;
 
 1655                if ($ilPluginAdmin->isActive(
IL_COMP_MODULE, 
"TestQuestionPool", 
"qst", $a_pname))
 
 1672                require_once 
'Modules/TestQuestionPool/classes/class.ilAssIncompleteQuestionPurger.php';
 
 1674                $incompleteQuestionPurger->setOwnerId(
$ilUser->getId());
 
 1675                $incompleteQuestionPurger->purge();
 
 1685                require_once 
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
 
Abstract basic class which is to be extended by the concrete assessment question type classes.
addQuestionChangeListener(ilQuestionChangeListener $listener)
_isUsedInRandomTest($question_id="")
Checks whether the question is used in a random test or not.
static & _instanciateQuestionGUI($question_id)
Creates an instance of a question gui with a given question id.
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
const ORDER_MODE_FIX
order mode with fixed priority for ordering
const ORDER_MODE_ALPHA
order mode that orders by alphanumerical priority
static _getInstance($a_copy_id)
Get instance of copy wizard options.
_getForbiddenQuestionTypes()
Returns the forbidden questiontypes for ILIAS.
_getImportDirectory()
get import directory of lm
ilObjQuestionPool($a_id=0, $a_call_by_reference=true)
Constructor @access public.
exportPagesXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog, $questions)
export pages of test to xml (see ilias_co.dtd)
getExportDirectory($type="")
get export directory of questionpool
getImportMapping()
get array of (two) new created questions for import id
setDescription($a_description)
set description of content object
getTitle()
get title of glossary object
deleteQuestion($question_id)
Deletes a question from the question pool.
getQuestiontype($question_id)
Returns the question type of a question with a given id.
cleanupClipboard($deletedQuestionId)
getDescription()
get description of content object
& getQuestionDetails($question_ids)
Returns an array containing the qpl_question and qpl_qst_type fields for an array of question ids.
addQuestionChangeListeners(assQuestion $question)
& getDeleteableQuestionDetails($question_ids)
Returns an array containing the qpl_question and qpl_qst_type fields of deleteable questions for an a...
isPluginActive($a_pname)
Checks wheather or not a question plugin with a given name is active.
moveToClipboard($question_id)
Moves a question to the clipboard.
& _getQuestionTypes($all_tags=FALSE, $fixOrder=false)
_lookupOnline($a_obj_id, $is_reference=FALSE)
getTaxonomyIds()
get ids of all taxonomies corresponding to current pool
setOnline($a_online_status)
Sets the questionpool online status.
modifyExportIdentifier($a_tag, $a_param, $a_value)
& _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.
getPrintviewQuestions()
Calculates the data for the print view of the questionpool.
setTitle($a_title)
set title of glossary object
setShowTaxonomies($showTaxonomies)
read($a_force_db=false)
read object data from db into object
static & _getSelfAssessmentQuestionTypes($all_tags=FALSE)
Get all self assessment question types.
static _createImportDirectory()
creates data directory for import files (data_dir/qpl_data/qpl_<id>/import, depending on data directo...
createReference()
Creates a database reference id for the object (saves the object to the database and creates a refere...
loadFromDb()
Loads a ilObjQuestionpool object from a database.
& getQuestionTypes($all_tags=FALSE, $fixOrder=false)
_getFullPathToQpl($ref_id)
Retrieves the full path to a question pool with a given reference id.
copyQuestion($question_id, $questionpool_to)
Copies a question into another question pool.
create($a_upload=false)
create questionpool object
exportXMLMediaObjects(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
export media objects to xml (see ilias_co.dtd)
_hasEqualPoints($a_obj_id, $is_reference=FALSE)
Checks a question pool for questions with the same maximum points.
createExportDirectory()
creates data directory for export files (data_dir/qpl_data/qpl_<id>/export, depending on data directo...
setNavTaxonomyId($navTaxonomyId)
duplicateQuestion($question_id)
Duplicates a question for a questionpool.
exportXMLPageObjects(&$a_xml_writer, $a_inst, &$expLog, $questions)
export page objects to xml (see ilias_co.dtd)
_setImportDirectory($a_import_dir=null)
set import directory
static getQuestionTypeByTypeId($type_id)
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)
static getQuestionTypeTranslations()
isInUse($question_id)
Checks whether the question is in use or not.
cloneObject($a_target_id, $a_copy_id=0)
Creates a 1:1 copy of the object and places the copy in a given repository.
update()
update object data
saveToDb()
Saves a ilObjQuestionpool object to a database.
copyToClipboard($question_id)
Copies a question to the clipboard.
_isWriteable($object_id, $user_id)
Returns true, if the question pool is writeable by a given user.
notify($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
notifys an object about an event occured Based on the event happend, each object may decide how it re...
static _updateQuestionCount($object_id)
Updates the number of available questions for a question pool in the database.
toXML($questions)
Returns a QTI xml representation of a list of questions.
_getQuestionCount($questionpool_id, $complete_questions_only=FALSE)
Returns the number of questions in a question pool.
& createQuestion($question_type, $question_id=-1)
exportFileItems($a_target_dir, &$expLog)
export files of file itmes
pasteFromClipboard()
Copies/Moves a question from the clipboard.
& getAllQuestions()
Retrieve an array containing all question ids of the questionpool.
updateMetaData()
update meta data entry
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
static getPoolQuestionChangeListeners(ilDB $db, $poolObjId)
Class ilObject Basic functions for all objects.
getType()
get object type @access public
static _lookupObjId($a_id)
ilObject($a_id=0, $a_reference=true)
Constructor @access public.
deleteMetaData()
delete meta data entry
_hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
createMetaData()
create meta data entry
static _getAllReferences($a_id)
get all reference ids of object
getId()
get object id @access public
static _prepareCloneSelection($a_ref_ids, $new_type, $show_path=true)
Prepare copy wizard object selection.
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
static subStr($a_str, $a_start, $a_length=NULL)
static getDataDir()
get data directory (outside webspace)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static insertInstIntoID($a_value)
inserts installation id into ILIAS 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,...
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
redirection script todo: (a better solution should control the processing via a xml file)