当前位置: 首页>>代码示例>>PHP>>正文


PHP assQuestion::_getSolutionMaxPass方法代码示例

本文整理汇总了PHP中assQuestion::_getSolutionMaxPass方法的典型用法代码示例。如果您正苦于以下问题:PHP assQuestion::_getSolutionMaxPass方法的具体用法?PHP assQuestion::_getSolutionMaxPass怎么用?PHP assQuestion::_getSolutionMaxPass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在assQuestion的用法示例。


在下文中一共展示了assQuestion::_getSolutionMaxPass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getTextAnswer

 /**
 * Returns the text answer of a given user for a given question
 *
 * @param integer $user_id The user id
 * @param integer $question_id The question id
 * @return string The answer text
 * @access public
 */
 function getTextAnswer($active_id, $question_id, $pass = NULL)
 {
     global $ilDB;
     $res = "";
     if ($active_id && $question_id) {
         if (is_null($pass)) {
             include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
             $pass = assQuestion::_getSolutionMaxPass($question_id, $active_id);
         }
         $result = $ilDB->queryF("SELECT value1 FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s", array('integer', 'integer', 'integer'), array($active_id, $question_id, $pass));
         if ($result->numRows() == 1) {
             $row = $ilDB->fetchAssoc($result);
             $res = $row["value1"];
         }
     }
     return $res;
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:25,代码来源:class.ilObjTest.php

示例2: _setReachedPoints

 /**
  * Sets the points, a learner has reached answering the question
  * Additionally objective results are updated
  *
  * @param integer $user_id The database ID of the learner
  * @param integer $test_id The database Id of the test containing the question
  * @param integer $points The points the user has reached answering the question
  * @return boolean true on success, otherwise false
  * @access public
  */
 function _setReachedPoints($active_id, $question_id, $points, $maxpoints, $pass, $manualscoring, $obligationsEnabled)
 {
     global $ilDB;
     if ($points <= $maxpoints) {
         if (is_null($pass)) {
             $pass = assQuestion::_getSolutionMaxPass($question_id, $active_id);
         }
         // retrieve the already given points
         $old_points = 0;
         $result = $ilDB->queryF("SELECT points FROM tst_test_result WHERE active_fi = %s AND question_fi = %s AND pass = %s", array('integer', 'integer', 'integer'), array($active_id, $question_id, $pass));
         $manual = $manualscoring ? 1 : 0;
         $rowsnum = $result->numRows();
         if ($rowsnum) {
             $row = $ilDB->fetchAssoc($result);
             $old_points = $row["points"];
             if ($old_points != $points) {
                 $affectedRows = $ilDB->manipulateF("UPDATE tst_test_result SET points = %s, manual = %s, tstamp = %s WHERE active_fi = %s AND question_fi = %s AND pass = %s", array('float', 'integer', 'integer', 'integer', 'integer', 'integer'), array($points, $manual, time(), $active_id, $question_id, $pass));
             }
         } else {
             $next_id = $ilDB->nextId('tst_test_result');
             $affectedRows = $ilDB->manipulateF("INSERT INTO tst_test_result (test_result_id, active_fi, question_fi, points, pass, manual, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)", array('integer', 'integer', 'integer', 'float', 'integer', 'integer', 'integer'), array($next_id, $active_id, $question_id, $points, $pass, $manual, time()));
         }
         if ($old_points != $points || !$rowsnum) {
             assQuestion::_updateTestPassResults($active_id, $pass, $obligationsEnabled);
             // finally update objective result
             include_once "./Modules/Test/classes/class.ilObjTest.php";
             include_once './Modules/Course/classes/class.ilCourseObjectiveResult.php';
             ilCourseObjectiveResult::_updateObjectiveResult(ilObjTest::_getUserIdFromActiveId($active_id), $question_id, $points);
             include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
             if (ilObjAssessmentFolder::_enabledAssessmentLogging()) {
                 global $lng, $ilUser;
                 include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
                 $username = ilObjTestAccess::_getParticipantData($active_id);
                 assQuestion::_logAction(sprintf($lng->txtlng("assessment", "log_answer_changed_points", ilObjAssessmentFolder::_getLogLanguage()), $username, $old_points, $points, $ilUser->getFullname() . " (" . $ilUser->getLogin() . ")"), $active_id, $question_id);
             }
         }
         return TRUE;
     } else {
         return FALSE;
     }
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:51,代码来源:class.assQuestion.php


注:本文中的assQuestion::_getSolutionMaxPass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。