course_home.php 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <?php // $Id: course_home.php 11342 2007-03-02 13:48:38Z elixir_julian $
  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. $htmlHeadXtra[] = "
  54. <style>
  55. .row{
  56. width:100%;
  57. }
  58. div.row div.label {
  59. width: 0%;
  60. }
  61. div.row div.formw {
  62. width: 100%;
  63. }
  64. </style>";
  65. if(!isset($cidReq))
  66. {
  67. $cidReq = $dbname; // to provide compatibility. with previous system
  68. GLOBAL $error_msg,$error_no;
  69. $classError = "init";
  70. $error_no[$classError][] = "2";
  71. $error_level[$classError][] = "info";
  72. $error_msg[$classError][] = "[".__FILE__."][".__LINE__."] cidReq was Missing $cidReq take $dbname;";
  73. }
  74. // is this needed?????
  75. $section = "course";
  76. // name of the language file that needs to be included
  77. $language_file = "course_home";
  78. // inlcuding the global file
  79. include('../../main/inc/global.inc.php');
  80. if(isset($_SESSION['_gid'])){
  81. unset($_SESSION['_gid']);
  82. }
  83. // The section for the tabs
  84. $this_section=SECTION_COURSES;
  85. /*
  86. -----------------------------------------------------------
  87. Libraries
  88. -----------------------------------------------------------
  89. */
  90. include_once(api_get_path(LIBRARY_PATH) . 'course.lib.php');
  91. include_once(api_get_path(LIBRARY_PATH) . 'debug.lib.inc.php');
  92. /*
  93. -----------------------------------------------------------
  94. Constants
  95. -----------------------------------------------------------
  96. */
  97. define ("TOOL_PUBLIC", "Public");
  98. define ("TOOL_PUBLIC_BUT_HIDDEN", "PublicButHide");
  99. define ("TOOL_COURSE_ADMIN", "courseAdmin");
  100. define ("TOOL_PLATFORM_ADMIN", "platformAdmin");
  101. define ("TOOL_AUTHORING", "toolauthoring");
  102. define ("TOOL_INTERACTION", "toolinteraction");
  103. define ("TOOL_ADMIN", "tooladmin");
  104. define ("TOOL_ADMIN_PLATEFORM", "tooladminplatform");
  105. // ("TOOL_ADMIN_PLATFORM_VISIBLE", "tooladminplatformvisible");
  106. //define ("TOOL_ADMIN_PLATFORM_INVISIBLE", "tooladminplatforminvisible");
  107. //define ("TOOL_ADMIN_COURS_INVISIBLE", "tooladmincoursinvisible");
  108. define ("TOOL_STUDENT_VIEW", "toolstudentview");
  109. define ("TOOL_ADMIN_VISIBLE", "tooladminvisible");
  110. /*
  111. -----------------------------------------------------------
  112. Virtual course support code
  113. -----------------------------------------------------------
  114. */
  115. $user_id = api_get_user_id();
  116. $course_code = $_course["sysCode"];
  117. $course_info = Database::get_course_info($course_code);
  118. $return_result = CourseManager::determine_course_title_from_course_info($_user['user_id'], $course_info);
  119. $course_title = $return_result["title"];
  120. $course_code = $return_result["code"];
  121. $_course["name"] = $course_title;
  122. $_course['official_code'] = $course_code;
  123. api_session_unregister('toolgroup');
  124. /*
  125. -----------------------------------------------------------
  126. Header
  127. -----------------------------------------------------------
  128. */
  129. Display::display_header($course_title, "Home");
  130. /*
  131. -----------------------------------------------------------
  132. Is the user allowed here?
  133. -----------------------------------------------------------
  134. */
  135. if($is_allowed_in_course == false)
  136. {
  137. api_not_allowed();
  138. }
  139. /*
  140. -----------------------------------------------------------
  141. Session Management
  142. -----------------------------------------------------------
  143. */
  144. if(api_get_setting('use_session_mode')=='true' && $is_allowed_in_course)
  145. {
  146. // Database Table Definitions
  147. $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
  148. $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
  149. $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
  150. $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
  151. if(!empty($_GET['id_session']))
  152. {
  153. $_SESSION['id_session'] = $_GET['id_session'];
  154. $sql = 'SELECT name FROM '.$tbl_session . ' WHERE id="'.$_SESSION['id_session'] . '"';
  155. $rs = api_sql_query($sql,__FILE__,__LINE__);
  156. list($_SESSION['session_name']) = mysql_fetch_array($rs);
  157. }
  158. }
  159. /*
  160. -----------------------------------------------------------
  161. STATISTICS
  162. -----------------------------------------------------------
  163. */
  164. if(!isset($coursesAlreadyVisited[$_cid]) )
  165. {
  166. include(api_get_path(LIBRARY_PATH) . 'events.lib.inc.php');
  167. event_access_course();
  168. $coursesAlreadyVisited[$_cid] = 1;
  169. api_session_register('coursesAlreadyVisited');
  170. }
  171. $tool_table = Database::get_course_table(TABLE_TOOL_LIST);
  172. $temps=time();
  173. $reqdate="&reqdate=$temps";
  174. /*
  175. ==============================================================================
  176. MAIN CODE
  177. ==============================================================================
  178. */
  179. //display course title for course home page (similar to toolname for tool pages)
  180. //echo '<h3>'.api_display_tool_title($nameTools) . '</h3>';
  181. /*
  182. -----------------------------------------------------------
  183. Introduction section
  184. (editable by course admins)
  185. -----------------------------------------------------------
  186. */
  187. $fck_attribute['Width'] = '100%';
  188. $fck_attribute['Height'] = '400';
  189. $fck_attribute['ToolbarSet'] = 'Full';
  190. Display::display_introduction_section(TOOL_COURSE_HOMEPAGE);
  191. /*
  192. -----------------------------------------------------------
  193. SWITCH TO A DIFFERENT HOMEPAGE VIEW
  194. the setting homepage_view is adjustable through
  195. the platform administration section
  196. -----------------------------------------------------------
  197. */
  198. if(get_setting('homepage_view') == "activity")
  199. include('activity.php');
  200. elseif(get_setting('homepage_view') == "2column")
  201. include('2column.php');
  202. elseif(get_setting('homepage_view') == "3column")
  203. include('3column.php');
  204. /*
  205. ==============================================================================
  206. FOOTER
  207. ==============================================================================
  208. */
  209. Display::display_footer();
  210. ?>