本文整理汇总了PHP中ilLanguage::txtlng方法的典型用法代码示例。如果您正苦于以下问题:PHP ilLanguage::txtlng方法的具体用法?PHP ilLanguage::txtlng怎么用?PHP ilLanguage::txtlng使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilLanguage
的用法示例。
在下文中一共展示了ilLanguage::txtlng方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: calculateResultsFromSolution
/**
* Calculates the question results from a previously saved question solution
*
* @final
* @global ilDB $ilDB
* @global ilObjUser $ilUser
* @param integer $active_id Active id of the user
* @param integer $pass Test pass
*/
public final function calculateResultsFromSolution($active_id, $pass = NULL, $obligationsEnabled = false)
{
global $ilDB, $ilUser;
if (is_null($pass)) {
include_once "./Modules/Test/classes/class.ilObjTest.php";
$pass = ilObjTest::_getPass($active_id);
}
// determine reached points for submitted solution
$reached_points = $this->calculateReachedPoints($active_id, $pass);
// deduct points for requested hints from reached points
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
$questionHintTracking = new ilAssQuestionHintTracking($this->getId(), $active_id, $pass);
$requestsStatisticData = $questionHintTracking->getRequestStatisticDataByQuestionAndTestpass();
$reached_points = $reached_points - $requestsStatisticData->getRequestsPoints();
// adjust reached points regarding to tests scoring options
$reached_points = $this->adjustReachedPointsByScoringOptions($reached_points, $active_id, $pass);
if ($obligationsEnabled && ilObjTest::isQuestionObligatory($this->getId())) {
$isAnswered = $this->isAnswered($active_id, $pass);
} else {
$isAnswered = true;
}
if (is_null($reached_points)) {
$reached_points = 0;
}
$this->getProcessLocker()->requestUserQuestionResultUpdateLock();
$query = "\n\t\t\tDELETE FROM\t\ttst_test_result\n\t\t\t\n\t\t\tWHERE\t\t\tactive_fi = %s\n\t\t\tAND\t\t\t\tquestion_fi = %s\n\t\t\tAND\t\t\t\tpass = %s\n\t\t";
$types = array('integer', 'integer', 'integer');
$values = array($active_id, $this->getId(), $pass);
if ($this->getStep() !== NULL) {
$query .= "\n\t\t\t\tAND\t\t\t\tstep = %s\n\t\t\t";
$types[] = 'integer';
$values[] = $this->getStep();
}
$affectedRows = $ilDB->manipulateF($query, $types, $values);
$next_id = $ilDB->nextId("tst_test_result");
$fieldData = array('test_result_id' => array('integer', $next_id), 'active_fi' => array('integer', $active_id), 'question_fi' => array('integer', $this->getId()), 'pass' => array('integer', $pass), 'points' => array('float', $reached_points), 'tstamp' => array('integer', time()), 'hint_count' => array('integer', $requestsStatisticData->getRequestsCount()), 'hint_points' => array('float', $requestsStatisticData->getRequestsPoints()), 'answered' => array('integer', $isAnswered));
if ($this->getStep() !== NULL) {
$fieldData['step'] = array('integer', $this->getStep());
}
$ilDB->insert('tst_test_result', $fieldData);
$this->getProcessLocker()->releaseUserQuestionResultUpdateLock();
include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
if (ilObjAssessmentFolder::_enabledAssessmentLogging()) {
$this->logAction(sprintf($this->lng->txtlng("assessment", "log_user_answered_question", ilObjAssessmentFolder::_getLogLanguage()), $reached_points), $active_id, $this->getId());
}
// update test pass results
$this->_updateTestPassResults($active_id, $pass, $obligationsEnabled, $this->getProcessLocker());
// Update objective status
include_once 'Modules/Course/classes/class.ilCourseObjectiveResult.php';
ilCourseObjectiveResult::_updateObjectiveResult($ilUser->getId(), $active_id, $this->getId());
}