class_information.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php // $Id: class_information.php 16954 2008-11-26 14:41:35Z pcool $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004 Dokeos S.A.
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) Olivier Brouckaert
  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: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  17. ==============================================================================
  18. */
  19. /**
  20. ==============================================================================
  21. * @author Bart Mollet
  22. * @package dokeos.admin
  23. ==============================================================================
  24. */
  25. /*
  26. ==============================================================================
  27. INIT SECTION
  28. ==============================================================================
  29. */
  30. // name of the language file that needs to be included
  31. $language_file='admin';
  32. $cidReset=true;
  33. require('../inc/global.inc.php');
  34. $this_section=SECTION_PLATFORM_ADMIN;
  35. api_protect_admin_script();
  36. require(api_get_path(LIBRARY_PATH).'classmanager.lib.php');
  37. if( !isset($_GET['id']))
  38. {
  39. api_not_allowed();
  40. }
  41. $interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
  42. $interbreadcrumb[] = array ("url" => 'class_list.php', "name" => get_lang('AdminClasses'));
  43. $class_id = $_GET['id'];
  44. $class = ClassManager::get_class_info($class_id);
  45. $tool_name = $class['name'];
  46. Display::display_header($tool_name);
  47. //api_display_tool_title($tool_name);
  48. /**
  49. * Show all users subscribed in this class
  50. */
  51. echo '<h4>'.get_lang('Users').'</h4>';
  52. echo '<blockquote>';
  53. $users = ClassManager::get_users($class_id);
  54. if( count($users) > 0)
  55. {
  56. $table_header[] = array (get_lang('OfficialCode'), true);
  57. $table_header[] = array (get_lang('FirstName'), true);
  58. $table_header[] = array (get_lang('LastName'), true);
  59. $table_header[] = array (get_lang('Email'), true);
  60. $table_header[] = array (get_lang('Status'), true);
  61. $table_header[] = array ('', false);
  62. $data = array();
  63. foreach($users as $index => $user)
  64. {
  65. $row = array ();
  66. $row[] = $user['official_code'];
  67. $row[] = $user['firstname'];
  68. $row[] = $user['lastname'];
  69. $row[] = Display :: encrypted_mailto_link($user['email'], $user['email']);
  70. $row[] = $user['status'] == 5 ? get_lang('Student') : get_lang('Teacher');
  71. $row[] = '<a href="user_information.php?user_id='.$user['user_id'].'">'.Display::return_icon('synthese_view.gif').'</a>';
  72. $data[] = $row;
  73. }
  74. Display::display_sortable_table($table_header,$data,array(),array(),array('id'=>$_GET['id']));
  75. }
  76. else
  77. {
  78. echo get_lang('NoUsersInClass');
  79. }
  80. echo '</blockquote>';
  81. /**
  82. * Show all courses in which this class is subscribed
  83. */
  84. $courses = ClassManager::get_courses($class_id);
  85. if (count($courses) > 0)
  86. {
  87. $header[] = array (get_lang('Code'), true);
  88. $header[] = array (get_lang('Title'), true);
  89. $header[] = array ('', false);
  90. $data = array ();
  91. foreach( $courses as $index=>$course)
  92. {
  93. $row = array ();
  94. $row[] = $course['visual_code'];
  95. $row[] = $course['title'];
  96. $row[] = '<a href="course_information.php?code='.$course['code'].'">'.Display::return_icon('info_small.gif', get_lang('Delete')).'</a>'.
  97. '<a href="'.api_get_path(WEB_COURSE_PATH).$course['directory'].'">'.Display::return_icon('course_home.gif', get_lang('CourseHome')).'</a>' .
  98. '<a href="course_edit.php?course_code='.$course['code'].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
  99. $data[] = $row;
  100. }
  101. echo '<p><b>'.get_lang('Courses').'</b></p>';
  102. echo '<blockquote>';
  103. Display :: display_sortable_table($header, $data, array (), array (), array('id'=>$_GET['id']));
  104. echo '</blockquote>';
  105. }
  106. else
  107. {
  108. echo '<p>'.get_lang('NoCoursesForThisClass').'</p>';
  109. }
  110. /*
  111. ==============================================================================
  112. FOOTER
  113. ==============================================================================
  114. */
  115. Display::display_footer();
  116. ?>