echo "<script>\n";
echo "<!--\n";
echo "document.write('<form>');\n";
- echo "document.write('<input type=button onClick=\"self.close();\" value=\"".get_string("closewindow")."\">');\n";
+ echo "document.write('<input type=\"button\" onClick=\"self.close();\" value=\"".get_string("closewindow")."\" />');\n";
echo "document.write('</form>');\n";
echo "-->\n";
echo "</script>\n";
$javascript = "";
}
- $output = "<select name=$name $javascript>\n";
+ $output = "<select name=\"$name\" $javascript>\n";
if ($nothing) {
$output .= " <option value=\"$nothingvalue\"\n";
if ($nothingvalue == $selected) {
- $output .= " selected";
+ $output .= " selected=\"true\"";
}
$output .= ">$nothing</option>\n";
}
foreach ($options as $value => $label) {
$output .= " <option value=\"$value\"";
if ($value == $selected) {
- $output .= " selected";
+ $output .= " selected=\"true\"";
}
if ($label === "") {
$output .= ">$value</option>\n";
$nothing = get_string("choose")."...";
}
- $startoutput = "<form target=\"{$CFG->framename}\" name=$formname>";
- $output = "<select name=popup onchange=\"$targetwindow.location=document.$formname.popup.options[document.$formname.popup.selectedIndex].value\">\n";
+ $startoutput = "<form target=\"{$CFG->framename}\" name=\"$formname\">";
+ $output = "<select name=\"popup\" onchange=\"$targetwindow.location=document.$formname.popup.options[document.$formname.popup.selectedIndex].value\">\n";
if ($nothing != "") {
$output .= " <option value=\"javascript:void(0)\">$nothing</option>\n";
} else {
$output .= " <option value=\"$common$value\"";
if ($value == $selected) {
- $output .= " selected";
+ $output .= " selected=\"true\"";
}
}
if ($label) {
function formerr($error) {
/// Prints some red text
if (!empty($error)) {
- echo "<font color=#ff0000>$error</font>";
+ echo "<font color=\"#ff0000\">$error</font>";
}
}
function validate_email ($address) {
-/// Validates an email to make it makes sense.
+/// Validates an email to make sure it makes sense.
return (ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.
'@'.
'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.
if ($runonce == false){
foreach ($emoticons as $emoticon => $image){
$e[] = $emoticon;
- $img[] = "<img alt=\"$emoticon\" width=15 height=15 src=\"$CFG->pixpath/s/$image\">";
+ $img[] = "<img alt=\"$emoticon\" width=\"15\" height=\"15\" src=\"$CFG->pixpath/s/$image\" />";
}
$runonce = true;
}
/// STANDARD WEB PAGE PARTS ///////////////////////////////////////////////////
-function print_header ($title="", $heading="", $navigation="", $focus="", $meta="", $cache=true, $button=" ", $menu="") {
+function print_header ($title="", $heading="", $navigation="", $focus="", $meta="",
+ $cache=true, $button=" ", $menu="", $usexml=false) {
// $title - appears top of window
// $heading - appears top of page
// $navigation - premade navigation string
// $meta - meta tags in the header
// $cache - should this page be cacheable?
// $button - HTML code for a button (usually for module editing)
-// $menu - HTML code for a popup menu
+// $menu - HTML code for a popup menu
+// $usexml - use XML for this page
global $USER, $CFG, $THEME, $SESSION;
if (file_exists("$CFG->dirroot/theme/$CFG->theme/styles.php")) {
if (!$menu and $navigation) {
if (isset($USER->id)) {
- $menu = "<font size=2><a target=\"$CFG->framename\" href=\"$CFG->wwwroot/login/logout.php\">".get_string("logout")."</a></font>";
+ $menu = "<font size=\"2\"><a target=\"$CFG->framename\" href=\"$CFG->wwwroot/login/logout.php\">".get_string("logout")."</a></font>";
} else {
- $menu = "<font size=2><a target=\"$CFG->framename\" href=\"$CFG->wwwroot/login/index.php\">".get_string("login")."</a></font>";
+ $menu = "<font size=\"2\"><a target=\"$CFG->framename\" href=\"$CFG->wwwroot/login/index.php\">".get_string("login")."</a></font>";
}
}
// Specify character set ... default is iso-8859-1 but some languages might need something else
// Could be optimised by carrying the charset variable around in $USER
if (current_language() == "en") {
- $meta = "<meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\">\n$meta\n";
+ $meta = "<meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\" />\n$meta\n";
} else {
- $meta = "<meta http-equiv=\"content-type\" content=\"text/html; charset=".get_string("thischarset")."\">\n$meta\n";
+ $meta = "<meta http-equiv=\"content-type\" content=\"text/html; charset=".get_string("thischarset")."\" />\n$meta\n";
}
if (!empty($CFG->langdir) and $CFG->langdir == "RTL") {
if (!$cache) { // Do everything we can to prevent clients and proxies caching
@header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
@header("Pragma: no-cache");
- $meta .= "\n<meta http-equiv=\"pragma\" content=\"no-cache\">";
- $meta .= "\n<meta http-equiv=\"expires\" content=\"0\">";
+ $meta .= "\n<meta http-equiv=\"pragma\" content=\"no-cache\" />";
+ $meta .= "\n<meta http-equiv=\"expires\" content=\"0\" />";
+ }
+
+ if ($usexml) { // Added by Gustav Delius / Mad Alex for MathML output
+ $currentlanguage = current_language();
+
+ @header("Content-type: text/xml");
+ echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>\n";
+ if (!empty($CFG->xml_stylesheets)) {
+ $stylesheets = explode(";", $CFG->xml_stylesheets);
+ foreach ($stylesheets as $stylesheet) {
+ echo "<?xml-stylesheet type=\"text/xsl\" href=\"$CFG->wwwroot/$stylesheet\" ?>\n";
+ }
+ }
+ echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1";
+ if ($CFG->xml_doctype_extra)
+ echo " plus $CFG->xml_doctype_extra";
+ echo "//" . strtoupper($currentlanguage) . "\" \"$CFG->xml_dtd\">\n";
+ $direction = " xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"$currentlanguage\" $direction";
}
include ("$CFG->dirroot/theme/$CFG->theme/header.html");
if ($course) {
if ($course == "home") { // special case for site home page - please do not remove
$homelink = "<p align=\"center\"><a title=\"moodle $CFG->release ($CFG->version)\" href=\"http://moodle.org/\" target=\"_blank\">";
- $homelink .= "<br><img width=\"130\" height=\"19\" src=\"pix/madewithmoodle.gif\" border=0></a></p>";
+ $homelink .= "<br /><img width=\"130\" height=\"19\" src=\"pix/madewithmoodle.gif\" border=\"0\" /></a></p>";
$course = get_site();
$homepage = true;
} else {
if (isset($user->realuser)) {
if ($realuser = get_record("user", "id", $user->realuser)) {
- $realuserinfo = " [<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/course/loginas.php?id=$course->id&return=$realuser->id\">$realuser->firstname $realuser->lastname</A>] ";
+ $realuserinfo = " [<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/course/loginas.php?id=$course->id&return=$realuser->id\">$realuser->firstname $realuser->lastname</a>] ";
}
} else {
$realuserinfo = "";
}
if (isset($user->id) and $user->id) {
- $username = "<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/user/view.php?id=$user->id&course=$course->id\">$user->firstname $user->lastname</a>";
+ $username = "<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/user/view.php?id=$user->id&course=$course->id\">$user->firstname $user->lastname</a>";
$loggedinas = $realuserinfo.get_string("loggedinas", "moodle", "$username").
" (<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/login/logout.php\">".get_string("logout")."</a>)";
} else {
echo "<form action=\"$link\" method=\"$method\">";
if ($options) {
foreach ($options as $name => $value) {
- echo "<input type=hidden name=\"$name\" value=\"$value\">";
+ echo "<input type=\"hidden\" name=\"$name\" value=\"$value\" />";
}
}
- echo "<input type=submit value=\"$label\"></form>";
+ echo "<input type=\"submit\" value=\"$label\" /></form>";
}
function print_spacer($height=1, $width=1, $br=true) {
global $CFG;
- echo "<img height=\"$height\" width=\"$width\" src=\"$CFG->wwwroot/pix/spacer.gif\" alt=\"\">";
+ echo "<img height=\"$height\" width=\"$width\" src=\"$CFG->wwwroot/pix/spacer.gif\" alt=\"\" />";
if ($br) {
echo "<br />\n";
}
echo "<a href=\"$link\">";
}
if (substr(strtolower($path), 0, 7) == "http://") {
- echo "<img border=0 $height $width src=\"$path\">";
+ echo "<img border=\"0\" $height $width src=\"$path\" />";
} else if ($courseid) {
- echo "<img border=0 $height $width src=\"";
+ echo "<img border=\"0\" $height $width src=\"";
if ($CFG->slasharguments) { // Use this method if possible for better caching
echo "$CFG->wwwroot/file.php/$courseid/$path";
} else {
echo "$CFG->wwwroot/file.php?file=/$courseid/$path";
}
- echo "\">";
+ echo "\" />";
} else {
echo "Error: must pass URL or course";
}
global $CFG, $THEME;
if ($link) {
- $output = "<a href=\"$CFG->wwwroot/user/view.php?id=$userid&course=$courseid\">";
+ $output = "<a href=\"$CFG->wwwroot/user/view.php?id=$userid&course=$courseid\">";
} else {
$output = "";
}
if ($picture) { // Print custom user picture
if ($CFG->slasharguments) { // Use this method if possible for better caching
$output .= "<img align=\"absmiddle\" src=\"$CFG->wwwroot/user/pix.php/$userid/$file.jpg\"".
- " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\">";
+ " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\" />";
} else {
$output .= "<img align=\"absmiddle\" src=\"$CFG->wwwroot/user/pix.php?file=/$userid/$file.jpg\"".
- " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\">";
+ " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\" />";
}
} else { // Print default user pictures (use theme version if available)
$output .= "<img align=\"absmiddle\" src=\"$CFG->pixpath/u/$file.png\"".
- " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\">";
+ " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\" />";
}
if ($link) {
$output .= "</a>";
if (isset($table->wrap)) {
foreach ($table->wrap as $key => $ww) {
if ($ww) {
- $wrap[$key] = " nowrap ";
+ $wrap[$key] = " nowrap=\"nowrap\" ";
} else {
$wrap[$key] = "";
}
}
print_simple_box_start("center", "$table->width", "#ffffff", 0);
- echo "<table width=100% border=0 valign=top align=center ";
+ echo "<table width=\"100%\" border=\"0\" valign=\"top\" align=\"center\" ";
echo " cellpadding=\"$table->cellpadding\" cellspacing=\"$table->cellspacing\" class=\"generaltable\">\n";
if (!empty($table->head)) {
if (!isset($align[$key])) {
$align[$key] = "";
}
- echo "<th valign=top ".$align[$key].$size[$key]." nowrap class=\"generaltableheader\">$heading</th>";
+ echo "<th valign=\"top\" ".$align[$key].$size[$key]." nowrap=\"nowrap\" class=\"generaltableheader\">$heading</th>";
}
- echo "</TR>\n";
+ echo "</tr>\n";
}
foreach ($table->data as $row) {
- echo "<tr valign=top>";
+ echo "<tr valign=\"top\">";
foreach ($row as $key => $item) {
if (!isset($size[$key])) {
$size[$key] = "";
if (isset($table->wrap)) {
foreach ($table->wrap as $key => $ww) {
if ($ww) {
- $wrap[$key] = " nowrap ";
+ $wrap[$key] = " nowrap=\"nowrap\" ";
} else {
$wrap[$key] = "";
}
$fontsize = "<font size=\"$table->fontsize\">";
}
- $output = "<table width=\"$table->width\" valign=top align=\"$table->tablealign\" ";
+ $output = "<table width=\"$table->width\" valign=\"top\" align=\"$table->tablealign\" ";
$output .= " cellpadding=\"$table->cellpadding\" cellspacing=\"$table->cellspacing\" class=\"$table->class\">\n";
if (!empty($table->head)) {
if (!isset($align[$key])) {
$align[$key] = "";
}
- $output .= "<th valign=top ".$align[$key].$size[$key]." nowrap class=\"{$table->class}header\">$fontsize$heading</th>";
+ $output .= "<th valign=\"top\" ".$align[$key].$size[$key]." nowrap=\"nowrap\" class=\"{$table->class}header\">$fontsize$heading</th>";
}
$output .= "</tr>\n";
}
foreach ($table->data as $row) {
- $output .= "<tr valign=top>";
+ $output .= "<tr valign=\"top\">";
foreach ($row as $key => $item) {
if (!isset($size[$key])) {
$size[$key] = "";
global $CFG, $THEME;
if ($richedit) {
- echo "<object id=richedit style=\"background-color: buttonface\"";
+ echo "<object id=\"richedit\" style=\"background-color: buttonface\"";
echo " data=\"$CFG->wwwroot/lib/rte/richedit.html\"";
echo " width=\"$width\" height=\"$height\" ";
- echo " type=\"text/x-scriptlet\" VIEWASTEXT></object>\n";
- echo "<textarea style=\"display:none\" name=\"$name\" rows=1 cols=1>";
+ echo " type=\"text/x-scriptlet\" VIEWASTEXT=\"true\"></object>\n";
+ echo "<textarea style=\"display:none\" name=\"$name\" rows=\"1\" cols=\"1\">";
p($value);
echo "</textarea>\n";
} else {
- echo "<textarea name=\"$name\" rows=\"$rows\" cols=\"$cols\" wrap=virtual>";
+ echo "<textarea name=\"$name\" rows=\"$rows\" cols=\"$cols\" wrap=\"virtual\">";
p($value);
echo "</textarea>\n";
}
$string = get_string("turneditingon");
$edit = "on";
}
- return "<form target=_parent method=get action=\"$CFG->wwwroot/course/view.php\">".
- "<input type=hidden name=id value=\"$courseid\">".
- "<input type=hidden name=edit value=\"$edit\">".
- "<input type=submit value=\"$string\"></form>";
+ return "<form target=\"_parent\" method=\"get\" action=\"$CFG->wwwroot/course/view.php\">".
+ "<input type=\"hidden\" name=\"id\" value=\"$courseid\" />".
+ "<input type=\"hidden\" name=\"edit\" value=\"$edit\" />".
+ "<input type=\"submit\" value=\"$string\" /></form>";
}
}
if (isteacheredit($courseid)) {
$string = get_string("updatethis", "", $string);
- return "<form target=_parent method=get action=\"$CFG->wwwroot/course/mod.php\">".
- "<input type=hidden name=update value=\"$moduleid\">".
- "<input type=hidden name=return value=\"true\">".
- "<input type=submit value=\"$string\"></form>";
+ return "<form target=\"_parent\" method=\"get\" action=\"$CFG->wwwroot/course/mod.php\">".
+ "<input type=\"hidden\" name=\"update\" value=\"$moduleid\" />".
+ "<input type=\"hidden\" name=\"return\" value=\"true\" />".
+ "<input type=\"submit\" value=\"$string\" /></form>";
} else {
return "";
}
$string = get_string("turneditingon");
$edit = "on";
}
- return "<form method=get action=\"$CFG->wwwroot/course/category.php\">".
- "<input type=hidden name=id value=\"$categoryid\">".
- "<input type=hidden name=edit value=\"$edit\">".
- "<input type=submit value=\"$string\"></form>";
+ return "<form method=\"get\" action=\"$CFG->wwwroot/course/category.php\">".
+ "<input type=\"hidden\" name=\"id\" value=\"$categoryid\" />".
+ "<input type=\"hidden\" name=\"edit\" value=\"$edit\" />".
+ "<input type=\"submit\" value=\"$string\" /></form>";
}
}
$string = get_string("turneditingon");
$edit = "on";
}
- return "<form target=_parent method=get action=\"$CFG->wwwroot/course/index.php\">".
- "<input type=hidden name=edit value=\"$edit\">".
- "<input type=submit value=\"$string\"></form>";
+ return "<form target=\"_parent\" method=\"get\" action=\"$CFG->wwwroot/course/index.php\">".
+ "<input type=\"hidden\" name=\"edit\" value=\"$edit\" />".
+ "<input type=\"submit\" value=\"$string\" /></form>";
}
}
choose_from_menu($grades, "$name", "$current", "");
$helpicon = "$CFG->pixpath/help.gif";
- $linkobject = "<img align=\"absmiddle\" border=0 height=17 width=22 alt=\"$strscales\" src=\"$helpicon\">";
- link_to_popup_window ("/course/scales.php?id=$courseid&list=true", "ratingscales",
+ $linkobject = "<img align=\"absmiddle\" border=\"0\" height=\"17\" width=\"22\" alt=\"$strscales\" src=\"$helpicon\" />";
+ link_to_popup_window ("/course/scales.php?id=$courseid&list=true", "ratingscales",
$linkobject, 400, 500, $strscales);
}
$strscales = get_string("scales");
choose_from_menu(get_scales_menu($courseid), "$name", $current, "");
$helpicon = "$CFG->pixpath/help.gif";
- $linkobject = "<img align=\"absmiddle\" border=0 height=17 width=22 alt=\"$strscales\" src=\"$helpicon\">";
- link_to_popup_window ("/course/scales.php?id=$courseid&list=true", "ratingscales",
+ $linkobject = "<img align=\"absmiddle\" border=\"0\" height=\"17\" width=\"22\" alt=\"$strscales\" src=\"$helpicon\" />";
+ link_to_popup_window ("/course/scales.php?id=$courseid&list=true", "ratingscales",
$linkobject, 400, 500, $strscales);
}
$strscales = get_string("scales");
$helpicon = "$CFG->pixpath/help.gif";
- $linkobject = "<img align=\"absmiddle\" border=0 height=17 width=22 alt=\"$scale->name\" src=\"$helpicon\">";
- link_to_popup_window ("/course/scales.php?id=$courseid&list=true&scale=$scale->id", "ratingscale",
+ $linkobject = "<img align=\"absmiddle\" border=\"0\" height=\"17\" width=\"22\" alt=\"$scale->name\" src=\"$helpicon\" />";
+ link_to_popup_window ("/course/scales.php?id=$courseid&list=true&scale=$scale->id", "ratingscale",
$linkobject, 400, 500, $scale->name);
}
global $CFG, $SESSION;
print_header(get_string("error"));
- echo "<BR>";
+ echo "<br />";
print_simple_box($message, "center", "", "#FFBBBB");
if (!$link) {
if ($image) {
$icon = "$CFG->pixpath/help.gif";
if ($linktext) {
- $linkobject = "$title<img align=\"absmiddle\" border=0 height=17 width=22 alt=\"\" src=\"$icon\">";
+ $linkobject = "$title<img align=\"absmiddle\" border=\"0\" height=\"17\" width=\"22\" alt=\"\" src=\"$icon\" />";
} else {
- $linkobject = "<img align=\"absmiddle\" border=0 height=17 width=22 alt=\"$title\" src=\"$icon\">";
+ $linkobject = "<img align=\"absmiddle\" border=\"0\" height=\"17\" width=\"22\" alt=\"$title\" src=\"$icon\" />";
}
} else {
$linkobject = $title;
}
if ($text) {
- $url = "/help.php?module=$module&text=".htmlentities(urlencode($text));
+ $url = "/help.php?module=$module&text=".htmlentities(urlencode($text));
} else {
- $url = "/help.php?module=$module&file=$page.html";
+ $url = "/help.php?module=$module&file=$page.html";
}
link_to_popup_window ($url, "popup", $linkobject, 400, 500, $title);
}
$SESSION->inserttextfield = $field;
helpbutton("emoticons", get_string("helpemoticons"), "moodle", false, true);
echo " ";
- link_to_popup_window ("/help.php?module=moodle&file=emoticons.html", "popup",
- "<img src=\"$CFG->pixpath/s/smiley.gif\" border=0 align=\"absmiddle\" width=15 height=15>",
+ link_to_popup_window ("/help.php?module=moodle&file=emoticons.html", "popup",
+ "<img src=\"$CFG->pixpath/s/smiley.gif\" border=\"0\" align=\"absmiddle\" width=\"15\" height=\"15\" />",
400, 500, get_string("helpemoticons"));
echo "<br />";
}
global $THEME;
print_simple_box_start("center", "60%", "$THEME->cellheading");
- echo "<p align=center><font size=3>$message</font></p>";
- echo "<p align=center><font size=3><b>";
+ echo "<p align=\"center\"><font size=\"3\">$message</font></p>";
+ echo "<p align=\"center\"><font size=\"3\"><b>";
echo "<a href=\"$linkyes\">".get_string("yes")."</a>";
echo " ";
echo "<a href=\"$linkno\">".get_string("no")."</a>";
// Uses META tags to redirect the user, after printing a notice
if (empty($message)) {
- echo "<meta http-equiv='refresh' content='$delay; url=$url'>";
+ echo "<meta http-equiv=\"refresh\" content=\"$delay; url=$url\" />";
} else {
if (empty($delay)) {
$delay = 3; // There's no point having a message with no delay
}
- echo "<meta http-equiv='refresh' content='$delay; url=$url'>";
+ echo "<meta http-equiv=\"refresh\" content=\"$delay; url=$url\" />";
print_header();
echo "<center>";
echo "<p>$message</p>";