4include_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();
 
  114        include_once 
"./Services/MetaData/classes/class.ilMD.php";
 
  116        $md_gen = &$md->getGeneral();
 
  117        if ($md_gen == 
false) {
 
  118            include_once 
"./Services/MetaData/classes/class.ilMDCreator.php";
 
  120            $md_creator->setTitle($this->
getTitle());
 
  121            $md_creator->setTitleLanguage(
$ilUser->getPref(
'language'));
 
  122            $md_creator->create();
 
  124        parent::updateMetaData();
 
  132    public function read($a_force_db = 
false)
 
  134        parent::read($a_force_db);
 
  145    public function delete()
 
  148        if (!parent::delete()) {
 
  158        require_once 
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImportFails.php';
 
  160        $qsaImportFails->deleteRegisteredImportFails();
 
  169        if (count($questions)) {
 
  170            foreach ($questions as $question_id) {
 
  176        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  178        $directory = $qpl_data_dir . 
"/qpl_" . $this->
getId();
 
  179        if (is_dir($directory)) {
 
  180            include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  193        include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
  194        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  198        $question->delete($question_id);
 
  225            "SELECT * FROM qpl_questionpool WHERE obj_fi = %s",
 
  227            array($this->
getId())
 
  249            "SELECT id_questionpool FROM qpl_questionpool WHERE obj_fi = %s",
 
  251            array($this->
getId())
 
  258                    'isonline' => array(
'text', $this->
getOnline()),
 
  262                    'tstamp' => array(
'integer', time())
 
  265                    'obj_fi' => array(
'integer', $this->
getId())
 
  269            $next_id = 
$ilDB->nextId(
'qpl_questionpool');
 
  272                'id_questionpool' => array(
'integer', $next_id),
 
  273                'isonline' => array(
'text', $this->
getOnline()),
 
  277                'tstamp' => array(
'integer', time()),
 
  278                'obj_fi' => array(
'integer', $this->
getId())
 
  295        if ($question_id < 1) {
 
  300            "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",
 
  306            return $data[
"type_tag"];
 
  327        parent::setDescription($a_description);
 
  337        return parent::getTitle();
 
  345        parent::setTitle($a_title);
 
  361            "SELECT COUNT(solution_id) solution_count FROM tst_solutions WHERE question_fi = %s",
 
  366        return $row[
"solution_count"];
 
  371        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  372        if ($question_id > 0) {
 
  376        $question_type_gui = $question_type . 
"GUI";
 
  377        $question_gui = 
new $question_type_gui();
 
  378        return $question_gui;
 
  390        $newtitle = $question->object->getTitle();
 
  391        if ($question->object->questionTitleExists($this->getId(), $question->object->getTitle())) {
 
  393            while ($question->object->questionTitleExists($this->getId(), $question->object->getTitle() . 
" ($counter)")) {
 
  396            $newtitle = $question->object->getTitle() . 
" ($counter)";
 
  398        $new_id = $question->object->duplicate(
false, $newtitle);
 
  414        if ($question_gui->object->getObjId() == $questionpool_to) {
 
  419            $newtitle = $question_gui->object->getTitle();
 
  420            if ($question_gui->object->questionTitleExists($this->getId(), $question_gui->object->getTitle())) {
 
  422                while ($question_gui->object->questionTitleExists($this->getId(), $question_gui->object->getTitle() . 
" ($counter)")) {
 
  425                $newtitle = $question_gui->object->getTitle() . 
" ($counter)";
 
  427            return $question_gui->object->copyObject($this->
getId(), $newtitle);
 
  441        $query_result = 
$ilDB->queryF(
 
  442            "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",
 
  444            array($this->
getId())
 
  448        if ($query_result->numRows()) {
 
  449            while (
$row = 
$ilDB->fetchAssoc($query_result)) {
 
  450                $row[
'ttype'] = $types[
$row[
'type_tag']];
 
  451                if (
$row[
"plugin"]) {
 
  468        $xmlWriter->xmlStartTag(
'Settings');
 
  470        $xmlWriter->xmlElement(
'ShowTaxonomies', 
null, (
int) $this->
getShowTaxonomies());
 
  471        $xmlWriter->xmlElement(
'NavTaxonomy', 
null, (
int) $this->
getNavTaxonomyId());
 
  474        $xmlWriter->xmlEndTag(
'Settings');
 
  488        $this->mob_ids = array();
 
  489        $this->file_ids = array();
 
  492        $attrs[
"Type"] = 
"Questionpool_Test";
 
  493        $a_xml_writer->
xmlStartTag(
"ContentObject", $attrs);
 
  502        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Start Export Page Objects");
 
  503        $ilBench->start(
"ContentObjectExport", 
"exportPageObjects");
 
  505        $ilBench->stop(
"ContentObjectExport", 
"exportPageObjects");
 
  506        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Finished Export Page Objects");
 
  509        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Start Export Media Objects");
 
  510        $ilBench->start(
"ContentObjectExport", 
"exportMediaObjects");
 
  512        $ilBench->stop(
"ContentObjectExport", 
"exportMediaObjects");
 
  513        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Finished Export Media Objects");
 
  516        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Start Export File Items");
 
  517        $ilBench->start(
"ContentObjectExport", 
"exportFileItems");
 
  519        $ilBench->stop(
"ContentObjectExport", 
"exportFileItems");
 
  520        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Finished Export File Items");
 
  525        $a_xml_writer->
xmlEndTag(
"ContentObject");
 
  537        require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
 
  539        $assignmentList->setParentObjId($this->
getId());
 
  540        $assignmentList->loadFromDb();
 
  541        $assignmentList->loadAdditionalSkillData();
 
  543        require_once 
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentExporter.php';
 
  545        $skillQuestionAssignmentExporter->setXmlWriter($a_xml_writer);
 
  546        $skillQuestionAssignmentExporter->setQuestionIds($questions);
 
  547        $skillQuestionAssignmentExporter->setAssignmentList($assignmentList);
 
  548        $skillQuestionAssignmentExporter->export();
 
  559        include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
 
  561        $md2xml->setExportMode(
true);
 
  562        $md2xml->startExport();
 
  563        $a_xml_writer->appendXML($md2xml->getXML());
 
  568        if ($a_tag == 
"Identifier" && $a_param == 
"Entry") {
 
  569            include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  588        include_once 
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
 
  590        foreach ($questions as $question_id) {
 
  591            $ilBench->start(
"ContentObjectExport", 
"exportPageObject");
 
  592            $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Page Object " . $question_id);
 
  595            $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
 
  599            $ilBench->start(
"ContentObjectExport", 
"exportPageObject_XML");
 
  600            include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
 
  602            $page_object->buildDom();
 
  603            $page_object->insertInstIntoIDs($a_inst);
 
  604            $mob_ids = $page_object->collectMediaObjects(
false);
 
  605            require_once 
'Services/COPage/classes/class.ilPCFileList.php';
 
  607            $xml = $page_object->getXMLFromDom(
false, 
false, 
false, 
"", 
true);
 
  608            $xml = str_replace(
"&", 
"&", 
$xml);
 
  609            $a_xml_writer->appendXML(
$xml);
 
  610            $page_object->freeDom();
 
  613            $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_XML");
 
  616            $ilBench->start(
"ContentObjectExport", 
"exportPageObject_CollectMedia");
 
  618            foreach ($mob_ids as $mob_id) {
 
  619                $this->mob_ids[$mob_id] = $mob_id;
 
  621            $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_CollectMedia");
 
  624            $ilBench->start(
"ContentObjectExport", 
"exportPageObject_CollectFileItems");
 
  626            foreach ($file_ids as $file_id) {
 
  627                $this->file_ids[$file_id] = $file_id;
 
  629            $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_CollectFileItems");
 
  631            $a_xml_writer->xmlEndTag(
"PageObject");
 
  634            $ilBench->stop(
"ContentObjectExport", 
"exportPageObject");
 
  646        include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
  648        foreach ($this->mob_ids as $mob_id) {
 
  649            $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Media Object " . $mob_id);
 
  652                $media_obj->exportXML($a_xml_writer, $a_inst);
 
  653                $media_obj->exportFiles($a_target_dir);
 
  665        include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
  667        foreach ($this->file_ids as $file_id) {
 
  668            $expLog->write(date(
"[y-m-d H:i:s] ") . 
"File Item " . $file_id);
 
  669            $file_obj = 
new ilObjFile($file_id, 
false);
 
  670            $file_obj->export($a_target_dir);
 
  682        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  685        if (!is_writable($qpl_data_dir)) {
 
  686            $this->
ilias->raiseError(
"Questionpool Data Directory (" . $qpl_data_dir
 
  687                . 
") not writeable.", $this->
ilias->error_obj->FATAL);
 
  691        $qpl_dir = $qpl_data_dir . 
"/qpl_" . $this->
getId();
 
  693        if (!@is_dir($qpl_dir)) {
 
  694            $this->
ilias->raiseError(
"Creation of Questionpool Directory failed.", $this->
ilias->error_obj->FATAL);
 
  699            $this->
ilias->raiseError(
"Creation of Export Directory failed.", $this->
ilias->error_obj->FATAL);
 
  703            $this->
ilias->raiseError(
"Creation of Export Directory failed.", $this->
ilias->error_obj->FATAL);
 
  712        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  715                include_once(
"./Services/Export/classes/class.ilExport.php");
 
  737        $ilias = 
$DIC[
'ilias'];
 
  739        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  743        if (!is_writable($qpl_data_dir)) {
 
  744            $ilias->raiseError(
"Questionpool Data Directory (" . $qpl_data_dir
 
  745                . 
") not writeable.", $ilias->error_obj->FATAL);
 
  749        $qpl_dir = $qpl_data_dir . 
"/qpl_import";
 
  751        if (!@is_dir($qpl_dir)) {
 
  752            $ilias->raiseError(
"Creation of Questionpool Directory failed.", $ilias->error_obj->FATAL);
 
  762        if (strlen($a_import_dir)) {
 
  763            $_SESSION[
"qpl_import_dir"] = $a_import_dir;
 
  774        if (strlen(
$_SESSION[
"qpl_import_dir"])) {
 
  796            "SELECT question_id FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.tstamp > 0 AND original_id IS NULL",
 
  798            array($this->
getId())
 
  800        $questions = array();
 
  802            array_push($questions, 
$row[
"question_id"]);
 
  812        $query_result = 
$ilDB->queryF(
 
  813            "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",
 
  814            array(
'integer',
'text'),
 
  815            array($this->
getId(), 1)
 
  817        $questions = array();
 
  818        if ($query_result->numRows()) {
 
  819            while (
$row = 
$ilDB->fetchAssoc($query_result)) {
 
  820                if (
$row[
"plugin"]) {
 
  822                        array_push($questions, 
$row[
"question_id"]);
 
  825                    array_push($questions, 
$row[
"question_id"]);
 
  836        $row = 
$DIC->database()->fetchAssoc(
$DIC->database()->queryF(
 
  837            "SELECT COUNT(question_id) cnt FROM qpl_questions WHERE question_id = %s AND obj_fi = %s",
 
  838            array(
'integer', 
'integer'),
 
  839            array($questionId, $this->
getId())
 
  842        return (
bool) 
$row[
'cnt'];
 
  851        if (!is_array($this->import_mapping)) {
 
  854            return $this->import_mapping;
 
  869        if (count($questions) > 0) {
 
  870            foreach ($questions as 
$key => $value) {
 
  872                $xml .= $question->object->toXML();
 
  874            if (count($questions) > 1) {
 
  875                $xml = preg_replace(
"/<\/questestinterop>\s*<.xml.*?>\s*<questestinterop>/", 
"", 
$xml);
 
  878        $xml = preg_replace(
"/(<\?xml[^>]*?>)/", 
"\\1" . 
"<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">", 
$xml);
 
  894        if ($complete_questions_only) {
 
  896                "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",
 
  897                array(
'integer', 
'text'),
 
  898                array($questionpool_id, 1)
 
  902                "SELECT COUNT(question_id) question_count FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.tstamp > 0 AND original_id IS NULL",
 
  904                array($questionpool_id)
 
  908        return $row[
"question_count"];
 
  920        switch ($a_online_status) {
 
  923                $this->online = $a_online_status;
 
  933        if (strcmp($this->online, 
"") == 0) {
 
  971                "SELECT qpl_questionpool.isonline FROM qpl_questionpool,object_reference WHERE object_reference.ref_id = %s AND object_reference.obj_id = qpl_questionpool.obj_fi",
 
  977                "SELECT isonline FROM qpl_questionpool WHERE obj_fi = %s",
 
  984            return $row[
"isonline"];
 
 1000        if ($is_reference) {
 
 1002                "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",
 
 1008                "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",
 
 1013        if (
$result->numRows() == 1) {
 
 1015            if (
$row[
"equal_points"] == 1) {
 
 1035        if (array_key_exists(
"qpl_clipboard", 
$_SESSION)) {
 
 1037            foreach (
$_SESSION[
"qpl_clipboard"] as $question_object) {
 
 1038                if (strcmp($question_object[
"action"], 
"move") == 0) {
 
 1040                        "SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
 
 1042                        array($question_object[
"question_id"])
 
 1044                    if (
$result->numRows() == 1) {
 
 1046                        $source_questionpool = 
$row[
"obj_fi"];
 
 1048                        $affectedRows = 
$ilDB->manipulateF(
 
 1049                            "UPDATE qpl_questions SET obj_fi = %s WHERE question_id = %s",
 
 1050                            array(
'integer',
'integer'),
 
 1051                            array($this->
getId(), $question_object[
"question_id"])
 
 1053                        if (!$affectedRows) {
 
 1058                        $source_path = CLIENT_WEB_DIR . 
"/assessment/" . $source_questionpool . 
"/" . $question_object[
"question_id"] . 
"/";
 
 1059                        if (@is_dir($source_path)) {
 
 1060                            $target_path = CLIENT_WEB_DIR . 
"/assessment/" . $this->
getId() . 
"/";
 
 1061                            if (!@is_dir($target_path)) {
 
 1062                                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 1065                            rename($source_path, $target_path . $question_object[
"question_id"]);
 
 1071                    $new_question_id = $this->
copyQuestion($question_object[
"question_id"], $this->
getId());
 
 1072                    if (!$new_question_id) {
 
 1093        if (!array_key_exists(
"qpl_clipboard", 
$_SESSION)) {
 
 1096        $_SESSION[
"qpl_clipboard"][$question_id] = array(
"question_id" => $question_id, 
"action" => 
"copy");
 
 1107        if (!array_key_exists(
"qpl_clipboard", 
$_SESSION)) {
 
 1110        $_SESSION[
"qpl_clipboard"][$question_id] = array(
"question_id" => $question_id, 
"action" => 
"move");
 
 1115        if (!isset(
$_SESSION[
'qpl_clipboard'])) {
 
 1119        if (!isset(
$_SESSION[
'qpl_clipboard'][$deletedQuestionId])) {
 
 1123        unset(
$_SESSION[
'qpl_clipboard'][$deletedQuestionId]);
 
 1125        if (!count(
$_SESSION[
'qpl_clipboard'])) {
 
 1140        $rbacsystem = 
$DIC[
'rbacsystem'];
 
 1142        include_once 
"./Services/Object/classes/class.ilObject.php";
 
 1167        $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");
 
 1168        if ($query_result->numRows()) {
 
 1169            while (
$row = 
$ilDB->fetchAssoc($query_result)) {
 
 1191        $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");
 
 1192        if ($query_result->numRows()) {
 
 1193            include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 1194            while (
$row = 
$ilDB->fetchAssoc($query_result)) {
 
 1205                    $duplicate_id = $question->object->duplicate(
true);
 
 1206                    if ($duplicate_id > 0) {
 
 1208                        $affectedRows = 
$ilDB->manipulateF(
 
 1209                            "UPDATE tst_solutions SET question_fi = %s WHERE question_fi = %s",
 
 1210                            array(
'integer',
'integer'),
 
 1211                            array($duplicate_id, 
$row[
"question_id"])
 
 1215                        $affectedRows = 
$ilDB->manipulateF(
 
 1216                            "UPDATE tst_test_rnd_qst SET question_fi = %s WHERE question_fi = %s",
 
 1217                            array(
'integer',
'integer'),
 
 1218                            array($duplicate_id, 
$row[
"question_id"])
 
 1222                        $affectedRows = 
$ilDB->manipulateF(
 
 1223                            "UPDATE tst_test_result SET question_fi = %s WHERE question_fi = %s",
 
 1224                            array(
'integer',
'integer'),
 
 1225                            array($duplicate_id, 
$row[
"question_id"])
 
 1229                        $affectedRows = 
$ilDB->manipulateF(
 
 1230                            "UPDATE ass_log SET question_fi = %s WHERE question_fi = %s",
 
 1231                            array(
'integer',
'integer'),
 
 1232                            array($duplicate_id, 
$row[
"question_id"])
 
 1257        foreach (
$path as $item) {
 
 1258            if (($counter > 0) && ($counter < count(
$path) - 1)) {
 
 1259                array_push($items, $item[
"title"]);
 
 1263        $fullpath = join(
" > ", $items);
 
 1264        include_once 
"./Services/Utilities/classes/class.ilStr.php";
 
 1265        if (strlen($fullpath) > 60) {
 
 1277    public static function _getAvailableQuestionpools($use_object_id = 
false, $equal_points = 
false, $could_be_offline = 
false, $showPath = 
false, $with_questioncount = 
false, $permission = 
"read", $usr_id = 
"")
 
 1284        $result_array = array();
 
 1285        $permission = (strlen($permission) == 0) ? 
"read" : $permission;
 
 1293        if (count($obj_ids)) {
 
 1294            $in = 
$ilDB->in(
'object_data.obj_id', $obj_ids, 
false, 
'integer');
 
 1295            if ($could_be_offline) {
 
 1296                $result = 
$ilDB->query(
"SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE " .
 
 1297                    "qpl_questionpool.obj_fi = object_data.obj_id AND $in ORDER BY object_data.title");
 
 1300                    "SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE " .
 
 1301                    "qpl_questionpool.obj_fi = object_data.obj_id AND $in AND qpl_questionpool.isonline = %s " .
 
 1302                    "ORDER BY object_data.title",
 
 1309                if ($equal_points) {
 
 1317                    if ($with_questioncount) {
 
 1318                        $title .= 
" [" . 
$row[
"questioncount"] . 
" " . (
$row[
"questioncount"] == 1 ? 
$lng->txt(
"ass_question") : 
$lng->txt(
"assQuestions")) . 
"]";
 
 1321                    if ($use_object_id) {
 
 1322                        $result_array[
$row[
"obj_fi"]] = array(
 
 1323                            'qpl_id' => 
$row[
'obj_fi'],
 
 1324                            'qpl_title' => 
$row[
'title'],
 
 1326                            "count" => 
$row[
"questioncount"]
 
 1329                        $result_array[
$ref_id] = array(
 
 1330                            'qpl_id' => 
$row[
'obj_fi'],
 
 1331                            'qpl_title' => 
$row[
'title'],
 
 1333                            "count" => 
$row[
"questioncount"]
 
 1339        return $result_array;
 
 1347        $questions = array();
 
 1349            "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",
 
 1351            array($this->
getId())
 
 1354            array_push($questions, 
$row[
"question_id"]);
 
 1364    public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree = 
false)
 
 1369        $newObj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
 
 1374        if (!$cp_options->isRootNode($this->getRefId())) {
 
 1380        $newObj->saveToDb();
 
 1384        $questionIdsMap = array();
 
 1385        foreach ($questions as $question_id) {
 
 1386            $newQuestionId = $newObj->copyQuestion($question_id, $newObj->getId());
 
 1387            $questionIdsMap[$question_id] = $newQuestionId;
 
 1391        include_once 
"./Services/MetaData/classes/class.ilMD.php";
 
 1393        $new_md = &$md->cloneMD($newObj->getId(), 0, $newObj->getType());
 
 1396        $newObj->updateMetaData();
 
 1398        require_once 
'Modules/TestQuestionPool/classes/class.ilQuestionPoolTaxonomiesDuplicator.php';
 
 1400        $duplicator->setSourceObjId($this->
getId());
 
 1401        $duplicator->setSourceObjType($this->
getType());
 
 1402        $duplicator->setTargetObjId($newObj->getId());
 
 1403        $duplicator->setTargetObjType($newObj->getType());
 
 1404        $duplicator->setQuestionIdMapping($questionIdsMap);
 
 1405        $duplicator->duplicate($duplicator->getAllTaxonomiesForSourceObject());
 
 1407        $duplicatedTaxKeyMap = $duplicator->getDuplicatedTaxonomiesKeysMap();
 
 1408        $newObj->setNavTaxonomyId($duplicatedTaxKeyMap->getMappedTaxonomyId($this->getNavTaxonomyId()));
 
 1409        $newObj->saveToDb();
 
 1414    public function getQuestionTypes($all_tags = 
false, $fixOrder = 
false, $withDeprecatedTypes = 
true)
 
 1419    public static function _getQuestionTypes($all_tags = 
false, $fixOrder = 
false, $withDeprecatedTypes = 
true)
 
 1425        include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 1427        $lng->loadLanguageModule(
"assessment");
 
 1431            if ($all_tags || (!in_array(
$row[
"question_type_id"], $forbidden_types))) {
 
 1435                if (
$row[
"plugin"] == 0) {
 
 1439                    $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 1440                    $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE, 
"TestQuestionPool", 
"qst");
 
 1441                    foreach ($pl_names as $pl_name) {
 
 1443                        if (strcmp($pl->getQuestionType(), 
$row[
"type_tag"]) == 0) {
 
 1444                            $types[$pl->getQuestionTypeTranslation()] = 
$row;
 
 1451        require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionTypeOrderer.php';
 
 1454        $types = $orderer->getOrderedTypes($withDeprecatedTypes);
 
 1464        $query = 
"SELECT type_tag FROM qpl_qst_type WHERE question_type_id = %s";
 
 1465        $types = array(
'integer');
 
 1470            return $row[
'type_tag'];
 
 1480        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 1482        $lng->loadLanguageModule(
"assessment");
 
 1486            if (
$row[
"plugin"] == 0) {
 
 1487                $types[
$row[
'type_tag']] = 
$lng->txt(
$row[
"type_tag"]);
 
 1489                $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE, 
"TestQuestionPool", 
"qst");
 
 1490                foreach ($pl_names as $pl_name) {
 
 1492                    if (strcmp($pl->getQuestionType(), 
$row[
"type_tag"]) == 0) {
 
 1493                        $types[
$row[
'type_tag']] = $pl->getQuestionTypeTranslation();
 
 1521        $allowed_types = array(
 
 1522            "assSingleChoice" => 1,
 
 1523            "assMultipleChoice" => 2,
 
 1524            "assKprimChoice" => 3,
 
 1525            "assClozeTest" => 4,
 
 1526            "assMatchingQuestion" => 5,
 
 1527            "assOrderingQuestion" => 6,
 
 1528            "assOrderingHorizontal" => 7,
 
 1529            "assImagemapQuestion" => 8,
 
 1530            "assTextSubset" => 9,
 
 1531            "assErrorText" => 10,
 
 1536        foreach ($qtypes as $k => 
$t) {
 
 1538            if (isset($allowed_types[
$t[
"type_tag"]])) {
 
 1539                $t[
"order"] = $allowed_types[
$t[
"type_tag"]];
 
 1552        $questions = array();
 
 1554            "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",
 
 1556            array($this->
getId())
 
 1559            array_push($questions, 
$row);
 
 1575            "UPDATE qpl_questionpool SET questioncount = %s, tstamp = %s WHERE obj_fi = %s",
 
 1576            array(
'integer',
'integer',
'integer'),
 
 1591        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 1593        $plugins = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE, 
"TestQuestionPool", 
"qst");
 
 1594        foreach ($plugins as $pluginName) {
 
 1595            if ($pluginName == $questionType) { 
 
 1602            if ($plugin->getQuestionType() == $questionType) { 
 
 1619        require_once 
'Modules/TestQuestionPool/classes/class.ilAssIncompleteQuestionPurger.php';
 
 1621        $incompleteQuestionPurger->setOwnerId(
$ilUser->getId());
 
 1622        $incompleteQuestionPurger->purge();
 
 1632        require_once 
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
 
 1656        if (self::$isSkillManagementGloballyActivated === 
null) {
 
 1657            include_once 
'Services/Skill/classes/class.ilSkillManagementSettings.php';
 
 1660            self::$isSkillManagementGloballyActivated = $skmgSet->isActivated();
 
 1668        require_once 
'Modules/TestQuestionPool/classes/class.ilObjQuestionPoolXMLParser.php';
 
if(php_sapi_name() !='cli') $in
An exception for terminatinating execution or to throw for unit testing.
Abstract basic class which is to be extended by the concrete assessment question type classes.
static _isUsedInRandomTest($question_id="")
Checks whether the question is used in a random test or not.
addQuestionChangeListener(ilQuestionChangeListener $listener)
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.
static _getExportDirectory($a_obj_id, $a_type="xml", $a_obj_type="", $a_entity="")
Get export directory for an repository object.
static _getForbiddenQuestionTypes()
Returns the forbidden questiontypes for ILIAS.
static _getQuestionCount($questionpool_id, $complete_questions_only=false)
Returns the number of questions in a question pool.
static _lookupOnline($a_obj_id, $is_reference=false)
static _getQuestionTypes($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)
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)
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 _isWriteable($object_id, $user_id)
Returns true, if the question pool is writeable by a given user.
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...
moveToClipboard($question_id)
Moves a question to the clipboard.
getTaxonomyIds()
get ids of all taxonomies corresponding to current pool
setOnline($a_online_status)
Sets the questionpool online status.
static isSkillManagementGloballyActivated()
static $isSkillManagementGloballyActivated
modifyExportIdentifier($a_tag, $a_param, $a_value)
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 _createImportDirectory()
creates data directory for import files (data_dir/qpl_data/qpl_<id>/import, depending on data directo...
static _getImportDirectory()
get import directory of lm
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.
questionsToXML($questions)
Returns a QTI xml representation of a list of questions.
_getFullPathToQpl($ref_id)
Retrieves the full path to a question pool with a given reference id.
static & _getSelfAssessmentQuestionTypes($all_tags=false)
Get all self assessment question types.
copyQuestion($question_id, $questionpool_to)
Copies a question into another question pool.
create($a_upload=false)
create questionpool object
objectToXmlWriter(ilXmlWriter &$a_xml_writer, $a_inst, $a_target_dir, &$expLog, $questions)
export pages of test to xml (see ilias_co.dtd)
exportXMLMediaObjects(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
export media objects to xml (see ilias_co.dtd)
createExportDirectory()
creates data directory for export files (data_dir/qpl_data/qpl_<id>/export, depending on data directo...
setNavTaxonomyId($navTaxonomyId)
isPluginActive($questionType)
Checks wheather or not a question plugin with a given name is active.
duplicateQuestion($question_id)
Duplicates a question for a questionpool.
static _setImportDirectory($a_import_dir=null)
set import directory
exportXMLPageObjects(&$a_xml_writer, $a_inst, &$expLog, $questions)
export page objects to xml (see ilias_co.dtd)
static _hasEqualPoints($a_obj_id, $is_reference=false)
Checks a question pool for questions with the same maximum points.
setSkillServiceEnabled($skillServiceEnabled)
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.
__construct($a_id=0, $a_call_by_reference=true)
Constructor @access public.
update()
update object data
saveToDb()
Saves a ilObjQuestionpool object to a database.
copyToClipboard($question_id)
Copies a question to the clipboard.
exportXMLSettings($xmlWriter)
checkQuestionParent($questionId)
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 _updateQuestionCount($object_id)
Updates the number of available questions for a question pool in the database.
& 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
populateQuestionSkillAssignmentsXml(ilXmlWriter &$a_xml_writer, $questions)
getQuestionTypes($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
static getPoolQuestionChangeListeners(ilDBInterface $db, $poolObjId)
Class ilObject Basic functions for all objects.
getType()
get object type @access public
static _lookupObjId($a_id)
deleteMetaData()
delete meta data entry
createMetaData()
create meta data entry
static _getAllReferences($a_id)
get all reference ids of object
getId()
get object id @access public
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
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(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
Skill management settings.
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 ...
xmlEndTag($tag)
Writes an endtag.
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
update($pash, $contents, Config $config)
redirection script todo: (a better solution should control the processing via a xml file)