mirror of
https://github.com/moodle/moodle.git
synced 2025-04-15 05:25:08 +02:00
Displayed time formats are now stored in lang files
(see the new strftime* strings) so they can be customised per language
This commit is contained in:
parent
9277dbd42d
commit
dcde9f020a
@ -89,6 +89,7 @@
|
||||
if (!isset($string[$key]) or $string[$key] == "") {
|
||||
$value = htmlspecialchars($value);
|
||||
$value = str_replace("$"."a", "\\$"."a", $value);
|
||||
$value = str_replace("%%","%",$value);
|
||||
if ($first) {
|
||||
echo "</PRE><HR><P><B>".get_string("stringsnotset","","$langdir/$file")."</B></P><PRE>";
|
||||
$first = false;
|
||||
@ -188,6 +189,7 @@
|
||||
echo "<TD WIDTH=40% BGCOLOR=\"$THEME->cellheading\" VALIGN=TOP>$envalue</TD>";
|
||||
|
||||
$value = str_replace("\\","",$string[$key]); // Delete all slashes
|
||||
$value = str_replace("%%","%",$value);
|
||||
$value = htmlspecialchars($value);
|
||||
|
||||
$cellcolour = $value ? $THEME->cellcontent: $THEME->highlight;
|
||||
@ -261,6 +263,7 @@ function lang_save_file($path, $file, $strings) {
|
||||
$value = str_replace("\\","",$value); // Delete all slashes
|
||||
$value = str_replace("$"."a", "\\$"."a", $value); // Add slashes for $a
|
||||
$value = str_replace("\"", "\\\"", $value); // Add slashes for "
|
||||
$value = str_replace("%","%%",$value); // Escape % characters
|
||||
if ($id == "string" and $value != ""){
|
||||
fwrite($f,"\$string['$stringname'] = \"$value\";\n");
|
||||
}
|
||||
|
@ -47,6 +47,10 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate="today"
|
||||
asort($courses);
|
||||
}
|
||||
|
||||
|
||||
$strftimedate = get_string("strftimedate");
|
||||
$strftimedaydate = get_string("strftimedaydate");
|
||||
|
||||
asort($users);
|
||||
|
||||
// Get all the possible dates
|
||||
@ -59,7 +63,7 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate="today"
|
||||
$timemidnight = $today = usergetmidnight($timenow);
|
||||
|
||||
// Put today up the top of the list
|
||||
$dates = array("$timemidnight" => get_string("today").", ".userdate($timenow, "%d %B %Y") );
|
||||
$dates = array("$timemidnight" => get_string("today").", ".userdate($timenow, $strftimedate) );
|
||||
|
||||
if (! $course->startdate) {
|
||||
$course->startdate = $course->timecreated;
|
||||
@ -69,7 +73,7 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate="today"
|
||||
while ($timemidnight > $course->startdate and $numdates < 365) {
|
||||
$timemidnight = $timemidnight - 86400;
|
||||
$timenow = $timenow - 86400;
|
||||
$dates["$timemidnight"] = userdate($timenow, "%A, %d %B %Y");
|
||||
$dates["$timemidnight"] = userdate($timenow, $strftimedaydate);
|
||||
$numdates++;
|
||||
}
|
||||
|
||||
@ -150,6 +154,8 @@ function print_log($course, $user=0, $date=0, $order="ORDER BY l.time ASC") {
|
||||
$totalcountlogs = "$COURSE_MAX_LOGS_PER_PAGE/$totalcountlogs";
|
||||
}
|
||||
|
||||
$strftimedatetime = get_string("strftimedatetime");
|
||||
|
||||
echo "<P ALIGN=CENTER>";
|
||||
print_string("displayingrecords", "", $totalcountlogs);
|
||||
echo "</P>";
|
||||
@ -173,7 +179,7 @@ function print_log($course, $user=0, $date=0, $order="ORDER BY l.time ASC") {
|
||||
echo "<TD NOWRAP><FONT SIZE=2><A HREF=\"view.php?id=$log->course\">".$courses[$log->course]."</A></TD>";
|
||||
}
|
||||
echo "<TD NOWRAP ALIGN=right><FONT SIZE=2>".userdate($log->time, "%A")."</TD>";
|
||||
echo "<TD NOWRAP><FONT SIZE=2>".userdate($log->time, "%d %B %Y, %I:%M %p")."</TD>";
|
||||
echo "<TD NOWRAP><FONT SIZE=2>".userdate($log->time, $strftimedatetime)."</TD>";
|
||||
echo "<TD NOWRAP><FONT SIZE=2>";
|
||||
link_to_popup_window("/lib/ipatlas/plot.php?address=$log->ip&user=$log->userid", "ipatlas","$log->ip", 400, 700);
|
||||
echo "</TD>";
|
||||
@ -306,7 +312,7 @@ function print_recent_activity($course) {
|
||||
} else {
|
||||
echo "<P ALIGN=CENTER><FONT SIZE=1>";
|
||||
echo get_string("yourlastlogin").":<BR>";
|
||||
echo userdate($USER->lastlogin, "%A, %d %b %Y, %H:%M");
|
||||
echo userdate($USER->lastlogin, get_string("strftimerecentfull"));
|
||||
echo "</FONT></P>";
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
$userinfo = "$u->firstname $u->lastname";
|
||||
}
|
||||
if ($date) {
|
||||
$dateinfo = userdate($date, "%A, %d %B %Y");
|
||||
$dateinfo = userdate($date, get_string("strftimedaydate"));
|
||||
}
|
||||
|
||||
if ($course->category) {
|
||||
|
@ -113,6 +113,8 @@
|
||||
$weekofseconds = 604800;
|
||||
$course->enddate = $course->startdate + ($weekofseconds * $course->numsections);
|
||||
|
||||
$strftimedateshort = " ".get_string("strftimedateshort");
|
||||
|
||||
while ($weekdate < $course->enddate) {
|
||||
|
||||
$nextweekdate = $weekdate + ($weekofseconds);
|
||||
@ -127,8 +129,8 @@
|
||||
|
||||
$thisweek = (($weekdate <= $timenow) && ($timenow < $nextweekdate));
|
||||
|
||||
$weekday = userdate($weekdate, " %d %B");
|
||||
$endweekday = userdate($weekdate+518400, " %d %B");
|
||||
$weekday = userdate($weekdate, $strftimedateshort);
|
||||
$endweekday = userdate($weekdate+518400, $strftimedateshort);
|
||||
|
||||
if ($thisweek) {
|
||||
$colorsides = "bgcolor=\"$THEME->cellheading2\" class=\"weeklyoutlinesidehighlight\"";
|
||||
|
2
file.php
2
file.php
@ -49,7 +49,7 @@
|
||||
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 ($pathname)", "course/view.php?id=$courseid");
|
||||
}
|
||||
|
||||
exit;
|
||||
|
@ -459,6 +459,14 @@ $string['someerrorswerefound'] = "Some information was missing or incorrect. Loo
|
||||
$string['startdate'] = "Course start date";
|
||||
$string['startsignup'] = "Start now by creating a new account!";
|
||||
$string['status'] = "Status";
|
||||
$string['strftimedate'] = "%%d %%B %%Y";
|
||||
$string['strftimedateshort'] = "%%d %%B";
|
||||
$string['strftimedatetime'] = "%%d %%B %%Y, %%I:%%M %%p";
|
||||
$string['strftimedaydate'] = "%%A, %%d %%B %%Y";
|
||||
$string['strftimedaydatetime'] = "%%A, %%d %%B %%Y, %%I:%%M %%p";
|
||||
$string['strftimerecent'] = "%%d %%b, %%H:%%M";
|
||||
$string['strftimerecentfull'] = "%%a, %%d %%b %%Y, %%I:%%M %%p";
|
||||
$string['strftimetime'] = "%%I:%%M %%p";
|
||||
$string['stringsnotset'] = "The following strings are not defined in \$a";
|
||||
$string['studentnotallowed'] = "Sorry, but you can not enter this course as '\$a'";
|
||||
$string['success'] = "Success";
|
||||
|
@ -141,14 +141,12 @@ function userdate($date, $format="", $timezone=99) {
|
||||
global $USER;
|
||||
|
||||
if ($format == "") {
|
||||
$format = "%A, %d %B %Y, %I:%M %p";
|
||||
$formatnoday = "%A, DD %B %Y, %I:%M %p";
|
||||
$fixday = true;
|
||||
} else {
|
||||
$formatnoday = str_replace("%d", "DD", $format);
|
||||
$fixday = ($formatnoday != $format);
|
||||
$format = get_string("strftimedaydatetime");
|
||||
}
|
||||
|
||||
$formatnoday = str_replace("%d", "DD", $format);
|
||||
$fixday = ($formatnoday != $format);
|
||||
|
||||
if ($timezone == 99) {
|
||||
if (isset($USER->timezone)) {
|
||||
$timezone = (float)$USER->timezone;
|
||||
|
@ -197,10 +197,11 @@ function assignment_print_recent_activity(&$logs, $isteacher=false) {
|
||||
}
|
||||
|
||||
if ($assignments) {
|
||||
$strftimerecent = get_string("strftimerecent");
|
||||
$content = true;
|
||||
print_headline(get_string("newsubmissions", "assignment").":");
|
||||
foreach ($assignments as $assignment) {
|
||||
$date = userdate($assignment->time, "%d %b, %H:%M");
|
||||
$date = userdate($assignment->time, $strftimerecent);
|
||||
echo "<P><FONT SIZE=1>$date - $assignment->firstname $assignment->lastname<BR>";
|
||||
echo "\"<A HREF=\"$CFG->wwwroot/mod/assignment/$assignment->url\">";
|
||||
echo "$assignment->name";
|
||||
|
@ -53,7 +53,11 @@
|
||||
$useranswer[$key] = array();
|
||||
}
|
||||
foreach ($users as $user) {
|
||||
$answer = $answers[$user->id];
|
||||
if (!empty($answers[$user->id])) {
|
||||
$answer = $answers[$user->id];
|
||||
} else {
|
||||
$answer->answer = 0;
|
||||
}
|
||||
$useranswer[(int)$answer->answer][] = $user;
|
||||
}
|
||||
foreach ($choice->answer as $key => $answer) {
|
||||
|
@ -302,6 +302,8 @@ function forum_print_recent_activity(&$logs, $isteacher=false) {
|
||||
$heading = false;
|
||||
$content = false;
|
||||
|
||||
$strftimerecent = get_string("strftimerecent");
|
||||
|
||||
foreach ($logs as $log) {
|
||||
if ($log->module == "forum") {
|
||||
|
||||
@ -321,7 +323,7 @@ function forum_print_recent_activity(&$logs, $isteacher=false) {
|
||||
$heading = true;
|
||||
$content = true;
|
||||
}
|
||||
$date = userdate($post->modified, "%d %b, %H:%M");
|
||||
$date = userdate($post->modified, $strftimerecent);
|
||||
echo "<P><FONT SIZE=1 $teacherpost>$date - $post->firstname $post->lastname<BR>";
|
||||
echo "\"<A HREF=\"$CFG->wwwroot/mod/forum/$log->url\">";
|
||||
if ($log->action == "add") {
|
||||
@ -1468,6 +1470,11 @@ function forum_print_latest_discussions($forum_id=0, $forum_numdiscussions=5, $f
|
||||
|
||||
$discussioncount = 0;
|
||||
|
||||
if ($forum_style == "minimal") {
|
||||
$strftimerecent = get_string("strftimerecent");
|
||||
$strmore = get_string("more", "forum");
|
||||
}
|
||||
|
||||
foreach ($discussions as $discussion) {
|
||||
$discussioncount++;
|
||||
|
||||
@ -1488,10 +1495,10 @@ function forum_print_latest_discussions($forum_id=0, $forum_numdiscussions=5, $f
|
||||
}
|
||||
switch ($forum_style) {
|
||||
case "minimal":
|
||||
echo "<P><FONT COLOR=#555555>".userdate($discussion->modified, "%d %b, %H:%M")." - $discussion->firstname</FONT>";
|
||||
echo "<P><FONT COLOR=#555555>".userdate($discussion->modified, $strftimerecent)." - $discussion->firstname</FONT>";
|
||||
echo "<BR>$discussion->subject ";
|
||||
echo "<A HREF=\"$CFG->wwwroot/mod/forum/discuss.php?d=$discussion->discussion\">";
|
||||
echo get_string("more", "forum")."...</A>";
|
||||
echo $strmore."...</A>";
|
||||
echo "</P>\n";
|
||||
break;
|
||||
case "header":
|
||||
|
@ -139,9 +139,10 @@ function journal_print_recent_activity(&$logs, $isteacher=false) {
|
||||
|
||||
if ($journals) {
|
||||
$content = true;
|
||||
$strftimerecent = get_string("strftimerecent");
|
||||
print_headline(get_string("newjournalentries", "journal").":");
|
||||
foreach ($journals as $journal) {
|
||||
$date = userdate($journal->time, "%d %b, %H:%M");
|
||||
$date = userdate($journal->time, $strftimerecent);
|
||||
echo "<P><FONT SIZE=1>$date - $journal->firstname $journal->lastname<BR>";
|
||||
echo "\"<A HREF=\"$CFG->wwwroot/mod/journal/$journal->url\">";
|
||||
echo "$journal->name";
|
||||
|
@ -52,7 +52,7 @@
|
||||
break;
|
||||
|
||||
case WEBPAGE:
|
||||
if ($frameset) {
|
||||
if (!empty($frameset)) {
|
||||
print_header("$course->shortname: $resource->name", "$course->fullname",
|
||||
"$navigation <A TARGET=_top HREF=\"$resource->reference\" TITLE=\"$resource->reference\">$resource->name</A>",
|
||||
"", "", true, update_module_button($cm->id, $course->id, $strresource), navmenu($course, $cm));
|
||||
@ -69,7 +69,7 @@
|
||||
break;
|
||||
|
||||
case UPLOADEDFILE:
|
||||
if ($frameset) {
|
||||
if (!empty($frameset)) {
|
||||
print_header("$course->shortname: $resource->name", "$course->fullname", "$navigation $resource->name",
|
||||
"", "", true, update_module_button($cm->id, $course->id, $strresource), navmenu($course, $cm));
|
||||
echo "<CENTER><FONT SIZE=-1>".text_to_html($resource->summary, true, false)."</FONT></CENTER>";
|
||||
|
@ -116,9 +116,10 @@ function survey_print_recent_activity(&$logs, $isteacher=false) {
|
||||
|
||||
if ($surveys) {
|
||||
$content = true;
|
||||
$strftimerecent = get_string("strftimerecent");
|
||||
print_headline(get_string("newsurveyresponses", "survey").":");
|
||||
foreach ($surveys as $survey) {
|
||||
$date = userdate($survey->time, "%d %b, %H:%M");
|
||||
$date = userdate($survey->time, $strftimerecent);
|
||||
echo "<P><FONT SIZE=1>$date - $survey->firstname $survey->lastname<BR>";
|
||||
echo "\"<A HREF=\"$CFG->wwwroot/mod/survey/$survey->url\">";
|
||||
echo "$survey->name";
|
||||
@ -213,6 +214,8 @@ function survey_count_responses($survey) {
|
||||
function survey_print_all_responses($survey, $results) {
|
||||
global $THEME;
|
||||
|
||||
$dateformat = get_string("strftimedatetime");
|
||||
|
||||
echo "<TABLE CELLPADDING=5 CELLSPACING=2 ALIGN=CENTER>";
|
||||
echo "<TR><TD>Name<TD>Time<TD>Answered</TR>";
|
||||
|
||||
@ -220,7 +223,7 @@ function survey_print_all_responses($survey, $results) {
|
||||
|
||||
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, "%d %B %Y, %I:%M %p")."</TD>";
|
||||
echo "<TD>".userdate($a->time, $dateformat)."</TD>";
|
||||
echo "<TD align=right>$a->numanswers</TD>";
|
||||
echo "</TR>";
|
||||
}
|
||||
|
@ -216,6 +216,7 @@
|
||||
$strtime = get_string("time", "survey");
|
||||
$stractual = get_string("actual", "survey");
|
||||
$strpreferred = get_string("preferred", "survey");
|
||||
$strdateformat = get_string("strftimedatetime");
|
||||
|
||||
echo "<TABLE ALIGN=center CELLPADDING=0 CELLSPACING=10><TR><TD> <TH align=left>$strname<TH align=left>$strtime<TH align=left>$stractual<TH align=left>$strpreferred</TR>";
|
||||
|
||||
@ -226,7 +227,7 @@
|
||||
print_user_picture($a->userid, $course->id, $a->picture, false);
|
||||
echo "</TD>";
|
||||
echo "<TD><P><A HREF=\"report.php?id=$id&action=student&student=$a->userid\">$a->firstname $a->lastname</A></TD>";
|
||||
echo "<TD><P>".userdate($a->time, "%d %B %Y, %I:%M %p")."</TD>";
|
||||
echo "<TD><P>".userdate($a->time, $strdateformat)."</TD>";
|
||||
echo "<TD BGCOLOR=\"$THEME->cellcontent\"><P>";
|
||||
if ($a->answer1) {
|
||||
echo "$a->answer1 - ".$answers[$a->answer1 - 1];
|
||||
|
Loading…
x
Reference in New Issue
Block a user