<input type="hidden" name="cmi_core_total_time" />
<input type="hidden" name="cmi_core_score_raw" />
<input type="hidden" name="cmi_suspend_data" />
-
</form>
</body>
</html>
// This file is a hack to files/index.php that removes
// the headers and adds some controls so that images
-// can be selected within the Richtext editor.
+// can be selected within the Richtext editor.
// All the Moodle-specific stuff is in this top section
// Configuration and access control occurs here.
function html_footer() {
echo "</td></tr></table></body></html>";
}
-
+
function html_header($course, $wdir, $formfield=""){
- global $CFG,$THEME,$ME;
+ global $CFG, $THEME, $ME;
if ($course->id == SITEID) {
$strfiles = get_string("sitefiles");
} else {
$strfiles = get_string("files");
}
-
+
if ($wdir == "/") {
$fullnav = "$strfiles";
} else {
$regexp="\\.\\.";
- if (ereg( $regexp, $file, $regs )| ereg( $regexp, $wdir,$regs )) {
+ if (ereg( $regexp, $file, $regs )| ereg( $regexp, $wdir,$regs )) {
$message = "Error: Directories can not contain \"..\"";
$wdir = "/";
$action = "";
- }
+ }
if (!$wdir) {
$wdir="/";
echo "<p>$struploadafile ($strmaxsize) --> <b>$wdir</b>";
echo "<table><tr><td colspan=\"2\">";
echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"".$ME."\">";
- echo " <input type=\"hidden\" name=\"id\" value=$id />";
- echo " <input type=\"hidden\" name=\"wdir\" value=$wdir />";
- echo " <input type=\"hidden\" name=\"action\" value=\"upload\" />";
upload_print_form_fragment(1,array('userfile'),null,false,null,$course->maxbytes,0,false);
+ echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
+ echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
+ echo " <input type=\"hidden\" name=\"action\" value=\"upload\" />";
echo " </td><tr><td width=\"10\">";
echo " <input type=\"submit\" name=\"save\" value=\"$struploadthisfile\" />";
echo "</form>";
echo "</td><td width=\"100%\">";
echo "<form action=\"".$ME."\" method=\"get\">";
- echo " <input type=\"hidden\" name=\"id\" value=$id />";
- echo " <input type=\"hidden\" name=\"wdir\" value=$wdir />";
+ echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
+ echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />";
echo " <input type=\"submit\" value=\"$strcancel\" />";
echo "</form>";
printfilelist($USER->filelist);
print_simple_box_end();
echo "<br />";
- notice_yesno (get_string("deletecheckfiles"),
+ notice_yesno (get_string("deletecheckfiles"),
"".basename($ME)."?id=$id&wdir=$wdir&action=delete&confirm=1",
"".basename($ME)."?id=$id&wdir=$wdir&action=cancel");
} else {
echo "Error: could not rename $oldname to $name";
}
displaydir($wdir);
-
+
} else {
$strrename = get_string("rename");
$strcancel = get_string("cancel");
echo "<p>$strrenamefileto:";
echo "<table><tr><td>";
echo "<form action=\"".$ME."\" method=\"post\" name=\"form\">";
- echo " <input type=\"hidden\" name=\"id\" value=$id />";
- echo " <input type=\"hidden\" name=\"wdir\" value=$wdir />";
+ echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
+ echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
echo " <input type=\"hidden\" name=\"action\" value=\"rename\" />";
echo " <input type=\"hidden\" name=\"oldname\" value=\"$file\" />";
echo " <input type=\"text\" name=\"name\" size=\"35\" value=\"$file\" />";
echo "</form>";
echo "</td><td>";
echo "<form action=\"".$ME."\" method=\"get\">";
- echo " <input type=\"hidden\" name=\"id\" value=$id />";
- echo " <input type=\"hidden\" name=\"wdir\" value=$wdir />";
+ echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
+ echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />";
echo " <input type=\"submit\" value=\"$strcancel\" />";
echo "</form>";
echo "Error: could not create $name";
}
displaydir($wdir);
-
+
} else {
$strcreate = get_string("create");
$strcancel = get_string("cancel");
echo "<p>$strcreatefolder:";
echo "<table><tr><td>";
echo "<form action=\"".$ME."\" method=\"post\" name=\"form\">";
- echo " <input type=\"hidden\" name=\"id\" value=$id />";
- echo " <input type=\"hidden\" name=\"wdir\" value=$wdir />";
+ echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
+ echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
echo " <input type=\"hidden\" name=\"action\" value=\"mkdir\" />";
echo " <input type=\"text\" name=\"name\" size=\"35\" />";
echo " <input type=\"submit\" value=\"$strcreate\" />";
echo "</form>";
echo "</td><td>";
echo "<form action=\"".$ME."\" method=\"get\">";
- echo " <input type=\"hidden\" name=\"id\" value=$id />";
- echo " <input type=\"hidden\" name=\"wdir\" value=$wdir />";
+ echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
+ echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />";
echo " <input type=\"submit\" value=\"$strcancel\" />";
echo "</form>";
fputs($fileptr, stripslashes($text));
fclose($fileptr);
displaydir($wdir);
-
+
} else {
$streditfile = get_string("edit", "", "<b>$file</b>");
$fileptr = fopen($basedir.$file, "r");
echo "<table><tr><td colspan=\"2\">";
echo "<form action=\"".$ME."\" method=\"post\" name=\"form\" $onsubmit>";
- echo " <input type=\"hidden\" name=\"id\" value=$id />";
+ echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
echo " <input type=\"hidden\" name=\"file\" value=\"$file\" />";
echo " <input type=\"hidden\" name=\"action\" value=\"edit\" />";
echo "</form>";
echo "</td><td>";
echo "<form action=\"".$ME."\" method=\"get\">";
- echo " <input type=\"hidden\" name=\"id\" value=$id />";
- echo " <input type=\"hidden\" name=\"wdir\" value=$wdir />";
+ echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
+ echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />";
echo " <input type=\"submit\" value=\"".get_string("cancel")."\" />";
echo "</form>";
echo "</td></tr></table>";
- if ($usehtmleditor) {
+ if ($usehtmleditor) {
print_richedit_javascript("form", "text", "yes");
}
}
clearfilelist();
displaydir($wdir);
-
+
} else {
html_header($course, $wdir, "form.name");
echo "<p align=\"center\">".get_string("whattocallzip");
echo "<table><tr><td>";
echo "<form action=\"".$ME."\" method=\"post\" name=\"form\">";
- echo " <input type=\"hidden\" name=\"id\" value=$id />";
+ echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
echo " <input type=\"hidden\" name=\"action\" value=\"zip\" />";
echo " <input type=\"text\" name=\"name\" size=\"35\" value=\"new.zip\" />";
echo "</form>";
echo "</td><td>";
echo "<form action=\"".$ME."\" method=\"get\">";
- echo " <input type=\"hidden\" name=\"id\" value=$id />";
- echo " <input type=\"hidden\" name=\"wdir\" value=$wdir />";
+ echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
+ echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />";
echo " <input type=\"submit\" value=\"".get_string("cancel")."\" />";
echo "</form>";
}
echo "</table>";
}
-
+
} else { // Use external unzip program
print_simple_box_start("center");
echo "<pre>";
}
echo "<center><form action=\"".$ME."\" method=\"get\">";
- echo " <input type=\"hidden\" name=\"id\" value=$id />";
- echo " <input type=\"hidden\" name=\"wdir\" value=$wdir />";
+ echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
+ echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />";
echo " <input type=\"submit\" value=\"$strok\" />";
echo "</form>";
echo "</table>";
}
echo "<br /><center><form action=\"".$ME."\" method=\"get\">";
- echo " <input type=\"hidden\" name=\"id\" value=$id />";
- echo " <input type=\"hidden\" name=\"wdir\" value=$wdir />";
+ echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
+ echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />";
echo " <input type=\"submit\" value=\"$strok\" />";
echo "</form>";
/// FILE FUNCTIONS ///////////////////////////////////////////////////////////
-function fulldelete($location) {
+function fulldelete($location) {
if (is_dir($location)) {
$currdir = opendir($location);
- while ($file = readdir($currdir)) {
+ while ($file = readdir($currdir)) {
if ($file <> ".." && $file <> ".") {
$fullfile = $location."/".$file;
- if (is_dir($fullfile)) {
+ if (is_dir($fullfile)) {
if (!fulldelete($fullfile)) {
return false;
}
if (!unlink($fullfile)) {
return false;
}
- }
+ }
}
- }
+ }
closedir($currdir);
if (! rmdir($location)) {
return false;
echo "<img src=\"$CFG->pixpath/f/folder.gif\" height=\"16\" width=\"16\" alt=\"\" /> $file<br />";
$subfilelist = array();
$currdir = opendir($basedir.$file);
- while ($subfile = readdir($currdir)) {
+ while ($subfile = readdir($currdir)) {
if ($subfile <> ".." && $subfile <> ".") {
$subfilelist[] = $file."/".$subfile;
}
}
printfilelist($subfilelist);
- } else {
+ } else {
$icon = mimeinfo("icon", $file);
echo "<img src=\"$CFG->pixpath/f/$icon\" height=\"16\" width=\"16\" alt=\"\" /> $file<br />";
}
}
function displaydir ($wdir) {
+
// $wdir == / or /a or /a/b/c/d etc
global $basedir;
if ($file == "." || $file == "..") {
continue;
}
-
+
if (is_dir($fullpath."/".$file)) {
$dirlist[] = $file;
} else {
- if ((basename(strtolower($file),".zip") != basename(strtolower($file))) || (basename(strtolower($file),".pif") != basename(strtolower($file))))
- $filelist[] = $file;
+ if ((basename(strtolower($file),".zip") != basename(strtolower($file))) || (basename(strtolower($file),".pif") != basename(strtolower($file)))) {
+ $filelist[] = $file;
+ }
}
}
closedir($directory);
echo "<form action=\"".$ME."\" method=\"post\" name=\"dirform\">";
- echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"640\">";
+ echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"640\">";
echo "<tr>";
echo "<th width=\"5\"></th>";
echo "<th align=\"left\">$strname</th>";
$fileurl = rawurlencode($wdir."/".$dir);
$filesafe = rawurlencode($dir);
$filedate = userdate(filectime($filename), "%d %b %Y, %I:%M %p");
-
+
echo "<tr>";
print_cell("center", "<input type=\"checkbox\" name=\"file$count\" value=\"$fileurl\" />");
print_cell("right", "-");
print_cell("right", $filedate);
print_cell("right", "<a href=\"".basename($ME)."?id=$id&wdir=$wdir&file=$filesafe&action=rename\">$strrename</a>");
-
+
echo "</tr>";
}
}
-
if (!empty($filelist)) {
asort($filelist);
foreach ($filelist as $file) {
print_cell("center", "<input type=\"checkbox\" name=\"file$count\" value=\"$fileurl\" />");
echo "<td align=\"left\" nowrap=\"nowrap\">";
- link_to_popup_window ($ffurl, "display",
- "<img src=\"$CFG->pixpath/f/$icon\" height=\"16\" width=\"16\" border=\"0\" alt=\"file\" />",
+ link_to_popup_window ($ffurl, "display",
+ "<img src=\"$CFG->pixpath/f/$icon\" height=\"16\" width=\"16\" border=\"0\" alt=\"file\" />",
480, 640);
echo "<font size=\"-1\" face=\"Arial, Helvetica\">";
link_to_popup_window ($ffurl, "display", htmlspecialchars($file), 480, 640);
print_cell("right", display_size($file_size));
print_cell("right", $filedate);
- $edittext = "<b><a onMouseDown=\"return set_value('$selectfile')\" href=\"\">$strchoose</a></b> ";
+ $edittext = "<b><a onmousedown=\"return set_value('$selectfile')\" href=\"\">$strchoose</a></b> ";
if ($icon == "text.gif" || $icon == "html.gif") {
$edittext .= "<a href=\"".basename($ME)."?id=$id&wdir=$wdir&file=$fileurl&action=edit\">$stredit</a>";
}
print_cell("right", "$edittext <a href=\"".basename($ME)."?id=$id&wdir=$wdir&file=$filesafe&action=rename\">$strrename</a>");
-
+
echo "</tr>";
}
}
echo "</table>";
- echo "<hr width=\"640\" align=\"center\" noshade=\"noshade\" size=\"1\" />";
+ echo "<hr width=\"640\" align=\"center\" size=\"1\" />";
if (empty($wdir)) {
$wdir = "/";
}
- echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"640\">";
- echo "<tr><td>";
+ echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"640\" align=\"center\">";
+ echo "<tr><td align=\"center\">";
echo "<input type=\"hidden\" name=\"id\" value=\"$id\" />";
echo "<input type=\"hidden\" name=\"wdir\" value=\"$wdir\" /> ";
$options = array (
choose_from_menu ($options, "action", "", "$strwithchosenfiles...", "javascript:document.dirform.submit()");
}
- echo "</form>";
- echo "<td align=\"center\">";
+ echo "</td></tr></table></form>";
+ echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"640\" align=\"center\"><tr>";
if (!empty($USER->fileop) and ($USER->fileop == "move") and ($USER->filesource <> $wdir)) {
+ echo "<td align=\"center\">";
echo "<form action=\"".$ME."\" method=\"get\">";
- echo " <input type=\"hidden\" name=\"id\" value=$id />";
+ echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
echo " <input type=\"hidden\" name=\"action\" value=\"paste\" />";
echo " <input type=\"submit\" value=\"$strmovefilestohere\" />";
echo "</form>";
+ echo "</td>";
}
- echo "<td align=\"right\">";
+ echo "<td align=\"center\">";
echo "<form action=\"".$ME."\" method=\"get\">";
- echo " <input type=\"hidden\" name=\"id\" value=$id />";
+ echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
echo " <input type=\"hidden\" name=\"action\" value=\"mkdir\" />";
echo " <input type=\"submit\" value=\"$strmakeafolder\" />";
echo "</form>";
echo "</td>";
- echo "<td align=\"right\">";
+ echo "<td align=\"center\">";
echo "<form action=\"".$ME."\" method=\"get\">";
- echo " <input type=\"hidden\" name=\"id\" value=$id />";
+ echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
echo " <input type=\"hidden\" name=\"action\" value=\"upload\" />";
echo " <input type=\"submit\" value=\"$struploadafile\" />";
echo "</form>";
echo "</td></tr>";
echo "</table>";
- echo "<hr width=\"640\" align=\"center\" noshade=\"noshade\" size=\"1\" />";
+ echo "<hr width=\"640\" align=\"center\" size=\"1\" />";
}
$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);
+ 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));
}
- $result = scorm_validate($tempdir."/imsmanifest.xml");
} else {
- $result = "packagedir";
+ $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";
}
//
if (is_dir($tempdir))
scorm_delete_files($tempdir);
- } else {
- //
+ } else {
+ //
// Delete package file
//
- unlink ($tempdir."/".basename($form->reference));
- if ($form->mode == "update") {
+ 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 "<table cellpadding=\"5\" align=\"center\">\n";
- echo " <tr><td align=\"right\" nowrap=\"nowrap\"><p><b>$strname:</b></p></td><td><p>$form->name</p></a></td></tr>\n";
- echo " <tr><td align=\"right\" nowrap=\"nowrap\"><p><b>".get_string("validation","scorm").":</b></p></td><td><p>".get_string($result,"scorm")."</p></a></td></tr>\n";
- if ($errorlogs != '') {
- $lines = round(count($errors)/4);
- if ($lines < 5) {
- $lines = 5;
+ $fstat = fstat($fp);
+ fclose($fp);
+ if (get_field("scorm","timemodified","id",$form->instance) < $fstat["mtime"]) {
+ $form->launch = 0;
}
- echo " <tr><td align=\"right\" nowrap=\"nowrap\"><p><b>".get_string("errorlogs","scorm").":</b></p></td><td><textarea rows=\"".$lines."\" cols=\"30\" readonly>".$errorlogs."</textarea></a></td></tr>\n";
}
- if (($form->mode == "update") && ($form->launch == 0) && (get_records("scorm_sco_users","scormid",$form->instance)))
+ }
+ //
+ // Print validation result
+ //
+ print_simple_box_start("center", "", "$THEME->cellheading");
+ echo "<table cellpadding=\"5\" align=\"center\">\n";
+ echo " <tr><td align=\"right\" nowrap=\"nowrap\"><p><b>$strname:</b></p></td><td><p>$form->name</p></td></tr>\n";
+ echo " <tr><td align=\"right\" nowrap=\"nowrap\"><p><b>".get_string("validation","scorm").":</b></p></td><td><p>".get_string($result,"scorm")."</p></td></tr>\n";
+ if ($errorlogs != '') {
+ $lines = round(count($errors)/4);
+ if ($lines < 5) {
+ $lines = 5;
+ }
+ echo " <tr><td align=\"right\" nowrap=\"nowrap\"><p><b>".get_string("errorlogs","scorm").":</b></p></td><td><textarea rows=\"".$lines."\" cols=\"30\" readonly>".$errorlogs."</textarea></a></td></tr>\n";
+ }
+ if (($form->mode == "update") && ($form->launch == 0) && (get_records("scorm_sco_users","scormid",$form->instance))) {
echo " <tr><td align=\"center\" colspan=\"2\" nowrap=\"nowrap\"><p><b>".get_string("trackingloose","scorm")."</b></p></td></tr>\n";
- echo "</table>\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 "</table>\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 "<form name=\"theform\" method=\"post\" action=\"$form->destination\">\n";
//$form->popup = $CFG->scorm_popup;
$strnewwindow = get_string("newwindow", "scorm");
- $strnewwindowopen = get_string("newwindowopen", "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);
+ }
+ $alljsoptions = implode(",", $jsoption);
- if ($form->instance) { // Re-editing
+ 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;
+ $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) {
+ $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];
$window->$optionname = "checked";
}
}
- }
+ }
}
- } else {
- foreach ($SCORM_WINDOW_OPTIONS as $optionname) {
- $defaultvalue = "scorm_popup$optionname";
- $window->$optionname = $CFG->$defaultvalue;
+ } else {
+ foreach ($SCORM_WINDOW_OPTIONS as $optionname) {
+ $defaultvalue = "scorm_popup$optionname";
+ $window->$optionname = $CFG->$defaultvalue;
}
$newwindow = $CFG->scorm_popup;
- }
-
+ }
?>
<table cellpadding="5" align="center">
- <tr valign="top">
+ <tr valign="top">
<td align="right"><p><b><?php print_string("grademethod", "scorm") ?>:</b></p></td>
<td>
- <?php
- $options = array();
- $options[0] = get_string("gradescoes", "scorm");
- $options[1] = get_string("gradehighest", "scorm");
- $options[2] = get_string("gradeaverage", "scorm");
- choose_from_menu($SCORM_GRADE_METHOD, "grademethod", "$form->grademethod", "");
- helpbutton("grademethod", get_string("grademethod","scorm"), "scorm");
- ?>
+ <?php
+ $options = array();
+ $options[0] = get_string("gradescoes", "scorm");
+ $options[1] = get_string("gradehighest", "scorm");
+ $options[2] = get_string("gradeaverage", "scorm");
+ choose_from_menu($SCORM_GRADE_METHOD, "grademethod", "$form->grademethod", "");
+ helpbutton("grademethod", get_string("grademethod","scorm"), "scorm");
+ ?>
</td>
- </tr>
- <tr valign="top">
+ </tr>
+ <tr valign="top">
<td align="right"><p><b><?php print_string("maximumgrade") ?>:</b></p></td>
<td>
- <?php
- for ($i=100; $i>=1; $i--) {
+ <?php
+ for ($i=100; $i>=1; $i--) {
$grades[$i] = $i;
- }
+ }
- choose_from_menu($grades, "maxgrade", "$form->maxgrade", "");
- helpbutton("maxgrade", get_string("maximumgrade"), "scorm");
- ?>
+ choose_from_menu($grades, "maxgrade", "$form->maxgrade", "");
+ helpbutton("maxgrade", get_string("maximumgrade"), "scorm");
+ ?>
</td>
- </tr>
- <tr valign="top">
- <td align="right"><p><b><?php print_string("autocontinue","scorm") ?>:</b></p></td>
- <td>
- <?php
- $options = array();
- $options[0]=get_string("no");
- $options[1]=get_string("yes");
- choose_from_menu ($options, "auto", $form->auto);
- ?>
- </td>
- </tr>
- <tr valign="top">
+ </tr>
+ <tr valign="top">
+ <td align="right"><p><b><?php print_string("autocontinue","scorm") ?>:</b></p></td>
+ <td>
+ <?php
+ $options = array();
+ $options[0]=get_string("no");
+ $options[1]=get_string("yes");
+ choose_from_menu ($options, "auto", $form->auto);
+ ?>
+ </td>
+ </tr>
+ <tr valign="top">
<td align="right" nowrap="nowrap">
<p><b><?php p($strnewwindow) ?></b></p>
</td>
var subitems = [<?php echo $alljsoptions; ?>];
function autowindow() {
- if (document.theform.newwindow.checked)
+ if (document.theform.newwindow.checked) {
document.theform.auto.disabled=true;
- else
+ } else {
document.theform.auto.disabled=false;
+ }
}
<?php
- if ($newwindow == "checked")
+ if ($newwindow == "checked") {
echo "document.theform.auto.disabled=true;\n";
+ $newwindow = "checked='checked'";
+ }
?>
</script>
<input name="setnewwindow" type="hidden" value="1" />
- <input name="newwindow" type="checkbox" value="1" <?php p($newwindow) ?> onclick="autowindow();return lockoptions('theform','newwindow', subitems);" />
- <?php p($strnewwindowopen) ?>
- <ul>
+ <input name="newwindow" type="checkbox" value="1" onclick="autowindow();return lockoptions('theform','newwindow', subitems);" <?php echo $newwindow ?> />
+ <?php echo $strnewwindowopen."\n"; ?>
+ <ul style='list-style-type:none;'><li>
<?php
- foreach ($window as $name => $value) {
- if ($name == "height" or $name == "width") {
- continue;
- }
- echo "\t\t<input name=\"h$name\" type=\"hidden\" value=\"0\" />\n";
- echo "\t\t<input name=\"$name\" type=\"checkbox\" value=\"1\" ".$window->$name." /> ";
- $stringname = "str$name";
- echo $$stringname."<br />\n";
+ foreach ($window as $name => $value) {
+ if ($name == "height" or $name == "width") {
+ continue;
+ }
+ echo "\t\t<input name=\"h$name\" type=\"hidden\" value=\"0\" />\n";
+ if ($window->$name == 'checked') {
+ $window->$name = 'checked="checked"';
+ }
+ echo "\t\t<input name=\"$name\" type=\"checkbox\" value=\"1\" ".$window->$name." /> ";
+ $stringname = "str$name";
+ echo $$stringname."<br />\n";
}
?>
<input name="width" type="text" size="4" value="<?php p($window->width) ?>" /> <?php p($strwidth) ?><br />
<input name="hheight" type="hidden" value="0" />
<input name="height" type="text" size="4" value="<?php p($window->height) ?>" /> <?php p($strheight) ?><br />
- <?php
+ <?php
if (!$newwindow) {
echo "<script>\n<!--\n";
echo "\tlockoptions('theform','newwindow', subitems);";
echo "\n-->\n</script>";
}
?>
- </ul>
- </p>
+ </li></ul>
</td>
- </tr>
- </table>
- <input type="hidden" name="reference" value="<?php p($form->reference) ?>" />
- <input type="hidden" name="datadir" value="<?php p(substr($tempdir,strlen($scormdir))) ?>" />
- <input type="hidden" name="summary" value="<?php p($form->summary) ?>" />
- <input type="hidden" name="name" value="<?php p($form->name) ?>" />
- <input type="hidden" name="launch" value="<?php p($form->launch) ?>" />
- <input type="hidden" name="course" value="<?php p($form->course) ?>" />
- <input type="hidden" name="coursemodule" value="<?php p($form->coursemodule) ?>" />
- <input type="hidden" name="section" value="<?php p($form->section) ?>" />
- <input type="hidden" name="module" value="<?php p($form->module) ?>" />
- <input type="hidden" name="modulename" value="<?php p($form->modulename) ?>" />
- <input type="hidden" name="instance" value="<?php p($form->instance) ?>" />
- <input type="hidden" name="mode" value="<?php p($form->mode) ?>" />
- <div align="center">
- <input type="submit" value="<?php print_string("savechanges") ?>" />
- <input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
- </div>
- </form>
+ </tr>
+ </table>
+ <input type="hidden" name="reference" value="<?php p($form->reference) ?>" />
+ <input type="hidden" name="datadir" value="<?php p(substr($tempdir,strlen($scormdir))) ?>" />
+ <input type="hidden" name="summary" value="<?php p($form->summary) ?>" />
+ <input type="hidden" name="name" value="<?php p($form->name) ?>" />
+ <input type="hidden" name="launch" value="<?php p($form->launch) ?>" />
+ <input type="hidden" name="course" value="<?php p($form->course) ?>" />
+ <input type="hidden" name="coursemodule" value="<?php p($form->coursemodule) ?>" />
+ <input type="hidden" name="section" value="<?php p($form->section) ?>" />
+ <input type="hidden" name="module" value="<?php p($form->module) ?>" />
+ <input type="hidden" name="modulename" value="<?php p($form->modulename) ?>" />
+ <input type="hidden" name="instance" value="<?php p($form->instance) ?>" />
+ <input type="hidden" name="mode" value="<?php p($form->mode) ?>" />
+ <div align="center">
+ <input type="submit" value="<?php print_string("savechanges") ?>" />
+ <input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
+ </div>
+ </form>
<?php
} else {
?>
- <center>
- <input type="button" value="<?php print_string("continue") ?>" onClick="document.location='<?php echo $CFG->wwwroot ?>/course/view.php?id=<?php echo $course->id ?>';" />
- </center>
+ <div align="center">
+ <input type="button" value="<?php print_string("continue") ?>" onclick="document.location='<?php echo $CFG->wwwroot ?>/course/view.php?id=<?php echo $course->id ?>';" />
+ </div>
<?php
- }
- print_simple_box_end();
+ }
+ print_simple_box_end();
print_footer($course);
} else {
- error("This script was called incorrectly");
+ error("This script was called incorrectly");
}
?>
if ($course->format == "weeks") {
$table->head = array ($strweek, $strname, $strsummary);
- $table->align = array ("CENTER", "LEFT", "LEFT");
+ $table->align = array ("center", "left", "left");
} else if ($course->format == "topics") {
$table->head = array ($strtopic, $strname, $strsummary);
- $table->align = array ("CENTER", "LEFT", "LEFT");
+ $table->align = array ("center", "left", "left");
} else {
$table->head = array ($strlastmodified, $strname, $strsummary);
- $table->align = array ("LEFT", "LEFT", "LEFT");
+ $table->align = array ("left", "left", "left");
}
foreach ($scorms as $scorm) {
// Crop a string to $len character and set an anchor title to the full string
$len=11;
if ( strlen($stringa)>$len ) {
- return "<a name=\"\" title=\"$stringa\">".substr($stringa,0,$len-4).'...'.substr($stringa,strlen($stringa)-1,1).'</a>';
+ return "<a name=\"none\" title=\"$stringa\">".substr($stringa,0,$len-4).'...'.substr($stringa,strlen($stringa)-1,1).'</a>';
} else
return $stringa;
}
//
$bodyscripts = "";
if ($scorm->popup != "") {
- $bodyscripts = "onLoad='SCOInitialize();' onUnload='SCOFinish(); closeMain();' onbeforeUnload='SCOFinish();'";
+ $bodyscripts = "onload='SCOInitialize();' onunload='SCOFinish(); closeMain();'";
}
print_header($pagetitle, "$course->fullname",
"$navigation <a target=\"{$CFG->framename}\" href=\"view.php?id=$cm->id\" title=\"$scorm->summary\">$scorm->name</a>",
$currentSCO = $_POST['scoid'];
?>
<br />
- <script language="Javascript">
+ <script language="Javascript" type="text/javascript">
<!--
function playSCO(scoid) {
document.navform.scoid.value=scoid;
function expandCollide(which,list) {
var nn=document.ids?true:false
var w3c=document.getElementById?true:false
- var beg=nn?"document.ids.":w3c?"document.getElementById(":"document.all.";
- var mid=w3c?").style":".style";
+ var beg=nn?"document.ids.":w3c?"document.getElementById('":"document.all.";
+ var mid=w3c?"').style":".style";
if (eval(beg+list+mid+".display") != "none") {
which.src = "pix/plus.gif";
}
-->
</script>
- <style type="text/css">
- .scormlist { list-style-type:none; }
- </style>
<?php
- print_simple_box_start("CENTER");
+ $liststyle = "style=\"list-style-type:none;\"";
+ print_simple_box_start("center");
echo "<table>\n";
echo " <tr><th>".get_string("coursestruct","scorm")."</th></tr>\n";
- echo " <tr><td nowrap=\"nowrap\">\n<ul class=\"scormlist\"'>\n";
+ echo " <tr><td nowrap=\"nowrap\">\n<ul $liststyle>\n";
$incomplete = false;
if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' AND organization='$currentorg' order by id ASC")){
$level=0;
$i--;
}
if (($i == 0) && ($sco->parent != $currentorg)) {
- echo " <li><ul id='".$sublist."' class=\"scormlist\"'>\n";
+ echo " <li><ul id='s".$sublist."' $liststyle>\n";
$level++;
} else {
echo $closelist;
$nextsco = next($scoes);
if (($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) {
$sublist++;
- echo " <img src=\"pix/minus.gif\" onClick='expandCollide(this,".$sublist.");' alt=\"\" />\n";
+ echo " <img src=\"pix/minus.gif\" onclick='expandCollide(this,\"s".$sublist."\");' alt=\"-\" title=\"".get_string('collide','scorm')."\" />\n";
} else {
- echo " <img src=\"pix/spacer.gif\" alt=\"\" />\n";
+ echo " <img src=\"pix/spacer.gif\" alt=\" \" />\n";
}
if ($sco->launch) {
$startbold = '';
$endbold = '';
if ($sco->id == $currentSCO) {
- $startbold = '-> <b>';
- $endbold = '</b> <-';
+ $startbold = '-> <b>';
+ $endbold = '</b> <-';
}
if (($currentSCO == "") && ($mode != "normal")) {
$currentSCO = $sco->id;
- $startbold = '-> <b>';
- $endbold = '</b> <-';
+ $startbold = '-> <b>';
+ $endbold = '</b> >-';
}
$score = "";
if ($sco_user=get_record("scorm_sco_users","scoid",$sco->id,"userid",$USER->id)) {
}
} else {
if ($sco->type == 'sco') {
- echo " <img src=\"pix/notattempted.gif\" alt=\"".get_string("notattempted","scorm")."\" />";
+ echo " <img src=\"pix/notattempted.gif\" alt=\"".get_string("notattempted","scorm")."\" title=\"".get_string("notattempted","scorm")."\" />";
$incomplete = true;
} else {
- echo " <img src=\"pix/asset.gif\" alt=\"".get_string("asset","scorm")."\" />";
+ echo " <img src=\"pix/asset.gif\" alt=\"".get_string("asset","scorm")."\" title=\"".get_string("asset","scorm")."\" />";
}
}
echo " $startbold<a href=\"javascript:playSCO(".$sco->id.");\">$sco->title</a> $score$endbold\n </li>\n";
echo "<table width=\"100%\">\n <tr>\n";
echo " <td align=\"center\" nowrap=\"nowrap\">
<iframe name=\"cmi\" width=\"1\" height=\"1\" src=\"cmi.php?id=$cm->id\" style=\"visibility: hidden\"></iframe>
- <form name=\"navform\" method=\"POST\" action=\"playscorm.php?id=$cm->id\" target=\"_top\">
+ <form name=\"navform\" method=\"post\" action=\"playscorm.php?id=$cm->id\" target=\"_top\">
<input name=\"scoid\" type=\"hidden\" />
<input name=\"currentorg\" type=\"hidden\" value=\"$currentorg\" />
<input name=\"mode\" type=\"hidden\" value=\"".$mode."\" />
- <input name=\"prev\" type=\"button\" value=\"".get_string("prev","scorm")."\" onClick=\"top.changeSco('previous');\" /> \n";
+ <input name=\"prev\" type=\"button\" value=\"".get_string("prev","scorm")."\" onclick=\"top.changeSco('previous');\" /> \n";
if ($scorm->popup == "") {
$currentorg = '';
}
choose_from_menu($options, "courseStructure", "", "", "document.navform.scoid.value=document.navform.courseStructure.options[document.navform.courseStructure.selectedIndex].value;document.navform.submit();");
}
- echo " <input name=\"next\" type=\"button\" value=\"".get_string("next","scorm")."\" onClick=\"top.changeSco('continue')\" />\n";
+ echo " <input name=\"next\" type=\"button\" value=\"".get_string("next","scorm")."\" onclick=\"top.changeSco('continue')\" />\n";
echo " </form>
</td>\n";
function SCOFinish(){
if (typeof API != "undefined") {
- SaveTotalTime();
+ API.SaveTotalTime();
}
}
//
if (!$cm->visible and !isteacher($course->id)) {
print_header($pagetitle, "$course->fullname", "$navigation $scorm->name", "", "", true,
- update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm));
+ update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm));
notice(get_string("activityiscurrentlyhidden"));
} else {
print_header($pagetitle, "$course->fullname","$navigation <a target=\"{$CFG->framename}\" href=\"$ME?id=$cm->id\" title=\"$scorm->summary\">$scorm->name</a>",
print_heading($scorm->name);
- print_simple_box(text_to_html($scorm->summary), "CENTER");
+ print_simple_box(text_to_html($scorm->summary), "center");
if (isguest()) {
print_heading(get_string("guestsno", "scorm"));
exit;
}
echo "<br />";
- echo "<style type=\"text/css\">.scormlist { list-style-type:none; }</style>\n";
- print_simple_box_start("CENTER");
+ $liststyle = "style=\"list-style-type:none;\"";
+ print_simple_box_start("center");
echo "<table>\n";
echo " <tr><th>".get_string("coursestruct","scorm")."</th></tr>\n";
$organization = $scorm->launch;
if (isset($_POST['organization'])) {
$organization = $_POST['organization'];
}
- echo "<tr><td align='center'><form name='changeorg' method='POST' action='view.php?id=$cm->id'>".get_string('organizations','scorm').": \n";
+ echo "<tr><td align='center'><form name='changeorg' method='post' action='view.php?id=$cm->id'>".get_string('organizations','scorm').": \n";
choose_from_menu($orgs, 'organization', "$organization", '','submit()');
echo "</form></td></tr>\n";
}
$orgidentifier = $org->organization;
}
}
- echo " <tr><td nowrap=\"nowrap\">\n<ul class=\"scormlist\"'>\n";
+ echo " <tr><td nowrap=\"nowrap\">\n<ul $liststyle>\n";
$incomplete = false;
if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' AND organization='$orgidentifier' order by id ASC")){
$level=0;
$i--;
}
if (($i == 0) && ($sco->parent != $orgidentifier)) {
- echo " <li><ul id='".$sublist."' class=\"scormlist\"'>\n";
+ echo " <li><ul id='s".$sublist."' $liststyle>\n";
$level++;
} else {
echo $closelist;
$nextsco = next($scoes);
if (($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) {
$sublist++;
- echo " <img src=\"pix/minus.gif\" onClick='expandCollide(this,".$sublist.");' alt=\"\" />\n";
+ echo " <img src=\"pix/minus.gif\" onclick='expandCollide(this,\"s".$sublist."\");' alt=\"-\" title=\"".get_string('collide','scorm')."\" />\n";
} else {
- echo " <img src=\"pix/spacer.gif\" alt=\"\" />\n";
+ echo " <img src=\"pix/spacer.gif\" alt=\" \" />\n";
}
if ($sco->launch) {
$score = "";
}
} else {
if ($sco->type == 'sco') {
- echo " <img src=\"pix/notattempted.gif\" alt=\"".get_string("notattempted","scorm")."\" />";
+ echo " <img src=\"pix/notattempted.gif\" alt=\"".get_string("notattempted","scorm")."\" title=\"".get_string("notattempted","scorm")."\" />";
$incomplete = true;
} else {
- echo " <img src=\"pix/asset.gif\" alt=\"".get_string("asset","scorm")."\" />";
+ echo " <img src=\"pix/asset.gif\" alt=\"".get_string("asset","scorm")."\" title=\"".get_string("asset","scorm")."\" />";
}
}
echo " <a href=\"javascript:playSCO(".$sco->id.")\">$sco->title</a> $score\n </li>\n";
echo "</ul></td></tr>\n";
echo "</table>\n";
print_simple_box_end();
- echo "<form name=\"theform\" method=\"POST\" action=\"playscorm.php?id=$cm->id\">\n";
- echo "<table align=\"CENTER\">\n<tr>\n<td align=\"center\">";
+ echo "<form name=\"theform\" method=\"post\" action=\"playscorm.php?id=$cm->id\">\n";
+ echo "<table align=\"center\">\n<tr>\n<td align=\"center\">";
print_string("mode","scorm");
echo ": <input type=\"radio\" id=\"b\" name=\"mode\" value=\"browse\" /><label for=\"b\">".get_string("browse","scorm")."</label>\n";
if ($incomplete === true) {
<input type="submit" value="'.get_string("entercourse","scorm").'" />';
echo "\n</td>\n</tr>\n</table>\n</form><br />";
?>
-<script language="javascript">
+<script language="javascript" type="text/javascript">
<!--
function playSCO(scoid,status) {
document.theform.scoid.value = scoid;
function expandCollide(which,list) {
var nn=document.ids?true:false
var w3c=document.getElementById?true:false
- var beg=nn?"document.ids.":w3c?"document.getElementById(":"document.all.";
- var mid=w3c?").style":".style";
-
+ var beg=nn?"document.ids.":w3c?"document.getElementById('":"document.all.";
+ var mid=w3c?"').style":".style";
+
if (eval(beg+list+mid+".display") != "none") {
which.src = "pix/plus.gif";
+ which.alt = "+";
+ which.title = "<?php echo get_string('expand','scorm') ?>";
eval(beg+list+mid+".display='none';");
} else {
which.src = "pix/minus.gif";
+ which.alt = "-";
+ which.title = "<?php echo get_string('collide','scorm') ?>";
eval(beg+list+mid+".display='block';");
}