本文整理汇总了PHP中ExerciseLib类的典型用法代码示例。如果您正苦于以下问题:PHP ExerciseLib类的具体用法?PHP ExerciseLib怎么用?PHP ExerciseLib使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ExerciseLib类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exercise_time_control_is_valid
/**
* Validates the time control key
*/
public static function exercise_time_control_is_valid($exercise_id, $lp_id = 0, $lp_item_id = 0)
{
$course_id = api_get_course_int_id();
$exercise_id = intval($exercise_id);
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$sql = "SELECT expired_time FROM {$TBL_EXERCICES} WHERE c_id = {$course_id} AND iid = {$exercise_id}";
$result = Database::query($sql);
$row = Database::fetch_array($result, 'ASSOC');
if (!empty($row['expired_time'])) {
$current_expired_time_key = ExerciseLib::get_time_control_key($exercise_id, $lp_id, $lp_item_id);
if (isset($_SESSION['expired_time'][$current_expired_time_key])) {
$current_time = time();
$expired_time = api_strtotime($_SESSION['expired_time'][$current_expired_time_key], 'UTC');
$total_time_allowed = $expired_time + 30;
//error_log('expired time converted + 30: '.$total_time_allowed);
//error_log('$current_time: '.$current_time);
if ($total_time_allowed < $current_time) {
return false;
}
return true;
} else {
return false;
}
} else {
return true;
}
}
示例2: return_exercise_block
function return_exercise_block($personal_course_list)
{
$exercise_list = array();
if (!empty($personal_course_list)) {
foreach ($personal_course_list as $course_item) {
$course_code = $course_item['c'];
$session_id = $course_item['id_session'];
$exercises = ExerciseLib::get_exercises_to_be_taken($course_code, $session_id);
foreach ($exercises as $exercise_item) {
$exercise_item['course_code'] = $course_code;
$exercise_item['session_id'] = $session_id;
$exercise_item['tms'] = api_strtotime($exercise_item['end_time'], 'UTC');
$exercise_list[] = $exercise_item;
}
}
if (!empty($exercise_list)) {
$exercise_list = ArrayClass::msort($exercise_list, 'tms');
$my_exercise = $exercise_list[0];
$url = Display::url($my_exercise['title'], api_get_path(WEB_CODE_PATH) . 'exercice/overview.php?exerciseId=' . $my_exercise['id'] . '&cidReq=' . $my_exercise['course_code'] . '&id_session=' . $my_exercise['session_id']);
$this->tpl->assign('exercise_url', $url);
$this->tpl->assign('exercise_end_date', api_convert_and_format_date($my_exercise['end_time'], DATE_FORMAT_SHORT));
}
}
}
示例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 {
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]);
}
}
示例4: foreach
foreach ($exercise_data as $exercise_item) {
$result_list = $exercise_item['results'];
$exercise_info = $exercise_item['exercise_data'];
if ($exercise_info->start_time == '0000-00-00 00:00:00') {
$start_date = '-';
} else {
$start_date = $exercise_info->start_time;
}
if (!empty($result_list)) {
foreach ($result_list as $exercise_result) {
$platform_score = ExerciseLib::show_score($exercise_result['exe_result'], $exercise_result['exe_weighting']);
$my_score = 0;
if (!empty($exercise_result['exe_weighting']) && intval($exercise_result['exe_weighting']) != 0) {
$my_score = $exercise_result['exe_result'] / $exercise_result['exe_weighting'];
}
$position = ExerciseLib::get_exercise_result_ranking($my_score, $exercise_result['exe_id'], $my_exercise_id, $my_course_code, $session_id, $user_list);
$exercise_info->exercise = Display::url($exercise_info->exercise, api_get_path(WEB_CODE_PATH) . "exercice/result.php?cidReq={$my_course_code}&id={$exercise_result['exe_id']}&id_session={$session_id}&show_headers=1", array('target' => SESSION_LINK_TARGET, 'class' => 'exercise-result-link'));
$my_real_array[] = array('status' => Display::return_icon('quiz.gif', get_lang('Attempted'), '', ICON_SIZE_SMALL), 'date' => $start_date, 'course' => $course_data['name'], 'exercise' => $exercise_info->exercise, 'attempt' => $counter, 'result' => $platform_score, 'best_result' => $best_score, 'position' => $position);
$counter++;
}
} else {
// We check the date validation of the exercise if the user can make it
if ($exercise_info->start_time != '0000-00-00 00:00:00') {
$allowed_time = api_strtotime($exercise_info->start_time, 'UTC');
if ($now < $allowed_time) {
continue;
}
}
$exercise_info->exercise = Display::url($exercise_info->exercise, api_get_path(WEB_CODE_PATH) . "exercice/overview.php?cidReq={$my_course_code}&exerciseId={$exercise_info->id}&id_session={$session_id}", array('target' => SESSION_LINK_TARGET));
$new_exercises[] = array('status' => Display::return_icon('star.png', get_lang('New'), array('width' => ICON_SIZE_SMALL)), 'date' => $start_date, 'course' => $course_data['name'], 'exercise' => $exercise_info->exercise, 'attempt' => '-', 'result' => '-', 'best_result' => '-', 'position' => '-');
}
示例5: header
}
if (empty($objExercise)) {
if (!empty($_SESSION['objExercise'])) {
$objExercise = Session::read('objExercise');
} else {
$objExercise = null;
}
}
if (!$objExercise) {
//Redirect to the exercise overview
//Check if the exe_id exists
header("Location: overview.php?exerciseId=" . $exerciseId);
exit;
}
$time_control = false;
$clock_expired_time = ExerciseLib::get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
if ($objExercise->expired_time != 0 && !empty($clock_expired_time)) {
$time_control = true;
}
if ($time_control) {
// Get time left for exipiring time
$time_left = api_strtotime($clock_expired_time, 'UTC') - time();
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH) . 'javascript/epiclock/stylesheet/jquery.epiclock.css');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH) . 'javascript/epiclock/renderers/minute/epiclock.minute.css');
$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.dateformat.min.js');
$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.epiclock.min.js');
$htmlHeadXtra[] = api_get_js('epiclock/renderers/minute/epiclock.minute.js');
$htmlHeadXtra[] = $objExercise->show_time_control_js($time_left);
}
$exe_id = intval(Session::read('exe_id'));
$exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id);
示例6: api_not_allowed
break;
case 'csv':
default:
$export->exportCompleteReportCSV($documentPath, null, $loadExtraData, null, $_GET['exerciseId']);
exit;
break;
}
} else {
api_not_allowed(true);
}
}
//Send student email @todo move this code in a class, library
if (isset($_REQUEST['comments']) && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit || $is_tutor || $allowCoachFeedbackExercises)) {
//filtered by post-condition
$id = intval($_GET['exeid']);
$track_exercise_info = ExerciseLib::get_exercise_track_exercise_info($id);
if (empty($track_exercise_info)) {
api_not_allowed();
}
$test = $track_exercise_info['title'];
$student_id = $track_exercise_info['exe_user_id'];
$session_id = $track_exercise_info['session_id'];
$lp_id = $track_exercise_info['orig_lp_id'];
//$lp_item_id = $track_exercise_info['orig_lp_item_id'];
$lp_item_view_id = $track_exercise_info['orig_lp_item_view_id'];
$course_info = api_get_course_info();
// Teacher data
$teacher_info = api_get_user_info(api_get_user_id());
$from_name = api_get_person_name($teacher_info['firstname'], $teacher_info['lastname'], null, PERSON_NAME_EMAIL_ADDRESS);
$url = api_get_path(WEB_CODE_PATH) . 'exercice/result.php?id=' . $track_exercise_info['exe_id'] . '&' . api_get_cidreq() . '&show_headers=1&id_session=' . $session_id;
$my_post_info = array();
示例7: get_stats_table_by_attempt
/**
* Returns a category summary report
*
* @param int exercise id
* @param array prefilled array with the category_id, score, and weight example: array(1 => array('score' => '10', 'total' => 20));
* @param bool $categoryMinusOne shows category - 1 see BT#6540
* @return string
*/
public static function get_stats_table_by_attempt($exercise_id, $category_list = array(), $categoryMinusOne = false)
{
if (empty($category_list)) {
return null;
}
$category_name_list = Testcategory::getListOfCategoriesNameForTest($exercise_id, false);
$table = new HTML_Table(array('class' => 'data_table'));
$table->setHeaderContents(0, 0, get_lang('Categories'));
$table->setHeaderContents(0, 1, get_lang('AbsoluteScore'));
$table->setHeaderContents(0, 2, get_lang('RelativeScore'));
$row = 1;
$none_category = array();
if (isset($category_list['none'])) {
$none_category = $category_list['none'];
unset($category_list['none']);
}
$total = array();
if (isset($category_list['total'])) {
$total = $category_list['total'];
unset($category_list['total']);
}
$em = Database::getManager();
$repo = $em->getRepository('ChamiloCoreBundle:CQuizCategory');
$redefineCategoryList = array();
if (!empty($category_list) && count($category_list) > 1) {
$globalCategoryScore = array();
foreach ($category_list as $category_id => $category_item) {
$cat = $em->find('ChamiloCoreBundle:CQuizCategory', $category_id);
$path = $repo->getPath($cat);
$categoryName = $category_name_list[$category_id];
$index = 0;
if ($categoryMinusOne) {
$index = 1;
}
if (isset($path[$index])) {
$category_id = $path[$index]->getIid();
$categoryName = $path[$index]->getTitle();
}
if (!isset($globalCategoryScore[$category_id])) {
$globalCategoryScore[$category_id] = array();
$globalCategoryScore[$category_id]['score'] = 0;
$globalCategoryScore[$category_id]['total'] = 0;
$globalCategoryScore[$category_id]['title'] = '';
}
$globalCategoryScore[$category_id]['score'] += $category_item['score'];
$globalCategoryScore[$category_id]['total'] += $category_item['total'];
$globalCategoryScore[$category_id]['title'] = $categoryName;
}
foreach ($globalCategoryScore as $category_item) {
$table->setCellContents($row, 0, $category_item['title']);
$table->setCellContents($row, 1, ExerciseLib::show_score($category_item['score'], $category_item['total'], false));
$table->setCellContents($row, 2, ExerciseLib::show_score($category_item['score'], $category_item['total'], true, false, true));
$class = 'class="row_odd"';
if ($row % 2) {
$class = 'class="row_even"';
}
$table->setRowAttributes($row, $class, true);
$row++;
}
if (!empty($none_category)) {
$table->setCellContents($row, 0, get_lang('None'));
$table->setCellContents($row, 1, ExerciseLib::show_score($none_category['score'], $none_category['total'], false));
$table->setCellContents($row, 2, ExerciseLib::show_score($none_category['score'], $none_category['total'], true, false, true));
$row++;
}
if (!empty($total)) {
$table->setCellContents($row, 0, get_lang('Total'));
$table->setCellContents($row, 1, ExerciseLib::show_score($total['score'], $total['total'], false));
$table->setCellContents($row, 2, ExerciseLib::show_score($total['score'], $total['total'], true, false, true));
$table->setRowAttributes($row, 'class="row_total"', true);
}
return $table->toHtml();
}
return null;
}
示例8: array
if (!(api_is_allowed_to_edit() || api_is_coach())) {
return array();
}
require_once api_get_path(SYS_CODE_PATH) . 'work/work.lib.php';
$columns = array('student', 'works');
$result = getWorkUserListData($workId, api_get_course_id(), api_get_session_id(), api_get_group_id(), $start, $limit, $sidx, $sord);
break;
case 'get_hotpotatoes_exercise_results':
$course = api_get_course_info();
$documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
if (api_is_allowed_to_edit(null, true) || api_is_drh()) {
$columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date', 'score', 'actions');
} else {
$columns = array('exe_date', 'score', 'actions');
}
$result = ExerciseLib::get_exam_results_hotpotatoes_data($start, $limit, $sidx, $sord, $hotpot_path, $whereCondition);
break;
case 'get_sessions_tracking':
if (api_is_drh()) {
$sessions = SessionManager::get_sessions_followed_by_drh(api_get_user_id(), $start, $limit, false, false, false, null, $keyword, $description);
} else {
// Sessions for the coach
$sessions = Tracking::get_sessions_coached_by_user(api_get_user_id(), $start, $limit, false, $keyword, $description);
}
$columns = array('name', 'date', 'course_per_session', 'student_per_session', 'details');
$result = array();
if (!empty($sessions)) {
foreach ($sessions as $session) {
if (api_drh_can_access_all_session_content()) {
$count_courses_in_session = count(SessionManager::get_course_list_by_session_id($session['id']));
} else {
示例9: array
if (empty($objQuestionTmp->level)) {
$txtQuestionLevel = '-';
}
$questionLevel = Display::tag('div', $txtQuestionLevel, array('style' => $styleLevel));
// Question score
$questionScore = Display::tag('div', $objQuestionTmp->selectWeighting(), array('style' => $styleScore));
echo '<div id="question_id_list_' . $id . '" >';
echo '<div class="header_operations">';
echo $questionName;
echo $questionType;
echo $questionCategory;
echo $questionLevel;
echo $questionScore;
echo $actions;
echo '</div>';
echo '<div class="question-list-description-block">';
echo '<p class="lead">' . get_lang($question_class) . '</p>';
//echo get_lang('Level').': '.$objQuestionTmp->selectLevel();
ExerciseLib::showQuestion($id, false, null, null, false, true, false, true, $objExercise->feedback_type, true);
echo '</div>';
echo '</div>';
unset($objQuestionTmp);
}
}
}
if (!$nbrQuestions) {
echo Display::display_warning_message(get_lang('NoQuestion'));
}
echo '</div>';
//question list div
}
示例10: Exercise
$mytime = (int) $time_exe_date - (int) $time_start_date;
$score = (double) $row_dates['exe_result'];
$max_score = (double) $row_dates['exe_weighting'];
$sql = "UPDATE {$TBL_LP_ITEM} SET\n max_score = '{$max_score}'\n WHERE c_id = {$course_id} AND id = '" . $safe_item_id . "'";
Database::query($sql);
$sql = "SELECT id FROM {$TBL_LP_ITEM_VIEW}\n WHERE\n c_id = {$course_id} AND\n lp_item_id = '{$safe_item_id}' AND\n lp_view_id = '" . $learnPath->lp_view_id . "'\n ORDER BY id DESC\n LIMIT 1";
$res_last_attempt = Database::query($sql);
if (Database::num_rows($res_last_attempt) && !api_is_invitee()) {
$row_last_attempt = Database::fetch_row($res_last_attempt);
$lp_item_view_id = $row_last_attempt[0];
$exercise = new Exercise(api_get_course_int_id());
$exercise->read($row_dates['exe_exo_id']);
$status = 'completed';
if (!empty($exercise->pass_percentage)) {
$status = 'failed';
$success = ExerciseLib::is_success_exercise_result($score, $max_score, $exercise->pass_percentage);
if ($success) {
$status = 'passed';
}
}
$sql = "UPDATE {$TBL_LP_ITEM_VIEW} SET\n status = '{$status}',\n score = {$score},\n total_time = {$mytime}\n WHERE id='" . $lp_item_view_id . "' AND c_id = {$course_id} ";
if ($debug) {
error_log($sql);
}
Database::query($sql);
$sql = "UPDATE {$TBL_TRACK_EXERCICES} SET\n orig_lp_item_view_id = {$lp_item_view_id}\n WHERE exe_id = " . $safe_exe_id;
Database::query($sql);
}
}
if (intval($_GET['fb_type']) > 0) {
$src = 'blank.php?msg=exerciseFinished';
示例11: array
if (isset($exerciseLevel) && $exerciseLevel != -1) {
$filter .= ' AND level=' . $exerciseLevel . ' ';
}
if (isset($answerType) && $answerType > 0) {
$filter .= ' AND qu.type=' . $answerType . ' ';
}
if (!empty($session_id) && $session_id != '-1') {
$main_question_list = array();
if (!empty($course_list)) {
foreach ($course_list as $course_item) {
if (!empty($selected_course) && $selected_course != '-1') {
if ($selected_course != $course_item['id']) {
continue;
}
}
$exercise_list = ExerciseLib::get_all_exercises($course_item, $session_id);
if (!empty($exercise_list)) {
foreach ($exercise_list as $exercise) {
$my_exercise = new Exercise($course_item['id']);
$my_exercise->read($exercise['id']);
if (!empty($my_exercise)) {
if (!empty($my_exercise->questionList)) {
foreach ($my_exercise->questionList as $question_id) {
$question_obj = Question::read($question_id, $course_item['id']);
if ($exerciseLevel != '-1') {
if ($exerciseLevel != $question_obj->level) {
continue;
}
}
if ($answerType > 0) {
if ($answerType != $question_obj->type) {
示例12: array
$my_attempt_array = array();
$table_content = '';
/* Make a special case for IE, which doesn't seem to be able to handle the
* results popup -> send it to the full results page */
$browser = new Browser();
$current_browser = $browser->getBrowser();
$url_suffix = '';
$btn_class = 'ajax ';
if ($current_browser == 'Internet Explorer') {
$url_suffix = '&show_headers=1';
$btn_class = '';
}
if (!empty($attempts)) {
$i = $counter;
foreach ($attempts as $attempt_result) {
$score = ExerciseLib::show_score($attempt_result['exe_result'], $attempt_result['exe_weighting']);
$attempt_url = api_get_path(WEB_CODE_PATH) . 'exercice/result.php?' . api_get_cidreq() . '&id=' . $attempt_result['exe_id'] . '&id_session=' . api_get_session_id() . '&height=500&width=950' . $url_suffix;
$attempt_link = Display::url(get_lang('Show'), $attempt_url, array('class' => $btn_class . 'btn'));
$teacher_revised = Display::label(get_lang('Validated'), 'success');
//$attempt_link = get_lang('NoResult');
//$attempt_link = Display::return_icon('quiz_na.png', get_lang('NoResult'), array(), ICON_SIZE_SMALL);
if ($attempt_result['attempt_revised'] == 0) {
$teacher_revised = Display::label(get_lang('NotValidated'), 'info');
}
$row = array('count' => $i, 'date' => api_convert_and_format_date($attempt_result['start_date'], DATE_TIME_FORMAT_LONG));
$attempt_link .= " " . $teacher_revised;
if (in_array($objExercise->results_disabled, array(RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS, RESULT_DISABLE_SHOW_SCORE_ONLY, RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES))) {
$row['result'] = $score;
}
if (in_array($objExercise->results_disabled, array(RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS, RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES)) || $objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_ONLY && $objExercise->feedback_type == EXERCISE_FEEDBACK_TYPE_END) {
$row['attempt_link'] = $attempt_link;
示例13: sprintf
if ($row['start_time'] != '0000-00-00 00:00:00') {
$attempt_text = sprintf(get_lang('ExerciseAvailableFromX'), api_convert_and_format_date($row['start_time']));
}
if ($row['end_time'] != '0000-00-00 00:00:00') {
$attempt_text = sprintf(get_lang('ExerciseAvailableUntilX'), api_convert_and_format_date($row['end_time']));
}
}
}
} else {
//Normal behaviour
//Show results
if ($my_result_disabled == 0 || $my_result_disabled == 2) {
if ($num > 0) {
$row_track = Database::fetch_array($qryres);
$attempt_text = get_lang('LatestAttempt') . ' : ';
$attempt_text .= ExerciseLib::show_score($row_track['exe_result'], $row_track['exe_weighting']);
} else {
$attempt_text = get_lang('NotAttempted');
}
} else {
$attempt_text = get_lang('CantShowResults');
}
}
$class_tip = '';
if (empty($num)) {
$num = '';
} else {
$class_tip = 'link_tooltip';
//@todo use sprintf and show the results validated by the teacher
if ($num == 1) {
$num = $num . ' ' . get_lang('Result');
示例14: cut
$count = ExerciseLib::get_number_students_answer_hotspot_count($answer_id, $question_id, $exercise_id, $courseCode, $sessionId);
$percentange = 0;
if (!empty($count_students)) {
$percentange = $count / $count_students * 100;
}
$data[$id]['attempts'] = Display::bar_progress($percentange, false, $count . ' / ' . $count_students);
break;
default:
if ($answer_id == 1) {
$data[$id]['name'] = cut($question_obj->question, 100);
} else {
$data[$id]['name'] = '-';
}
$data[$id]['answer'] = $answer_info;
$data[$id]['correct'] = $correct_answer;
$count = ExerciseLib::get_number_students_answer_count($real_answer_id, $question_id, $exercise_id, $courseCode, $sessionId);
$percentange = 0;
if (!empty($count_students)) {
$percentange = $count / $count_students * 100;
}
$data[$id]['attempts'] = Display::bar_progress($percentange, false, $count . ' / ' . $count_students);
}
$id++;
}
}
}
// Format A table
$table = new HTML_Table(array('class' => 'data_table'));
$row = 0;
$column = 0;
foreach ($headers as $header) {
示例15: 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);
}
}