Show albums on summary
Ok I made the code to show album in summary if anybody needs it
The aim of this is that people in my blogs post more albums than texts so I needed to show on the summary page that the blog is really active by the posted albums.
Here are my modifications.
in /class/summary/dao/summarystats.class.phpadd this method
/**
* Returns an array of last albums
* addition by [email protected] to show recent
* albums in summary
*
* @param maxAlbums The maximum number of album to return
* @return An array of album
*/
function getRecentAlbums( $maxAlbums = 0) {
$query = "SELECT id, owner_id, description,
name, flags, parent_id,
date, properties, show_album
FROM ".$this->getPrefix()."gallery_albums WHERE show_album = 1
ORDER BY id DESC
LIMIT 0, $maxAlbums";
$result = $this->Execute( $query );
if( !$result ){
return Array();
}
$albums = Array();
while( $row = $result->FetchRow()) {
$album = $this->albums->getAlbum( $row["id"]);
array_push( $albums, $album );
}
$result->Close();
return $albums;
}
Then in /class/summary/action/summarydefaultaction.class.php inside perform() method, add these
//added by [email protected]
$recentAlbums = $stats->getRecentAlbums( $this->_numPosts );
$this->_view->setValue( "recentAlbums", $recentAlbums );
Now you can show it in /templates/summary/index.template
{*
added by [email protected]
*}
{if $recentAlbums}
{$locale->tr("resources")}
{foreach name=recentalbum from=$recentAlbums item=album}
{assign var=albumOwnerId value=$album->getOwnerId()}
{assign var="blog" value=$blogs[$albumOwnerId]}
{assign var="url" value=$blog->getBlogRequestGenerator()}
{if $smarty.foreach.recentalbum.first}
{/if}
-
albumLink($album)}">{$album->getName()|strip_tags} ({$album->getNumChildren()})
{if $smarty.foreach.recentalbum.last}
{/if}
{/foreach}
{/if}
If anybody can perform it then welcome... and let me know.