Файл: adultscript-2.0.3-pro/files/admin/modules/link/components/view.php
Строк: 44
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_Admin_link_view
{
public function __construct()
{
}
public function render()
{
$db = VF::factory('database');
$id = (isset($_GET['id'])) ? (int) trim($_GET['id']) : 0;
$page = (isset($_GET['page'])) ? (int) trim($_GET['page']) : 1;
$link = array();
$clicks = array();
$pagination = array();
$db->query("SELECT * FROM #__link WHERE link_id = ".$id." LIMIT 1");
if ($db->affected_rows()) {
$link = $db->fetch_assoc();
$sql = 'SELECT COUNT(*) AS total_clicks FROM #__link_clicks WHERE link_id = '.$id;
$total_clicks = $db->get_field($sql, 'total_clicks');
$pagination = VPagination::get($page, $total_clicks, 20);
$sql = 'SELECT * FROM #__link_clicks WHERE link_id = '.$id.' ORDER BY click_date DESC LIMIT '.$pagination['limit'];
$clicks = $db->get_rows($sql);
}
$tpl = VF::factory('template');
$tpl->menu = 'link';
$tpl->submenu = 'link_manage';
$tpl->meta_title = 'Admin::Link::View';
$tpl->link = $link;
$tpl->clicks = $clicks;
$tpl->pagination = $pagination;
$tpl->load(array('header', 'link_view', 'footer'));
$tpl->display();
}
}