<?php
/**
 * @package		Ad Platform
 * @author		Uta Marian - Alexandru ( -uMarian- )
 * @license		http://codecanyon.net/licenses
 * @link		http://www.uta-marian.com
 * @version		Version 1.0
 */
require_once(dirname(__FILE__).'/../../config.php');
require_once(DIR_SYSTEM.'/admin/session.admin.php');

//*** DATES ***//
$today				=	strtotime( "now" );
$BEGIN_TODAY		=	strtotime("midnight", $today);
$END_TODAY			=	strtotime("tomorrow", $BEGIN_TODAY) - 1;

$views = $db->Query("SELECT `aav_value` FROM advertisers_ad_views where aav_date>? and aav_date<?","ii",$BEGIN_TODAY,$END_TODAY);
$view->viewsCounter	=	count($views);


$clicks = $db->Query("SELECT `aac_value` FROM advertisers_ad_clicks where aac_date>? and aac_date<?","ii",$BEGIN_TODAY,$END_TODAY);
$view->clicksCounter	=	count($clicks);

$sum = 0;
foreach ( $clicks as $click ) {
	$sum = $sum + $click['aac_value'];
}
$view->sum = $sum;

//**DEFINE CUSTOM CSS/JS FILLES**//
$view->customCode = '<link href="'.HTTP_SERVER_WEBSITE.'templates/'.ADMIN_TEMPLATE.'/assets/css/dashboard.css" rel="stylesheet">';

/* set page title */
$view->title = $LANG["WBS_ADMIN_STATS_TA_ADVERTISER_SEO"];
$view->description = $LANG["WBS_ADMIN_STATS_TA_ADVERTISER_SEO"];
$view->keywords = $LANG["WBS_ADMIN_STATS_TA_ADVERTISER_SEO"];

$view->header = $view->render(DIR_TEMPLATE.ADMIN_TEMPLATE.'/header.php');
$view->footer = $view->render(DIR_TEMPLATE.ADMIN_TEMPLATE.'/footer.php');

echo $view->render(DIR_TEMPLATE.ADMIN_TEMPLATE.'/stats/ta.php');
?>