course)) { error("This course doesn't exist"); } require_login($course->id); if (!isteacher($course->id)) { error("You can't modify this course!"); } $strediting = get_string("validateascorm", "scorm"); $strname = get_string("name"); print_header_simple("$strediting", "$strediting", "$strediting"); if (!$form->name or !$form->reference or !$form->summary) { error(get_string("filloutallfields"), $_SERVER["HTTP_REFERER"]); } // // Create a temporary directory to unzip package and validate imsmanifest // $coursedir = "$CFG->dataroot/$course->id"; if ($scormdir = make_upload_directory("$course->id/$CFG->moddata/scorm")) { if ($tempdir = scorm_datadir($scormdir, $form->datadir)) { copy ("$coursedir/$form->reference", $tempdir."/".basename($form->reference)); if (empty($CFG->unzip)) { // Use built-in php-based unzip function include_once($CFG->dirroot.'/lib/pclzip/pclzip.lib.php'); $archive = new PclZip($tempdir."/".basename($form->reference)); if (!$list = $archive->extract($tempdir)) { error($archive->errorInfo(true)); } } else { $command = "cd $tempdir; $CFG->unzip -o ".basename($form->reference)." 2>&1"; exec($command); } $result = scorm_validate($tempdir."/imsmanifest.xml"); } else { $result = "packagedir"; } } else { $result = "datadir"; } $errorlogs = ''; if (($result != "regular") && ($result != "found")) { if ($CFG->scorm_validate == 'domxml') { foreach ($errors as $error) { $errorlogs .= get_string($error->type,"scorm",$error->data) . ".\n"; } } // // Delete files and temporary directory // if (is_dir($tempdir)) scorm_delete_files($tempdir); } else { // // Delete package file // unlink ($tempdir."/".basename($form->reference)); if ($form->mode == "update") { $fp = fopen($coursedir."/".$form->reference,"r"); $fstat = fstat($fp); fclose($fp); if (get_field("scorm","timemodified","id",$form->instance) < $fstat["mtime"]) $form->launch = 0; } } // // Print validation result // print_simple_box_start("center", "", "$THEME->cellheading"); echo "\n"; echo " \n"; echo " \n"; if ($errorlogs != '') { $lines = round(count($errors)/4); if ($lines < 5) { $lines = 5; } echo " \n"; } if (($form->mode == "update") && ($form->launch == 0) && (get_records("scorm_sco_users","scormid",$form->instance))) echo " \n"; echo "

$strname:

$form->name

".get_string("validation","scorm").":

".get_string($result,"scorm")."

".get_string("errorlogs","scorm").":

".get_string("trackingloose","scorm")."

\n"; if (($result == "regular") || ($result == "found")){ if (empty($form->auto)) { $form->auto = ""; } if (empty($form->maxgrade)) { $form->maxgrade = ""; } if (empty($form->grademethod)) { $form->grademethod = "0"; } echo "
destination\">\n"; //$form->popup = $CFG->scorm_popup; $strnewwindow = get_string("newwindow", "scorm"); $strnewwindowopen = get_string("newwindowopen", "scorm"); foreach ($SCORM_WINDOW_OPTIONS as $optionname) { $stringname = "str$optionname"; $$stringname = get_string("new$optionname", "scorm"); $window->$optionname = ""; $jsoption[] = "\"$optionname\""; } $alljsoptions = implode(",", $jsoption); if ($form->instance) { // Re-editing if ($form->popup == "") { $newwindow = ""; // Disable the new window foreach ($SCORM_WINDOW_OPTIONS as $optionname) { $defaultvalue = "scorm_popup$optionname"; $window->$optionname = $CFG->$defaultvalue; } } else { $newwindow = "checked"; $rawoptions = explode(',', $form->popup); foreach ($rawoptions as $rawoption) { $option = explode('=', trim($rawoption)); if (($option[0] != 'location') && ($option[0] != 'menubar') && ($option[0] != 'toolbar')) { $optionname = $option[0]; $optionvalue = $option[1]; if ($optionname == "height" or $optionname == "width") { $window->$optionname = $optionvalue; } else if ($optionvalue == 1) { $window->$optionname = "checked"; } } } } } else { foreach ($SCORM_WINDOW_OPTIONS as $optionname) { $defaultvalue = "scorm_popup$optionname"; $window->$optionname = $CFG->$defaultvalue; } $newwindow = $CFG->scorm_popup; } ?>

:

grademethod", ""); helpbutton("grademethod", get_string("grademethod","scorm"), "scorm"); ?>

:

=1; $i--) { $grades[$i] = $i; } choose_from_menu($grades, "maxgrade", "$form->maxgrade", ""); helpbutton("maxgrade", get_string("maximumgrade"), "scorm"); ?>

:

auto); ?>

onclick="autowindow();return lockoptions('theform','newwindow', subitems);" />
    $value) { if ($name == "height" or $name == "width") { continue; } echo "\t\t\n"; echo "\t\t$name." /> "; $stringname = "str$name"; echo $$stringname."
    \n"; } ?>

    \n\n"; } ?>

" /> " />
" onClick="document.location='wwwroot ?>/course/view.php?id=id ?>';">