add photo count to photo album list
This commit is contained in:
parent
35d42f8626
commit
8b66329a8f
@ -264,7 +264,7 @@ function photos_albums_list($channel,$observer) {
|
|||||||
|
|
||||||
$sql_extra = permissions_sql($channel_id);
|
$sql_extra = permissions_sql($channel_id);
|
||||||
|
|
||||||
$albums = q("SELECT distinct album from photo where uid = %d and ( photo_flags = %d or photo_flags = %d ) $sql_extra order by created desc",
|
$albums = q("SELECT count( distinct resource_id ) as total, album from photo where uid = %d and ( photo_flags = %d or photo_flags = %d ) $sql_extra group by album order by created desc",
|
||||||
intval($channel_id),
|
intval($channel_id),
|
||||||
intval(PHOTO_NORMAL),
|
intval(PHOTO_NORMAL),
|
||||||
intval(PHOTO_PROFILE)
|
intval(PHOTO_PROFILE)
|
||||||
@ -279,7 +279,8 @@ function photos_albums_list($channel,$observer) {
|
|||||||
$ret['success'] = true;
|
$ret['success'] = true;
|
||||||
foreach($albums as $k => $album) {
|
foreach($albums as $k => $album) {
|
||||||
$entry = array(
|
$entry = array(
|
||||||
'text' => $album['album'],
|
'text' => $album['album'],
|
||||||
|
'total' => $album['total'],
|
||||||
'url' => z_root() . '/photos/' . $channel['channel_address'] . '/album/' . bin2hex($album['album']),
|
'url' => z_root() . '/photos/' . $channel['channel_address'] . '/album/' . bin2hex($album['album']),
|
||||||
'urlencode' => urlencode($album['album']),
|
'urlencode' => urlencode($album['album']),
|
||||||
'bin2hex' => bin2hex($album['album']));
|
'bin2hex' => bin2hex($album['album']));
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
{{if $albums}}
|
{{if $albums}}
|
||||||
<ul>
|
<ul>
|
||||||
{{foreach $albums as $al}}
|
{{foreach $albums as $al}}
|
||||||
<li><a href="{{$baseurl}}/photos/{{$nick}}/album/{{$al.bin2hex}}">{{$al.text}}</a></li>
|
{{if $al.text}}
|
||||||
|
<li><a href="{{$baseurl}}/photos/{{$nick}}/album/{{$al.bin2hex}}">{{$al.text}}</a> ({{$al.total}})</li>
|
||||||
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</ul>
|
</ul>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
Reference in New Issue
Block a user