<?php include("parent/callMe.php"); ?>
<?php  include("sessioncheck.php"); ?>
<?php
$date; ?>
<!DOCTYPE html>
<html lang="en">
  <head>
    
    <title>Add Diary | 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">
  <div class="container">

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

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

    <?php 
        if(!isset($_GET['taskup'])) { ?>
        <input type="hidden" name="action" value="Add_Teacher_Task" />
    <?php  } else {

          $query="select * from eduportal_teachers_task where task_id =".$_GET['taskup'];
          $taskup = $m->query($query);
    ?>
        <input type="hidden" name="action" value="update_task" />
        <input type="hidden" name="task_id"  value="<?php echo $_GET['taskup'];?>">

  <?php } ?> 

        <div class="panel panel-default">
         
          <div class="panel-body">

                <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">Class</label>
 

                  <select name="class_id" id="class_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-2 col-sm-12 col-xm-12 floatm" style="padding: 8px;">
                <div class="form-group ">
                  <label class="required">Subject</label>
                    <select name="subject_id" id="subject_id" class="form-control"  style="padding-left:2px;" required>
                      <option value="">Select Subject</option>
                              
                        <?php
                        $m->where("branch_id", $_SESSION['branch']);
                        $WorkAssignList = $m->get("eduportal_subject_config");
                        foreach($WorkAssignList as $WorkAssignListVal)
                        { ?>

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


                    <?php } ?>

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



             <div class="col-md-3 col-sm-12 col-xs-12" style="padding:8px; float:left;"  id="col1">
                 <div class="form-group ">

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

             

              <div class="col-md-12 col-sm-12 col-xs-12">

                 <div class="item form-group">
                    <h2 style="">Task Details</h2> 
                       
                    <textarea id="textarea" required="required" name="details" class="ckeditor"> <?php echo $taskup[0]['task_details']; ?></textarea>
                  </div>
              </div>


              <div class="col-md-12 col-sm-12 col-xs-12" style="padding:8px; float:left;"  id="col1">
                 <div class="form-group ">

                 <label class="required"> Insert Youtube Link</label>
                 <input name="YoutubeLink" placeholder="e.g https://www.youtube.com/" value="<?php echo $taskup[0]['task_youtube_link']; ?>" type="text" class="form-control"  >
                       
                  </div>
               </div>

              <div class="col-md-3 col-sm-12 col-xs-12" style="padding:8px; float:left;" >
                 <div class="form-group ">

                 <label> Upload Image</label>
                 <input type="file" class="form-control has-feedback-left" name="img_file" id="img_file" />
                 <input type="hidden" value="<?php echo $taskup[0]['image']; ?>" name="old_file" />
                       
                  </div>
              </div>

               <!-- <div class="col-md-3 col-sm-6 col-xs-12 form-group has-feedback">
                        <input type="file" class="form-control has-feedback-left" name="img_file" id="img_file" />
                        <span class="form-control-feedback right" aria-hidden="true">Upload Image</span>
              </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;">Save</button>
                </div>
          </div>

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

<div class="col-md-12">

          
         


<h3>List Of Task</h3>
    <div style="overflow-x:auto;">

 
    <table id="listofstudents1" data-page-length='100' class="table table-striped table-bordered" style="width:100%">
          
          <thead>
            <tr>
                <th width="3%">S.No</th>
                <th width="10%">Class Name</th>
                <th width="10%">Date</th>
                <th width="10%">Image</th>
                <th width="10%">Youtube Link</th>
                <th width="37%">Diary Details</th>
                <th width="10">Access</th>
                <th width="10%">Action</th>
              
                 
            </tr>
        </thead>
        <tbody>

     <?php $count=1;

       $m->where("branch_id", $_SESSION['branch']);
       $m->orderBy("task_id", "desc");
       $WorkAssignListings = $m->get("eduportal_teachers_task");

      foreach($WorkAssignListings as $WorkAssignListVal)
      { 

        $m->where("class_id", $WorkAssignListVal['class_id']);
        $class=$m->get("edu_class_config");

        $m->where("section_id", $WorkAssignListVal['section_id']);
        $section=$m->get("edu_adm_section_detail");

      ?>

        <tr>
                  <td style="text-align:center;"> <?php echo $count; $count+=1;?> </td>
                  <td style="text-align:center;"> <?php echo $class[0]['Class_Name'];?> - <?php echo $section[0]['section_name'];?> </td>
                  <td style=""> <?php echo $WorkAssignListVal['task_date'];?> </td>
                  <td style=""> 
                  

            <?php 

            $extention=substr($WorkAssignListVal['image'],-4);        
            

             if($extention==".png" || $extention==".PNG" || $extention==".jpg" || $extention==".JPEG") {?>

                     <a href="teacher_task_img/<?php echo $WorkAssignListVal['image'];?>" >
                        <img style="height:50px;width:60px;" src="teacher_task_img/<?php echo $WorkAssignListVal['image'];?>"  />
                      </a>
                    <?php  } else if($extention==".pdf" || $extention==".PDF") { ?> 
                    

                  <a class="btn btn-success" target="_blank" href="teacher_task_img/<?php echo $WorkAssignListVal['image'];?>">Download file </a>

                  <?php echo $WorkAssignListVal['image'];?>
    
            <?php } else {echo "No Attachment..."; }?>



                   </td>
                  
                  <td style=""> <?php echo $WorkAssignListVal['task_youtube_link'];?> </td>

                  <td style=""> <?php echo $WorkAssignListVal['task_details'];?> </td>
                  <td>
                    <a style="padding: 0px 5px;" href="assignTask.php?taskId=<?php echo $WorkAssignListVal['task_id'];?>" class="iframePupop btn btn-success" >
                    Assign
                   </a>
                  </td>
                  <td>
                     <a style="padding: 0px 5px; font-size:14px;"  href="teachers_task.php?<?php echo session_id().session_id().session_id().session_id().session_id();?>&taskup=<?php echo $WorkAssignListVal['task_id'];?>&session=<?php echo $WorkAssignListVal['session_id'];?>&class_id=<?php echo $WorkAssignListVal['class_id'];?>&section=<?php echo $WorkAssignListVal['section_id'];?>&taskDate=<?php echo $WorkAssignListVal['task_date'];?>&subject=<?php echo $WorkAssignListVal['subject_id'];?>" style="cursor:pointer;"  class="btn btn-success"> <i class="fa fa-pencil" aria-hidden="true"></i></a> 



                     <a href="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php?id=<?php echo $WorkAssignListVal['task_id'];?>&action=DeleteTeacherTask" style="padding: 0px 5px; font-size:14px;" onClick="return confirm('Are you sure you want to delete this record');"  class="btn btn-danger"><i class="fa fa-remove"></i> </a>
                   </td>
                 
              </tr>





              <?php
      } ?>



           
            
           
        </tbody>
        
    </table>
  
  </div>

    <br><br>


  </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 src="https://cdn.ckeditor.com/4.12.1/standard/ckeditor.js"></script>


<link rel="stylesheet" href="colorbox.css" />

<script src="jquery.colorbox.js"></script>

 <script>

$(document).ready(function(){

$(".iframePupop").colorbox({iframe:true, width:"50%", height:"70%"});

});

</script>


  </body>
</html>
