Current File : /home/inlingua/public_html/dwarka/icentex/admin_cert/05featuredemo1_reports.php
<?php
/**
 * PHPExcel
 *
 * Copyright (C) 2006 - 2010 PHPExcel
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * @category   PHPExcel
 * @package    PHPExcel
 * @copyright  Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
 * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL
 * @version    1.7.3, 2010-05-17
 */

ini_set("max_execution_time",0);

// Include the database connection details
require('../dbConnection.php');

// Include common functions
require('../commonFunc.php');

// Include common functions
require('../globalVars.php');

// Include the table handler class
require('../dbHandler.class.php');

// Init and connect to database
$dbObject = new dbHandler();
$dbObject->connect();


 
 function getPresentBySymbol($arr,$symbol)
	{
	$present=0;
	foreach($arr as $key=>$val)
		{
		$exp=explode('~#',$val);
		foreach($exp as $keys=>$vals)
			{
			if($vals==$symbol) 	$present+=1;
			}
		}
		return $present;
	}
	
 function getPercentage($arr)
	{
	$percent=0;
	foreach($arr as $key=>$val)
		{
		$exp=explode('~#',$val);
		foreach($exp as $keys=>$vals)
			{
			if($vals=='P') 	$percent+=1;
			if($vals=='L') 	$percent+=.5;
			if($vals=='E') 	$percent+=1;
			}
			$TotalH=$TotalH+count($exp);
		}
		return number_format(($percent/$TotalH)*100,2,'.','');
	}

 function getColorPercentage($arr)
	{
	$percent=0;
	foreach($arr as $key=>$val)
		{
		$exp=explode('~#',$val);
		foreach($exp as $keys=>$vals)
			{
			if($vals=='P') 	$percent+=1;
			if($vals=='L') 	$percent+=.5;
			if($vals=='E') 	$percent+=1;
			}
			$TotalH=$TotalH+count($exp);
		}
		$percentage =($percent/$TotalH)*100;
		if($percentage < 75) $class="AttenRed";
		else $class="AttenGreen";
		return $class;
	}

	function getTotalHour($arr)
	{
	
		foreach($arr as $key=>$val)
		{
		$exp=explode('~#',$val);
		 
			$TotalH=$TotalH+count($exp);
		}
		
		return $TotalH;
	}



 
include "05featuredemo1.inc_reports.php";

/** PHPExcel_IOFactory */
require_once '../Classes/PHPExcel/IOFactory.php';


// Save Excel 2007 file
//echo date('H:i:s') . " Write to Excel2007 format\n";
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
//$objWriter->save(str_replace('.php', '.xlsx', __FILE__));


$objWriter->save("reports/reports.xlsx");
// Echo memory peak usage
//echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n";

// Echo done
//echo date('H:i:s') . " Done writing file.\r\n";
include("header_cert.php");
?>
<div><h4>Course Records Report Download</h4>
<div style='margin-left:5px;'>
<a href="reports/reports.xlsx">Download</a>
</div></div>
<?php
include("footer_cert.php");
?>