$context = get_context_instance(CONTEXT_MODULE, $cm->id); require_capability('mod/lesson:edit', $context); $strimportppt = get_string("importppt", "lesson"); $strlessons = get_string("modulenameplural", "lesson"); print_header_simple("{$strimportppt}", " {$strimportppt}", "<a href=\"index.php?id={$course->id}\">{$strlessons}</a> -> <a href=\"{$CFG->wwwroot}/mod/{$modname}/view.php?id={$cm->id}\">" . format_string($mod->name, true) . "</a>-> {$strimportppt}"); if ($form = data_submitted()) { /// Filename if (empty($_FILES['newfile'])) { // file was just uploaded notify(get_string("uploadproblem")); } if (!is_uploaded_file($_FILES['newfile']['tmp_name']) or $_FILES['newfile']['size'] == 0) { notify(get_string("uploadnofilefound")); } else { // Valid file is found if ($rawpages = readdata($_FILES, $course->id, $modname)) { // first try to reall all of the data in $pageobjects = extract_data($rawpages, $course->id, $mod->name, $modname); // parse all the html files into objects clean_temp(); // all done with files so dump em $mod_create_objects = $modname . '_create_objects'; $mod_save_objects = $modname . '_save_objects'; $objects = $mod_create_objects($pageobjects, $mod->id); // function to preps the data to be sent to DB if (!$mod_save_objects($objects, $mod->id, $pageid)) { // sends it to DB error("could not save"); } } else { error('could not get data');
$attempt = game_getattempt($game, $detail); $bookid = $game->bookid; if ($bookid == 0) { error(get_string('bookquiz_not_select_book', 'game')); } if ($form = data_submitted()) { /// Filename if (empty($_FILES['newfile'])) { // file was just uploaded notify(get_string("uploadproblem")); } if (!is_uploaded_file($_FILES['newfile']['tmp_name']) or $_FILES['newfile']['size'] == 0) { notify(get_string("uploadnofilefound")); } else { // Valid file is found if (readdata($course->id, 'game', $dirtemp, $r_levels, $r_titles, $r_texts, $dirfordelete)) { // first try to reall all of the data in $subchapter = $_POST['subchapter'] != 0; $overwrite = (int) $_POST['overwrite'] != 0; if ($overwrite) { game_bookquiz_deletebook($course->id, $bookid); } $pageobjects = extract_data($course->id, 'book', $bookid, $dirtemp, $subchapter, $r_levels, $r_titles, $r_texts); // parse all the html files into objects clean_temp($dirfordelete); // all done with files so dump em $objects = game_bookquiz_create_objects($pageobjects, $bookid); // function to preps the data to be sent to DB if (!game_bookquiz_save_objects($objects)) { // sends it to DB error("could not save");