Файл: housetrack/modules/top_files/helpers/top_files_widget.php
Строк: 59
<?php
defined('IN_SYSTEM') or die('<b>403<br />Запрет доступа!</b>');
class top_files_widget
{
public static function display($widget_id)
{
$db = Registry::get('db');
$widget = $db->get_row("SELECT * FROM #__index_page_widgets WHERE widget_id = $widget_id");
$config = parse_ini_string($widget['config']);
$top_files=$db->get_array("SELECT df.`file_id`, df.`name`, df.`time`, df.`rating`, df.`downloads`,
(SELECT COUNT(*) FROM `#__comments_posts`
WHERE `module`='downloads'
AND `item_id` = df.`file_id`
) AS `comments`
FROM `#__downloads_files` AS df
WHERE rating > 0 ORDER BY rating DESC LIMIT 10
");
$count = $db->get_row("SELECT
(SELECT COUNT(*) FROM #__comments_posts WHERE module = 'downloads') AS comments,
(SELECT COUNT(*) FROM #__comments_posts WHERE module = 'downloads' AND time > UNIX_TIMESTAMP() - 3600 * 24) AS new_comments");
if(empty($top_files))
return 'Ещё не проголосовали не за один трек';
else
{
$result=null;
$position=1;
foreach($top_files AS $file)
{
$result.='<b>'.$position .'. </b><a href="'. URL .'downloads/view/'. $file['file_id'] .'"> '. $file['name'] .'</a><div class="top_info"> ['. intval($file['rating']) .'<img src="'. URL .'views/default/images/star_home.png" alt="" /> из 5] Скач: '. $file['downloads'] .' Дата: '.itime($file['time']) .' <a href="'. URL .'comments/?module=downloads&item_id='. $file['file_id'] .'">Комм:</a> <span class="small_text">['. $file['comments'] .']</span> '. ($files['new_comments'] > 0 ? ' <span class="new">+ '. $files['new_comments'] .'</span>' : '') .'</div>';
$position++;
if(each($top_files))
$result.='<hr/>';
}
return $result.='<hr/><div class="top_home"><img src="'. URL .'views/default/images/icon.png" alt="" /> <a href="'. URL . 'downloads/top_files">Перейти к TOP 100</a></div>';
}
}
public static function setup($widget)
{
a_notice('Данный виджет не требует настройки', a_url('index_page/admin'));
}
}
?>