$(function() { LoginFancybox (); 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_institute_signup(); 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(); forgot_PWD(); // forgotPWD2(); vlm(); goto_top(); contact_form(); tabs_ui(); accordion_ui(); custom_lists_ui(); Inst_Reg_form(); demo_request_form(); change_RecoverPWD_form() ; course_file_uploading_page (); Init_ManageQuizPage (); applySubTrainerCourseFunctions (); YoutubeFancyBox (); addTrainerFancyBox (); addTraineeFancyBox (); RashidFrame (); // 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("
Processing data, please wait ...");
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("
Processing data, please wait ...");
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("
Processing data, please wait ...");
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 forgot_PWD()
{
$('#forgot').on('click', function() {
$("div#responce2").html("
Please wait..");
var email = $('input#email').val();
var username = $('input#uname').val();
if (email ==""){
if(username==""){
$("div#responce2").html("
Processing data, please wait ...");
//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 ('
Saving data, please wait ...");
var CTitle = encodeURIComponent($('input#CTitle').val());
var CDesc = encodeURIComponent($('textarea#CDesc').val());
var CLevel = $('select#CLevel').val();
var CServer = $('select#CServer').val();
var post='CTitle='+CTitle+ '&CDesc=' + CDesc + '&CLevel=' + CLevel + '&CServer=' + CServer;
$.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("
Saving data, please wait ...");
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("
Saving data, please wait ...");
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("
Saving data, please wait ...");
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();
var post='CTitle=' + CTitle + '&CDesc=' + CDesc + '&CDesc_arabic=' + CDesc_arabic + '&Clevel=' + Clevel + '&LDesc=' + LDesc + '&LDesc_arabic=' + LDesc_arabic + '&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);
});
});
$('a#btn-save-forum').on('click', function() {
var fid = $('select#selected-forum option:selected').val();
var post = 'fid=' + fid + '&dt=' + (new Date()).getTime();
$.post('act_SaveCourseForum.php', post, function(data) {
$("div#response-forum").html(data);
});
});
}
// ==================== Trainer Page =================================
function form_trainer_page()
{
$("#folder_name").change(function(){
$("#message").html("
Checking ...");
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("
Not available");
}
}
});
});
}
// ==================== Trainer signup =================================
function form_trainer_signup()
{
$("#U_name").change(function(){
$("#message").html("
Checking ...");
var username = $("#U_name").val();
$.ajax({
type:"post",
url:"check_username.php",
data:"username="+username,
success:function(data){
if(data==0){
$("#message").html("
Not available");
}
}
});
});
$('#trainer_send').on('click', function() {
$("div#responce").html("
Saving data, please wait ...");
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("
Checking ...");
var username = $("#T_name").val();
$.ajax({
type:"post",
url:"check_username.php",
data:"username="+username,
success:function(data){
if(data==0){
$("#message").html("
Not available");
}
}
});
});
$('#sub_trainer_signup').on('click', function() {
$("div#responce").html("
Saving data, please wait ...");
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("
Checking ...");
var username = $("#ST_name").val();
$.ajax({
type:"post",
url:"check_username.php",
data:"username="+username,
success:function(data){
if(data==0){
$("#message").html("
Not available");
}
}
});
});
$('#assistant_trainer_signup').on('click', function() {
$("div#responce").html("
Saving data, please wait ...");
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);
});
});
}
// ==================== Trainer signup =================================
function form_institute_signup() {
$("#T_name").change(function(){
$("#message").html("
Checking ...");
var username = $("#T_name").val();
$.ajax({
type:"post",
url:"check_username.php",
data:"username="+username,
success:function(data){
if(data==0){
$("#message").html("
Not available");
}
}
});
});
$('#institute_signup').on('click', function() {
$("div#responce").html("
Saving data, please wait ...");
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 typ = $('select#institute-type').val();
var post='U_name=' + U_name + '&pwd_1=' + pwd_1 + '&pwd_2=' + pwd_2 + '&FullName=' + FullName + '&typ=' + typ + '&email=' + email;
$.post('act_institute_signup.php', post, function(data) {
$("div#responce").html(data);
});
});
}
// ==================== Institute signup =================================
function Inst_Reg_form()
{
$("#I_name").change(function(){
$("#message").html("
Checking ...");
var username=$("#I_name").val();
$.ajax({
type:"post",
url:"check_username.php",
data:"username="+username,
success:function(data){
if(data==0){
$("#message").html("
Not available");
}
}
});
});
$("#URLD").change(function(){
$("#message1").html("
Checking ...");
var instname=$("#URLD").val();
$.ajax({
type:"post",
url:"check_instname.php",
data:"instname="+instname,
success:function(data){
if(data==0){
$("#message1").html("
Not available");
}
}
});
});
$('#Inst_info').on('click', function() {
$("div#responce").html("
Saving data, please wait ...");
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 change_RecoverPWD_form()
{
$('#chngPwd').on('click', function() {
var pwd_1 = $('input#password').val();
var pwd_2 = $('input#cnfrm_password').val();
var User_ID = $('input#userID').val();
var stopHere="";
if(pwd_1 == "" ){
$("#e_password").toggleClass("Nshow_span show_span");
$("#e_password").html("Required");
stopHere=1;
}
if(pwd_2 == "" ){
$("#e_cnfrm_password").toggleClass("Nshow_span show_span");
$("#e_cnfrm_password").html("Required");
stopHere=1;
}
if(pwd_1 != pwd_2){
$("#e_cnfrm_password").html("Password Missmatched ");
stopHere=1;
}
if (stopHere!=""){
$("div#responce1").html("
Missing Information");
return false;
}
var post = 'pwd_1=' + pwd_1 + '&pwd_2=' + pwd_2 + '&User_ID=' + User_ID;
// alert(post);
$("div#responce").html("
Changing Password, please wait ...");
$.post('act_chngPWD.php', post, function(data) {
// alert(data);
if(data==1){
var welcomeNote = "
checking...");
var username=$("#User_Name").val();
if (username!=""){
$.ajax({
type:"post",
url:"check_username.php",
data:"username="+username,
success:function(data){
if(data==0){
$("#e_User_Name").addClass("show_spanG");
$("#e_User_Name").html("
Not available");
}
}
});
} else {
$("#e_User_Name").removeClass("show_span");
$("#e_User_Name").removeClass("show_spanG");
$("#e_User_Name").addClass("Nshow_span");
}
});
$("#Email_Address").change(function(){
$("#e_Email_Address").removeClass("Nshow_span");
$("#e_Email_Address").html("
checking...");
var Email_Address=$("#Email_Address").val();
if (Email_Address!=""){
var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
if (filter.test(Email_Address)) {
$.ajax({
type:"post",
url:"check_email.php",
data:"Email_Address="+Email_Address,
success:function(data){
if(data==0){
$("#e_Email_Address").addClass("show_spanG");
$("#e_Email_Address").html("
Not available");
}
}
});
} else {
$("#e_Email_Address").removeClass("Nshow_span");
$("#e_Email_Address").removeClass("show_spanG");
$("#e_Email_Address").addClass("show_span");
$("#e_Email_Address").html("Invalid Format");
}
} else {
$("#e_Email_Address").removeClass("show_span");
$("#e_Email_Address").removeClass("show_spanG");
$("#e_Email_Address").addClass("Nshow_span");
}
});
$("#Phone_Number").change(function(){
$("#e_Phone_Number").removeClass("Nshow_span");
$("#e_Phone_Number").addClass("show_span");
$("#e_Phone_Number").html("
checking...");
var Phone_Number=$("#Phone_Number").val();
if (Phone_Number!=""){
var filter = /^[0-9-+s()]*$/;
if (filter.test(Phone_Number)) {
$("#e_Phone_Number").html("");
$("#e_Phone_Number").removeClass("show_span");
$("#e_Phone_Number").addClass("Nshow_span");
return true;
}
else {
$("#e_Phone_Number").html("Invlid Number Format!");
return false;
}
} else {
$("#e_Phone_Number").removeClass("show_span");
$("#e_Phone_Number").addClass("Nshow_span");
}
});
$("#password").keyup(function(){
$("#e_password").removeClass("Nshow_span");
$("#e_password").addClass("show_spanW");
$("#e_password").html("
checking...");
var password=$("#password").val();
if (password!=""){
//Regular Expressions.
var regex = new Array();
regex.push("[A-Z]"); //Uppercase Alphabet.
regex.push("[a-z]"); //Lowercase Alphabet.
regex.push("[0-9]"); //Digit.
regex.push("[$@$!%*#?&]"); //Special Character.
var passed = 0;
for (var i = 0; i < regex.length; i++) {
if (new RegExp(regex[i]).test(password)) {
passed++;
}
//Validate for length of Password.
if (passed > 3 && password.length > 5) {
passed++;
}
var color = "";
var strength = "";
switch (passed) {
case 0:
case 1:
strength = "Very Weak";
color = "red";
break;
case 2:
strength = "Weak";
color = "darkorange";
break;
case 3:
case 4:
strength = "Strong";
color = "green";
break;
case 5:
strength = "Very Strong";
color = "darkgreen";
break;
}
$("#e_password").html(strength);
$("#e_password").css("color", color);
}
} else {
$("#e_password").removeClass("show_spanW");
$("#e_password").addClass("Nshow_span");
}
});
$(".toggle-password").click(function() {
$(this).toggleClass("icon-eye-open icon-eye-close");
$("#password").toggleClass( "pw" );
$("#pwdOld").toggleClass( "pw" );
return false;
});
$("#cnfrm_password").keyup(function() {
$("#e_cnfrm_password").removeClass("Nshow_span");
$("#e_cnfrm_password").addClass("show_span");
var password1=$("#password").val();
var password2=$("#cnfrm_password").val();
if(password1 != password2){
$("#e_cnfrm_password").html("Password Missmatched ");
}else {
$("#e_cnfrm_password").html("");
$("#e_cnfrm_password").removeClass("show_span");
$("#e_cnfrm_password").addClass("Nshow_span");
}
});
$("#First_Name").change(function(){
$("#e_First_Name").toggleClass("Nshow_span show_span");
});
$("#Last_Name").change(function(){
$("#e_Last_Name").toggleClass("Nshow_span show_span");
});
$("#Service_Interested_In").change(function(){
$("#e_Service_Interested_In").toggleClass("Nshow_span show_span");
});
$("#CTitle").change(function(){
$("#e_CTitle").toggleClass("Nshow_span show_span");
});
$("#countryS").change(function(){
$("#e_country").toggleClass("Nshow_span show_span");
});
$('#RegFrom_info').on('click', function() {
var CTitle = $('#CTitle option:selected').val();
var First_Name = $('input#First_Name').val();
var Last_Name = $('input#Last_Name').val();
var pwd_1 = $('input#password').val();
var pwd_2 = $('input#cnfrm_password').val();
var User_Name = $('input#User_Name').val();
var email = $('input#Email_Address').val();
var Phone_Number = $('input#Phone_Number').val();
var Visitor_Occupation = $('input#Visitor_Occupation').val();
var Visitor_Age = $('input#Visitor_Age').val();
var Service_Interested_In = $('#Service_Interested_In option:selected').val();
var country = $('#countryS option:selected').val();
var stopHere="";
if(CTitle == "" ){
$("#e_CTitle").toggleClass("Nshow_span show_span");
$("#e_CTitle").html("Required");
stopHere=1;
}
if(First_Name == "" ){
$("#e_First_Name").toggleClass("Nshow_span show_span");
$("#e_First_Name").html("Required");
stopHere=1;
}
if(Last_Name == "" ){
$("#e_Last_Name").toggleClass("Nshow_span show_span");
$("#e_Last_Name").html("Required");
stopHere=1;
}
if(pwd_1 == "" ){
$("#e_password").toggleClass("Nshow_span show_span");
$("#e_password").html("Required");
stopHere=1;
}
if(pwd_2 == "" ){
$("#e_cnfrm_password").toggleClass("Nshow_span show_span");
$("#e_cnfrm_password").html("Required");
stopHere=1;
}
if(pwd_1 != pwd_2){
$("#e_cnfrm_password").html("Password Missmatched ");
stopHere=1;
}
if(User_Name == "" ){
$("#e_User_Name").removeClass("Nshow_span");
$("#e_User_Name").addClass("show_span");
$("#e_User_Name").html("Required");
stopHere=1;
}
if(Phone_Number == "" ){
$("#e_Phone_Number").toggleClass("Nshow_span show_span");
$("#e_Phone_Number").html("Required");
stopHere=1;
}
if(Service_Interested_In == "" ){
$("#e_Service_Interested_In").toggleClass("Nshow_span show_span");
$("#e_Service_Interested_In").html("Required");
stopHere=1;
}
if(country == "" ){
$("#e_country").toggleClass("Nshow_span show_span");
$("#e_country").html("Required");
stopHere=1;
}
if(email == "" ){
$("#e_Email_Address").toggleClass("Nshow_span show_span");
$("#e_Email_Address").html("Required");
stopHere=1;
}
if (stopHere!=""){
$("div#responce1").html("
Missing Information");
return false;
}
var post = 'CTitle=' + CTitle + '&First_Name=' + First_Name + '&Last_Name='
+ Last_Name + '&pwd_1=' + pwd_1 + '&pwd_2=' + pwd_2 + '&User_Name=' + User_Name + '&email=' + email +
'&Phone_Number=' + Phone_Number + '&Visitor_Occupation=' + Visitor_Occupation + '&Visitor_Age=' + Visitor_Age +
'&Service_Interested_In=' + Service_Interested_In + '&country=' + country;
// alert(post);
$("div#responce1").html("
Saving data, please wait ...");
$("div#responce").html("
Saving data, please wait ...");
$.post('act_Reg.php', post, function(data) {
var arr = data.split("|");
if(arr[0]==0) {
$("div#responce").html('Your Email is already registered with us. Use another email OR Click here for login');
$("div#responce1").html('Your Email is already registered with us. Use another email OR Click here for login');
}
else if(arr[0]==2){
$("div#responce").html("We are unable to create account at this time. Please try again later!");
$("div#responce1").html("We are unable to create account at this time. Please try again later!");
}
else if(arr[0]==1){
var welcomeNote = "
Please Wait
Login Successfully
"); window.location.href= "myDashboard.php"; //$("div#menuUpdate").load(); } else { $("div#responce").html("
Getting existing questions list, please wait ...");
$.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 ("Can not get the list of existing quiz questions at this time");
},
// 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 question data, please wait ...");
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 ("Can not get the list of existing quiz questions at this time");
},
// 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 question data, please wait ...");
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 ("Can not get the list of existing quiz questions at this time");
},
// 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
Getting course files, please wait ...");
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 ("Can not get the list of existing course files at this time.");
},
// 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 ("Can not get the list of existing quizzes at this time.");
},
// 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 ("Can not get the list of existing course files at this time.");
},
// 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 ("
Saving data, please wait ...");
var qnSt = $('#qnSt').val();
var qnType = $('#qnType').val();
var qTitle = $('#qTitle').val();
var qTitle_2 = $('#qTitle-2').val();
var qTitle_3 = $('#qTitle-3').val();
var UseTitleDutch_2 = $('input#use-title-dutch-new-2').prop("checked") ? 1:0;
var UseTitleDutch_3 = $('input#use-title-dutch-new-3').prop("checked") ? 1:0;
var qnTx = CKEDITOR.instances['qnTx'].getData();
var qnTx_2 = CKEDITOR.instances['qnTx-2'].getData();
var qnTx_3 = CKEDITOR.instances['qnTx-3'].getData();
var UseQuestionDutch_2 = $('input#use-question-dutch-new-2').prop("checked") ? 1:0;
var UseQuestionDutch_3 = $('input#use-question-dutch-new-3').prop("checked") ? 1:0;
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("
Saving data, please wait ...");
var qid = $('#qid').val();
var qnSte = $('#qnSte').val();
var qnTypee = $('#qnTypee').val();
var qTitlee = $('#qTitlee').val();
var qTitlee_2 = $('#qTitlee-2').val();
var qTitlee_3 = $('#qTitlee-3').val();
var UseTitleDutch_2 = $('input#use-title-dutch-edit-2').prop("checked") ? 1:0;
var UseTitleDutch_3 = $('input#use-title-dutch-edit-3').prop("checked") ? 1:0;
var qnTxe = CKEDITOR.instances['qnTxe'].getData();
var qnTxe_2 = CKEDITOR.instances['qnTxe-2'].getData();
var qnTxe_3 = CKEDITOR.instances['qnTxe-3'].getData();
var UseQuestionDutch_2 = $('input#use-question-dutch-edit-2').prop("checked") ? 1:0;
var UseQuestionDutch_3 = $('input#use-question-dutch-edit-3').prop("checked") ? 1:0;
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("
Deleting question, please wait ...");
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);
$('.question-new-2').show ();
$('.question-new-3').show ();
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.instances['qnTx-2'].destroy();
CKEDITOR.instances['qnTx-3'].destroy();
CKEDITOR.replace( 'qnTx');
CKEDITOR.replace( 'qnTx-2');
CKEDITOR.replace( 'qnTx-3');
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.instances['qnTx-2'].destroy();
CKEDITOR.instances['qnTx-3'].destroy();
CKEDITOR.replace( 'qnTx');
CKEDITOR.replace( 'qnTx-2');
CKEDITOR.replace( 'qnTx-3');
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.instances['qnTx-2'].destroy();
CKEDITOR.instances['qnTx-3'].destroy();
CKEDITOR.replace( 'qnTx');
CKEDITOR.replace( 'qnTx-2');
CKEDITOR.replace( 'qnTx-3');
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.instances['qnTx-2'].destroy();
CKEDITOR.instances['qnTx-3'].destroy();
CKEDITOR.replace( 'qnTx', {
extraPlugins: 'colorbutton,custom-type-in-the-blank'
});
CKEDITOR.replace( 'qnTx-2', {
extraPlugins: 'colorbutton,custom-type-in-the-blank'
});
CKEDITOR.replace( 'qnTx-3', {
extraPlugins: 'colorbutton,custom-type-in-the-blank'
});
$('.question-new-2').hide ();
$('.question-new-3').hide ();
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.instances['qnTx-2'].destroy();
CKEDITOR.instances['qnTx-3'].destroy();
CKEDITOR.replace( 'qnTx', {
extraPlugins: 'colorbutton,custom-drop-in-the-blank'
});
CKEDITOR.replace( 'qnTx-2', {
extraPlugins: 'colorbutton,custom-drop-in-the-blank'
});
CKEDITOR.replace( 'qnTx-3', {
extraPlugins: 'colorbutton,custom-drop-in-the-blank'
});
$('.question-new-2').hide ();
$('.question-new-3').hide ();
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.instances['qnTx-2'].destroy();
CKEDITOR.instances['qnTx-3'].destroy();
CKEDITOR.replace( 'qnTx', {
extraPlugins: 'colorbutton,custom-select-in-the-blank'
});
CKEDITOR.replace( 'qnTx-2', {
extraPlugins: 'colorbutton,custom-select-in-the-blank'
});
CKEDITOR.replace( 'qnTx-3', {
extraPlugins: 'colorbutton,custom-select-in-the-blank'
});
$('.question-new-2').hide ();
$('.question-new-3').hide ();
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.instances['qnTx-2'].destroy();
CKEDITOR.instances['qnTx-3'].destroy();
CKEDITOR.replace( 'qnTx');
CKEDITOR.replace( 'qnTx-2');
CKEDITOR.replace( 'qnTx-3');
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.instances['qnTx-2'].destroy();
CKEDITOR.instances['qnTx-3'].destroy();
CKEDITOR.replace( 'qnTx');
CKEDITOR.replace( 'qnTx-2');
CKEDITOR.replace( 'qnTx-3');
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.instances['qnTx-2'].destroy();
CKEDITOR.instances['qnTx-3'].destroy();
CKEDITOR.replace( 'qnTx');
CKEDITOR.replace( 'qnTx-2');
CKEDITOR.replace( 'qnTx-3');
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');
CKEDITOR.replace('qnTxe-2');
CKEDITOR.replace('qnTxe-3');
onChangeQuestionTypeInEditMode ($('#qnTypee').val());
$('input[type="file"]').off('change');
$('input[type="file"]').change(function(){
readURL(this);
});
ExpandPreviewBox ();
// $('span.responce2').html ("applied");
}
function onChangeQuestionTypeInEditMode (selectedOption) {
$('.question-edit-2').show ();
$('.question-edit-3').show ();
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.instances['qnTxe-2'].destroy();
CKEDITOR.instances['qnTxe-3'].destroy();
CKEDITOR.replace( 'qnTxe');
CKEDITOR.replace( 'qnTxe-2');
CKEDITOR.replace( 'qnTxe-3');
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.instances['qnTxe-2'].destroy();
CKEDITOR.instances['qnTxe-3'].destroy();
CKEDITOR.replace( 'qnTxe');
CKEDITOR.replace( 'qnTxe-2');
CKEDITOR.replace( 'qnTxe-3');
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.instances['qnTxe-2'].destroy();
CKEDITOR.instances['qnTxe-3'].destroy();
CKEDITOR.replace( 'qnTxe');
CKEDITOR.replace( 'qnTxe-2');
CKEDITOR.replace( 'qnTxe-3');
break;
}
case "4": { // Type in the blank
$("#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.instances['qnTxe-2'].destroy();
CKEDITOR.instances['qnTxe-3'].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
}
}
});
CKEDITOR.replace( 'qnTxe-2', {
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
}
}
});
CKEDITOR.replace( 'qnTxe-3', {
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
}
}
});
$('.question-edit-2').hide ();
$('.question-edit-3').hide ();
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.instances['qnTxe-2'].destroy();
CKEDITOR.instances['qnTxe-3'].destroy();
CKEDITOR.replace( 'qnTxe', {
extraPlugins: 'colorbutton,custom-drop-in-the-blank'
});
CKEDITOR.replace( 'qnTxe-2', {
extraPlugins: 'colorbutton,custom-drop-in-the-blank'
});
CKEDITOR.replace( 'qnTxe-3', {
extraPlugins: 'colorbutton,custom-drop-in-the-blank'
});
break;
}
case "6": { // Select in the blank
$("#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.instances['qnTxe-2'].destroy();
CKEDITOR.instances['qnTxe-3'].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
}
}
});
CKEDITOR.replace( 'qnTxe-2', {
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
}
}
});
CKEDITOR.replace( 'qnTxe-3', {
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
}
}
});
$('.question-edit-2').hide ();
$('.question-edit-3').hide ();
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.instances['qnTxe-2'].destroy();
CKEDITOR.instances['qnTxe-3'].destroy();
CKEDITOR.replace( 'qnTxe');
CKEDITOR.replace( 'qnTxe-2');
CKEDITOR.replace( 'qnTxe-3');
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.instances['qnTxe-2'].destroy();
CKEDITOR.instances['qnTxe-3'].destroy();
CKEDITOR.replace( 'qnTxe');
CKEDITOR.replace( 'qnTxe-2');
CKEDITOR.replace( 'qnTxe-3');
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.instances['qnTxe-2'].destroy();
CKEDITOR.instances['qnTxe-3'].destroy();
CKEDITOR.replace( 'qnTxe');
CKEDITOR.replace( 'qnTxe-2');
CKEDITOR.replace( 'qnTxe-3');
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 () {
LoadStudentsInGroups ();
// 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) ========================================
function LoginFancybox () {
$('.login.fancybox').fancybox({
'transitionIn' : 'fade',
'transitionOut' : 'fade',
'speedIn' : '800',
'speedOut' : '400',
'overlayShow' : true,
'overlayColor' : '#fcfcfc',
'padding' : '3',
'hideOnContentClick' : true,
'titlePosition' : 'outside',
'titleFormat' : null,
'width' : 350,
'height' : 350
});
}
function logoutFunctionR(){
$(this).html('Please wait..');
var post = "id=1";
// alert (post);
$.post('logout.php', post, function(data) {
// alert (data);
//$(this).html(data);
location.reload();
// window.location.href= "index.php";
});
}
$(function() {
$('.slogout').click(logoutFunctionR);
});
$(document).ready(function () {
// preloader
$(window).load(function(){
$('.preloader').delay(400).fadeOut(500);
})
})