'index.php', 'name' => get_lang('MySpace')]; $id_session = ''; if (isset($_GET['id_session']) && $_GET['id_session'] != '') { $id_session = intval($_GET['id_session']); $interbreadcrumb[] = ['url' => 'session.php', 'name' => get_lang('Sessions')]; $interbreadcrumb[] = ['url' => 'course.php?id_session='.$id_session.'', 'name' => get_lang('Course')]; } // Set this option to true to enforce strict purification for usenames. $purification_option_for_usernames = false; // Checking whether the current coach is the admin coach. if (api_get_setting('add_users_by_coach') === 'true') { if (!api_is_platform_admin()) { if (isset($_REQUEST['id_session'])) { $id_session = intval($_REQUEST['id_session']); $sql = 'SELECT id_coach FROM '.Database::get_main_table(TABLE_MAIN_SESSION).' WHERE id='.$id_session; $rs = Database::query($sql); if (Database::result($rs, 0, 0) != $_user['user_id']) { api_not_allowed(true); } } else { api_not_allowed(true); } } } else { api_not_allowed(true); } set_time_limit(0); $errors = []; if (isset($_POST['formSent']) && $_POST['formSent'] && $_FILES['import_file']['size'] !== 0) { $file_type = $_POST['file_type']; $id_session = intval($_POST['id_session']); if ($file_type == 'csv') { $users = MySpace::parse_csv_data($_FILES['import_file']['tmp_name']); } else { $users = MySpace::parse_xml_data($_FILES['import_file']['tmp_name']); } if (count($users) > 0) { $results = MySpace::validate_data($users); $errors = $results['errors']; $users = $results['users']; if (count($errors) == 0) { if (!empty($id_session)) { $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); // Selecting all the courses from the session id requested. $sql = "SELECT c_id FROM $tbl_session_rel_course WHERE session_id ='$id_session'"; $result = Database::query($sql); $course_list = []; while ($row = Database::fetch_array($result)) { $course_list[] = $row['c_id']; } $errors = MySpace::get_user_creator($users); $users = MySpace::check_all_usernames($users, $course_list, $id_session); if (count($errors) == 0) { MySpace::save_data($users, $course_list, $id_session); } } else { Display::addFlash(Display::return_message(get_lang('NoSessionId'), 'warning')); header('Location: course.php?id_session='.$id_session); exit; } } } else { Display::addFlash(Display::return_message(get_lang('NoUsersRead'), 'warning')); header('Location: course.php?id_session='.$id_session); exit; } } Display :: display_header($tool_name); if (isset($_FILES['import_file']) && $_FILES['import_file']['size'] == 0 && $_POST) { echo Display::return_message(get_lang('ThisFieldIsRequired'), 'error'); } if (count($errors) != 0) { $error_message = '
:
LastName;FirstName;Email;UserName;Password;OfficialCode;PhoneNumber; Montoya;Julio;info@localhost;jmontoya;123456789;code1;3141516 Doewing;Johny;info@localhost;jdoewing;123456789;code2;3141516
:
<?xml version="1.0" encoding=""?> <Contacts> <Contact> <LastName>Montoya</LastName> <FirstName>Julio</FirstName> <Email>info@localhost</Email> <UserName>jmontoya</UserName> <Password>123456</Password> <OfficialCode>code1</OfficialCode> <PhoneNumber>3141516</PhoneNumber> </Contact> </Contacts>