123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- <?php // $Id: course_home.php 9744 2006-10-25 10:04:16Z fvauthier $
- /*
- ==============================================================================
- Dokeos - elearning and course management software
- Copyright (c) 2004-2005 Dokeos S.A.
- Copyright (c) 2003 Ghent University
- Copyright (c) 2001 Universite Catholique de Louvain
- Copyright (c) various contributors
- For a full list of contributors, see "credits.txt".
- The full license can be read in "license.txt".
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
- See the GNU General Public License for more details.
- Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
- Mail: info@dokeos.com
- ==============================================================================
- */
- /**
- ==============================================================================
- * HOME PAGE FOR EACH COURSE
- *
- * This page, included in every course's index.php is the home
- * page. To make administration simple, the teacher edits his
- * course from the home page. Only the login detects that the
- * visitor is allowed to activate, deactivate home page links,
- * access to the teachers tools (statistics, edit forums...).
- *
- * Edit visibility of tools
- *
- * visibility = 1 - everybody
- * visibility = 0 - course admin (teacher) and platform admin
- *
- * Who can change visibility ?
- *
- * admin = 0 - course admin (teacher) and platform admin
- * admin = 1 - platform admin
- *
- * Show message to confirm that a tools must be hide from available tools
- *
- * visibility 0,1
- *
- *
- * @package dokeos.course_home
- ==============================================================================
- */
- /*
- ==============================================================================
- INIT SECTION
- ==============================================================================
- */
- if(!isset($cidReq))
- {
- $cidReq = $dbname; // to provide compatibility. with previous system
- GLOBAL $error_msg,$error_no;
- $classError = "init";
- $error_no[$classError][] = "2";
- $error_level[$classError][] = "info";
- $error_msg[$classError][] = "[".__FILE__."][".__LINE__."] cidReq was Missing $cidReq take $dbname;";
- }
- // is this needed?????
- $section = "course";
- // The langauge file
- $langFile = "course_home";
- // inlcuding the global file
- include('../../main/inc/global.inc.php');
- // The section for the tabs
- $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');
- /*
- -----------------------------------------------------------
- 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");
- /*
- -----------------------------------------------------------
- Virtual course support code
- -----------------------------------------------------------
- */
- $user_id = api_get_user_id();
- $course_code = $_course["sysCode"];
- $course_info = Database::get_course_info($course_code);
- $return_result = CourseManager::determine_course_title_from_course_info($_uid, $course_info);
- $course_title = $return_result["title"];
- $course_code = $return_result["code"];
- $_course["name"] = $course_title;
- $_course['official_code'] = $course_code;
- api_session_unregister('toolgroup');
- /*
- -----------------------------------------------------------
- Header
- -----------------------------------------------------------
- */
- Display::display_header($course_title, "Home");
- /*
- -----------------------------------------------------------
- Is the user allowed here?
- -----------------------------------------------------------
- */
- if($is_allowed_in_course == false)
- {
- api_not_allowed();
- }
- /*
- -----------------------------------------------------------
- Session Management
- -----------------------------------------------------------
- */
- if(api_get_setting('use_session_mode')=='true' && $is_allowed_in_course)
- {
- $tbl_session = Database::get_main_table(MAIN_SESSION_TABLE);
- $tbl_user = Database::get_main_table(MAIN_USER_TABLE);
- $tbl_session_course = Database::get_main_table(MAIN_SESSION_COURSE_TABLE);
- $tbl_session_course_user = Database::get_main_table(MAIN_SESSION_COURSE_USER_TABLE);
-
- if(!empty($_GET['id_session']))
- {
- $_SESSION['id_session'] = $_GET['id_session'];
- $sql = 'SELECT name FROM '.$tbl_session . ' WHERE id="'.$_SESSION['id_session'] . '"';
- $rs = api_sql_query($sql,__FILE__,__LINE__);
- list($_SESSION['session_name']) = mysql_fetch_array($rs);
- }
- }
- /*
- -----------------------------------------------------------
- STATISTICS
- -----------------------------------------------------------
- */
- if(!isset($coursesAlreadyVisited[$_cid]) )
- {
- include(api_get_path(LIBRARY_PATH) . 'events.lib.inc.php');
- event_access_course();
- $coursesAlreadyVisited[$_cid] = 1;
- api_session_register('coursesAlreadyVisited');
- }
- $tool_table = Database::get_course_table(TOOL_LIST_TABLE);
- $temps=time();
- $reqdate="&reqdate=$temps";
- /*
- ==============================================================================
- MAIN CODE
- ==============================================================================
- */
- //display course title for course home page (similar to toolname for tool pages)
- //echo '<h3>'.api_display_tool_title($nameTools) . '</h3>';
- /*
- -----------------------------------------------------------
- Introduction section
- (editable by course admins)
- -----------------------------------------------------------
- */
- Display::display_introduction_section(TOOL_COURSE_HOMEPAGE);
- /*
- -----------------------------------------------------------
- SWITCH TO A DIFFERENT HOMEPAGE VIEW
- the setting homepage_view is adjustable through
- the platform administration section
- -----------------------------------------------------------
- */
- if(get_setting('homepage_view') == "activity")
- include('activity.php');
- elseif(get_setting('homepage_view') == "2column")
- include('2column.php');
- elseif(get_setting('homepage_view') == "3column")
- include('3column.php');
- /*
- ==============================================================================
- FOOTER
- ==============================================================================
- */
- Display::display_footer();
- ?>
|