Current File : /home/inlingua/www/icentex/course_details.php |
<?php
header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1.
header('Cache-Control: no-cache');
header('Pragma: no-cache');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Cache-Control: post-check=0, pre-check=0', FALSE);
clearstatcache();
?>
<meta http-equiv="Expires" content="Tue, 01 Jan 1995 12:12:12 GMT">
<meta http-equiv="Pragma" content="no-cache">
<script type="text/javascript" src="../jquery/development-bundle/ui/jquery.min.js"></script>
<script type="text/javascript">
function send_mail(name,courceid,email,rowid)
{
event.preventDefault();
$.ajax({
type: "GET",
url: "send_emailcou.php",
data: { 'name': name,'courceid':courceid,'email':email},
cache: false,
success: function(data){
//document.getElementById('result').innerHTML=data;
alert(data);
$('#'+rowid).css('background-color', 'green');
}
});
}
</script>
<?php
date_default_timezone_set('Asia/Calcutta');
// 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();
$tableName = "tbl_cou_alert_mail";
$dbObject->setTableName($tableName);
$courceid = $_GET['course_id'];
$cid = $_GET['cid'];
$lavelid = $_GET['lavel'];
$query="select * from ingl_course where recNo='".$courceid."'";
$result=mysqli_query($conn,$query);
$num=mysqli_fetch_array($result);
if($num['attendance_table']=="")
{
$num['attendance_table']='ingl_attendances_2011';
}
$queryM="select * from ".$num['attendance_table']." where courseIdrecNo='".$courceid."' ";
$resultM=mysqli_query($conn,$queryM);
$StudentTotalEntered=@mysqli_num_rows($resultM);
while($numM=@mysqli_fetch_array($resultM))
{
$studentrecNo=$numM['studentrecNo'];
$SattenArray[$studentrecNo][] = $numM['attendance_status'];
}
/*echo "<pre>";
print_r($SattenArray);
exit;*/
function getPercentage($arr)
{
/*echo "<pre>";
print_r($arr);exit;*/
if(empty($arr))
{
return "NA";
}
$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 Certificate_d($courseId,$level,$student)
{
$courseId =$courseId;
$level =trim($level);
//echo "<strong>$level</strong>";exit;
/*echo 'lavel=> '.$level.' course=>'.$courseId;exit;*/
if($level=="1A" || $level=="1B" || $level=="1B+"|| $level=="E1S2" || $level=="E1S2+")
{
$cert="certificate_1.php";
$tab="level_1";
}
elseif($level=="2A" || $level=="2B" || $level=="2A+" || $level=="2B+" || $level=="E2-S2" || $level=="E2-S2+"|| $level=="E2-S1"|| $level=="E2-S1+")
{
$cert="certificate_2.php";
$tab="level_2";
}
elseif($level=="3A" || $level=="3B" || $level=="E3-S1" || $level=="E3-S2")
{
$cert="certificate_3.php";
$tab="level_3";
}
elseif($level=="4")
{
$cert="certificate_4.php";
$tab="level_4";
}
elseif($level=="5")
{
$cert="certificate_5.php";
$tab="level_5";
}
elseif($level=="Private")
{
$cert="certificate_Private.php";
$tab="level_private";
}
else
{
$cert="#";
}
$queryC=" select count(a.recNo) as tot from ".$tab." a left join ingl_student s on s.recNo=a.student_recNo where a.courseId='".$courseId."' && a.student_recNo='".$student."'";
//echo $queryC;exit;
$resultC=mysqli_query($conn,$queryC);
$countT=mysqli_fetch_array($resultC);
if($countT['tot']>0)
{
$querylbl="select a.*, s.studentName from ".$tab." a left join ingl_student s on s.recNo=a.student_recNo where a.student_recNo='".$student."'";
$resultlbl=mysqli_query($conn,$querylbl);
$resultlbl = mysqli_fetch_array($resultlbl);
$link['nextlbl'] = $resultlbl['eligibility'];
//$link="<a href='".$cert."?courseId=".$courseId."' target='_blank'><font size='1'>Download Certificate(".$countT[tot].")</font></a>";
$link['cirtificate']="Yes";
}
else
{
$link['cirtificate']="No";
}
return $link;
}
?>
<table cellpadding="5" cellspacing="10" style="border:solid #000000 2px;" border="1" align="center">
<tr><td colspan="4" align="center"><h1>Course Id</h1></td><td colspan="4" align="center"><h1><?php echo $cid; ?></h1></td></tr>
<tr align="center">
<th>Students</th>
<th>Oral Comments (Yes/No)</th>
<th>Attendance</th>
<th>Certificate Generated (yes/No) </th>
<th>Promoted to next level(yes/ no)</th>
<th>FWF</th>
<th>EOC</th>
<th>Send Course details E-mail</th>
</tr>
<?php
$query = "SELECT * FROM ingl_student where courseId='".$courceid."' ";
// echo $query;exit;
$selectedRecords = $dbObject->Select($query);
$rowid=0;
while($objectData=$dbObject->SelectNext())
{
$isoral="No";
$iscertificate ="No";
$ispromoted="No";
$qureyorl=mysqli_query($conn,"SELECT count(*) FROM ingl_test_oral where student_id='".$objectData['ref_No']."'");
$resultorl=mysql_fetch_row($qureyorl);
if($resultorl!=0)
{
$isoral="Yes";
}
$certificate = Certificate_d($cid,$lavelid,$objectData['recNo']);
?>
<tr align="center">
<td><?php echo $objectData['studentName']; ?></td>
<td><?php echo $isoral; ?></td>
<td><?php echo getPercentage($SattenArray[$objectData['recNo']]); ?></td>
<td><?php echo $certificate['cirtificate']; ?> </td>
<td><?php echo $certificate['nextlbl'] ; ?></td>
<td>0</td>
<td>0</td>
<td>
<?php
//." => ".$objectData['email'];exit;//!$dbObject->Exists("courceid",$courceid) ||
if(!$dbObject->Exists("courceid",$cid) || !$dbObject->Exists("emailid",$objectData['email']))
{?>
<button type="button" /><a href="#" id="<?php echo $rowid; ?>" style="background:red;" onclick="send_mail('<?php echo $objectData['studentName']; ?>','<?php echo $cid; ?>','<?php echo $objectData['email']; ?>',<?php echo $rowid ?>);">Send Email</a>
<?php }else{ ?>
<button type="button" /><a id="<?php echo $rowid; ?>" href="#" style="background:green;" onclick="send_mail('<?php echo $objectData['studentName']; ?>','<?php echo $cid; ?>','<?php echo $objectData['email']; ?>',<?php echo $rowid ?>);">Already Send</a>
<?php }?>
</td>
</tr>
<?php $rowid++; } ?>
</table>
<div id="result"></div>