Commit 1616eeee authored by Son Nguyen's avatar Son Nguyen Committed by Gerrit Code Review
Browse files

Merge "Showing the modified date for the collections shared with group"

parents 4a0a6859 9ed4b3b2
......@@ -4791,7 +4791,7 @@ class View {
}
$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 ';
if (is_array($sort)) {
foreach ($sort as $sortitem) {
......@@ -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
* @return array updated collection data
......@@ -5028,6 +5028,20 @@ class View {
$collection = new Collection(0, $c);
$c['url'] = $collection->get_url(false);
$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}
<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}
<span class="owner"> {str tag=by section=view}
{if $collection.group}
......@@ -11,8 +11,11 @@
{$collection.sharedby}
{/if}
</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}
</h4>
<div class="detail">{$collection.description|str_shorten_html:100:true|strip_tags|safe}</div>
{if $collection.tags}
<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