group_overview.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <?php // $Id: group_overview.php 16728 2008-11-12 15:49:54Z pcool $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004-2008 Dokeos SPRL
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) various contributors
  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 address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
  17. Mail: info@dokeos.com
  18. ==============================================================================
  19. */
  20. /**
  21. ==============================================================================
  22. * Main page for the group module.
  23. * This script displays the general group settings,
  24. * and a list of groups with buttons to view, edit...
  25. *
  26. * @author Thomas Depraetere, Hugues Peeters, Christophe Gesche: initial versions
  27. * @author Bert Vanderkimpen, improved self-unsubscribe for cvs
  28. * @author Patrick Cool, show group comment under the group name
  29. * @author Roan Embrechts, initial self-unsubscribe code, code cleaning, virtual course support
  30. * @author Bart Mollet, code cleaning, use of Display-library, list of courseAdmin-tools, use of GroupManager
  31. * @package dokeos.group
  32. ==============================================================================
  33. */
  34. /*
  35. ==============================================================================
  36. INIT SECTION
  37. ==============================================================================
  38. */
  39. // name of the language file that needs to be included
  40. $language_file = "group";
  41. include ('../inc/global.inc.php');
  42. $this_section=SECTION_COURSES;
  43. $nameTools = get_lang("GroupOverview");
  44. /*
  45. -----------------------------------------------------------
  46. Libraries
  47. -----------------------------------------------------------
  48. */
  49. include_once (api_get_path(LIBRARY_PATH).'course.lib.php'); //necessary
  50. include_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php');
  51. include_once (api_get_path(LIBRARY_PATH).'export.lib.inc.php');
  52. include_once (api_get_path(LIBRARY_PATH).'events.lib.inc.php'); //necessary for statistics
  53. if( isset($_GET['action']))
  54. {
  55. switch($_GET['action'])
  56. {
  57. case 'export':
  58. $groups = GroupManager::get_group_list();
  59. $data = array();
  60. foreach($groups as $index => $group)
  61. {
  62. $users = GroupManager::get_users($group['id']);
  63. foreach($users as $index => $user)
  64. {
  65. $row = array();
  66. $user = api_get_user_info($user);
  67. $row[] = $group['name'];
  68. $row[] = $user['official_code'];
  69. $row[] = $user['lastName'];
  70. $row[] = $user['firstName'];
  71. $data[] = $row;
  72. }
  73. }
  74. switch($_GET['type'])
  75. {
  76. case 'csv':
  77. Export::export_table_csv($data);
  78. case 'xls':
  79. Export::export_table_xls($data);
  80. }
  81. break;
  82. }
  83. }
  84. /*
  85. -----------------------------------------------------------
  86. Header
  87. -----------------------------------------------------------
  88. */
  89. $interbreadcrumb[]=array("url" => "group.php","name" => get_lang('GroupManagement'));
  90. if (!isset ($_GET['origin']) || $_GET['origin'] != 'learnpath')
  91. { //so we are not in learnpath tool
  92. if (! $is_allowed_in_course) api_not_allowed(true);
  93. else Display::display_header($nameTools,"Group");
  94. }
  95. else
  96. {
  97. ?> <link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CODE_PATH); ?>css/default.css" /> <?php
  98. }
  99. // action links
  100. echo '<div class="actions">';
  101. echo Display::return_icon('csv.gif').'<a href="group_overview.php?'.api_get_cidreq().'&action=export&type=csv">'.get_lang('ExportAsCSV').'</a> ';
  102. echo Display::return_icon('excel.gif').' <a href="group_overview.php?'.api_get_cidreq().'&action=export&type=xls">'.get_lang('ExportAsXLS').'</a>';
  103. echo '</div>';
  104. $categories = GroupManager::get_categories();
  105. foreach($categories as $index => $category)
  106. {
  107. if( api_get_setting('allow_group_categories') == 'true')
  108. {
  109. echo '<h3>'.$category['title'].'</h3>';
  110. }
  111. $groups = GroupManager::get_group_list($category['id']);
  112. echo '<ul>';
  113. foreach($groups as $index => $group)
  114. {
  115. echo '<li>';
  116. echo stripslashes($group['name']);
  117. echo '<ul>';
  118. $users = GroupManager::get_users($group['id']);
  119. foreach($users as $index => $user)
  120. {
  121. $user_info = api_get_user_info($user);
  122. echo '<li>'.$user_info['firstName'].' '.$user_info['lastName'].'</li>';
  123. }
  124. echo '</ul>';
  125. echo '</li>';
  126. }
  127. echo '</ul>';
  128. }
  129. /*
  130. ==============================================================================
  131. FOOTER
  132. ==============================================================================
  133. */
  134. if (!isset ($_GET['origin']) || $_GET['origin'] != 'learnpath')
  135. {
  136. Display::display_footer();
  137. }
  138. ?>