<?php
include('header.php');
?>
<div class="row">
                
                <div class="col-lg-3 col-md-6">
                    <div class="panel panel-green">
                        <div class="panel-heading">
                            <div class="row">
                                <div class="col-xs-3">
                                    <i class="fa fa-user fa-5x"></i>
                                </div>
                                <div class="col-xs-9 text-right">
                                    <div class="huge"><?php echo $general->count_users(); ?></div>
                                    <div class="stat-text">Users</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
				<div class="col-lg-3 col-md-6">
                    <div class="panel panel-primary">
                        <div class="panel-heading">
                            <div class="row">
                                <div class="col-xs-3">
                                    <i class="fa fa-th fa-5x"></i>
                                </div>
                                <div class="col-xs-9 text-right">
                                    <div class="huge"><?php echo $general->count_channels(); ?></div>
                                    <div class="stat-text">Channels</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-3 col-md-6">
                    <div class="panel panel-yellow">
                        <div class="panel-heading">
                            <div class="row">
                                <div class="col-xs-3">
                                    <i class="fa fa-list fa-5x"></i>
                                </div>
                                <div class="col-xs-9 text-right">
                                    <div class="huge"><?php echo $general->count_lists(); ?></div>
                                    <div class="stat-text">Lists</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-3 col-md-6">
                    <div class="panel panel-red">
                        <div class="panel-heading">
                            <div class="row">
                                <div class="col-xs-3">
                                    <i class="fa fa-youtube-play fa-5x"></i>
                                </div>
                                <div class="col-xs-9 text-right">
                                    <div class="huge"><?php echo $general->count_media(); ?></div>
                                    <div class="stat-text">Media</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
				
            </div>
<?php
$start = $general->start_period();
if ($start != 0) {
$month = intval(make_safe(xss_clean($_GET['month'])));
$year = intval(make_safe(xss_clean($_GET['year'])));
if (!isset($month) OR empty($month) OR $month > 12) {$current_month = date('n');} else {$current_month = $month;}
if (!isset($year) OR empty($year) OR $year > date('Y')) {$current_year = date('Y');} else {$current_year = $year;}
?>
<div class="page-header page-heading">
	<div class="row">
	<div class="col-md-9"><h1><i class="fa fa-bar-chart"></i> Media Statistics For <span class="text-info"><?php echo month_name($current_month).', '.$current_year; ?></span></h1></div>
	<div class="col-md-3">
	<form method="GET" name="menu">
	<select name="selectedPage" onChange="changePage(this.form.selectedPage)" class="form-control">
	<option>Choose a Month</option>
	<?php
	echo generate_statics_select($start['year'],$start['month']);
	?>
	</select>
	</form>
	</div>
	</div>
</div>
<div class="row">
<?php
$thetime = mktime(0, 0, 0, $current_month, 3, $current_year);
$days = date('t',$thetime);
?>
<script>
						$(function() {
						Morris.Area({
							element: 'morris-area-chart',
							data: [
							<?php for($i=1;$i<$days+1;$i++) 
							{ 
							?>
							<?php echo "{"; ?>
							periods: '<?php echo $current_year.'-'.$current_month.'-'.$i; ?>',
							youtube: <?php echo $general->statistics_media('youtube',$i,$current_month,$current_year); ?>,
							vimeo: <?php echo $general->statistics_media('vimeo',$i,$current_month,$current_year); ?>,
							dailymotion: <?php echo $general->statistics_media('dailymotion',$i,$current_month,$current_year); ?>
							<?php echo "}, "; ?>
							<?php } ?>
							],
							xkey: 'periods',
							ykeys: ['youtube','vimeo','dailymotion'],
							labels: ['Youtube','Vimeo','DailyMotion'],
							barColors: ['#DF5B37','#ED1B23','#5DBFE4','#555555'],
							pointSize: 4,
							hideHover: 'auto',
							resize: true
						});
						});
						</script>
						<div id="morris-area-chart"></div>
						</div>
<?php
}
include('footer.php');
?>