$CFG->dbtype = "mysql"; // eg mysql, postgres, oracle, access etc
$CFG->dbhost = "localhost"; // eg localhost
$CFG->dbname = "moodle"; // eg moodle
-$CFG->dbuser = "muser";
-$CFG->dbpass = "mpassword";
+$CFG->dbuser = "moodle";
+$CFG->dbpass = "moodle";
// Next you need to tell Moodle where it is, and where it can save files.
-$CFG->wwwroot = "http://example.com/moodle";
-$CFG->dirroot = "/home/httpd/moodle";
-$CFG->dataroot = "/home/moodledata"; // Web-server writeable
+$CFG->wwwroot = "http://server.dougiamas.net/moodle";
+$CFG->dirroot = "/web/server/moodle";
+$CFG->dataroot = "/web/moodledata"; // Web-server writeable
// Choose a theme from the "themes" folder. Default theme is "standard".
// Give the full name (eg mail.example.com) of an SMTP server that the
// web server machine has access to (to send mail). Default: "localhost".
-$CFG->smtphost = "mail.example.com";
+$CFG->smtphost = "dougiamas.com";
// You should not need to change anything below this line
error("That's an invalid course id");
}
- if (! $course->category) { // This course is not a real course.
- redirect("$CFG->wwwroot");
- }
-
add_to_log("View course: $course->shortname", $id);
if ( $USER->teacher[$course->id] ) {
$USER->help = false;
}
+ if (! $course->category) { // This course is not a real course.
+ redirect("$CFG->wwwroot");
+ }
+
print_header("Course: $course->fullname", "$course->fullname", "$course->shortname", "");
if (! $modtypes = get_records_sql_menu("SELECT name,fullname FROM modules ORDER BY fullname") ) {
$args = get_slash_arguments();
$numargs = count($args);
-
$courseid = (integer)$args[0];
- if ($courseid > 0) {
+ $course = get_record("course", "id", $courseid);
+
+ if ($course->category) {
require_login($courseid);
}
+ // it's OK to get here if no course was specified
+
$pathname = "$CFG->dataroot$PATH_INFO";
$filename = $args[$numargs-1];
header("Content-type: $mimetype");
readfile("$pathname");
} else {
- error("Sorry, but the file you are looking for was not found", "/course/view.php?id=$courseid");
+ error("Sorry, but the file you are looking for was not found", "course/view.php?id=$courseid");
}
exit;
return true;
}
+function print_editing_switch($courseid) {
+ global $CFG, $USER;
+
+ if (isadmin() || isteacher($courseid)) {
+ if ($USER->editing) {
+ echo "<A HREF=\"$CFG->wwwroot/course/view.php?id=$courseid&edit=off\">Turn editing off</A>";
+ } else {
+ echo "<A HREF=\"$CFG->wwwroot/course/view.php?id=$courseid&edit=on\">Turn editing on</A>";
+ }
+ }
+}
+
function moodledate($date) {
return date("l, j F Y, g:i A T", $date);
<!-- START OF FOOTER -->
<CENTER>
<HR SIZE=1 NOSHADE>
-<FONT SIZE=1><P>
+<FONT SIZE=1>
+<P>
<? if ($USER->id) {
- echo "You are logged in as $USER->firstname $USER->lastname. ";
- if ($USER->survey) {
- echo " (Student)<BR>To log out you need to quit the browser.";
- } else {
- echo " (<A HREF=$CFG->wwwroot/login/logout.php>Logout</A>)";
- }
- } else {
- echo "You are not logged in. <A HREF=$CFG->wwwroot/login/>Log in here</A>.";
- }
+ echo "You are logged in as $USER->firstname $USER->lastname.";
+ echo "(<A HREF=\"$CFG->wwwroot/login/logout.php\">Logout</A>)";
+ } else {
+ echo "You are not logged in. <A HREF=\"$CFG->wwwroot/login/\">Log in here</A>.";
+ }
?>
</P>
<P><?=$homelink ?></P>
-</BODY>
+</FONT>