Commit 9ed4b3b2 authored by Robert Lyon's avatar Robert Lyon
Browse files

Showing the modified date for the collections shared with group



Bug #1448807

Change-Id: I300c4d45d6a9c0568339a49dd3eeedce7ad9a117
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 4901ef65
...@@ -4791,7 +4791,7 @@ class View { ...@@ -4791,7 +4791,7 @@ class View {
} }
$count = count_records_sql('SELECT COUNT(DISTINCT c.id) ' . $from . $where, $ph); $count = count_records_sql('SELECT COUNT(DISTINCT c.id) ' . $from . $where, $ph);
$select = 'SELECT DISTINCT c.id, c.name, c.description, c.owner, c.group, c.institution'; $select = 'SELECT DISTINCT c.id, c.name, c.description, c.owner, c.group, c.institution, c.ctime, c.mtime';
$orderby = ' ORDER BY '; $orderby = ' ORDER BY ';
if (is_array($sort)) { if (is_array($sort)) {
foreach ($sort as $sortitem) { foreach ($sort as $sortitem) {
...@@ -4945,7 +4945,7 @@ class View { ...@@ -4945,7 +4945,7 @@ class View {
} }
/** /**
* Get more info for the collections: owner, url, tags * Get more info for the collections: owner, url, tags, views
* *
* @param array a list of collections $collectiondata * @param array a list of collections $collectiondata
* @return array updated collection data * @return array updated collection data
...@@ -5028,6 +5028,20 @@ class View { ...@@ -5028,6 +5028,20 @@ class View {
$collection = new Collection(0, $c); $collection = new Collection(0, $c);
$c['url'] = $collection->get_url(false); $c['url'] = $collection->get_url(false);
$c['fullurl'] = $needsubdomain ? $collection->get_url(true) : ($wwwroot . $c['url']); $c['fullurl'] = $needsubdomain ? $collection->get_url(true) : ($wwwroot . $c['url']);
// Get any views that are part of this collection
$c['views'] = get_records_sql_assoc('SELECT v.id, v.title, v.mtime FROM {view} v, {collection_view} cv, {collection} c
WHERE cv.collection = c.id AND cv.view = v.id AND c.id = ?',
array($c['id']));
// Set the collection modified time as the highest view
// modified time if higher than collection modified time
foreach ($c['views'] as $view) {
$cmodified = new DateTime($c['mtime']);
$vmodified = new DateTime($view->mtime);
if ($vmodified > $cmodified) {
$c['mtime'] = $view->mtime;
}
}
} }
} }
} }
......
{foreach from=$items item=collection} {foreach from=$items item=collection}
<div class="{cycle values='r0,r1'} listrow"> <div class="{cycle values='r0,r1'} listrow">
<h4 class="title"><a href="{$collection.fullurl}">{$collection.name}</a> <h4 class="title"><a href="{$collection.fullurl}">{$collection.name}</a></h4>
{if $collection.sharedby} {if $collection.sharedby}
<span class="owner"> {str tag=by section=view} <span class="owner"> {str tag=by section=view}
{if $collection.group} {if $collection.group}
...@@ -11,8 +11,11 @@ ...@@ -11,8 +11,11 @@
{$collection.sharedby} {$collection.sharedby}
{/if} {/if}
</span> </span>
<span class="postedon">
- {if $collection.mtime == $collection.ctime}{str tag=Created}{else}{str tag=Updated}{/if}
{$collection.mtime|strtotime|format_date: 'strftimedate'}
</span>
{/if} {/if}
</h4>
<div class="detail">{$collection.description|str_shorten_html:100:true|strip_tags|safe}</div> <div class="detail">{$collection.description|str_shorten_html:100:true|strip_tags|safe}</div>
{if $collection.tags} {if $collection.tags}
<div class="tags"><strong>{str tag=tags}:</strong> {list_tags owner=$collection.owner tags=$collection.tags}</div> <div class="tags"><strong>{str tag=tags}:</strong> {list_tags owner=$collection.owner tags=$collection.tags}</div>
......
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