관리-도구
편집 파일: course_footer.php
<!-- Modal --> <!-- The cf_course_drip_model --> <div id="mycf_course_drip_model" class="cf_course_drip_model" style="border-radius:5px"> <!-- cf_course_drip_model content --> <div class="cf_course_drip_model-content "> <div class="alert alert-info pb-0 mb-0"> <span class="cf-course-close-drip cf-course-close-drip-btn">×</span> <h2>Information</h2> </div> <div class="cf_course_drip_model-body py-3 "> <?= $drip_text; ?> </div> <div class="modal-footer"> <button type="button" class="btn btn-primary btn-sm cf-course-close-drip-btn ">Close</button> </div> </div> </div> <div id="mycf_course_drip_delete_model" class="cf_course_drip_model" style="border-radius:5px"> <!-- cf_course_drip_model content --> <div class="cf_course_drip_model-content"> <div class="alert position-relative pb-0 mb-0 alert-info"> <span class="cf-course-close-drip cf-course-close-drip-btn">×</span> <h5 id="cf-course-delete-he">Delete Comment</h5> </div> <div class="cf_course_drip_model-body py-3 cf_course_drip_model-del-body"> Delete your comment permanently? </div> <input type="hidden" id="cf-course-delete-comment" value=""> <div class="modal-footer"> <button type="button" class="btn btn-sm btn-primary cf-course-close-drip-btn">Cancel</button> <button type="button" class="btn btn-sm btn-danger " id="cf-course-remove-comm">Delete</button> </div> </div> </div> <div id="mycf_course_theme_model" class="cf_course_drip_model cf_course_theme-model" style="border-radius:5px"> <!-- cf_course_drip_model content --> <div class="cf_course_drip_model-content"> <div class="alert position-relative pb-0 mb-0 alert-info"> <span class="cf-course-close-drip cf-course-close-drip-btn">×</span> <h5>Select Theme</h5> </div> <div class="cf_course_drip_model-body py-5 cf_course_sub_asquizz-mode"> <div class="row text-center text-lg-left"> <div class="col-lg-3 col-md-4 col-6 text-center cfcourse_images "> <label for="cfcourse_theme_a"> <img class="img-fluid img-thumbnail" src="<?= plugin_dir_url( dirname(__FILE__) ) ?>assets/image/a.png" alt="Theme image"> </label> <input type="radio" class="cfcourse_custom_theme" name="cfcourse_theme" value="a" id="cfcourse_theme_a" <?php if((isset($theme)) && $theme == "a"){ echo "checked"; } ?> > </div> <div class="col-lg-3 col-md-4 col-6 text-center cfcourse_images "> <label for="cfcourse_theme_b"> <img class="img-fluid img-thumbnail" src="<?= plugin_dir_url( dirname(__FILE__) ) ?>assets/image/b.png" alt="Theme image"> </label> <input type="radio" class="cfcourse_custom_theme" name="cfcourse_theme" value="b" id="cfcourse_theme_b" <?php if(isset($theme) && $theme == "b"){ echo "checked"; } ?> > </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-sm btn-primary cf-course-close-drip-btn">Cancel</button> <button type="button" class="btn btn-sm btn-success " id="cf-course-choose-theme-btn">Save</button> </div> </div> </div> <div id="mycf_course_drip_note_model" class="cf_course_drip_model" > <!-- cf_course_drip_model content --> <div class="cf_course_drip_model-content"> <div class="alert position-relative pb-0 mb-0 alert-info"> <span class="cf-course-close-drip cf-course-close-drip-btn">×</span> <h5 id="cf-course-delete-he">Delete Note</h5> </div> <div class="cf_course_drip_model-body py-3"> Are you sure to delete this note permanently? </div> <input type="hidden" id="cf-course-delete-note" value=""> <div class="modal-footer"> <button type="button" class="btn btn-primary btn-sm cf-course-close-drip-btn">Cancel</button> <button type="button" class="btn btn-danger btn-sm " id="cf-course-remove-notes">Delete</button> </div> </div> </div> <!--Model end --> <!-- if window height is less than 500 px then it will show! --> <div class="cf-course--footer bg-dark" id="cf--course--footer"> </div> <div id="cf-course-snackbar">Comment Deleted.</div> <!-- Footer End --> <script defer > window.addEventListener("load", cfCourseLoadCustomCss); function cfCourseLoadCustomCss() { let totalProgres = $(".cf-course-memebr-progress"); let memberProgress =$(".cf-course-total-progress"); let shortCodeImage =$(".cf-course-shortcode-image"); if( typeof memberProgress != "undefind" && typeof memberProgress != "null" && memberProgress != null ) { $(totalProgres).text($("#cf-course-progers_count").val()); $(memberProgress).text($("#cf-course-total_lecture").val()); } if( typeof shortCodeImage != "undefind" && typeof shortCodeImage != "null" && shortCodeImage != null ) { let alt = $("#cf-course-user-name").val(); let imageValue = $("#cf-course-user-image").val(); let membership_url = $("#cf-course-membership-url").val(); let membership_dash = $(".cf-course-select-dashboard"); let membership_logout = $(".cf-course-select-logout"); $(membership_dash).attr("href",membership_url); $(membership_logout).attr("href",membership_url+"?logout=1"); $(".cf-course-img-shortdiv").attr("title","Image of "+alt); $(".cf-course-img-shortdiv").html(`<img src="${imageValue}" classs="img-thumbnail cf-course-shortcode-image">`); } } </script> <?php if( isset($option_type ) && $option_type=="lecture" && $l_type=="vu"): ?> <script> // Play html video from specific duration let cfCourseVideoId = document.getElementById("cf-course-mlec-video"); if( typeof cfCourseVideoId != "undefind" && typeof cfCourseVideoId != "null" && cfCourseVideoId != null ) { cfCourseVideoId.onloadeddata = function() { var cfCourseVideo = document.getElementById("cf-course--msl--video"); let duration =cfCourseVideo.getAttribute("data-duration"); let cfviduration = Math.floor( this.duration ); if( ( cfviduration == duration ) || ( cfviduration-10 <= duration ) ) { this.currentTime = 0; } this.currentTime = duration-5; } } // html vidoe end </script> <?php elseif( isset($option_type ) && $option_type=="lecture" && ($l_type=="y" )): ?> <script> var cfcourseYtag = document.createElement('script'); cfcourseYtag.src = "https://www.youtube.com/iframe_api"; var cfCoursefirstScriptTag = document.getElementsByTagName('script')[0]; cfCoursefirstScriptTag.parentNode.insertBefore( cfcourseYtag , cfCoursefirstScriptTag ); var cfcourseYPlayer; var cfcourseYvideotime = 0; function onYouTubeIframeAPIReady() { let allCon =document.getElementById("cf-course-msl-show-youtube"); let parEl =document.getElementById("cf-course-ml-show-youtube-c"); let showEl =document.getElementById("cf-course-next-open-rating"); let shownext =document.getElementById("cf-course-next-open"); let rating_status = document.getElementById("cfcours-urating-status").value; if( typeof allCon != "undefind" && typeof allCon != "null" && allCon != null ) { let yvId = allCon.getAttribute("data-yid"); let next = allCon.getAttribute("data-duration"); cfcourseYPlayer = new YT.Player('cf-course-msl-show-youtube', { height: "100%", width: "100%", videoId: yvId, playerVars:{ autoplay: 1, controls: 1, fs: 0, loop: 0, modestbranding: 1, rel: 0, title:0, showinfo: 1, autohide: 1, }, events: { 'onReady': onPlayerReady, 'onStateChange': onPlayerStateChange } }); let preventMultiple=0; function onPlayerReady(event) { let cfyduration = cfcourseYPlayer.getDuration(); if( ( cfyduration == next ) || ( cfyduration-10 <= next ) ) { cfcourseYPlayer.seekTo(0, true); }else{ cfcourseYPlayer.seekTo(next, true); } cfcourseYPlayer.playVideo(); event.target.playVideo(); let cfydurationless = cfyduration-10; function updateTime() { var oldTime = cfcourseYvideotime; if(cfcourseYPlayer && cfcourseYPlayer.getCurrentTime) { cfcourseYvideotime = cfcourseYPlayer.getCurrentTime(); let timer = Math.floor(this.cfcourseYvideotime ); if( timer >= cfydurationless && timer <= cfyduration && preventMultiple==0 ) { preventMultiple++; let oid = allCon.getAttribute("data-oid"); let sid = allCon.getAttribute("data-sid"); let cid = allCon.getAttribute("data-cid"); let mid = allCon.getAttribute("data-mid"); } let times = cfCourseGetVideoTime( timer ); document.querySelector(".cf-course-notes-times").innerText = times; } } let timeupdater1 = setInterval(updateTime, 1000); } var done = false; const cfurl = new URL( window.location ); function onPlayerStateChange(event) { if (event.data == YT.PlayerState.PLAYING && !done) { let timeupdate = setInterval(updateFiveTime, 10000); done = true; } else if ( event.data == YT.PlayerState.ENDED ) { parEl.style.display="none"; if(rating_status.trim()=="no") { showEl.style.display="block"; }else if(rating_status.trim()=="yes"){ shownext.style.display="block"; let par=100; $('.cf-course-second-cancel.cf-course-circle-cancel').circleProgress({ startAngle: -Math.PI / 4 *10, value: par/100, thickness:5, delay:9000, emptyFill: '#918e8e', fill: { color: "#ffffff" }, animation: { duration: 4000 } }).on('circle-animation-progress', function(event, progress) { progress=progress-3; let strg = $( this ).find('strong'); let oid = $( strg ).data("oid"); let sid = $( strg ).data("sid"); let type = $( strg ).data("type"); let cid = $( strg ).data("cid"); let mid = $( strg ).data("mid"); let count= $( strg ).data("count"); $(strg).html('<a href="javascript:void(0)" class="text-white data-type="'+type+'" data-mid="'+mid+'" data-sid="'+sid+'" data-oid="'+oid+'" data-cid="'+cid+'" data-count="'+count+'" ><i class="fa fa-step-forward "></i></a>'); }); let video= $(".cf-course--st-cnext"); let oid = $( video ).data("oid"); let sid = $( video ).data("sid"); let type = $( video ).data("type"); let cid = $( video ).data("cid"); let mid = $( video ).data("mid"); let href = $( video ).data("href"); cfCourseAddProgress( cid, sid, oid, mid, 1,href ); cfCourseStopSettimeout = setTimeout( function() { cfurl.searchParams.set('id', cid ); cfurl.searchParams.set('content', oid ); cfurl.searchParams.set('type', type); window.history.pushState( {}, '', cfurl ); window.location = location.href; }, 4000 ); } } } // add the current time of video in database function updateFiveTime() { let oid = allCon.getAttribute("data-oid"); let sid = allCon.getAttribute("data-sid"); let type = "lecture"; let cid = allCon.getAttribute("data-cid"); let mid = allCon.getAttribute("data-mid"); let param = "update"; var oldTime = cfcourseYvideotime; if( cfcourseYPlayer && cfcourseYPlayer.getCurrentTime ) { cfcourseYvideotime = cfcourseYPlayer.getCurrentTime(); let timer = Math.floor( this.cfcourseYvideotime ); next = timer; cfCourseStartVideoFrom( next,mid, cid, sid, oid, param, type ); } } function stopVideo() { cfcourseYPlayer.stopVideo(); } } } // Youtube video end </script> <?php elseif( isset($option_type ) && $option_type=="lecture" &&( $l_type=="vm" ) ): ?> <script src="https://player.vimeo.com/api/player.js"></script> <script> // Vimeo Video start cfCourseVimeoVideo(); function cfCourseVimeoVideo() { var iframe = document.querySelector('#cf-course--vimeo--v'); let parEl =document.getElementById("cf-course-ml-show-vimeo-c"); let showEl =document.getElementById("cf-course-next-open-rating"); let shownext =document.getElementById("cf-course-next-open"); let rating_status = document.getElementById("cfcours-urating-status").value; if( typeof iframe != "undefind" && typeof iframe != "null" && iframe != null ) { let allCon = document.getElementById("cf-course--msl--vimeo"); let oid = allCon.getAttribute("data-oid"); let sid = allCon.getAttribute("data-sid"); let mid = allCon.getAttribute("data-mid"); let next = allCon.getAttribute("data-duration"); if( next < 10 ){ next = 10; } var options = { // id: '23733161', controls: false } let type = "lecture"; let cid = allCon.getAttribute("data-cid"); let param = "update"; var player = new Vimeo.Player(iframe,options); let setIn; player.on('play', function(data) { let cfvimuration1 = Math.floor( data.duration ); if( ( cfvimuration1 == next ) || ( cfvimuration1-10 <= next ) ) { player.setCurrentTime(0); }else{ player.setCurrentTime(next-5); } setIn = setInterval(function(){ },10000); }); player.on('pause', function() { clearInterval(setIn); }); const cfurl = new URL( window.location ); player.on('ended', function() { clearInterval(setIn); parEl.style.display="none"; if(rating_status.trim()=="no") { showEl.style.display="block"; }else if(rating_status.trim()=="yes"){ shownext.style.display="block"; let par=100; $('.cf-course-second-cancel.cf-course-circle-cancel').circleProgress({ startAngle: -Math.PI / 4 *10, value: par/100, thickness:5, delay:9000, emptyFill: '#918e8e', fill: { color: "#ffffff" }, animation: { duration: 4000 } }).on('circle-animation-progress', function(event, progress) { progress=progress-3; let strg = $( this ).find('strong'); let oid = $( strg ).data("oid"); let sid = $( strg ).data("sid"); let type = $( strg ).data("type"); let cid = $( strg ).data("cid"); let mid = $( strg ).data("mid"); $(strg).html('<a href="javascript:void(0)" class="text-white data-type="'+type+'" data-mid="'+mid+'" data-sid="'+sid+'" data-oid="'+oid+'" data-cid="'+cid+'" ><i class="fa fa-step-forward "></i></a>'); }); let video= $(".cf-course--st-cnext"); let oid = $( video ).data("oid"); let sid = $( video ).data("sid"); let type = $( video ).data("type"); let cid = $( video ).data("cid"); let mid = $( video ).data("mid"); let href = $( video ).data("href"); cfCourseAddProgress( cid, sid, oid, mid, 1 ,href ); cfCourseStopSettimeout=setTimeout(function(){ cfurl.searchParams.set('id', cid ); cfurl.searchParams.set('content', oid ); cfurl.searchParams.set('type', type); window.history.pushState( {}, '', cfurl ); window.location = location.href; },4000); } }); let preventMultiple=0; player.on('timeupdate', function(data) { // console.log( ); let cfviduration = Math.floor( data.duration ); let cfvidurationles = cfviduration-10; let timer = Math.floor( data.seconds ); let times = cfCourseGetVideoTime( timer ) ; document.querySelector(".cf-course-notes-times").innerText = times; if( timer >= cfvidurationles && timer <= cfviduration && preventMultiple==0 ) { preventMultiple++; cfCourseAddProgress( cid, sid, oid, mid, 1 ,false ); } if( timer == next ) { cfCourseStartVideoFrom( next, mid, cid, sid, oid, param, type ); next+=10; } }); player.on("seeked", function(data) { let timer = Math.floor( data.seconds ); next = timer; if( timer == next ) { next+=10; } }); } } // Vimeo video end </script> <?php endif; ?> <div id="cf-course-this-end"></div>