[svn r12976] If there is only one session imported, we redirect on the session resume page : http://projects.dokeos.com/?do=details&id=1867

skala
Julian Prud'homme 17 years ago
parent e32f7bc13b
commit 988e72c528
  1. 16
      main/admin/session_import.php

@ -75,6 +75,8 @@ if($_POST['formSent'])
//XML///////////////// //XML/////////////////
///////////////////// /////////////////////
$countSessions = 0;
if($file_type == 'xml') if($file_type == 'xml')
{ {
@ -215,6 +217,7 @@ if($_POST['formSent'])
} }
} }
foreach ($racine->Session as $sessionNode){ // foreach session foreach ($racine->Session as $sessionNode){ // foreach session
$countCourses = 0; $countCourses = 0;
@ -295,6 +298,8 @@ if($_POST['formSent'])
$rsSession = api_sql_query($sqlSession, __FILE__, __LINE__); $rsSession = api_sql_query($sqlSession, __FILE__, __LINE__);
$session_id = mysql_insert_id(); $session_id = mysql_insert_id();
$countSessions++;
foreach ($sessionNode->User as $userNode){ foreach ($sessionNode->User as $userNode){
$username = mb_convert_encoding(substr($userNode->nodeValue,0,20),$charset,'utf-8'); $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)."'"; $sqlUser = "SELECT user_id FROM $tbl_user WHERE username='".Database::escape_string($username)."'";
@ -440,6 +445,7 @@ if($_POST['formSent'])
} }
foreach($sessions as $enreg) { foreach($sessions as $enreg) {
$SessionName = $enreg['SessionName']; $SessionName = $enreg['SessionName'];
$DateStart = $enreg['DateStart']; $DateStart = $enreg['DateStart'];
$DateEnd = $enreg['DateEnd']; $DateEnd = $enreg['DateEnd'];
@ -479,6 +485,8 @@ if($_POST['formSent'])
$session_id = mysql_insert_id($rsSession); $session_id = mysql_insert_id($rsSession);
} }
$countSessions++;
$users = explode('|',$enreg['Users']); $users = explode('|',$enreg['Users']);
foreach ($users as $user){ foreach ($users as $user){
$sqlUser = "SELECT user_id FROM $tbl_user WHERE username='".$user."'"; $sqlUser = "SELECT user_id FROM $tbl_user WHERE username='".$user."'";
@ -546,7 +554,15 @@ if($_POST['formSent'])
{ {
$errorMsg = get_lang('ButProblemsOccured').' :<br />'.$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)); header('Location: session_list.php?action=show_message&message='.urlencode(get_lang('FileImported').' '.$errorMsg));
exit;
}
} }
else else
{ {

Loading…
Cancel
Save