本文整理汇总了PHP中ExerciseLib::exercise_time_control_is_valid方法的典型用法代码示例。如果您正苦于以下问题:PHP ExerciseLib::exercise_time_control_is_valid方法的具体用法?PHP ExerciseLib::exercise_time_control_is_valid怎么用?PHP ExerciseLib::exercise_time_control_is_valid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExerciseLib
的用法示例。
在下文中一共展示了ExerciseLib::exercise_time_control_is_valid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveExerciseAttemptHotspot
/**
* Record an hotspot spot for this attempt at answering an hotspot question
* @param int Exercise ID
* @param int Question ID
* @param int Answer ID
* @param int Whether this answer is correct (1) or not (0)
* @param string Coordinates of this point (e.g. 123;324)
* @param bool update results?
* @return boolean Result of the insert query
* @uses Course code and user_id from global scope $_cid and $_user
*/
public static function saveExerciseAttemptHotspot($exe_id, $question_id, $answer_id, $correct, $coords, $updateResults = false, $exerciseId = 0)
{
global $safe_lp_id, $safe_lp_item_id;
if ($updateResults == false) {
// Validation in case of fraud with activated control time
if (!ExerciseLib::exercise_time_control_is_valid($exerciseId, $safe_lp_id, $safe_lp_item_id)) {
$correct = 0;
}
}
$tbl_track_e_hotspot = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
if ($updateResults) {
$params = array('hotspot_correct' => $correct, 'hotspot_coordinate' => $coords);
Database::update($tbl_track_e_hotspot, $params, array('hotspot_user_id = ? AND hotspot_exe_id = ? AND hotspot_question_id = ? AND hotspot_answer_id = ? ' => array(api_get_user_id(), $exe_id, $question_id, $answer_id, $answer_id)));
} else {
return Database::insert($tbl_track_e_hotspot, ['hotspot_course_code' => api_get_course_id(), 'hotspot_user_id' => api_get_user_id(), 'c_id' => api_get_course_int_id(), 'hotspot_exe_id' => $exe_id, 'hotspot_question_id' => $question_id, 'hotspot_answer_id' => $answer_id, 'hotspot_correct' => $correct, 'hotspot_coordinate' => $coords]);
}
}
示例2: header
if ($origin != 'learnpath') {
//so we are not in learnpath tool
echo '</div>';
//End glossary div
Display::display_footer();
} else {
echo '</body></html>';
}
exit;
}
}
} else {
//Time control is only enabled for ONE PER PAGE
if (!empty($exe_id) && is_numeric($exe_id)) {
//Verify if the current test is fraudulent
$check = ExerciseLib::exercise_time_control_is_valid($exerciseId, $learnpath_id, $learnpath_item_id);
if ($check) {
$sql_exe_result = "";
if ($debug) {
error_log('12. exercise_time_control_is_valid is valid');
}
} else {
$sql_exe_result = ", exe_result = 0";
if ($debug) {
error_log('12. exercise_time_control_is_valid is NOT valid then exe_result = 0 ');
}
}
}
if ($objExercise->review_answers) {
//header('Location: '.$urlMainExercise.'exercise_reminder.php?'.$params);
header("Location: " . $urlMainExercise . "exercise_result.php?" . api_get_cidreq() . "&exe_id={$exe_id}&origin={$origin}&learnpath_id={$learnpath_id}&learnpath_item_id={$learnpath_item_id}&learnpath_item_view_id={$learnpath_item_view_id}");
示例3: saveExerciseAttemptHotspot
/**
* Record an hotspot spot for this attempt at answering an hotspot question
* @param int Exercise ID
* @param int Question ID
* @param int Answer ID
* @param int Whether this answer is correct (1) or not (0)
* @param string Coordinates of this point (e.g. 123;324)
* @param bool update results?
* @return boolean Result of the insert query
* @uses Course code and user_id from global scope $_cid and $_user
*/
public static function saveExerciseAttemptHotspot($exe_id, $question_id, $answer_id, $correct, $coords, $updateResults = false, $exerciseId = 0)
{
global $safe_lp_id, $safe_lp_item_id;
if ($updateResults == false) {
// Validation in case of fraud with activated control time
if (!ExerciseLib::exercise_time_control_is_valid($exerciseId, $safe_lp_id, $safe_lp_item_id)) {
$correct = 0;
}
}
$tbl_track_e_hotspot = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
if ($updateResults) {
$params = array('hotspot_correct' => $correct, 'hotspot_coordinate' => $coords);
Database::update($tbl_track_e_hotspot, $params, array('hotspot_user_id = ? AND hotspot_exe_id = ? AND hotspot_question_id = ? AND hotspot_answer_id = ? ' => array(api_get_user_id(), $exe_id, $question_id, $answer_id, $answer_id)));
} else {
$sql = "INSERT INTO {$tbl_track_e_hotspot} (hotspot_course_code, hotspot_user_id, c_id, hotspot_exe_id, hotspot_question_id, hotspot_answer_id, hotspot_correct, hotspot_coordinate)\n VALUES (\n '" . api_get_course_id() . "',\n " . api_get_user_id() . "'," . " " . api_get_course_int_id() . ", " . " '" . Database::escape_string($exe_id) . "', " . " '" . Database::escape_string($question_id) . "'," . " '" . Database::escape_string($answer_id) . "'," . " '" . Database::escape_string($correct) . "'," . " '" . Database::escape_string($coords) . "')";
return $result = Database::query($sql);
}
}
示例4: saveExerciseAttemptHotspot
/**
* Record an hotspot spot for this attempt at answering an hotspot question
* @param int Exercise ID
* @param int Question ID
* @param int Answer ID
* @param int Whether this answer is correct (1) or not (0)
* @param string Coordinates of this point (e.g. 123;324)
* @param bool update results?
* @return boolean Result of the insert query
* @uses Course code and user_id from global scope $_cid and $_user
*/
public static function saveExerciseAttemptHotspot($exe_id, $question_id, $answer_id, $correct, $coords, $updateResults = false, $exerciseId = 0)
{
global $safe_lp_id, $safe_lp_item_id;
$em = Database::getManager();
if ($updateResults == false) {
// Validation in case of fraud with activated control time
if (!ExerciseLib::exercise_time_control_is_valid($exerciseId, $safe_lp_id, $safe_lp_item_id)) {
$correct = 0;
}
}
if ($updateResults) {
$em->createQuery('
UPDATE ChamiloCoreBundle:TrackEHotspot teh
SET teh.hotspotCorrect = :correct,
teh.hotspotCoordinate = :coords
WHERE teh.hotspotUserId = :user AND teh.hotspotExeId = :exe AND
teh.hotspotQuestionId = :question AND teh.hotspotAnswerId = :answer
')->execute(['correct' => $correct, 'coords' => $coords, 'user' => api_get_user_id(), 'exe' => $exe_id, 'question' => $question_id, 'answer' => $answer_id]);
} else {
$course = $em->find('ChamiloCoreBundle:', api_get_course_int_id());
$trackEHotspot = new \Chamilo\CoreBundle\Entity\TrackEHotspot();
$trackEHotspot->setCourse($course)->setHotspotUserId(api_get_user_id())->setHotspotExeId($exe_id)->setHotspotQuestionId($question_id)->setHotspotAnswerId($answer_id)->setHotspotCorrect($correct)->setHotspotCoordinate($coords);
$em->persist($trackEHotspot);
$em->flush();
return $trackEHotspot->getHotspotId();
}
}