?
Current Path : /home1/savoy/public_html/savoyglobal.net/sec/application/views/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/public_html/savoyglobal.net/sec/application/views/commonfunctions.php |
<script type="text/javascript"> function viewdata(controller, controllerfunction, modelfunction, page, pagenum) { if (arguments[5]) { var divid = arguments[5]; } else { var divid = "inner_content"; } $("#" + divid).empty().html('<CENTER><img src="<?= base_url() ?>assets/img/loading.gif" class="loading"/></CENTER>'); $("#" + divid).load("<?= site_url() ?>/" + controller + '/' + controllerfunction + '/' + modelfunction + '/' + page + '/' + pagenum); } function addformdisplay(page, directory) { $("#inner_content").empty().html('<CENTER><img src="<?= base_url() ?>assets/img/loading.gif" class="loading"/></CENTER>'); $("#inner_content").load("<?= site_url('master/addformdisplay/') ?>/" + page + '/' + directory); } function editformdata(controller, controllerfunction, id, table, field, page) { $("#inner_content").empty().html('<CENTER><img src="<?= base_url() ?>assets/img/loading.gif" class="loading"/></CENTER>'); $("#inner_content").load("<?= site_url() ?>/" + controller + '/' + controllerfunction + '/' + id + '/' + table + '/' + field + '/' + page); } function displayformdata(controller, controllerfunction, id, table, field, page) { $("#inner_content").empty().html('<CENTER><img src="<?= base_url() ?>assets/img/loading.gif" class="loading"/></CENTER>'); $("#inner_content").load("<?= site_url() ?>/" + controller + '/' + controllerfunction + '/' + id + '/' + table + '/' + field + '/' + page); } function deletedata(deltable, id, delfield, controller, controllerfunction, modelfunction, page, table, field, value) { var clicked = function () { if (value) { var val = value; } else { var val = id; } if (table != "" && field != "") { $.ajax({ type: "POST", dataType: "json", url: "<?= site_url('master/checkexistencearray/') ?>/" + table + '/' + field + '/' + val, success: function (msg) { if (msg != 0) { alert("Record cannot be deleted due to associated data"); } else { $.ajax({ type: "POST", dataType: "json", url: "<?= site_url('master/deletedata/') ?>/" + deltable + "/" + id + "/" + delfield, success: function (msg) { viewdata(controller, controllerfunction, modelfunction, page, '1'); } }); alert('Record Deleted Successfully!!!'); } } }); } else { $.ajax({ type: "GET", dataType: "json", url: "<?= site_url('master/deletedata/') ?>/" + deltable + "/" + id + "/" + delfield, success: function (msg) { alert('Record Deleted Successfully!!!'); viewdata(controller, controllerfunction, modelfunction, page, '1'); } }); } }; if (confirmDelete()) { clicked(); } } function confirmDelete() { if (confirm("Are you sure you want to delete")) return 1; else return 0; } function addformdata(formid) { if (arguments[1]) { var divid = arguments[1]; } else { var divid = "inner_content"; } if (callvalidate(formid)) { $('.customForm,.validate').ajaxForm({ beforeSubmit: function () { $('button[type="submit"]').attr('disabled', 'disabled'); return true; }, success: function (data) { $("#" + divid).html(data); $('html, body, #' + divid).animate({scrollTop: 0}, 'slow'); $('#table-example').dataTable(); } }); return false; } else { return false; } } function callvalidate(formid) { $("#" + formid).validate(); return $("#" + formid).valid(); } function suggestStudent(divid) { $(divid).autocomplete("<?= site_url() ?>/master/autosuggeststudent/", { width: 250, selectFirst: false }); } function checkexistence(table, field, value) { $("#success-panel").empty().html('<CENTER><img src="<?= base_url() ?>assets/img/loading.gif" class="loading"/></CENTER>'); $("#success-panel").load("<?= site_url('master/checkexistence/') ?>/" + table + '/' + field + '/' + value, function (data) { if (data == 1) { $("input#" + field).val(""); $("select#" + field).val(""); $("#" + field).css('border', 'solid 1px red'); $("#" + field).focus(); $("#success-panel").fadeIn(900, 0); $("#success-panel").html("Duplicate Entry Recorded"); $("#success-panel").fadeOut(2000, 0); } else { $("#" + field).css('border', 'solid 1px gray'); } }); } function checkdata(id, className, comment) { var numItems = $('.' + className).length var i = 1; var flag = 1; for (i = 1; i <= numItems; i++) { if ($('input#' + id + '_id' + i).val() == "") { flag = 0; $('input#' + id + i).val(""); } } if (flag == 0) { alert(comment) return false; } else return true } function checkdatavalidity(jid, field, comment) { if (jid == "") { alert(comment) $('input#' + field).val(""); return false; } else { return true; } } function empty_text(tag) { $('#' + tag).val(""); } function empty_div(divid) { $('#' + divid).val(""); } </script>