Changing place of an ajax request to inc/lib/ajax

skala
Julio Montoya 16 years ago
parent d11a853d85
commit e02cd708c4
  1. 6
      main/auth/courses.php
  2. 29
      main/inc/ajax/course_home.ajax.php

@ -15,7 +15,7 @@
*/
// Names of the language file that needs to be included.
$language_file = array ('courses', 'registration');
$language_file = array ('courses', 'registration');
// Delete the globals['_cid'], we don't need it here.
$cidReset = true; // Flag forcing the 'current course' reset
@ -495,7 +495,7 @@ function display_subscribe_to_courses($courses) {
// block course description
echo "\t\t<td>";
$icon_title = get_lang('CourseDetails') . ' - ' . $course['title'];
echo "<a href='course_description.php?code=".$course['code']."' title='$icon_title' rel='gb_page_center[778]'>".Display::return_icon('synthese_view.gif', $icon_title)."</a>";
echo "<a href='".api_get_path(WEB_CODE_PATH)."inc/lib/ajax/course_home.ajax.php?a=show_course_information&code=".$course['code']."' title='$icon_title' rel='gb_page_center[778]'>".Display::return_icon('synthese_view.gif', $icon_title)."</a>";
echo "\t\t</td>";
}
@ -858,7 +858,7 @@ function display_courses_in_category($user_category_id, $showicons) {
// block course description
echo "\t\t<td>";
$icon_title = get_lang('CourseDetails') . ' - ' . $course['title'];
echo "<a href='course_description.php?code=".$course['code']."' title='$icon_title' rel='gb_page_center[778]'>".Display::return_icon('synthese_view.gif', $icon_title)."</a>";
echo "<a href='".api_get_path(WEB_CODE_PATH)."inc/ajax/course_home.ajax.php?a=show_course_information&code=".$course['code']."' title='$icon_title' rel='gb_page_center[778]'>".Display::return_icon('synthese_view.gif', $icon_title)."</a>";
echo "\t\t</td>";
}

@ -1,13 +1,13 @@
<?php
/* For licensing terms, see /chamilo_license.txt */
/* For licensing terms, see /license.txt */
/**
* Responses to AJAX calls
*/
require_once '../global.inc.php';
$action = $_GET['a'];
*/
$action = $_GET['a'];
switch ($action) {
case 'set_visibility':
require_once '../global.inc.php';
if(api_is_allowed_to_edit(null,true)) {
$tool_table = Database::get_course_table(TABLE_TOOL_LIST);
$tool_id = Security::remove_XSS($_GET["id"]);
@ -80,6 +80,27 @@ switch ($action) {
print(json_encode($response_data));
}
break;
case 'show_course_information' :
$language_file = array ('course_description');
require_once '../global.inc.php';
require_once api_get_path(INCLUDE_PATH).'reduced_header.inc.php' ;
// Get the name of the database course.
$database_course = CourseManager::get_name_database_course($_GET['code']);
$tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION, $database_course);
$sql = "SELECT * FROM $tbl_course_description WHERE session_id=0 ORDER BY id";
$result = Database::query($sql);
while ($description = Database::fetch_object($result)) {
$descriptions[$description->id] = $description;
}
// Function that displays the details of the course description in html.
echo CourseManager::get_details_course_description_html($descriptions, api_get_system_encoding(), false);
break;
default:
echo '';
}

Loading…
Cancel
Save