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



      if($_REQUEST['from']!=" " && $_REQUEST['from']!=NULL ) {
        $from=date("Y-m-d",strtotime($_REQUEST['from']));  

      }else {
        $from=date("Y-m-01");  
      }
     
      if($_REQUEST['to']!=" " && $_REQUEST['to']!=NULL   ) {
        $to=date("Y-m-d",strtotime($_REQUEST['to']));
      }else {
        $to=date("Y-m-t");  
      } 
      
    
    
?>


<!DOCTYPE html>
<html lang="en">
  <head>
    
    <title>User Audit Report | EduPortal</title>
    <?php include('RootMe/css_links.php');?>
   
  </head>
<script type="text/javascript">



  function getExamAudit()
    {
    
         var from=document.getElementById("from").value;
         var to=document.getElementById("to").value;
         var user_id=document.getElementById("user_id").value;
         var action=document.getElementById("action").value;

  //alert(session_id+"=="+term_id+"=="+class_id+"=="+txt_section+"=="+user_id+"=="+action);

        var ajx;  // The variable that makes Ajax possible!

        if (window.XMLHttpRequest)
            ajx = new XMLHttpRequest();
        ajx.onreadystatechange = function ()
        {
          //alert("786");
            if (ajx.readyState == 4)
            {
               // alert(ajx.responseText);  
                document.getElementById("myID").innerHTML = ajx.responseText;

            }
        }
        
        ajx.open("GET", "get_user_exam_activity_report.php?from="+from+"&to="+to+"&user_id="+user_id+"&action="+action);
        ajx.send();

    }

</script>

<style type="text/css">
    .center {
  margin-left: auto;
  margin-right: auto;
}
  </style>

  <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;">

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


           
<section class="add_sub_agent" id="table_sub_agent">
  <div class="container">

 <div class="" style="margin-top:10px;">
      
        <div class="panel panel-default">
          <div class="panel-heading">Please Choose Parameters to View Report....! <span style="float:right;margin-top: -7px;">

          <input type="hidden" value="<?php echo session_id().session_id().session_id().session_id().session_id(); ?>" name="session" />
          

          </span><div class="clearfix"></div> </div>
          <div class="panel-body">
          
            <div class="col-md-12" id="" >


              


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

                  <select style="height:40px;" required name="user_id" id="user_id" class="chosen-multi-select form-control">

                              <option value="">Select User</option>
                        
                        <?php
                        $m->where("status", '0');
                        $m->where("branch_id", $_SESSION['branch']);
                        $Users = $m->get("edu_user_config");
                        foreach($Users as $User)
                        { ?>

                           <option <?php if($_REQUEST['user_id']==$User['user_id']){echo 'selected';}?> value="<?php echo $User['user_id']; ?>"><?php echo $User['user_fname']; ?></option>


                                <?php
                        } ?>

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



                <div class="col-md-3" style="padding:8px;"  id="col1">

                       <div class="form-group ">

                          <label class="required"> From Date</label>
                              <input name="from"  id="from" value="<?php echo $from;?>" type="date" class="form-control"  >
                       
                          </div>
                  </div>                      
             

                  <div class="col-md-3" style="padding:8px;"  id="col2">

                       <div class="form-group ">

                          <label class="required"> To Date</label>
                              <input name="to" id="to" value="<?php echo $to;?>" type="date" class="form-control"  >
                       
                          </div>
                  </div>   
                


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

                  <select style="height:40px;" name="action" id="action" class="chosen-multi-select form-control"  required>

                       <option value="">All Actions</option>
                        
                        <?php

                        $bb=$_SESSION['branch'];
                        $sql="SELECT action FROM eduportal_users_exam_auditlog_detail WHERE branch_id='$bb' group by action";
  
                         $Actions = $m->query($sql);
                       
                        foreach($Actions as $Action)

                        { ?>

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


                                <?php
                        } ?>
                        
                        

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


              

           <div class="col-md-2 " style="padding:2px;float: right;" >
                <div class="form-group ">
                  <label class="required" style="color:white;">Action</label>
                   <input type="hidden" name="addaccountAdmin" value="1">
                <button  onclick="getExamAudit()" class="btn btn-primary form-control">Search Records</button>
                </div>
          </div>

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

     

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

    
    
    <div id="myID">
   

    </div>
</div>



  </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');?>


    <!-- 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);}
    </script>

  </body>
</html>
