123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705 |
- <?php // $Id: session_import.php 15000 2008-04-22 02:32:46Z yannoo $
- /*
- ==============================================================================
- Dokeos - elearning and course management software
- Copyright (c) 2004-2008 Dokeos SPRL
- Copyright (c) 2003 Ghent University (UGent)
- Copyright (c) 2001 Universite catholique de Louvain (UCL)
- Copyright (c) Olivier Brouckaert
- For a full list of contributors, see "credits.txt".
- The full license can be read in "license.txt".
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
- See the GNU General Public License for more details.
- Contact: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium, info@dokeos.com
- ==============================================================================
- */
- /**
- ==============================================================================
- * @package dokeos.admin
- ==============================================================================
- */
- $language_file = array('admin','registration');
- $cidReset=true;
- require('../inc/global.inc.php');
- if(empty($charset))
- {
- $charset = 'ISO-8859-15';
- }
- api_protect_admin_script(true);
- require_once(api_get_path(LIBRARY_PATH).'fileManage.lib.php');
- require(api_get_path(CONFIGURATION_PATH).'add_course.conf.php');
- require_once(api_get_path(LIBRARY_PATH).'add_course.lib.inc.php');
- $formSent=0;
- $errorMsg='';
- $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
- $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
- $tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
- $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
- $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
- $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
- $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
- $tool_name=get_lang('ImportSessionListXMLCSV');
- $interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('AdministrationTools'));
- set_time_limit(0);
- if($_POST['formSent'])
- {
- if(isset($_FILES['import_file']['tmp_name']))
- {
- $formSent=$_POST['formSent'];
- $file_type=$_POST['file_type'];
- $sendMail=$_POST['sendMail']?1:0;
- $sessions=array();
- ///////////////////////
- //XML/////////////////
- /////////////////////
-
- $countSessions = 0;
-
- if($file_type == 'xml')
- {
- $racine = simplexml_load_file($_FILES['import_file']['tmp_name']);
- if(is_object($racine))
- {
- foreach($racine->Users->User as $userNode)
- {
- $username = mb_convert_encoding($userNode->Username,$charset,'utf-8');
- $isCut = 0; // if the username given is too long
- if(strlen($username)>20)
- {
- $user_name_dist = $username;
- $username = substr($username,0,20);
- $isCut = 1;
- }
- $sql = "SELECT 1 FROM $tbl_user WHERE username='".addslashes($username)."'";
- $rs = api_sql_query($sql, __FILE__, __LINE__);
- if(mysql_affected_rows()==0)
- {
- if($isCut)
- {
- $errorMsg .= get_lang('UsernameTooLongWasCut').' '.get_lang('From').' '.$user_name_dist.' '.get_lang('To').' '.$username.' <br />';
- }
- $lastname = mb_convert_encoding($userNode->Lastname,$charset,'utf-8');
- $firstname = mb_convert_encoding($userNode->Firstname,$charset,'utf-8');
- $password = mb_convert_encoding($userNode->Password,$charset,'utf-8');
- if(empty($password))
- $password = base64_encode(rand(1000,10000));
- $email = mb_convert_encoding($userNode->Email,$charset,'utf-8');
- $official_code = mb_convert_encoding($userNode->OfficialCode,$charset,'utf-8');
- $phone = mb_convert_encoding($userNode->Phone,$charset,'utf-8');
- $status = mb_convert_encoding($userNode->Status,$charset,'utf-8');
- switch($status)
- {
- case 'student' : $status = 5; break;
- case 'teacher' : $status = 1; break;
- default : $status = 5; $errorMsg = get_lang('StudentStatusWasGivenTo').' : '.$username.'<br />';
- }
- $sql = "INSERT INTO $tbl_user SET
- username = '".Database::escape_string($username)."',
- lastname = '".Database::escape_string($lastname)."',
- firstname = '".Database::escape_string($firstname)."',
- password = '".($userPasswordCrypted==true ? md5($password) : $password)."',
- email = '".Database::escape_string($email)."',
- official_code = '".Database::escape_string($official_code)."',
- phone = '".Database::escape_string($phone)."',
- status = '".Database::escape_string($status)."'";
- api_sql_query($sql, __FILE__, __LINE__);
- if(mysql_affected_rows()>0 && $sendMail)
- {
- $emailto='"'.$firstname.' '.$lastname.'" <'.$email.'>';
- $emailsubject='['.get_setting('siteName').'] '.get_lang('YourReg').' '.get_setting('siteName');
- $emailbody="[NOTE:] ".get_lang('ThisIsAutomaticEmailNoReply').".\n\n".get_lang('langDear')." $firstname $lastname,\n\n".get_lang('langYouAreReg')." ". get_setting('siteName') ." ".get_lang('langSettings')." $username\n". get_lang('langPass')." : $password\n\n".get_lang('langAddress') ." ". get_lang('langIs') ." ". $serverAddress ."\n\n".get_lang('YouWillSoonReceiveMailFromCoach')."\n\n". get_lang('langProblem'). "\n\n". get_lang('langFormula');
- //#287 modifiee par Stephane DEBIEVE - FOREM
- $emailheaders='From: '.get_setting('administratorName').' '.get_setting('administratorSurname').' <'.get_setting('emailAdministrator').">\n";
- $emailheaders.='Reply-To: '.get_setting('emailAdministrator');
- @api_send_mail($emailto,$emailsubject,$emailbody,$emailheaders);
- }
- }
- else
- {
- $lastname = mb_convert_encoding($userNode->Lastname,$charset,'utf-8');
- $firstname = mb_convert_encoding($userNode->Firstname,$charset,'utf-8');
- $password = mb_convert_encoding($userNode->Password,$charset,'utf-8');
- $email = mb_convert_encoding($userNode->Email,$charset,'utf-8');
- $official_code = mb_convert_encoding($userNode->OfficialCode,$charset,'utf-8');
- $phone = mb_convert_encoding($userNode->Phone,$charset,'utf-8');
- $status = mb_convert_encoding($userNode->Status,$charset,'utf-8');
- switch($status)
- {
- case 'student' : $status = 5; break;
- case 'teacher' : $status = 1; break;
- default : $status = 5; $errorMsg = get_lang('StudentStatusWasGivenTo').' : '.$username.'<br />';
- }
- $sql = "UPDATE $tbl_user SET
- lastname = '".Database::escape_string($lastname)."',
- firstname = '".Database::escape_string($firstname)."',
- ".(empty($password) ? "" : "password = '".($userPasswordCrypted==true ? md5($password) : $password)."',")."
- email = '".Database::escape_string($email)."',
- official_code = '".Database::escape_string($official_code)."',
- phone = '".Database::escape_string($phone)."',
- status = '".Database::escape_string($status)."'
- WHERE username = '".Database::escape_string($username)."'";
- api_sql_query($sql, __FILE__, __LINE__);
-
- }
- }
- foreach($racine->Courses->Course as $courseNode)
- {
- $course_code = mb_convert_encoding($courseNode->CourseCode,$charset,'utf-8');
- $title = mb_convert_encoding($courseNode->CourseTitle,$charset,'utf-8');
- $description = mb_convert_encoding($courseNode->CourseDescription,$charset,'utf-8');
- $language = mb_convert_encoding($courseNode->CourseLanguage,$charset,'utf-8');
- $username = mb_convert_encoding($courseNode->CourseTeacher,$charset,'utf-8');
- $sql = "SELECT user_id, lastname, firstname FROM $tbl_user WHERE username='$username'";
- $rs = api_sql_query($sql, __FILE__, __LINE__);
- list($user_id, $lastname, $firstname) = mysql_fetch_array($rs);
- $keys = define_course_keys($course_code, "", $dbNamePrefix);
- if (sizeof($keys))
- {
- $currentCourseCode = $keys['visual_code'];
- $currentCourseId = $keys["currentCourseId"];
- if(empty($currentCourseCode))
- $currentCourseCode = $currentCourseId;
- $currentCourseDbName = $keys["currentCourseDbName"];
- $currentCourseRepository = $keys["currentCourseRepository"];
- if($currentCourseId == strtoupper($course_code))
- {
- if (empty ($title))
- {
- $title = $keys["currentCourseCode"];
- }
- prepare_course_repository($currentCourseRepository, $currentCourseId);
- update_Db_course($currentCourseDbName);
- fill_course_repository($currentCourseRepository);
- fill_Db_course($currentCourseDbName, $currentCourseRepository, 'french');
- //register_course($currentCourseId, $currentCourseCode, $currentCourseRepository, $currentCourseDbName, "$lastname $firstname", $course['unit_code'], addslashes($course['FR']['title']), $language, $user_id);
- $sql = "INSERT INTO ".$tbl_course." SET
- code = '".$currentCourseId."',
- db_name = '".$currentCourseDbName."',
- directory = '".$currentCourseRepository."',
- course_language = '".$language."',
- title = '".$title."',
- description = '".lang2db($description)."',
- category_code = '',
- visibility = '".$defaultVisibilityForANewCourse."',
- show_score = '',
- disk_quota = NULL,
- creation_date = now(),
- expiration_date = NULL,
- last_edit = now(),
- last_visit = NULL,
- tutor_name = '".$lastname." ".$firstname."',
- visual_code = '".$currentCourseCode."'";
- api_sql_query($sql, __FILE__, __LINE__);
- $sql = "INSERT INTO ".$tbl_course_user." SET
- course_code = '".$currentCourseId."',
- user_id = '".$user_id."',
- status = '1',
- role = '".lang2db('Professor')."',
- tutor_id='1',
- sort='". ($sort +1)."',
- user_course_cat='0'";
- api_sql_query($sql, __FILE__, __LINE__);
- }
- }
- }
-
- foreach ($racine->Session as $sessionNode){ // foreach session
-
- $countCourses = 0;
- $countUsers = 0;
- $SessionName = mb_convert_encoding($sessionNode->SessionName,$charset,'utf-8');
- $Coach = mb_convert_encoding($sessionNode->Coach,$charset,'utf-8');
- if(!empty($Coach)){
- $sqlCoach = "SELECT user_id FROM $tbl_user WHERE username='$Coach'";
- $rsCoach = api_sql_query($sqlCoach);
- list($CoachId) = (mysql_fetch_array($rsCoach));
- if(empty($CoachId))
- {
- $errorMsg .= get_lang('UserDoesNotExist').' : '.$Coach.'<br />';
- }
- }
- $DateStart = $sessionNode->DateStart;
- if(!empty($DateStart))
- {
- list($YearStart,$MonthStart, $DayStart) = explode('-',$DateStart);
- if(empty($YearStart) || empty($MonthStart) || empty($DayStart))
- {
- $errorMsg .= get_lang('WrongDate').' : '.$DateStart.'<br />';
- break;
- }
- else
- {
- $timeStart = mktime(0,0,0,$MonthStart,$DayStart,$YearStart);
- }
- $DateEnd = $sessionNode->DateEnd;
- if(!empty($DateStart))
- {
- list($YearEnd,$MonthEnd, $DayEnd) = explode('-',$DateEnd);
- if(empty($YearEnd) || empty($MonthEnd) || empty($DayEnd))
- {
- $errorMsg .= get_lang('WrongDate').' : '.$DateEnd.'<br />';
- break;
- }
- else
- {
- $timeEnd = mktime(0,0,0,$MonthEnd,$DayEnd,$YearEnd);
- }
- }
- if($timeEnd - $timeStart < 0)
- {
- $errorMsg .= get_lang('StartDateShouldBeBeforeEndDate').' : '.$DateEnd.'<br />';
- }
- }
- // verify that session doesn't exist
- while(!$uniqueName)
- {
- if($i>1)
- $suffix = ' - '.$i;
- $sql = 'SELECT 1 FROM '.$tbl_session.' WHERE name="'.Database::escape_string($SessionName.$suffix).'"';
- $rs = api_sql_query($sql, __FILE__, __LINE__);
- if(mysql_result($rs,0,0))
- {
- $i++;
- }
- else
- {
- $uniqueName = true;
- $SessionName .= $suffix;
- }
- }
- $sqlSession = "INSERT IGNORE INTO $tbl_session SET
- name = '".Database::escape_string($SessionName)."',
- id_coach = '$CoachId',
- date_start = '$DateStart',
- date_end = '$DateEnd',
- session_admin_id=".intval($_user['user_id']);
- $rsSession = api_sql_query($sqlSession, __FILE__, __LINE__);
- $session_id = mysql_insert_id();
-
- $countSessions++;
- foreach ($sessionNode->User as $userNode){
- $username = mb_convert_encoding(substr($userNode->nodeValue,0,20),$charset,'utf-8');
- $sqlUser = "SELECT user_id FROM $tbl_user WHERE username='".Database::escape_string($username)."'";
- $rsUser = api_sql_query($sqlUser);
- list($user_id) = (mysql_fetch_array($rsUser));
- if(!empty($user_id)){
- $sql = "INSERT INTO $tbl_session_user SET
- id_user='$user_id',
- id_session = '$session_id'";
- $rsUser = api_sql_query($sql,__FILE__,__LINE__);
- if(mysql_affected_rows()){
- $countUsers++;
- }
- }
- }
- foreach($sessionNode->Course as $courseNode){
- $CourseCode = $courseNode->CourseCode;
- // verify that the course pointed by the course code node exists
- $sql = 'SELECT 1 FROM '.$tbl_course.' WHERE code="'.mysql_escape_string($CourseCode).'"';
- $rs = api_sql_query($sql, __FILE__, __LINE__);
- if(mysql_num_rows($rs)>0)
- { // if the course exists we continue
- $Coach = substr($courseNode->Coach,0,20);
- if(!empty($Coach)){
- $sqlCoach = "SELECT user_id FROM $tbl_user WHERE username='$Coach'";
- $rsCoach = api_sql_query($sqlCoach,__FILE__,__LINE__);
- list($CoachId) = (mysql_fetch_array($rsCoach));
- if(empty($CoachId))
- {
- $errorMsg .= get_lang('UserDoesNotExist').' : '.$Coach.'<br />';
- }
- }
- else {
- $Coach = '';
- }
- $sqlCourse = "INSERT INTO $tbl_session_course SET
- course_code = '$CourseCode',
- id_coach='$CoachId',
- id_session='$session_id'";
- $rsCourse = api_sql_query($sqlCourse,__FILE__,__LINE__);
- if(mysql_affected_rows()){
- $countCourses++;
- $countUsersCourses = 0;
- foreach ($courseNode->User as $userNode){
- $username = substr($userNode,0,20);
- $sqlUser = "SELECT user_id FROM $tbl_user WHERE username='".$username."'";
- $rsUser = api_sql_query($sqlUser);
- list($user_id) = (mysql_fetch_array($rsUser));
- if(!empty($user_id))
- {
- $sql = "INSERT IGNORE INTO $tbl_session_user SET
- id_user='$user_id',
- id_session = '$session_id'";
- if(mysql_affected_rows())
- $countUsers++;
- $rsUser = api_sql_query($sql,__FILE__,__LINE__);
- $sql = "INSERT IGNORE INTO $tbl_session_course_user SET
- id_user='$user_id',
- course_code='$CourseCode',
- id_session = '$session_id'";
- $rsUsers = api_sql_query($sql,__FILE__,__LINE__);
- if(mysql_affected_rows())
- $countUsersCourses++;
- }
- else
- {
- $errorMsg .= get_lang('UserDoesNotExist').' : '.$username.'<br />';
- }
- }
- api_sql_query("UPDATE $tbl_session_course SET nbr_users='$countUsersCourses' WHERE course_code='$CourseCode'",__FILE__,__LINE__);
- }
- }
- else
- { // if the course does not exists
- $errorMsg .= get_lang('CourseDoesNotExist').' : '.$CourseCode.'<br />';
- }
- }
- api_sql_query("UPDATE $tbl_session SET nbr_users='$countUsers', nbr_courses='$countCourses' WHERE id='$session_id'",__FILE__,__LINE__);
- }
- }
- else
- {
- $errorMsg .= get_lang('XMLNotValid');
- }
- }
- /////////////////////
- // CSV /////////////
- ///////////////////
- else
- {
- $content=file($_FILES['import_file']['tmp_name']);
- if(!strstr($content[0],';'))
- {
- $errorMsg=get_lang('NotCSV');
- }
- else
- {
- $tag_names=array();
- foreach($content as $key=>$enreg)
- {
- $enreg=explode(';',trim($enreg));
- if($key)
- {
- foreach($tag_names as $tag_key=>$tag_name)
- {
- $sessions[$key-1][$tag_name]=$enreg[$tag_key];
- }
- }
- else
- {
- foreach($enreg as $tag_name)
- {
- $tag_names[]=eregi_replace('[^a-z0-9_-]','',$tag_name);
- }
- if(!in_array('SessionName',$tag_names) || !in_array('DateStart',$tag_names) || !in_array('DateEnd',$tag_names))
- {
- $errorMsg=get_lang('NoNeededData');
- break;
- }
- }
- }
-
- foreach($sessions as $enreg) {
-
- $SessionName = $enreg['SessionName'];
- $DateStart = $enreg['DateStart'];
- $DateEnd = $enreg['DateEnd'];
- if(!empty($enreg['Coach'])){
- $sqlCoach = "SELECT user_id FROM $tbl_user WHERE username='".$enreg['Coach']."'";
- $rsCoach = api_sql_query($sqlCoach);
- list($Coach) = (mysql_fetch_array($rsCoach));
- }
- else {
- $Coach = '';
- }
- $sqlSession = "INSERT IGNORE INTO $tbl_session SET
- name = '$SessionName',
- id_coach = '$Coach',
- date_start = '$DateStart',
- date_end = '$DateEnd'";
- $rsSession = api_sql_query($sqlSession, __FILE__, __LINE__);
- $update = false;
- if(!mysql_affected_rows($rsSession)){
- $update = true;
- $sqlSession = "UPDATE $tbl_session SET
- id_coach = '$Coach',
- date_start = '$DateStart',
- date_end = '$DateEnd'
- WHERE name = '$SessionName'";
- $rsSession = api_sql_query($sqlSession, __FILE__, __LINE__);
- $session_id = api_sql_query("SELECT id FROM $tbl_session WHERE name='$SessionName'",__FILE__,__LINE__);
- list($session_id) = mysql_fetch_array($session_id);
- api_sql_query("DELETE FROM $tbl_session_user WHERE id_session='$session_id'",__FILE__,__LINE__);
- api_sql_query("DELETE FROM $tbl_session_course WHERE id_session='$session_id'",__FILE__,__LINE__);
- api_sql_query("DELETE FROM $tbl_session_course_user WHERE id_session='$session_id'",__FILE__,__LINE__);
- }
- else {
- $session_id = mysql_insert_id($rsSession);
- }
-
- $countSessions++;
-
- $users = explode('|',$enreg['Users']);
- foreach ($users as $user){
- $sqlUser = "SELECT user_id FROM $tbl_user WHERE username='".$user."'";
- $rsUser = api_sql_query($sqlUser);
- list($user_id) = (mysql_fetch_array($rsUser));
- $sql = "INSERT INTO $tbl_session_user SET
- id_user='$user_id',
- id_session = '$session_id'";
- $rsUser = api_sql_query($sql,__FILE__,__LINE__);
- if(mysql_affected_rows()){
- $countUsers++;
- }
- }
- $courses = explode('|',$enreg['Courses']);
- foreach($courses as $course){
- $CourseCode = substr($course,0,strpos($course,'['));
- $Coach = strstr($course,'[');
- $Coach = substr($Coach,1,strpos($Coach,']')-1);
- if(!empty($Coach)){
- $sqlCoach = "SELECT user_id FROM $tbl_user WHERE username='$Coach'";
- $rsCoach = api_sql_query($sqlCoach,__FILE__,__LINE__);
- list($Coach) = (mysql_fetch_array($rsCoach));
- }
- else {
- $Coach = '';
- }
- $sqlCourse = "INSERT INTO $tbl_session_course SET
- course_code = '$CourseCode',
- id_coach='$Coach',
- id_session='$session_id'";
- $rsCourse = api_sql_query($sqlCourse,__FILE__,__LINE__);
- if(mysql_affected_rows()){
- $countCourses++;
- $users = substr($course , strpos($course,'[',1)+1 , strpos($course,']',1));
- $users = explode('|',$enreg['Users']);
- $countUsersCourses = 0;
- foreach ($users as $user){
- $sqlUser = "SELECT user_id FROM $tbl_user WHERE username='".$user."'";
- $rsUser = api_sql_query($sqlUser);
- list($user_id) = (mysql_fetch_array($rsUser));
- $sql = "INSERT INTO $tbl_session_course_user SET
- id_user='$user_id',
- course_code='$CourseCode',
- id_session = '$session_id'";
- $rsUsers = api_sql_query($sql,__FILE__,__LINE__);
- if(mysql_affected_rows())
- $countUsersCourses++;
- }
- api_sql_query("UPDATE $tbl_session_course SET nbr_users='$countUsersCourses' WHERE course_code='$CourseCode'",__FILE__,__LINE__);
- }
- }
- api_sql_query("UPDATE $tbl_session SET nbr_users='$countUsers', nbr_courses='$countCourses' WHERE id='$session_id'",__FILE__,__LINE__);
- }
- }
- }
- if(!empty($errorMsg))
- {
- $errorMsg = get_lang('ButProblemsOccured').' :<br />'.$errorMsg;
- }
- if($countSessions == 1){
- header('Location: resume_session.php?id_session='.$session_id);
- exit;
- }
- else{
- header('Location: session_list.php?action=show_message&message='.urlencode(get_lang('FileImported').' '.$errorMsg));
- exit;
- }
- }
- else
- {
- $errorMsg = get_lang('NoInputFile');
- }
- }
- Display::display_header($tool_name);
- api_display_tool_title($tool_name);
- ?>
- <form method="post" action="<?php echo api_get_self(); ?>" enctype="multipart/form-data" style="margin:0px;">
- <input type="hidden" name="formSent" value="1">
- <table border="0" cellpadding="5" cellspacing="0">
- <?php
- if(!empty($errorMsg))
- {
- ?>
- <tr>
- <td colspan="2">
- <?php
- Display::display_normal_message($errorMsg,false); //main API
- ?>
- </td>
- </tr>
- <?php
- }
- ?>
- <tr>
- <td nowrap="nowrap"><?php echo get_lang('ImportFileLocation'); ?> :</td>
- <td><input type="file" name="import_file" size="30"></td>
- </tr>
- <tr>
- <td nowrap="nowrap" valign="top"><?php echo get_lang('FileType'); ?> :</td>
- <td>
- <input class="checkbox" type="radio" name="file_type" id="file_type_xml" value="xml" checked="checked" /> <label for="file_type_xml">XML</label> (<a href="exemple.xml" target="_blank"><?php echo get_lang('ExampleXMLFile'); ?></a>)<br>
- <input class="checkbox" type="radio" name="file_type" id="file_type_csv" value="csv" <?php if($formSent && $file_type == 'csv') echo 'checked="checked"'; ?>> <label for="file_type_csv">CSV</label> (<a href="exempleSession.csv" target="_blank"><?php echo get_lang('ExampleCSVFile'); ?></a>)<br>
- </td>
- </tr>
- <tr>
- <td nowrap="nowrap" valign="top"><?php echo get_lang('SendMailToUsers'); ?> :</td>
- <td>
- <input class="checkbox" type="checkbox" name="sendMail" id="sendMail" value="true" />
- </td>
- </tr>
- <tr>
- <td> </td>
- <td><input type="submit" value="<?php echo get_lang('Ok'); ?>"></td>
- </tr>
- </table>
- </form>
- <font color="gray">
- <p><?php echo get_lang('CSVMustLookLike').' ('.get_lang('MandatoryFields').')'; ?> :</p>
- <blockquote>
- <pre>
- <b>SessionName</b>;Coach;<b>DateStart</b>;<b>DateEnd</b>;Users;Courses
- <b>xxx</b>;xxx;<b>xxx;xxx</b>;username1|username2;course1[coach1][username1,username2,...]|course2[coach1][username1,username2,...]
- </pre>
- </blockquote>
- <p><?php echo get_lang('XMLMustLookLike').' ('.get_lang('MandatoryFields').')'; ?> :</p>
- <blockquote>
- <pre>
- <?xml version="1.0" encoding="ISO-8859-1"?>
- <Sessions>
- <Users>
- <User>
- <Username><b>username1</b></Username>
- <Lastname>xxx</Lastname>
- <Firstname>xxx</Firstname>
- <Password>xxx</Password>
- <Email>xxx@xx.xx</Email>
- <OfficialCode>xxx</OfficialCode>
- <Phone>xxx</Phone>
- <Status>student|teacher</Status>
- </User>
- </Users>
- <Courses>
- <Course>
- <CourseCode><b>xxx</b></CourseCode>
- <CourseTeacher>xxx</CourseTeacher>
- <CourseLanguage>xxx</CourseLanguage>
- <CourseTitle>xxx</CourseTitle>
- <CourseDescription>xxx</CourseDescription>
- </Course>
- </Courses>
- <Session>
- <b><SessionName>xxx</SessionName></b>
- <Coach>xxx</Coach>
- <b><DateStart>xxx</DateStart></b>
- <b><DateEnd>xxx</DateEnd></b>
- <User>xxx</User>
- <User>xxx</User>
- <Course>
- <CourseCode>coursecode1</CourseCode>
- <Coach>coach1</Coach>
- <User>username1</User>
- <User>username2</User>
- </Course>
- </Session>
- </Sessions>
- </pre>
- </blockquote>
- </font>
- <?php
- /*
- ==============================================================================
- FOOTER
- ==============================================================================
- */
- Display::display_footer();
- ?>
|