Course: Use id instead of course code in course_information.php

pull/3991/head
Julio 3 years ago
parent 652a981eb0
commit 6a0edc1e8f
  1. 2
      public/main/admin/course_edit.php
  2. 26
      public/main/admin/course_information.php
  3. 2
      public/main/admin/course_list.php
  4. 2
      public/main/admin/course_list_admin.php
  5. 4
      public/main/admin/ldap_import_students.php
  6. 4
      public/main/admin/user_information.php

@ -446,7 +446,7 @@ $actions .= Display::url(
);
$actions .= Display::url(
Display::return_icon('info2.png', get_lang('Information')),
api_get_path(WEB_CODE_PATH)."admin/course_information.php?code=$courseCode"
api_get_path(WEB_CODE_PATH)."admin/course_information.php?id=$courseId"
);
echo Display::toolbarAction('toolbar', [$actions]);

@ -2,26 +2,30 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
/**
* This script gives information about a course.
*
* @author Bart Mollet
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
if (!isset($_GET['code'])) {
if (!isset($_GET['id'])) {
api_not_allowed(true);
}
$courseInfo = api_get_course_info($_GET['code']);
if (empty($courseInfo)) {
$course = api_get_course_entity($_GET['id']);
if (null === $course) {
api_not_allowed(true);
}
$courseId = $course->getId();
$sessionId = isset($_GET['id_session']) ? (int) $_GET['id_session'] : 0;
/**
@ -92,22 +96,26 @@ function get_course_usage($course, $session_id = 0)
return $usage;
}
$courseUrl = api_get_course_url($courseId);
$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('Administration')];
$interbreadcrumb[] = ['url' => 'course_list.php', 'name' => get_lang('Courses')];
$courseId = $courseInfo['real_id'];
$tool_name = $courseInfo['title'].' ('.$courseInfo['visual_code'].')';
Display::display_header($tool_name);
Display::display_header($course->getTitleAndCode());
echo Display::toolbarAction(
'info',
[
Display::url(
Display::return_icon('home.png', get_lang('Course home'), [], ICON_SIZE_MEDIUM),
$courseInfo['course_public_url']
$courseUrl
),
]
);
$illustrationRepo = Container::getIllustrationRepository();
$illustrationUrl = $illustrationRepo->getIllustrationUrl($course, 'course_picture_medium');
echo ' <img class="img-thumbnail" src="'.$illustrationUrl.'" />';
/*echo Display::page_header(get_lang('Course usage'));
$table = new SortableTableFromArray(
get_course_usage($courseInfo, $sessionId),
@ -161,7 +169,7 @@ if (Database::num_rows($res) > 0) {
$users[] = $user;
}
$table = new SortableTableFromArray($users, 0, 20, 'user_table');
$table->set_additional_parameters(['code' => $courseInfo['code']]);
$table->set_additional_parameters(['code' => $course->getCode()]);
$table->set_other_tables(['usage_table', 'class_table']);
$table->set_header(0, get_lang('Code'), true);
if ($is_western_name_order) {
@ -179,7 +187,7 @@ if (Database::num_rows($res) > 0) {
echo get_lang('No users in course');
}
$sessionList = SessionManager::get_session_by_course($courseInfo['real_id']);
$sessionList = SessionManager::get_session_by_course($courseId);
$url = api_get_path(WEB_CODE_PATH);
if (!empty($sessionList)) {

@ -172,7 +172,7 @@ function get_course_data($from, $number_of_items, $column, $direction, $dataFunc
$actions = [];
$actions[] = Display::url(
Display::return_icon('info2.png', get_lang('Information')),
"course_information.php?code=$courseCode"
"course_information.php?id=$courseId"
);
$actions[] = Display::url(
Display::return_icon('course_home.png', get_lang('Course home')),

@ -170,7 +170,7 @@ function get_course_data($from, $number_of_items, $column, $direction, $dataFunc
$actions = [];
$actions[] = Display::url(
Display::return_icon('info2.png', get_lang('Info')),
"course_information.php?code=$courseCode"
"course_information.php?id=$courseId"
);
/*$actions[] = Display::url(
Display::return_icon('course_home.png', get_lang('CourseHomepage')),

@ -136,11 +136,11 @@ if (empty($annee) && empty($course)) {
}
}
if (!empty($_POST['course'])) {
$courseInfo = api_get_course_info($_POST['course']);
foreach ($UserList as $user_id) {
$courseInfo = api_get_course_info($_POST['course']);
CourseManager::subscribeUser($user_id, $courseInfo['real_id']);
}
header('Location: course_information.php?code='.Security::remove_XSS($_POST['course']));
header('Location: course_information.php?id='.$courseInfo['real_id']);
exit;
} else {
$message = get_lang('No user added');

@ -318,7 +318,7 @@ if (count($sessions) > 0) {
Display::return_icon('statistics.png', get_lang('Statistics')),
api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?details=true&student='.$userId.'&id_session='.$sessionId.'&course='.$courseCode
);
$tools .= '&nbsp;<a href="course_information.php?code='.$courseCode.'&id_session='.$sessionId.'">'.
$tools .= '&nbsp;<a href="course_information.php?id='.$courseId.'&id_session='.$sessionId.'">'.
Display::return_icon('info2.png', get_lang('Overview')).'</a>'.
'<a href="'.$courseUrl.'">'.
Display::return_icon('course_home.png', get_lang('Course home')).'</a>';
@ -427,7 +427,7 @@ if (count($courseRelUserList) > 0) {
Display::return_icon('statistics.png', get_lang('Statistics')),
api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?details=true&student='.$userId.'&id_session=0&course='.$courseCode
);
$tools .= '&nbsp;<a href="course_information.php?code='.$courseCode.'">'.
$tools .= '&nbsp;<a href="course_information.php?id='.$courseId.'">'.
Display::return_icon('info2.png', get_lang('Overview')).'</a>'.
'<a href="'.$courseUrl.'">'.
Display::return_icon('course_home.png', get_lang('Course home')).'</a>'.

Loading…
Cancel
Save