Re: Parse WebCT quiz
| From: | John Taylor-Johnston | Date: | Mon, 24 Nov 2003 06:25:43 +0000 |
| Subject: | Re: Parse WebCT quiz | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-170768@lists.php.net to get a copy of this message | ||
I have done this (below) already. I suppose. I will have to explode by \n.
One of my problems is that with ":QUESTION:{H|T}", the question is on the next line.
Exploding by \n puts my question text into the next line_field[]. "Note: Multiple lines of text
are permitted."
Getting that variabnle confuses me, for example.
https://online.csus.edu/web-ct/help/en/designer/quiz/quiz_transfer.html#formats
Tested: http://ccl.flsh.usherbrooke.ca/~johj2201/webct_import.php
$fileContents=fread($fh, filesize($_FILES['userfile']['tmp_name']));
fclose($fh);
$lines=explode("\n",$fileContents);
foreach($lines as $line)
{
echo $line."<hr>";
}
-----quiz.txt----------
:TYPE:S
:TITLE:Sample Exercise JQuiz 2 (2)
:CAT:Sample Exercise 2
:QUESTION:H
I have come here <u>a lot</u>.
:ANSWERS:1
:CASE:0
:ANSWER1:How often have you come here?:100:0:0
:ANSWER2:How often have I come here?:100:0:0
:TYPE:MC:1:0:C
:TITLE:Sample JBC Exercise 1 (1)
:CAT:Sample Exercise 1
:QUESTION:H
Which if the following sentences is incorrect?
:ANSWER1:0:H
That's not a very funny joke.
:REASON1:H
:ANSWER2:0:H
The book I'm reading is quite long.
:REASON2:H
:ANSWER3:0:H
He's much taller than me.
:REASON3:H
:ANSWER4:100:H
Anna is more younger than Halley.
:REASON4:H
The corrct response is: "Anna is younger than Halley."