|
|
|
@ -12,14 +12,15 @@ |
|
|
|
|
* internal functions. |
|
|
|
|
* @return array List of user IDs for the users that have just been inserted |
|
|
|
|
*/ |
|
|
|
|
function fill_exe() { |
|
|
|
|
function fill_exe() |
|
|
|
|
{ |
|
|
|
|
$qc = 5000; //how many questions to create per exercise |
|
|
|
|
$eol = PHP_EOL; |
|
|
|
|
$courses = array(); //declare only to avoid parsing notice |
|
|
|
|
$qst = array(); |
|
|
|
|
require_once 'data_exe.php'; //fill the $users array |
|
|
|
|
$output = array(); |
|
|
|
|
$output[] = array('title'=>'Exe Filling Report: '); |
|
|
|
|
$output[] = array('title' => 'Exe Filling Report: '); |
|
|
|
|
$i = 1; |
|
|
|
|
$lib = api_get_path(SYS_CODE_PATH); |
|
|
|
|
require_once $lib.'exercice/exercise.class.php'; |
|
|
|
@ -63,12 +64,22 @@ function fill_exe() { |
|
|
|
|
$question->type = $q['type']; |
|
|
|
|
$question->course = $res; |
|
|
|
|
$r = $question->save($id); |
|
|
|
|
if ($r === false) { continue; } |
|
|
|
|
if ($r === false) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
$qid = $question->id; |
|
|
|
|
$aid = 1; |
|
|
|
|
foreach ($q['answers'] as $asw) { |
|
|
|
|
$answer = new UniqueAnswer($qid); |
|
|
|
|
$answer->create_answer($aid,$qid,$asw['title'],'',$asw['score'],$asw['correct'], $res['real_id']); |
|
|
|
|
$answer->create_answer( |
|
|
|
|
$aid, |
|
|
|
|
$qid, |
|
|
|
|
$asw['title'], |
|
|
|
|
'', |
|
|
|
|
$asw['score'], |
|
|
|
|
$asw['correct'], |
|
|
|
|
$res['real_id'] |
|
|
|
|
); |
|
|
|
|
$aid++; |
|
|
|
|
} |
|
|
|
|
$qi++; |
|
|
|
@ -78,5 +89,6 @@ function fill_exe() { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $output; |
|
|
|
|
} |
|
|
|
|