group_overview.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <?php // $Id: group_overview.php 20095 2009-04-24 22:24:33Z juliomontoya $
  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('Groups'));
  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. if (!api_is_allowed_to_edit(false,true)) api_not_allowed(true);
  94. else Display::display_header($nameTools,"Group");
  95. }
  96. else
  97. {
  98. ?> <link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CODE_PATH); ?>css/default.css" /> <?php
  99. }
  100. // action links
  101. echo '<div class="actions">';
  102. echo Display::return_icon('groupadd.gif', get_lang('NewGroupCreate')) . '<a href="group_creation.php?'.api_get_cidreq().'">'.get_lang('NewGroupCreate').'</a>';
  103. echo Display::return_icon('group.gif', get_lang('Groups')) .'<a href="group.php?'.api_get_cidreq().'">'.get_lang('Groups').'</a>';
  104. if (get_setting('allow_group_categories') == 'true') {
  105. echo Display::return_icon('folder_new.gif', get_lang('AddCategory')) . '<a href="group_category.php?'.api_get_cidreq().'&action=add_category">'.get_lang('AddCategory').'</a>&nbsp;';
  106. } else {
  107. //echo '<a href="group_category.php?'.api_get_cidreq().'&id=2">'.Display::return_icon('edit_group.gif').'&nbsp;'.get_lang('PropModify').'</a>&nbsp;';
  108. echo Display::return_icon('settings.gif', get_lang('PropModify')) . '<a href="group_category.php?'.api_get_cidreq().'&id=2">'.get_lang('PropModify').'</a>&nbsp;';
  109. }
  110. //echo Display::return_icon('csv.gif', get_lang('ExportAsCSV')).'<a href="group_overview.php?'.api_get_cidreq().'&action=export&type=csv">'.get_lang('ExportAsCSV').'</a> ';
  111. echo Display::return_icon('excel.gif', get_lang('ExportAsXLS')).' <a href="group_overview.php?'.api_get_cidreq().'&action=export&type=xls">'.get_lang('ExportAsXLS').'</a>';
  112. echo '</div>';
  113. $categories = GroupManager::get_categories();
  114. foreach($categories as $index => $category)
  115. {
  116. if( api_get_setting('allow_group_categories') == 'true')
  117. {
  118. echo '<h3>'.$category['title'].'</h3>';
  119. }
  120. $groups = GroupManager::get_group_list($category['id']);
  121. echo '<ul>';
  122. foreach($groups as $index => $group)
  123. {
  124. echo '<li>';
  125. echo stripslashes($group['name']);
  126. echo '<ul>';
  127. $users = GroupManager::get_users($group['id']);
  128. foreach($users as $index => $user)
  129. {
  130. $user_info = api_get_user_info($user);
  131. echo '<li>'.$user_info['firstName'].' '.$user_info['lastName'].'</li>';
  132. }
  133. echo '</ul>';
  134. echo '</li>';
  135. }
  136. echo '</ul>';
  137. }
  138. /*
  139. ==============================================================================
  140. FOOTER
  141. ==============================================================================
  142. */
  143. if (!isset ($_GET['origin']) || $_GET['origin'] != 'learnpath')
  144. {
  145. Display::display_footer();
  146. }
  147. ?>