當前位置: 首頁>>代碼示例>>PHP>>正文


PHP assQuestion::_isUsedInRandomTest方法代碼示例

本文整理匯總了PHP中assQuestion::_isUsedInRandomTest方法的典型用法代碼示例。如果您正苦於以下問題:PHP assQuestion::_isUsedInRandomTest方法的具體用法?PHP assQuestion::_isUsedInRandomTest怎麽用?PHP assQuestion::_isUsedInRandomTest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在assQuestion的用法示例。


在下文中一共展示了assQuestion::_isUsedInRandomTest方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: array

 /**
 * 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;
 }
開發者ID:Walid-Synakene,項目名稱:ilias,代碼行數:43,代碼來源:class.ilObjQuestionPool.php


注:本文中的assQuestion::_isUsedInRandomTest方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。