diff --git a/main/coursecopy/copy_course_session.php b/main/coursecopy/copy_course_session.php index 7fc8d2bb81..6a6266f0ec 100755 --- a/main/coursecopy/copy_course_session.php +++ b/main/coursecopy/copy_course_session.php @@ -1,6 +1,7 @@ '; - $_SESSION['course_list'] = $temp_course_list; - $_SESSION['session_origin'] = $id_session; + Session::write('course_list', $temp_course_list); + Session::write('session_origin', $id_session); // Build select for destination sessions where is not included current session from select origin if (!empty($id_session)) { @@ -204,10 +205,6 @@ function search_courses($id_session, $type) $xajax_response -> addAssign('ajax_list_courses_origin', 'innerHTML', api_utf8_encode($return)); $xajax_response -> addAssign('ajax_list_courses_destination', 'innerHTML', api_utf8_encode($select_multiple_empty)); } else { - //Left Select - Destination - $list_courses_origin = implode(',', $_SESSION['course_list']); - $session_origin = $_SESSION['session_origin']; - // Search courses by id_session where course codes is include en courses list destination $sql = "SELECT c.code, c.visual_code, c.title, src.session_id FROM $tbl_course c, $tbl_session_rel_course src @@ -223,7 +220,8 @@ function search_courses($id_session, $type) $return .= ''; } $return .= ''; - $_SESSION['course_list_destination'] = $course_list_destination; + + Session::write('course_list_destination', $course_list_destination); // Send response by ajax $xajax_response->addAssign( diff --git a/main/coursecopy/copy_course_session_selected.php b/main/coursecopy/copy_course_session_selected.php index 6352aa43af..3fd1c67aae 100644 --- a/main/coursecopy/copy_course_session_selected.php +++ b/main/coursecopy/copy_course_session_selected.php @@ -1,6 +1,7 @@ '; } $return .= ''; - $_SESSION['course_list_destination'] = $course_list_destination; + Session::write('course_list_destination', $course_list_destination); // Send response by ajax $xajaxResponse->addAssign( - 'ajax_list_courses_destination', 'innerHTML', api_utf8_encode($return) + 'ajax_list_courses_destination', + 'innerHTML', + api_utf8_encode($return) ); } return $xajaxResponse; @@ -278,22 +281,21 @@ Display::display_header($nameTools); if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') || (isset($_POST['copy_option']) && $_POST['copy_option'] == 'full_copy') ) { - $destinationCourse = $destinationSession = ''; $originCourse = api_get_course_id(); $originSession = api_get_session_id(); if (isset($_POST['action']) && $_POST['action'] == 'course_select_form') { - $destinationCourse = $_POST['destination_course']; $destinationSession = $_POST['destination_session']; $course = CourseSelectForm::get_posted_course( - 'copy_course', $originSession, $originCourse + 'copy_course', + $originSession, + $originCourse ); $cr = new CourseRestorer($course); $cr->restore($destinationCourse, $destinationSession); - echo Display::return_message(get_lang('CopyFinished'), 'confirmation'); displayForm(); @@ -329,11 +331,11 @@ if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') || $cb = new CourseBuilder('', $courseInfo); $course = $cb->build( - $originSession, $courseCode + $originSession, + $courseCode ); $cr = new CourseRestorer($course); $cr->restore($courseDestination, $destinationSession); - echo Display::return_message(get_lang('CopyFinished'), 'confirmation'); } diff --git a/main/document/create_document.php b/main/document/create_document.php index 0ef5c225b1..b51c0ca42f 100755 --- a/main/document/create_document.php +++ b/main/document/create_document.php @@ -216,7 +216,7 @@ if (!$is_certificate_mode) { ); } else { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], + 'url' => Category::getUrl(), 'name' => get_lang('Gradebook'), ); } diff --git a/main/document/edit_document.php b/main/document/edit_document.php index c88311c51b..45d6b1f2b5 100755 --- a/main/document/edit_document.php +++ b/main/document/edit_document.php @@ -164,7 +164,10 @@ if (!$is_certificate_mode) { "name" => get_lang('Documents'), ); } else { - $interbreadcrumb[] = array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); + $interbreadcrumb[] = array( + 'url' => Category::getUrl(), + 'name' => get_lang('Gradebook') + ); } if (empty($document_data['parents'])) { diff --git a/main/document/edit_draw.php b/main/document/edit_draw.php index 687951f360..b9c232c561 100755 --- a/main/document/edit_draw.php +++ b/main/document/edit_draw.php @@ -103,7 +103,7 @@ if (!$is_certificate_mode) { ); } else { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], + 'url' => Category::getUrl(), 'name' => get_lang('Gradebook') ); } diff --git a/main/document/edit_paint.php b/main/document/edit_paint.php index 7467bacd0f..7c025ff19e 100755 --- a/main/document/edit_paint.php +++ b/main/document/edit_paint.php @@ -99,7 +99,7 @@ if (!$is_certificate_mode) { ); } else { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], + 'url' => Category::getUrl(), 'name' => get_lang('Gradebook') ); } diff --git a/main/exercise/admin.php b/main/exercise/admin.php index 9d830ae8c8..180635ec3a 100755 --- a/main/exercise/admin.php +++ b/main/exercise/admin.php @@ -279,13 +279,9 @@ if ($editQuestion || $modifyQuestion || $newQuestion || $modifyAnswers) { $nameTools = get_lang('QuestionManagement'); } -if (isset($_SESSION['gradebook'])) { - $gradebook = $_SESSION['gradebook']; -} - -if (!empty($gradebook) && $gradebook == 'view') { +if (api_is_in_gradebook()) { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], + 'url' => Category::getUrl(), 'name' => get_lang('ToolGradebook') ); } diff --git a/main/exercise/adminhp.php b/main/exercise/adminhp.php index b79dcc68ce..ea74e02e2d 100755 --- a/main/exercise/adminhp.php +++ b/main/exercise/adminhp.php @@ -37,19 +37,17 @@ if (!$is_allowedToEdit) { api_not_allowed(true); } -if (isset($_SESSION['gradebook'])) { - $gradebook = $_SESSION['gradebook']; -} - -if (!empty($gradebook) && $gradebook == 'view') { +if (api_is_in_gradebook()) { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], + 'url' => Category::getUrl(), 'name' => get_lang('ToolGradebook'), ); } -$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises')); - +$interbreadcrumb[] = array( + "url" => "exercise.php", + "name" => get_lang('Exercises') +); $nameTools = get_lang('adminHP'); Display::display_header($nameTools, "Exercise"); diff --git a/main/exercise/exercise.php b/main/exercise/exercise.php index b5c70bfe9d..c970d9d2a2 100644 --- a/main/exercise/exercise.php +++ b/main/exercise/exercise.php @@ -87,17 +87,9 @@ if ($page < 0) { $page = 1; } -if (!empty($_GET['gradebook']) && $_GET['gradebook'] == 'view') { - $_SESSION['gradebook'] = Security::remove_XSS($_GET['gradebook']); - $gradebook = $_SESSION['gradebook']; -} elseif (empty($_GET['gradebook'])) { - unset($_SESSION['gradebook']); - $gradebook = ''; -} - -if (!empty($gradebook) && $gradebook == 'view') { +if (api_is_in_gradebook()) { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], + 'url' => Category::getUrl(), 'name' => get_lang('ToolGradebook') ); } diff --git a/main/exercise/exercise_admin.php b/main/exercise/exercise_admin.php index 66dd2a014b..582226f791 100755 --- a/main/exercise/exercise_admin.php +++ b/main/exercise/exercise_admin.php @@ -163,14 +163,9 @@ if ($form->validate()) { header('Location:admin.php?exerciseId='.$exercise_id.'&'.api_get_cidreq()); exit; } else { - // DISPLAY FORM - if (isset($_SESSION['gradebook'])) { - $gradebook = $_SESSION['gradebook']; - } - - if (!empty($gradebook) && $gradebook == 'view') { + if (api_is_in_gradebook()) { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], + 'url' => Category::getUrl(), 'name' => get_lang('ToolGradebook') ); } diff --git a/main/exercise/exercise_result.php b/main/exercise/exercise_result.php index 5014d8bbbc..49ec193323 100755 --- a/main/exercise/exercise_result.php +++ b/main/exercise/exercise_result.php @@ -56,13 +56,9 @@ if (empty($objExercise)) { api_not_allowed(); } -$gradebook = ''; -if (isset($_SESSION['gradebook'])) { - $gradebook = $_SESSION['gradebook']; -} -if (!empty($gradebook) && $gradebook == 'view') { +if (api_is_in_gradebook()) { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], + 'url' => Category::getUrl(), 'name' => get_lang('ToolGradebook'), ); } diff --git a/main/exercise/exercise_show.php b/main/exercise/exercise_show.php index e075c25d9b..e711334b52 100755 --- a/main/exercise/exercise_show.php +++ b/main/exercise/exercise_show.php @@ -135,16 +135,12 @@ if (!$is_allowedToEdit) { } } -if (isset($_SESSION['gradebook'])) { - $gradebook = Security::remove_XSS($_SESSION['gradebook']); -} - $allowRecordAudio = api_get_setting('enable_record_audio') === 'true'; $allowTeacherCommentAudio = api_get_configuration_value('allow_teacher_comment_audio') === true; -if (!empty($gradebook) && $gradebook == 'view') { +if (api_is_in_gradebook()) { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], + 'url' => Category::getUrl(), 'name' => get_lang('ToolGradebook') ); } diff --git a/main/exercise/exercise_submit.php b/main/exercise/exercise_submit.php index 89a4c83450..4b0c83339b 100755 --- a/main/exercise/exercise_submit.php +++ b/main/exercise/exercise_submit.php @@ -775,19 +775,17 @@ if ($question_count != 0) { } } -if (!empty ($_GET['gradebook']) && $_GET['gradebook'] == 'view') { - $_SESSION['gradebook'] = Security::remove_XSS($_GET['gradebook']); - $gradebook = $_SESSION['gradebook']; -} elseif (empty ($_GET['gradebook'])) { - unset($_SESSION['gradebook']); - $gradebook = ''; -} - -if (!empty ($gradebook) && $gradebook == 'view') { - $interbreadcrumb[] = array('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), 'name' => get_lang('ToolGradebook')); +if (api_is_in_gradebook()) { + $interbreadcrumb[] = array( + 'url' => Category::getUrl(), + 'name' => get_lang('ToolGradebook') + ); } -$interbreadcrumb[] = array("url" => "exercise.php?".api_get_cidreq(), "name" => get_lang('Exercises')); +$interbreadcrumb[] = array( + "url" => "exercise.php?".api_get_cidreq(), + "name" => get_lang('Exercises') +); $interbreadcrumb[] = array("url" => "#", "name" => $objExercise->selectTitle(true)); if ($origin != 'learnpath') { //so we are not in learnpath tool diff --git a/main/exercise/hotpotatoes.php b/main/exercise/hotpotatoes.php index c5338980f1..4b718d6906 100755 --- a/main/exercise/hotpotatoes.php +++ b/main/exercise/hotpotatoes.php @@ -19,13 +19,9 @@ if (!api_is_allowed_to_edit(null, true)) { api_not_allowed(); } -if (isset($_SESSION['gradebook'])) { - $gradebook = $_SESSION['gradebook']; -} - -if (!empty($gradebook) && $gradebook == 'view') { +if (api_is_in_gradebook()) { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], + 'url' => Category::getUrl(), 'name' => get_lang('ToolGradebook') ); } diff --git a/main/exercise/overview.php b/main/exercise/overview.php index 791aaa5064..959e3f3d45 100755 --- a/main/exercise/overview.php +++ b/main/exercise/overview.php @@ -36,7 +36,10 @@ $learnpath_item_id = isset($_REQUEST['learnpath_item_id']) ? intval($_REQUEST['l $learnpathItemViewId = isset($_REQUEST['learnpath_item_view_id']) ? intval($_REQUEST['learnpath_item_view_id']) : null; $origin = api_get_origin(); -$interbreadcrumb[] = array("url" => "exercise.php?gradebook=$gradebook", "name" => get_lang('Exercises')); +$interbreadcrumb[] = array( + "url" => "exercise.php?".api_get_path(), + "name" => get_lang('Exercises') +); $interbreadcrumb[] = array("url" => "#", "name" => $objExercise->selectTitle(true)); $time_control = false; @@ -125,7 +128,7 @@ if (isset($exercise_stat_info['exe_id'])) { // 2. Exercise button // Notice we not add there the lp_item_view_id because is not already generated -$exercise_url = api_get_path(WEB_CODE_PATH).'exercise/exercise_submit.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&origin='.$origin.'&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&learnpath_item_view_id='.$learnpathItemViewId.$extra_params; +$exercise_url = api_get_path(WEB_CODE_PATH).'exercise/exercise_submit.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&learnpath_item_view_id='.$learnpathItemViewId.$extra_params; $exercise_url_button = Display::url( $label, $exercise_url, diff --git a/main/exercise/question_pool.php b/main/exercise/question_pool.php index 84f72d126e..7c3fb0f408 100755 --- a/main/exercise/question_pool.php +++ b/main/exercise/question_pool.php @@ -171,12 +171,11 @@ if ($is_allowedToEdit) { } } -if (isset($_SESSION['gradebook'])) { - $gradebook = $_SESSION['gradebook']; -} - -if (!empty($gradebook) && $gradebook == 'view') { - $interbreadcrumb[] = array('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), 'name' => get_lang('ToolGradebook')); +if (api_is_in_gradebook()) { + $interbreadcrumb[] = array( + 'url' => Category::getUrl(), + 'name' => get_lang('ToolGradebook') + ); } // if admin of course diff --git a/main/forum/editpost.php b/main/forum/editpost.php index 4d2da12a7a..6d57fb41cb 100755 --- a/main/forum/editpost.php +++ b/main/forum/editpost.php @@ -64,14 +64,9 @@ if (!$isEditable) { api_not_allowed(true); } -/* Header and Breadcrumbs */ -if (isset($_SESSION['gradebook'])) { - $gradebook = $_SESSION['gradebook']; -} - -if (!empty($gradebook) && $gradebook == 'view') { +if (api_is_in_gradebook()) { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], + 'url' => Category::getUrl(), 'name' => get_lang('ToolGradebook') ); } diff --git a/main/forum/editthread.php b/main/forum/editthread.php index 4c2f3bb033..bf4dfa775b 100644 --- a/main/forum/editthread.php +++ b/main/forum/editthread.php @@ -34,15 +34,9 @@ $currentForumCategory = get_forumcategory_information($currentForum['forum_categ // the variable $forum_settings is declared in forumconfig.inc.php $forumSettings = $forum_setting; -/* Breadcrumbs */ - -if (isset($_SESSION['gradebook'])) { - $gradebook = Security::remove_XSS($_SESSION['gradebook']); -} - -if (!empty($gradebook) && $gradebook == 'view') { +if (api_is_in_gradebook()) { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), + 'url' => Category::getUrl(), 'name' => get_lang('ToolGradebook') ); } diff --git a/main/forum/forumqualify.php b/main/forum/forumqualify.php index 8fa8b35855..a0abaa4a06 100755 --- a/main/forum/forumqualify.php +++ b/main/forum/forumqualify.php @@ -90,16 +90,9 @@ $currentForumCategory = get_forumcategory_information( ); $groupId = api_get_group_id(); -/* - Header and Breadcrumbs -*/ -if (isset($_SESSION['gradebook'])) { - $gradebook = $_SESSION['gradebook']; -} - -if (!empty($gradebook) && $gradebook == 'view') { +if (api_is_in_gradebook()) { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], + 'url' => Category::getUrl(), 'name' => get_lang('ToolGradebook') ); } diff --git a/main/forum/forumsearch.php b/main/forum/forumsearch.php index 639d94fa0c..87ce68d350 100755 --- a/main/forum/forumsearch.php +++ b/main/forum/forumsearch.php @@ -39,14 +39,9 @@ $origin = api_get_origin(); // Name of the tool $nameTools = get_lang('ToolForum'); -// Breadcrumbs -if (isset($_SESSION['gradebook'])) { - $gradebook = $_SESSION['gradebook']; -} - -if (!empty($gradebook) && $gradebook == 'view') { +if (api_is_in_gradebook()) { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], + 'url' => Category::getUrl(), 'name' => get_lang('ToolGradebook') ); } diff --git a/main/forum/index.php b/main/forum/index.php index 7cf63ce0bb..732819609a 100755 --- a/main/forum/index.php +++ b/main/forum/index.php @@ -52,17 +52,9 @@ $_user = api_get_user_info(); require_once 'forumconfig.inc.php'; require_once 'forumfunction.inc.php'; -if (!empty($_GET['gradebook']) && $_GET['gradebook'] == 'view') { - $_SESSION['gradebook'] = Security::remove_XSS($_GET['gradebook']); - $gradebook = $_SESSION['gradebook']; -} elseif (empty($_GET['gradebook'])) { - unset($_SESSION['gradebook']); - $gradebook = ''; -} - -if (!empty($gradebook) && $gradebook == 'view') { +if (api_is_in_gradebook()) { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], + 'url' => Category::getUrl(), 'name' => get_lang('ToolGradebook'), ); } diff --git a/main/forum/newthread.php b/main/forum/newthread.php index 09c831364d..de5cf35461 100755 --- a/main/forum/newthread.php +++ b/main/forum/newthread.php @@ -45,15 +45,9 @@ $origin = api_get_origin(); $current_forum = get_forum_information($_GET['forum']); $current_forum_category = get_forumcategory_information($current_forum['forum_category']); -/* Breadcrumbs */ - -if (isset($_SESSION['gradebook'])) { - $gradebook = Security::remove_XSS($_SESSION['gradebook']); -} - -if (!empty($gradebook) && $gradebook == 'view') { +if (api_is_in_gradebook()) { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), + 'url' => Category::getUrl(), 'name' => get_lang('ToolGradebook') ); } diff --git a/main/forum/reply.php b/main/forum/reply.php index 712817c7e4..f723f33c56 100755 --- a/main/forum/reply.php +++ b/main/forum/reply.php @@ -77,23 +77,16 @@ if ($current_forum['forum_of_group'] != 0) { } } -/* Breadcrumbs */ - -$gradebook = null; -if (isset($_SESSION['gradebook'])) { - $gradebook = Security::remove_XSS($_SESSION['gradebook']); -} - -if (!empty($gradebook) && $gradebook == 'view') { +if (api_is_in_gradebook()) { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), + 'url' => Category::getUrl(), 'name' => get_lang('ToolGradebook') ); } $groupId = api_get_group_id(); if (!empty($groupId)) { $_clean['toolgroup'] = $groupId; - $group_properties = GroupManager :: get_group_properties($_clean['toolgroup']); + $group_properties = GroupManager::get_group_properties($_clean['toolgroup']); $interbreadcrumb[] = array( 'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(), 'name' => get_lang('Groups'), diff --git a/main/forum/viewforum.php b/main/forum/viewforum.php index 095dea24ce..2a5170b3ff 100755 --- a/main/forum/viewforum.php +++ b/main/forum/viewforum.php @@ -107,14 +107,9 @@ if (!empty($groupId)) { $my_search = isset($_GET['search']) ? $_GET['search'] : ''; $my_action = isset($_GET['action']) ? $_GET['action'] : ''; -$gradebook = null; -if (isset($_SESSION['gradebook'])) { - $gradebook = $_SESSION['gradebook']; -} - -if (!empty($gradebook) && $gradebook == 'view') { +if (api_is_in_gradebook()) { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], + 'url' => Category::getUrl(), 'name' => get_lang('ToolGradebook') ); } diff --git a/main/forum/viewforumcategory.php b/main/forum/viewforumcategory.php index 820246dbae..2e16b372e9 100755 --- a/main/forum/viewforumcategory.php +++ b/main/forum/viewforumcategory.php @@ -54,15 +54,9 @@ require_once 'forumfunction.inc.php'; // Are we in a lp ? $origin = api_get_origin(); -/* Header and Breadcrumbs */ -$gradebook = null; -if (isset($_SESSION['gradebook'])) { - $gradebook = $_SESSION['gradebook']; -} - -if (!empty($gradebook) && $gradebook == 'view') { +if (api_is_in_gradebook()) { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], + 'url' => Category::getUrl(), 'name' => get_lang('ToolGradebook') ); } diff --git a/main/forum/viewpost.php b/main/forum/viewpost.php index 96c79168f5..9cf846324f 100755 --- a/main/forum/viewpost.php +++ b/main/forum/viewpost.php @@ -41,15 +41,9 @@ $current_forum = get_forum_information($current_thread['forum_id']); // Note: Th $current_forum_category = get_forumcategory_information($current_forum['forum_category']); $whatsnew_post_info = $_SESSION['whatsnew_post_info']; -/* Header and Breadcrumbs */ - -if (isset($_SESSION['gradebook'])) { - $gradebook = $_SESSION['gradebook']; -} - -if (!empty($gradebook) && $gradebook == 'view') { +if (api_is_in_gradebook()) { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], + 'url' => Category::getUrl(), 'name' => get_lang('ToolGradebook') ); } diff --git a/main/forum/viewthread.php b/main/forum/viewthread.php index 416c0439ae..a39726d672 100755 --- a/main/forum/viewthread.php +++ b/main/forum/viewthread.php @@ -38,16 +38,10 @@ $current_thread = get_thread_information($_GET['forum'], $_GET['thread']); $current_forum = get_forum_information($current_thread['forum_id']); $current_forum_category = get_forumcategory_information($current_forum['forum_category']); $whatsnew_post_info = isset($_SESSION['whatsnew_post_info']) ? $_SESSION['whatsnew_post_info'] : null; -/* Header and Breadcrumbs */ -if (!empty($_GET['gradebook']) && $_GET['gradebook'] == 'view') { - $_SESSION['gradebook'] = Security::remove_XSS($_GET['gradebook']); - $gradebook = $_SESSION['gradebook']; -} - -if (!empty($gradebook) && $gradebook == 'view') { +if (api_is_in_gradebook()) { $interbreadcrumb[] = array( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], + 'url' => Category::getUrl(), 'name' => get_lang('ToolGradebook') ); } diff --git a/main/gradebook/gradebook.php b/main/gradebook/gradebook.php index 04886589dc..ce69d66bb6 100755 --- a/main/gradebook/gradebook.php +++ b/main/gradebook/gradebook.php @@ -13,10 +13,10 @@ $_in_course = false; //make sure the destination for scripts is index.php instead of gradebook.php require_once __DIR__.'/../inc/global.inc.php'; if (!empty($_GET['course'])) { - $_SESSION['gradebook_dest'] = 'index.php'; + Category::setUrl('index.php'); $this_section = SECTION_COURSES; } else { - $_SESSION['gradebook_dest'] = 'gradebook.php'; + Category::setUrl('gradebook.php'); $this_section = SECTION_MYGRADEBOOK; unset($_GET['course']); } @@ -65,7 +65,7 @@ if (isset($_GET['createallcategories'])) { unset($cat); } } - header('Location: '.$_SESSION['gradebook_dest'].'?addallcat=&selectcat=0'); + header('Location: '.Category::getUrl().'addallcat=&selectcat=0'); exit; } @@ -421,24 +421,27 @@ if (isset($move_form)) { if (!isset($_GET['exportpdf']) && !isset($_GET['export_certificate'])) { if (isset($_GET['studentoverview'])) { $interbreadcrumb[] = array( - 'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectcat.'&'.api_get_cidreq(), + 'url' => Category::getUrl().'selectcat='.$selectcat, 'name' => get_lang('ToolGradebook') ); Display :: display_header(get_lang('FlatView')); - } elseif (isset ($_GET['search'])) { - if ($_SESSION['gradebook_dest'] == 'index.php') { - $gradebook_dest = Security::remove_XSS($_SESSION['gradebook_dest']).'?'.api_get_cidreq().'&'; - } else { - $gradebook_dest = Security::remove_XSS($_SESSION['gradebook_dest']); - } - - $interbreadcrumb[] = array('url' => $gradebook_dest, 'name' => get_lang('Gradebook')); + } elseif (isset($_GET['search'])) { + $interbreadcrumb[] = array( + 'url' => Category::getUrl(), + 'name' => get_lang('Gradebook') + ); if ((isset($_GET['selectcat']) && $_GET['selectcat'] > 0)) { if (!empty($_GET['course'])) { - $interbreadcrumb[] = array('url' => $gradebook_dest.'selectcat='.$selectcat, 'name' => get_lang('Details')); + $interbreadcrumb[] = array( + 'url' => Category::getUrl().'selectcat='.$selectcat, + 'name' => get_lang('Details') + ); } else { - $interbreadcrumb[] = array('url' => $_SESSION['gradebook_dest'].'?selectcat=0', 'name' => get_lang('Details')); + $interbreadcrumb[] = array( + 'url' => Category::getUrl().'selectcat=0', + 'name' => get_lang('Details') + ); } } Display :: display_header(''); diff --git a/main/gradebook/gradebook_add_cat.php b/main/gradebook/gradebook_add_cat.php index 16e26877bd..3355d36add 100755 --- a/main/gradebook/gradebook_add_cat.php +++ b/main/gradebook/gradebook_add_cat.php @@ -89,13 +89,13 @@ if ($form->validate()) { } $cat->set_visible($visible); $result = $cat->add(); - header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?addcat=&selectcat='.$cat->get_parent_id().'&'.api_get_cidreq()); + header('Location: '.Category::getUrl().'addcat=&selectcat='.$cat->get_parent_id()); exit; } if (!$_in_course) { $interbreadcrumb[] = array( - 'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$get_select_cat.'&'.api_get_cidreq(), + 'url' => Category::getUrl().'selectcat='.$get_select_cat, 'name' => get_lang('Gradebook') ); } diff --git a/main/gradebook/gradebook_add_eval.php b/main/gradebook/gradebook_add_eval.php index 4acddf3c5e..68999c9cd1 100755 --- a/main/gradebook/gradebook_add_eval.php +++ b/main/gradebook/gradebook_add_eval.php @@ -69,7 +69,7 @@ if ($form->validate()) { //header('Location: gradebook_add_user.php?selecteval=' . $eval->get_id()); exit; } else { - header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$eval->get_category_id().'&'.api_get_cidreq()); + header('Location: '.Category::getUrl().'selectcat='.$eval->get_category_id()); exit; } } else { @@ -78,19 +78,19 @@ if ($form->validate()) { header('Location: gradebook_add_result.php?selecteval='.$eval->get_id().'&'.api_get_cidreq()); exit; } else { - header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$eval->get_category_id().'&'.api_get_cidreq()); + header('Location: '.Category::getUrl().'selectcat='.$eval->get_category_id()); exit; } } } $interbreadcrumb[] = array( - 'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$select_cat.'&'.api_get_cidreq(), + 'url' => Category::getUrl().'selectcat='.$select_cat, 'name' => get_lang('Gradebook')) ; $this_section = SECTION_COURSES; -$htmlHeadXtra[] = ''; $interbreadcrumb[] = array( - 'url' => $_SESSION['gradebook_dest'].'?selectcat=1', + 'url' => Category::getUrl().'selectcat=1', 'name' => get_lang('ToolGradebook') ); diff --git a/main/gradebook/gradebook_showlog_eval.php b/main/gradebook/gradebook_showlog_eval.php index abdec3d909..9fb2cca9e9 100755 --- a/main/gradebook/gradebook_showlog_eval.php +++ b/main/gradebook/gradebook_showlog_eval.php @@ -12,11 +12,11 @@ GradebookUtils::block_students(); $selectCat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0; $interbreadcrumb[] = array( - 'url' => $_SESSION['gradebook_dest'].'?', + 'url' => Category::getUrl(), 'name' => get_lang('Gradebook') ); $interbreadcrumb[] = array( - 'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectCat, + 'url' => Category::getUrl().'selectcat='.$selectCat, 'name' => get_lang('Details') ); $interbreadcrumb[] = array( diff --git a/main/gradebook/gradebook_showlog_link.php b/main/gradebook/gradebook_showlog_link.php index 23377cab75..e05f148d9e 100755 --- a/main/gradebook/gradebook_showlog_link.php +++ b/main/gradebook/gradebook_showlog_link.php @@ -14,11 +14,11 @@ GradebookUtils::block_students(); $selectCat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0; $interbreadcrumb[] = array( - 'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?', + 'url' => Category::getUrl(), 'name' => get_lang('Gradebook'), ); $interbreadcrumb[] = array( - 'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$selectCat, + 'url' => Category::getUrl().'selectcat='.$selectCat, 'name' => get_lang('Details') ); $interbreadcrumb[] = array( diff --git a/main/gradebook/gradebook_statistics.php b/main/gradebook/gradebook_statistics.php index 66c1b905f8..2c10e14d22 100755 --- a/main/gradebook/gradebook_statistics.php +++ b/main/gradebook/gradebook_statistics.php @@ -19,7 +19,9 @@ if ($eval[0]->get_category_id() < 0) { } $interbreadcrumb[] = array( - 'url' => $_SESSION['gradebook_dest'].'?selectcat='.$currentcat[0]->get_id(), 'name' => get_lang('ToolGradebook')); + 'url' => Category::getUrl().'selectcat='.$currentcat[0]->get_id(), + 'name' => get_lang('ToolGradebook') +); if (api_is_allowed_to_edit()) { $interbreadcrumb[] = array( diff --git a/main/gradebook/gradebook_view_result.php b/main/gradebook/gradebook_view_result.php index 64d7f4d124..45a50f4e06 100755 --- a/main/gradebook/gradebook_view_result.php +++ b/main/gradebook/gradebook_view_result.php @@ -19,7 +19,7 @@ if (!$isDrhOfCourse) { } $interbreadcrumb[] = array( - 'url' => $_SESSION['gradebook_dest'], + 'url' => Category::getUrl(), 'name' => get_lang('Gradebook') ); @@ -513,7 +513,7 @@ if (isset($_GET['deleteall'])) { if (!isset($_GET['export']) && (!isset($_GET['import']))) { if (!isset($_GET['selectcat'])) { $interbreadcrumb[] = array( - 'url' => $_SESSION['gradebook_dest'].'?selectcat='.$currentcat[0]->get_id().'&'.api_get_cidreq(), + 'url' => Category::getUrl().'selectcat='.$currentcat[0]->get_id(), 'name' => get_lang('Details') ); } diff --git a/main/gradebook/index.php b/main/gradebook/index.php index 39b42eaf9d..88ad1b29f1 100755 --- a/main/gradebook/index.php +++ b/main/gradebook/index.php @@ -22,7 +22,7 @@ $stud_id = api_get_user_id(); $session_id = api_get_session_id(); //make sure the destination for scripts is index.php instead of gradebook.php -$_SESSION['gradebook_dest'] = 'index.php'; +Category::setUrl('index.php'); $this_section = SECTION_COURSES; @@ -150,7 +150,7 @@ if (isset($_GET['createallcategories'])) { unset($cat); } } - header('Location: '.$_SESSION['gradebook_dest'].'?addallcat=&selectcat=0'); + header('Location: '.Category::getUrl().'addallcat=&selectcat=0'); exit; } @@ -575,15 +575,15 @@ $viewTitle = ''; // DISPLAY HEADERS AND MESSAGES if (!isset($_GET['exportpdf'])) { - if (isset ($_GET['studentoverview'])) { + if (isset($_GET['studentoverview'])) { $interbreadcrumb[] = array( - 'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectCat, + 'url' => Category::getUrl().'selectcat='.$selectCat, 'name' => get_lang('ToolGradebook') ); $viewTitle = get_lang('FlatView'); } elseif (isset($_GET['search'])) { $interbreadcrumb[] = array( - 'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectCat, + 'url' => Category::getUrl().'selectcat='.$selectCat, 'name' => get_lang('ToolGradebook') ); $viewTitle = get_lang('SearchResults'); diff --git a/main/gradebook/lib/be/category.class.php b/main/gradebook/lib/be/category.class.php index d889d5510e..a5eb919bb3 100755 --- a/main/gradebook/lib/be/category.class.php +++ b/main/gradebook/lib/be/category.class.php @@ -2,6 +2,7 @@ /* For licensing terms, see /license.txt */ use Chamilo\CoreBundle\Entity\GradebookCategory; +use ChamiloSession as Session; /** * Class Category @@ -2561,4 +2562,30 @@ class Category implements GradebookItem $this->studentList = $list; } + /** + * @return string + */ + public static function getUrl() + { + $url = Session::read('gradebook_dest'); + + return $url; + } + + /** + * Destination is index.php or gradebook.php + * @param string $url + */ + public static function setUrl($url) + { + switch ($url) { + case 'gradebook.php': + $url = api_get_path(WEB_CODE_PATH).'gradebook/gradebook.php?'; + break; + case 'index.php': + $url = api_get_path(WEB_CODE_PATH).'gradebook/index.php?'.api_get_cidreq().'&'; + break; + } + Session::write('gradebook_dest', $url); + } } diff --git a/main/gradebook/lib/fe/displaygradebook.php b/main/gradebook/lib/fe/displaygradebook.php index 8b0975b7af..5ba5ed4fa6 100755 --- a/main/gradebook/lib/fe/displaygradebook.php +++ b/main/gradebook/lib/fe/displaygradebook.php @@ -20,7 +20,7 @@ class DisplayGradebook if (api_is_allowed_to_edit(null, true)) { $header = '
'; if ($page != 'statistics') { - $header .= ''. + $header .= ''. Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM).''; if (($evalobj->get_course_code() != null) && !$evalobj->has_results()) { $header .= ' @@ -110,15 +110,25 @@ class DisplayGradebook if ($page != 'statistics') { if (api_is_allowed_to_edit(null, true)) { $evalinfo .= '
'. - Display::return_icon('statistics.png', get_lang('ViewStatistics'), '', ICON_SIZE_MEDIUM).''; + Display::return_icon( + 'statistics.png', + get_lang('ViewStatistics'), + '', + ICON_SIZE_MEDIUM + ).''; } } - $evalinfo .= ''.Display::return_icon('tutorial.gif', '', ['style' => 'float:right; position:relative;']).''; + $evalinfo .= ''. + Display::return_icon( + 'tutorial.gif', + '', + ['style' => 'float:right; position:relative;'] + ) + .''; echo $evalinfo; echo $header; } - /** * Displays the header for the flatview page containing filters * @param $catobj @@ -130,7 +140,7 @@ class DisplayGradebook $header = '
'; if ($catobj->get_parent_id() == 0) { $select_cat = $catobj->get_id(); - $url = Security::remove_XSS($_SESSION['gradebook_dest']); + $url = Category::getUrl(); } else { $select_cat = $catobj->get_parent_id(); $url = 'gradebook_flatview.php'; @@ -149,7 +159,12 @@ class DisplayGradebook ]); $header .= Display::url( - Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM), + Display::return_icon( + 'export_csv.png', + get_lang('ExportAsCSV'), + '', + ICON_SIZE_MEDIUM + ), $exportCsvUrl ); @@ -160,7 +175,12 @@ class DisplayGradebook ]); $header .= Display::url( - Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM), + Display::return_icon( + 'export_excel.png', + get_lang('ExportAsXLS'), + '', + ICON_SIZE_MEDIUM + ), $exportXlsUrl ); @@ -171,7 +191,12 @@ class DisplayGradebook ]); $header .= Display::url( - Display::return_icon('export_doc.png', get_lang('ExportAsDOC'), '', ICON_SIZE_MEDIUM), + Display::return_icon( + 'export_doc.png', + get_lang('ExportAsDOC'), + '', + ICON_SIZE_MEDIUM + ), $exportDocUrl ); @@ -181,7 +206,12 @@ class DisplayGradebook ]); $header .= Display::url( - Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM), + Display::return_icon( + 'printer.png', + get_lang('Print'), + '', + ICON_SIZE_MEDIUM + ), $exportPrintUrl, ['target' => '_blank'] ); @@ -195,7 +225,12 @@ class DisplayGradebook ]); $header .= Display::url( - Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM), + Display::return_icon( + 'pdf.png', + get_lang('ExportToPDF'), + '', + ICON_SIZE_MEDIUM + ), $exportPdfUrl ); @@ -306,7 +341,13 @@ class DisplayGradebook $header .= ''; if (!$selectcat == '0') { $header .= ''. - Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('RootCat'), '', ICON_SIZE_MEDIUM).''; + Display::return_icon( + 'back.png', + get_lang('BackTo').' '.get_lang('RootCat'), + '', + ICON_SIZE_MEDIUM + ). + ''; } $header .= ''.get_lang('CurrentCategory').''. '