本文整理汇总了PHP中assQuestion::_updateTestPassResults方法的典型用法代码示例。如果您正苦于以下问题:PHP assQuestion::_updateTestPassResults方法的具体用法?PHP assQuestion::_updateTestPassResults怎么用?PHP assQuestion::_updateTestPassResults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assQuestion
的用法示例。
在下文中一共展示了assQuestion::_updateTestPassResults方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirectQuestionCmd
//.........这里部分代码省略.........
$this->outTestPage(true);
break;
case "handleQuestionAction":
$this->sequence = $this->calculateSequence();
$this->testSession->setLastSequence($this->sequence);
$this->testSession->saveToDb();
$this->outTestPage(false);
break;
case "summary":
$this->ctrl->redirect($this, "outQuestionSummary");
break;
case "summary_obligations":
$this->ctrl->redirect($this, "outQuestionSummaryWithObligationsInfo");
break;
case "summary_obligations_only":
$this->ctrl->redirect($this, "outObligationsOnlySummary");
break;
case "start":
$_SESSION['tst_pass_finish'] = 0;
// ensure existing test session
$this->testSession->setUserId($ilUser->getId());
$this->testSession->setAnonymousId($_SESSION["tst_access_code"][$this->object->getTestId()]);
$this->testSession->setObjectiveOrientedContainerId($this->getObjectiveOrientedContainerId());
$this->testSession->saveToDb();
$active_id = $this->testSession->getActiveId();
$this->ctrl->setParameter($this, "active_id", $active_id);
$shuffle = $this->object->getShuffleQuestions();
if ($this->object->isRandomTest()) {
$this->generateRandomTestPassForActiveUser();
$this->object->loadQuestions();
$shuffle = FALSE;
// shuffle is already done during the creation of the random questions
}
assQuestion::_updateTestPassResults($active_id, $this->testSession->getPass(), $this->object->areObligationsEnabled(), null, $this->object->id);
// ensure existing test sequence
if (!$this->testSequence->hasSequence()) {
$this->testSequence->createNewSequence($this->object->getQuestionCount(), $shuffle);
$this->testSequence->saveToDb();
}
if ($this->testSession->isObjectiveOriented()) {
$this->testSequence->loadFromDb();
$this->testSequence->loadQuestions();
$this->filterTestSequenceByObjectives($this->testSession, $this->testSequence);
}
$active_time_id = $this->object->startWorkingTime($this->testSession->getActiveId(), $this->testSession->getPass());
$_SESSION["active_time_id"] = $active_time_id;
if ($this->object->getListOfQuestionsStart()) {
$this->ctrl->setParameter($this, "activecommand", "summary");
$this->ctrl->redirect($this, "redirectQuestion");
} else {
$this->ctrl->setParameter($this, "sequence", $this->sequence);
$this->ctrl->setParameter($this, "activecommand", "gotoquestion");
$this->ctrl->saveParameter($this, "tst_javascript");
$this->ctrl->redirect($this, "redirectQuestion");
}
break;
case "resume":
$_SESSION['tst_pass_finish'] = 0;
$active_id = $this->testSession->getActiveId();
$this->ctrl->setParameter($this, "active_id", $active_id);
if ($this->object->isRandomTest()) {
if (!$this->testSequence->hasRandomQuestionsForPass($active_id, $this->testSession->getPass())) {
// create a new set of random questions
$this->generateRandomTestPassForActiveUser();
}
}
示例2: redirectQuestion
/**
* Called when a user answered a question to perform a redirect after POST.
* This is called for security reasons to prevent users sending a form twice.
*
* @access public
*/
function redirectQuestion()
{
global $ilUser;
// check the test restrictions to access the test in case one
// of the test navigation commands was called by an external script
// e.g. $ilNavigationHistory
$executable = $this->object->isExecutable($ilUser->getId());
if (!$executable["executable"]) {
ilUtil::sendInfo($executable["errormessage"], TRUE);
$this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
}
switch ($_GET["activecommand"]) {
case "next":
$this->sequence = $this->calculateSequence();
if ($this->sequence === FALSE) {
if ($this->object->getListOfQuestionsEnd()) {
$allObligationsAnswered = ilObjTest::allObligationsAnswered($this->object->getTestSession()->getTestId(), $this->object->getTestSession()->getActiveId(), $this->object->getTestSession()->getPass());
if ($this->object->areObligationsEnabled() && !$allObligationsAnswered) {
$this->ctrl->redirect($this, "outQuestionSummaryWithObligationsInfo");
}
$this->outQuestionSummary();
} else {
$this->ctrl->redirect($this, "finishTest");
}
} else {
$this->object->getTestSession()->setLastSequence($this->sequence);
$this->object->getTestSession()->saveToDb();
$this->outTestPage();
}
break;
case "previous":
$this->sequence = $this->calculateSequence();
$this->object->getTestSession()->setLastSequence($this->sequence);
$this->object->getTestSession()->saveToDb();
if ($this->sequence === FALSE) {
$this->ctrl->redirect($this, "outIntroductionPage");
} else {
$this->outTestPage();
}
break;
case "postpone":
$this->sequence = $this->calculateSequence();
$nextSequence = $this->object->getTestSequence()->getNextSequence($this->sequence);
$this->object->getTestSequence()->postponeSequence($this->sequence);
$this->object->getTestSequence()->saveToDb();
$this->object->getTestSession()->setLastSequence($nextSequence);
$this->object->getTestSession()->saveToDb();
$this->sequence = $nextSequence;
$this->outTestPage();
break;
case "setmarked":
$this->sequence = $this->calculateSequence();
$this->object->getTestSession()->setLastSequence($this->sequence);
$this->object->getTestSession()->saveToDb();
$q_id = $this->object->getTestSequence()->getQuestionForSequence($_GET["sequence"]);
$this->object->setQuestionSetSolved(1, $q_id, $ilUser->getId());
$this->outTestPage();
break;
case "resetmarked":
$this->sequence = $this->calculateSequence();
$this->object->getTestSession()->setLastSequence($this->sequence);
$this->object->getTestSession()->saveToDb();
$q_id = $this->object->getTestSequence()->getQuestionForSequence($_GET["sequence"]);
$this->object->setQuestionSetSolved(0, $q_id, $ilUser->getId());
$this->outTestPage();
break;
case "directfeedback":
$this->sequence = $this->calculateSequence();
$this->object->getTestSession()->setLastSequence($this->sequence);
$this->object->getTestSession()->saveToDb();
$this->outTestPage();
break;
case "selectImagemapRegion":
$this->sequence = $this->calculateSequence();
$this->object->getTestSession()->setLastSequence($this->sequence);
$this->object->getTestSession()->saveToDb();
$this->outTestPage();
break;
case "summary":
$this->ctrl->redirect($this, "outQuestionSummary");
break;
case "summary_obligations":
$this->ctrl->redirect($this, "outQuestionSummaryWithObligationsInfo");
break;
case "summary_obligations_only":
$this->ctrl->redirect($this, "outObligationsOnlySummary");
break;
case "start":
$_SESSION['tst_pass_finish'] = 0;
$this->object->createTestSession();
$active_id = $this->object->getTestSession()->getActiveId();
assQuestion::_updateTestPassResults($active_id, $this->object->getTestSession()->getPass(), $this->object->areObligationsEnabled());
$this->ctrl->setParameter($this, "active_id", $active_id);
$shuffle = $this->object->getShuffleQuestions();
//.........这里部分代码省略.........
示例3: _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;
}
}
示例4: startTestCmd
protected function startTestCmd()
{
global $ilUser;
// ensure existing test session
$this->testSession->setRefId($this->object->getRefId());
$this->testSession->setTestId($this->object->getTestId());
$this->testSession->setUserId($ilUser->getId());
$this->testSession->setAnonymousId($_SESSION['tst_access_code'][$this->object->getTestId()]);
$this->testSession->setCurrentQuestionId(null);
// no question "came up" yet
$this->testSession->saveToDb();
$this->ctrl->setParameter($this, 'active_id', $this->testSession->getActiveId());
assQuestion::_updateTestPassResults($this->testSession->getActiveId(), $this->testSession->getPass());
$_SESSION['active_time_id'] = $this->object->startWorkingTime($this->testSession->getActiveId(), $this->testSession->getPass());
$this->ctrl->saveParameter($this, 'tst_javascript');
if ($this->dynamicQuestionSetConfig->isTaxonomyFilterEnabled()) {
$this->ctrl->redirect($this, self::CMD_SHOW_QUESTION_SELECTION);
}
$this->ctrl->redirect($this, self::CMD_SHOW_QUESTION);
}
示例5: _isPassed
/**
* Returns TRUE if the user with the user id $user_id passed the test with the object id $a_obj_id
*
* @param int $user_id The user id
* @param int $a_obj_id The object id
* @return boolean TRUE if the user passed the test, FALSE otherwise
*/
public static function _isPassed($user_id, $a_obj_id)
{
global $ilDB;
$result = $ilDB->queryF("SELECT tst_result_cache.* FROM tst_result_cache, tst_active, tst_tests WHERE tst_active.test_fi = tst_tests.test_id AND tst_active.user_fi = %s AND tst_tests.obj_fi = %s AND tst_result_cache.active_fi = tst_active.active_id", array('integer', 'integer'), array($user_id, $a_obj_id));
if (!$result->numRows()) {
$result = $ilDB->queryF("SELECT tst_active.active_id FROM tst_active, tst_tests WHERE tst_active.test_fi = tst_tests.test_id AND tst_active.user_fi = %s AND tst_tests.obj_fi = %s", array('integer', 'integer'), array($user_id, $a_obj_id));
$row = $ilDB->fetchAssoc($result);
if ($row['active_id'] > 0) {
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
assQuestion::_updateTestResultCache($row['active_id']);
} else {
return false;
}
}
$result = $ilDB->queryF("SELECT tst_result_cache.* FROM tst_result_cache, tst_active, tst_tests WHERE tst_active.test_fi = tst_tests.test_id AND tst_active.user_fi = %s AND tst_tests.obj_fi = %s AND tst_result_cache.active_fi = tst_active.active_id", array('integer', 'integer'), array($user_id, $a_obj_id));
if (!$result->numRows()) {
$result = $ilDB->queryF("SELECT tst_pass_result.*, tst_tests.pass_scoring, tst_tests.random_test, tst_tests.test_id FROM tst_pass_result, tst_active, tst_tests WHERE tst_active.test_fi = tst_tests.test_id AND tst_active.user_fi = %s AND tst_tests.obj_fi = %s AND tst_pass_result.active_fi = tst_active.active_id ORDER BY tst_pass_result.pass", array('integer', 'integer'), array($user_id, $a_obj_id));
$points = array();
while ($row = $ilDB->fetchAssoc($result)) {
array_push($points, $row);
}
$reached = 0;
$max = 0;
if ($points[0]["pass_scoring"] == 0) {
$reached = $points[count($points) - 1]["points"];
$max = $points[count($points) - 1]["maxpoints"];
if (!$max) {
$active_id = $points[count($points) - 1]["active_fi"];
$pass = $points[count($points) - 1]["pass"];
if (strlen($active_id) && strlen($pass)) {
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$res = assQuestion::_updateTestPassResults($active_id, $pass);
$max = $res['maxpoints'];
$reached = $res['points'];
}
}
} else {
foreach ($points as $row) {
if ($row["points"] > $reached) {
$reached = $row["points"];
$max = $row["maxpoints"];
if (!$max) {
$active_id = $row["active_fi"];
$pass = $row["pass"];
if (strlen($active_id) && strlen($pass)) {
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
assQuestion::_updateTestPassResults($active_id, $pass);
$max = $res['maxpoints'];
$reached = $res['points'];
}
}
}
}
}
include_once "./Modules/Test/classes/class.assMarkSchema.php";
$percentage = !$max ? 0 : $reached / $max * 100.0;
$mark = ASS_MarkSchema::_getMatchingMarkFromObjId($a_obj_id, $percentage);
return $mark["passed"] ? TRUE : FALSE;
} else {
$row = $ilDB->fetchAssoc($result);
return $row['passed'] ? true : false;
}
}
示例6: startTestCmd
protected function startTestCmd()
{
global $ilUser;
$this->testSession->setCurrentQuestionId(null);
// no question "came up" yet
$this->testSession->saveToDb();
$this->ctrl->setParameter($this, 'active_id', $this->testSession->getActiveId());
assQuestion::_updateTestPassResults($this->testSession->getActiveId(), $this->testSession->getPass(), false, null, $this->object->id);
$_SESSION['active_time_id'] = $this->object->startWorkingTime($this->testSession->getActiveId(), $this->testSession->getPass());
$this->ctrl->saveParameter($this, 'tst_javascript');
if ($this->dynamicQuestionSetConfig->isAnyQuestionFilterEnabled()) {
$this->ctrl->redirect($this, self::CMD_SHOW_QUESTION_SELECTION);
}
$this->ctrl->redirect($this, self::CMD_SHOW_QUESTION);
}