class_information.php 3.6 KB

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