class_information.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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_once '../inc/global.inc.php';
  14. $this_section = SECTION_PLATFORM_ADMIN;
  15. api_protect_admin_script();
  16. require_once 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. $users = ClassManager::get_users($class_id);
  32. if (count($users) > 0) {
  33. $is_western_name_order = api_is_western_name_order();
  34. $table_header[] = array (get_lang('OfficialCode'), true);
  35. if ($is_western_name_order) {
  36. $table_header[] = array (get_lang('FirstName'), true);
  37. $table_header[] = array (get_lang('LastName'), true);
  38. } else {
  39. $table_header[] = array (get_lang('LastName'), true);
  40. $table_header[] = array (get_lang('FirstName'), true);
  41. }
  42. $table_header[] = array (get_lang('Email'), true);
  43. $table_header[] = array (get_lang('Status'), true);
  44. $table_header[] = array ('', false);
  45. $data = array();
  46. foreach($users as $index => $user) {
  47. $username = api_htmlentities(sprintf(get_lang('LoginX'), $user['username']), ENT_QUOTES);
  48. $row = array ();
  49. $row[] = $user['official_code'];
  50. if ($is_western_name_order) {
  51. $row[] = $user['firstname'];
  52. $row[] = "<span title='$username'>".$user['lastname']."</span>";
  53. } else {
  54. $row[] = "<span title='$username'>".$user['lastname']."</span>";
  55. $row[] = $user['firstname'];
  56. }
  57. $row[] = Display :: encrypted_mailto_link($user['email'], $user['email']);
  58. $row[] = $user['status'] == 5 ? get_lang('Student') : get_lang('Teacher');
  59. $row[] = '<a href="user_information.php?user_id='.$user['user_id'].'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a>';
  60. $data[] = $row;
  61. }
  62. Display::display_sortable_table($table_header,$data,array(),array(),array('id'=>$_GET['id']));
  63. } else {
  64. echo get_lang('NoUsersInClass');
  65. }
  66. /**
  67. * Show all courses in which this class is subscribed.
  68. */
  69. $courses = ClassManager::get_courses($class_id);
  70. if (count($courses) > 0) {
  71. $header[] = array (get_lang('Code'), true);
  72. $header[] = array (get_lang('Title'), true);
  73. $header[] = array ('', false);
  74. $data = array ();
  75. foreach( $courses as $index => $course) {
  76. $row = array ();
  77. $row[] = $course['visual_code'];
  78. $row[] = $course['title'];
  79. $row[] = '<a href="course_information.php?code='.$course['code'].'">'.Display::return_icon('info_small.gif', get_lang('Delete')).'</a>'.
  80. '<a href="'.api_get_path(WEB_COURSE_PATH).$course['directory'].'">'.Display::return_icon('course_home.gif', get_lang('CourseHome')).'</a>' .
  81. '<a href="course_edit.php?course_code='.$course['code'].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
  82. $data[] = $row;
  83. }
  84. echo '<p><b>'.get_lang('Courses').'</b></p>';
  85. echo '<blockquote>';
  86. Display :: display_sortable_table($header, $data, array (), array (), array('id'=>$_GET['id']));
  87. echo '</blockquote>';
  88. } else {
  89. echo '<p>'.get_lang('NoCoursesForThisClass').'</p>';
  90. }
  91. // Displaying the footer.
  92. Display::display_footer();