echo $OUTPUT->header(); echo $OUTPUT->box_start('generalbox'); $o = ""; $o .= 'var quizzes = new Array();'; $lastkey = 0; while (list($key, $value) = each($quiz)) { $o .= ' quizzes[' . $key . '] = [' . $value . '];'; $lastkey = $key; } $o .= 'lastkey = ' . $lastkey . ';'; $o .= '$(document).ready(function() {loadquiz(0);});function loadquiz(key) {if (key == window.lastkey) var end = 1; else var end = 0;$.post(\'' . $CFG->wwwroot . '/mod/reader/dlquizzes_proccess.php?id=' . $id . '&quizid=\'+window.quizzes[key]+\'&courseid=' . $courseid . '§ionchoosing=' . $sectionchoosing . '§ion=' . $section . '&end=\'+end, function(data) {$("#installationlog").append(data);if (key != window.lastkey) loadquiz(key + 1); });}'; echo html_writer::script($o); echo html_writer::tag('div', 'Installation in process...', array('id' => 'installationlog')); } else { $OUTPUT->header(); $xmlquizzesfile = reader_file($readercfg->reader_serverlink . "/?a=quizzes&login={$readercfg->reader_serverlogin}&password={$readercfg->reader_serverpassword}", array('password' => $password, 'quiz' => array($quizid), 'upload' => 'true')); $listofquizzes = xmlize($xmlquizzesfile); foreach ($listofquizzes['myxml']['#']['item'] as $number => $listofquizze) { foreach ($listofquizze['@'] as $key => $value) { $quizzestoadd[$number][$key] = $value; $sections[$listofquizze['@']['publisher'] . " - " . $listofquizze['@']['level']] = $listofquizze['@']['publisher'] . " - " . $listofquizze['@']['level']; if (empty($currentsection)) { $currentsection = $listofquizze['@']['publisher'] . " - " . $listofquizze['@']['level']; } } } if ($courseid == 0) { $data = array(); $data['fullname'] = 'All Quizzes'; $data['shortname'] = 'Reader'; $data['summary'] = 'All Quizzes';
$o .= html_writer::end_tag('form'); echo $o; echo $OUTPUT->box_end(); } else { $listofpublishers = reader_curlfile("{$readercfg->reader_serverlink}/?a=publishers&login={$readercfg->reader_serverlogin}&password={$readercfg->reader_serverpassword}"); $listofpublishers = xmlize(reader_makexml($listofpublishers)); foreach ($listofpublishers['myxml']['#']['item'] as $listofpublisher) { $quizzes[$listofpublisher['@']['publisher']][$listofpublisher['@']['level']][$listofpublisher['@']['id']] = $listofpublisher['#']; } //Check Passwords if ($step == 1) { $postzapros = array('quiz' => $quiz); } else { $postzapros = array('password' => $password, 'quiz' => $quiz); } $listofpublishers = xmlize(reader_file("{$readercfg->reader_serverlink}/?a=quizzes&login={$readercfg->reader_serverlogin}&password={$readercfg->reader_serverpassword}", $postzapros)); foreach ($listofpublishers['myxml']['#']['item'] as $listofpublisher) { $publishers[$listofpublisher['@']['publisher']][$listofpublisher['@']['level']]['pass'] = $listofpublisher['#']; if (isset($listofpublisher['@']['status'])) { $publishers[$listofpublisher['@']['publisher']][$listofpublisher['@']['level']]['status'] = $listofpublisher['@']['status']; } } //Passwords form $passprefix = ""; class reader_uploadbooks_form extends moodleform { function definition() { global $CFG, $DB, $course, $password, $publishers, $passprefix, $second, $quizzes, $removequizzes, $step, $id, $readercfg, $reader, $readercourseexist, $quiz, $reader_images, $OUTPUT; $o = ''; if (empty($puttocourse)) {