<?php require "_header.php"; ?>
<script language="javascript" type="text/javascript">
	document.getElementById("main-content").style.display = 'none';
</script>
<div id="main-report" align="center">
	<style type="text/css">
		.table-report {
			font-family: Verdana, Geneva, sans-serif;
			font-size: 12px;
			text-align: center;
			border-right: 0px none;
			border-bottom: 0px none;
		}

		.table-report-inner {
			font-family: Verdana, Geneva, sans-serif;
			font-size: 12px;
		}

		.table-report tr {
			padding: 5px 5px 5px 5px;
		}

		.table-report td {
			padding: 5px 5px 5px 5px;
			border-top: 0px none;
			border-left: 0px none;
		}

		.table-report th {
			padding: 5px 5px 5px 5px;
			font-weight: bold;
			text-align: center;
			border-top: 0px none;
			border-left: 0px none;
		}

		.college_name {
			font-family: QTAbbie;
			font-size: 24px;
			font-weight: bold;
			padding: 2px 2px 2px 2px;
			text-align: center;
		}

		.college_address {
			font-family: Tahoma, Geneva, sans-serif;
			font-size: 11px;
			text-align: center;
			padding: 2px 2px 2px 2px;
		}

		.report_name {
			font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
			font-size: 13px;
			background-color: #CCC;
			text-align: center;
			font-weight: bold;
			padding: 2px 2px 2px 2px;
		}

		.left {
			float: left;
			width: 50%;
		}

		.right {
			float: right;
			width: 50%;
		}
	</style>
	<?php
	$branch_disp = Escape($_REQUEST['branch_disp']);
	$semester_disp = Escape($_REQUEST['semester_disp']);
	$subject_disp = Escape($_REQUEST['subject_disp']);
	$employee_disp = Escape($_REQUEST['employee_disp']);

	/*$student_qry=" select 
					sm.student_id,
					sd.cur_divison,
					sm.student_gturegno,
					CONCAT(sm.student_surname , ' ' , sm.student_firstname , ' ' ,sm.student_lastname) AS studentname,
					group_concat(CONCAT(fqr.subject_id,'-',fqr.employee_id) ORDER BY fqr.subject_id ASC,fqr.employee_id) as subject_id
					from 
						cms_studentmaster sm,
						cms_studentdetail sd
						left join feedback_que_result fqr on fqr.student_id = sd.student_id
					where
					sm.college_id = '".$_SESSION["VedantnrCollegeId"]."' 
					AND	sd.year_id = '".$_SESSION["VedantnrYearId"]."'
					AND sm.student_id = sd.student_id
					AND sm.student_active = 1
					  ";

		  $qry = "SELECT 
							alo.subject_id,
							alo.employee_id,
							sub.short_name,
							sub.subject_code,
							emp.employee_name
						FROM 
							 `cms_subjectmaster` sub,
							 `cms_employeemaster` emp,
							 `cms_subject_allocation` alo
						WHERE 
						alo.employee_id = emp.employee_id 
						AND alo.lectype=1
						AND alo.subject_id = sub.subject_id 
						AND emp.employee_active = 'YES' ";*/

	if ($_REQUEST['branch_hidden'] != "" && $_REQUEST['branch_hidden'] != "undefined") {
		$condition1 .= " AND alo.branch_id = '" . Escape($_REQUEST['branch_hidden']) . "' ";
		$condition .= " AND sd.cur_branchid = '" . Escape($_REQUEST['branch_hidden']) . "' ";
	}
	if ($_REQUEST['semester_hidden'] != "" && $_REQUEST['semester_hidden'] != "undefined") {
		$qcondition1ry .= " AND alo.semester_id = '" . Escape($_REQUEST['semester_hidden']) . "' ";
		$condition .= " AND sd.cur_semesterid = '" . Escape($_REQUEST['semester_hidden']) . "' ";
	}
	
	if ($_REQUEST['subject_hidden'] != "" && $_REQUEST['subject_hidden'] != "undefined") {
		$condition1 .= " AND alo.subject_id = '" . Escape($_REQUEST['subject_hidden']) . "' ";
	}
	if ($_REQUEST['employee_id_hid'] != "" && $_REQUEST['employee_id_hid'] != "undefined") {
		$condition1 .= "  AND alo.employee_id = '" . Escape($_REQUEST['employee_id_hid']) . "' ";
	}
	if ($_SESSION["VedantnrUserRole"] == 'Faculty' && $_SESSION["Employee_Id"] != "") {
		$condition1 .= " AND alo.employee_id  = '" . Escape($_SESSION["Employee_Id"]) . "' ";
	}
	$condition .= "group by sm.student_id order by sm.student_gturegno ASC,fqr.subject_id,fqr.employee_id ";
	$condition1 .= " group by alo.subject_id,alo.employee_id order by alo.subject_id,alo.employee_id ";


	//dbquery("SET group_concat_max_len = 102400");
	//$result1=dbQuery($qry);
	// dbquery("SET group_concat_max_len = 102400");
	//$student_result=dbQuery($student_qry);
	

	$objsubject_allocationMgmt = new cms_subject_allocationMgmt();
	$result1 = $objsubject_allocationMgmt->getemployeesub($condition1);

	$objfeedback_que_masterMgmt = new feedback_que_masterMgmt();
	$student_result = $objfeedback_que_masterMgmt->getemployeependdingfeedback($condition);
	if (dbRows($result1) > 0) {
		ob_start();
		?>
		<div style="display: inline-block; vertical-align: middle;">
									<b style="font-size: 30px;"><?php echo $_SESSION["VedantnrCollegeName"]; ?></b><br>
									<?php echo $_SESSION["VedantnrCollegeAddress"]; ?><br>
									Phone: <?php echo $_SESSION["VedantnrCollegePhone"]; ?>&nbsp;&nbsp;
									Email: <?php echo $_SESSION["VedantnrCollegeEmail"]; ?>
								</div>
		<center>
			<h4>Faculty Pandding Feedback Report-<?php echo $_SESSION["VedantnrYearName"] ?></h4>
		</center>
		<br />
		<table width="100%">
			<tr>
				<td style="text-align: left;border:none;"><b>Department</b>
					:<?php echo $branch_disp ?><br /><?php echo ($employee_disp != "" ? "<b>Name of Faculty: </b>  $employee_disp" : ''); ?>
				</td>
				<td style="text-align: right;border:none;"><b>Semester:
					</b><?php echo $semester_disp . '-' . $_REQUEST['division_id']; ?><br /><?php echo ($subject_disp != "" ? "<b>Subject: </b>$subject_disp" : ''); ?><br />
				</td>
			</tr>
			<tr>
				<td colspan="2"> Y= Feedback Given By Student, N= Feedback Not given By student</td>
			</tr>
		</table>
		<table class="table-report" border="1" cellpadding="0" cellspacing="0" width="100%">
			<tr style="background-color:#CCC;">
				<th style="text-align:center; font-weight:bold;font-size:12px ">Sr.</th>
				<th style="text-align:center; font-weight:bold;font-size:12px ">Enrollment no</th>
				<th style="text-align:center; font-weight:bold;font-size:12px ">Name of Student</th>
				<th style="text-align:center; font-weight:bold;font-size:12px ">Div</th>
				<?php while ($row = dbArray($result1)) {
					$sub_employee_id[] = $row['subject_id'] . '-' . $row['employee_id'];
					?>
					<th style="text-align:center; font-weight:bold;font-size:12px "><?php echo $row['short_name'] . '<br/><span style="font-size: 9px;
    font-weight: normal;">' . $row['employee_name'] . '</span>'; ?></th>
				<?php } ?>
			</tr>
			<?php
			$srno = 1;
			while ($studentrow = dbArray($student_result)) {
				$subject_id = explode(',', $studentrow['subject_id']);
				$createdon = explode(',', $studentrow['createdon']);
				?>
				<tr>
					<td style="text-align:left;">&nbsp;<?php echo $srno; ?></td>
					<td style="text-align:left;">&nbsp;<?php echo $studentrow['student_gturegno']; ?></td>
					<td style="text-align:left;">&nbsp;<?php echo $studentrow['studentname']; ?></td>
					<td style="text-align:left;">&nbsp;<?php echo $studentrow['cur_divison']; ?></td>
					<?php for ($i = 0; $i < count($sub_employee_id); $i++) { ?>
						<td style="text-align:center;">
							<?php
							if (in_array($sub_employee_id[$i], $subject_id)) {
								echo 'Y';
							} else {
								echo '<span style="color:#FF0000;font-weight:bold;">N</span>';
							} ?>
						</td>
					<?php } ?>
				</tr>
				<?php $srno++;
			} ?>
			<!--         <tr>
					<td colspan="17" >
					<table class="table-report-footer" cellpadding="0" cellspacing="0" width="100%">
						<tr>
							<td align="left" style="border:solid 0px red; padding:0px;" width="75%">Created by <b><?php echo $_SESSION["VedantnrUserName"]; ?></b> </td>
							<td align="right" style="border:solid 0px red; padding:0px;" width="25%">Developed By <b>Aum Imagineering Pvt.Ltd.</b></td>
						</tr>
					</table>
					</td>        
					</tr> -->

		</table>
		<?php
		$HtmlCode = ob_get_contents();
		ob_end_flush();
		$HtmlUrl = "hallticket-report.html";
		$HtmlPath = "report/" . $HtmlUrl;
		createHTMLReportPage($header_row_string, $HtmlUrl, $HtmlPath, $HtmlCode);
		?>
		<br />
		<form name="frm" id="frm" action="" method="post">
			<input type="hidden" name="txtFile" id="txtFile" value="<?php echo $HtmlUrl; ?>" />
			<!--<input type="button" name="btnPdf" id="btnPdf" value="Print" onClick="SetPageAction('PRINT');"/>-->
			<input type="button" name="btnPdf" id="btnPdf" value="Create PDF" onClick="SetPageAction('PDF');" />
			<!--<input type="button" name="btnHtml" id="btnHtml" value="Create HTML" onClick="SetPageAction('HTML');"/>-->
		</form>
		<script language="javascript" type="text/javascript">
			function SetPageAction(varAction) {
				if (varAction == "PRINT") {
					document.frm.action = "print/create-print.php";
					document.frm.target = "_blank";
					document.frm.submit();
				}
				else if (varAction == "PDF") {
					document.frm.action = "convertpdf/create-pdf.php";
					document.frm.target = "_blank";
					document.frm.submit();
				}
				else if (varAction == "HTML") {
					document.frm.action = "<?php echo $HtmlPath; ?>";
					document.frm.target = "_blank";
					document.frm.submit();
				}
				else if (varAction == "WORD") {
					document.frm.action = "convertword/create-word.php";
					document.frm.target = "_blank";
					document.frm.submit();
				}
				else if (varAction == "Excel") {
					document.frm.action = "convertword/create-excel.php";
					document.frm.target = "_blank";
					document.frm.submit();
				}
			}
		</script>
	<?php } else {
		echo "NO DATA FOUND!";
	} ?>
</div>
<?php require "_footer.php"; ?>
<?php
function get_feedback()
{

}
?>