class_information.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.admin
  5. */
  6. /**
  7. * Code
  8. * @author Bart Mollet
  9. */
  10. // Language files that should be included.
  11. $language_file = 'admin';
  12. $cidReset = true;
  13. require '../inc/global.inc.php';
  14. $this_section = SECTION_PLATFORM_ADMIN;
  15. api_protect_admin_script();
  16. require api_get_path(LIBRARY_PATH).'classmanager.lib.php';
  17. if (!isset($_GET['id'])) {
  18. api_not_allowed();
  19. }
  20. $interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
  21. $interbreadcrumb[] = array ('url' => 'class_list.php', 'name' => get_lang('AdminClasses'));
  22. $class_id = $_GET['id'];
  23. $class = ClassManager::get_class_info($class_id);
  24. $tool_name = $class['name'];
  25. Display::display_header($tool_name);
  26. //api_display_tool_title($tool_name);
  27. /**
  28. * Show all users subscribed in this class.
  29. */
  30. echo '<h4>'.get_lang('Users').'</h4>';
  31. echo '<blockquote>';
  32. $users = ClassManager::get_users($class_id);
  33. if (count($users) > 0) {
  34. $is_western_name_order = api_is_western_name_order();
  35. $table_header[] = array (get_lang('OfficialCode'), true);
  36. if ($is_western_name_order) {
  37. $table_header[] = array (get_lang('FirstName'), true);
  38. $table_header[] = array (get_lang('LastName'), true);
  39. } else {
  40. $table_header[] = array (get_lang('LastName'), true);
  41. $table_header[] = array (get_lang('FirstName'), true);
  42. }
  43. $table_header[] = array (get_lang('LoginName'), true);
  44. $table_header[] = array (get_lang('Email'), true);
  45. $table_header[] = array (get_lang('Status'), true);
  46. $table_header[] = array ('', false);
  47. $data = array();
  48. foreach($users as $index => $user) {
  49. $row = array ();
  50. $row[] = $user['official_code'];
  51. if ($is_western_name_order) {
  52. $row[] = $user['firstname'];
  53. $row[] = $user['lastname'];
  54. } else {
  55. $row[] = $user['lastname'];
  56. $row[] = $user['firstname'];
  57. }
  58. $row[] = $user['username'];
  59. $row[] = Display :: encrypted_mailto_link($user['email'], $user['email']);
  60. $row[] = $user['status'] == 5 ? get_lang('Student') : get_lang('Teacher');
  61. $row[] = '<a href="user_information.php?user_id='.$user['user_id'].'">'.Display::return_icon('synthese_view.gif').'</a>';
  62. $data[] = $row;
  63. }
  64. Display::display_sortable_table($table_header,$data,array(),array(),array('id'=>$_GET['id']));
  65. } else {
  66. echo get_lang('NoUsersInClass');
  67. }
  68. echo '</blockquote>';
  69. /**
  70. * Show all courses in which this class is subscribed.
  71. */
  72. $courses = ClassManager::get_courses($class_id);
  73. if (count($courses) > 0) {
  74. $header[] = array (get_lang('Code'), true);
  75. $header[] = array (get_lang('Title'), true);
  76. $header[] = array ('', false);
  77. $data = array ();
  78. foreach( $courses as $index => $course) {
  79. $row = array ();
  80. $row[] = $course['visual_code'];
  81. $row[] = $course['title'];
  82. $row[] = '<a href="course_information.php?code='.$course['code'].'">'.Display::return_icon('info_small.gif', get_lang('Delete')).'</a>'.
  83. '<a href="'.api_get_path(WEB_COURSE_PATH).$course['directory'].'">'.Display::return_icon('course_home.gif', get_lang('CourseHome')).'</a>' .
  84. '<a href="course_edit.php?course_code='.$course['code'].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
  85. $data[] = $row;
  86. }
  87. echo '<p><b>'.get_lang('Courses').'</b></p>';
  88. echo '<blockquote>';
  89. Display :: display_sortable_table($header, $data, array (), array (), array('id'=>$_GET['id']));
  90. echo '</blockquote>';
  91. } else {
  92. echo '<p>'.get_lang('NoCoursesForThisClass').'</p>';
  93. }
  94. // Displaying the footer.
  95. Display::display_footer();