|
|
|
@ -123,9 +123,10 @@ function lp_upload_quiz_action_handling() { |
|
|
|
|
// Read the Excel document |
|
|
|
|
$data = new Spreadsheet_Excel_Reader(); |
|
|
|
|
// Set output Encoding. |
|
|
|
|
$data->setOutputEncoding(api_get_system_encoding()); |
|
|
|
|
$data->setOutputEncoding('UTF-8'); |
|
|
|
|
// Reading the xls document. |
|
|
|
|
$data->read($_FILES['user_upload_quiz']['tmp_name']); |
|
|
|
|
|
|
|
|
|
// Variables |
|
|
|
|
$quiz_index = 0; |
|
|
|
|
$question_title_index = array(); |
|
|
|
@ -221,7 +222,7 @@ function lp_upload_quiz_action_handling() { |
|
|
|
|
// Quiz object |
|
|
|
|
$quiz_object = new Exercise(); |
|
|
|
|
|
|
|
|
|
$quiz_id = $quiz_object->create_quiz(api_utf8_encode($quiz_title), $expired_time, $type, $random, $active, $results, $max_attempt, $feedback); |
|
|
|
|
$quiz_id = $quiz_object->create_quiz(($quiz_title), $expired_time, $type, $random, $active, $results, $max_attempt, $feedback); |
|
|
|
|
// insert into the item_property table |
|
|
|
|
api_item_property_update($_course, TOOL_QUIZ, $quiz_id, 'QuizAdded', api_get_user_id()); |
|
|
|
|
// Import questions |
|
|
|
@ -229,7 +230,7 @@ function lp_upload_quiz_action_handling() { |
|
|
|
|
// Create questions |
|
|
|
|
$question_title = $question[$i][2]; // Question name |
|
|
|
|
if ($question_title != '') { |
|
|
|
|
$question_id = Question::create_question($quiz_id, api_utf8_encode($question_title)); |
|
|
|
|
$question_id = Question::create_question($quiz_id, ($question_title)); |
|
|
|
|
} |
|
|
|
|
$unique_answer = new UniqueAnswer(); |
|
|
|
|
if (is_array($new_answer[$i])) { |
|
|
|
@ -250,11 +251,13 @@ function lp_upload_quiz_action_handling() { |
|
|
|
|
$comment = $feedback_false_list[$i][2]; |
|
|
|
|
} |
|
|
|
|
// Create answer |
|
|
|
|
$unique_answer->create_answer($id, $question_id, api_utf8_encode($answer), api_utf8_encode($comment), $score, $correct); |
|
|
|
|
$unique_answer->create_answer($id, $question_id, ($answer), ($comment), $score, $correct); |
|
|
|
|
$id++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var_dump($data->sheets[0]);exit; |
|
|
|
|
if (isset($_SESSION['lpobject'])) { |
|
|
|
|
if ($debug > 0) { |
|
|
|
|
error_log('New LP - SESSION[lpobject] is defined', 0); |
|
|
|
@ -281,7 +284,7 @@ function lp_upload_quiz_action_handling() { |
|
|
|
|
$previous = $_SESSION['oLP']->select_previous_item_id(); |
|
|
|
|
$parent = 0; |
|
|
|
|
// Add a Quiz as Lp Item |
|
|
|
|
$_SESSION['oLP']->add_item($parent, $previous, TOOL_QUIZ, $quiz_id, api_utf8_encode($quiz_title), ''); |
|
|
|
|
$_SESSION['oLP']->add_item($parent, $previous, TOOL_QUIZ, $quiz_id, ($quiz_title), ''); |
|
|
|
|
// Redirect to home page for add more content |
|
|
|
|
header('location: ../newscorm/lp_controller.php?' . api_get_cidreq() . '&action=add_item&type=step&lp_id=' . Security::remove_XSS($_GET['lp_id']).'&session_id='.api_get_session_id()); |
|
|
|
|
exit; |
|
|
|
|