本文整理汇总了PHP中assQuestion::saveWorkingData方法的典型用法代码示例。如果您正苦于以下问题:PHP assQuestion::saveWorkingData方法的具体用法?PHP assQuestion::saveWorkingData怎么用?PHP assQuestion::saveWorkingData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assQuestion
的用法示例。
在下文中一共展示了assQuestion::saveWorkingData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveWorkingData
/**
* Saves the learners input of the question to the database
*
* Saves the learners input of the question to the database
*
* @param integer $test_id The database id of the test containing this question
* @return boolean Indicates the save status (true if saved successful, false otherwise)
* @access public
* @see $ranges
*/
function saveWorkingData($active_id, $pass = NULL)
{
global $ilDB;
global $ilUser;
if (is_null($pass)) {
include_once "./Modules/Test/classes/class.ilObjTest.php";
$pass = ilObjTest::_getPass($active_id);
}
$entered_values = 0;
$query = sprintf("DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s", $ilDB->quote($active_id . ""), $ilDB->quote($this->getId() . ""), $ilDB->quote($pass . ""));
$result = $ilDB->query($query);
foreach ($_POST as $key => $value) {
if (preg_match("/^SYNTAXTREE_(\\d+)/", $key, $matches)) {
if (strlen($value)) {
$tstamp = array("integer", time());
$next_id = $ilDB->nextId('tst_solutions');
$query = sprintf("INSERT INTO tst_solutions (solution_id, active_fi, question_fi, value1, value2, pass, tstamp) VALUES (%s, %s, %s, %s, NULL, %s, %s)", $ilDB->quote($next_id), $ilDB->quote($active_id), $ilDB->quote($this->getId()), $ilDB->quote(trim($value)), $ilDB->quote($pass . ""), $ilDB->quote($tstamp));
$result = $ilDB->query($query);
$entered_values++;
}
}
}
if ($entered_values) {
include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
if (ilObjAssessmentFolder::_enabledAssessmentLogging()) {
$this->logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
}
} else {
include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
if (ilObjAssessmentFolder::_enabledAssessmentLogging()) {
$this->logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
}
}
parent::saveWorkingData($active_id, $pass);
return true;
}