require("../config.php");
require("lib.php");
- print_header("Courses", "Courses", "Courses", "");
+ $title = get_string("courses");
+
+ print_header($title, $title, $title, "");
optional_variable($cat, 1);
$timemidnight = $today = usergetmidnight($timenow);
// Put today up the top of the list
- $dates = array("$timemidnight" => "Today, ".userdate($timenow, "j F Y") );
+ $dates = array("$timemidnight" => "Today, ".userdate($timenow, "%e %B %Y") );
if (! $course->startdate) {
$course->startdate = $course->timecreated;
while ($timemidnight > $course->startdate and $numdates < 365) {
$timemidnight = $timemidnight - 86400;
$timenow = $timenow - 86400;
- $dates["$timemidnight"] = userdate($timenow, "l, j F Y");
+ $dates["$timemidnight"] = userdate($timenow, "%A, %e %B %Y");
$numdates++;
}
if (! $course->category) {
echo "<TD><FONT SIZE=2><A HREF=\"view.php?id=$log->course\">".$courses[$log->course]."</A></TD>";
}
- echo "<TD ALIGN=right><FONT SIZE=2>".userdate($log->time, "l")."</TD>";
- echo "<TD><FONT SIZE=2>".userdate($log->time, "j M Y, h:i A")."</TD>";
+ echo "<TD ALIGN=right><FONT SIZE=2>".userdate($log->time, "%A")."</TD>";
+ echo "<TD><FONT SIZE=2>".userdate($log->time, "%e %B %Y, %I:%M %p")."</TD>";
echo "<TD><FONT SIZE=2><A TITLE=\"$log->ip\" HREF=\"../user/view.php?id=$log->user&course=$log->course\"><B>$log->firstname $log->lastname</B></TD>";
echo "<TD><FONT SIZE=2>";
link_to_popup_window( make_log_url($log->module,$log->url), "fromloglive","$log->module $log->action", 400, 600);
echo "<TABLE WIDTH=100%>";
echo "<TR VALIGN=top>";
echo "<TD VALIGN=top WIDTH=50%>";
- echo "<P><FONT SIZE=3><B><A TITLE=\"Click to enter this course\"
+ echo "<P><FONT SIZE=3><B><A TITLE=\"".get_string("entercourse")."\"
HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</A></B></FONT></P>";
if ($teachers = get_records_sql("SELECT u.* FROM user u, user_teachers t
WHERE u.id = t.user AND t.course = '$course->id'
$userinfo = "$u->firstname $u->lastname";
}
if ($date) {
- $dateinfo = userdate($date, "l, j F Y");
+ $dateinfo = userdate($date, "%A, %e %B %Y");
}
print_header("$course->shortname: Logs", "$course->fullname",
$filename = $fullpath."/".$dir;
$fileurl = rawurlencode($wdir."/".$dir);
$filesafe = rawurlencode($dir);
- $filedate = userdate(filectime($filename), "d-m-Y H:i:s");
+ $filedate = userdate(filectime($filename), "%e %b %Y, %I:%M %p");
echo "<TR>";
$fileurl = "$wdir/$file";
$filesafe = rawurlencode($file);
$fileurlsafe = rawurlencode($fileurl);
- $filedate = userdate(filectime($filename), "d-m-Y H:i:s");
+ $filedate = userdate(filectime($filename), "%e %b %Y, %I:%M %p");
echo "<TR>";
function userdate($date, $format="", $timezone=99) {
// Returns a formatted string that represents a date in user time
+// WARNING: note that the format is for strftime(), not date().
+
global $USER;
if ($format == "") {
- $format = "l, j F Y, g:i A";
+ $format = "%A, %e %B %Y, %I:%M %p";
}
if ($timezone == 99) {
$timezone = (float)$USER->timezone;
if (abs($timezone) > 12) {
return date("$format", $date);
}
- return gmdate($format, $date + (int)($timezone * 3600));
+ return gmstrftime($format, $date + (int)($timezone * 3600));
}
function usergetdate($date, $timezone=99) {
if (!file_exists($langfile)) { // try English instead
$langfile = "$langpath/en/strings.php";
if (!file_exists($langfile)) {
- return "ERROR: No translation file found";
+ return "ERROR: No lang file";
}
}
} else {
if ($lang == "en") {
- return "ERROR: Translation string '$identifier' is missing!";
+ return "ERROR: '$identifier' is missing!";
} else { // Try looking in the english file.
$langfile = "$langpath/en/strings.php";
if (!file_exists($langfile)) {
- return "ERROR: No translation file found";
+ return "ERROR: No lang file";
}
if ($result = get_string_from_file($identifier, $langfile, "\$resultstring")) {
eval($result);
return $resultstring;
} else {
- return "ERROR: Translation string '$identifier' is missing!";
+ return "ERROR: '$identifier' is missing!";
}
}
}
$CFG->header = "$CFG->dirroot/theme/$CFG->theme/header.html";
$CFG->footer = "$CFG->dirroot/theme/$CFG->theme/footer.html";
+// Set language/locale of printed times (must be supported by OS)
+
+ setlocale ("LC_TIME", $CFG->lang);
+
// Load up theme variables (colours etc)
require("$CFG->dirroot/theme/$CFG->theme/config.php");
$ownpost = ($topic->userid == $USER->id);
switch ($forum_style) {
case "minimal":
- echo "<P><FONT COLOR=#555555>".userdate($topic->modified, "j M H:i")."</FONT>";
+ echo "<P><FONT COLOR=#555555>".userdate($topic->modified, "%e %B, %H:%M")."</FONT>";
echo "<BR>$topic->subject ";
echo "<A HREF=\"$CFG->wwwroot/mod/discuss/view.php?d=$topic->discuss\">more...</A>";
echo "</P>\n";
$myxls->InsertText($u->lastname);
$myxls->InsertText($u->email);
$myxls->InsertText($u->idnumber);
- $myxls->InsertText( userdate($results["$user"]["time"], "d-M-Y h:i:s A") );
+ $myxls->InsertText( userdate($results["$user"]["time"], "%d-%b-%Y %I:%M:%S %p") );
$myxls->InsertText($notes);
foreach ($order as $key => $qid) {
if (! $u = get_record_sql("SELECT firstname,lastname,email,idnumber FROM user WHERE id = '$user'")) {
error("Error finding student # $user");
}
- echo $survey->id." ";
- echo $survey->name." ";
- echo $user." ";
- echo $u->firstname." ";
- echo $u->lastname." ";
- echo $u->email." ";
- echo $u->idnumber." ";
- echo userdate($results["$user"]["time"], "d-M-Y h:i:s A")." ";
+ echo $survey->id."\t";
+ echo $survey->name."\t";
+ echo $user."\t";
+ echo $u->firstname."\t";
+ echo $u->lastname."\t";
+ echo $u->email."\t";
+ echo $u->idnumber."\t";
+ echo userdate($results["$user"]["time"], "%d-%b-%Y %I:%M:%S %p")."\t";
foreach ($order as $key => $qid) {
$question = $questions["$qid"];
echo "<TR>";
echo "<TD><A HREF=\"report.php?action=student&student=$a->id&id=$survey\">$a->firstname $a->lastname</A></TD>";
- echo "<TD>".userdate($a->time, "j M Y, h:i A")."</TD>";
+ echo "<TD>".userdate($a->time, "%e %B %Y, %I:%M %p")."</TD>";
echo "<TD align=right>$a->numanswers</TD>";
echo "</TR>";
}
print_user_picture($a->user, $course->id, $a->picture, false);
echo "</TD>";
echo "<TD><P><A HREF=\"report.php?id=$id&action=student&student=$a->user\">$a->firstname $a->lastname</A></TD>";
- echo "<TD><P>".userdate($a->time, "j M Y h:i A")."</TD>";
+ echo "<TD><P>".userdate($a->time, "%e %B %Y, %I:%M %p")."</TD>";
echo "<TD BGCOLOR=\"$THEME->cellcontent\"><P>";
if ($a->answer1) {
echo "$a->answer1 - ".$answers[$a->answer1 - 1];