course_home.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <?php // $Id: course_home.php 9744 2006-10-25 10:04:16Z fvauthier $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004-2005 Dokeos S.A.
  6. Copyright (c) 2003 Ghent University
  7. Copyright (c) 2001 Universite Catholique de Louvain
  8. Copyright (c) various contributors
  9. For a full list of contributors, see "credits.txt".
  10. The full license can be read in "license.txt".
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15. See the GNU General Public License for more details.
  16. Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
  17. Mail: info@dokeos.com
  18. ==============================================================================
  19. */
  20. /**
  21. ==============================================================================
  22. * HOME PAGE FOR EACH COURSE
  23. *
  24. * This page, included in every course's index.php is the home
  25. * page. To make administration simple, the teacher edits his
  26. * course from the home page. Only the login detects that the
  27. * visitor is allowed to activate, deactivate home page links,
  28. * access to the teachers tools (statistics, edit forums...).
  29. *
  30. * Edit visibility of tools
  31. *
  32. * visibility = 1 - everybody
  33. * visibility = 0 - course admin (teacher) and platform admin
  34. *
  35. * Who can change visibility ?
  36. *
  37. * admin = 0 - course admin (teacher) and platform admin
  38. * admin = 1 - platform admin
  39. *
  40. * Show message to confirm that a tools must be hide from available tools
  41. *
  42. * visibility 0,1
  43. *
  44. *
  45. * @package dokeos.course_home
  46. ==============================================================================
  47. */
  48. /*
  49. ==============================================================================
  50. INIT SECTION
  51. ==============================================================================
  52. */
  53. if(!isset($cidReq))
  54. {
  55. $cidReq = $dbname; // to provide compatibility. with previous system
  56. GLOBAL $error_msg,$error_no;
  57. $classError = "init";
  58. $error_no[$classError][] = "2";
  59. $error_level[$classError][] = "info";
  60. $error_msg[$classError][] = "[".__FILE__."][".__LINE__."] cidReq was Missing $cidReq take $dbname;";
  61. }
  62. // is this needed?????
  63. $section = "course";
  64. // The langauge file
  65. $langFile = "course_home";
  66. // inlcuding the global file
  67. include('../../main/inc/global.inc.php');
  68. // The section for the tabs
  69. $this_section=SECTION_COURSES;
  70. /*
  71. -----------------------------------------------------------
  72. Libraries
  73. -----------------------------------------------------------
  74. */
  75. include_once(api_get_path(LIBRARY_PATH) . 'course.lib.php');
  76. include_once(api_get_path(LIBRARY_PATH) . 'debug.lib.inc.php');
  77. /*
  78. -----------------------------------------------------------
  79. Constants
  80. -----------------------------------------------------------
  81. */
  82. define ("TOOL_PUBLIC", "Public");
  83. define ("TOOL_PUBLIC_BUT_HIDDEN", "PublicButHide");
  84. define ("TOOL_COURSE_ADMIN", "courseAdmin");
  85. define ("TOOL_PLATFORM_ADMIN", "platformAdmin");
  86. define ("TOOL_AUTHORING", "toolauthoring");
  87. define ("TOOL_INTERACTION", "toolinteraction");
  88. define ("TOOL_ADMIN", "tooladmin");
  89. define ("TOOL_ADMIN_PLATEFORM", "tooladminplatform");
  90. // ("TOOL_ADMIN_PLATFORM_VISIBLE", "tooladminplatformvisible");
  91. //define ("TOOL_ADMIN_PLATFORM_INVISIBLE", "tooladminplatforminvisible");
  92. //define ("TOOL_ADMIN_COURS_INVISIBLE", "tooladmincoursinvisible");
  93. define ("TOOL_STUDENT_VIEW", "toolstudentview");
  94. define ("TOOL_ADMIN_VISIBLE", "tooladminvisible");
  95. /*
  96. -----------------------------------------------------------
  97. Virtual course support code
  98. -----------------------------------------------------------
  99. */
  100. $user_id = api_get_user_id();
  101. $course_code = $_course["sysCode"];
  102. $course_info = Database::get_course_info($course_code);
  103. $return_result = CourseManager::determine_course_title_from_course_info($_uid, $course_info);
  104. $course_title = $return_result["title"];
  105. $course_code = $return_result["code"];
  106. $_course["name"] = $course_title;
  107. $_course['official_code'] = $course_code;
  108. api_session_unregister('toolgroup');
  109. /*
  110. -----------------------------------------------------------
  111. Header
  112. -----------------------------------------------------------
  113. */
  114. Display::display_header($course_title, "Home");
  115. /*
  116. -----------------------------------------------------------
  117. Is the user allowed here?
  118. -----------------------------------------------------------
  119. */
  120. if($is_allowed_in_course == false)
  121. {
  122. api_not_allowed();
  123. }
  124. /*
  125. -----------------------------------------------------------
  126. Session Management
  127. -----------------------------------------------------------
  128. */
  129. if(api_get_setting('use_session_mode')=='true' && $is_allowed_in_course)
  130. {
  131. $tbl_session = Database::get_main_table(MAIN_SESSION_TABLE);
  132. $tbl_user = Database::get_main_table(MAIN_USER_TABLE);
  133. $tbl_session_course = Database::get_main_table(MAIN_SESSION_COURSE_TABLE);
  134. $tbl_session_course_user = Database::get_main_table(MAIN_SESSION_COURSE_USER_TABLE);
  135. if(!empty($_GET['id_session']))
  136. {
  137. $_SESSION['id_session'] = $_GET['id_session'];
  138. $sql = 'SELECT name FROM '.$tbl_session . ' WHERE id="'.$_SESSION['id_session'] . '"';
  139. $rs = api_sql_query($sql,__FILE__,__LINE__);
  140. list($_SESSION['session_name']) = mysql_fetch_array($rs);
  141. }
  142. }
  143. /*
  144. -----------------------------------------------------------
  145. STATISTICS
  146. -----------------------------------------------------------
  147. */
  148. if(!isset($coursesAlreadyVisited[$_cid]) )
  149. {
  150. include(api_get_path(LIBRARY_PATH) . 'events.lib.inc.php');
  151. event_access_course();
  152. $coursesAlreadyVisited[$_cid] = 1;
  153. api_session_register('coursesAlreadyVisited');
  154. }
  155. $tool_table = Database::get_course_table(TOOL_LIST_TABLE);
  156. $temps=time();
  157. $reqdate="&reqdate=$temps";
  158. /*
  159. ==============================================================================
  160. MAIN CODE
  161. ==============================================================================
  162. */
  163. //display course title for course home page (similar to toolname for tool pages)
  164. //echo '<h3>'.api_display_tool_title($nameTools) . '</h3>';
  165. /*
  166. -----------------------------------------------------------
  167. Introduction section
  168. (editable by course admins)
  169. -----------------------------------------------------------
  170. */
  171. Display::display_introduction_section(TOOL_COURSE_HOMEPAGE);
  172. /*
  173. -----------------------------------------------------------
  174. SWITCH TO A DIFFERENT HOMEPAGE VIEW
  175. the setting homepage_view is adjustable through
  176. the platform administration section
  177. -----------------------------------------------------------
  178. */
  179. if(get_setting('homepage_view') == "activity")
  180. include('activity.php');
  181. elseif(get_setting('homepage_view') == "2column")
  182. include('2column.php');
  183. elseif(get_setting('homepage_view') == "3column")
  184. include('3column.php');
  185. /*
  186. ==============================================================================
  187. FOOTER
  188. ==============================================================================
  189. */
  190. Display::display_footer();
  191. ?>