diff --git a/main/exercice/exercice.php b/main/exercice/exercice.php
index ad334831eb..fb9fc9a236 100755
--- a/main/exercice/exercice.php
+++ b/main/exercice/exercice.php
@@ -200,10 +200,7 @@ if ($show == 'result' && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit
Database::query($recording_changes);
}
- $qry = 'SELECT DISTINCT question_id, marks
- FROM ' . $TBL_TRACK_ATTEMPT . ' where exe_id = ' . $id . '
- GROUP BY question_id';
-
+ $qry = 'SELECT DISTINCT question_id, marks FROM ' . $TBL_TRACK_ATTEMPT . ' where exe_id = ' . $id . ' GROUP BY question_id';
$res = Database::query($qry);
$tot = 0;
while ($row = Database :: fetch_array($res, 'ASSOC')) {
@@ -582,7 +579,7 @@ $condition_session = api_get_session_condition($session_id,true,true);
// only for administrator
if ($is_allowedToEdit) {
if ($show == 'test') {
- $sql = "SELECT id, title, type, active, description, results_disabled, session_id, start_time, end_time FROM $TBL_EXERCICES WHERE active<>'-1' $condition_session ORDER BY title LIMIT " . (int) $from . "," . (int) ($limitExPage +1);
+ $sql = "SELECT id, title, type, active, description, results_disabled, session_id, start_time, end_time, random,max_attempt FROM $TBL_EXERCICES WHERE active<>'-1' $condition_session ORDER BY title LIMIT " . (int) $from . "," . (int) ($limitExPage +1);
$result = Database::query($sql);
}
} elseif ($show == 'test') { // only for students
@@ -752,7 +749,7 @@ if ($show == 'test') {
$mylpitemid = (empty ($learnpath_item_id) ? '' : '&learnpath_item_id=' . $learnpath_item_id);
$token = Security::get_token();
- while ($row = Database :: fetch_array($result)) {
+ while ($row = Database :: fetch_array($result,'ASSOC')) {
//validacion when belongs to a session
$session_img = api_get_session_image($row['session_id'], $_user['status']);
@@ -780,9 +777,8 @@ if ($show == 'test') {
$s_class = "row_even";
// prof only
if ($is_allowedToEdit) {
- echo '
';
-
- echo '| '.Display::return_icon('quiz.gif', get_lang('Exercice')).' | ';
+ echo '
';
+ echo '| '.Display::return_icon('quiz.gif', get_lang('Exercice')) .' | ';
echo ''.($i+($page*$limitExPage)).'.'.' | ';
//Showing exercise title
@@ -807,12 +803,15 @@ if ($show == 'test') {
$sqlresult = Database::query($sqlquery);
$rowi = Database :: result($sqlresult, 0);
- //count number random exercice - teacher
- $sql_random_query = 'SELECT type,random,active,results_disabled,max_attempt FROM ' . $TBL_EXERCICES . ' WHERE id="' . Database :: escape_string($exid) . '" ';
+ //useless query
+ /*$sql_random_query = 'SELECT type,random,active,results_disabled,max_attempt FROM ' . $TBL_EXERCICES . ' WHERE id="' . Database :: escape_string($exid) . '" ';
$rs_random = Database::query($sql_random_query);
- $row_random = Database :: fetch_array($rs_random);
- if ($row_random['random'] > 0) {
- echo $row_random['random'] . ' ' . api_strtolower(get_lang(($row_random['random'] > 1 ? 'Questions' : 'Question'))) . '';
+ $row_random = Database :: fetch_array($rs_random);*/
+
+ $random_label = '';
+ if ($row['random'] > 0) {
+ $random_label = ' ('.get_lang('Random').') ';
+ echo $row['random'] . ' ' . api_strtolower(get_lang(($row['random'] > 1 ? 'Questions' : 'Question'))) .$random_label. '';
} else {
echo $rowi . ' ' . api_strtolower(get_lang(($rowi > 1 ? 'Questions' : 'Question'))) . '';
}
diff --git a/main/inc/lib/events.lib.inc.php b/main/inc/lib/events.lib.inc.php
index 6211030465..e59b2dbc48 100755
--- a/main/inc/lib/events.lib.inc.php
+++ b/main/inc/lib/events.lib.inc.php
@@ -117,20 +117,11 @@ function event_access_course() {
} else {
$user_id = "0"; // no one
}
- $sql = "INSERT INTO ".$TABLETRACK_ACCESS."
- (access_user_id,
- access_cours_code,
- access_date,
- access_session_id)
- VALUES
- (".$user_id.",
- '".$_cid."',
- '".$reallyNow."',
- '".$id_session."')";
+ $sql = "INSERT INTO ".$TABLETRACK_ACCESS." (access_user_id, access_cours_code, access_date, access_session_id) VALUES
+ (".$user_id.", '".$_cid."', '".$reallyNow."','".$id_session."')";
$res = Database::query($sql);
// added for "what's new" notification
- $sql = "UPDATE $TABLETRACK_LASTACCESS
- SET access_date = '$reallyNow'
+ $sql = "UPDATE $TABLETRACK_LASTACCESS SET access_date = '$reallyNow'
WHERE access_user_id = $user_id AND access_cours_code = '$_cid' AND access_tool IS NULL AND access_session_id=".$id_session;
$res = Database::query($sql);
if (Database::affected_rows() == 0) {
@@ -348,8 +339,7 @@ function event_link($link_id) {
* @desc Record result of user when an exercice was done
*/
function update_event_exercice($exeid, $exo_id, $score, $weighting,$session_id,$learnpath_id=0, $learnpath_item_id=0, $learnpath_item_view_id = 0, $duration) {
- if ($exeid!='') {
-
+ if ($exeid!='') {
// Validation in case of fraud with actived control time
if (!exercise_time_control_is_valid($exo_id)) {
$score = 0;
@@ -383,8 +373,8 @@ function update_event_exercice($exeid, $exo_id, $score, $weighting,$session_id,$
//Deleting control time session track
exercise_time_control_delete($exo_id);
- error_log('update_event_exercice');
- error_log($sql);
+ //error_log('update_event_exercice');
+ //error_log($sql);
return $res;
} else
@@ -531,8 +521,7 @@ function exercise_attempt_hotspot($exe_id, $question_id, $answer_id, $correct, $
}
$tbl_track_e_hotspot = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
- $sql = "INSERT INTO $tbl_track_e_hotspot " .
- "(hotspot_user_id, hotspot_course_code, hotspot_exe_id, hotspot_question_id, hotspot_answer_id, hotspot_correct, hotspot_coordinate)".
+ $sql = "INSERT INTO $tbl_track_e_hotspot (hotspot_user_id, hotspot_course_code, hotspot_exe_id, hotspot_question_id, hotspot_answer_id, hotspot_correct, hotspot_coordinate)".
" VALUES ('" . Database :: escape_string($_user['user_id']) . "'," .
" '" . api_get_course_id() . "', " .
" '" . Database :: escape_string($exe_id) . "', " .