Current File : /home/inlingua/public_html/sensoriumpsychologists.com/diagnostics/admin/all_students.php
<?php require_once("../franchise_between/admin_constants.php");?>
<?php require_once("../franchise_between/check_admin.php");?>
<?php require_once("../franchise_between/user_details_msg_setup.php");?>
<?php require_once("../franchise_back/connection.php");?>
<?php require_once("../franchise_back/database_admin.php");?>
<?php require_once("../franchise_back/validate_admin.php");?>
<?php require_once("../franchise_between/admin.php");?>
<?php
$page_no=0;
$pages_return=0;
$reg_no="";
$franchise="";
$student_name="";
$reg_date_from="";
$reg_date_to="";
$sort_by="name";
$order_by="asc";
if(isset($_GET['page_no']))
{
	$page_no = $_GET['page_no'];
}
if(isset($_GET['sort_by']))
{
	$sort_by = $_GET['sort_by'];
}
if(isset($_GET['order_by']))
{
	$order_by = $_GET['order_by'];
}
if(isset($_GET['reg_no']))
{
	$reg_no= $_GET['reg_no'];
}
if(isset($_GET['franchise']))
{
	$franchise= $_GET['franchise'];
}
if(isset($_GET['student_name']))
{
	$student_name= $_GET['student_name'];
}
if(isset($_GET['reg_date_from']))
{
	$reg_date_from= $_GET['reg_date_from'];
}
if(isset($_GET['reg_date_to']))
{
	$reg_date_to= $_GET['reg_date_to'];
}
$fetch_obj=new admin;
$result=$fetch_obj->all_students($page_no,$pages_return,$reg_no,$franchise,$student_name,$reg_date_from,$reg_date_to);
?>
<!DOCTYPE html>
<html>
  <head>
    <?php require("common/head_links.php");?>
    
  </head>
  <body class="hold-transition skin-blue sidebar-mini">
    <div class="wrapper">

      <?php require("common/header.php");?>
      
      <?php require("common/left_side_bar.php");?>

      <!-- Content Wrapper. Contains page content -->
      <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            All Students
          </h1>

      <form action="" method="get" role="form" class="form-inline" name="filter_form" onSubmit="return submit_form()">
      <input type="hidden" name="page_no" id="page_no" value="<?=$page_no?>" />
        <div class="row" style="margin-top:20px;">
        	<div class="col-md-4">
            	<strong>Franchise:</strong><input type="text" name="franchise" id="franchise" class="form-control" value="<?php echo($franchise);?>" />
            </div>
        	<div class="col-md-4">
            	<strong>Student Name:</strong><input type="text" name="student_name" id="student_name" class="form-control" value="<?php echo($student_name);?>" />
            </div>
        	<div class="col-md-4">
            	<strong>Reg No:</strong><input type="text" name="reg_no" id="reg_no" class="form-control" value="<?php echo($reg_no);?>" />
            </div>
            <div class="clearfix" style="margin:10px 0;"></div>
        	<div class="col-md-6">
            	<strong>Reg Date From (YYYY-MM-DD):</strong>
                <input type="text" name="reg_date_from" id="reg_date_from" class="form-control" value="<?php echo($reg_date_from);?>" placeholder="e.g 2017-03-15" />
            </div>
        	<div class="col-md-6">
            	<strong>Reg Date To (YYYY-MM-DD):</strong>
                <input type="text" name="reg_date_to" id="reg_date_to" class="form-control" value="<?php echo($reg_date_to);?>" placeholder="e.g 2017-04-15" />
            </div>
            <div class="clearfix" style="margin:10px 0;"></div>
          <div class="col-md-4">
                <strong>Sort By :</strong>
                <select name="sort_by" id="sort_by" class="form-control">
                  <option value="name" <?php if($sort_by=="name"){ ?> selected <?php }?>>Name</option>
                  <option value="registration_date" <?php if($sort_by=="registration_date"){ ?> selected <?php }?>>Reg Date</option>
                  <option value="registration_no" <?php if($sort_by=="registration_no"){ ?> selected <?php }?>>Reg No</option>
                </select>
                <select name="order_by" id="order_by" class="form-control">
                    <option <?php if($order_by=='asc'){ ?> selected <?php }?>value="asc">
                    Ascending
                    </option>
                    <option <?php if($order_by=='desc'){ ?> selected <?php }?> value="desc">
                    Descending
                    </option>
                </select>
          </div>
          <div class="clearfix"></div>
          <div class="col-md-12" style="margin-top:10px;">
            	<a href="javascript:submit_form()"><div class="btn btn-success" style="margin-top:5px;">Submit</div></a>
            	<a href="all_students.php">
            		<div class="btn btn-danger" style="margin-top:5px;">Reset</div>
                </a>
          </div>
        </div>
      </form>   
      </section>
        <!-- Main content -->
        <section class="content">
        	<div class="row" style="margin-top:20px;">
        <div class="col-xs-12">
          <div class="box box-primary">
            <div class="box-body table-responsive">
              <table id="example2" class="table table-bordered table-hover">
                <thead>
                  <tr>
                    <th style="width:30px;">S.NO</th>
                    <th>NAME</th>
                    <th>REG NO</th>
                    <th>REG DATE</th>
                    <th>FRANCHISE</th>
                  </tr>
                </thead>
                <tbody>
                  <?php	
				  if($result==="not found")
				  {
				  ?>
                  <tr>
                  	<td colspan="6" style="color:#F00;">No records found...</td>
                  </tr>
                  <?php
				  }
				  else
				  {
					 $x=1;
					 while($DATA = $result->fetch_assoc())
					 {
		 				$sno=$page_no*PER_PAGE_STUDENTS+$x;
   				?>
								  <tr>
									<td><?php echo $sno;?></td>
									<td><?php echo $DATA['name'];?></td>
									<td><?php echo $DATA['registration_no'];?></td>
									<?php
                                    $dob=$DATA['registration_date'];
                                    if($dob!="0000-00-00")
                                    {
                                        $date_obj = new DateTime($dob);
                                        $dob=$date_obj->format(DATE_FORMAT);
                                    }
                                    ?>
                                    <td><?php echo($dob);?></td>
									<td><?php echo $DATA['franchise_name'];?></td>
								  </tr>
								  <?php
					  $x++;
					  }
				  }
	  ?>
                </tbody>
              </table>
            </div>
            <!-- /.box-body --> 
            
            <?php
			if($pages_return>1)
			{
			?>
                <div class="box-footer clearfix">
                  <ul class="pagination pagination-sm no-margin pull-right">
                  	<?php
					if($page_no==0)
					{
						echo("<li class=\"disabled\"><a href=\"#\">&laquo;</a></li>");
					}
					else
					{
						echo("<li><a href=\"javascript:submit_form_page_no('".($page_no-1)."')\">&laquo;</a></li>");
					}
					?>
                    <?php
					for($i=1;$i<=$pages_return;$i++)
					{
						$j=$i-1;
						echo("<li");
						if($j==$page_no)echo(" class=\"active\"");
						echo("><a href=\"javascript:submit_form_page_no('".$j."')\">".$i."</a></li>");
					}
					?>
                  	<?php
					if(($page_no+1)==$pages_return)
					{
						echo("<li class=\"disabled\"><a href=\"#\">&raquo;</a></li>");
					}
					else
					{
						echo("<li><a href=\"javascript:submit_form_page_no('".($page_no+1)."')\">&raquo;</a></li>");
					}
					?>
                  </ul>
                </div>
            <?php
			}
			?>
            
            
          </div>
          <!-- /.box --> 
        </div>
        <!-- /.col --> 
      </div>
        </section><!-- /.content -->
      </div><!-- /.content-wrapper -->
      <?php require("common/footer.php");?>

      

    </div><!-- ./wrapper -->
<?php require("common/footer_links.php");?>



<script>
function submit_form_page_no(temp_val)
{
	$("#page_no").val(temp_val);
	submit_form();
}
function submit_form()
{
	$("#blackout").css({'visibility':'visible'});
	document.filter_form.submit();
}
</script>
  </body>
</html>