course_information.php 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <?php
  2. // $Id: course_information.php 10204 2006-11-26 20:46:53Z pcool $
  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. // name of the language file that needs to be included
  32. $language_file = 'admin';
  33. $cidReset = true;
  34. require ('../inc/global.inc.php');
  35. require_once(api_get_path(LIBRARY_PATH).'sortabletable.class.php');
  36. $this_section=SECTION_PLATFORM_ADMIN;
  37. api_protect_admin_script();
  38. /**
  39. *
  40. */
  41. function get_course_usage($course_code)
  42. {
  43. $table = Database::get_main_table(TABLE_MAIN_COURSE);
  44. $sql = "SELECT * FROM $table WHERE code='".$course_code."'";
  45. $res = api_sql_query($sql,__FILE__,__LINE__);
  46. $course = mysql_fetch_object($res);
  47. // Learnpaths
  48. $table = Database :: get_course_table(TABLE_LEARNPATH_MAIN, $course->db_name);
  49. $usage[] = array (get_lang(TOOL_LEARNPATH), Database::count_rows($table));
  50. // Forums
  51. $table = Database :: get_course_table(TABLE_FORUM, $course->db_name);
  52. $usage[] = array (get_lang(TOOL_BB_FORUM), Database::count_rows($table));
  53. // Quizzes
  54. $table = Database :: get_course_table(TABLE_QUIZ_TEST, $course->db_name);
  55. $usage[] = array (get_lang(TOOL_QUIZ), Database::count_rows($table));
  56. // Documents
  57. $table = Database :: get_course_table(TABLE_DOCUMENT, $course->db_name);
  58. $usage[] = array (get_lang(TOOL_DOCUMENT), Database::count_rows($table));
  59. // Groups
  60. $table = Database :: get_course_table(TABLE_GROUP, $course->db_name);
  61. $usage[] = array (get_lang(TOOL_GROUP), Database::count_rows($table));
  62. // Calendar
  63. $table = Database :: get_course_table(TABLE_AGENDA, $course->db_name);
  64. $usage[] = array (get_lang(TOOL_CALENDAR_EVENT), Database::count_rows($table));
  65. // Link
  66. $table = Database::get_course_table(TABLE_LINK, $course->db_name);
  67. $usage[] = array(get_lang(TOOL_LINK), Database::count_rows($table));
  68. // Announcements
  69. $table = Database::get_course_table(TABLE_ANNOUNCEMENT, $course->db_name);
  70. $usage[] = array(get_lang(TOOL_ANNOUNCEMENT), Database::count_rows($table));
  71. return $usage;
  72. }
  73. /*****************************************************************/
  74. if (!isset ($_GET['code']))
  75. {
  76. api_not_allowed();
  77. }
  78. //$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('PlatformAdmin'));
  79. $interbreadcrumb[] = array ("url" => 'course_list.php', "name" => get_lang('Courses'));
  80. $table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
  81. $code = $_GET['code'];
  82. $sql = "SELECT * FROM $table_course WHERE code = '".$code."'";
  83. $res = api_sql_query($sql,__FILE__,__LINE__);
  84. $course = mysql_fetch_object($res);
  85. $tool_name = $course->title.' ('.$course->code.')';
  86. Display::display_header($tool_name);
  87. //api_display_tool_title($tool_name);
  88. ?>
  89. <p>
  90. <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>
  91. <br/>
  92. <?php
  93. if( get_setting('server_type') == 'test')
  94. {
  95. ?>
  96. <a href="course_create_content.php?course_code=<?php echo $course->code ?>"><?php echo get_lang('AddDummyContentToCourse') ?></a>
  97. <?php
  98. }
  99. ?>
  100. </p>
  101. <?php
  102. echo '<h4>'.get_lang('CourseUsage').'</h4>';
  103. echo '<blockquote>';
  104. $table = new SortableTableFromArray(get_course_usage($course->code),0,20,'usage_table');
  105. $table->set_additional_parameters(array ('code' => $_GET['code']));
  106. $table->set_other_tables(array('user_table','class_table'));
  107. $table->set_header(0,get_lang('Tool'), true);
  108. $table->set_header(1,get_lang('NumberOfItems'), true);
  109. $table->display();
  110. echo '</blockquote>';
  111. /**
  112. * Show all users subscribed in this course
  113. */
  114. echo '<h4>'.get_lang('Users').'</h4>';
  115. echo '<blockquote>';
  116. $table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
  117. $table_user = Database :: get_main_table(TABLE_MAIN_USER);
  118. $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."' ";
  119. $res = api_sql_query($sql,__FILE__,__LINE__);
  120. if (mysql_num_rows($res) > 0)
  121. {
  122. $users = array ();
  123. while ($obj = mysql_fetch_object($res))
  124. {
  125. $user = array ();
  126. $user[] = $obj->official_code;
  127. $user[] = $obj->firstname;
  128. $user[] = $obj->lastname;
  129. $user[] = Display :: encrypted_mailto_link($obj->email, $obj->email);
  130. $user[] = $obj->course_status == 5 ? get_lang('Student') : get_lang('Teacher');
  131. $user[] = '<a href="user_information.php?user_id='.$obj->user_id.'"><img src="../img/info_small.gif" border="0" /></a>';
  132. $users[] = $user;
  133. }
  134. $table = new SortableTableFromArray($users,0,20,'user_table');
  135. $table->set_additional_parameters(array ('code' => $_GET['code']));
  136. $table->set_other_tables(array('usage_table','class_table'));
  137. $table->set_header(0,get_lang('OfficialCode'), true);
  138. $table->set_header(1,get_lang('FirstName'), true);
  139. $table->set_header(2,get_lang('LastName'), true);
  140. $table->set_header(3,get_lang('Email'), true);
  141. $table->set_header(4,get_lang('Status'), true);
  142. $table->set_header(5,'', false);
  143. $table->display();
  144. }
  145. else
  146. {
  147. echo get_lang('NoUsersInCourse');
  148. }
  149. echo '</blockquote>';
  150. /**
  151. * Show all classes subscribed in this course
  152. */
  153. $table_course_class = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS);
  154. $table_class = Database :: get_main_table(TABLE_MAIN_CLASS);
  155. $sql = 'SELECT * FROM '.$table_course_class.' cc, '.$table_class.' c WHERE cc.class_id = c.id AND cc.course_code = '."'".$_GET['code']."'";
  156. $res = api_sql_query($sql,__FILE__,__LINE__);
  157. if (mysql_num_rows($res) > 0)
  158. {
  159. $data = array ();
  160. while ($class = mysql_fetch_object($res))
  161. {
  162. $row = array ();
  163. $row[] = $class->name;
  164. $row[] = '<a href="class_information.php?id='.$class->id.'"><img src="../img/info_small.gif" border="0" /></a>';
  165. $data[] = $row;
  166. }
  167. echo '<p><b>'.get_lang('AdminClasses').'</b></p>';
  168. echo '<blockquote>';
  169. $table = new SortableTableFromArray($data,0,20,'class_table');
  170. $table->set_additional_parameters(array ('code' => $_GET['code']));
  171. $table->set_other_tables(array('usage_table','user_table'));
  172. $table->set_header(0,get_lang('Title'));
  173. $table->set_header(1,'');
  174. $table->display();
  175. echo '</blockquote>';
  176. }
  177. else
  178. {
  179. echo '<p>'.get_lang('NoClassesForThisCourse').'</p>';
  180. }
  181. /*
  182. ==============================================================================
  183. FOOTER
  184. ==============================================================================
  185. */
  186. Display::display_footer();
  187. ?>