session_import.php 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.admin
  5. */
  6. $language_file = array('admin', 'registration');
  7. $cidReset = true;
  8. //require_once '../inc/global.inc.php';
  9. $this_section = SECTION_PLATFORM_ADMIN;
  10. api_protect_admin_script(true);
  11. $form_sent = 0;
  12. $error_message = '';
  13. if (isset($_GET['action']) && $_GET['action'] == 'show_message') {
  14. $error_message = Security::remove_XSS($_GET['message']);
  15. }
  16. $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
  17. $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
  18. $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
  19. $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
  20. $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
  21. $tool_name = get_lang('ImportSessionListXMLCSV');
  22. $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('Sessions'));
  23. set_time_limit(0);
  24. // Set this option to true to enforce strict purification for usenames.
  25. $purification_option_for_usernames = false;
  26. $inserted_in_course = array();
  27. global $_configuration;
  28. if (isset($_POST['formSent'])) {
  29. if (isset($_FILES['import_file']['tmp_name']) && !empty($_FILES['import_file']['tmp_name'])) {
  30. $form_sent = $_POST['formSent'];
  31. $file_type = $_POST['file_type'];
  32. $send_mail = $_POST['sendMail'] ? 1 : 0;
  33. //$updatesession = $_POST['updatesession'] ? 1 : 0;
  34. $updatesession = 0;
  35. $sessions = array();
  36. $session_counter = 0;
  37. if ($file_type == 'xml') {
  38. // XML
  39. // SimpleXML for PHP5 deals with various encodings, but how many they are, what are version issues, do we need to waste time with configuration options?
  40. // For avoiding complications we go some sort of "PHP4 way" - we convert the input xml-file into UTF-8 before passing it to the parser.
  41. // Instead of:
  42. // $root = @simplexml_load_file($_FILES['import_file']['tmp_name']);
  43. // we may use the following construct:
  44. // To ease debugging let us use:
  45. $content = file_get_contents($_FILES['import_file']['tmp_name']);
  46. $content = Text::api_utf8_encode_xml($content);
  47. $root = @simplexml_load_string($content);
  48. unset($content);
  49. if (is_object($root)) {
  50. if (count($root->Users->User) > 0) {
  51. // Creating/updating users from <Sessions> <Users> base node.
  52. foreach ($root->Users->User as $node_user) {
  53. $username = $username_old = trim(api_utf8_decode($node_user->Username));
  54. if (UserManager::is_username_available($username)) {
  55. $password = api_utf8_decode($node_user->Password);
  56. if (empty($password)) {
  57. $password = api_generate_password();
  58. }
  59. switch ($node_user->Status) {
  60. case 'student' :
  61. $status = 5;
  62. break;
  63. case 'teacher' :
  64. $status = 1;
  65. break;
  66. default :
  67. $status = 5;
  68. $error_message .= get_lang('StudentStatusWasGivenTo').' : '.$username.'<br />';
  69. }
  70. $result = UserManager::create_user(
  71. api_utf8_decode($node_user->Firstname),
  72. api_utf8_decode($node_user->Lastname),
  73. $status,
  74. api_utf8_decode($node_user->Email),
  75. $username,
  76. $password,
  77. api_utf8_decode($node_user->OfficialCode),
  78. null,
  79. api_utf8_decode($node_user->Phone),
  80. null,
  81. PLATFORM_AUTH_SOURCE,
  82. null,
  83. 1,
  84. 0,
  85. null,
  86. null,
  87. $send_mail
  88. );
  89. } else {
  90. $lastname = trim(api_utf8_decode($node_user->Lastname));
  91. $firstname = trim(api_utf8_decode($node_user->Firstname));
  92. $password = api_utf8_decode($node_user->Password);
  93. $email = trim(api_utf8_decode($node_user->Email));
  94. $official_code = trim(api_utf8_decode($node_user->OfficialCode));
  95. $phone = trim(api_utf8_decode($node_user->Phone));
  96. $status = trim(api_utf8_decode($node_user->Status));
  97. switch ($status) {
  98. case 'student' : $status = 5; break;
  99. case 'teacher' : $status = 1; break;
  100. default : $status = 5; $error_message .= get_lang('StudentStatusWasGivenTo').' : '.$username.'<br />';
  101. }
  102. $sql = "UPDATE $tbl_user SET
  103. lastname = '".Database::escape_string($lastname)."',
  104. firstname = '".Database::escape_string($firstname)."',
  105. ".(empty($password) ? "" : "password = '".(api_get_encrypted_password($password))."',")."
  106. email = '".Database::escape_string($email)."',
  107. official_code = '".Database::escape_string($official_code)."',
  108. phone = '".Database::escape_string($phone)."',
  109. status = '".Database::escape_string($status)."'
  110. WHERE username = '".Database::escape_string($username)."'";
  111. Database::query($sql);
  112. }
  113. }
  114. }
  115. // Creating courses from <Sessions> <Courses> base node.
  116. if (count($root->Courses->Course) > 0) {
  117. foreach ($root->Courses->Course as $courseNode) {
  118. $params = array();
  119. if (empty($courseNode->CourseTitle)) {
  120. $params['title'] = api_utf8_decode($courseNode->CourseCode);
  121. } else {
  122. $params['title'] = api_utf8_decode($courseNode->CourseTitle);
  123. }
  124. $params['wanted_code'] = api_utf8_decode($courseNode->CourseCode);
  125. $params['tutor_name'] = null;
  126. $params['course_category'] = null;
  127. $params['course_language'] = api_get_valid_language(api_utf8_decode($courseNode->CourseLanguage));
  128. $params['user_id'] = api_get_user_id();
  129. // Looking up for the teacher.
  130. $username = trim(api_utf8_decode($courseNode->CourseTeacher));
  131. $sql = "SELECT user_id, lastname, firstname FROM $tbl_user WHERE username='$username'";
  132. $rs = Database::query($sql);
  133. list($user_id, $lastname, $firstname) = Database::fetch_array($rs);
  134. $params['teachers'] = $user_id;
  135. CourseManager::create_course($params);
  136. }
  137. }
  138. // Creating sessions from <Sessions> base node.
  139. if (count($root->Session) > 0) {
  140. foreach ($root->Session as $node_session) {
  141. $course_counter = 0;
  142. $user_counter = 0;
  143. $session_name = trim(api_utf8_decode($node_session->SessionName));
  144. $coach = UserManager::purify_username(api_utf8_decode($node_session->Coach), $purification_option_for_usernames);
  145. if (!empty($coach)) {
  146. $coach_id = UserManager::get_user_id_from_username($coach);
  147. if ($coach_id === false) {
  148. $error_message .= get_lang('UserDoesNotExist').' : '.$coach.'<br />';
  149. // Forcing the coach id if user does not exist.
  150. $coach_id = api_get_user_id();
  151. }
  152. } else {
  153. // Forcing the coach id.
  154. $coach_id = api_get_user_id();
  155. }
  156. $date_start = trim(api_utf8_decode($node_session->DateStart)); // Just in case - encoding conversion.
  157. $date_end = trim(api_utf8_decode($node_session->DateEnd));
  158. $visibility = trim(api_utf8_decode($node_session->Visibility));
  159. $session_category_id = trim(api_utf8_decode($node_session->SessionCategory));
  160. if (!$updatesession) {
  161. // Always create a session.
  162. $unique_name = false; // This MUST be initializead.
  163. $i = 0;
  164. // Change session name, verify that session doesn't exist.
  165. while (!$unique_name) {
  166. if ($i > 1) {
  167. $suffix = ' - '.$i;
  168. }
  169. $sql = 'SELECT 1 FROM '.$tbl_session.' WHERE name="'.Database::escape_string($session_name.$suffix).'"';
  170. $rs = Database::query($sql);
  171. if (Database::result($rs, 0, 0)) {
  172. $i++;
  173. } else {
  174. $unique_name = true;
  175. $session_name .= $suffix;
  176. }
  177. }
  178. $params = array (
  179. 'id_coach' => $coach_id,
  180. 'visibility' => $visibility,
  181. 'name' => $session_name,
  182. 'access_start_date' => $date_start,
  183. 'access_end_date' => $date_end,
  184. 'session_category_id' => $session_category_id,
  185. 'session_admin_id' => api_get_user_id(),
  186. );
  187. $session_id = SessionManager::add($params);
  188. $session_counter++;
  189. } else {
  190. // Update the session if it is needed.
  191. $my_session_result = SessionManager::get_session_by_name($session_name);
  192. if ($my_session_result === false) {
  193. $params = array (
  194. 'id_coach' => $coach_id,
  195. 'visibility' => $visibility,
  196. 'name' => $session_name,
  197. 'access_start_date' => $date_start,
  198. 'access_end_date' => $date_end,
  199. 'session_category_id' => $session_category_id,
  200. 'session_admin_id' => api_get_user_id(),
  201. );
  202. $session_id = SessionManager::add($params);
  203. $session_counter++;
  204. } else {
  205. $params = array (
  206. 'id' => $my_session_result['id'],
  207. 'id_coach' => $coach_id,
  208. 'visibility' => $visibility,
  209. 'name' => $session_name,
  210. 'access_start_date' => $date_start,
  211. 'access_end_date' => $date_end,
  212. 'session_category_id' => $session_category_id,
  213. 'session_admin_id' => api_get_user_id(),
  214. );
  215. SessionManager::update($params);
  216. $session_id = Database::query("SELECT id FROM $tbl_session WHERE name='$session_name'");
  217. list($session_id) = Database::fetch_array($session_id);
  218. Database::query("DELETE FROM $tbl_session_user WHERE id_session='$session_id'");
  219. Database::query("DELETE FROM $tbl_session_course WHERE id_session='$session_id'");
  220. Database::query("DELETE FROM $tbl_session_course_user WHERE id_session='$session_id'");
  221. }
  222. }
  223. // Associate the session with access_url.
  224. global $_configuration;
  225. if ($_configuration['multiple_access_urls']) {
  226. $access_url_id = api_get_current_access_url_id();
  227. UrlManager::add_session_to_url($session_id, $access_url_id);
  228. } else {
  229. // We fill by default the access_url_rel_session table.
  230. UrlManager::add_session_to_url($session_id, 1);
  231. }
  232. // Adding users to the new session.
  233. foreach ($node_session->User as $node_user) {
  234. $username = UserManager::purify_username(api_utf8_decode($node_user), $purification_option_for_usernames);
  235. $user_id = UserManager::get_user_id_from_username($username);
  236. if ($user_id !== false) {
  237. $sql = "INSERT IGNORE INTO $tbl_session_user SET
  238. id_user='$user_id',
  239. id_session = '$session_id'";
  240. $rs_user = Database::query($sql);
  241. $user_counter++;
  242. }
  243. }
  244. // Adding courses to a session.
  245. foreach ($node_session->Course as $node_course) {
  246. $course_code = Database::escape_string(trim(api_utf8_decode($node_course->CourseCode)));
  247. // Verify that the course pointed by the course code node exists.
  248. if (CourseManager::course_exists($course_code)) {
  249. // If the course exists we continue.
  250. $course_info = CourseManager::get_course_information($course_code);
  251. $courseId = $course_info['real_id'];
  252. $session_course_relation = SessionManager::relation_session_course_exist($session_id, $courseId);
  253. if (!$session_course_relation) {
  254. $sql_course = "INSERT INTO $tbl_session_course SET c_id = '$courseId', id_session='$session_id'";
  255. $rs_course = Database::query($sql_course);
  256. }
  257. $course_coaches = explode(',', $node_course->Coach);
  258. // Adding coachs to session course user
  259. foreach ($course_coaches as $course_coach) {
  260. $coach_id = UserManager::purify_username(api_utf8_decode($course_coach), $purification_option_for_usernames);
  261. $coach_id = UserManager::get_user_id_from_username($course_coach);
  262. if ($coach_id !== false) {
  263. $sql = "INSERT IGNORE INTO $tbl_session_course_user SET
  264. id_user='$coach_id',
  265. c_id ='$courseId',
  266. id_session = '$session_id',
  267. status = 2 ";
  268. $rs_coachs = Database::query($sql);
  269. } else {
  270. $error_message .= get_lang('UserDoesNotExist').' : '.$user.'<br />';
  271. }
  272. }
  273. // Adding users.
  274. $course_counter++;
  275. $users_in_course_counter = 0;
  276. foreach ($node_course->User as $node_user) {
  277. $username = UserManager::purify_username(api_utf8_decode($node_user), $purification_option_for_usernames);
  278. $user_id = UserManager::get_user_id_from_username($username);
  279. if ($user_id !== false) {
  280. // Adding to session_rel_user table.
  281. $sql = "INSERT IGNORE INTO $tbl_session_user SET
  282. id_user='$user_id',
  283. id_session = '$session_id'";
  284. $rs_user = Database::query($sql);
  285. $user_counter++;
  286. // Adding to session_rel_user_rel_course table.
  287. $sql = "INSERT IGNORE INTO $tbl_session_course_user SET
  288. id_user='$user_id',
  289. c_id ='$courseId',
  290. id_session = '$session_id'";
  291. $rs_users = Database::query($sql);
  292. $users_in_course_counter++;
  293. } else {
  294. $error_message .= get_lang('UserDoesNotExist').' : '.$username.'<br />';
  295. }
  296. }
  297. $update_session_course = "UPDATE $tbl_session_course SET nbr_users='$users_in_course_counter' WHERE c_id ='$courseId'";
  298. Database::query($update_session_course);
  299. $inserted_in_course[$course_code] = $course_info['title'];
  300. }
  301. /*
  302. if (CourseManager::course_exists($course_code, true)) {
  303. // If the course exists we continue.
  304. // Also subscribe to virtual courses through check on visual code.
  305. $list = CourseManager :: get_courses_info_from_visual_code($course_code);
  306. foreach ($list as $vcourse) {
  307. if ($vcourse['code'] == $course_code) {
  308. // Ignore, this has already been inserted.
  309. } else {
  310. $sql_course = "INSERT INTO $tbl_session_course SET course_code = '".$vcourse['code']."', id_session='$session_id'";
  311. $rs_course = Database::query($sql_course);
  312. $course_coaches = explode(",",$node_course->Coach);
  313. // adding coachs to session course user
  314. foreach ($course_coaches as $course_coach) {
  315. $coach_id = UserManager::purify_username(api_utf8_decode($course_coach), $purification_option_for_usernames);
  316. $coach_id = UserManager::get_user_id_from_username($course_coach);
  317. if ($coach_id !== false) {
  318. $sql = "INSERT IGNORE INTO $tbl_session_course_user SET
  319. id_user='$coach_id',
  320. course_code='{$vcourse['code']}',
  321. id_session = '$session_id',
  322. status = 2 ";
  323. $rs_coachs = Database::query($sql);
  324. } else {
  325. $error_message .= get_lang('UserDoesNotExist').' : '.$user.'<br />';
  326. }
  327. }
  328. // adding users
  329. $course_counter++;
  330. $users_in_course_counter = 0;
  331. foreach ($node_course->User as $node_user) {
  332. $username = UserManager::purify_username(api_utf8_decode($node_user), $purification_option_for_usernames);
  333. $user_id = UserManager::get_user_id_from_username($username);
  334. if ($user_id !== false) {
  335. // Adding to session_rel_user table.
  336. $sql = "INSERT IGNORE INTO $tbl_session_user SET
  337. id_user='$user_id',
  338. id_session = '$session_id'";
  339. $rs_user = Database::query($sql);
  340. $user_counter++;
  341. // Adding to session_rel_user_rel_course table.
  342. $sql = "INSERT IGNORE INTO $tbl_session_course_user SET
  343. id_user='$user_id',
  344. course_code='{$vcourse['code']}',
  345. id_session = '$session_id'";
  346. $rs_users = Database::query($sql);
  347. $users_in_course_counter++;
  348. } else {
  349. $error_message .= get_lang('UserDoesNotExist').' : '.$username.'<br />';
  350. }
  351. }
  352. $update_session_course = "UPDATE $tbl_session_course SET nbr_users='$users_in_course_counter' WHERE course_code='$course_code'";
  353. Database::query($update_session_course);
  354. $inserted_in_course[$course_code] = $course_info['title'];
  355. }
  356. $inserted_in_course[$vcourse['code']] = $vcourse['title'];
  357. }
  358. } else {
  359. // Tthe course does not exist.
  360. $error_message .= get_lang('CourseDoesNotExist').' : '.$course_code.'<br />';
  361. }
  362. */
  363. }
  364. Database::query("UPDATE $tbl_session SET nbr_users='$user_counter', nbr_courses='$course_counter' WHERE id='$session_id'");
  365. }
  366. }
  367. if (empty($root->Users->User) && empty($root->Courses->Course) && empty($root->Session)) {
  368. $error_message = get_lang('NoNeededData');
  369. }
  370. } else {
  371. $error_message .= get_lang('XMLNotValid');
  372. }
  373. } else {
  374. // CSV
  375. $result = SessionManager::importCSV($_FILES['import_file']['tmp_name'], $updatesession, api_get_user_id());
  376. $error_message = $result['error_message'];
  377. $session_counter = $result['session_counter'];
  378. }
  379. if (!empty($error_message)) {
  380. $error_message = get_lang('ButProblemsOccured').' :<br />'.$error_message;
  381. }
  382. if (count($inserted_in_course) > 1) {
  383. $warn = get_lang('SeveralCoursesSubscribedToSessionBecauseOfSameVisualCode').': ';
  384. foreach ($inserted_in_course as $code => $title) {
  385. $warn .= ' '.$title.' ('.$code.'),';
  386. }
  387. $warn = substr($warn, 0, -1);
  388. }
  389. if ($session_counter == 1) {
  390. header('Location: resume_session.php?id_session='.$session_id.'&warn='.urlencode($warn));
  391. exit;
  392. } else {
  393. header('Location: session_list.php?action=show_message&message='.urlencode(get_lang('FileImported').' '.$error_message).'&warn='.urlencode($warn));
  394. exit;
  395. }
  396. } else {
  397. $error_message = get_lang('NoInputFile');
  398. }
  399. }
  400. // Display the header.
  401. Display::display_header($tool_name);
  402. if (count($inserted_in_course) > 1) {
  403. $msg = get_lang('SeveralCoursesSubscribedToSessionBecauseOfSameVisualCode').': ';
  404. foreach ($inserted_in_course as $code => $title) {
  405. $msg .= ' '.$title.' ('.$title.'),';
  406. }
  407. $msg = substr($msg, 0, -1);
  408. Display::display_warning_message($msg);
  409. }
  410. echo '<div class="actions">';
  411. echo '<a href="../admin/index.php">'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('PlatformAdmin'),'',ICON_SIZE_MEDIUM).'</a>';
  412. echo '</div>';
  413. if (!empty($error_message)) {
  414. Display::display_normal_message($error_message, false);
  415. }
  416. $form = new FormValidator('import_sessions', 'post', api_get_self(), null, array('enctype' => 'multipart/form-data'));
  417. $form->addElement('hidden', 'formSent', 1);
  418. $form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
  419. $form->addElement('radio', 'file_type', array(get_lang('FileType'), '<a href="example_session.csv" target="_blank">'.get_lang('ExampleCSVFile').'</a>'), 'CSV', 'csv');
  420. $form->addElement('radio', 'file_type', array(null, '<a href="example_session.xml" target="_blank">'.get_lang('ExampleXMLFile').'</a>'), 'XML', 'xml');
  421. $form->addElement('checkbox', 'sendMail', null, get_lang('SendMailToUsers'));
  422. $form->addElement('button', 'submit', get_lang('ImportSession'));
  423. $defaults = array('sendMail' => 'true','file_type' => 'csv');
  424. $form->setDefaults($defaults);
  425. Display::display_normal_message(get_lang('TheXMLImportLetYouAddMoreInfoAndCreateResources'));
  426. $form->display();
  427. ?>
  428. <font color="gray">
  429. <p><?php echo get_lang('CSVMustLookLike').' ('.get_lang('MandatoryFields').')'; ?> :</p>
  430. <blockquote>
  431. <pre>
  432. <strong>SessionName</strong>;Coach;<strong>DateStart</strong>;<strong>DateEnd</strong>;Users;Courses
  433. <strong>xxx1</strong>;xxx;<strong>xxx;xxx</strong>;username1|username2;course1[coach1][username1,username2,...]|course2[coach1][username1,username2,...]
  434. <strong>xxx2</strong>;xxx;<strong>xxx;xxx</strong>;username1|username2;course1[coach1][username1,username2,...]|course2[coach1][username1,username2,...]
  435. </pre>
  436. </blockquote>
  437. <p><?php echo get_lang('XMLMustLookLike').' ('.get_lang('MandatoryFields').')'; ?> :</p>
  438. <blockquote>
  439. <pre>
  440. &lt;?xml version=&quot;1.0&quot; encoding=&quot;<?php echo api_get_system_encoding(); ?>&quot;?&gt;
  441. &lt;Sessions&gt;
  442. &lt;Users&gt;
  443. &lt;User&gt;
  444. &lt;Username&gt;<strong>username1</strong>&lt;/Username&gt;
  445. &lt;Lastname&gt;xxx&lt;/Lastname&gt;
  446. &lt;Firstname&gt;xxx&lt;/Firstname&gt;
  447. &lt;Password&gt;xxx&lt;/Password&gt;
  448. &lt;Email&gt;xxx@xx.xx&lt;/Email&gt;
  449. &lt;OfficialCode&gt;xxx&lt;/OfficialCode&gt;
  450. &lt;Phone&gt;xxx&lt;/Phone&gt;
  451. &lt;Status&gt;student|teacher&lt;/Status&gt;
  452. &lt;/User&gt;
  453. &lt;/Users&gt;
  454. &lt;Courses&gt;
  455. &lt;Course&gt;
  456. &lt;CourseCode&gt;<strong>xxx</strong>&lt;/CourseCode&gt;
  457. &lt;CourseTeacher&gt;<strong>teacher_username</strong>&lt;/CourseTeacher&gt;
  458. &lt;CourseLanguage&gt;xxx&lt;/CourseLanguage&gt;
  459. &lt;CourseTitle&gt;xxx&lt;/CourseTitle&gt;
  460. &lt;CourseDescription&gt;xxx&lt;/CourseDescription&gt;
  461. &lt;/Course&gt;
  462. &lt;/Courses&gt;
  463. &lt;Session&gt;
  464. <strong>&lt;SessionName&gt;xxx&lt;/SessionName&gt;</strong>
  465. &lt;Coach&gt;xxx&lt;/Coach&gt;
  466. <strong>&lt;DateStart&gt;xxx&lt;/DateStart&gt;</strong>
  467. <strong>&lt;DateEnd&gt;xxx&lt;/DateEnd&gt;</strong>
  468. &lt;User&gt;xxx&lt;/User&gt;
  469. &lt;User&gt;xxx&lt;/User&gt;
  470. &lt;Course&gt;
  471. &lt;CourseCode&gt;coursecode1&lt;/CourseCode&gt;
  472. &lt;Coach&gt;coach1&lt;/Coach&gt;
  473. &lt;User&gt;username1&lt;/User&gt;
  474. &lt;User&gt;username2&lt;/User&gt;
  475. &lt;/Course&gt;
  476. &lt;/Session&gt;
  477. &lt;Session&gt;
  478. <strong>&lt;SessionName&gt;xxx&lt;/SessionName&gt;</strong>
  479. &lt;Coach&gt;xxx&lt;/Coach&gt;
  480. <strong>&lt;DateStart&gt;xxx&lt;/DateStart&gt;</strong>
  481. <strong>&lt;DateEnd&gt;xxx&lt;/DateEnd&gt;</strong>
  482. &lt;User&gt;xxx&lt;/User&gt;
  483. &lt;User&gt;xxx&lt;/User&gt;
  484. &lt;Course&gt;
  485. &lt;CourseCode&gt;coursecode1&lt;/CourseCode&gt;
  486. &lt;Coach&gt;coach1&lt;/Coach&gt;
  487. &lt;User&gt;username1&lt;/User&gt;
  488. &lt;User&gt;username2&lt;/User&gt;
  489. &lt;/Course&gt;
  490. &lt;/Session&gt;
  491. &lt;/Sessions&gt;
  492. </pre>
  493. </blockquote>
  494. </font>
  495. <?php
  496. /* FOOTER */
  497. Display::display_footer();