$(function() { services_animation(); mobile_menu(); init_menu(); // init_fancybox(); // init_tooltip(); // init_flickr(); // init_testimonials_slide(); loginTVT(); portfolio_filter(); FeaturesTVT_filter(); SignupTVT_Tabs(); pickvideoTVT_Tabs(); form_trainer_signup(); form_sub_trainer_signup(); form_institute_course(); form_upload_file(); form_trainer_finance(); form_paypal(); form_otherpayment(); form_upload_trainee_CSV(); form_billinginfo(); form_trainer_page(); form_trainer_course(); form_trainer_course_deadline(); form_trainer_invemail(); form_trainer_rmdemail(); form_trainer_compemail(); form_receive_email_notifications(); form_course_certs(); form_course_access(); course_invemail_existingtrainees(); course_invemail_anyone(); form_trainer_create_course(); form_trainer_personalinfo(); form_trainer_personalinfo_changepassword(); forgotPWD(); vlm(); goto_top(); contact_form(); tabs_ui(); accordion_ui(); custom_lists_ui(); Inst_Reg_form(); course_file_uploading_page (); Init_ManageQuizPage (); applySubTrainerCourseFunctions (); YoutubeFancyBox (); addTrainerFancyBox (); addTraineeFancyBox (); // init_tweets(); }); function services_animation() { $(".services .service").hover( function() { var id = $(this).attr('id'); $('.services .service#' + id + ' .icon').addClass('animated bounce'); }, function() { $('.icon').removeClass('animated bounce'); } ); } function mobile_menu() { selectnav('nav', { label: 'Menu', nested: true, indent: '-' }); } function init_menu() { $('ul.sf-menu').superfish({ speed: 'normal', disableHI: false, delay: 150 }); } function init_tweets() { $(".latest_tweets #tweets, #footer #twitter_feed").tweet({ username: 'mojothemes', modpath: 'js/twitter/', join_text: "auto", avatar_size: 25, count: 2, auto_join_text_default: "we said,", auto_join_text_ed: "we", auto_join_text_ing: "we were", auto_join_text_reply: "we replied to", auto_join_text_url: "we were checking out", loading_text: "loading tweets..." }); } function init_fancybox() { $('.fancybox').fancybox({ 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : '800', 'speedOut' : '400', 'overlayShow' : true, 'overlayColor' : '#fcfcfc', 'padding' : '3', 'hideOnContentClick' : true, 'titlePosition' : 'outside', 'titleFormat' : null }); $(".fancybox.video").click(function() { $.fancybox({ 'padding' : 0, 'autoScale' : false, 'transitionIn' : 'none', 'transitionOut' : 'none', 'title' : this.title, 'overlayColor' : '#fcfcfc', 'width' : 640, 'height' : 385, 'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'), 'type' : 'swf', 'swf' : { 'wmode' : 'transparent', 'allowfullscreen' : 'true' } }); return false; }); $(".fancybox.iframe").click(function() { $.fancybox({ 'width' : 640, 'height' : 385 }); return false; }); // alert ("init_fancybox"); } function init_tooltip() { $('.tooltip').tipsy({ 'gravity' : 's' }); } function init_flickr() { $('#flickr_feed').jflickrfeed({ limit: 9, qstrings: { id: '34903216@N04' }, useTemplate: false, itemCallback: function(item){ $(this).append("
  • "); } }); } function init_testimonials_slide() { $('.testimonial_slides .testimonial').quovolver(); } function portfolio_filter() { $('.portfolio ul.sort li').eq(0).addClass('current'); $('.portfolio ul.sort a').click(function() { $(this).css('outline','none'); $('ul.sort .current').removeClass('current'); $(this).parent().addClass('current'); var filterVal = $(this).text().toLowerCase().replace(' ','-'); if(filterVal == 'all') { $('ul.portfolio_sort li.hidden').fadeIn('slow').removeClass('hidden'); } else { $('ul.portfolio_sort li').each(function() { if(!$(this).hasClass(filterVal)) { $(this).fadeOut('normal').addClass('hidden'); } else { $(this).fadeIn('slow').removeClass('hidden'); } }); } return false; }); } function FeaturesTVT_filter() { var arr = new Array(); arr.push({item_key: "All", item_value: "alle"});arr.push({item_key: "Course Management", item_value: "Cursusbeheer"});arr.push({item_key: "Video Management", item_value: "video Management"});arr.push({item_key: "Video Conferencing", item_value: "video Conferencing"});arr.push({item_key: "Video Chat", item_value: "video Chat"}); $('.FeaturesTVT ul.sort li').eq(0).addClass('current'); $('.FeaturesTVT ul.sort a').click(function() { $(this).css('outline','none'); $('ul.sort .current').removeClass('current'); $(this).parent().addClass('current'); var item = ""; for (x in arr) { if (arr[x].item_value == $(this).text()) { item = arr[x].item_key; } } // var filterVal = $(this).text().toLowerCase().replace(' ','-'); var filterVal = item.toLowerCase().replace(' ','-'); if(filterVal == 'all') { $('ul.FeaturesTVT_sort li.hidden').fadeIn('slow').removeClass('hidden'); } else { $('ul.FeaturesTVT_sort li').each(function() { if(!$(this).hasClass(filterVal)) { $(this).fadeOut('normal').addClass('hidden'); } else { $(this).fadeIn('slow').removeClass('hidden'); } }); } return false; }); } // =============================== // Functions added by Khalil Mangi // =============================== // ===================== uploading/importing student .csv file ========================================================== function form_upload_trainee_CSV () { $('#Uploadcsv').click(function(){ if ($('select#gid').val() == 0 && $('input#new-group').val().trim() == '') { $("#responce").html (''); return; } $(this).hide(); $('progress').show(); $("#responce").html (""); var formData = new FormData($('form')[0]); $.ajax({ url: 'act_upload_student_csv.php', //Server script to process data type: 'POST', xhr: function() { // Custom XMLHttpRequest var myXhr = $.ajaxSettings.xhr(); if(myXhr.upload){ // Check if upload property exists myXhr.upload.addEventListener('progress',progressHandlingFunction, false); // For handling the progress of the upload } return myXhr; }, //Ajax events // beforeSend: beforeSendHandler, success: function (data) { if (data) { $("#responce").html (data); } $('#Uploadcsv').show(); return false; }, error: function() { alert("Error Occurred..."); $('#Uploadcsv').show(); }, // Form data data: formData, //Options to tell jQuery not to process data or worry about content-type. cache: false, contentType: false, processData: false }); }); $('progress').hide(); } // ==================== Other Payment Gateway Email Template ============================================================ function form_otherpayment() { $('#other_Payment').on('click', function() { $("div#responce").html(" Het verwerken van gegevens, even geduld ..."); var invsubject = $('input#invsubject').val(); var invbody = $('textarea#invbody').val(); var post='invsubject=' + invsubject + '&invbody=' + invbody; $.post('act_otherpaymentGateway.php', post, function(data) { $("div#responce").html(data); }); }); } // ===================== Inserting TVT Paypal ID for course payments ================================================ function form_paypal() { $('#paypal').on('click', function() { $("div#responce").html(" Het verwerken van gegevens, even geduld ..."); var paypal = $("#paypal").attr("checked") ? 1 : 0; var post = 'paypal=' + paypal; var act_file = "act_userPaypal.php"; $.post(act_file, post, function(data) { $("div#responce").html(data); }); }); } // ===================== Trainer Finance insertion =============================================================== function form_trainer_finance() { $('#trainer_finance').on('click', function() { $("div#responce").html(" Het verwerken van gegevens, even geduld ..."); var p_name = $('input#p_name').val(); var p_email = $('input#p_email').val(); var post = 'p_email=' + p_email + '&p_name='+ p_name; var act_file = "act_financialSettings.php"; $.post(act_file, post, function(data) { $("div#responce").html(data); }); }); } // ===================== Forgot Password =============================================================== function forgotPWD() { $('#forgot').on('click', function() { $("div#responce").html(" Het verwerken van gegevens, even geduld ..."); var email = $('input#email').val(); var post = 'email=' + email; var act_file = "act_forgotPassword.php"; $.post(act_file, post, function(data) { $("div#responce").html(data); }); }); } // Trainer course deadline form =================================================================================== function form_trainer_course_deadline() { $('#trainer_deadline').on('click', function() { $("div#responce_trainer_course_deadline").html(" Het verwerken van gegevens, even geduld ..."); //var deadline = $("#deadline").attr("checked") ? 1 : 0; var CDeadline = $('input#CDeadline').val(); var DType = $("#DType option:selected").val(); var post='CDeadline=' + CDeadline + '&DType=' + DType; $.post('act_course_trainer_deadline.php', post, function(data) { $("div#responce_trainer_course_deadline").html(data); }); }); } // ==================== Course Invitation Email Template ============================================================ function form_trainer_invemail() { $('#trainer_invemail').on('click', function() { var invsubject = $('input#invsubject').val(); var invbody = $('textarea#invbody').val(); var post='invsubject=' + invsubject + '&invbody=' + invbody; $.post('act_course_invitationEmail.php', post, function(data) { $("div#responce_trainer_invemail").html(data); }); }); } // ==================== Course Reminder Email Template ============================================================ function form_trainer_rmdemail() { $('#trainer_rmdemail').on('click', function() { var rmdsubject = $('input#rmdsubject').val(); var rmdbody = $('textarea#rmdbody').val(); var post='rmdsubject=' + rmdsubject + '&rmdbody=' + rmdbody; $.post('act_course_reminderEmail.php', post, function(data) { $("div#responce_trainer_rmdemail").html(data); }); }); } // ==================== Course COMPLETED Email Template ============================================================ function form_trainer_compemail() { $('#trainer_compemail').on('click', function() { var compsubject = $('input#compsubject').val(); var compbody = $('textarea#compbody').val(); var post='compsubject=' + compsubject + '&compbody=' + compbody; $.post('act_course_completionEmail.php', post, function(data) { $("div#responce_trainer_compemail").html(data); }); }); } // ==================== TRAINEE ACTIVITY EMAIL NOTIFICATIONS ============================================================ function form_receive_email_notifications() { $('#trainer_noti').on('click', function() { var Cnotification = $("#Cnotification option:selected").val(); var post='Cnotification=' + Cnotification; $.post('act_trainee_notification_emails.php', post, function(data) { $("div#responce_receive_email_notifications").html(data); }); }); } // ==================== Certifications options ============================================================ function form_course_certs() { $('#cert_btn').on('click', function() { var icerts = $("#issue_certs").attr("checked") ? 1 : 0; var scerts = $("#score_certs").attr("checked") ? 1 : 0; //document.write("i am here"); var post='icerts=' + icerts + '&scerts=' + scerts; $.post('act_course_certs.php', post, function(data) { $("div#responce_course_certs").html(data); }); }); } // ==================== Course access ============================================================ function form_course_access() { $('#course_access').on('click', function() { var access = $("input[name='access']:checked").val() var post='access=' + access; $.post('act_course_access.php', post, function(data) { $("div#responce_course_access").html(data); }); }); } // ==================== Course Invitation email to existing trainees ================================= function course_invemail_existingtrainees() { $('#invemail_trainees').on('click', function() { var ids = ""; $('input[type=checkbox]').each (function (index) { ids += (this.checked ? $(this).val() + "|" : ""); }); var arr = ids.split("|"); arr.splice(arr.length-1); var str = arr.join("|"); // alert (str); if (str == "") { $('div#responce_invemail_existingtrainees').html (''); } else { $('div#responce_invemail_existingtrainees').html (''); var post = 'ids=' + str; $.post('act_invemail_existingTrainees.php', post, function(data) { $("div#responce_invemail_existingtrainees").html(data); }); } }); } // ==================== Course Invitation email to existing trainees ================================= function course_invemail_anyone() { $('#invemail_anyone').on('click', function() { var ids = $('textarea#anyone_emails').val(); /* alert (ids); ids = ids.replace('\r\n', '|'); ids = ids.replace('\r', '|'); ids = ids.replace('\n', '|'); */ // alert (ids); /* var arr = ids.split("|"); arr.splice(arr.length-1); var str = arr.join("|"); */ // alert (str); if (ids == "") { $('div#responce_invemail_anyone').html (''); } else { $('div#responce_invemail_anyone').html (''); var post = 'ids=' + ids; $.post('act_invemail_anyone.php', post, function(data) { $("div#responce_invemail_anyone").html(data); }); } }); } // ==================== Course Invitation email to existing trainees ================================= function form_trainer_create_course() { $('#trainer_Coursecreate').on('click', function() { $("div#responce_trainer_create_course").html(" Opslaan van gegevens, even geduld ..."); var CTitle = encodeURIComponent($('input#CTitle').val()); var CDesc = encodeURIComponent($('textarea#CDesc').val()); var CLevel = $('select#CLevel').val(); var post='CTitle='+CTitle+ '&CDesc=' + CDesc + '&CLevel=' + CLevel; $.post('act_step02_trainer_createCourse.php', post, function(data) { $("div#responce_trainer_create_course").html(data); }); }); } // ==================== Trainer Billing information form ================================= function form_billinginfo() { $('#trainer_billing').on('click', function() { $("div#responce_trainer_personalinfo").html(" Opslaan van gegevens, even geduld ..."); var amount = $('input#amount').val(); var pkg_id = $('input#pkg_id').val(); var pkg_name = $('input#pkg_name').val(); var FullName = $('input#FullName').val(); var email = $('input#email').val(); var bill_desc = $('input#bill_desc').val(); var tele_no = $('input#tele_no').val(); var country_code = $("#country option:selected").val(); var country_text = $("#country option:selected").text(); var post='FullName=' + FullName +'&tele_no=' + tele_no +'&amount=' + amount +'&bill_desc=' + bill_desc +'&country_code=' + country_code + '&country_text=' + country_text +'&email=' + email + '&pkg_id=' + pkg_id + '&pkg_name=' + pkg_name ; $.post('act_billingInfo.php', post, function(data) { $("div#responce_trainer_personalinfo").html(data); }); }); } // ==================== Trainer personal information form ================================= function form_trainer_personalinfo() { $('#trainer_personal').on('click', function() { $("div#responce_trainer_personalinfo").html(" Opslaan van gegevens, even geduld ..."); var inst_name = $('input#inst_name').val(); var FullName = $('input#FullName').val(); var email = $('input#email').val(); var WebsiteAdd = $('input#WebsiteAdd').val(); var tele_no = $('input#tele_no').val(); var st_add = encodeURIComponent($('input#st_add').val()); var zip_code = $('input#zip_code').val(); var city = $('input#city').val(); var state = $('input#state').val(); var country_code = $("#country option:selected").val(); var country_text = $("#country option:selected").text(); var post='U_name=' + U_name +'&inst_name=' + inst_name +'&FullName=' + FullName +'&tele_no=' + tele_no +'&st_add=' + st_add +'&zip_code=' + zip_code +'&city=' + city +'&state=' + state +'&country_code=' + country_code + '&country_text=' + country_text +'&WebsiteAdd=' + WebsiteAdd + '&email=' + email; $.post('act_trainerPersonalinfoRashid.php', post, function(data) { $("div#responce_trainer_personalinfo").html(data); }); }); } //=============== Trainer Change Password ===================================== function form_trainer_personalinfo_changepassword() { $('#trainer_personal_changepwd').on('click', function() { $("div#responce_trainer_password").html(" Opslaan van gegevens, even geduld ..."); var U_name = $('input#U_name').val(); var old_pwd = $('input#old_pwd').val(); var pwd_1 = $('input#pwd_1').val(); var pwd_2 = $('input#pwd_2').val(); var post='U_name=' + U_name + '&old_pwd=' + old_pwd + '&pwd_1=' + pwd_1 + '&pwd_2=' + pwd_2 ; $.post('act_trainerPersonalPwd.php', post, function(data) { $("div#responce_trainer_password").html(data); }); }); } // ==================== Trainer course updating ================================= function form_trainer_course() { $('#trainer_Coursesend').on('click', function() { var CTitle = encodeURIComponent($('input#CTitle').val()); var CDesc = encodeURIComponent($('textarea#CDesc').val()); var CDesc_arabic = encodeURIComponent($('textarea#CDesc-arabic').val()); var CCreator = $('input#CCreator').val(); var CEmail = $('input#CEmail').val(); var CFree = $('input#CFree').val(); var Clevel = $("#Clevel option:selected").val(); var CType = $("#CType option:selected").val(); var cCurrency_code = $("#cCurrency option:selected").val(); var cCurrency_text = $("#cCurrency option:selected").text(); var cAssignedTo = $("#cAssignedTo option:selected").val(); var CType = $("#CType option:selected").val(); var Cduration = $('input#Cduration').val(); var Dtype = $("#Dtype option:selected").val(); var CRequirement = $('textarea#CRequirement').val(); var LDesc = encodeURIComponent(CKEDITOR.instances['LDesc'].getData()); // var LDesc = CKEDITOR.instances['LDesc'].getData(); var LDesc_arabic = encodeURIComponent(CKEDITOR.instances['LDesc-arabic'].getData()); var post='CTitle=' + CTitle + '&CDesc=' + CDesc + '&CDesc_arabic=' + CDesc_arabic + '&CFree=' + CFree +'&Clevel=' + Clevel +'&cCurrency_code=' + cCurrency_code +'&cCurrency_text='+ cCurrency_text +'&CType=' + CType +'&Cduration=' + Cduration +'&Dtype=' + Dtype +'&LDesc=' + LDesc + '&LDesc_arabic=' + LDesc_arabic +'&CRequirement=' + CRequirement +'&CCreator=' + CCreator + '&CEmail=' + CEmail + '&cAssignedTo=' + cAssignedTo + '&dt=' + (new Date()).getTime(); // alert (LDesc); // return false; $.post('Post_course_trainer.php', post, function(data) { $("div#responce_trainer_course").html(data); }); }); $('a#btn-save-course-form').on('click', function() { var cvForm = $('select#cv-form option:selected').val(); var post = 'cvForm=' + cvForm + '&dt=' + (new Date()).getTime(); // alert (LDesc); // return false; $.post('act_SaveCourseFormSelection.php', post, function(data) { $("div#response-course-form").html(data); }); }); } // ==================== Trainer Page ================================= function form_trainer_page() { $("#folder_name").change(function(){ $("#message").html(" Controleren ..."); var d_folder=$("#folder_name").val(); $.ajax({ type:"post", url:"check_domainFolder.php", data:"d_folder="+d_folder, success:function(data){ if(data==0){ $("#message").html("beschikbaar"); } else{ $("#message").html("niet beschikbaar"); } } }); }); } // ==================== Trainer signup ================================= function form_trainer_signup() { $("#U_name").change(function(){ $("#message").html(" Controleren ..."); var username = $("#U_name").val(); $.ajax({ type:"post", url:"check_username.php", data:"username="+username, success:function(data){ if(data==0){ $("#message").html("beschikbaar"); } else{ $("#message").html("niet beschikbaar"); } } }); }); $('#trainer_send').on('click', function() { $("div#responce").html(" Opslaan van gegevens, even geduld ..."); var U_name = $('input#U_name').val(); var pwd_1 = $('input#pwd_1').val(); var pwd_2 = $('input#pwd_2').val(); var FullName = $('input#FullName').val(); var email = $('input#email').val(); var WebsiteAdd = $('input#WebsiteAdd').val(); var post='U_name=' + U_name + '&pwd_1=' + pwd_1 + '&pwd_2=' + pwd_2 + '&FullName=' + FullName + '&WebsiteAdd=' + WebsiteAdd + '&email=' + email; $.post('act_trainer_signup.php', post, function(data) { $("div#responce").html(data); }); }); } function form_sub_trainer_signup() { $("#T_name").change(function(){ $("#message").html(" Controleren ..."); var username = $("#T_name").val(); $.ajax({ type:"post", url:"check_username.php", data:"username="+username, success:function(data){ if(data==0){ $("#message").html("beschikbaar"); } else{ $("#message").html("niet beschikbaar"); } } }); }); $('#sub_trainer_signup').on('click', function() { $("div#responce").html(" Opslaan van gegevens, even geduld ..."); var U_name = $('input#T_name').val(); var pwd_1 = $('input#pwd_1').val(); var pwd_2 = $('input#pwd_2').val(); var FullName = $('input#FullName').val(); var email = $('input#email').val(); var post='U_name=' + U_name + '&pwd_1=' + pwd_1 + '&pwd_2=' + pwd_2 + '&FullName=' + FullName + '&email=' + email; // alert (post); $.post('act_sub_trainer_signup.php', post, function(data) { $("div#responce").html(data); }); }); } function form_assistant_trainer_registration () { $("#ST_name").change(function(){ $("#message").html(" Controleren ..."); var username = $("#ST_name").val(); $.ajax({ type:"post", url:"check_username.php", data:"username="+username, success:function(data){ if(data==0){ $("#message").html("beschikbaar"); } else{ $("#message").html("niet beschikbaar"); } } }); }); $('#assistant_trainer_signup').on('click', function() { $("div#responce").html(" Opslaan van gegevens, even geduld ..."); var U_name = $('input#ST_name').val(); var pwd_1 = $('input#pwd_1').val(); var pwd_2 = $('input#pwd_2').val(); var FullName = $('input#FullName').val(); var email = $('input#email').val(); var tel = $('input#tele_no').val(); var post='U_name=' + U_name + '&pwd_1=' + pwd_1 + '&pwd_2=' + pwd_2 + '&FullName=' + FullName + '&email=' + email + '&tel=' + tel; // alert (post); $.post('act_assistant_trainer_signup.php', post, function(data) { $("div#responce").html(data); }); }); } // ==================== Institute signup ================================= function Inst_Reg_form() { $("#I_name").change(function(){ $("#message").html(" Controleren ..."); var username=$("#I_name").val(); $.ajax({ type:"post", url:"check_username.php", data:"username="+username, success:function(data){ if(data==0){ $("#message").html("beschikbaar"); } else{ $("#message").html("niet beschikbaar"); } } }); }); $("#URLD").change(function(){ $("#message1").html(" Controleren ..."); var instname=$("#URLD").val(); $.ajax({ type:"post", url:"check_instname.php", data:"instname="+instname, success:function(data){ if(data==0){ $("#message1").html("beschikbaar"); } else{ $("#message1").html("niet beschikbaar"); } } }); }); $('#Inst_info').on('click', function() { $("div#responce").html(" Opslaan van gegevens, even geduld ..."); var Ins_name = $('input#Ins_name').val(); var I_name = $('input#I_name').val(); var pwd_1 = $('input#pwd_1').val(); var pwd_2 = $('input#pwd_2').val(); var FullName = $('input#FullName').val(); var URLD = $('input#URLD').val(); var email = $('input#email').val(); var WebsiteAdd = $('input#WebsiteAdd').val(); var post = 'Ins_name=' + Ins_name + '&U_name=' + I_name + '&pwd_1=' + pwd_1 + '&pwd_2=' + pwd_2 + '&FullName=' + FullName + '&URLD=' + URLD + '&WebsiteAdd=' + WebsiteAdd + '&email=' + email; $.post('Post_form_institute.php', post, function(data) { $("div#responce").html(data); }); }); } // ================================================================================================================= function SignupTVT_Tabs() { var arr_signup = new Array(); arr_signup.push({item_key: "Sign Up", item_value: "Aanmelden"});arr_signup.push({item_key: "1 Create Course Videos", item_value: "1 Maak Cursus Video"});arr_signup.push({item_key: "2 Manage Course Information", item_value: "2 Beheer Cursus Informatie"});arr_signup.push({item_key: "3 Manage Course Content", item_value: "3 Beheer Cursus Inhoud"});arr_signup.push({item_key: "4 Publish Course", item_value: "4 Publicatie Course"});arr_signup.push({item_key: "5 Market Course", item_value: "5 Market Course"}); $('.SignupTVT ul.sort li').eq(0).addClass('current'); changeContent ('sign-up'); $('.SignupTVT ul.sort a').click(function() { $(this).css('outline','none'); $('ul.sort .current').removeClass('current'); $(this).parent().addClass('current'); var item = ""; for (x in arr_signup) { if (arr_signup[x].item_value == $(this).text()) { item = arr_signup[x].item_key; } } // var filterVal = $(this).text().toLowerCase().replace(' ','-'); var filterVal = item.toLowerCase().replace(/ /g,'-'); // var filterVal = $(this).text().toLowerCase().replace(/ /g,'-'); changeContent (filterVal); return false; }); } function changeContent (filterVal) { $('ul.SignupTVT_sort li').each(function() { if(!$(this).hasClass(filterVal)) { $(this).fadeOut('normal').addClass('hidden'); } else { $(this).fadeIn('slow').removeClass('hidden'); } }); } function pickvideoTVT_Tabs() { $('.pickvideoTVT ul.sort li').eq(0).addClass('current'); changeContent ('sign-up'); $('.pickvideoTVT ul.sort a').click(function() { $(this).css('outline','none'); $('ul.sort .current').removeClass('current'); $(this).parent().addClass('current'); var filterVal = $(this).text().toLowerCase().replace(/ /g,'-'); changeContentVideo (filterVal); return false; }); } function changeContentVideo (filterVal) { $('ul.pickvideoTVT_sort li').each(function() { if(!$(this).hasClass(filterVal)) { $(this).fadeOut('normal').addClass('hidden'); } else { $(this).fadeIn('slow').removeClass('hidden'); } }); } function goto_top() { $("#footer #sub_footer a.back_to_top").click(function(){ $('html, body').animate({scrollTop:0}, 400); return false; }); } function contact_form() { $('#contact_send').on('click', function() { var name = $('input#name').val(); var email = $('input#email').val(); var message = $('textarea#message').val(); var post = 'name=' + name + '&email=' + email + '&message=' + message; $.post('sendmail.php', post, function(data) { $("div#responce").html(data); }); }); } function loginTVT() { $('#loginTVTsend').on('click', function() { doLogin (); }); } function doLogin () { $("div#responce").html(" Het verwerken van gegevens, even geduld ..."); var U_name = $('input#U_name').val(); var pwd_1 = $('input#pwd_1').val(); var post='U_name=' + U_name + '&pwd_1=' + pwd_1; $.post('act_login.php', post, function(data) { $("div#responce").html(data); }); } function course_timezone() { $('#course_timezone_btn').on('click', function() { var optionSelected = $(this).find("option:selected"); var valueSelected = optionSelected.val(); var textSelected = optionSelected.text(); confirm("value is changed"); $.ajax({ type:"post", url:"act_courseTimezone.php", data:"tzone_off="+valueSelected+"&tzone="+textSelected, success:function(data){ $("div#responce").html(data); } }); }); } function form_institute_course() { $('#institute_Coursesend').on('click', function() { var CTitle = $('input#CTitle').val(); var CDesc = $('input#CDesc').val(); var CCreator = $('input#CCreator').val(); var CEmail = $('input#CEmail').val(); var post='CTitle=' + CTitle + '&CDesc=' + CDesc + '&CCreator=' + CCreator + '&CEmail=' + CEmail; $.post('Post_course_institute.php', post, function(data) { $("div#responce").html(data); }); }); } function form_upload_file() { $('#SendfileUpload').on('click', function() { var Fileupload = $('input#Fileupload').val(); var FileDetail = $('input#FileDetail').val(); var post='Fileupload=' + Fileupload + '&FileDetail=' + FileDetail; $.post('Post_course_file.php', post, function(data) { $("div#responce").html(data); }); }); } function tabs_ui() { $(".tab_content").hide(); $("ul.tabs_nav li:first").addClass("active").show(); $(".tab_content:first").show(); $("ul.tabs_nav li").click(function() { $("ul.tabs_nav li").removeClass("active"); $(this).addClass("active"); $(".tab_content").hide(); var activeTab = $(this).find("a").attr("href"); if ($(activeTab).hasClass("courses")) { // alert ("courses"); LoadAllCourses (); } else if ($(activeTab).hasClass("course-bundles")) { // alert ("course-buldles"); LoadAllCourseBundles (); } else if ($(activeTab).hasClass("add-questions")) { CKEDITOR.instances['qnTx'].setData(''); $('.option-windows').empty (); } else if ($(activeTab).hasClass("students-in-groups-tab")) { LoadStudentsInGroups (); } else if ($(activeTab).hasClass("students-groups-tab")) { LoadGroupsList (); } else if ($(activeTab).hasClass("students-grades-tab")) { LoadGradesList (); } else if ($(activeTab).hasClass("course-study-guideline-master-tab")) { LoadCourseStudyGuidelineMaster (); } else if ($(activeTab).hasClass("existing-questions")) { var quiz2 = 0; $($(activeTab).attr('class').split(' ')).each (function () { var arr = this.split('-'); if (arr[0] == 'quiz') { quiz2 = arr[1]; } }); // alert (quizID + "|" + quiz2); $('.option-windows').empty (); getQuizQuestionsData (quiz2); } $(activeTab).fadeIn(1000); return false; }); } function getQuizQuestionsData (quizID) { $("#existing-questions-list").html(" Getting bestaande lijst vragen, even geduld ..."); $.ajax({ url: 'getCourseQuizQuestions.php?quiz_id='+quizID, //Server script to process data type: 'POST', success: function (data) { $("#existing-questions-list").html (data); // accordion_ui(); question_accordion_ui (); InitializeSortable (); // Present in Manage_quiz.php }, error: function() { $("#existing-questions-list").html ("Kan de lijst van bestaande quizvragen niet op dit moment"); }, // Form data data: {quiz_id: quizID}, //Options to tell jQuery not to process data or worry about content-type. cache: false, contentType: false, processData: true }); } function accordion_ui() { $(".accordion h3").eq(0).addClass("active"); $(".accordion h3 .icon").eq(0).removeClass("icon-plus").addClass("icon-minus"); $(".acc_content").eq(0).show(); $(".accordion h3").click(function(){ var handle = $(this).next(".acc_content"); $(this).next(".acc_content").slideToggle("slow").siblings(".acc_content:visible").slideUp("slow"); $(this).toggleClass("active"); $(this).siblings("h3").removeClass("active"); $('.accordion h3').each(function(index,value) { if($('.accordion h3:eq('+index+')').hasClass('active')) { $('.accordion h3:eq('+index+') .icon').removeClass('icon-plus').addClass('icon-minus'); } else { $('.accordion h3:eq('+index+') .icon').removeClass('icon-minus').addClass('icon-plus'); } }); }); } /* function question_accordion_ui() { $(".question.accordion h3").click(function(){ // alert ("called"); var handle = $(this).next(".acc_content"); $(this).next(".acc_content").slideToggle("slow").siblings(".acc_content:visible").slideUp("slow"); $(this).toggleClass("active"); $(this).siblings("h3").removeClass("active"); $('.question.accordion h3').each(function(index,value) { if($('.question.accordion h3:eq('+index+')').hasClass('active')) { $('.question.accordion h3:eq('+index+') .icon').removeClass('icon-plus').addClass('icon-minus'); } else { $('.question.accordion h3:eq('+index+') .icon').removeClass('icon-minus').addClass('icon-plus'); } }); $('.question.accordion .acc_content span').html(""); var elementID = $(this).attr("id"); if (elementID != null) { handle.find("span").html(" Getting vraag gegevens, even geduld ..."); var questionID = elementID.split("-")[1]; $.ajax({ url: 'getCourseQuizQuestionInEditMode.php?qid='+questionID, //Server script to process data type: 'POST', success: function (data) { handle.find("span").html(data); applyEditQuestionFunctions (); }, error: function() { alert ("error"); handle.next("span").html ("Kan de lijst van bestaande quizvragen niet op dit moment"); }, // Form data data: {qid: questionID}, //Options to tell jQuery not to process data or worry about content-type. cache: false, contentType: false, processData: true }); } var str = ""; $('.question.accordion .acc_content span').each(function(index,value) { str += $('.question.accordion .acc_content span:eq('+index+')').html(); }); }); } */ function question_accordion_ui() { $(".question.accordion h3").click(function(){ // alert ("called"); var handle = $(this).next(".acc_content"); $(this).next(".acc_content").slideToggle("slow").siblings(".acc_content:visible").slideUp("slow"); $(this).toggleClass("active"); $(this).parent().siblings("div.group").find('h3').removeClass("active"); $('.question.accordion div.group').each(function(index,value) { if($(this).find('h3').hasClass('active')) { $(this).find('h3 .icon').removeClass('icon-plus').addClass('icon-minus'); } else { $(this).find('h3 .icon').removeClass('icon-minus').addClass('icon-plus'); } }); $('.question.accordion .acc_content span').html(""); var elementID = $(this).attr("id"); if (elementID != null) { handle.find("span").html(" Getting vraag gegevens, even geduld ..."); var questionID = elementID.split("-")[1]; $.ajax({ url: 'getCourseQuizQuestionInEditMode.php?qid='+questionID, //Server script to process data type: 'POST', success: function (data) { handle.find("span").html(data); applyEditQuestionFunctions (); }, error: function() { alert ("error"); handle.next("span").html ("Kan de lijst van bestaande quizvragen niet op dit moment"); }, // Form data data: {qid: questionID}, //Options to tell jQuery not to process data or worry about content-type. cache: false, contentType: false, processData: true }); } /* var str = ""; $('.question.accordion .acc_content span').each(function(index,value) { str += $('.question.accordion .acc_content span:eq('+index+')').html(); }); */ }); } function custom_lists_ui() { $("ul.arrow li").prepend(''); $("ul.plus li").prepend(''); $("ul.check li").prepend(''); } var thresholdcolors=[['20%','darkred'], ['10%','red']] //[chars_left_in_pct, CSS color to apply to output] var uncheckedkeycodes=/(8)|(13)|(16)|(17)|(18)/ //keycodes that are not checked, even when limit has been reached. thresholdcolors.sort(function(a,b){return parseInt(a[0])-parseInt(b[0])}) //sort thresholdcolors by percentage, ascending function setformfieldsize($fields, optsize, optoutputdiv){ var $=jQuery $fields.each(function(i){ var $field=$(this) $field.data('maxsize', optsize || parseInt($field.attr('data-maxsize'))) //max character limit var statusdivid=optoutputdiv || $field.attr('data-output') //id of DIV to output status $field.data('$statusdiv', $('#'+statusdivid).length==1? $('#'+statusdivid) : null) $field.unbind('keypress.restrict').bind('keypress.restrict', function(e){ setformfieldsize.restrict($field, e) }) $field.unbind('keyup.show').bind('keyup.show', function(e){ setformfieldsize.showlimit($field) }) setformfieldsize.showlimit($field) //show status to start }) } setformfieldsize.restrict=function($field, e){ var keyunicode=e.charCode || e.keyCode if (!uncheckedkeycodes.test(keyunicode)){ if ($field.val().length >= $field.data('maxsize')){ //if characters entered exceed allowed if (e.preventDefault) e.preventDefault() return false } } } setformfieldsize.showlimit=function($field){ if ($field.val().length > $field.data('maxsize')){ var trimmedtext=$field.val().substring(0, $field.data('maxsize')); $field.val(trimmedtext); } if ($field.data('$statusdiv')){ // $field.data('$statusdiv').css('color', '').html($field.val().length); $field.data('$statusdiv').css('color', '').html('      Current ' + $field.val().length + ' : Remaining ' + ($field.data('maxsize')-$field.val().length)); var pctremaining=($field.data('maxsize')-$field.val().length)/$field.data('maxsize')*100; //calculate chars remaining in terms of percentage for (var i=0; i" + data + ""); } else { $("#responce").html (""); $("#existing-course-files").html (" Getting natuurlijk bestanden, even geduld ..."); getCourseFiles (); } $('#SendfileUpload1').show(); return false; }, error: function() { alert("Error Occurred..."); $('#SendfileUpload1').show(); }, // Form data data: formData, //Options to tell jQuery not to process data or worry about content-type. cache: false, contentType: false, processData: false }); }); $('progress').hide(); getCourseFiles (); myFancyBox (); } function progressHandlingFunction(e){ if(e.lengthComputable){ // $('progress').attr({value:e.loaded,max:e.total}); console.log (e.loaded + ' / ' + e.total); } } function getCourseFiles () { $.ajax({ url: 'getCourseFiles.php', //Server script to process data type: 'POST', success: function (data) { $("#existing-course-files").html (data); myFancyBox () ; }, error: function() { $("#existing-course-files").html ("Kan de lijst van de bestaande cursus bestanden niet op dit moment."); }, // Form data data: false, //Options to tell jQuery not to process data or worry about content-type. cache: false, contentType: false, processData: false }); } function myFancyBox () { $('.asim.fancybox').fancybox({ 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : '800', 'speedOut' : '400', 'overlayShow' : true, 'overlayColor' : '#fcfcfc', 'padding' : '3', 'hideOnContentClick' : true, 'titlePosition' : 'outside', 'titleFormat' : null, 'width' : 500, 'height' : 300, 'onClosed': function () {getCourseFiles ();} }); } function getCourseQuizzes () { $.ajax({ url: 'getCourseQuizzes.php', //Server script to process data type: 'POST', success: function (data) { $("#existing-quizzes").html (data); ApplyQuizEvents (); manageQuizFancyBox (); deleteQuizFancyBox (); // putCheckMark ('quizzes-list'); ShowQuantity ('quizzes-list'); }, error: function() { $("#existing-quizzes").html ("Kan de lijst van bestaande quizzen niet krijgen op dit moment."); }, // Form data data: false, //Options to tell jQuery not to process data or worry about content-type. cache: false, contentType: false, processData: false }); } function getCourseFilesForTrainerDashboard () { $.ajax({ url: 'getCourseFilesForTrainerDashboard.php', //Server script to process data type: 'POST', success: function (data) { $("#existing-files").html (data); editFileFancyBox (); deleteFileFancyBox (); putCheckMark ('files-list'); }, error: function() { $("#existing-files").html ("Kan de lijst van de bestaande cursus bestanden niet op dit moment."); }, // Form data data: false, //Options to tell jQuery not to process data or worry about content-type. cache: false, contentType: false, processData: false }); } function addCourseFilePageForTrainerDashboard () { $('#SendfileUpload2').click(function(){ $(this).hide(); $('progress').show(); $("#responce").html (""); // StartUploadCourseFile (); // alert ($('#file').val()); var arr = $('input[type=file]').val().split('\\'); var selected_filename = arr[arr.length-1]; var post = 'f=' + selected_filename; $.post ('CheckFileExist.php', post, function (data) { data = data.trim(); if (data == "yes") { $("#responce").html (""); $('#SendfileUpload2').show(); $('progress').hide(); } else if (data == "no") { StartUploadCourseFile (); } }); }); $('progress').hide(); } function StartUploadCourseFile () { var formData = new FormData($('form')[0]); $.ajax({ url: 'uploadScriptForTrainerDashboard.php', //Server script to process data type: 'POST', xhr: function() { // Custom XMLHttpRequest var myXhr = $.ajaxSettings.xhr(); if(myXhr.upload){ // Check if upload property exists myXhr.upload.addEventListener('progress',progressHandlingFunction, false); // For handling the progress of the upload } return myXhr; }, //Ajax events // beforeSend: beforeSendHandler, success: function (data) { if (data != '0') { $("#responce").html (""); } else { $("#responce").html (""); } $('#SendfileUpload2').show(); return false; }, error: function() { alert("Error Occurred..."); $('#SendfileUpload2').show(); }, // Form data data: formData, //Options to tell jQuery not to process data or worry about content-type. cache: false, contentType: false, processData: false }); } function RashidFrame () { $('.fancybox').fancybox({ 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : '800', 'speedOut' : '400', 'overlayShow' : true, 'overlayColor' : '#fcfcfc', 'padding' : '3', 'hideOnContentClick' : true, 'titlePosition' : 'outside', 'titleFormat' : null, 'width' : 300, 'height' : 500 }); } function Step08_trainer_signup() { // alert ("asim 1"); getCourseFilesForTrainerDashboard (); addFileFancyBox (); editFileFancyBox (); deleteFileFancyBox (); getCourseQuizzes (); addQuizFancyBox (); manageQuizFancyBox (); deleteQuizFancyBox (); addQuizQuestionAjaxCalled (); addCourseFilePageForTrainerDashboard (); scheduleFancyBox (); // CourseScheduleFancyBox (); InvitationFancyBox (); EmailTemplatesFancyBox (); personalInfoFancyBox (); // alert ("asim"); } function deleteFileFancyBox () { $('.delete-file.fancybox').fancybox({ 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : '800', 'speedOut' : '400', 'overlayShow' : true, 'overlayColor' : '#fcfcfc', 'padding' : '3', 'hideOnContentClick' : true, 'titlePosition' : 'outside', 'titleFormat' : null, 'width' : 500, 'height' : 800, 'onClosed': function () {getCourseFilesForTrainerDashboard ();} }); } function editFileFancyBox () { $('.edit-file.fancybox').fancybox({ 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : '800', 'speedOut' : '500', 'overlayShow' : true, 'overlayColor' : '#fcfcfc', 'padding' : '3', 'hideOnContentClick' : true, 'titlePosition' : 'outside', 'titleFormat' : null, 'width' : 800, 'height' : 500, 'onClosed': function () {getCourseFilesForTrainerDashboard ();} }); } function addFileFancyBox () { $('.add-file.fancybox').fancybox({ 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : '800', 'speedOut' : '400', 'overlayShow' : true, 'overlayColor' : '#fcfcfc', 'padding' : '3', 'hideOnContentClick' : true, 'titlePosition' : 'outside', 'titleFormat' : null, 'width' : 800, 'height' : 600, 'onClosed': function () {getCourseFilesForTrainerDashboard ();} }); } function deleteQuizFancyBox () { $('.delete-quiz.fancybox').fancybox({ 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : '800', 'speedOut' : '400', 'overlayShow' : true, 'overlayColor' : '#fcfcfc', 'padding' : '3', 'hideOnContentClick' : true, 'titlePosition' : 'outside', 'titleFormat' : null, 'width' : 500, 'height' : 300, 'onClosed': function () {getCourseQuizzes ();} }); } function manageQuizFancyBox () { $('.manage-quiz.fancybox').fancybox({ 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : '800', 'speedOut' : '500', 'overlayShow' : true, 'overlayColor' : '#fcfcfc', 'padding' : '3', 'hideOnContentClick' : true, 'titlePosition' : 'outside', 'titleFormat' : null, 'width' : 820, 'height' : 800, 'onClosed': function () {getCourseQuizzes ();} }); } function addQuizFancyBox () { $('.add-quiz.fancybox').fancybox({ 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : '800', 'speedOut' : '400', 'overlayShow' : true, 'overlayColor' : '#fcfcfc', 'padding' : '3', 'hideOnContentClick' : true, 'titlePosition' : 'outside', 'titleFormat' : null, 'width' : 800, 'height' : 500, 'onClosed': function () {getCourseQuizzes ();} }); } function vlm () { $('.vlm1.fancybox').fancybox({ 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : '800', 'speedOut' : '400', 'overlayShow' : true, 'overlayColor' : '#fcfcfc', 'padding' : '3', 'hideOnContentClick' : true, 'titlePosition' : 'outside', 'titleFormat' : null, 'width' : 920, 'height' : 400 }); } function scheduleFancyBox () { $('.schedule.fancybox').fancybox({ 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : '800', 'speedOut' : '400', 'overlayShow' : true, 'overlayColor' : '#fcfcfc', 'padding' : '3', 'hideOnContentClick' : true, 'titlePosition' : 'outside', 'titleFormat' : null, 'width' : 1200, 'height' : 530, 'onStart': function () { $(this).attr("href", "act_courseTimezone.php?timezone=" + $("#timezone").val()); } }); } function CourseScheduleFancyBox () { $('.course-schedule.fancybox').fancybox({ 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : '800', 'speedOut' : '400', 'overlayShow' : true, 'overlayColor' : '#fcfcfc', 'padding' : '3', 'hideOnContentClick' : true, 'titlePosition' : 'outside', 'titleFormat' : null, 'width' : 1200, 'height' : 530 }); } function InvitationFancyBox () { $('.invitation.fancybox').fancybox({ 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : '800', 'speedOut' : '400', 'overlayShow' : true, 'overlayColor' : '#fcfcfc', 'padding' : '3', 'hideOnContentClick' : true, 'titlePosition' : 'outside', 'titleFormat' : null, 'width' : 800, 'height' : 500 }); } function EmailTemplatesFancyBox () { $('.email-templates.fancybox').fancybox({ 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : '800', 'speedOut' : '400', 'overlayShow' : true, 'overlayColor' : '#fcfcfc', 'padding' : '3', 'hideOnContentClick' : true, 'titlePosition' : 'outside', 'titleFormat' : null, 'width' : 800, 'height' : 500 }); } function personalInfoFancyBox () { var folName = ""; $('.per_InfoFancyBox.fancybox').fancybox({ 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : '800', 'speedOut' : '400', 'overlayShow' : true, 'overlayColor' : '#fcfcfc', 'padding' : '3', 'hideOnContentClick' : true, 'titlePosition' : 'outside', 'titleFormat' : null, 'width' : 1000, 'height' : 550, 'onClosed': function () {window.location.reload();} // 'onClosed': function () {alert($("a#my-page-anchor").attr("href"));} // 'onCleanup': function () {alert(folName);} }); } function StudentInfoFancybox () { $('.btn-student-details.fancybox').fancybox({ 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : '800', 'speedOut' : '400', 'overlayShow' : true, 'overlayColor' : '#fcfcfc', 'padding' : '3', 'hideOnContentClick' : true, 'titlePosition' : 'outside', 'titleFormat' : null, 'width' : 800, 'height' : 400 }); } function putCheckMark (strType) { var num = 0; $('ul.check').each(function() { if ($(this).hasClass(strType)) { $(this).find("li").prepend(''); num = $(this).find("li").length; } }); $('span').filter('#'+strType+'-number').html (num); // alert (num); } function ShowQuantity (strType) { var num = $('ul.'+strType).find("li").length; $('span').filter('#'+strType+'-number').html (num); // alert (num); } function addQuizQuestionAjaxCalled () { console.log ("Loaded addQuizQuestionAjaxCalled"); $('#btnAddQuizQuestion').on('click', function() { $("span.responce1").html(" Opslaan van gegevens, even geduld ..."); var qnSt = $('#qnSt').val(); var qnType = $('#qnType').val(); var qTitle = $('#qTitle').val(); var qnTx = CKEDITOR.instances['qnTx'].getData(); var qnS1 = $('#qnS1').val(); var qnS2 = $('#qnS2').val(); var qnS3 = $('#qnS3').val(); var qnS4 = $('#qnS4').val(); var qnS5 = $('#qnS5').val(); var qnOp = $('#qnOp:checked').val(); var library_video = $('#library-video').val(); var qnSn = $('#qnSn:checked').val(); var file_qnSn = $('#file-qnSn:checked').val(); // var file_qnSn = $('input[name="file-qnSn"]:checked').val(); var qnSnc = ""; var file_qnSnc = ""; $('#option-check-add input:checkbox').each (function () { qnSnc += (this.checked ? $(this).val() : ""); }); $('#options-files-div input:checkbox').each (function () { file_qnSnc += (this.checked ? $(this).val() : ""); }); // alert (qnType + " - " + qnSn + " - " + qnSnc); if (qnType == 1) { if (qnTx == '' || qnTx == undefined || qnSn == "" || qnSn == undefined) { $("span.responce1").html(""); return; } } else if (qnType == 2) { if (qnTx == '' || qnTx == undefined || qnSnc == "" || qnSnc == "undefined") { $("span.responce1").html(""); return; } } else if (qnType == 4) { $('.tester').html(qnTx); var num = 1; var arr_blank = new Array(); var arr_options = new Array(); var empty_alert = false; // alert ($('.tester').html()); $('.tester').find('input[class="blank"]').each (function (ind) { var id = $(this).attr('id').split('-')[1]; var temp_arr = new Array(); $('.blank-' + id + ' .option-row input[type="text"]').each (function (n) { if ($(this).val() != '') { temp_arr.push($(this).val()); } }); var blank_options = temp_arr.join('|'); if (blank_options == '') { empty_alert = true; return; } arr_options.push (blank_options); // alert ($(this).html()); $(this).prop('id', 'id-' + num); // alert ($(this).html()); num++; }); if (empty_alert) { $("span.responce1").html(""); return; } qnS1 = arr_options.join('|||'); qnTx = $('.tester').html(); // alert ($('.tester').html()); $('.tester').empty (); } else if (qnType == 6) { $('.tester').html(qnTx); var num = 1; var arr_blank = new Array(); var arr_options = new Array(); var empty_alert = false; $('.tester').find('select[class="blank"]').each (function (ind) { var id = $(this).attr('id').split('-')[1]; var temp_arr = new Array(); var chk = ''; var input_val = ''; $('.blank-' + id + ' .option-row').each (function (n) { input_val = $(this).find('input[type="text"]').val(); if (input_val != '') { chk = ($(this).find('input[type="checkbox"]').is(':checked') ? 1 : 0); temp_arr.push(chk + '^' + input_val); } }); var blank_options = temp_arr.join('|'); if (blank_options == '') { empty_alert = true; return; } arr_options.push (blank_options); $(this).attr('id', 'id-' + num).empty(); num++; }); if (empty_alert) { $("span.responce1").html(""); return; } qnS1 = arr_options.join('|||'); qnTx = $('.tester').html(); $('.tester').empty (); } else if (qnType == 8) { if (qnTx == '' || qnTx == undefined || file_qnSn == "" || file_qnSn == undefined) { $("span.responce1").html(""); return; } } // alert (qnS1); // return; // var qnEx = encodeURIComponent($('#qnEx').val()); var qnEx = $('#qnEx').val(); // var post = 'qnSt=' + qnSt + '&qnType=' + qnType + '&qnTx=' + qnTx + '&qnS1=' + qnS1 + '&qnS2=' + qnS2 + '&qnS3=' + qnS3 + '&qnS4=' + qnS4 + '&qnS5=' + qnS5 + '&qnSn=' + qnSn + '&qnSnc=' + qnSnc + '&qnEx=' + qnEx; var post = new FormData(); post.append('qnSt', qnSt); post.append('qnType', qnType); post.append('qTitle', qTitle); post.append('qnTx', qnTx); if (qnType == 8 || qnType == 9) { post.append('file-qnS1', document.getElementById('file-qnS1').files[0]); post.append('file-qnS2', document.getElementById('file-qnS2').files[0]); post.append('file-qnS3', document.getElementById('file-qnS3').files[0]); post.append('file-qnS4', document.getElementById('file-qnS4').files[0]); post.append('file-qnS5', document.getElementById('file-qnS5').files[0]); post.append('file-qnSn', file_qnSn); post.append('file-qnSnc', file_qnSnc); } else { post.append('qnS1', qnS1); post.append('qnS2', qnS2); post.append('qnS3', qnS3); post.append('qnS4', qnS4); post.append('qnS5', qnS5); } post.append('qnOp', qnOp); post.append('qnSn', qnSn); post.append('qnSnc', qnSnc); post.append('qnEx', qnEx); post.append('library-video', library_video); post.append('question-file', document.getElementById('question-file').files[0]); // alert (post); $.ajax({ url: 'AjaxAddQuizQuestion.php', //Server script to process data type: 'POST', xhr: function() { // Custom XMLHttpRequest var myXhr = $.ajaxSettings.xhr(); if(myXhr.upload){ // Check if upload property exists myXhr.upload.addEventListener('progress',progressHandlingFunction, false); // For handling the progress of the upload } return myXhr; }, //Ajax events // beforeSend: beforeSendHandler, success: function (data) { $("#qnTx").val(""); $("#qnEx").val(""); $("#qTitle").val(""); CKEDITOR.instances['qnTx'].setData(''); $('.option-windows').empty (); $('#question-file').val(''); $('#library-video').val(''); $('#qnType').change (); $('#qnSn').prop('checked', false); $('.add-radio').each (function () { this.checked = false; }); for (var n=1; n<=5; n++) { $('#qnS'+n).val(""); $('#qnSn'+n).prop('checked', false); $('#file-qnSn'+n).prop('checked', false); } $('#file-qnS1').val(''); $('#file-qnS2').val(''); $('#file-qnS3').val(''); $('#file-qnS4').val(''); $('#file-qnS5').val(''); $('#file-qnSn').val(''); $('.preview-file').html('').css('height', '0px'); $("span.responce1").html(data); return false; }, error: function() { alert("Error Occurred..."); $('#SendfileUpload1').show(); }, // Form data data: post, //Options to tell jQuery not to process data or worry about content-type. cache: false, contentType: false, processData: false }); }); } function editQuizQuestionAjaxCalled () { $('#btnEditQuizQuestion').on('click', function() { $("span.responce2").html(" Opslaan van gegevens, even geduld ..."); var qid = $('#qid').val(); var qnSte = $('#qnSte').val(); var qnTypee = $('#qnTypee').val(); var qTitlee = $('#qTitlee').val(); var qnTxe = CKEDITOR.instances['qnTxe'].getData(); var qnSe1 = $('#qnSe1').val(); var qnSe2 = $('#qnSe2').val(); var qnSe3 = $('#qnSe3').val(); var qnSe4 = $('#qnSe4').val(); var qnSe5 = $('#qnSe5').val(); var qnOpe = $('#qnOpe:checked').val(); var library_video = $('#library-video-e').val(); var qnSne = $('#qnSne:checked').val(); var file_qnSne = $('#file-qnSne:checked').val(); var qnSnce = ""; var file_qnSnce = ""; $('#option-check-edit input:checkbox').each (function () { qnSnce += (this.checked ? $(this).val() : ""); }); $('#options-files-div-edit input:checkbox').each (function () { file_qnSnce += (this.checked ? $(this).val() : ""); }); if (qnTypee == 1) { if (qnSne == "" || qnSne == undefined) { $("span.responce2").html(""); return; } } else if (qnTypee == 2) { if (qnSnce == "" || qnSnce == "undefined") { $("span.responce2").html(""); return; } } else if (qnTypee == 4) { $('.tester').html(qnTxe); var num = 1; var arr_blank = new Array(); var arr_options = new Array(); var empty_alert = false; $('.tester').find('input[class="blank"]').each (function (ind) { var id = $(this).attr('id').split('-')[1]; var temp_arr = new Array(); $('.blank-' + id + ' .option-row input[type="text"]').each (function (n) { if ($(this).val() != '') { temp_arr.push($(this).val()); } }); var blank_options = temp_arr.join('|'); if (blank_options == '') { empty_alert = true; return; } arr_options.push (blank_options); $(this).prop('id', 'id-' + num); num++; }); if (empty_alert) { $("span.responce2").html(""); return; } qnSe1 = arr_options.join('|||'); qnTxe = $('.tester').html(); $('.tester').empty (); } else if (qnTypee == 6) { $('.tester').html(qnTxe); var num = 1; var arr_blank = new Array(); var arr_options = new Array(); var empty_alert = false; $('.tester').find('select[class="blank"]').each (function (ind) { var id = $(this).attr('id').split('-')[1]; var temp_arr = new Array(); var chk = ''; var input_val = ''; $('.blank-' + id + ' .option-row').each (function (n) { input_val = $(this).find('input[type="text"]').val(); if (input_val != '') { chk = ($(this).find('input[type="checkbox"]').is(':checked') ? 1 : 0); temp_arr.push(chk + '^' + input_val); } }); var blank_options = temp_arr.join('|'); if (blank_options == '') { empty_alert = true; return; } arr_options.push (blank_options); $(this).attr('id', 'id-' + num).empty(); num++; }); if (empty_alert) { $("span.responce2").html(""); return; } qnSe1 = arr_options.join('|||'); qnTxe = $('.tester').html(); $('.tester').empty (); } else if (qnTypee == 8) { if (qnTxe == '' || qnTxe == undefined || file_qnSne == "" || file_qnSne == undefined) { $("span.responce1").html(""); return; } } // var qnExe = encodeURIComponent($('#qnExe').val()); var qnExe = $('#qnExe').val(); // var post = 'qid=' + qid + '&qnSte=' + qnSte + '&qnTypee=' + qnTypee + '&qnTxe=' + qnTxe + '&qnSe1=' + qnSe1 + '&qnSe2=' + qnSe2 + '&qnSe3=' + qnSe3 + '&qnSe4=' + qnSe4 + '&qnSe5=' + qnSe5 + '&qnSne=' + qnSne + '&qnSnce=' + qnSnce + '&qnExe=' + qnExe; var post = new FormData(); post.append('qid', qid); post.append('qnSte', qnSte); post.append('qnTypee', qnTypee); post.append('qTitlee', qTitlee); post.append('qnTxe', qnTxe); if (qnTypee == 8 || qnTypee == 9) { post.append('file-qnSe1', document.getElementById('file-qnSe1').files[0]); post.append('file-qnSe2', document.getElementById('file-qnSe2').files[0]); post.append('file-qnSe3', document.getElementById('file-qnSe3').files[0]); post.append('file-qnSe4', document.getElementById('file-qnSe4').files[0]); post.append('file-qnSe5', document.getElementById('file-qnSe5').files[0]); post.append('file-qnSne', file_qnSne); post.append('file-qnSnce', file_qnSnce); } else { post.append('qnSe1', qnSe1); post.append('qnSe2', qnSe2); post.append('qnSe3', qnSe3); post.append('qnSe4', qnSe4); post.append('qnSe5', qnSe5); } post.append('qnOpe', qnOpe); post.append('qnSne', qnSne); post.append('qnSnce', qnSnce); post.append('qnExe', qnExe); post.append('library-video-e', library_video); post.append('question-file-e', document.getElementById('question-file-e').files[0]); // alert (qnOpe); $.ajax({ url: 'AjaxEditQuizQuestion.php', //Server script to process data type: 'POST', xhr: function() { // Custom XMLHttpRequest var myXhr = $.ajaxSettings.xhr(); if(myXhr.upload){ // Check if upload property exists myXhr.upload.addEventListener('progress',progressHandlingFunction, false); // For handling the progress of the upload } return myXhr; }, //Ajax events // beforeSend: beforeSendHandler, success: function (data) { $("span.responce2").html(data); if (qnTypee == 4 || qnTypee == 5) { $('#Q-'+qid+' span').html(qTitlee); } else { $('#Q-'+qid+' span').html($(qnTxe).text()); } doNumbering (); LoadMediaForQuestion (qid); return false; }, error: function() { alert("Error Occurred..."); $('#SendfileUpload1').show(); }, // Form data data: post, //Options to tell jQuery not to process data or worry about content-type. cache: false, contentType: false, processData: false }); }); } function LoadMediaForQuestion (qid) { console.log ('loading media'); var post = 'qid=' + qid; $.post('LoadMediaForQuestion.php', post, function (data) { $('.mc-' + qid).html(data); console.log(data); ApplyRemoveMediaButton (); }); } function ApplyRemoveMediaButton () { $('.remove-media').off('click'); $('.remove-media').click (function () { var qid = $(this).attr('id').split('-')[1]; var post = 'qid=' + qid; $.post('RemoveMediaFromQuestion.php', post, function (data) { $('#question-file-e').val(''); $('#library-video-e').val(''); LoadMediaForQuestion (qid); }); }); } function ApplyVideoBankButton () { $('.library-videos-e').hide(); var scrt = $("
    ").append($('.library-videos .wms-main-strip').clone()).html(); $('.library-videos-e').append(scrt); $('a.btn-open-bank-e').click (function () { // alert ('called'); /* if ($('.library-videos-e').css('display') == 'block') { $('.library-videos-e').hide(); isBankOpen = false; } else { $('.library-videos-e').show(); isBankOpen = true; } */ $('.library-videos-e').show(); // alert ('called 2'); }); $('#question-file-e').change(function () { if ($(this).val() != '') { $('.selected-video-e span.media-container').empty(); $('#library-video-e').val(''); } }); $('.library-videos-e ul.video-strip li a').click (function () { var video_name = $(this).attr('data-video'); var str = ''; // console.log (video_name); // console.log ($(this).parent().find('img').attr('src')); str += '

    Selected Video From Course Videos

    '; str += '
    ' str += ' '; str += '
    '; $('.selected-video-e span.media-container').empty().html (str); $('#question-file-e').val(''); $('#library-video-e').val(video_name); }); } function deleteQuizQuestionAjaxCalled () { $('#btnDeleteQuizQuestion').on('click', function() { $("span.responce2").html(" Vraag het verwijderen, even geduld ..."); var qid = $('#qid').val(); var post = 'qid=' + qid; // window.open('AjaxDeleteQuizQuestion.php?'+post, "popupWindow", "width=600,height=600,scrollbars=yes"); $.post('AjaxDeleteQuizQuestion.php', post, function(data) { $("span.responce3").html(data); Init_ManageQuizPage (); }); }); } function Init_ManageQuizPage () { $('progress').show(); if ($(".tab_content").hasClass("existing-questions")) { classes = {}; $(".tab_content").each(function() { $($(this).attr('class').split(' ')).each(function() { if (this !== '') { classes[this] = this; } }); }); //build the classnames quizID = ''; for (class_name in classes) { if (class_name.split('-')[0] == 'quiz') { quizID = class_name.split('-')[1]; } } getQuizQuestionsData (quizID); } $('#qnType').change (function () { var selectedOption = $(this).val(); // alert (selectedOption); switch (selectedOption) { case "1": { // Single Answer with Text Options $("#option-radio-add").show(); $("#option-check-add").hide(); $("#possible-solutions-add").show(); $('#caption-option').show(); $("#possible-drop-options").hide(); $("#options-boxes-div").show(); $("#options-files-div").hide(); $('#open-ended-options-add').hide (); $(".qTitle").hide(); CKEDITOR.instances['qnTx'].destroy(); CKEDITOR.replace( 'qnTx'); break; } case "2": { // Multiple Answer with Text Options $("#option-radio-add").hide(); $("#option-check-add").show(); $("#possible-solutions-add").show(); $('#caption-option').show(); $("#possible-drop-options").hide(); $("#options-boxes-div").show(); $("#options-files-div").hide(); $('#open-ended-options-add').hide (); $(".qTitle").hide(); CKEDITOR.instances['qnTx'].destroy(); CKEDITOR.replace( 'qnTx'); break; } case "3": { // Open Ended $("#option-radio-add").hide(); $("#option-check-add").hide(); $("#possible-solutions-add").hide(); $('#caption-option').hide(); $("#possible-drop-options").hide(); $(".qTitle").hide(); $('#open-ended-options-add').show (); CKEDITOR.instances['qnTx'].destroy(); CKEDITOR.replace( 'qnTx'); break; } case "4": { // Type in the blank $("#option-radio-add").hide(); $("#option-check-add").hide(); $("#possible-solutions-add").hide(); $("#possible-drop-options").hide(); $('#open-ended-options-add').hide (); $(".qTitle").show(); CKEDITOR.instances['qnTx'].destroy(); CKEDITOR.replace( 'qnTx', { extraPlugins: 'colorbutton,custom-type-in-the-blank' }); break; } case "5": { // Drop in the blank $("#option-radio-add").hide(); $("#option-check-add").hide(); $("#possible-solutions-add").hide(); $("#possible-drop-options").show(); $('#open-ended-options-add').hide (); $(".qTitle").show(); CKEDITOR.instances['qnTx'].destroy(); CKEDITOR.replace( 'qnTx', { extraPlugins: 'colorbutton,custom-drop-in-the-blank' }); break; } case "6": { // Select in the blank $("#option-radio-add").hide(); $("#option-check-add").hide(); $("#possible-solutions-add").hide(); $("#possible-drop-options").hide(); $('#open-ended-options-add').hide (); $(".qTitle").show(); CKEDITOR.instances['qnTx'].destroy(); CKEDITOR.replace( 'qnTx', { extraPlugins: 'colorbutton,custom-select-in-the-blank' }); break; } case "8": { // Single Answer (Audio/Video/Image Options) $("#option-radio-add").hide(); $("#option-check-add").hide(); $("#possible-solutions-add").show(); $("#possible-drop-options").hide(); $('#caption-option').hide(); $("#options-boxes-div").hide(); $("#options-files-div").show(); $('#options-files-div input[type="radio"]').show(); $('#options-files-div input[type="checkbox"]').hide(); $('#open-ended-options-add').hide (); $(".qTitle").hide(); CKEDITOR.instances['qnTx'].destroy(); CKEDITOR.replace( 'qnTx'); break; } case "9": { // Multiple Answers (Audio/Video/Image Options) $("#option-radio-add").hide(); $("#option-check-add").hide(); $("#possible-solutions-add").show(); $("#possible-drop-options").hide(); $('#caption-option').hide(); $("#options-boxes-div").hide(); $("#options-files-div").show(); $('#options-files-div input[type="radio"]').hide(); $('#options-files-div input[type="checkbox"]').show(); $('#open-ended-options-add').hide (); $(".qTitle").hide(); CKEDITOR.instances['qnTx'].destroy(); CKEDITOR.replace( 'qnTx'); break; } case "10": { // Multiple Correct Answers With Any Selection (Audio/Video/Image Options) $("#option-radio-add").hide(); $("#option-check-add").hide(); $("#possible-solutions-add").show(); $("#possible-drop-options").hide(); $('#caption-option').hide(); $("#options-boxes-div").hide(); $("#options-files-div").show(); $('#options-files-div input[type="radio"]').hide(); $('#options-files-div input[type="checkbox"]').show(); $('#open-ended-options-add').hide (); $(".qTitle").hide(); CKEDITOR.instances['qnTx'].destroy(); CKEDITOR.replace( 'qnTx'); break; } } // alert (selectedOption); }); $('#add-drop-option').click (function () { var txt = $('#drop-option-text').val(); }); } function applyEditQuestionFunctions () { $('#qnTypee').change (function () { var selectedOption = $(this).val(); onChangeQuestionTypeInEditMode (selectedOption); }); editQuizQuestionAjaxCalled (); deleteQuizQuestionAjaxCalled (); ApplyRemoveMediaButton (); ApplyVideoBankButton (); CKEDITOR.replace('qnTxe'); onChangeQuestionTypeInEditMode ($('#qnTypee').val()); $('input[type="file"]').off('change'); $('input[type="file"]').change(function(){ readURL(this); }); ExpandPreviewBox (); // $('span.responce2').html ("applied"); } function onChangeQuestionTypeInEditMode (selectedOption) { switch (selectedOption) { case "1": { $("#option-radio-edit").show(); $("#option-check-edit").hide(); $("#possible-solutions-edit").show(); $('#caption-option-edit').show(); $("#possible-drop-options-edit").hide(); $("#options-boxes-div-edit").show(); $("#options-files-div-edit").hide(); $('#open-ended-options-edit').hide (); $(".qTitlee").hide(); CKEDITOR.instances['qnTxe'].destroy(); CKEDITOR.replace( 'qnTxe'); break; } case "2": { $("#option-radio-edit").hide(); $("#option-check-edit").show(); $("#possible-solutions-edit").show(); $('#caption-option-edit').show(); $("#possible-drop-options-edit").hide(); $("#options-boxes-div-edit").show(); $("#options-files-div-edit").hide(); $('#open-ended-options-edit').hide (); $(".qTitlee").hide(); CKEDITOR.instances['qnTxe'].destroy(); CKEDITOR.replace( 'qnTxe'); break; } case "3": { $("#option-radio-edit").show(); $("#option-check-edit").show(); $("#possible-solutions-edit").hide(); $("#possible-drop-options-edit").hide(); $('#open-ended-options-edit').show (); $(".qTitlee").hide(); CKEDITOR.instances['qnTxe'].destroy(); CKEDITOR.replace( 'qnTxe'); break; } case "4": { $("#option-radio-edit").hide(); $("#option-check-edit").hide(); $("#possible-solutions-edit").hide(); $("#possible-drop-options-edit").hide(); $('#open-ended-options-edit').hide (); $(".qTitlee").show(); CKEDITOR.instances['qnTxe'].destroy(); CKEDITOR.replace( 'qnTxe', { extraPlugins: 'colorbutton,custom-type-in-the-blank', on: { instanceReady: function() { // alert( this.name ); // 'editor1' ApplyCloseOption (); ApplyNewAddOption (); ApplyFillOptions (); ApplyFirstValuesToBlanks (); $.MyVars.cntr = 1000; // Initialized in Manage_Quiz.php $.MyVars.int_cntr = 1000; // Initialized in Manage_Quiz.php } } }); break; } case "5": { $("#option-radio-edit").hide(); $("#option-check-edit").hide(); $("#possible-solutions-edit").hide(); $("#possible-drop-options-edit").show(); $('#open-ended-options-edit').hide (); $(".qTitlee").show(); CKEDITOR.instances['qnTxe'].destroy(); CKEDITOR.replace( 'qnTxe', { extraPlugins: 'colorbutton,custom-drop-in-the-blank' }); break; } case "6": { $("#option-radio-edit").hide(); $("#option-check-edit").hide(); $("#possible-solutions-edit").hide(); $("#possible-drop-options-edit").hide(); $('#open-ended-options-edit').hide (); $(".qTitlee").show(); CKEDITOR.instances['qnTxe'].destroy(); CKEDITOR.replace( 'qnTxe', { extraPlugins: 'colorbutton,custom-select-in-the-blank', on: { instanceReady: function() { // alert( this.name ); // 'editor1' ApplyCloseOptionForSelectBlank (); ApplyNewAddOptionForSelectBlank (); ApplyFillOptionsForSelectBlank (); ApplyFirstValuesToBlanksForSelectBlank (); $.MyVars.cntr = 1000; // Initialized in Manage_Quiz.php $.MyVars.int_cntr = 1000; // Initialized in Manage_Quiz.php } } }); break; } case "8": { // Single Answer (Audio/Video/Image Options) $("#option-radio-edit").hide(); $("#option-check-edit").hide(); $("#possible-solutions-edit").show(); $("#possible-drop-options").hide(); $('#caption-option-edit').hide(); $("#options-boxes-div-edit").hide(); $("#options-files-div-edit").show(); $('#options-files-div-edit input[type="radio"]').show(); $('#options-files-div-edit input[type="checkbox"]').hide(); $('#open-ended-options-edit').hide (); $(".qTitlee").hide(); CKEDITOR.instances['qnTxe'].destroy(); CKEDITOR.replace( 'qnTxe'); break; } case "9": { // Multiple Answers (Audio/Video/Image Options) $("#option-radio-edit").hide(); $("#option-check-edit").hide(); $("#possible-solutions-edit").show(); $("#possible-drop-options").hide(); $('#caption-option-edit').hide(); $("#options-boxes-div-edit").hide(); $("#options-files-div-edit").show(); $('#options-files-div-edit input[type="radio"]').hide(); $('#options-files-div-edit input[type="checkbox"]').show(); $('#open-ended-options-edit').hide (); $(".qTitlee").hide(); CKEDITOR.instances['qnTxe'].destroy(); CKEDITOR.replace( 'qnTxe'); break; } case "10": { // Multiple Correct Answers With Any Selection (Audio/Video/Image Options) $("#option-radio-edit").hide(); $("#option-check-edit").hide(); $("#possible-solutions-edit").show(); $("#possible-drop-options").hide(); $('#caption-option-edit').hide(); $("#options-boxes-div-edit").hide(); $("#options-files-div-edit").show(); $('#options-files-div-edit input[type="radio"]').hide(); $('#options-files-div-edit input[type="checkbox"]').show(); $('#open-ended-options-edit').hide (); $(".qTitlee").hide(); CKEDITOR.instances['qnTxe'].destroy(); CKEDITOR.replace( 'qnTxe'); break; } } // alert (selectedOption); } function applySubTrainerCourseFunctions () { onChangePublishForSubTrainerCourse (); onPreviewForSubTrainerCourse (); } function onChangePublishForSubTrainerCourse () { $('.sub-trainer-course-publish').click (function () { var cid = $(this).val(); var post = "cid=" + cid; $.post('AjaxPublishSubTrainerCourse.php', post, function(data) { /* $(this).parent().find('i').hide();*/ $('#cb-'+cid).parent().find('i').hide(); }); }); } function onPreviewForSubTrainerCourse () { $('.sub-trainer-course-preview').click (function () { // var selectedOption = $(this).val(); }); } function YoutubeFancyBox () { $('.youtube.fancybox').fancybox({ 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : '800', 'speedOut' : '400', 'overlayShow' : true, 'overlayColor' : '#fcfcfc', 'padding' : '3', 'hideOnContentClick' : true, 'titlePosition' : 'outside', 'titleFormat' : null, 'width' : 420, 'height' : 323 }); } function addTrainerFancyBox () { // alert ("ccc"); $('.add-trainer.fancybox').fancybox({ 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : '800', 'speedOut' : '400', 'overlayShow' : true, 'overlayColor' : '#fcfcfc', 'padding' : '3', 'hideOnContentClick' : true, 'titlePosition' : 'outside', 'titleFormat' : null, 'width' : 800, 'height' : 500, 'onClosed': function () { LoadTrainerList (); LoadAssistantTrainerList (); /* LoadTraineeList ('unassigned'); LoadStudentInGroupList ('ungrouped'); ApplyCourseEvents (); ApplyTraineeButtonEvents (); ApplyGroupButtonEvents (); */ } }); } function addTraineeFancyBox () { $('.add-trainee.fancybox').fancybox({ 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : '800', 'speedOut' : '400', 'overlayShow' : true, 'overlayColor' : '#fcfcfc', 'padding' : '3', 'hideOnContentClick' : true, 'titlePosition' : 'outside', 'titleFormat' : null, 'width' : 900, 'height' : 650, 'onClosed': function () { LoadTrainerList (); LoadTraineeList ('unassigned'); LoadStudentInGroupList ('ungrouped'); ApplyCourseEvents (); ApplyTraineeButtonEvents (); ApplyGroupButtonEvents (); } }); } //==================================== Functions Used in CKEDITOR for Quizzes (Start) ======================================= //------------------------ Function For Type in The Blanks (Start) ------------------------------------ function ApplyNewAddOption () { $('.add-new-option').off('click'); $('.add-new-option').click (function () { var id = $(this).attr('data-id'); // alert (id); var str = '
    ' + '
    ' + '
    ' + '
    '; $.MyVars.int_cntr ++; // $('.blank-' + id).append (str); $(str).insertAfter ($(this).parent().parent()); ApplyNewAddOption (); ShowHideRemoveOption (id); }); $('.remove-new-option').off('click'); $('.remove-new-option').click (function () { var id = $(this).attr('data-id'); $(this).parent().parent().remove(); ShowHideRemoveOption (id); }); } function ApplyCloseOption () { $('.btn-close').off('click'); $('.btn-close').click (function () { var id = $(this).attr('data-id').split('-')[1]; var first_value = $(this).parent().find('.option-row input[type="text"]').val(); var len = first_value.length; var iframe = $('iframe').contents(); /* iframe.find('input#id-' + id).attr('value', first_value);*/ iframe.find('input#id-' + id).val(first_value); if (len > 20) { // iframe.find('input#id-' + id).attr('size', Math.ceil(len*0.85)); iframe.find('input#id-' + id).attr('style', 'width: ' + (7 * Math.ceil(len*0.85)) + 'px'); } $(this).parent().fadeOut (); }); } function ApplyFillOptions () { var iframe = $('iframe').contents(); // alert (iframe.find('.blank').length); iframe.find('.blank').off('dblclick'); iframe.find('.blank').dblclick (function () { var id = $(this).attr('id').split('-')[1]; // alert (id); $('.option-window').fadeOut (); $('.blank-' + id).fadeIn (); }); } function ShowHideRemoveOption (id) { // alert (".blank-" + id + " = " + $('.blank-' + id + ' .option-row').length); if ($('.blank-' + id + ' .option-row').length > 1) { $('.blank-' + id + ' .option-row a.remove-new-option').show (); } else { $('.blank-' + id + ' .option-row a.remove-new-option').hide (); } } function ApplyFirstValuesToBlanks () { console.log ("ApplyFirstValuesToBlanks called"); var iframe = $('iframe').contents(); iframe.find('.blank').each (function (ind) { var id = $(this).attr('id').split('-')[1]; var first_value = $('.option-windows .option-window.blank-' + id).find('.option-row input[type="text"]').val(); var len = first_value.length; var iframe = $('iframe').contents(); iframe.find('input#id-' + id).val(first_value); if (len > 30) { // iframe.find('input#id-' + id).attr('size', Math.ceil(len*0.85)); iframe.find('input#id-' + id).attr('style', 'width: ' + (7 * Math.ceil(len*0.85)) + 'px'); } }); } //------------------------ Function For Type in The Blanks (End) ------------------------------------ //------------------------ Function For Select In The Blanks (Start) ------------------------------------ function ApplyNewAddOptionForSelectBlank () { $('.add-new-option').off('click'); $('.add-new-option').click (function () { var id = $(this).attr('data-id'); // alert (id); var str = '
    ' + '
    ' + '
    ' + '
    ' + '
    '; $.MyVars.int_cntr ++; // $('.blank-' + id).append (str); $(str).insertAfter ($(this).parent().parent()); ApplyNewAddOptionForSelectBlank (); ShowHideRemoveOption (id); }); $('.remove-new-option').off('click'); $('.remove-new-option').click (function () { var id = $(this).attr('data-id'); $(this).parent().parent().remove(); ShowHideRemoveOption (id); }); } function ApplyCloseOptionForSelectBlank () { $('.btn-close').off('click'); $('.btn-close').click (function () { var id = $(this).attr('data-id').split('-')[1]; var first_value = ''; $(this).parent().find('.option-row').each (function () { if ($(this).find('input[type="checkbox"]').is(':checked')) { first_value = $(this).find('input[type="text"]').val(); return false; } }); // var first_value = $(this).parent().find('.option-row input[type="text"]').val(); var iframe = $('iframe').contents(); iframe.find('select#id-' + id).empty().append(''); $(this).parent().fadeOut (); }); } function ApplyFillOptionsForSelectBlank () { var iframe = $('iframe').contents(); // alert (iframe.find('.blank').length); iframe.find('.blank').off('dblclick'); iframe.find('.blank').dblclick (function () { var id = $(this).attr('id').split('-')[1]; // alert (id); $('.option-window').fadeOut (); $('.blank-' + id).fadeIn (); }); } function ApplyFirstValuesToBlanksForSelectBlank () { var iframe = $('iframe').contents(); iframe.find('.blank').each (function (ind) { var id = $(this).attr('id').split('-')[1]; // var first_value = $('.option-windows .option-window.blank-' + id).find('.option-row input[type="text"]').val(); var first_value = ''; $('.option-windows .option-window.blank-' + id).find('.option-row').each (function () { if ($(this).find('input[type="checkbox"]').is(':checked')) { first_value = $(this).find('input[type="text"]').val(); return false; } }); var iframe = $('iframe').contents(); // iframe.find('input#id-' + id).val(first_value); iframe.find('select#id-' + id).empty().append(''); }); } //------------------------ Function For Select in The Blanks (End) ------------------------------------ //==================================== Functions Used in CKEDITOR for Quizzes (End) ========================================