course_information.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <?php
  2. // $Id: course_information.php 9246 2006-09-25 13:24:53Z bmol $
  3. /*
  4. ==============================================================================
  5. Dokeos - elearning and course management software
  6. Copyright (c) 2004 Dokeos S.A.
  7. Copyright (c) 2003 Ghent University (UGent)
  8. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  9. Copyright (c) Olivier Brouckaert
  10. For a full list of contributors, see "credits.txt".
  11. The full license can be read in "license.txt".
  12. This program is free software; you can redistribute it and/or
  13. modify it under the terms of the GNU General Public License
  14. as published by the Free Software Foundation; either version 2
  15. of the License, or (at your option) any later version.
  16. See the GNU General Public License for more details.
  17. Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  18. ==============================================================================
  19. */
  20. /**
  21. ==============================================================================
  22. @author Bart Mollet
  23. * @package dokeos.admin
  24. ==============================================================================
  25. */
  26. /*
  27. ==============================================================================
  28. INIT SECTION
  29. ==============================================================================
  30. */
  31. $langFile = 'admin';
  32. $cidReset = true;
  33. require ('../inc/global.inc.php');
  34. require_once(api_get_path(LIBRARY_PATH).'sortabletable.class.php');
  35. $this_section=SECTION_PLATFORM_ADMIN;
  36. api_protect_admin_script();
  37. /**
  38. *
  39. */
  40. function get_course_usage($course_code)
  41. {
  42. $table = Database::get_main_table(MAIN_COURSE_TABLE);
  43. $sql = "SELECT * FROM $table WHERE code='".$course_code."'";
  44. $res = api_sql_query($sql,__FILE__,__LINE__);
  45. $course = mysql_fetch_object($res);
  46. // Learnpaths
  47. $table = Database :: get_course_table(LEARNPATH_MAIN_TABLE, $course->db_name);
  48. $usage[] = array (get_lang(TOOL_LEARNPATH), Database::count_rows($table));
  49. // Forums
  50. $table = Database :: get_course_table(FORUM_TABLE, $course->db_name);
  51. $usage[] = array (get_lang(TOOL_BB_FORUM), Database::count_rows($table));
  52. // Quizzes
  53. $table = Database :: get_course_table(QUIZ_TEST_TABLE, $course->db_name);
  54. $usage[] = array (get_lang(TOOL_QUIZ), Database::count_rows($table));
  55. // Documents
  56. $table = Database :: get_course_table(DOCUMENT_TABLE, $course->db_name);
  57. $usage[] = array (get_lang(TOOL_DOCUMENT), Database::count_rows($table));
  58. // Groups
  59. $table = Database :: get_course_table(GROUP_TABLE, $course->db_name);
  60. $usage[] = array (get_lang(TOOL_GROUP), Database::count_rows($table));
  61. // Calendar
  62. $table = Database :: get_course_table(AGENDA_TABLE, $course->db_name);
  63. $usage[] = array (get_lang(TOOL_CALENDAR_EVENT), Database::count_rows($table));
  64. // Link
  65. $table = Database::get_course_table(LINK_TABLE, $course->db_name);
  66. $usage[] = array(get_lang(TOOL_LINK), Database::count_rows($table));
  67. // Announcements
  68. $table = Database::get_course_table(ANNOUNCEMENT_TABLE, $course->db_name);
  69. $usage[] = array(get_lang(TOOL_ANNOUNCEMENT), Database::count_rows($table));
  70. return $usage;
  71. }
  72. /*****************************************************************/
  73. if (!isset ($_GET['code']))
  74. {
  75. api_not_allowed();
  76. }
  77. //$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('PlatformAdmin'));
  78. $interbreadcrumb[] = array ("url" => 'course_list.php', "name" => get_lang('Courses'));
  79. $table_course = Database :: get_main_table(MAIN_COURSE_TABLE);
  80. $code = $_GET['code'];
  81. $sql = "SELECT * FROM $table_course WHERE code = '".$code."'";
  82. $res = api_sql_query($sql,__FILE__,__LINE__);
  83. $course = mysql_fetch_object($res);
  84. $tool_name = $course->title.' ('.$course->code.')';
  85. Display::display_header($tool_name);
  86. //api_display_tool_title($tool_name);
  87. ?>
  88. <p>
  89. <a href="<?php echo api_get_path(WEB_COURSE_PATH).$course->directory; ?>"><img src="../img/home_small.gif" border="0" /> <?php echo api_get_path(WEB_COURSE_PATH).$course->directory; ?></a>
  90. <br/>
  91. <?php
  92. if( get_setting('server_type') == 'test')
  93. {
  94. ?>
  95. <a href="course_create_content.php?course_code=<?php echo $course->code ?>"><?php echo get_lang('AddDummyContentToCourse') ?></a>
  96. <?php
  97. }
  98. ?>
  99. </p>
  100. <?php
  101. echo '<h4>'.get_lang('CourseUsage').'</h4>';
  102. echo '<blockquote>';
  103. $table = new SortableTableFromArray(get_course_usage($course->code),0,20,'usage_table');
  104. $table->set_additional_parameters(array ('code' => $_GET['code']));
  105. $table->set_other_tables(array('user_table','class_table'));
  106. $table->set_header(0,get_lang('Tool'), true);
  107. $table->set_header(1,get_lang('NumberOfItems'), true);
  108. $table->display();
  109. echo '</blockquote>';
  110. /**
  111. * Show all users subscribed in this course
  112. */
  113. echo '<h4>'.get_lang('Users').'</h4>';
  114. echo '<blockquote>';
  115. $table_course_user = Database :: get_main_table(MAIN_COURSE_USER_TABLE);
  116. $table_user = Database :: get_main_table(MAIN_USER_TABLE);
  117. $sql = 'SELECT *,cu.status as course_status FROM '.$table_course_user.' cu, '.$table_user." u WHERE cu.user_id = u.user_id AND cu.course_code = '".$code."' ";
  118. $res = api_sql_query($sql,__FILE__,__LINE__);
  119. if (mysql_num_rows($res) > 0)
  120. {
  121. $users = array ();
  122. while ($obj = mysql_fetch_object($res))
  123. {
  124. $user = array ();
  125. $user[] = $obj->official_code;
  126. $user[] = $obj->firstname;
  127. $user[] = $obj->lastname;
  128. $user[] = Display :: encrypted_mailto_link($obj->email, $obj->email);
  129. $user[] = $obj->course_status == 5 ? get_lang('Student') : get_lang('Teacher');
  130. $user[] = '<a href="user_information.php?user_id='.$obj->user_id.'"><img src="../img/info_small.gif" border="0" /></a>';
  131. $users[] = $user;
  132. }
  133. $table = new SortableTableFromArray($users,0,20,'user_table');
  134. $table->set_additional_parameters(array ('code' => $_GET['code']));
  135. $table->set_other_tables(array('usage_table','class_table'));
  136. $table->set_header(0,get_lang('OfficialCode'), true);
  137. $table->set_header(1,get_lang('FirstName'), true);
  138. $table->set_header(2,get_lang('LastName'), true);
  139. $table->set_header(3,get_lang('Email'), true);
  140. $table->set_header(4,get_lang('Status'), true);
  141. $table->set_header(5,'', false);
  142. $table->display();
  143. }
  144. else
  145. {
  146. echo get_lang('NoUsersInCourse');
  147. }
  148. echo '</blockquote>';
  149. /**
  150. * Show all classes subscribed in this course
  151. */
  152. $table_course_class = Database :: get_main_table(MAIN_COURSE_CLASS_TABLE);
  153. $table_class = Database :: get_main_table(MAIN_CLASS_TABLE);
  154. $sql = 'SELECT * FROM '.$table_course_class.' cc, '.$table_class.' c WHERE cc.class_id = c.id AND cc.course_code = '."'".$_GET['code']."'";
  155. $res = api_sql_query($sql,__FILE__,__LINE__);
  156. if (mysql_num_rows($res) > 0)
  157. {
  158. $data = array ();
  159. while ($class = mysql_fetch_object($res))
  160. {
  161. $row = array ();
  162. $row[] = $class->name;
  163. $row[] = '<a href="class_information.php?id='.$class->id.'"><img src="../img/info_small.gif" border="0" /></a>';
  164. $data[] = $row;
  165. }
  166. echo '<p><b>'.get_lang('AdminClasses').'</b></p>';
  167. echo '<blockquote>';
  168. $table = new SortableTableFromArray($data,0,20,'class_table');
  169. $table->set_additional_parameters(array ('code' => $_GET['code']));
  170. $table->set_other_tables(array('usage_table','user_table'));
  171. $table->set_header(0,get_lang('Title'));
  172. $table->set_header(1,'');
  173. $table->display();
  174. echo '</blockquote>';
  175. }
  176. else
  177. {
  178. echo '<p>'.get_lang('NoClassesForThisCourse').'</p>';
  179. }
  180. /*
  181. ==============================================================================
  182. FOOTER
  183. ==============================================================================
  184. */
  185. Display::display_footer();
  186. ?>