Minor - format code fix php warning

pull/3213/head
Julio Montoya 6 years ago
parent 2b92ced895
commit 67b61d8c72
  1. 4
      main/lp/learnpath.class.php
  2. 50
      main/lp/learnpathItem.class.php

@ -2564,7 +2564,9 @@ class learnpath
$score = $item->get_score();
$maxScore = $item->get_max();
if ($mode = '%') {
$percentage = ((float) $score / (float) $maxScore) * 100;
if (!empty($maxScore)) {
$percentage = ((float) $score / (float) $maxScore) * 100;
}
$percentage = number_format($percentage, 0);
$text = '%';
} else {

@ -171,10 +171,10 @@ class learnpathItem
$tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF);
$sql = 'SELECT *
FROM %s
WHERE
course_code=\'%s\' AND
tool_id=\'%s\' AND
ref_id_high_level=%s AND
WHERE
course_code=\'%s\' AND
tool_id=\'%s\' AND
ref_id_high_level=%s AND
ref_id_second_level=%d
LIMIT 1';
// TODO: Verify if it's possible to assume the actual course instead
@ -753,7 +753,7 @@ class learnpathItem
*/
public function get_max()
{
if ($this->type == 'sco') {
if ($this->type === 'sco') {
if (isset($this->view_max_score) &&
!empty($this->view_max_score) &&
$this->view_max_score > 0
@ -766,16 +766,16 @@ class learnpathItem
} else {
if (!empty($this->max_score)) {
return $this->max_score;
} else {
return 100;
}
return 100;
}
} else {
if (!empty($this->max_score)) {
return $this->max_score;
} else {
return 100;
}
return 100;
}
}
@ -2415,7 +2415,7 @@ class learnpathItem
$sql = 'SELECT exe_result, exe_weighting
FROM '.Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES).'
WHERE
c_id = '.$course_id.' AND
c_id = '.$course_id.' AND
exe_exo_id = '.$items[$refs_list[$prereqs_string]]->path.' AND
exe_user_id = '.$user_id.' AND
orig_lp_id = '.$this->lp_id.' AND
@ -3405,12 +3405,12 @@ class learnpathItem
$item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW);
$course_id = api_get_course_int_id();
$sql = 'SELECT total_time, status
$sql = 'SELECT total_time, status
FROM '.$item_view_table.'
WHERE
c_id = '.$course_id.' AND
lp_item_id = "'.$this->db_id.'" AND
lp_view_id = "'.$this->view_id.'" AND
WHERE
c_id = '.$course_id.' AND
lp_item_id = "'.$this->db_id.'" AND
lp_view_id = "'.$this->view_id.'" AND
view_count = "'.$this->get_attempt_id().'"';
$result = Database::query($sql);
$row = Database::fetch_array($result);
@ -3476,10 +3476,10 @@ class learnpathItem
) {
$sql = "UPDATE $item_view_table
SET total_time = '$total_time'
WHERE
c_id = $course_id AND
lp_item_id = {$this->db_id} AND
lp_view_id = {$this->view_id} AND
WHERE
c_id = $course_id AND
lp_item_id = {$this->db_id} AND
lp_view_id = {$this->view_id} AND
view_count = {$this->get_attempt_id()}";
if ($debug) {
error_log('-------------total_time updated ------------------------');
@ -3498,12 +3498,12 @@ class learnpathItem
$table = Database::get_course_table(TABLE_LP_ITEM_VIEW);
$course_id = api_get_course_int_id();
$sql = 'UPDATE '.$table.'
SET total_time = 0,
SET total_time = 0,
start_time = '.time().'
WHERE
c_id = '.$course_id.' AND
lp_item_id = "'.$this->db_id.'" AND
lp_view_id = "'.$this->view_id.'" AND
WHERE
c_id = '.$course_id.' AND
lp_item_id = "'.$this->db_id.'" AND
lp_view_id = "'.$this->view_id.'" AND
view_count = "'.$this->attempt_id.'"';
Database::query($sql);
}
@ -3585,7 +3585,7 @@ class learnpathItem
$insertId = Database::insert($iva_table, $params);
if ($insertId) {
$sql = "UPDATE $iva_table SET id = iid
$sql = "UPDATE $iva_table SET id = iid
WHERE iid = $insertId";
Database::query($sql);
}

Loading…
Cancel
Save