<?php
////////////////////// FUNCTION | MODULE FUNCTION (c) i2d Technologies //////////////////////////////////

if (!function_exists('tung')) {
	function tung($icon,$text,$col_id,$table){
	$funda=stats2("master","deals_entry","link_id2",$col_id);	
   ?>
   <!-- PAGE FUNCTION STARTS (c) i2d Technologies Website Engine -->
   <div class="col-lg-3 col-sm-6">
											<div class="widget-inline-box text-center">
												<h3 class="m-t-10">
												<i class="text-primary <?php echo $icon; ?>"></i> 
												<b data-plugin="counterup"><?php echo $funda; ?></b></h3>
												<p class="text-muted"><?php echo $text; ?></p>
											</div>
										</div>

 <!-- PAGE FUNCTION ENDS (c) i2d Technologies Website Engine -->   
<?php   
}
}
//////////////////////////// HTML FUNCTION ENDS (c) i2d Technologies ///////////////////////////////////////

////////////////////// FUNCTION | MODULE FUNCTION (c) i2d Technologies //////////////////////////////////

if (!function_exists('dashboard')) {
	function dashboard($tung_array){
   ?>
   <!-- PAGE FUNCTION STARTS (c) i2d Technologies Website Engine -->
                        <div class="row">
							<div class="col-sm-12">
								<div class="card-box widget-inline">
									<div class="row">
										
										<?php 
				foreach ($tung_array as $item) {
				
				tung($item['icon'],$item['label'],$item['category_id'],$item['table'],$item['color']);
				
				//tung("mdi mdi-account-multiple","Food Deals","13","master",'primary');
				
				
				}	
										
										?>
										
									
									</div>
								</div>
								</div>
								</div>
							
 <!-- PAGE FUNCTION ENDS (c) i2d Technologies Website Engine -->   
<?php   
}
}
//////////////////////////// HTML FUNCTION ENDS (c) i2d Technologies ///////////////////////////////////////
//////////////////////////// HTML FUNCTION ENDS (c) i2d Technologies ///////////////////////////////////////
////////////////////// FUNCTION | MODULE FUNCTION (c) i2d Technologies //////////////////////////////////

if (!function_exists('stats_bar')) {
	function stats_bar($settings){
if (array_key_exists('table', $settings)) {
   $table=$settings['table'];
}
if (array_key_exists('ref', $settings)) {
   $ref=$settings['ref'];
}   
if (array_key_exists('title', $settings)) {
   $title=$settings['title'];
}
if (array_key_exists('bar_limit', $settings)) {
   $bar_limit=$settings['bar_limit'];
}
if (array_key_exists('bar_class', $settings)) {
   $bar_class=$settings['bar_class'];
}
if (array_key_exists('link', $settings)) {
   $link=$settings['link'];
}
if (array_key_exists('link_label', $settings)) {
   $link_label=$settings['link_label'];
  }
if (array_key_exists('link_class', $settings)) {
   $link_class=$settings['link_class'];
  }
if (array_key_exists('widget_class', $settings)) {
   $widget_class=$settings['widget_class'];
  }
else{
   $widget_class="col-sm-4";	
}  
  
  
$counter=stats2($table,$ref,"status","Active");  

$percent=$counter/$bar_limit;
$percent=$percent*100;
  

  
   ?>
   <!-- PAGE FUNCTION STARTS (c) i2d Technologies Website Engine -->
   <div class="<?php echo $widget_class; ?>">
                                <div class="card-box">

								<i class="fa fa-info-circle text-muted pull-left inform" 
								data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Tooltip on right"></i>
                                
								<a href="<?php echo $link; ?>" class="btn btn-sm <?php echo $link_class; ?> pull-right"><?php echo $link_label; ?></a>
                                    <h6 class="text-muted m-t-0 text-uppercase"><?php echo $title; ?></h6>
                                    <h2 class="m-b-20"><span><?php echo $counter; ?></span></h2>
                                    <div class="progress progress-sm m-0">
                                        <div class="progress-bar progress-bar-<?php echo $bar_class;?>" role="progressbar" aria-valuenow="<?php echo $percent; ?>" 
										aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $percent; ?>%;">
                                            <!-- <span class="sr-only">77% Complete</span> -->
                                        </div>
                                    </div>
                                </div>
                            </div>
 <!-- PAGE FUNCTION ENDS (c) i2d Technologies Website Engine -->   
<?php   
}
}
//////////////////////////// HTML FUNCTION ENDS (c) i2d Technologies ///////////////////////////////////////

////////////////////// FUNCTION | MODULE FUNCTION (c) i2d Technologies //////////////////////////////////

if (!function_exists('stats_bar_sum')) {
	function stats_bar_sum($settings){
if (array_key_exists('table', $settings)) {
   $table=$settings['table'];
}
if (array_key_exists('ref', $settings)) {
   $ref=$settings['ref'];
}   
if (array_key_exists('title', $settings)) {
   $title=$settings['title'];
}
if (array_key_exists('bar_limit', $settings)) {
   $bar_limit=$settings['bar_limit'];
}
if (array_key_exists('bar_class', $settings)) {
   $bar_class=$settings['bar_class'];
}
if (array_key_exists('link', $settings)) {
   $link=$settings['link'];
}
if (array_key_exists('link_label', $settings)) {
   $link_label=$settings['link_label'];
  }
if (array_key_exists('link_class', $settings)) {
   $link_class=$settings['link_class'];
  }
if (array_key_exists('widget_class', $settings)) {
   $widget_class=$settings['widget_class'];
  }
else{
   $widget_class="col-sm-4";	
}  
  
  
$counter=stats_sum($table,$ref,id_col,"status","Active");  


$percent=$counter/$bar_limit;
$percent=$percent*100;
  

  
   ?>
   <!-- PAGE FUNCTION STARTS (c) i2d Technologies Website Engine -->
   <div class="<?php echo $widget_class; ?>">
                                <div class="card-box">

								<i class="fa fa-info-circle text-muted pull-left inform" 
								data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Tooltip on right"></i>
                                
								<a href="<?php echo $link; ?>" class="btn btn-sm <?php echo $link_class; ?> pull-right"><?php echo $link_label; ?></a>
                                    <h6 class="text-muted m-t-0 text-uppercase"><?php echo $title; ?></h6>
                                    <h2 class="m-b-20"><span><?php echo $counter; ?></span></h2>
                                    <div class="progress progress-sm m-0">
                                        <div class="progress-bar progress-bar-<?php echo $bar_class;?>" role="progressbar" aria-valuenow="<?php echo $percent; ?>" 
										aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $percent; ?>%;">
                                            <!-- <span class="sr-only">77% Complete</span> -->
                                        </div>
                                    </div>
                                </div>
                            </div>
 <!-- PAGE FUNCTION ENDS (c) i2d Technologies Website Engine -->   
<?php   
}
}
//////////////////////////// HTML FUNCTION ENDS (c) i2d Technologies ///////////////////////////////////////






















?>
