当前位置: 首页>>代码示例>>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;未经允许,请勿转载。