default: $dialogBox->error(get_lang('Error!! you cannot unregister a course manager')); } } } } } // end if cmd == unregister // Export users list if ($cmd == 'export' && $can_export_user_list) { require_once dirname(__FILE__) . '/lib/export.lib.php'; // contruction of XML flow $csv = export_user_list(claro_get_current_course_id()); if (!empty($csv)) { $courseData = claro_get_current_course_data(); claro_send_stream($csv, $courseData['officialCode'] . '_userlist.csv'); exit; } } // Validate a user (if this option is enable for the course) if ($cmd == 'validation' && $req['user_id']) { $courseUserPrivileges = new CourseUserPrivileges(claro_get_current_course_id(), $req['user_id']); $courseUserPrivileges->load(); $courseObject = new Claro_Course(claro_get_current_course_id()); $courseObject->load(); $validation = new UserCourseEnrolmentValidation($courseObject, $courseUserPrivileges); $validationChange = isset($_REQUEST['validation']) ? $_REQUEST['validation'] : null; if ($validation->isModifiable()) { if ('grant' == $validationChange && $validation->isPending()) { if ($validation->grant()) { $dialogBox->success(get_lang('This user account is now active in the course'));
$csvSubTab['courseCode'] = $key; $csvSubTab['courseTitle'] = $elmt['courseTitle']; $csvSubTab['courseTitulars'] = $elmt['courseTitulars']; foreach ($elmt['courseStats'] as $key => $elmt2) { $csvSubTab[$key . '_count'] = $elmt2['count']; $csvSubTab[$key . '_size'] = round($elmt2['size'] / 1024); } foreach ($elmt['courseCategory'] as $key => $cat) { $csvSubTab[$key . '_courseCategory'] = $cat; } $csvTab[] = $csvSubTab; } $csvExporter = new CsvExporter(';', '"'); $fileName = get_lang('files_stats') . '_' . claro_date('d-m-Y') . '.csv'; $stream = $csvExporter->export($csvTab); claro_send_stream($stream, $fileName, 'text/csv'); } } else { $dialogBox->warning(get_lang('Statistics in progress, please don\'t refresh until further instructions ! ') . '<br />' . get_lang('Course actually treated : ') . $course['title'] . '<br />' . get_lang(' Number of course treated : ') . count($stats)); $claroline->display->body->appendContent($dialogBox->render()); echo $claroline->display->render(); } } else { $dialogBox = new DialogBox(); $dialogBox->warning(get_lang('Caution: building files\' statistics is a pretty heavy work. It might take a while and a lot of resources, depending of the size of your campus.')); if (!empty($extensions)) { $dialogBox->info(get_lang('You\'ve chosen to isolate the following extensions: %types. If you wish to modify these extensions, check the advanced platform settings', array('%types' => implode(', ', $extensions)))); } else { $dialogBox->info(get_lang('You don\'t have chosen any extension to isolate. If you wish to isolate extensions in your statistics, check the advanced platform settings')); } $template = new CoreTemplate('admin_files_stats.tpl.php');
case 'unsubscribe': if (user_remove_to_class($user_id, $class_id)) { $dialogBox->success(get_lang('User has been sucessfully unregistered from the class')); } break; case 'unsubscribe_all': if (class_remove_all_users($class_id)) { $dialogBox->success(get_lang('All users have been sucessfully unregistered from the class')); } break; case 'export': if ($cmd == 'export' && claro_is_platform_admin()) { require_once dirname(__FILE__) . '/../user/lib/export.lib.php'; $csv = export_user_list_for_class($class_id); if (!empty($csv)) { claro_send_stream($csv, $classinfo['name'] . '.csv'); exit; } } break; default: // No command } //---------------------------------- // Build query and find info in db //---------------------------------- // find this class current content $classes_list = getSubClasses($class_id); $classes_list[] = $class_id; $sql = "SELECT distinct U.user_id AS user_id,\n U.nom AS nom,\n U.prenom AS prenom,\n U.nom AS lastname,\n U.prenom AS firstname,\n U.email AS email,\n U.officialCode AS officialCode\n FROM `" . $tbl_user . "` AS U\n LEFT JOIN `" . $tbl_class_user . "` AS CU\n ON U.`user_id`= CU.`user_id`\n WHERE `CU`.`class_id`\n in (" . implode($classes_list, ",") . ")"; // if user search exist