Bug #5280 - Cleaning code in the file course_home.php. Tested on Ubuntu, http://192.168.xx.xx/dokeos/ - IE6 on Wine and Firefox. Tested on Vista, http://localhost/dokeos/ - IE8, Firefox, Opera, Safari, Chrome. Changing visibility works fine.

skala
Ivan Tcholakov 16 years ago
parent ac9116e974
commit d3f75f5178
  1. 171
      main/course_home/course_home.php

@ -58,38 +58,28 @@
==============================================================================
*/
// name of the language file that needs to be included
$language_file[] = "course_home";
// Name of the language file that needs to be included.
$language_file = 'course_home';
$use_anonymous = true;
// inlcuding the global file
include '../../main/inc/global.inc.php';
// Inlcuding the global initialization file.
require '../../main/inc/global.inc.php';
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
if ($_SERVER['HTTP_HOST'] == 'localhost') {
//Get information of path
$info = explode('courses',api_get_self());
$path_work = substr($info[0],0,strlen($info[0])-1);
} else {
$path_work = "";
}
$htmlHeadXtra[] ='<script type="text/javascript">
$(document).ready(function() {
$(".make_visible_and_invisible").attr("href","javascript:void(0);");
$("td .make_visible_and_invisible > img").click(function () {
make_visible="visible.gif";
make_invisible="invisible.gif";
path_name=$(this).attr("src");
list_path_name=path_name.split("/");
image_link=list_path_name[list_path_name.length-1];
tool_id=$(this).attr("id");
tool_info=tool_id.split("_");
my_tool_id=tool_info[1];
//Delete last item
list_path_name[list_path_name.length-1]=null;
real_path = list_path_name.join("/");
my_protocol = location.protocol;
my_host = location.host;
my_real_path = my_protocol+"//"+my_host;
$(document).ready(function() {
$(".make_visible_and_invisible").attr("href", "javascript:void(0);");
$("td .make_visible_and_invisible > img").click(function () {
make_visible = "visible.gif";
make_invisible = "invisible.gif";
path_name = $(this).attr("src");
list_path_name = path_name.split("/");
image_link = list_path_name[list_path_name.length - 1];
tool_id = $(this).attr("id");
tool_info = tool_id.split("_");
my_tool_id = tool_info[1];
$.ajax({
contentType: "application/x-www-form-urlencoded",
@ -98,45 +88,43 @@ $htmlHeadXtra[] ='<script type="text/javascript">
$("#id_confirmation_message").hide();
},
type: "GET",
url: my_real_path+"'.$path_work.'/main/course_home/activity.php",
data: "id="+my_tool_id+"&sent_http_request=1",
success: function(datos) {
eval("var info="+datos);
new_current_tool_image = real_path+info.image;
new_current_view = real_path+info.view;
url: "'.api_get_path(WEB_CODE_PATH).'course_home/activity.php",
data: "id=" + my_tool_id + "&sent_http_request=1",
success: function(data) {
eval("var info=" + data);
new_current_tool_image = "'.api_get_path(WEB_IMG_PATH).'" + info.image;
new_current_view = "'.api_get_path(WEB_IMG_PATH).'" + info.view;
//eyes
$("#"+tool_id).attr("src",new_current_view);
$("#" + tool_id).attr("src", new_current_view);
//tool
$("#toolimage_"+my_tool_id).attr("src",new_current_tool_image);
$("#toolimage_" + my_tool_id).attr("src", new_current_tool_image);
//clase
$("#tooldesc_"+my_tool_id).attr("class",info.tclass);
$("#istooldesc_"+my_tool_id).attr("class",info.tclass);
$("#tooldesc_" + my_tool_id).attr("class", info.tclass);
$("#istooldesc_" + my_tool_id).attr("class", info.tclass);
if (image_link=="visible.gif") {
$("#"+tool_id).attr("alt","'.get_lang('Activate').'");
$("#"+tool_id).attr("title","'.get_lang('Activate').'");
if (image_link == "visible.gif") {
$("#" + tool_id).attr("alt", "'.get_lang('Activate', '').'");
$("#" + tool_id).attr("title", "'.get_lang('Activate', '').'");
} else {
$("#"+tool_id).attr("alt","'.get_lang('Deactivate').'");
$("#"+tool_id).attr("title","'.get_lang('Deactivate').'");
$("#" + tool_id).attr("alt", "'.get_lang('Deactivate', '').'");
$("#" + tool_id).attr("title", "'.get_lang('Deactivate', '').'");
}
if (info.message=="is_active") {
message = "'.get_lang('ToolIsNowVisible').'";
if (info.message == "is_active") {
message = "'.get_lang('ToolIsNowVisible', '').'";
} else {
message = "'.get_lang('ToolIsNowHidden').'";
message = "'.get_lang('ToolIsNowHidden', '').'";
}
$(".normal-message").hide();
$("#id_confirmation_message").html(message);
$("#id_confirmation_message").show();
} });
}
});
});
});
});
</script>';
if(!isset($cidReq))
{
$cidReq = api_get_course_id(); // to provide compatibility. with previous system
if (!isset($cidReq)) {
$cidReq = api_get_course_id(); // To provide compatibility with previous systems.
global $error_msg,$error_no;
$classError = "init";
$error_no[$classError][] = "2";
@ -144,39 +132,39 @@ if(!isset($cidReq))
$error_msg[$classError][] = "[".__FILE__."][".__LINE__."] cidReq was Missing $cidReq take $dbname;";
}
if(isset($_SESSION['_gid'])){
if (isset($_SESSION['_gid'])) {
unset($_SESSION['_gid']);
}
// The section for the tabs
$this_section=SECTION_COURSES;
$this_section = SECTION_COURSES;
/*
-----------------------------------------------------------
Libraries
-----------------------------------------------------------
*/
include_once(api_get_path(LIBRARY_PATH) . 'course.lib.php');
include_once(api_get_path(LIBRARY_PATH) . 'debug.lib.inc.php');
include_once api_get_path(LIBRARY_PATH).'course.lib.php';
include_once api_get_path(LIBRARY_PATH).'debug.lib.inc.php';
/*
-----------------------------------------------------------
Constants
-----------------------------------------------------------
*/
define ("TOOL_PUBLIC", "Public");
define ("TOOL_PUBLIC_BUT_HIDDEN", "PublicButHide");
define ("TOOL_COURSE_ADMIN", "courseAdmin");
define ("TOOL_PLATFORM_ADMIN", "platformAdmin");
define ("TOOL_AUTHORING", "toolauthoring");
define ("TOOL_INTERACTION", "toolinteraction");
define ("TOOL_ADMIN", "tooladmin");
define ("TOOL_ADMIN_PLATEFORM", "tooladminplatform");
// ("TOOL_ADMIN_PLATFORM_VISIBLE", "tooladminplatformvisible");
//define ("TOOL_ADMIN_PLATFORM_INVISIBLE", "tooladminplatforminvisible");
//define ("TOOL_ADMIN_COURS_INVISIBLE", "tooladmincoursinvisible");
define ("TOOL_STUDENT_VIEW", "toolstudentview");
define ("TOOL_ADMIN_VISIBLE", "tooladminvisible");
define ('TOOL_PUBLIC', 'Public');
define ('TOOL_PUBLIC_BUT_HIDDEN', 'PublicButHide');
define ('TOOL_COURSE_ADMIN', 'courseAdmin');
define ('TOOL_PLATFORM_ADMIN', 'platformAdmin');
define ('TOOL_AUTHORING', 'toolauthoring');
define ('TOOL_INTERACTION', 'toolinteraction');
define ('TOOL_ADMIN', 'tooladmin');
define ('TOOL_ADMIN_PLATEFORM', 'tooladminplatform');
// ('TOOL_ADMIN_PLATFORM_VISIBLE', 'tooladminplatformvisible');
//define ('TOOL_ADMIN_PLATFORM_INVISIBLE', 'tooladminplatforminvisible');
//define ('TOOL_ADMIN_COURS_INVISIBLE', 'tooladmincoursinvisible');
define ('TOOL_STUDENT_VIEW', 'toolstudentview');
define ('TOOL_ADMIN_VISIBLE', 'tooladminvisible');
/*
-----------------------------------------------------------
@ -184,14 +172,14 @@ define ("TOOL_ADMIN_VISIBLE", "tooladminvisible");
-----------------------------------------------------------
*/
$user_id = api_get_user_id();
$course_code = $_course["sysCode"];
$course_code = $_course['sysCode'];
$course_info = Database::get_course_info($course_code);
$return_result = CourseManager::determine_course_title_from_course_info($_user['user_id'], $course_info);
$course_title = $return_result["title"];
$course_code = $return_result["code"];
$course_title = $return_result['title'];
$course_code = $return_result['code'];
$_course["name"] = $course_title;
$_course['name'] = $course_title;
$_course['official_code'] = $course_code;
api_session_unregister('toolgroup');
@ -201,18 +189,17 @@ api_session_unregister('toolgroup');
Is the user allowed here?
-----------------------------------------------------------
*/
if($is_allowed_in_course == false)
{
if (!$is_allowed_in_course) {
api_not_allowed(true);
}
/*
-----------------------------------------------------------
Header
-----------------------------------------------------------
*/
Display::display_header($course_title, "Home");
//Display::display_header($course_title, 'Home');
Display::display_header('', 'Home');
/*
@ -220,8 +207,7 @@ Display::display_header($course_title, "Home");
STATISTICS
-----------------------------------------------------------
*/
if(!isset($coursesAlreadyVisited[$_cid]) )
{
if (!isset($coursesAlreadyVisited[$_cid])) {
event_access_course();
$coursesAlreadyVisited[$_cid] = 1;
api_session_register('coursesAlreadyVisited');
@ -229,9 +215,8 @@ if(!isset($coursesAlreadyVisited[$_cid]) )
$tool_table = Database::get_course_table(TABLE_TOOL_LIST);
$temps=time();
$reqdate="&reqdate=$temps";
$temps = time();
$reqdate = "&reqdate=$temps";
/*
==============================================================================
@ -261,17 +246,14 @@ Display::display_introduction_section(TOOL_COURSE_HOMEPAGE, array(
the platform administration section
-----------------------------------------------------------
*/
if(api_get_setting('homepage_view') == "activity")
{
include('activity.php');
if (api_get_setting('homepage_view') == 'activity') {
require 'activity.php';
}
elseif(api_get_setting('homepage_view') == "2column")
{
include('2column.php');
elseif(api_get_setting('homepage_view') == '2column') {
require '2column.php';
}
elseif(api_get_setting('homepage_view') == "3column")
{
include('3column.php');
elseif(api_get_setting('homepage_view') == '3column') {
require '3column.php';
}
/*
@ -280,4 +262,3 @@ elseif(api_get_setting('homepage_view') == "3column")
==============================================================================
*/
Display::display_footer();
?>

Loading…
Cancel
Save