0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 18.191.189.119


Current Path : /var/www/html/cnv/kus/js/
Upload File :
Current File : /var/www/html/cnv/kus/js/MainPage.js

var $host_url =
  "https://" +
  window.location.host +
  "/" +
  window.location.pathname.split("/")[1] +
  "/" +
  window.location.pathname.split("/")[2] +
  "/app.php?a=";
var $host_url_hr =
  "https://" +
  window.location.host +
  "/" +
  window.location.pathname.split("/")[1] +
  "/" +
  window.location.pathname.split("/")[2] +
  "/aph.php?a=";
var $image_path =
  "https://" +
  window.location.host +
  "/" +
  window.location.pathname.split("/")[1] +
  "/" +
  window.location.pathname.split("/")[2] +
  "/JQGrid4/themes/tarka/images/";
$host_url = $host_url.replace("/index.html", "");
$host_url_hr = $host_url_hr.replace("/MainPage.html", "");

function date_format($str) {
  if (trim($str) == "" || $str == "undefined") return "0000-00-00";
  else {
    var indx = $str.indexOf("/");
    if (indx == -1) return $str;
    else {
      $date = $str.split("/");
      return $date[2] + "-" + $date[1] + "-" + $date[0];
    }
  }
}
function date_format_time(str) {
  var date = "0000-00-00 00:00:00";
  if (!empty(trim(str))) {
    var indx = str.indexOf(" ");
    if (indx == -1) return date;
    else {
      var split_arr = str.split(" ");
      var date_arr = split_arr[0].split("/");
      date =
        date_arr[2] +
        "-" +
        date_arr[1] +
        "-" +
        date_arr[0] +
        " " +
        split_arr[1];
    }
  }
  return date;
}

function ui_date_format($str) {
  if (trim($str) == "" || $str == "undefined" || $str == "null")
    $date = "00/00/0000";
  else $date = $str.split("-");

  if ($date.length == 3) $date = $date[2] + "/" + $date[1] + "/" + $date[0];
  else $date = "00/00/0000";
  return $date;
}
function isLoggedIn() {
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "isLoggedIn",
    error: AjaxErrorMessage,
    data: "",
    success: isLoggedInResponce
  });
}
function isLoggedInResponce($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.data == "0") {
    alert("Please Login");
    window.location.href = "admin_login.php";
  } else {
    $("#login_user_name_display").html(getCookie("f_user_name"));
    $(".dropdown-menu").append(
      '<li><a id="trigger_fullscreen" href="javascript:logout();"><i class="fa fa-key"></i> Log Out</a></li>'
    );
    homeAdmin();
  }
}

function isLoggedInColl() {
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "isLoggedInColl",
    error: AjaxErrorMessage,
    data: "",
    success: isLoggedInCollResponce
  });
}
function isLoggedInCollResponce($responce) {
  $responce = eval("(" + $responce + ")");

  if ($responce.data["data"] == "0") {
    alert("Please Login");
    window.location.href = "college_login.php";
  } else {
    document.getElementById("collegename").innerHTML =
      $responce.data["collname"];
    $("#login_user_name_display").html(getCookie("f_user_name"));
    $(".dropdown-menu").append(
      '<li><a id="trigger_fullscreen" href="javascript:logoutColl();"><i class="fa fa-key"></i> Log Out</a></li>'
    );
    homeCollege();
  }
}

function logout() {
  var r = confirm("Are you sure about Logout..!");
  if (r == true) {
    $.ajax({
      type: "POST",
      async: false,
      url: $host_url + "logout",
      error: AjaxErrorMessage,

      success: logoutResponce
    });
  } else {
    return;
  }
}
function logoutResponce($responce) {
  $responce = eval("(" + $responce + ")");
  window.location.href = "admin_login.php";
}

function logoutColl() {
  var r = confirm("Are you sure about Logout..!");
  if (r == true) {
    $.ajax({
      type: "POST",
      async: false,
      url: $host_url + "logoutColl",
      error: AjaxErrorMessage,

      success: logoutCollResponce
    });
  } else {
    return;
  }
}
function logoutCollResponce($responce) {
  $responce = eval("(" + $responce + ")");
  window.location.href = "college_login.php";
}

function setLoginCntr() {
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "setLoginCntr",
    error: AjaxErrorMessage,
    // data: lstr_query_string,
    success: function setLoginCntrResponce(responce) {
      try {
        responce = eval("(" + responce + ")");
      } catch (err) {
        txt = err.message;
        $.unblockUI();
        bootbox.alert(txt);
      }
    }
  });
}
function trim($str) {
  return jQuery.trim($str);
}
function AjaxErrorMessage(xhr, textStatus, errorThrown) {
  var error_msg = "";

  if (textStatus !== null) {
    error_msg = textStatus;
  } else if (errorThrown !== null) {
    error_msg = errorThrown.message;
  } else {
    error_msg = error;
  }

  bootbox.alert(error_msg + "</br>" + xhr);
  $.unblockUI();
}
// Get the Cookie Details
function getCookie(c_name) {
  if (document.cookie.length > 0) {
    c_start = document.cookie.indexOf(c_name + "=");
    if (c_start != -1) {
      c_start = c_start + c_name.length + 1;
      c_end = document.cookie.indexOf(";", c_start);
      if (c_end == -1) c_end = document.cookie.length;
      return unescape(document.cookie.substring(c_start, c_end));
    }
  }
  return "";
}

function CallTarkaMonthPicker(system_name) {
  $("#" + system_name).monthpicker({ dateFormat: "M-yy" });
  $("#" + system_name).monthpicker("show");
}

function CallTarkaDatePicker(system_name) {
  if (typeof system_name == "undefined") {
    $(".date-picker").datepicker({
      rtl: App.isRTL(),
      autoclose: true,
      format: "dd/mm/yyyy",
      todayBtn: true
    });
  } else {
    $("#" + system_name).datepicker({
      rtl: App.isRTL(),
      autoclose: true,
      format: "dd/mm/yyyy",
      todayBtn: true
    });
    $("#" + system_name).datepicker("show");
  }
}
function CallTarkaDateTimePicker(system_name) {
  if (typeof system_name == "undefined") {
    $(".form_datetime").datetimepicker({
      autoclose: true,
      isRTL: App.isRTL(),
      format: "dd/mm/yyyy  hh:ii",
      todayBtn: true,
      pickerPosition: App.isRTL() ? "bottom-right" : "bottom-left"
    });
  } else {
    $("#" + system_name).datetimepicker({
      autoclose: true,
      isRTL: App.isRTL(),
      format: "dd/mm/yyyy  hh:ii",
      todayBtn: true,
      pickerPosition: App.isRTL() ? "bottom-right" : "bottom-left"
    });
    $("#" + system_name).datetimepicker("show");
  }
}

function AssignDisplayModuleName() {
  $modulepath = "";
  $modulepath += $system_menu_name;
  //$modulepath=$g_main_menu;
  if ($g_module_parent_menu != "none") {
    //$modulepath+=$g_module_parent_menu;
    $("#span_main_menu").html($g_module_parent_menu);
    $("#span_main_menu")
      .parent()
      .show();
    $("#span_main_menu").show();
    $("#span_main_menu")
      .parent()
      .find("i")
      .show();
  } else {
    $("#span_main_menu")
      .parent()
      .hide();
  }

  $(".page-title").html($g_display_module_name);
  $("#span_parent_menu").html($modulepath);

  $("#display_module_name").html($g_display_module_name);
  $("#module_menu_action").show();
  $("#span_parent_menu_right").show();
}
function homeAdmin() {
  $g_inbox_init = 0;
  $g_args = arguments;
  $("#module_menu_action").hide();
  $("#page_main_home_div").show();
  $path = "home_admin.html";
  $("#page_main_home_div").load($path, function() {
    $("#page_main_div").html("");
    $("#page_main_div").hide();
    $("#main_body").hide();
    $("#page_header").hide();
    $("#page_footer").hide();
    $(".contents").hide();
    $("#span_parent_menu").html("");
    $("#display_module_name").html("");
    CMS.GetHeaderDetails();
  });
}

function homeCollege() {
  $g_inbox_init = 0;
  $g_args = arguments;
  // $('.page-title').html("Dashboard");
  $("#module_menu_action").hide();

  $("#page_main_home_div").show();
  $path = "home_college.html";
  $("#page_main_home_div").load($path, function() {
    $("#page_main_div").html("");
    $("#page_main_div").hide();
    $("#main_body").hide();
    $("#page_header").hide();
    $("#page_footer").hide();
    $(".contents").hide();
    $("#span_parent_menu").html("");
    $("#display_module_name").html("");
  });
}

function responcehome() {
  $g_inbox_init = 0;
  $g_args = arguments;
  $("#module_menu_action").hide();
  $("#page_main_home_div").show();
  $path = "home.html";
  CMS.GetHeaderDetails();
}

function home() {
  $g_inbox_init = 0;
  $g_args = arguments;
  $("#module_menu_action").hide();
  $("#page_main_home_div").show();
  $path = "home.html";
  $("#page_main_home_div").load($path, function() {
    $("#page_main_div").html("");
    $("#page_main_div").hide();
    $("#main_body").hide();
    $("#page_header").hide();
    $("#page_footer").hide();
    $(".contents").hide();
    $("#span_parent_menu").html("");
    $("#display_module_name").html("");
    $("#tasks_inbox").load(
      "html_modules/system_general_master_setup.php?v=1",
      function() {
        CMS.GetHeaderDetails();
      }
    );
  });
}

function DisplayUserSelectedPhoto() {
  var some_html =
    '<img class="alert" src="img/img-format.jpg" width="550px" /><br />';
  some_html +=
    "<h4>The photogaraphy must be a recent <b>passport style picture.</b>See the first example.</h4>";
  bootbox.confirm(some_html, function(result) {
    if (result == true) {
      var valid_file_extentions = new Array("jpeg", "jpg", "png", "gif");
      var ext = $("#student_entry_upload").val();
      filepath = ext;
      ext = ext.substring(ext.length - 3, ext.length);
      ext = ext.toLowerCase();
      if (ext != "" && !in_array(ext, valid_file_extentions)) {
        alert("Please Select the Valid Photo!");
        return false;
      }
      /* var myFSO = new ActiveXObject("Scripting.FileSystemObject");
			 
			var thefile = myFSO.getFile(filepath);
			var size = thefile.size;
			alert(size + " bytes"); */

      var lstr_data = "&filepath=" + filepath;
      $upload = $host_url + "DiaplayUserSelectedPhoto&" + lstr_data;
      App.blockUI({ boxed: true, message: "Please wait, Photo uploading..." });
      document
        .getElementById("form_module_details_upload")
        .setAttribute("action", $upload);
      return AIM.submit(
        document.getElementById("form_module_details_upload"),
        "same_tab",
        { onComplete: DiaplayUserSelectedPhotoResponse }
      );
    } else {
      $("#student_entry_upload").val("");
    }
  });
}

function DiaplayUserSelectedPhotoResponse($responce) {
  App.unblockUI();
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0)
    $("#student_entry_photo").attr("src", $responce.data);
  else if ($responce.error_code == -1)
    $("#student_entry_photo").attr("src", "images/default_photo.jpg");
  else if ($responce.error_code == -2) {
    alert($responce.data);
    $("#student_entry_photo").attr("src", "images/default_photo.jpg");
    $("#student_entry_upload").val("");
  }
}

function in_array(needle, haystack, argStrict) {
  var key = "",
    strict = !!argStrict;

  if (strict) {
    for (key in haystack) {
      if (haystack[key] === needle) {
        return true;
      }
    }
  } else {
    for (key in haystack) {
      if (haystack[key] == needle) {
        return true;
      }
    }
  }

  return false;
}
function isNull(o) {
  return o === null;
}
function empty(mixed_var) {
  var key;
  if (
    mixed_var === "" ||
    mixed_var === 0 ||
    mixed_var === "0" ||
    mixed_var === null ||
    mixed_var === false ||
    typeof mixed_var === "undefined"
  ) {
    return true;
  }
  if (typeof mixed_var == "object") {
    for (key in mixed_var) {
      return false;
    }
    return true;
  }

  return false;
}
function array_flip(trans) {
  var key,
    tmp_ar = {};
  for (key in trans) {
    tmp_ar[trans[key]] = key;
  }

  return tmp_ar;
}

function homeindex() {
  window.location.href = "indexpage.php";
}