var rootPath = "https://www.tamaonline.nl/"; var myPath = "https://www.tamaonline.nl/collectiveFolder/"; $(function() { services_animation(); // mobile_menu(); // init_menu(); init_fancybox(); // init_tooltip(); // init_flickr(); // init_testimonials_slide(); portfolio_filter(); goto_top(); contact_form(); tabs_ui(); accordion_ui(); custom_lists_ui(); // init_tweets(); AvailableCourses_filter(); form_trainee_signup(); form_trainer_signup(); form_trainer_personalinfo(); form_trainee_personalinfo(); form_trainer_personalinfo_changepassword(); form_trainee_personalinfo_changepassword(); form_trainer_create_course(); 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(); course_file_uploading_page (); Step08_trainer_signup (); loginTVT(); trainee_loginTVT(); forgotPWD(); form_contactTrainer(); BigFancyBox (); vlm (); }); // =========================== Functions added by Khalil Mangi ============================ // Trainer course deadline form =================================================================================== function form_trainer_course_deadline() { $('#trainer_deadline').on('click', function() { var deadline = $("#deadline").attr("checked") ? 1 : 0; var CDeadline = $('input#CDeadline').val(); var DType = $("#DType option:selected").val(); var post='deadline=' + deadline + '&CDeadline=' + CDeadline + '&DType=' + DType; var act_file = myPath +"act_course_trainer_deadline.php"; $.post(act_file, 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; var act_file = myPath +"act_course_invitationEmail.php"; $.post(act_file, 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; var act_file = myPath +"act_course_reminderEmail.php"; $.post(act_file, 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; var act_file = myPath +"act_course_completionEmail.php"; $.post(act_file, 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; var act_file = myPath +"act_trainee_notification_emails.php"; $.post(act_file, 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; var act_file = myPath +"act_course_certs.php"; $.post(act_file, 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; var act_file = myPath +"act_course_access.php"; $.post(act_file, 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 invto = $('input#invto').val(); var invsubject = $('input#invsubject').val(); var invbody = $('textarea#invbody').val(); var post='invto='+invto+ '&invsubject=' + invsubject + '&invbody=' + invbody; var act_file = myPath +"act_invemail_existingTrainees.php"; $.post(act_file, 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 invto = $('input#invto').val(); var invsubject = $('input#invsubject').val(); var invbody = $('textarea#invbody').val(); var post='invto='+invto+ '&invsubject=' + invsubject + '&invbody=' + invbody; var act_file = myPath +"act_invemail_anyone.php"; $.post(act_file, post, function(data) { $("div#responce_course_invemail_anyone").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 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 CType = $("#CType option:selected").val(); var Cduration = $('input#Cduration').val(); var Dtype = $("#Dtype option:selected").val(); var CRequirement = $('textarea#CRequirement').val(); //alert( document.getElementById( 'LDesc' ).value ); // The current editor data. var LDesc = escape(CKEDITOR.instances['LDesc'].getData()); // return false; var post='CTitle=' + CTitle + '&CDesc=' + CDesc + '&CFree=' + CFree +'&Clevel=' + Clevel +'&cCurrency_code=' + cCurrency_code +'&cCurrency_text='+ cCurrency_text +'&CType=' + CType +'&Cduration=' + Cduration +'&Dtype=' + Dtype +'&LDesc=' + LDesc +'&CRequirement=' + CRequirement +'&CCreator=' + CCreator + '&CEmail=' + CEmail; var act_file = myPath +"Post_course_trainer.php"; $.post(act_file, post, function(data) { $("div#responce_trainer_course").html(data); }); }); } // ==================== Course creation by trainer ================================= 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 post='CTitle='+CTitle+ '&CDesc=' + CDesc; var act_file = myPath +"act_step02_trainer_createCourse.php"; $.post(act_file, post, function(data) { $("div#responce_trainer_create_course").html(data); }); }); } // ==================== Trainer signup ================================= function form_trainer_signup() { $("#T_name").change(function(){ var file = myPath +"check_username.php"; $("#message").html(" Controleren ..."); var username=$("#T_name").val(); $.ajax({ type:"post", url: file, data:"username="+username, success:function(data){ if(data==0){ $("#message").html("beschikbaar"); } else{ $("#message").html("niet beschikbaar"); } } }); }); $('#trainer_signup').on('click', function() { $("div#responce").html(" Opslaan van gegevens, even geduld ..."); var T_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 WebsiteAdd = $('input#WebsiteAdd').val(); var post='U_name=' + T_name + '&pwd_1=' + pwd_1 + '&pwd_2=' + pwd_2 + '&FullName=' + FullName + '&WebsiteAdd=' + WebsiteAdd + '&email=' + email; var act_file = myPath +"act_trainer_signup.php"; $.post(act_file, post, function(data) { $("div#responce").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 FullName = encodeURIComponent($('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 = encodeURIComponent($('input#zip_code').val()); var city = encodeURIComponent($('input#city').val()); var state = encodeURIComponent($('input#state').val()); var country = encodeURIComponent($('input#country').val()); var post='U_name=' + U_name +'&FullName=' + FullName +'&tele_no=' + tele_no +'&st_add=' + st_add +'&zip_code=' + zip_code +'&city=' + city +'&state=' + state +'&country=' + country + '&WebsiteAdd=' + WebsiteAdd + '&email=' + email; var act_file = myPath +"act_trainerPersonalinfoRashid.php"; $.post(act_file, post, function(data) { $("div#responce_trainer_personalinfo").html(data); }); }); } // ==================== Trainee personal information form ================================= function form_trainee_personalinfo() { $('#trainee_personal').on('click', function() { $("div#responce_trainee_personalinfo").html(" Opslaan van gegevens, even geduld ..."); var FullName = encodeURIComponent($('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 = encodeURIComponent($('input#zip_code').val()); var city = encodeURIComponent($('input#city').val()); var state = encodeURIComponent($('input#state').val()); var country = encodeURIComponent($('input#country').val()); var post='U_name=' + U_name +'&FullName=' + FullName +'&tele_no=' + tele_no +'&st_add=' + st_add +'&zip_code=' + zip_code +'&city=' + city +'&state=' + state +'&country=' + country + '&WebsiteAdd=' + WebsiteAdd + '&email=' + email; var act_file = myPath +"act_traineePersonalinfo.php"; $.post(act_file, post, function(data) { $("div#responce_trainee_personalinfo").html(data); }); }); } //=============== Sub 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 ; var act_file = myPath +"act_trainerPersonalPwd.php"; $.post(act_file, post, function(data) { $("div#responce_trainer_password").html(data); }); }); } //=============== Trainee Change Password ===================================== function form_trainee_personalinfo_changepassword() { $('#trainee_personal_changepwd').on('click', function() { $("div#responce_trainee_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 ; var act_file = myPath +"act_traineePersonalPwd.php"; $.post(act_file, post, function(data) { $("div#responce_trainee_password").html(data); }); }); } //=============== Trainee signup ===================================== function form_trainee_signup() { $("#U_name").change(function(){ var file = myPath +"check_username.php"; //alert (file); $("#message").html(" Controleren ..."); var username=$("#U_name").val(); $.ajax({ type:"post", url: file, data:"username="+username, success:function(data){ // alert ("(" + data + ")"); if(data==0){ $("#message").html("beschikbaar"); } else{ $("#message").html("niet beschikbaar"); } } }); }); $('#trainee_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 phone = $('input#phone').val(); var study_level = $('input#study_level').val(); var job = $('input#job').val(); var age = $('input#age').val(); var cid = $('input#cid').val(); var ac = $('input#ac').val(); var act_file = myPath +"act_trainee_signup.php"; var post='U_name=' + U_name + '&pwd_1=' + pwd_1 + '&pwd_2=' + pwd_2 + '&FullName=' + FullName + '&email=' + email + '&phone=' + phone + '&study_level=' + study_level + '&job=' + job + '&age=' + age + '&cid=' + cid + '&ac=' + ac; $.post( act_file, post, function(data) { $("div#responce").html(data); }); }); } // ===================== Login Page =============================================================== function loginTVT() { $('#loginTVTsend').on('click', function() { $("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; var act_file = myPath +"act_login.php"; console.log (act_file); //alert(act_file); $.post(act_file, post, function(data) { $("div#responce").html(data); }); }); } // ===================== Trainee Enrollment Login Page =============================================================== function trainee_loginTVT() { $('#trainee_btn').on('click', function() { // alert ("asim"); $("div#responce").html(" Het verwerken van gegevens, even geduld ..."); var U_name = $('input#U_name').val(); var pwd_1 = $('input#pwd_1').val(); var cid = $('input#cid').val(); var ac = $('input#ac').val(); var post='U_name=' + U_name + '&pwd_1=' + pwd_1 + '&cid=' + cid + '&ac=' + ac; // var act_file = myPath + "act_trainee_login.php"; var act_file = rootPath + "act_login.php"; $.post(act_file, post, function(data) { $("div#responce").html(data); }); }); } // ===================== Contact Trainer thru email =============================================================== function form_contactTrainer() { $('#contact_trainer').on('click', function() { alert ("test"); $("div#responce_contactTrainer").html(" Het verwerken van gegevens, even geduld ..."); var email = $("#email option:selected").val(); var trainer_name = $("#email option:selected").text(); var subjectTrainer = $('input#subjectTrainer').val(); var message = $('textarea#message').val(); var post='email=' + email + '&subjectTrainer=' + subjectTrainer + '&trainer_name=' + trainer_name + '&message=' + message; var act_file = myPath +"act_emailTrainer.php"; alert (post); $.post(act_file, post, function(data) { alert (data); $("div#responce_contactTrainer").html(data); }); }); } // ===================== Contact Trainer thru email main page =============================================================== function contact_form() { $('#contact_send').on('click', function() { $("div#responce").html(" Het verwerken van gegevens, even geduld ..."); var name = $('input#name').val(); var email = $('input#email').val(); var message = encodeURIComponent($('textarea#message').val()); var post = 'name=' + name + '&email=' + email + '&message=' + message; var act_file = myPath +"sendmail.php"; $.post(act_file, post, function(data) { $("div#responce").html(data); }); }); $('#contact_save').on('click', function() { $("div#responce").html(" Het verwerken van gegevens, even geduld ..."); var name = $('input#name').val(); var email = $('input#email').val(); var message = encodeURIComponent($('textarea#message').val()); var post = 'name=' + name + '&email=' + email + '&message=' + message; var act_file = myPath +"savemail.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 = myPath +"act_forgotPassword.php"; $.post(act_file, post, function(data) { $("div#responce").html(data); }); }); } // ================================================================================================= 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; }); } 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 AvailableCourses_filter() { var arr = new Array(); arr.push({item_key: "All", item_value: "Cursusaanbod"});arr.push({item_key: "Basic", item_value: "Basic"});arr.push({item_key: "Intermediate", item_value: "Intermediate"});arr.push({item_key: "Advance", item_value: "Advance"});arr.push({item_key: "Refresher", item_value: "Refresher"}); $('.AvailableCourses ul.sort li').eq(0).addClass('current'); $('.AvailableCourses 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(' ','-'); // alert (filterVal); if(filterVal == 'all') { $('ul.AvailableCourses_sort li.hidden').fadeIn('slow').removeClass('hidden'); } else { $('ul.AvailableCourses_sort li').each(function() { if(!$(this).hasClass(filterVal)) { $(this).fadeOut('normal').addClass('hidden'); } else { $(this).fadeIn('slow').removeClass('hidden'); } }); } return false; }); } function goto_top() { $("#footer #sub_footer a.back_to_top").click(function(){ $('html, body').animate({scrollTop:0}, 400); return false; }); } 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"); $(activeTab).fadeIn(1000); return false; }); } 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(){ $(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 custom_lists_ui() { $("ul.arrow li").prepend(''); $("ul.plus li").prepend(''); $("ul.check li").prepend(''); } function BigFancyBox () { $('.bigF.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 () {}, 'onClosed': function () {window.location.reload();} }); } function course_file_uploading_page () { $('#SendfileUpload1').click(function(){ $(this).hide(); $('progress').show(); $("#responce").html (""); var formData = new FormData($('form')[0]); $.ajax({ url: '../uploadScript.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 (""); $("#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}); } } 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); manageQuizFancyBox (); deleteQuizFancyBox (); putCheckMark ('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 (""); 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 }); }); $('progress').hide(); } function Step08_trainer_signup() { // alert ("asim 1"); getCourseFilesForTrainerDashboard (); addFileFancyBox (); editFileFancyBox (); deleteFileFancyBox (); getCourseQuizzes (); addQuizFancyBox (); manageQuizFancyBox (); deleteQuizFancyBox (); addQuizQuestionAjaxCalled (); addCourseFilePageForTrainerDashboard (); scheduleFancyBox (); 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' : 500, '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' : 937, 'height' : 450 }); } 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 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' : 550, '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' : 850, 'height' : 500, 'onClosed': function () {window.location.reload();} // 'onClosed': function () {alert($("a#my-page-anchor").attr("href"));} // 'onCleanup': function () {alert(folName);} }); } 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 addQuizQuestionAjaxCalled () { $('#btnAddQuizQuestion').on('click', function() { $("span.responce1").html(" Opslaan van gegevens, even geduld ..."); var qnSt = $('#qnSt').val(); var qnType = $('#qnType').val(); var qnTx = $('#qnTx').val(); var qnS1 = $('#qnS1').val(); var qnS2 = $('#qnS2').val(); var qnS3 = $('#qnS3').val(); var qnS4 = $('#qnS4').val(); var qnS5 = $('#qnS5').val(); var qnSn = $('#qnSn:checked').val(); var qnSnc = ""; $('#option-check-add input:checkbox').each (function () { qnSnc += (this.checked ? $(this).val() : ""); }); /* var qnSn1 = $('#qnSn1').val(); var qnSn2 = $('#qnSn2').val(); var qnSn3 = $('#qnSn3').val(); var qnSn4 = $('#qnSn4').val(); var qnSn5 = $('#qnSn5').val(); */ var qnEx = $('#qnEx').val(); // alert (qnSnc); // return; var post = 'qnSt=' + qnSt + '&qnType=' + qnType + '&qnTx=' + qnTx + '&qnS1=' + qnS1 + '&qnS2=' + qnS2 + '&qnS3=' + qnS3 + '&qnS4=' + qnS4 + '&qnS5=' + qnS5 + '&qnSn=' + qnSn + '&qnSnc=' + qnSnc + '&qnEx=' + qnEx; $.post('AjaxAddQuizQuestion.php', post, function(data) { // $("#addQ").reset(); document.getElementById("addQ").reset(); $("#option-radio-add").show(); $("#option-check-add").hide(); $("#possible-solutions-add").show(); $("span.responce1").html(data); }); }); } 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 qnTxe = $('#qnTxe').val(); var qnSe1 = $('#qnSe1').val(); var qnSe2 = $('#qnSe2').val(); var qnSe3 = $('#qnSe3').val(); var qnSe4 = $('#qnSe4').val(); var qnSe5 = $('#qnSe5').val(); var qnSne = $('#qnSne:checked').val(); var qnSnce = ""; $('#option-check-edit input:checkbox').each (function () { qnSnce += (this.checked ? $(this).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; // window.open('AjaxEditQuizQuestion.php?'+post, "popupWindow", "width=600,height=600,scrollbars=yes"); $.post('AjaxEditQuizQuestion.php', post, function(data) { $("span.responce2").html(data); // alert ($('#btnEditQuizQuestion').parent('.question.accordion').html()); // alert ($('#Q-'+qid+' span').html()); $('#Q-'+qid+' span').html(qnTxe); }); }); } 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 () { 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": { $("#option-radio-add").show(); $("#option-check-add").hide(); $("#possible-solutions-add").show(); break; } case "2": { $("#option-radio-add").hide(); $("#option-check-add").show(); $("#possible-solutions-add").show(); break; } case "3": { $("#option-radio-add").show(); $("#option-check-add").show(); $("#possible-solutions-add").hide(); break; } } // alert (selectedOption); }); } function applyEditQuestionFunctions () { $('#qnTypee').change (function () { var selectedOption = $(this).val(); onChangeQuestionTypeInEditMode (selectedOption); }); onChangeQuestionTypeInEditMode ($('#qnTypee').val()); editQuizQuestionAjaxCalled (); deleteQuizQuestionAjaxCalled (); // $('span.responce2').html ("applied"); } function onChangeQuestionTypeInEditMode (selectedOption) { switch (selectedOption) { case "1": { $("#option-radio-edit").show(); $("#option-check-edit").hide(); $("#possible-solutions-edit").show(); break; } case "2": { $("#option-radio-edit").hide(); $("#option-check-edit").show(); $("#possible-solutions-edit").show(); break; } case "3": { $("#option-radio-edit").show(); $("#option-check-edit").show(); $("#possible-solutions-edit").hide(); break; } } }