  <?php 

$atp_id = user()->user_id;
$this->db->where('user_id', $atp_id);
$atp = $this->db->get('users')->row();
 ?>

 <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 class="m-0 text-dark">All Students</h1>
          </div><!-- /.col -->
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="<?php echo base_url() ?>admin/admin/dashboard">Dashboard</a></li>
              <li class="breadcrumb-item"><a href="#">Examination</a></li>
              <li class="breadcrumb-item active">All Students</li>

            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->
    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="card card-default">
          <div class="card-header">
            <h3 class="card-title">View All Students</h3>
          </div>
            <!-- /.card-header -->
            <div class="card-body">
              <table id="example1" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th>Photo</th>
                  <th>Reg No</th>
                  <th>Student Name</th>
                  <th>Course</th>
                  <th>Exam Date & Time</th>
                  <th>Print Hall Ticket</th>
                </tr>
                </thead>
                <tbody>
                <?php $i=1; foreach ($all_student as $student):?>
                <tr>
                  <td><img src="<?php echo base_url(); ?><?php echo $student->user_photo; ?>" alt="" width="50px"></td>
                  <td><?php echo $student->user_reg_id ?></td>
                  <td><?php echo $student->user_name; ?></td>
                  <td><?php echo $student->title; ?></td>
                  <td><?php echo date('d-m-Y', strtotime($student->st_student_exam_date)); ?> <br/><?php echo date('h:i A', strtotime($student->st_student_exam_time)); ?>
                  </td>
                  <td class="text-center">
                    <a target="_blank" href="<?php echo base_url(); ?>admin/printing/download_hall_ticket/<?php echo $student->user_id ?>/<?php echo $student->id ?>" class="btn btn-success btn-xs mt-3"><i class="fa fa-download"></i> &nbsp;&nbsp;Download</a>
                  </td>
                </tr>
                <?php $i++; ?>
                <?php endforeach; ?>
                </tbody>
              </table>
            </div>
          </div>
      </div>
    </section>
  </div>
<!-- <?php $a=1; foreach ($all_student as $student):?>
<div class="modal fade" id="printHallTicketModal<?php echo $a; ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
   <div class="modal-dialog">
      <div class="modal-content">
         <div class="modal-header">
          <h4 class="modal-title" id="myModalLabel">Print Receipt</h4>
            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
            </button>
         </div>
         
          <div class="modal-body" id="printformdata_<?php echo $a; ?>">
            <div class=" col-md-12 col-sm-12 col-xs-12">
               <table class="table table-bordered">
                  <tbody id="inst_stud_det">
                     <tr>
                        <td colspan=3>
                           <h1 id="center" class="text-center text-primary"><center><?php echo $atp->user_business_name; ?></center></h1>
                           <div class="text-center">
                            <span class="text-center"><b><center> Hall Ticket For <?php echo $student->title; ?></center></b></span>
                           </div>
                        </td>
                     </tr>
                     <tr>
                        <td>Registration No:</td>
                        <td><b><?php echo $student->user_reg_id; ?></b></td>
                        <td rowspan="2" class="text-center" style="text-align: center;"><img id="photo" width="60" height="60" src="<?php echo base_url(); ?><?php echo $student->user_photo; ?>"></td>
                      </tr>
                      <tr>
                        <td>Candidates Name:</td>
                        <td ><b><?php echo $student->user_name; ?></b></td>
                      </tr>
                      <tr>
                        <td>ATC & Exam Center:</td>
                        <td colspan="2"><b><?=strtoupper($atp->user_business_name);?> </b><br/>
                            <?=strtoupper($atp->user_village);?> , <?=strtoupper($atp->user_taluka);?> ,<?=strtoupper($atp->user_dist);?>, <?=strtoupper($atp->user_state);?> - <?=strtoupper($atp->user_pin_code);?></td>
                      </tr>
                     <tr>
                        <td>Exam Date : <br/><span  id="examdate"><b><?php echo date('d-m-Y', strtotime($student->st_student_exam_date)); ?> <br/><?php echo date('h:i A', strtotime($student->st_student_exam_time)); ?></b></span></td>
                        <td>Candidates Signature : </td>
                        <td>Director : <br/><span id="centre"><b><?=strtoupper($atp->user_business_name);?></b></span></td>
                     </tr>
                     <tr>
                        <td colspan=3>Instructions</td>
                     </tr>
                  </tbody>
               </table>
            </div>
          </div>
          <div class="modal-footer">
             <button type="submit" class="btn btn-primary" data-dismiss="modal">Cancel</button>
             <button  type="submit" onclick="printtable(<?php echo $a; ?>);" name="action" id="action" class="btn btn-success"  /> 
             Print</button>
          </div>
      
      </div>
   </div>
</div>
<?php $a++; endforeach; ?>
<script type="text/javascript">
function printtable(e)
  {
    
    var table=document.getElementById("printformdata_"+e);
    var htmltoprint=''+'<style type="text/css">table {border-spacing: 0;border-collapse: collapse; width:100%; } tbody>tr>td{padding: 8px;line-height: 1.42857143;vertical-align: top; border:2px solid #000;}'+ 
    'thead>tr>th{padding: 8px;line-height: 1.42857143;vertical-align: top; border:1px solid #ddd;}'+
    '</style>';
    htmltoprint+=table.outerHTML;  
    newWin=window.open("");
    newWin.document.write(htmltoprint);
    newWin.print();
    newWin.close();
  }
</script> -->