From dd882792cf9ae4ce1f7b2f357896b3be4a3de00f Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 11 Apr 2012 14:57:52 +0200 Subject: [PATCH] Cleaning unused variables see #4552 --- main/course_home/activity.php | 29 +++------- main/course_home/vertical_activity.php | 78 +++++++++++--------------- 2 files changed, 40 insertions(+), 67 deletions(-) diff --git a/main/course_home/activity.php b/main/course_home/activity.php index 37590e3d31..059a992fb4 100644 --- a/main/course_home/activity.php +++ b/main/course_home/activity.php @@ -15,6 +15,7 @@ $id = isset($_GET['id']) ? intval($_GET['id']) : null; $course_id = api_get_course_int_id(); +$session_id = api_get_session_id(); // MAIN CODE @@ -40,7 +41,7 @@ if (api_is_platform_admin()) { if (!empty($_GET['askDelete'])) { $content .='
'.get_lang('DelLk').'
    '.get_lang('No').' |  - '.get_lang('Yes').' + '.get_lang('Yes').'
'; } elseif (isset($_GET['delete']) && $_GET['delete']) { /* @@ -55,20 +56,7 @@ if (api_is_platform_admin()) { // COURSE ADMIN ONLY VIEW // Start of tools for CourseAdmins (teachers/tutors) -if (api_is_allowed_to_edit(null, true) && !api_is_coach()) { - - $current_protocol = $_SERVER['SERVER_PROTOCOL']; - $current_host = $_SERVER['HTTP_HOST']; - $server_protocol = substr($current_protocol, 0, strrpos($current_protocol, '/')); - $server_protocol = $server_protocol.'://'; - if ($current_host == 'localhost') { - // Get information of path - $info = explode('courses', api_get_self()); - $path_work = substr($info[0], 1); - } else { - $path_work = ''; - } - +if (api_is_allowed_to_edit(null, true) && !api_is_coach()) { $content .= '
'; - if (api_get_setting('show_session_data') == 'true' && $id_session > 0) { + if (api_get_setting('show_session_data') == 'true' && $session_id > 0) { $content .= '
'.get_lang('SessionData').' - '.CourseHome::show_session_data($id_session).' +
'.CourseHome::show_session_data($session_id).'
'; } @@ -97,8 +85,7 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) { $my_list = array_merge($my_list,$list2); $items = CourseHome::show_tools_category($my_list); - $content .= return_block(get_lang('Interaction'), $items); - + $content .= return_block(get_lang('Interaction'), $items); $my_list = CourseHome::get_tools_category(TOOL_ADMIN_PLATFORM); $items = CourseHome::show_tools_category($my_list); @@ -106,12 +93,12 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) { $content .= return_block(get_lang('Administration'), $items); } elseif (api_is_coach()) { - if (api_get_setting('show_session_data') == 'true' && $id_session > 0) { + if (api_get_setting('show_session_data') == 'true' && $session_id > 0) { $content .= '
'.get_lang('SessionData').' '; - $content .= CourseHome::show_session_data($id_session); + $content .= CourseHome::show_session_data($session_id); $content .= '
'; } diff --git a/main/course_home/vertical_activity.php b/main/course_home/vertical_activity.php index 0a87f69afc..1ada5a781f 100644 --- a/main/course_home/vertical_activity.php +++ b/main/course_home/vertical_activity.php @@ -14,18 +14,20 @@ */ // MAIN CODE +$id = isset($_GET['id']) ? intval($_GET['id']) : null; $course_id = api_get_course_int_id(); +$session_id = api_get_session_id(); if (api_is_allowed_to_edit(null, true)) { // HIDE if (!empty($_GET['hide'])) { // visibility 1 -> 0 - $sql = "UPDATE $tool_table SET visibility=0 WHERE c_id = $course_id AND id='".intval($_GET["id"])."'"; + $sql = "UPDATE $tool_table SET visibility=0 WHERE c_id = $course_id AND id='".$id."'"; Database::query($sql); $show_message = Display::return_message(get_lang('ToolIsNowHidden'), 'confirmation'); } elseif (!empty($_GET['restore'])) { // visibility 0,2 -> 1 // REACTIVATE - $sql = "UPDATE $tool_table SET visibility=1 WHERE c_id = $course_id AND id='".intval($_GET["id"])."'"; + $sql = "UPDATE $tool_table SET visibility=1 WHERE c_id = $course_id AND id='".$id."'"; Database::query($sql); $show_message = Display::return_message(get_lang('ToolIsNowVisible'), 'confirmation'); } @@ -38,7 +40,7 @@ if (api_is_platform_admin()) { if (!empty($_GET['askDelete'])) { $content .='
'.get_lang('DelLk').'
    '.get_lang('No').' |  - '.get_lang('Yes').' + '.get_lang('Yes').'
'; } elseif (isset($_GET['delete']) && $_GET['delete']) { /* @@ -53,58 +55,42 @@ if (api_is_platform_admin()) { // COURSE ADMIN ONLY VIEW // Start of tools for CourseAdmins (teachers/tutors) -if (api_is_allowed_to_edit(null, true) && !api_is_coach()) { +if (api_is_allowed_to_edit(null, true) && !api_is_coach()) { + $content .= '
+ '; + $content .= '
'; -if (api_get_setting('show_session_data') == 'true' && $id_session > 0) { - $content .= '
'.get_lang('SessionData').' - '.CourseHome::show_session_data($id_session).'
-
'; -} + if (api_get_setting('show_session_data') == 'true' && $session_id > 0) { + $content .= '
'.get_lang('SessionData').' + '.CourseHome::show_session_data($session_id).'
+
'; + } -$content .= '
'.get_lang('Authoring').''; -$my_list = CourseHome::get_tools_category(TOOL_AUTHORING); -$content .= CourseHome::show_tools_category($my_list); -$content .= '
'; + $content .= '
'.get_lang('Authoring').''; + $my_list = CourseHome::get_tools_category(TOOL_AUTHORING); + $content .= CourseHome::show_tools_category($my_list); + $content .= '
'; -$content .= '
'.get_lang('Interaction').''; -$my_list = CourseHome::get_tools_category(TOOL_INTERACTION); -$content .= CourseHome::show_tools_category($my_list); -$content .= '
'; + $content .= '
'.get_lang('Interaction').''; + $my_list = CourseHome::get_tools_category(TOOL_INTERACTION); + $content .= CourseHome::show_tools_category($my_list); + $content .= '
'; -$content .= '
'.get_lang('Administration').''; -$my_list = CourseHome::get_tools_category(TOOL_ADMIN_PLATFORM); -$content .= CourseHome::show_tools_category($my_list); -$content .= '
'; + $content .= '
'.get_lang('Administration').''; + $my_list = CourseHome::get_tools_category(TOOL_ADMIN_PLATFORM); + $content .= CourseHome::show_tools_category($my_list); + $content .= '
'; } elseif (api_is_coach()) { - if (api_get_setting('show_session_data') == 'true' && $id_session > 0) { + if (api_get_setting('show_session_data') == 'true' && $session_id > 0) { $content .= '
'.get_lang('SessionData').' '; - $content .= CourseHome::show_session_data($id_session); + $content .= CourseHome::show_session_data($session_id); $content .= '
'; }