
<?php  include("sessioncheck.php"); ?>
<?php 
/* 
| Developed by: Tauseef Ahmad
| Last Upate: 01-19-2021 08:45 PM
| Facebook: www.facebook.com/ahmadlogs
| Twitter: www.twitter.com/ahmadlogs
| YouTube: https://www.youtube.com/channel/UCOXYfOHgu-C-UfGyDcu5sYw/
| Blog: https://ahmadlogs.wordpress.com/
 */ 
 
 
include_once 'Zoom_Api.php';
//generateJWTKey();
$zoom_meeting = new Zoom_Api();

$data = array();
$data['topic']    = 'Introduction CompuTech Company';
$data['start_date'] = date("Y-m-d h:i:s", strtotime('tomorrow'));
$data['duration']   = 30;
$data['type']     = 2;
$data['password']   = "12345";

try {
  $response = $zoom_meeting->createMeeting($data);
  
/* echo "<pre>";
 print_r($response);
 echo "<pre>";*/
  
  echo "Meeting ID: ". $response->id;
  echo "<br>";
  echo "Topic: "  . $response->topic;
  echo "<br>";
  echo "Join URL: ". $response->join_url ."<a href='". $response->join_url ."'>Open URL</a>";
  echo "<br>";
  echo "Meeting Password: ". $response->password;
    
  
} catch (Exception $ex) {
    echo $ex;
}


?>

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

      }else {
        $date=date("Y-m-d");  
      }

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

     
       $m->where("class_id", $_REQUEST['class_id']);  
            
   
      if($_REQUEST['session']!=NULL){

        $m->where("session_id", $_REQUEST['session']);        
      }
      
      if($_REQUEST['section']!=NULL){

        $m->where("section_id", $_REQUEST['section']);
        
      }

      if($_REQUEST['orderBy']=='RollNoWise'){
       $m->where("status", '0');
       $m->where("branch_id", $_SESSION['branch']);
       $m->orderBy("candidate_roll_no", "asc");
       $WorkAssignListings = $m->get("edu_student_details");
       } else {

       $m->where("status", '0');
       $m->where("branch_id", $_SESSION['branch']);
       $m->orderBy("first_name","asc");
       $WorkAssignListings = $m->get("edu_student_details"); 
       }
      }

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

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

     <script type="text/javascript">
         function getsecall(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("txt_section").innerHTML=xmlhttp.responseText;
        // alert(xmlhttp.responseText);

      }

    }

    xmlhttp.open("GET","get_section_all.php?class_id="+id,true);

    xmlhttp.send();




  }



  function getSubjectsLec(id){
     // alert(id);      
            var session=document.getElementById("session").value;
            var clas=document.getElementById("class_id").value;
            
            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("subject_id").innerHTML=xmlhttp.responseText;
                //alert(xmlhttp.responseText);

              }

            }

            xmlhttp.open("GET","get_subjects.php?section="+id+"&class="+clas+"&session="+session,true);

            xmlhttp.send();




          }
     </script>


<!DOCTYPE html>
<html lang="en">
  <head>
    
    <title>Add Lecture | 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">

 <div class="" style="margin-top:10px;">
  <h2>Add Video Lecture</h2>
      <form class="form-style-7" action="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php" method="post" enctype="multipart/form-data">
<?php 
        if(!isset($_GET['lectureup'])) { ?>
        <input type="hidden" name="action" value="add_video_lecture" />
        <input type="hidden" name="meeting_id" value="<?php echo $response->join_url;?>">
    <?php  } else {

          $query="select * from eduportal_student_videoLecture where videoLec_id =".$_GET['lectureup'];
          $lectureup = $m->query($query);

        ?>
              <input type="hidden" name="action" value="update_videoLecture" />
              <input type="hidden" name="videoLec_id"  value="<?php echo $_GET['lectureup'];?>">

  <?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-3 col-sm-12 col-xm-12 floatm" 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="getsecall(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-sm-12 col-xm-12 floatm" style="padding: 8px;">
                <div class="form-group ">
                  <label class="required">Section</label>
                    <select name="section" id="txt_section" class="form-control" onChange="getSubjectsLec(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-2 col-sm-12 col-xs-12" style="padding:8px; float:left;"  id="col1">
                 <div class="form-group ">

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

             
                  <div class="item form-group">
                    <h2 style="">Details</h2> 
                        <div class="col-md-12 col-sm-12 col-xs-12">
                          <textarea id="textarea" required="required" name="details" class="ckeditor"> <?php echo $lectureup[0]['Description']; ?></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="youtube_link" placeholder="e.g https://www.youtube.com/" value="<?php echo $lectureup[0]['youtube_link']; ?>" type="text" class="form-control"  >
                       
                  </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;">Save</button>
                </div>
          </div>

             
          
            <div class="clearfix"></div>
          </div>
        </div>
      </form>
 
    </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>


  </body>
</html>
