Skip to main content

Get Google Calendar Event List in WordPress

<a href="https://console.cloud.google.com/apis/credentials">Get Your Api Credentials Here</a> <a href="https://calendar.google.com/calendar">Get your Calender ID</a> <?php include_once("wp-load.php"); function  get_calender_events() { $params = array(); /*Get current date*/ $current_date  = date('Y-m-d H:i:s'); /*Convert it to google calendar's rfc_format */ $rfc_format = date("c", strtotime($current_date)); $params[] = 'orderBy=startTime'; $params[] ='maxResults=100'; $params[] = 'timeMin='.urlencode($rfc_format); $url_param = ''; foreach($params as $param) { $url_param.= '&'.$param; } $calender_id = "calender_id"; $client_key =  "client_key"; $url = "https://www.googleapis.com/calendar/v3/calendars/".$calender_id."/events?key=".$client_key."&singleEvents=true".$url_param; $list_events = wp_remote_post($url, ...

Add video category and video url of Youtube in WP

<?php
//
add_action( 'admin_menu', 'video_details_page' );
function video_details_page(){
    add_menu_page( 'Video Details', 'Video Details', 'manage_options','video_details', 'video_details_options');
    add_submenu_page(
            'video_details', 'Add Video Category', 'Add Video Category', 'manage_options', 'video_category', 'video_category_display_here'
    );
 add_submenu_page(
            'video_details', 'Edit Video Category', 'Edit Video Category', 'manage_options', 'edit_video_cat', 'edit_video_category'
    );
  add_submenu_page(
            'video_details', 'Add Video', 'Add Video', 'manage_options', 'new_video_details', 'video_options_display_here'
    );
 add_submenu_page(
            'video_details', 'Edit Video', 'Edit Video', 'manage_options', 'edit_video_details', 'edit_video_options_display_here'
    );
}
//add category
function video_category_display_here(){
 ?>
<link rel="stylesheet" media="all" type="text/css" href="http://code.jquery.com/ui/1.8.23/themes/smoothness/jquery-ui.css" />
<!--<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.min.js"></script>-->
<script type="text/javascript" src="http://code.jquery.com/ui/1.8.23/jquery-ui.min.js"></script>
<script type="text/javascript" src="http://js.nicedit.com/nicEdit-latest.js"></script> <script type="text/javascript">
bkLib.onDomLoaded(function() {
new nicEditor({maxHeight : 1000}).panelInstance('description');
});
jQuery(function() {
jQuery('#start_date').datepicker({minDate:0});
});
</script>
<script>
function add_video_categorys()
{
 var category_name=jQuery("#category_name").val();
 var startdate=jQuery("#start_date").val();
 var description=jQuery("#description").val();
 formData = jQuery("form").serialize();
 formData = formData;

 if(category_name!="") {
         jQuery.ajax({
          type:'POST',
          data:formData,
          url: '<?php echo  get_site_url(); ?>/wp-content/themes/superiorkneerehab/action.php',
          success: function(value) {
        location.reload();
     //window.location.href = "<?php echo  get_site_url(); ?>/wp-admin/admin.php?page=video_details&msg=event_added";
          },
        }); 
 }
else {
 jQuery("#msg").html("Please fill mandatory fields");//alert(jQuery("#msg").html());
 jQuery("#msg").show();
 jQuery("#category_name").css("border-color", "red")
}
}
</script>
<style>
table td span{ color:#F00;}
table td input{ font-size:11px;}
table td textarea{ overflow:hidden; font-size:11px;}
table td{ font-size:11px;}
@media screen and (max-width:320px) {
.add_event{ overflow-x:scroll;}
}
.red{color:#dc1522; line-height:30px; font-weight:700;}
.green{color:#00c42e; line-height:30px; font-weight:700;}
</style>
<div class="wrap">
<h2>Add Video Category<a href="<?php echo  get_site_url();?>/wp-admin/admin.php?page=video_details" class="add-new-h2">Back</a></h2>
</div>
 <form id="video_category" action="" method="post">
<table width="50%" border="0" cellspacing="1" cellpadding="5" bgcolor="#e5e5e5">
 <THEAD>
 <h3>Please fill below information </h3>
 <span id="msg" class='red' style="display:none"></span>
 </THEAD>
 <TBODY>
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Category Name <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="category_name" id="category_name" value="" required/>
   <input type="hidden" name="action" id="action" value="add_video_category"/>
   </td>
  </tr>
   <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Sort Order</td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="sort_order" id="sort_order" value=""/>
   <input type="hidden" name="action" id="action" value="add_video_category"/>
   </td>
  </tr>
  </tr>
  <tr>
    <td align="center" valign="top" bgcolor="#FFFFFF" colspan="2">
    <input type="button" class="button" onclick="add_video_categorys()" name="add_video_category" id="add_video_category" value="Submit">
    </td>
  </tr>
  </TBODY>
 </table>
 </form>
 <?php

// view all category
global $wpdb;
$start_from = ($pageno-1) * $num_rec_per_page;
$sql = "SELECT * FROM video_category";
$pageposts = $wpdb->get_results($sql);?>
<script>
 function delete_category(id){
 flag=confirm("Do you really want to delete record");
 if(flag==true)
  {
        jQuery.ajax({
          type:'POST',
          data:{action:'delete_category',id:id},
          url: '<?php echo  get_site_url(); ?>/wp-content/themes/superiorkneerehab/action.php',
          success: function(value) {  
      location.reload();
           //jQuery("#showcontent").html(value);
          },
        }); 
  }
}
function add_record()
{
 jQuery.ajax({
          type:"GET",
          data:{action:"add_event"},
          url: "<?php echo get_site_url() ?>/wp-admin/admin-ajax.php",
          success: function(value) {
     jQuery("#wpbody-content").html(value);
     jQuery(".tablenav-pages").hide();
          // jQuery("#showcontent").html(value);
          },
          //complete: function(){
            //jQuery("#showcontent").html(val);
          //}
        });
}
function view_record(id)
{
 jQuery.ajax({
          type:"GET",
          data:{action:"view_event",id:id},
          url: "<?php echo get_site_url() ?>/wp-admin/admin-ajax.php",
          success: function(value) {
     jQuery("#wpbody-content").html(value);
     jQuery(".tablenav-pages").hide();
          // jQuery("#showcontent").html(value);
          },
        });
}
function edit_video_record(id)
{
 jQuery.ajax({
          type:"GET",
          data:{action:"edit_video_category",id:id},
          url: "<?php echo get_site_url() ?>/wp-admin/admin-ajax.php",
          success: function(value) {
     jQuery("#wpbody-content").html(value);
     jQuery(".tablenav-pages").hide();
          // jQuery("#showcontent").html(value);
          },
        });
}
function send_invitation(id)
{
 jQuery.ajax({
          type:"GET",
          data:{action:"send_invitation",id:id},
          url: "<?php echo get_site_url() ?>/wp-admin/admin-ajax.php",
          success: function(value) {
   
     jQuery("#wpbody-content").html(value);
     jQuery(".tablenav-pages").hide();
          // jQuery("#showcontent").html(value);
          },
        });
}
function view_sent(id)
{
 jQuery.ajax({
          type:"GET",
          data:{action:"view_sent",id:id},
          url: "<?php echo get_site_url() ?>/wp-admin/admin-ajax.php",
          success: function(value) {
   
     jQuery("#wpbody-content").html(value);
     jQuery(".tablenav-pages").hide();
          // jQuery("#showcontent").html(value);
          },
        });
}
function view_attendee(id)
{
 jQuery.ajax({
          type:"GET",
          data:{action:"view_attendee",id:id},
          url: "<?php echo get_site_url() ?>/wp-admin/admin-ajax.php",
          success: function(value) {
   
     jQuery("#wpbody-content").html(value);
     jQuery(".tablenav-pages").hide();
          // jQuery("#showcontent").html(value);
          },
        });
}

</script>
<style>
.title_text{font-size:12px;}
table td{ font-size:11px;}
.event_table{ padding:0 10px 0 0;}
.red{color:#dc1522; line-height:30px; font-weight:700;}
.green{color:#00c42e; line-height:30px; font-weight:700;}
.pagination{ float:right; margin:10px 10px 0 0; border:#CCCCCC solid 1px; background:#FFFFFF;}
.pagination a{ border-right:#CCCCCC solid 1px; padding:0 10px; line-height:20px; text-decoration:none;}
.pagination a:last-child{ border-right:none;}
</style>

<?php if($_GET['msg']=='event_added'){
echo '<span id="msg" class="green">Video is added Successfully.</span>';
}else if($_GET['msg']=='event_edited'){
echo '<span id="msg" class="green">Video is edited Successfully.</span>';
}?>
<div class="event_table">
<table width="100%" border="0" cellspacing="1" cellpadding="5" bgcolor="#e5e5e5">
  <tr>
    <td align="center" valign="middle" bgcolor="#dfdfdf" class="title_text"><strong>Category Name</strong></td>
  <td align="center" valign="middle" bgcolor="#dfdfdf" class="title_text"><strong>Sort Order</strong></td>
    <td align="center" valign="middle" bgcolor="#dfdfdf" class="title_text"><strong>Action</strong></td>
  </tr>
<?php
foreach ($pageposts as $singlepost) {
?>
  <tr>
    <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $singlepost->category_name;?></td>
 <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $singlepost->sort_order;?></td>
   <td align="left" valign="top" bgcolor="#FFFFFF">

 <a href="<?php echo get_site_url() ?>/wp-admin/admin.php?page=edit_video_cat&id=<?php echo $singlepost->id;?>" onclick="edit_record(<?php echo $singlepost->id;?>);">Edit</a>&nbsp;&nbsp;<span>|</span>&nbsp;&nbsp;

 <a href="javascript:void(0);" onclick="delete_category(<?php echo $singlepost->id;?>);">Delete</a>
 </td>
  </tr>
<?php
}
?>
</table></div>
<?php
}


//edit video category
//add_action('wp_ajax_edit_video_category','edit_video_category'); 
//add_action('wp_ajax_nopriv_edit_video_category','edit_video_category'); 
function edit_video_category()
{
global $wpdb;
$id=$_GET['id'];
$sql="select * from video_category where id='$id'";
$events = $wpdb->get_row($sql);
//print_r($events);
?>
<script>
function editevent()
{
 var title=jQuery("#title").val();
 var startdate=jQuery("#start_date").val();
 var description=jQuery("#description").val();
     if(title!="" && startdate!="") {
         jQuery.ajax({
          type:'POST',
          data:jQuery("form").serialize(),
          url: '<?php echo  get_site_url(); ?>/wp-content/themes/superiorkneerehab/action.php',
          success: function(value) {  
   //  location.reload();
           //jQuery("#showcontent").html(value);
          },
        }); 
  }
     else {
 jQuery("#msg").html("Please fill mandatory fields");//alert(jQuery("#msg").html());
 jQuery("#msg").show(); 
  } 
}
function file_del(file,id)
{
 flag=confirm("Do you really want to delete file");
 if(flag==true)
  {
         jQuery.ajax({
          type:'POST',
          data:{action:"file_del",id:id,file:file},
          url: '<?php echo  get_site_url(); ?>/wp-content/themes/superiorkneerehab/action.php',
          success: function(value) {  
    location.reload();
           //jQuery("#showcontent").html(value);
          },
        }); 
  }}
  
</script>
<style>
table td span{ color:#F00;}
table td input{ font-size:11px;}
table td textarea{ overflow:hidden; font-size:11px;}
table td{ font-size:11px;}
@media screen and (max-width:320px) {
.add_event{ overflow-x:scroll;}
}
.red{color:#dc1522; line-height:30px; font-weight:700;}
.green{color:#00c42e; line-height:30px; font-weight:700;}
</style>
<div class="add_event">
<form id="editevent" action="<?php echo  get_site_url(); ?>/wp-content/themes/superiorkneerehab/action.php" method="post" enctype="multipart/form-data">
<table width="50%" border="0" cellspacing="1" cellpadding="5" bgcolor="#e5e5e5">
 <THEAD>
 <h3>Please fill below information, </h3>
 <span id="msg" class='red' style="display:none"></span>
 </THEAD>
 <TBODY>
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Category Name <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="category_name" id="category_name" value="<?php echo $events->category_name; ?>"/>
   <input type="hidden" name="action" id="action" value="edit_video_category"/>
   <input type="hidden" name="id" id="id" value="<?php echo $events->id; ?>"/>
   </td>
  </tr>
    <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Pdf File</td>
   <td align="left" valign="top" bgcolor="#FFFFFF">
     <input type="file" id="file" name="files[]" multiple="multiple" />
  <?php $files = explode(",",$events->pdf_file);
  $url=get_site_url();
  $id=$events->id;
foreach($files as $file)
{
 if($file!="")
 {
 

 $c++;
 echo "<br>";
 echo "<a target='_blank' href='$url/wp-content/themes/superiorkneerehab/uploads/$file'>$file</a>";
 echo "  &nbsp;"; ?>
 <a href='#' onclick='file_del("<?php echo $file.',' ?>","<?php echo $id ?>")'>Delete</a>
 <?php

 echo "<br>";
 }
}
  ?>
   </td>
  </tr>
    <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Order</td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="sort_order" id="sort_order" value="<?php echo $events->sort_order; ?>"/>
   <?php explode(" ",$str) ?>
 
   </td>
  </tr>
 
  <tr>
    <td align="center" valign="top" bgcolor="#FFFFFF" colspan="2">
    <input type="submit" onclick="editevent()" name="edit_event" id="edit_event" value="Submit" class="button">
    </td>
  </tr>
  </TBODY>
 </table>
 </form>
 </div>
<?php die;}
//end video category

//view video link
function video_details_options()
{
global $wpdb;
$sql = "SELECT * FROM video_link order by video_category_id asc";
$pageposts = $wpdb->get_results($sql);?>
<script>
 function delete_event(id){
 flag=confirm("Do you really want to delete record");
 if(flag==true)
  {
        jQuery.ajax({
          type:'POST',
          data:{action:'delete_event',id:id},
            url: '<?php echo  get_site_url(); ?>/wp-content/themes/superiorkneerehab/action.php',
          success: function(value) {  
      location.reload();
           //jQuery("#showcontent").html(value);
          },
        }); 
  }
}
function add_record()
{
 jQuery.ajax({
          type:"GET",
          data:{action:"add_event"},
          url: "<?php echo get_site_url() ?>/wp-admin/admin-ajax.php",
          success: function(value) {
     jQuery("#wpbody-content").html(value);
     jQuery(".tablenav-pages").hide();
          // jQuery("#showcontent").html(value);
          },
          //complete: function(){
            //jQuery("#showcontent").html(val);
          //}
        });
}
function view_record(id)
{
 jQuery.ajax({
          type:"GET",
          data:{action:"view_event",id:id},
          url: "<?php echo get_site_url() ?>/wp-admin/admin-ajax.php",
          success: function(value) {
     jQuery("#wpbody-content").html(value);
     jQuery(".tablenav-pages").hide();
          // jQuery("#showcontent").html(value);
          },
        });
}
function edit_record(id)
{
 jQuery.ajax({
          type:"GET",
          data:{action:"edit_event",id:id},
          url: "<?php echo get_site_url() ?>/wp-admin/admin-ajax.php",
          success: function(value) {
     jQuery("#wpbody-content").html(value);
     jQuery(".tablenav-pages").hide();
          // jQuery("#showcontent").html(value);
          },
        });
}
function send_invitation(id)
{
 jQuery.ajax({
          type:"GET",
          data:{action:"send_invitation",id:id},
          url: "<?php echo get_site_url() ?>/wp-admin/admin-ajax.php",
          success: function(value) {
   
     jQuery("#wpbody-content").html(value);
     jQuery(".tablenav-pages").hide();
          // jQuery("#showcontent").html(value);
          },
        });
}
function view_sent(id)
{
 jQuery.ajax({
          type:"GET",
          data:{action:"view_sent",id:id},
          url: "<?php echo get_site_url() ?>/wp-admin/admin-ajax.php",
          success: function(value) {
   
     jQuery("#wpbody-content").html(value);
     jQuery(".tablenav-pages").hide();
          // jQuery("#showcontent").html(value);
          },
        });
}
function view_attendee(id)
{
 jQuery.ajax({
          type:"GET",
          data:{action:"view_attendee",id:id},
          url: "<?php echo get_site_url() ?>/wp-admin/admin-ajax.php",
          success: function(value) {
   
     jQuery("#wpbody-content").html(value);
     jQuery(".tablenav-pages").hide();
          // jQuery("#showcontent").html(value);
          },
        });
}

</script>
<style>
.title_text{font-size:12px;}
table td{ font-size:11px;}
.event_table{ padding:0 10px 0 0;}
.red{color:#dc1522; line-height:30px; font-weight:700;}
.green{color:#00c42e; line-height:30px; font-weight:700;}
.pagination{ float:right; margin:10px 10px 0 0; border:#CCCCCC solid 1px; background:#FFFFFF;}
.pagination a{ border-right:#CCCCCC solid 1px; padding:0 10px; line-height:20px; text-decoration:none;}
.pagination a:last-child{ border-right:none;}
</style>
<div class="wrap">
<h2>Video Details <a href="<?php echo  get_site_url();?>/wp-admin/admin.php?page=new_video_details" class="add-new-h2">Add New Video</a>
</h2>
</div>

<div class="event_table">
<table width="100%" border="0" cellspacing="1" cellpadding="5" bgcolor="#e5e5e5">
  <tr>
  <!-- <td align="center" valign="middle" bgcolor="#dfdfdf" class="title_text"><strong>video_name</strong></td>-->
  <td align="center" valign="middle" bgcolor="#dfdfdf" class="title_text"><strong>video_url</strong></td>
  <td align="center" valign="middle" bgcolor="#dfdfdf" class="title_text"><strong>video_title</strong></td>
     <td align="center" valign="middle" bgcolor="#dfdfdf" class="title_text"><strong>video_order</strong></td>  
  <td align="center" valign="middle" bgcolor="#dfdfdf" class="title_text"><strong>video_category_id</strong></td>
    <td align="center" valign="middle" bgcolor="#dfdfdf" class="title_text"><strong>Level</strong></td>
 <td align="center" valign="middle" bgcolor="#dfdfdf" class="title_text"><strong>Action</strong></td>
  </tr>
<?php
foreach ($pageposts as $singlepost) {
?>
  <tr>
  <!--  <td align="left" valign="top" bgcolor="#FFFFFF"><?php //echo $singlepost->video_name;?></td>-->
  <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $singlepost->video_url;?></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $singlepost->video_title;?></td>
    <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $singlepost->video_order;?></td>
     <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $singlepost->video_category_id;?></td>

   <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $singlepost->level;?></td>
    <td align="left" valign="top" bgcolor="#FFFFFF">
 <a href="<?php echo get_site_url() ?>/wp-admin/admin.php?page=edit_video_details&id=<?php echo $singlepost->id;?>" onclick="edit_record(<?php echo $singlepost->id;?>);">Edit</a>&nbsp;&nbsp;<span>|</span>&nbsp;&nbsp;
 <a href="javascript:void(0);" onclick="delete_event(<?php echo $singlepost->id;?>);">Delete</a>
 </td>
  </tr>
<?php
}?>
</table></div>
<?php die;
}
//end  video link

//add video link
function video_options_display_here(){
 ?>
<script src="<?php echo get_template_directory_uri(); ?>/js/ckeditor/ckeditor.js"></script>
<script>
 if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
 CKEDITOR.tools.enableHtml5Elements( document );
CKEDITOR.config.height = 150;
CKEDITOR.config.width = 'auto';
var initSample = ( function() {
 var wysiwygareaAvailable = isWysiwygareaAvailable(),
  isBBCodeBuiltIn = !!CKEDITOR.plugins.get( 'bbcode' );
 return function() {
  var editorElement = CKEDITOR.document.getById( 'transcrlpt' );
  if ( isBBCodeBuiltIn ) {
   editorElement.setHtml(
    'Hello world!\n\n' +
    'I\'m an instance of [url=http://ckeditor.com]CKEditor[/url].'
   );
  }
  if ( wysiwygareaAvailable ) {
   CKEDITOR.replace( 'transcrlpt' );
  } else {
   editorElement.setAttribute( 'contenteditable', 'true' );
   CKEDITOR.inline( 'transcrlpt' );
  }
 };
 function isWysiwygareaAvailable() {
  if ( CKEDITOR.revision == ( '%RE' + 'V%' ) ) {
   return true;
  }
  return !!CKEDITOR.plugins.get( 'wysiwygarea' );
 }
} )();
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
 CKEDITOR.tools.enableHtml5Elements( document );
CKEDITOR.config.height = 150;
CKEDITOR.config.width = 'auto';
var initSample1 = ( function() {
 var wysiwygareaAvailable = isWysiwygareaAvailable(),
  isBBCodeBuiltIn = !!CKEDITOR.plugins.get( 'bbcode' );
 return function() {
  var editorElement = CKEDITOR.document.getById( 'transcrlpt1' );
  if ( isBBCodeBuiltIn ) {
   editorElement.setHtml(
    'Hello world!\n\n' +
    'I\'m an instance of [url=http://ckeditor.com]CKEditor[/url].'
   );
  }
  if ( wysiwygareaAvailable ) {
   CKEDITOR.replace( 'transcrlpt1' );
  } else {
   editorElement.setAttribute( 'contenteditable', 'true' );
   CKEDITOR.inline( 'transcrlpt1' );
  }
 };
 function isWysiwygareaAvailable() {
  if ( CKEDITOR.revision == ( '%RE' + 'V%' ) ) {
   return true;
  }
  return !!CKEDITOR.plugins.get( 'wysiwygarea' );
 }
} )();
</script>

<script>
function addevent()
{
 var title=jQuery("#title").val();
 var startdate=jQuery("#start_date").val();
 var description=jQuery("#description").val();
  formData = jQuery("form").serialize();
  var transcrlpt = CKEDITOR.instances['transcrlpt'].getData();
  formData = formData + '&transcrlpt=' + transcrlpt;
 if(title!="" && startdate!="") {
         jQuery.ajax({
          type:'POST',
          data:formData,
          url: '<?php echo  get_site_url(); ?>/wp-content/themes/superiorkneerehab/action.php',
          success: function(value) {
    window.location.href = "<?php echo  get_site_url(); ?>/wp-admin/admin.php?page=video_details&msg=event_added";
          },
        }); 
 }
else {
 jQuery("#msg").html("Please fill mandatory fields");//alert(jQuery("#msg").html());
 jQuery("#msg").show();
}
}
</script>
<style>
table td span{ color:#F00;}
table td input{ font-size:11px;}
table td textarea{ overflow:hidden; font-size:11px;}
table td{ font-size:11px;}
@media screen and (max-width:320px) {
.add_event{ overflow-x:scroll;}
}
.red{color:#dc1522; line-height:30px; font-weight:700;}
.green{color:#00c42e; line-height:30px; font-weight:700;}
</style>
<div class="wrap">
<h2>Add new Video <a href="<?php echo  get_site_url();?>/wp-admin/admin.php?page=video_details" class="add-new-h2">Back</a></h2>
</div>
 <form id="addevent" action="<?php echo  get_site_url(); ?>/wp-content/themes/superiorkneerehab/action.php" method="post" enctype="multipart/form-data">
<table width="70%" border="0" cellspacing="1" cellpadding="5" bgcolor="#e5e5e5">
 <THEAD>
 <h3>Please fill below information </h3>
 <span id="msg" class='red' style="display:none"></span>
 </THEAD>
 <TBODY>
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Choose Category <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF">
   <select name='video_category_id'>
   <?php
   global $wpdb;
$sql = "SELECT * FROM video_category order by `sort_order` asc";
$pageposts = $wpdb->get_results($sql);
foreach ($pageposts as $singlepost) {
 echo "<option value=".$singlepost->id.">".$singlepost->category_name."</option>";
}
   ?>
   <select>
   </td>
  </tr>
 `
<input type="hidden" name="video_name" id="video_name" value=""/>
   <input type="hidden" name="action" id="action" value="add_video"/>
  </tr>
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">video_url <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="video_url" id="video_url" value=""/>
   </td>
  </tr>
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">video_title <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="video_title" id="video_title" value=""/>
 
   </td>
  </tr>
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">video_length <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="video_length" id="video_length" value=""/>
   </td>
  </tr>
  <!--  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Pdf <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="file" name="filepdf" />
   </td>
  </tr>-->
 
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Transcrlpt <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><textarea name="transcrlpt" id="transcrlpt" rows="20" cols="100"></textarea>
   </td>
  </tr>
 
   <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF"> <span></span></td>
    <td align="left" valign="top" bgcolor="#FFFFFF"><h3 style="align:center;">Add ? mark Video</h3>
   </td>
  </tr>
 
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">video_url <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="video_url1" id="video_url1" value=""/>
   </td>
  </tr>
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">video_title <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="video_title1" id="video_title1" value=""/>
 
   </td>
  </tr>
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Transcrlpt <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><textarea name="transcrlpt1" id="transcrlpt1" rows="20" cols="100"></textarea>
   </td>
  </tr>
 
 
 
 
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Order <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="video_order" id="video_order" value=""/>

   </td>
  </tr>
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Level <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF">
  
     <select name='level'>
<option value="For All">For All</option>
<option  value="Registered">Registered</option>
   <select>
  
   </td>
  </tr>
  
  <tr>
    <td align="center" valign="top" bgcolor="#FFFFFF" colspan="2">
 <!--   <input type="button" class="button" onclick="addevent()" name="add_event" id="add_event" value="Submit">-->
 <input type="submit" class="button"  name="add_event" id="add_event" value="Submit">
    </td>
  </tr>
  </TBODY>
 </table>
 </form>
 <script>
 initSample();
 initSample1();
</script>
 <?php
}

//edit video links
function edit_video_options_display_here(){
global $wpdb;
$id=$_GET['id'];
$sql="select * from video_link where id='$id'";
$events = $wpdb->get_row($sql);
?>
<script>
jQuery(function() {
jQuery('#start_date').datepicker({minDate:0});
});
function editevent()
{
 var title=jQuery("#title").val();
 var startdate=jQuery("#start_date").val();
 var transcrlpt=jQuery("#transcrlpt").val();

  formData = jQuery("form").serialize();
  formData = formData + '&transcrlpt=' + CKEDITOR.instances['transcrlpt'].getData();
 
     if(title!="" && startdate!="") {
         jQuery.ajax({
          type:'POST',
          data:formData,
          url: '<?php echo  get_site_url(); ?>/wp-content/themes/superiorkneerehab/action.php',
          success: function(value) {  
    //  location.reload();
        //window.location.href = "<?php echo  get_site_url(); ?>/wp-admin/admin.php?page=video_details&msg=event_edited";
          },
        }); 
  }
     else {
 jQuery("#msg").html("Please fill mandatory fields");//alert(jQuery("#msg").html());
 jQuery("#msg").show(); 
  } 
}
</script>
<script src="<?php echo get_template_directory_uri(); ?>/js/ckeditor/ckeditor.js"></script>
<script>
 if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
 CKEDITOR.tools.enableHtml5Elements( document );
CKEDITOR.config.height = 150;
CKEDITOR.config.width = 'auto';
var initSample = ( function() {
 var wysiwygareaAvailable = isWysiwygareaAvailable(),
  isBBCodeBuiltIn = !!CKEDITOR.plugins.get( 'bbcode' );
 return function() {
  var editorElement = CKEDITOR.document.getById( 'transcrlpt' );
  if ( isBBCodeBuiltIn ) {
   editorElement.setHtml(
    'Hello world!\n\n' +
    'I\'m an instance of [url=http://ckeditor.com]CKEditor[/url].'
   );
  }
  if ( wysiwygareaAvailable ) {
   CKEDITOR.replace( 'transcrlpt' );
  } else {
   editorElement.setAttribute( 'contenteditable', 'true' );
   CKEDITOR.inline( 'transcrlpt' );
  }
 };
 function isWysiwygareaAvailable() {
  if ( CKEDITOR.revision == ( '%RE' + 'V%' ) ) {
   return true;
  }
  return !!CKEDITOR.plugins.get( 'wysiwygarea' );
 }
} )();
 if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
 CKEDITOR.tools.enableHtml5Elements( document );
CKEDITOR.config.height = 150;
CKEDITOR.config.width = 'auto';
var initSample1 = ( function() {
 var wysiwygareaAvailable = isWysiwygareaAvailable(),
  isBBCodeBuiltIn = !!CKEDITOR.plugins.get( 'bbcode' );
 return function() {
  var editorElement = CKEDITOR.document.getById( 'transcrlpt1' );
  if ( isBBCodeBuiltIn ) {
   editorElement.setHtml(
    'Hello world!\n\n' +
    'I\'m an instance of [url=http://ckeditor.com]CKEditor[/url].'
   );
  }
  if ( wysiwygareaAvailable ) {
   CKEDITOR.replace( 'transcrlpt1' );
  } else {
   editorElement.setAttribute( 'contenteditable', 'true' );
   CKEDITOR.inline( 'transcrlpt1' );
  }
 };
 function isWysiwygareaAvailable() {
  if ( CKEDITOR.revision == ( '%RE' + 'V%' ) ) {
   return true;
  }
  return !!CKEDITOR.plugins.get( 'wysiwygarea' );
 }
} )();
</script>
<style>
table td span{ color:#F00;}
table td input{ font-size:11px;}
table td textarea{ overflow:hidden; font-size:11px;}
table td{ font-size:11px;}
@media screen and (max-width:320px) {
.add_event{ overflow-x:scroll;}
}
.red{color:#dc1522; line-height:30px; font-weight:700;}
.green{color:#00c42e; line-height:30px; font-weight:700;}
</style>
<div class="wrap">
<h2>Please fill below information <a href="<?php echo  get_site_url();?>/wp-admin/admin.php?page=video_details"  class="add-new-h2">Back</a></h2>
</div>
<div class="add_event">
<form id="editevent" action="<?php echo  get_site_url(); ?>/wp-content/themes/superiorkneerehab/action.php" method="post" enctype="multipart/form-data">
<table width="70%" border="0" cellspacing="1" cellpadding="5" bgcolor="#e5e5e5">
 <THEAD>
  <span id="msg" class='red' style="display:none"></span>
 </THEAD>
 <TBODY>

 
   <input type="hidden" name="action" id="action" value="edit_video"/>
   <input type="hidden" name="id" id="id" value="<?php echo $events->id; ?>"/>

    <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Choose Category <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF">
   <select name='video_category_id'>
   <?php
   global $wpdb;
$sql = "SELECT * FROM video_category order by `sort_order` asc";
$pageposts = $wpdb->get_results($sql);
foreach ($pageposts as $singlepost) {
 if($events->video_category_id==$singlepost->id)
 {
  $select="selected=selected";
 }
 else
 {
  $select="";
 }
 echo "<option value=".$singlepost->id." ".$select.">".$singlepost->category_name."</option>";
}
   ?>
   <select>
   </td>
  </tr>

  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">video_url <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="video_url" id="video_url" value="<?php echo $events->video_url; ?>"/>
   </td>
  </tr>
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">video_title <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="video_title" id="video_title" value="<?php echo $events->video_title; ?>"/>
 
   </td>
  </tr>
 
 
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">video_length <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="video_length" id="video_length" value="<?php echo $events->video_length; ?>"/>
   </td>
  </tr>
     <!-- <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Pdf <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="file" name="filepdf" />
   </td>
  </tr>-->
 
    <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Transcrlpt <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF">
   <textarea name="transcrlpt" id="transcrlpt" rows="20" cols="100"><?php echo $events->transcrlpt; ?></textarea>
   </td>
  </tr>
   <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF"> <span></span></td>
    <td align="left" valign="top" bgcolor="#FFFFFF"><h3 style="align:center;">Add ? mark Video</h3>
   </td>
  </tr>
 
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">video_url <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="video_url1" id="video_url1" value="<?php echo $events->video_url1; ?>"/>
   </td>
  </tr>
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">video_title <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="video_title1" id="video_title1" value="<?php echo $events->video_title1; ?>"/>
 
   </td>
  </tr>
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Transcrlpt <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><textarea name="transcrlpt1" id="transcrlpt1" rows="20" cols="100"><?php echo $events->transcrlpt1; ?></textarea>
   </td>
  </tr>
 
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Order <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="video_order" id="video_order" value="<?php echo $events->video_order; ?>"/>

   </td>
  </tr>
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Level <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF">
  
     <select name='level'><?php $s=$events->level;?>
<option value="For All" <?php if($s=="For All") echo "selected=selected";?>>For All</option>
<option value="Registered" <?php if($s=="Registered") echo "selected=selected";?>>Registered</option>
   <select>
  
   </td>
  </tr>
   <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Automatically</td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="auto" id="auto" value="<?php echo $events->auto; ?>"/>

   </td>
  </tr>
 
  <tr>
    <td align="center" valign="top" bgcolor="#FFFFFF" colspan="2">
   <!-- <input type="button" onclick="editevent()" name="edit_event" id="edit_event" value="Submit" class="button">-->
   <input type="submit"  name="edit_event" id="edit_event" value="Submit" class="button">
    </td>
  </tr>
  </TBODY>
 </table>
 </form>
 </div>
  <script>
 initSample(); initSample1()
</script>
<?php }

add_action('wp_ajax_add_event','add_event'); 
add_action('wp_ajax_nopriv_add_event','add_event'); 
function add_event()
{
?>
</table>
</div>
<script>
function addevent()
{
 var title=jQuery("#title").val();
 var startdate=jQuery("#start_date").val();
 var description=jQuery("#description").val();
 if(title!="" && startdate!="") {
         jQuery.ajax({
          type:'POST',
          data:jQuery("form").serialize(),
          url: '<?php echo  get_site_url(); ?>/wp-content/themes/compositerepair/registration_pages/action.php',
          success: function(value) {  
      location.reload();
           //jQuery("#showcontent").html(value);
          },
        }); 
 }
else {
 jQuery("#msg").html("Please fill mandatory fields");//alert(jQuery("#msg").html());
 jQuery("#msg").show();
}
}
</script>
<style>
table td span{ color:#F00;}
table td input{ font-size:11px;}
table td textarea{ overflow:hidden; font-size:11px;}
table td{ font-size:11px;}
@media screen and (max-width:320px) {
.add_event{ overflow-x:scroll;}
}
.red{color:#dc1522; line-height:30px; font-weight:700;}
.green{color:#00c42e; line-height:30px; font-weight:700;}
</style>
<div class="add_event">
<form id="addevent" action="" method="post">
<table width="50%" border="0" cellspacing="1" cellpadding="5" bgcolor="#e5e5e5">
 <THEAD>
 <h2>Add new Video</h2>
 <h3>Please fill below information <a href="<?php echo  get_site_url();?>/wp-admin/admin.php?page=video_details"  class="add-new-h2">Back</a></h3>
 <span id="msg" class='red' style="display:none"></span>
 </THEAD>
 <TBODY>
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Title <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="title" id="title" value=""/>
   <input type="hidden" name="action" id="action" value="add_event"/>
   </td>
  </tr>
    <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Start Date <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="start_date" id="start_date" value="" class="prjtitlediv"/> </td>
  </tr> 
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Description</td>
   <td align="left" valign="top" bgcolor="#FFFFFF">
  <!--<textarea name="description" id="description" ></textarea>-->
   <?php
 $settings = array(
        'textarea_name' => '_content_metabox',
        'textarea_rows' => 8
    );
 wp_editor($content, '_content_metabox', $settings);

      ?>
   </td>
  </tr>
  <tr>
    <td align="center" valign="top" bgcolor="#FFFFFF" colspan="2">
    <input type="button" class="button" onclick="addevent()" name="add_event" id="add_event" value="Submit">
    </td>
  </tr>
  </TBODY>
 </table>
 </form>
 </div>
<?php die;}
add_action('wp_ajax_view_event','view_event'); 
add_action('wp_ajax_nopriv_view_event','view_event'); 
function view_event()
{
global $wpdb;
$id=$_GET['id'];
$sql="select * from events where id='$id'";
$events = $wpdb->get_row($sql);
//print_r($events);
?>
<style>
table td span{ color:#F00;}
table td textarea{ overflow:hidden;}
table td{ font-size:11px;}
@media screen and (max-width:320px) {
.add_event{ overflow-x:scroll;}
}
</style>
<div class="wrap">
<h2>View Video <a href="<?php echo  get_site_url();?>/wp-admin/admin.php?page=video_details" class="add-new-h2">Back</a></h2>
</div>
<div class="add_event">
<form id="addevent" action="" method="post">
<table width="50%" border="0" cellspacing="1" cellpadding="5" bgcolor="#e5e5e5">
 <THEAD>
  <span id="msg" style="display:none"></span>
 </THEAD>
 <TBODY>
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Title</td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $events->title; ?>
   </td>
  </tr>
    <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Start Date</td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $events->start_date; ?></td>
  </tr> 
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Description</td>
   <td align="left" valign="top" bgcolor="#FFFFFF">
   <?php echo $events->description; ?>
   </td>
  </tr>
   <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Status</td>
   <td align="left" valign="top" bgcolor="#FFFFFF">
   <?php echo $events->status; ?>
   </td>
  </tr>
  </TBODY>
 </table>
 </form>
 </div>
<?php die;}
add_action('wp_ajax_edit_event','edit_event'); 
add_action('wp_ajax_nopriv_edit_event','edit_event'); 
function edit_event()
{
global $wpdb;
$id=$_GET['id'];
$sql="select * from events where id='$id'";
$events = $wpdb->get_row($sql);
//print_r($events);
?>
<script>
function editevent()
{
 var title=jQuery("#title").val();
 var startdate=jQuery("#start_date").val();
 var description=jQuery("#description").val();
     if(title!="" && startdate!="") {
         jQuery.ajax({
          type:'POST',
          data:jQuery("form").serialize(),
          url: '<?php echo  get_site_url(); ?>/wp-content/themes/compositerepair/registration_pages/action.php',
          success: function(value) {  
      location.reload();
           //jQuery("#showcontent").html(value);
          },
        }); 
  }
     else {
 jQuery("#msg").html("Please fill mandatory fields");//alert(jQuery("#msg").html());
 jQuery("#msg").show(); 
  } 
}
</script>
<style>
table td span{ color:#F00;}
table td input{ font-size:11px;}
table td textarea{ overflow:hidden; font-size:11px;}
table td{ font-size:11px;}
@media screen and (max-width:320px) {
.add_event{ overflow-x:scroll;}
}
.red{color:#dc1522; line-height:30px; font-weight:700;}
.green{color:#00c42e; line-height:30px; font-weight:700;}
</style>
<div class="add_event">
<form id="editevent" action="" method="post">
<table width="50%" border="0" cellspacing="1" cellpadding="5" bgcolor="#e5e5e5">
 <THEAD>
 <h3>Please fill below information </h3>
 <span id="msg" class='red' style="display:none"></span>
 </THEAD>
 <TBODY>
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Title <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="title" id="title" value="<?php echo $events->title; ?>"/>
   <input type="hidden" name="action" id="action" value="edit_event"/>
   <input type="hidden" name="id" id="id" value="<?php echo $events->id; ?>"/>
   </td>
  </tr>
    <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Start Date <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><input type="text" name="start_date" id="start_date" value="<?php echo $events->start_date; ?>"/> </td>
  </tr> 
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Description</td>
   <td align="left" valign="top" bgcolor="#FFFFFF">
   <textarea name="description" id="description"><?php echo $events->description; ?></textarea>
   </td>
  </tr>
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Status</td>
   <td align="left" valign="top" bgcolor="#FFFFFF">
  <select name="status">  
 <option value="Inactive">Inactive</option>
  <option value="Active">Active</option>
  </select>
   </td>
  </tr> 
 
  <tr>
    <td align="center" valign="top" bgcolor="#FFFFFF" colspan="2">
    <input type="button" onclick="editevent()" name="edit_event" id="edit_event" value="Submit" class="button">
    </td>
  </tr>
  </TBODY>
 </table>
 </form>
 </div>
<?php die;}
add_action('wp_ajax_send_invitation','send_invitation'); 
add_action('wp_ajax_nopriv_send_invitation','send_invitation'); 
function send_invitation()
{
global $wpdb;
$id=$_GET['id'];
$sql="select * from user_registration where sent_invitation=0 and id not in (select user_registration_id from events_user_registration where event_id=$id)";
$user_registration = $wpdb->get_results($sql);
$sql1="select * from events where id=$id";
$events = $wpdb->get_row($sql1);
?>
<script>
function send_invitation()
{
  var checkid=[];
  jQuery('.check:checked').each(function () { 
             checkid.push(jQuery(this).val());  
  });
    if(checkid!=''){
       jQuery("#msg").html('');    
    jQuery("#msg").removeClass('red');
        jQuery("#msg").addClass('green');
          jQuery.ajax({
          type:'POST',
          data:jQuery("form").serialize(),
          url: '<?php echo  get_site_url(); ?>/wp-content/themes/compositerepair/registration_pages/action.php',
          success: function(value) {
     jQuery("#msg").show();
    
     jQuery("#msg").html(value);
          },
        });
    }
   else {
        jQuery("#msg").removeClass('green');
        jQuery("#msg").addClass('red');
        jQuery("#msg").show();
 
   }
 

}

jQuery("#check_id").click(function () {
       if(jQuery("#check_id").is(':checked')){
   jQuery('.check').attr('checked', true);
   }
  else {
   jQuery('.check').attr('checked', false);
  }
 });
</script>
<style>
.red{color:#dc1522; line-height:30px; font-weight:700;}
.green{color:#00c42e; line-height:30px; font-weight:700;}
.title_text{font-size:12px; font-weight:700;}
table td{ font-size:11px;}
.add-new-h2:active {
margin-left: 4px;
padding: 4px 8px;
position: relative;
top: -3px;
text-decoration: none;
border: none;
-webkit-border-radius: 2px;
border-radius: 2px;
background: #e0e0e0;
text-shadow: none;
font-weight: 600;
font-size: 13px;
}
</style>
<div class="wrap">
<h2>Send Invitation <a href="<?php echo  get_site_url();?>/wp-admin/admin.php?page=video_details" class="add-new-h2">Back</a></h2>
</div>
<div class="send_invitation">
<form id="send_invitation" action="" method="post">
<table width="50%" border="0" cellspacing="1" cellpadding="5" bgcolor="#e5e5e5">
 <THEAD>
 <h3>Video ID : <?php echo $id;?></h3>
 <h3>Video Title : <?php echo $events->title;?></h3>
 <h3>Please Select User</h3>
 <span id="msg" style="display:none" class="green">Select at least 1 User.</span>
 </THEAD>
<?php if(!empty($user_registration)) {?>
 <TBODY>
   <tr>
   <td align="left" valign="top" bgcolor="#dfdfdf" class="title_text">User Name</td>
   <td align="left" valign="top" bgcolor="#dfdfdf" class="title_text"> <input type="checkbox" class="check_id" id="check_id" value="check_id"/>    </td>
    </tr> 
<?php foreach($user_registration as $user)
{?>
   <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $user->name;?> ( <?php echo $user->email;?> ) </td>
   <td align="left" valign="top" bgcolor="#FFFFFF">
   <input type="checkbox" name="user_name[]" class="check" id="<?php echo $user->id;?>" value="<?php echo $user->id;?>"/>  
   </td>
    </tr>  
<?php }?>
   <tr>
    <td align="center" valign="top" bgcolor="#FFFFFF" colspan="2">
 <input type="hidden" name="action" id="action" value="send_invitation"/>
 <input type="hidden" name="event_name" id="event_name" value="<?php echo $events->title;?>"/>
 <input type="hidden" name="event_id" id="event_id" value="<?php echo $id;?>"/>
    <input type="button" class="button" onclick="send_invitation()" name="sendinvitation" id="sendinvitation" value="Submit">
    </td>
  </tr>
  </TBODY>
  <?php }else {?>
  <h3>No data found.</h3>
  <?php }?>
 </table>
 </form>
 </div>
<?php die;}
add_action('wp_ajax_view_sent','view_sent'); 
add_action('wp_ajax_nopriv_view_sent','view_sent'); 
function view_sent()
{
global $wpdb;
$id=$_GET['id'];
$sql="select * from events_user_registration where status='sent_invitation' and event_id=$id";
$view_sent = $wpdb->get_results($sql);
$sql1="select * from events where id=$id";
$events = $wpdb->get_row($sql1);
?>
</script>
<style>
.title_text{font-size:12px; font-weight:700;}
table td{ font-size:11px;}
</style>
<div class="wrap">
<h2>Video Invitation: View Invitation Sent <a href="<?php echo  get_site_url();?>/wp-admin/admin.php?page=video_details" class="add-new-h2">Back</a></h2>
</div>
<div class="view_sent">
<form id="view_sent" action="" method="post">
<table width="50%" border="0" cellspacing="1" cellpadding="5" bgcolor="#e5e5e5">
 <THEAD>

 <h3>Video ID : <?php echo $id;?></h3>
 <h3>Video Title : <?php echo $events->title;?></h3>
 <span id="msg" style="display:none"></span>
 </THEAD>
 <?php if(!empty($view_sent)) {?>
 <TBODY>
  <tr>
   <td align="left" valign="top" bgcolor="#dfdfdf" class="title_text">User Name</td>
   <td align="left" valign="top" bgcolor="#dfdfdf" class="title_text">Email</td>
    </tr>  
<?php foreach($view_sent as $view)
{
$sql="select * from user_registration where id=".$view->user_registration_id;
$user = $wpdb->get_row($sql);
?>
   <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $user->name;?> </td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $user->email;?></td>
    </tr>  
<?php }?>
  </TBODY>
 <?php }else {?>
  <h3>No data found.</h3>
<?php }?>
 </table>
 </form>
 </div>
<?php die;}
add_action('wp_ajax_view_attendee','view_attendee'); 
add_action('wp_ajax_nopriv_view_attendee','view_attendee'); 
function view_attendee()
{
global $wpdb;
$id=$_GET['id'];
$sql="select * from events_user_registration where status='confirm' and event_id=$id";
$view_sent = $wpdb->get_results($sql);
$sql1="select * from events where id=$id";
$events = $wpdb->get_row($sql1);
?>
</script>
<style>
.title_text{font-size:12px; font-weight:700;}
table td{ font-size:11px;}
</style>
<div class="wrap">
<h2>Video Invitation : View Attendee <a href="<?php echo  get_site_url();?>/wp-admin/admin.php?page=video_details"  class="add-new-h2">Back</a></h2>
</div>
<div class="view_sent">
<form id="view_sent" action="" method="post">
<table width="50%" border="0" cellspacing="1" cellpadding="5" bgcolor="#e5e5e5">
 <THEAD>
 <h3>Video ID : <?php echo $id;?></h3>
 <h3>Video Title : <?php echo $events->title;?></h3>
 <span id="msg" style="display:none"></span>
 </THEAD>
<?php if(!empty($view_sent)){?>
 <TBODY>
 <tr>
   <td align="left" valign="top" bgcolor="#dfdfdf" class="title_text">User Name</td>
   <td align="left" valign="top" bgcolor="#dfdfdf" class="title_text">Email</td>
    </tr>  
<?php foreach($view_sent as $view)
{
$sql="select * from user_registration where id=".$view->user_registration_id;
$user = $wpdb->get_row($sql);
?>
   <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $user->name;?> </td>
   <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $user->email;?></td>
    </tr>  
<?php }?>
  </TBODY>
 <?php }else {?>
 <h3>No data found.</h3>
<?php }?>
 </table>
 </form>
 </div>
<?php die;}
//add_action('wp_ajax_edit_template','edit_template'); 
//add_action('wp_ajax_nopriv_edit_template','edit_template'); 
function edit_template()
{
global $wpdb;
$id=$_GET['id'];
$sql="select * from template where id=1";
$template = $wpdb->get_row($sql);
//print_r($events);
?>
<script>
function edit_template()
{
  formData = jQuery("form").serialize();
  formData = formData + '&body=' + jQuery(".nicEdit-main").html();
 
         jQuery.ajax({
          type:'POST',
          data:formData,
          url: '<?php echo  get_site_url(); ?>/wp-content/themes/compositerepair/registration_pages/action.php',
          success: function(value) {  
  
           window.location.href = "<?php echo  get_site_url(); ?>/wp-admin/admin.php?page=video_details&msg=template_edited";
          },
        }); 

}
</script>
<style>
table td span{ color:#F00;}
table td input{ font-size:11px;}
table td textarea{ overflow:hidden; font-size:11px;}
table td{ font-size:11px;}
@media screen and (max-width:320px) {
.add_event{ overflow-x:scroll;}
}
.red{color:#dc1522; line-height:30px; font-weight:700;}
.green{color:#00c42e; line-height:30px; font-weight:700;}
</style>
<div class="wrap">
<h2>Please fill below information <a href="<?php echo  get_site_url();?>/wp-admin/admin.php?page=video_details"  class="add-new-h2">Back</a></h2>
</div>
<div class="add_event">
<form id="edittemplate" action="" method="post">
<table width="50%" border="0" cellspacing="1" cellpadding="5" bgcolor="#e5e5e5">
 <THEAD>
  <span id="msg" class='red' style="display:none"></span>
 </THEAD>
 <TBODY>
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Subject <span>*</span></td>
   <td align="left" valign="top" bgcolor="#FFFFFF">
   <input type="text" name="subject" id="subject" style="width:390px;" value="<?php echo $template->subject; ?>"/>
   <input type="hidden" name="action" id="action" value="edit_template"/>
   <input type="hidden" name="id" id="id" value="<?php echo $events->id; ?>"/>
   </td>
  </tr>
  <tr>
   <td align="left" valign="top" bgcolor="#FFFFFF">Body</td>
   <td align="left" valign="top" bgcolor="#FFFFFF">
   <textarea name="body" id="body" rows="10" cols="60"><?php echo $template->body; ?></textarea>
   </td>
  </tr>
 
  <tr>
    <td align="center" valign="top" bgcolor="#FFFFFF" colspan="2">
    <input type="button" onclick="edit_template()" name="edittemplate" id="edittemplate" value="Submit" class="button">
    </td>
  </tr>
  </TBODY>
 </table>
 </form>
 </div>
<?php die;}

Comments

Popular posts from this blog

Create Signature pad with save on database in php

Create Signature pad with save on database in php 1.create a folder images index.php ============   <!DOCTYPE >     <head>     <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />     <title>Signature Pad</title>     <script type="text/javascript" src="jquery-1.8.0.min.js"></script>     <script type="text/javascript"> $(document).ready(function () {     /** Set Canvas Size **/     var canvasWidth = 400;     var canvasHeight = 100;     /** IE SUPPORT **/     var canvasDiv = document.getElementById('signaturePad');     canvas = document.createElement('canvas');     canvas.setAttribute('width', canvasWidth);     canvas.setAttribute('height', canvasHeight);     canvas.setAttribute('id', 'canvas');     canvasDiv.appendChild(canvas);    ...

Get Google Calendar Event List in WordPress

<a href="https://console.cloud.google.com/apis/credentials">Get Your Api Credentials Here</a> <a href="https://calendar.google.com/calendar">Get your Calender ID</a> <?php include_once("wp-load.php"); function  get_calender_events() { $params = array(); /*Get current date*/ $current_date  = date('Y-m-d H:i:s'); /*Convert it to google calendar's rfc_format */ $rfc_format = date("c", strtotime($current_date)); $params[] = 'orderBy=startTime'; $params[] ='maxResults=100'; $params[] = 'timeMin='.urlencode($rfc_format); $url_param = ''; foreach($params as $param) { $url_param.= '&'.$param; } $calender_id = "calender_id"; $client_key =  "client_key"; $url = "https://www.googleapis.com/calendar/v3/calendars/".$calender_id."/events?key=".$client_key."&singleEvents=true".$url_param; $list_events = wp_remote_post($url, ...

WooCommerce Mini cart With Ajax

WooCommerce Mini cart //MINI CART SECTION   <div class="productdiv rightcart">                                                         <?php if ( ! WC()->cart->is_empty() ) : ?>     <ul class="woocommerce-mini-cart cart_list product_list_widget <?php echo esc_attr( $args['list_class'] ); ?>">         <?php             do_action( 'woocommerce_before_mini_cart_contents' );             foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {                 $_product     = apply_filters( 'woocommerce_cart_item_pro...