From 7de29762926ecd9205e688ea8be596b2aba91f8d Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 26 Sep 2019 11:27:14 +0200 Subject: [PATCH] Minor - format code, avoid querying with id = 0 --- main/inc/introductionSection.inc.php | 7 +------ main/inc/lib/thematic.lib.php | 5 +++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/main/inc/introductionSection.inc.php b/main/inc/introductionSection.inc.php index 258850fdd8..55e10b3e75 100755 --- a/main/inc/introductionSection.inc.php +++ b/main/inc/introductionSection.inc.php @@ -184,14 +184,12 @@ if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) { $class1 = ''; if ($displayMode == '1') { // Show only the current course progress step - // $information_title = get_lang('InfoAboutLastDoneAdvance'); $last_done_advance = $thematic->get_last_done_thematic_advance(); $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance); $subTitle1 = get_lang('CurrentTopic'); $class1 = ' current'; } elseif ($displayMode == '2') { // Show only the two next course progress steps - // $information_title = get_lang('InfoAboutNextAdvanceNotDone'); $last_done_advance = $thematic->get_next_thematic_advance_not_done(); $next_advance_not_done = $thematic->get_next_thematic_advance_not_done(2); $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance); @@ -199,7 +197,6 @@ if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) { $subTitle1 = $subTitle2 = get_lang('NextTopic'); } elseif ($displayMode == '3') { // Show the current and next course progress steps - // $information_title = get_lang('InfoAboutLastDoneAdvanceAndNextAdvanceNotDone'); $last_done_advance = $thematic->get_last_done_thematic_advance(); $next_advance_not_done = $thematic->get_next_thematic_advance_not_done(); $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance); @@ -213,9 +210,7 @@ if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) { $thematic_advance = get_lang('CourseThematicAdvance'); $thematicScore = $thematic->get_total_average_of_thematic_advances().'%'; $thematicUrl = api_get_path(WEB_CODE_PATH).'course_progress/index.php?action=thematic_details&'.api_get_cidreq(); - $thematic_info = $thematic->get_thematic_list( - $thematic_advance_info['thematic_id'] - ); + $thematic_info = $thematic->get_thematic_list($thematic_advance_info['thematic_id']); $thematic_advance_info['start_date'] = api_get_local_time( $thematic_advance_info['start_date'] diff --git a/main/inc/lib/thematic.lib.php b/main/inc/lib/thematic.lib.php index e1e4eef8aa..67e95db7fd 100755 --- a/main/inc/lib/thematic.lib.php +++ b/main/inc/lib/thematic.lib.php @@ -716,8 +716,9 @@ class Thematic $tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE); $data = []; $condition = ''; - if (isset($thematic_advance_id)) { - $thematic_advance_id = intval($thematic_advance_id); + $thematic_advance_id = (int) $thematic_advance_id; + + if (!empty($thematic_advance_id)) { $condition = " AND a.id = $thematic_advance_id "; }