course_home.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <?php // $Id: course_home.php 13970 2007-12-05 16:56:20Z yannoo $
  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 type=\"text/css\" media=\"screen, projection\">
  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. // name of the language file that needs to be included
  66. $language_file[] = "course_home";
  67. $use_anonymous = true;
  68. // inlcuding the global file
  69. include('../../main/inc/global.inc.php');
  70. if(!isset($cidReq))
  71. {
  72. $cidReq = api_get_course_id(); // to provide compatibility. with previous system
  73. global $error_msg,$error_no;
  74. $classError = "init";
  75. $error_no[$classError][] = "2";
  76. $error_level[$classError][] = "info";
  77. $error_msg[$classError][] = "[".__FILE__."][".__LINE__."] cidReq was Missing $cidReq take $dbname;";
  78. }
  79. if(isset($_SESSION['_gid'])){
  80. unset($_SESSION['_gid']);
  81. }
  82. // The section for the tabs
  83. $this_section=SECTION_COURSES;
  84. /*
  85. -----------------------------------------------------------
  86. Libraries
  87. -----------------------------------------------------------
  88. */
  89. include_once(api_get_path(LIBRARY_PATH) . 'course.lib.php');
  90. include_once(api_get_path(LIBRARY_PATH) . 'debug.lib.inc.php');
  91. /*
  92. -----------------------------------------------------------
  93. Constants
  94. -----------------------------------------------------------
  95. */
  96. define ("TOOL_PUBLIC", "Public");
  97. define ("TOOL_PUBLIC_BUT_HIDDEN", "PublicButHide");
  98. define ("TOOL_COURSE_ADMIN", "courseAdmin");
  99. define ("TOOL_PLATFORM_ADMIN", "platformAdmin");
  100. define ("TOOL_AUTHORING", "toolauthoring");
  101. define ("TOOL_INTERACTION", "toolinteraction");
  102. define ("TOOL_ADMIN", "tooladmin");
  103. define ("TOOL_ADMIN_PLATEFORM", "tooladminplatform");
  104. // ("TOOL_ADMIN_PLATFORM_VISIBLE", "tooladminplatformvisible");
  105. //define ("TOOL_ADMIN_PLATFORM_INVISIBLE", "tooladminplatforminvisible");
  106. //define ("TOOL_ADMIN_COURS_INVISIBLE", "tooladmincoursinvisible");
  107. define ("TOOL_STUDENT_VIEW", "toolstudentview");
  108. define ("TOOL_ADMIN_VISIBLE", "tooladminvisible");
  109. /*
  110. -----------------------------------------------------------
  111. Virtual course support code
  112. -----------------------------------------------------------
  113. */
  114. $user_id = api_get_user_id();
  115. $course_code = $_course["sysCode"];
  116. $course_info = Database::get_course_info($course_code);
  117. $return_result = CourseManager::determine_course_title_from_course_info($_user['user_id'], $course_info);
  118. $course_title = $return_result["title"];
  119. $course_code = $return_result["code"];
  120. $_course["name"] = $course_title;
  121. $_course['official_code'] = $course_code;
  122. api_session_unregister('toolgroup');
  123. /*
  124. -----------------------------------------------------------
  125. Is the user allowed here?
  126. -----------------------------------------------------------
  127. */
  128. if($is_allowed_in_course == false)
  129. {
  130. api_not_allowed(true);
  131. }
  132. /*
  133. -----------------------------------------------------------
  134. Header
  135. -----------------------------------------------------------
  136. */
  137. Display::display_header($course_title, "Home");
  138. /*
  139. -----------------------------------------------------------
  140. STATISTICS
  141. -----------------------------------------------------------
  142. */
  143. if(!isset($coursesAlreadyVisited[$_cid]) )
  144. {
  145. include(api_get_path(LIBRARY_PATH) . 'events.lib.inc.php');
  146. event_access_course();
  147. $coursesAlreadyVisited[$_cid] = 1;
  148. api_session_register('coursesAlreadyVisited');
  149. }
  150. $tool_table = Database::get_course_table(TABLE_TOOL_LIST);
  151. $temps=time();
  152. $reqdate="&reqdate=$temps";
  153. /*
  154. ==============================================================================
  155. MAIN CODE
  156. ==============================================================================
  157. */
  158. //display course title for course home page (similar to toolname for tool pages)
  159. //echo '<h3>'.api_display_tool_title($nameTools) . '</h3>';
  160. /*
  161. -----------------------------------------------------------
  162. Introduction section
  163. (editable by course admins)
  164. -----------------------------------------------------------
  165. */
  166. $fck_attribute['Width'] = '100%';
  167. $fck_attribute['Height'] = '400';
  168. $fck_attribute['ToolbarSet'] = 'Full';
  169. Display::display_introduction_section(TOOL_COURSE_HOMEPAGE);
  170. /*
  171. -----------------------------------------------------------
  172. SWITCH TO A DIFFERENT HOMEPAGE VIEW
  173. the setting homepage_view is adjustable through
  174. the platform administration section
  175. -----------------------------------------------------------
  176. */
  177. if(get_setting('homepage_view') == "activity")
  178. {
  179. include('activity.php');
  180. }
  181. elseif(get_setting('homepage_view') == "2column")
  182. {
  183. include('2column.php');
  184. }
  185. elseif(get_setting('homepage_view') == "3column")
  186. {
  187. include('3column.php');
  188. }
  189. /*
  190. ==============================================================================
  191. FOOTER
  192. ==============================================================================
  193. */
  194. Display::display_footer();
  195. ?>