Файл: adultscript-2.0.3-pro/files/templates/defboot/extend/widgets/albums_popular.widget.php
Строк: 33
<?php
defined('_VALID') or die('Restricted Access!');
function template_widget_albums_popular()
{
$db = VF::factory('database');
$sql = "SELECT a.album_id, a.title, a.slug, a.likes, a.rating, a.rated_by,
a.total_views, a.total_photos, a.add_time, a.type, u.username
FROM #__photo_albums AS a
LEFT JOIN #__user AS u ON (u.user_id = a.user_id)
WHERE a.status = '1'
ORDER BY a.total_views DESC
LIMIT 6";
$db->query($sql);
if (!$db->affected_rows()) {
return;
}
$albums = $db->fetch_rows();
$output = array();
$output[] = '<div class="panel panel-default">';
$output[] = '<div class="panel-heading">';
$output[] = '<h3 class="panel-title">'.__('popular-albums').'</h3>';
$output[] = '</div>';
$output[] = '<div class="panel-body no-padding">';
$output[] = '<ul class="albums">';
foreach ($albums as $album) {
$percent = ($album['likes'] > 0 && $album['rated_by']) ? round($album['likes']*100/$album['rated_by']) : 100;
$class = ($percent > 50) ? 'up text-success' : 'down text-danger';
$output[] = '<li id="album-'.$album['album_id'].'">';
$output[] = '<div class="album">';
$output[] = '<a href="'.REL_URL.'/photo/'.$album['album_id'].'/'.$album['slug'].'/" title="'.e($album['title']).'" class="thumbnail">';
$output[] = '<img src="'.PHOTO_URL.'/covers/'.$album['album_id'].'.jpg" alt="'.e($album['title']).'" />';
if ($album['type'] == 'private') {
$output[] = '<img src="'.TPL_REL.'/images/private.png" alt="" class="private" />';
}
$output[] = '<span class="album-title">'.e($album['title']).'</span>';
$output[] = '<span class="album-overlay badge"><i class="fa fa-camera"></i> '.$album['total_photos'].'</span>';
$output[] = '<div class="album-details">';
$output[] = '<span class="pull-left"><i class="fa fa-eye"></i> '.$album['total_views'].'</span>';
$output[] = '<span class="pull-right text-right">'.$percent.'% <i class="fa fa-lg fa-thumbs-'.$class.'"></i></span>';
$output[] = '<div class="clearfix"></div>';
$output[] = '</div>';
$output[] = '</a>';
$output[] = '</div>';
$output[] = '</li>';
}
$output[] = '</ul>';
$output[] = '</div>';
$output[] = '</div>';
return implode("n", $output);
}
?>