/**
 * Returns an array containing the qpl_question and qpl_qst_type fields
 * of deleteable questions for an array of question ids
 *
 * @param array $question_ids An array containing the question ids
 * @return array An array containing the details of the requested questions
 * @access public
 */
 function &getDeleteableQuestionDetails($question_ids)
 {
     global $ilDB, $ilLog;
     $result = array();
     $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");
     if ($query_result->numRows()) {
         include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
         while ($row = $ilDB->fetchAssoc($query_result)) {
             if (!assQuestion::_isUsedInRandomTest($row["question_id"])) {
                 array_push($result, $row);
             } else {
                 // the question was used in a random test prior to ILIAS 3.7 so it was inserted
                 // as a reference to the original question pool object and not as a copy. To allow
                 // the deletion of the question pool object, a copy must be created and all database references
                 // of the original question must changed with the reference of the copy
                 // 1. Create a copy of the original question
                 $question =& $this->createQuestion("", $row["question_id"]);
                 $duplicate_id = $question->object->duplicate(true);
                 if ($duplicate_id > 0) {
                     // 2. replace the question id in the solutions
                     $affectedRows = $ilDB->manipulateF("UPDATE tst_solutions SET question_fi = %s WHERE question_fi = %s", array('integer', 'integer'), array($duplicate_id, $row["question_id"]));
                     // 3. replace the question id in the question list of random tests
                     $affectedRows = $ilDB->manipulateF("UPDATE tst_test_rnd_qst SET question_fi = %s WHERE question_fi = %s", array('integer', 'integer'), array($duplicate_id, $row["question_id"]));
                     // 4. replace the question id in the test results
                     $affectedRows = $ilDB->manipulateF("UPDATE tst_test_result SET question_fi = %s WHERE question_fi = %s", array('integer', 'integer'), array($duplicate_id, $row["question_id"]));
                     // 5. replace the question id in the test&assessment log
                     $affectedRows = $ilDB->manipulateF("UPDATE ass_log SET question_fi = %s WHERE question_fi = %s", array('integer', 'integer'), array($duplicate_id, $row["question_id"]));
                     // 6. The original question can be deleted, so add it to the list of questions
                     array_push($result, $row);
                 }
             }
         }
     }
     return $result;
 }