<?php include("parent/callMe.php"); ?>
<?php  include("sessioncheck.php"); ?>
<?php

$branch=$brid;

   $sessionIDid;

   if($_REQUEST['session']!=NULL){

      $sessionIDid=$_REQUEST['session'];
      
    }else {
      
      $sessionIDid=$_SESSION['current_session'];
    }


if($_REQUEST['class_id']!=NULL){

     
      $branch=$_SESSION['branch'];
      $sql = "SELECT student_id, first_name, last_name,image, ref_no, cell_no, status, branch_id, class_id, candidate_roll_no, section_id, session_id FROM  edu_student_details  WHERE branch_id='$branch' and status='0' ";

      if($_REQUEST['class_id']!=NULL){
      $sql .= " AND class_id ='" . $_REQUEST['class_id']. "' ";
      }

      if($_REQUEST['section']!=NULL){
      $sql .= " AND section_id ='" . $_REQUEST['section']. "' ";
     }

     if($_REQUEST['session']!=NULL){
      $sql .= " AND session_id ='" . $_REQUEST['session']. "' ";
     }

    
      //print_r($sql);
     $WorkAssignListings = $m->query($sql);


      }
 
     ?>


<!DOCTYPE html>
<html lang="en">
  <head>
    
    <title>Update Student Picture | EduPortal</title>
    <?php include('RootMe/css_links.php');?>


   
  </head>
  

  <body class="nav-md">
    <div class="container body">
      <div class="main_container">
        <div class="col-md-3 left_col">
     
            <?php include('RootMe/sidebar.php');?>

              <?php include('RootMe/header.php');?>
     
        <!-- page content -->
          <div class="right_col" role="main">
          <div class="" style="background-color: white;">
           
  <section class="add_sub_agent" id="table_sub_agent">
  <div class="container">


    <a href="<?php echo $_SESSION['dashboard'];?>">Dashboard </a> &nbsp; <i style="" class="fa fa-angle-double-right"></i>  &nbsp; 

     <a href="students_reports_link.php">Students Reports </a> &nbsp; <i style="" class="fa fa-angle-double-right"></i>  &nbsp; 
          
      Update Classwise Pictures

          <br><br>

 <div class="" style="margin-top:10px;">
      <form  action="update_student_pictures.php" enctype="multipart/form-data" method="get">
        <div class="panel panel-default">
          <div class="panel-heading"><?php echo count($WorkAssignListings);?> Students Records <span style="float:right;margin-top: -7px;">
         

<div class="pull-right">         

  <a onClick="$('#advanceSearch').toggle('blind')" class="btn btn-primary" style="cursor:pointer;">Advance Search</a>


</div>



          </span><div class="clearfix"></div> </div>
          <div class="panel-body">
          
            <div class="col-md-12" id="advanceSearch" style="display:none;">


                            
              <div class="col-md-2 col-xs-12" style="padding: 8px;">
                <div class="form-group ">
                  <label class="required">Session</label>
                    <select name="session" id="session" class="form-control" required="" >

                              <option value="">Select Session</option>
                        

                        <?php
 
 
                        $WorkAssignList = $m->get("edu_session_config");
                        foreach($WorkAssignList as $WorkAssignListVal)
                        { ?>

                           <option <?php if($sessionIDid==$WorkAssignListVal['session_id']){echo 'selected';}?> value="<?php echo $WorkAssignListVal['session_id']; ?>"><?php echo $WorkAssignListVal['session_year']; ?></option>


                                <?php
                        } ?>

                    </select>
                </div>
              </div>


           <div class="col-md-3 col-xs-12" style="padding: 8px;">
                <div class="form-group ">
                  <label class="required">Class</label>
 

                  <select name="class_id" id="class_id"  name="term_id"   data-placeholder="Select" class="chosen-multi-select inputfield form-control" onChange="getsec(this.value)"  >
                    <option value="">Select Class</option>

                    <?php
                    $m->where("branch_id", $_SESSION['branch']);
                    $WorkAssignList = $m->get("edu_class_config");
                    foreach($WorkAssignList as $WorkAssignListVal)
                    { ?>

                       <option <?php if($_REQUEST['class_id']==$WorkAssignListVal['class_id']){echo 'selected';}?> value="<?php echo $WorkAssignListVal['class_id']; ?>"><?php echo $WorkAssignListVal['Class_Name']; ?></option>


                            <?php
                    } ?>

                </select> 
                </div>
              </div>

                 <div class="col-md-2 col-xs-12" style="padding: 8px;">
                <div class="form-group ">
                  <label class="required">Section</label>
                    <select name="section" id="txt_section" class="form-control" onChange="getSubjects(this.value)">
                      
                   <?php
                              if($_REQUEST['section']!='')
                              { 

                              $m->where("class_id", $_REQUEST['class_id']);    

                              $secondLevel = $m->get("edu_adm_section_detail");
                              
                              foreach($secondLevel as $secondLevel_val)
                              {
                              
                               ?>
                                <option <?php if($_REQUEST['section']==$secondLevel_val['section_id']){echo "selected";} ?> value="<?php echo $secondLevel_val['section_id']; ?>"><?php echo trim(utf8_encode_all($secondLevel_val['section_name'])); ?></option>

                              <?php }   ?>
                                
                          <?php } ?>

                    </select>

                  
                </div>
              </div>
           
           <div class="col-md-3 pull-right" style="padding:2px;" >
                <div class="form-group ">
                   <input type="hidden" name="addaccountAdmin" value="1">
                <button type="submit" class="btn btn-primary" style="margin-top: 24px;float: right;">Search</button>
                </div>
          </div>

             
            </div>
            <div class="clearfix"></div>
          </div>
        </div>
      </form>
      <div class="clearfix"></div>
    </div>
    <br>
     
          
          <?php  if(isset($_SESSION['error'])){?>

            <div class="alert alert-danger" id="msg">
             <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
              <strong>Warning!</strong> Result already saved of this class, Please try another one.
            </div>

          <?php  unset($_SESSION['error']); }?>

      

          
          <?php  if(isset($_SESSION['fee_settings'])){?>


            <div class="alert alert-success" id="msg">
             <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
              <strong>Success!</strong> Fee updated successfully...
            </div>

          <?php  unset($_SESSION['fee_settings']); }?>

      
<div style="overflow-x:auto;">

<form class="form-style-7" action="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php" method="post"  onSubmit="return student_check();"  enctype="multipart/form-data">

  <input type="hidden" name="action" value="UpdateClassWiseStudentPicture">
  <input type="hidden" id="class_id"  name="class_id" value="<?php echo $_GET['class_id']; ?>" />
  <input type="hidden" id="session"  name="session" value="<?php echo $sessionIDid; ?>" />
  <input type="hidden" id="section"  name="section" value="<?php echo $_GET['section']; ?>" />
  
        <div class="col-md-9">
          
           <div id="check_std_msg" style="display:none;" class="alert alert-warning alert-dismissible">
                    <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
                     <strong>Warning !</strong> Please select class to save fee settings !!!
            </div>
    
          <?php  if(isset($_SESSION['error_msg'])){?>

           <div id="error"  class="alert alert-warning alert-dismissible">
                    <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
                     <strong>Warning !</strong> You have already saved the f of this class !!!
            </div>

         <?php  unset($_SESSION['error_msg']); }?>

        </div>


        <div class="col-md-1 pull-right" style="margin-bottom:1%;">
              <input type="submit" name="submit" class="pull-right btn btn-primary"  value="Update Records"/>
        </div>
      <table data-page-length='100' class="table table-striped table-bordered" style="width:100%">
          
          <thead>
            <tr>
                <th width="3%">S.No</th>
                <th width="15%" style="text-align:center;"> Student Name </th>
                <th width="15%" style="text-align:center;"> Father Name </th>
                <th width="10%">Roll Number</th>              
                <th width="11%" style="text-align:center;"> Class </th>
                <th width="20%" style="text-align:center;"> Upload Picture  </th>
  
            </tr>
        </thead>
        <tbody>
   
     
     <?php $count=1;

      foreach($WorkAssignListings as $WorkAssignListVal)
      { 
        

      ?>

        <tr>
                  <td style="text-align:center;"> <?php echo $count; $count+=1;?> </td>
                  

                     <input name="students[]" id="students[]" type="hidden" value="<?php echo $WorkAssignListVal['student_id'];?>">
                  
                   <td>

                     <?php if($WorkAssignListVal['image']!=NULL){?>

                    <img style="border-radius:50%;height:30px;width:30px;" src="<?php echo DOMAIN.AgentDirectory;?>/students_pics/<?php echo $WorkAssignListVal['image'];?>"  />
                  <?php }else {?>

                    <img style="border-radius:50%;height:30px;with:30px;" src="images/student.png" />

                  <?php }?>

                    <?php echo $WorkAssignListVal['first_name'];?></td>
                  <td><?php echo $WorkAssignListVal['last_name'];?></td>
                  <td> <?php echo $WorkAssignListVal['candidate_roll_no'];?> </td>

                  <td style="text-align:center;"> <?php echo getClassName($m,$_GET['class_id']);?> - <?php echo getSectionName($m,$WorkAssignListVal['section_id']);?> </td>

                  <td><input type="file" name="img_file[]" id="img_file" />
                    
                  <input type="hidden" name="old_imgs[]" value="<?php echo $WorkAssignListVal['image'];?>" />
                  </td>
                  
                                              
                 
              </tr>

              <?php
      } ?>

         
           
        </tbody>
        
    </table>
 

</form>
</div>
    <br><br>


  </div>
  <div class="clearfix"></div>
</section>          
    

           
          </div>
        </div>

            </div>
          </div>
        </div>
        <!-- /page content -->
  
<!-- jQuery -->
    <script src="js/ajax_functions.js"></script> 
    
  <?php include('RootMe/js_linksscript.php');?>
  </body>
</html>
 