<?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.'/users/session.user.php');

//** CHECK IF ADVERTISER IS ON or OFF **//
if ( ADVERTISER != 'ON' ) { header ( 'Location: '.HTTP_SERVER_WEBSITE.'dashboard' ); exit; }
//** END CHECK **//

$USER_ID	=	$_SESSION[USER_SESSION]['0']['user_id'];

$deposits = $db->Query("SELECT `adv_deposits_type`, `adv_deposits_email`, `adv_deposits_amount`, `adv_deposits_details`, `adv_deposits_date` , `adv_deposits_status` FROM advertisers_deposits where adv_deposits_user_id=? order by adv_deposits_id desc","i",$USER_ID);

$numbers = count ($deposits);

//PAGINATION
$page		=	$prepare->sanitize($_GET['p'], 'input');
$on_page	=	"10";
$page=!empty($page)?$page:"1";
$limitfrom=($page-1)*$on_page;
$limitto=($page*$on_page)-($page-1)*$on_page;
$itemsPerPage=$on_page;
$upsy = $paginator['rows']=$numbers;	 // rows
	  $paginator['pager']=$prepare->page($page,$upsy,$itemsPerPage);
	  $paginator['limitfrom']=$limitfrom+1;
	  $paginator['limitto']=$limitfrom+$upsy;
	  $paginator['itemsnum']=$upsy;
	  $paginator['page']=$page;
$view->paginator	=	$paginator;
//END PAGINATION
$view->dps = array_slice($deposits, $limitfrom, $limitto);
//***********************************************************************//









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

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

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

echo $view->render(DIR_TEMPLATE.WEBSITE_TEMPLATE.'/plugins/advertiser/deposit-management.php');
?>