Fix PHP warnings

pull/2487/head
jmontoyaa 9 years ago
parent b362d92fe2
commit 1be243e2a6
  1. 22
      main/exercise/exercise.php
  2. 12
      main/inc/lib/api.lib.php

@ -563,6 +563,8 @@ if (isset($list_ordered) && !empty($list_ordered)) {
$exercise_list = $new_question_list;
}
$tableRows = [];
/* Listing exercises */
if (!empty($exercise_list)) {
if ($origin != 'learnpath') {
@ -895,13 +897,13 @@ if (!empty($exercise_list)) {
// Don't remove this marker: note-query-exe-results
$sql = "SELECT * FROM $TBL_TRACK_EXERCISES
WHERE
exe_exo_id = ".$row['id']." AND
exe_user_id = ".$userId." AND
c_id = ".api_get_course_int_id()." AND
status <> 'incomplete' AND
orig_lp_id = 0 AND
exe_exo_id = ".$row['id']." AND
exe_user_id = $userId AND
c_id = ".api_get_course_int_id()." AND
status <> 'incomplete' AND
orig_lp_id = 0 AND
orig_lp_item_id = 0 AND
session_id = '".api_get_session_id()."'
session_id = '".api_get_session_id()."'
ORDER BY exe_id DESC";
$qryres = Database::query($sql);
@ -967,7 +969,10 @@ if (!empty($exercise_list)) {
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']);
$attempt_text .= ExerciseLib::show_score(
$row_track['exe_result'],
$row_track['exe_weighting']
);
} else {
$attempt_text = get_lang('NotAttempted');
}
@ -1012,8 +1017,7 @@ if (!empty($exercise_list)) {
'id' => 'exercise_list_' . $my_exercise_id,
)
);
} // end foreach()
}
}
}

@ -5045,7 +5045,7 @@ function api_set_setting($var, $value, $subvar = null, $cat = null, $access_url
// Found item for this access_url.
$row = Database::fetch_array($res);
$sql = "UPDATE $t_settings SET selected_value = '$value'
WHERE id = ".$row['id'] ;
WHERE id = ".$row['id'];
Database::query($sql);
} else {
// Item not found for this access_url, we have to check if it exist with access_url = 1
@ -5071,8 +5071,9 @@ function api_set_setting($var, $value, $subvar = null, $cat = null, $access_url
"".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," .
"".(!empty($row['subkeytext'])?"'".$row['subkeytext']."'":"NULL").",$access_url)";
Database::query($insert);
} else { // Such a setting does not exist.
error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all', 0);
} else {
// Such a setting does not exist.
//error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all', 0);
}
} else {
// Other access url.
@ -5084,7 +5085,8 @@ function api_set_setting($var, $value, $subvar = null, $cat = null, $access_url
}
$res = Database::query($select);
if (Database::num_rows($res) > 0) { // We have a setting for access_url 1, but none for the current one, so create one.
if (Database::num_rows($res) > 0) {
// We have a setting for access_url 1, but none for the current one, so create one.
$row = Database::fetch_array($res);
if ($row['access_url_changeable'] == 1) {
$insert = "INSERT INTO $t_settings (variable,subkey, type,category, selected_value,title, comment,scope, subkeytext,access_url, access_url_changeable) VALUES
@ -5098,7 +5100,7 @@ function api_set_setting($var, $value, $subvar = null, $cat = null, $access_url
Database::query($insert);
}
} else { // Such a setting does not exist.
error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all. The access_url is: '.$access_url.' ',0);
//error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all. The access_url is: '.$access_url.' ',0);
}
}
}

Loading…
Cancel
Save