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

<?php 

if($_REQUEST['semester_id']!="" && $_REQUEST['division_id']!="")
{ 
	 $header_row_string="Student Identity Card<br/>Semester :&nbsp;".$_REQUEST['semester_name']."&nbsp;
	 Division :&nbsp;".$_REQUEST['division_id'];
?>

<center><h4>Student Identity Card <br/> <b>Semester : </b><?php echo $_REQUEST['semester_name'];?>  
	&nbsp; <b>Division :</b> <?php echo $_REQUEST['division_id'];?></h4></center>
<?php 
} else {
	$header_row_string="Student Identity Card";
?>	

<center><h4>Student Identity Card</h4></center>

<?php } ?>
<?php 
if($_REQUEST['branch_id']=="")
{
?>
	<script language="javascript" type="text/javascript">
		location.href='report-form-student-icard.php';
	</script>
<?php
}
elseif($_SESSION['VedantnrCollegeId']!="" && isset($_SESSION['VedantnrCollegeId'])) 
{
	
	$branch_id 			= $_REQUEST['branch_id'];
	$student_gturegno 	= $_REQUEST['student_gturegno'];
	$semester_id 		= $_REQUEST['semester_id'];
	$division_id 		= $_REQUEST['division_id'];
	$semester_name		= $_REQUEST['semester_name'];	
	
	$limit=0;
	$start=0;
	$condition="";
	$order_field="";
	$order_type="";
		
		if($branch_id!=""){
			
			$condition  .= " and sd.cur_branchid ='$branch_id' ";				
			
			if($student_gturegno!=""){
				$condition .= " and sm.student_gturegno='$student_gturegno' ";	
			}
			else{
				$condition .= " and sd.cur_semesterid='$semester_id' and sd.cur_divison='$division_id' ";	
				$condition .= " and sm.student_active=1";
			}
		}
	 
 	$objStudent = new StudentMgmt();
	$outStudent = $objStudent->getAllStudentRecords($limit,$start,$condition,$order_field,$order_type);

	$qry_college = dbQuery("SELECT * FROM cms_collegemaster WHERE college_id= '".$_SESSION["VedantnrCollegeId"]."' ");
	$qry_college_res = dbArray($qry_college);

		
	$part = 1;
	$count=0;
	if(dbRows($outStudent)) {
	ob_start();
?>
<table cellpadding="0" cellspacing="0" width="95%"  >
<?php	
		while($row=dbArray($outStudent)) {
        	extract($row); 							

			if(!file_exists($StudentImagePath.$student_photo) || $student_photo=="") 
				$student_photo = "default.gif";
								
			//$imgfile = $SiteBaseUrl.str_replace("../","",$StudentImagePath).$student_photo;
		
		//background="http://image.ac.in/imagecms/images/i-bg.jpg"
			$StudentImagePath1 = "http://image.ac.in/imagecms/photo/college/1/student/";
			$imgfile = $StudentImagePath1.$student_photo;
		
			if($part%2!=0){
?>
			<tr style="border:0 none;">
<?php		
			}
?>
			<td  width="360" height="260" style="max-width:360" >
            <div style="height:260px; background:transparent url('http://image.ac.in/imagecms/images/i-bg.jpg'); background-repeat:no-repeat; width:360px; max-width:360; max-height:260; overflow:hidden; border-style:double; border-color:#000">
			  <table class="report" cellpadding="0" cellspacing="0">
				<tr style="border-bottom-style:hidden; max-height:0.2px; height:0.2px; overflow:hidden;"><td colspan="3" height="75" width="360"  >&nbsp;  </td></tr>
                
                <tr style="border-bottom-style:hidden; max-height:0.01px; height:0.01px; overflow:hidden;">
					<td  valign="top"  style="border:none; text-align:right">
                    <font color="#B70E0E" face="Arial, Helvetica, sans-serif"  size="1"><b>Adm Year</b>:</font>  </td>
					<td width="21%"   valign="top"  style="text-align:left; border:none;"><font face="Arial, Helvetica, sans-serif"  size="0.01"><?php print $ayear; ?></font></td>
					<td width="54%"   valign="top"  style="text-align:center; border:none;"><font face="Arial, Helvetica, sans-serif"  color="#B70E0E" size="1"><b>Valid Upto</b>:</font> <font face="Arial, Helvetica, sans-serif"  size="0.1"> Graduation</font></td>
				</tr>
                
				<tr style="border-bottom-style:hidden; max-height:0.01px; height:0.01px; overflow:hidden;">
					<td rowspan="4" width="25%" style=" padding-left:7px; padding-bottom:0px; border:none;"><img src="<?php echo $imgfile; ?>" width="75" height="100" alt="<?php echo $imgfile; ?>" /></td>
                    
					<td colspan="2" style="border:none;">
                    <font color="#255563" face="Arial, Helvetica, sans-serif" size="0.5"><b>Branch &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    </b>:</font> <font face="Arial, Helvetica, sans-serif" size="0.1"> <?php echo $_REQUEST['branch_name'];?></font></td>
				</tr>
                
              	<tr style="border-bottom-style:hidden; max-height:0.01px; height:0.01px; overflow:hidden;">
                	<td colspan="2" style="border:none;">
                    <font face="Arial, Helvetica, sans-serif" color="#255563" size="0.5"><b>Enrolment No 
                    </b>:</font> <font size="0.1" face="Arial, Helvetica, sans-serif"> <?php print $student_gturegno; ?></font> </td>
                </tr>
                
                <tr style="border-bottom-style:hidden; max-height:0.01px; height:0.01px; overflow:hidden;"><td colspan="2" style="border:none;">
                <font face="Arial, Helvetica, sans-serif" color="#255563" size="0.5"><b>Name &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </b>:</font> <font size="0.1" face="Arial, Helvetica, sans-serif" ><?php 
				$a = $student_surname." ".$student_firstname." ".substr($student_lastname,0,1)."."; 
				
				$b = preg_replace('~\b(\w)(\w+)~e', '"$1".strtolower("$2")', $a);
				print $b;
				?>
                </font></td>
                </tr>
				
                <tr style="border-bottom-style:hidden; max-height:0.01px; height:0.01px; overflow:hidden;">
                	<td height="52" colspan="3">
                    <font face="Arial, Helvetica, sans-serif" color="#255563" size="0.5"><b>Address &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    </b>:</font> <font face="Arial, Helvetica, sans-serif" size="0.05">
                    <div style="width:180px; padding-right:5px; height:36px; overflow:hidden;  float:right; " >
                    <?php 
					$a = $student_address; 
				
				$b = preg_replace('~\b(\w)(\w+)~e', '"$1".strtolower("$2")', $a);
				print $b;
					
					//print $student_address; ?> </div> </font></td>
               </tr>
                             
                <tr style="border-bottom-style:hidden; max-height:0.01px; height:0.01px; overflow:hidden;">
					<td colspan="1"  style="border:none; text-align:center">
                    <img src="http://image.ac.in/imagecms/images/img-sign1.jpg" /></td>
                    
                    <td colspan="2"  valign="bottom" style="border:none; text-align:center">&nbsp;
                    </td>
                    
				</tr>
                <tr style="border-bottom-style:hidden; max-height:0.01px; height:0.01px; overflow:hidden;">
                  <td valign="top" colspan="1" style="border:none; text-align:center"><font face="Arial, Helvetica, sans-serif" color="#255563" size="0.5"><b>Principal Sign</b>:</font></td>
                  
                   <td valign="top" colspan="1" style="border:none; text-align:right"><font face="Arial, Helvetica, sans-serif" color="#255563" size="0.5"><b>Phone No</b>:</font> </td>
                   <td valign="top" colspan="1" style="border:none; text-align:left"> <font face="Arial, Helvetica, sans-serif" size="0.5"><?php print $student_mobilestudents; ?> </font></td>
             
                </tr>
                <tr style="max-height:0.01px; height:0.01px; overflow:hidden;"><td valign="top" colspan="3"><font size="0.01" color="#000000" face="Arial, Helvetica, sans-serif">
              &nbsp;  The I-card should be produced whenever asked by Authority.
                </font></td></tr>
			</table>
            </div>
			</td>
			<td style="border:0 none;" width="4%">&nbsp;</td>
<?php
			$part++; 
			if($part%2!=0){
?>			</tr>
			<tr><td colspan="3"  style="border:0 none;">&nbsp;</td></tr>
<?php			
			}			
     	}
			if($part%2==0) { ?>
				<td style="border:0 none;">&nbsp;</td>
				<td style="border:0 none;">&nbsp;</td>
			</tr>
			<tr><td colspan="3"  style="border:0 none;">&nbsp;</td></tr>	
		<?php } ?>
</table>
<?php
		$HtmlCode= ob_get_contents();
		ob_end_flush();
		
		$HtmlUrl 	=	"student-identity-report-". $_SESSION["VedantnrUserId"].".html";
		$HtmlPath 	=	"report/".$HtmlUrl;
		createHTMLReportPage($header_row_string,$HtmlUrl,$HtmlPath,$HtmlCode);
			
?>
<br/>
<form name="frm1" id="frm1" action="" method="get">		
	<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');"/>
	<input type="button" name="btnWord" id="btnWord" value="Create WORD" onClick="SetPageAction('WORD');"/>

	<input type="button" name="btnExcel" id="btnExcel" value="Create EXCEL" onClick="SetPageAction('Excel');"/>
 
</form>
<script language="javascript" type="text/javascript">

	function SetPageAction(varAction) 
        {
			
		if(varAction=="PRINT"){			
            document.frm1.action="print/create-print.php";
            document.frm1.submit();
        }
		if(varAction=="PDF"){			
			document.frm1.action="convertpdf/create-pdf.php";
			document.frm1.target = "_blank";
			document.frm1.submit();
		}
		else if(varAction=="HTML"){
			document.frm1.action="<?php echo $HtmlPath ;?>";
			document.frm1.target = "_blank";
			document.frm1.submit();
		}
		else if(varAction=="WORD"){
			document.frm1.action="convertword/create-word.php";
			document.frm1.target="_blank";
			document.frm1.submit();
		}
		else if(varAction=="Excel"){
			document.frm1.action="convertword/create-excel.php";
			document.frm1.target="_blank";
			document.frm1.submit();
		}
	}
</script>

<?php		
		}	
		else
		{
			echo "<b>No Data Found.</b>";
	    }
	}
?>
</div>
<?php require "../_footer.php";?>