case 'export_all': $data = GroupManager::exportCategoriesAndGroupsToArray(null, true); Export::arrayToCsv($data); exit; break; case 'export_pdf': $content = GroupManager::getOverview($courseId, $keyword); $pdf = new PDF(); $extra = '<div style="text-align:center"><h2>' . get_lang('GroupList') . '</h2></div>'; $extra .= '<strong>' . get_lang('Course') . ': </strong>' . $courseInfo['title'] . ' (' . $courseInfo['code'] . ')'; $content = $extra . $content; $pdf->content_to_pdf($content, null, null, api_get_course_id()); break; case 'export': $groupId = isset($_GET['id']) ? intval($_GET['id']) : null; $data = GroupManager::exportCategoriesAndGroupsToArray($groupId, true); switch ($_GET['type']) { case 'csv': Export::arrayToCsv($data); exit; break; case 'xls': if (!empty($data)) { Export::arrayToXls($data); exit; } break; } break; } }
//require_once '../inc/global.inc.php'; $this_section = SECTION_COURSES; $current_course_tool = TOOL_GROUP; // Notice for unauthorized people. api_protect_course_script(true); $nameTools = get_lang('GroupOverview'); $courseId = api_get_course_int_id(); $courseInfo = api_get_course_info(); /* Libraries */ include_once api_get_path(LIBRARY_PATH) . 'groupmanager.lib.php'; include_once api_get_path(LIBRARY_PATH) . 'export.lib.inc.php'; $keyword = isset($_GET['keyword']) ? $_GET['keyword'] : null; if (isset($_GET['action'])) { switch ($_GET['action']) { case 'export_all': $data = GroupManager::exportCategoriesAndGroupsToArray(); Export::export_table_csv($data); exit; break; case 'export_pdf': $content = GroupManager::getOverview($courseId, $keyword); $pdf = new PDF(); $extra = '<div style="text-align:center"><h2>' . get_lang('GroupList') . '</h2></div>'; $extra .= '<strong>' . get_lang('Course') . ': </strong>' . $courseInfo['title'] . ' (' . $courseInfo['code'] . ')'; $content = $extra . $content; $pdf->content_to_pdf($content, null, null, api_get_course_id()); break; case 'export': $groupId = isset($_GET['id']) ? intval($_GET['id']) : null; $groups = GroupManager::get_group_list(); $data = array();