Commit 2176ecfc authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Use format_date to display submission times rather than parsing the db timestamp


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 7e4efe58
......@@ -70,7 +70,7 @@ $string['views'] = 'views';
$string['View'] = 'View';
$string['Views'] = 'Views';
$string['viewsubmittedtogroup'] = 'This View has been submitted to <a href="%s">%s</a>';
$string['viewsubmittedtogroupon'] = 'This View was submitted to <a href="%s">%s</a> on %s at %s';
$string['viewsubmittedtogroupon'] = 'This View was submitted to <a href="%s">%s</a> on %s';
$string['nobodycanseethisview2'] = 'Only you can see this View';
$string['noviews'] = 'No Views.';
$string['youhavenoviews'] = 'You have no Views.';
......
......@@ -385,7 +385,7 @@ class View {
$fordb = new StdClass;
foreach (get_object_vars($this) as $k => $v) {
$fordb->{$k} = $v;
if (in_array($k, array('mtime', 'ctime', 'atime', 'startdate', 'stopdate')) && !empty($v)) {
if (in_array($k, array('mtime', 'ctime', 'atime', 'startdate', 'stopdate', 'submittedtime')) && !empty($v)) {
$fordb->{$k} = db_format_timestamp($v);
}
}
......@@ -2072,10 +2072,9 @@ class View {
$data[$i]['description'] = $viewdata[$i]->description;
if (!empty($viewdata[$i]->submitgroupid)) {
if (!empty($viewdata[$i]->submittedtime)) {
$pieces = explode(' ', $viewdata[$i]->submittedtime);
$data[$i]['submittedto'] = get_string('viewsubmittedtogroupon', 'view',
get_config('wwwroot') . 'group/view.php?id=' . $viewdata[$i]->submitgroupid,
$viewdata[$i]->submitgroupname, $pieces[0], $pieces[1]);
$viewdata[$i]->submitgroupname, format_date(strtotime($viewdata[$i]->submittedtime)));
}
else {
$data[$i]['submittedto'] = get_string('viewsubmittedtogroup', 'view',
......
......@@ -101,8 +101,7 @@ if ($USER->is_logged_in() && $submittedgroup && group_user_can_assess_submitted_
// been submitted to, and is entitled to release the view
$submittedgroup = get_record('group', 'id', $submittedgroup);
if ($view->get('submittedtime')) {
$pieces = explode(' ', $view->get('submittedtime'));
$text = get_string('viewsubmittedtogroupon', 'view', get_config('wwwroot') . 'group/view.php?id=' . $submittedgroup->id, $submittedgroup->name, $pieces[0], $pieces[1]);
$text = get_string('viewsubmittedtogroupon', 'view', get_config('wwwroot') . 'group/view.php?id=' . $submittedgroup->id, $submittedgroup->name, format_date(strtotime($view->get('submittedtime'))));
}
else {
$text = get_string('viewsubmittedtogroup', 'view', get_config('wwwroot') . 'group/view.php?id=' . $submittedgroup->id, $submittedgroup->name);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment