Commit d2752322 authored by Robert Lyon's avatar Robert Lyon Committed by Cecilia Vela Gurovic
Browse files

Bug 1381228: Show created and updated dates for blogpost



If the created and updated dates are different for a
blogpost, we see both dates.

Based on  Robert's Proof of Concept

With showing both the created and updated dates for a
journal entry (blogpost)

Change-Id: If1701b56a12d39b017a8bb498fa1fbd0ea1ce92b
Signed-off-by: default avatarRobert Lyon <robertl@catalyst.net.nz>
parent 552d6e93
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -16,3 +16,4 @@ $string['description'] = 'Display the most recent journal entries (see Content -
$string['itemstoshow'] = 'Entries to show';
$string['postedin'] = 'in';
$string['postedon'] = 'on';
$string['updatedon'] = 'Last updated';
+4 −1
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ class PluginBlocktypeRecentposts extends MaharaCoreBlocktype {
            $blogids = $configdata['artefactids'];
            $artefactids = implode(', ', array_map('db_quote', $blogids));
            $mostrecent = get_records_sql_array(
                'SELECT a.title, ' . db_format_tsfield('a.ctime', 'ctime') . ', p.title AS parenttitle, a.id, a.parent
                'SELECT a.title, ' . db_format_tsfield('a.ctime', 'ctime') . ', p.title AS parenttitle, a.id, a.parent, ' . db_format_tsfield('a.mtime', 'mtime') . '
                    FROM {artefact} a
                    JOIN {artefact} p ON a.parent = p.id
                    JOIN {artefact_blog_blogpost} ab ON (ab.blogpost = a.id AND ab.published = 1)
@@ -115,6 +115,9 @@ class PluginBlocktypeRecentposts extends MaharaCoreBlocktype {
            // format the dates
            foreach ($mostrecent as &$data) {
                $data->displaydate = format_date($data->ctime);
                if ($data->ctime != $data->mtime) {
                    $data->updateddate = format_date($data->mtime);
                }
            }
            $smarty = smarty_core();
            $smarty->assign('mostrecent', $mostrecent);
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ $string['notagsavailable'] = 'You have not created any tags';
$string['notagsavailableerror'] = 'No tag selected. You need to add tags to your journal entries before being able to select them here.';
$string['postedin'] = 'in';
$string['postedon'] = 'on';
$string['updatedon'] = 'Last updated';
$string['itemstoshow'] = 'Items to show';
$string['configerror'] = 'Error during block configuration';
$string['showjournalitemsinfull'] = 'Show journal entries in full';
+4 −1
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ class PluginBlocktypeTaggedposts extends MaharaCoreBlocktype {
            $tagsout = array_filter($tagsout);
            $sqlvalues = array($view);
            $sql =
                'SELECT a.title, p.title AS parenttitle, a.id, a.parent, a.owner, a.description, a.allowcomments, at.tag, a.ctime
                'SELECT a.title, p.title AS parenttitle, a.id, a.parent, a.owner, a.description, a.allowcomments, at.tag, a.ctime, a.mtime
                FROM {artefact} a
                JOIN {artefact} p ON a.parent = p.id
                JOIN {artefact_blog_blogpost} ab ON (ab.blogpost = a.id AND ab.published = 1)
@@ -215,6 +215,9 @@ class PluginBlocktypeTaggedposts extends MaharaCoreBlocktype {
                $dataobject["artefact"] = $result->parent;
                $result->postedbyon = get_string('postedbyon', 'artefact.blog', display_default_name($result->owner), format_date(strtotime($result->ctime)));
                $result->displaydate= format_date(strtotime($result->ctime));
                if ($result->ctime != $result->mtime) {
                    $result->updateddate= format_date(strtotime($result->mtime));
                }

                $artefact = new ArtefactTypeBlogpost($result->id);
                // get comments for this post
+1 −0
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@ $string['post'] = 'entry';
$string['postbody'] = 'Entry';
$string['postbodydesc'] = ' ';
$string['postedon'] = 'Posted on';
$string['updatedon'] = 'Last updated';
$string['postedbyon'] = 'Posted by %s on %s';
$string['posttitle'] = 'Title';
$string['posts'] = 'entries';
Loading