session_import.php 30 KB

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