?
Current Path : /home1/savoy/public_html/savoyglobal.net/koolkids/school/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/koolkids/school/application/views/commonfunctions.php |
<?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ $profile_type=$_SESSION['profile_type']; ?> <script type="text/javascript"> function hidebuttons() { var profile_type = "<?= $profile_type ?>"; if(profile_type=="Student" || profile_type=="Parent") { $('.delete').hide(); $('.edit').hide(); $('.searchrecord').hide(); $('.addrecord').hide(); } } function confirmDelete() { if (confirm("Are you sure you want to delete")) { return 1; } else return 0; } function validateform(formid) { if($("#"+formid).validate()) { return true; } else { return false; } } /* Common function for viewing and adding data. Loaded via onclick function. */ function viewdata(controller,controllerfunction,modelfunction,page,pagenum) { $("#section_content").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#section_content").load("<?= site_url()?>"+'/'+controller+'/'+controllerfunction+'/'+modelfunction+'/'+page+'/'+pagenum,function(){ var code = "<script>hidebuttons();</scr"+"ipt>"; $("#section_content").append($(code)[0]); }); } function addformdisplay(page,directory) { $("#section_content").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#section_content").load("<?= site_url('master/addformdisplay/') ?>/" +page+'/'+directory); } function searchformdisplay() { $("#top-panel-search").fadeIn(1000,0); } function closesearchformdisplay() { $("#top-panel-search").fadeOut(1000,0); } function addformdata(formid) { if(arguments[1]) { var divid=arguments[1]; } else { var divid="section_content"; } if(callvalidate(formid)) { $('.search_form').ajaxForm({ beforeSubmit: showPreloader(divid), success: function(data) { $("#"+divid).html(data); } }); } } function addeditformdata(formid) { if($("#"+formid).validate()) { $('.search_form').ajaxForm(function(data) { $("#section_content").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#section_content").html(data); }); } } function editformdata(controller,controllerfunction,id) { //alert("<?= site_url()?>"+'/'+controller+'/editform/'+controllerfunction+'/'+id); $("#section_content").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#section_content").load("<?= site_url()?>"+'/'+controller+'/editform/'+controllerfunction+'/'+id); } function editformdatageneral(folder,page,table,field,id) { $("#section_content").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#section_content").load("<?= site_url('master/editformgeneral/') ?>/" +folder+'/'+page+'/'+table+'/'+field+'/'+id); } function viewformdata(controller,controllerfunction,id) { //alert("<?= site_url() ?>/" +controller+'/'+controllerfunction+'/'+id); $("#section_content").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#section_content").load("<?= site_url() ?>/" +controller+'/'+controllerfunction+'/'+id); } function deletedata(id,controller,controllerfunction,modelfunction,page,table_name,field_name,value) { if(confirmDelete()) { if(value) var val=value; else var val= id; $("#success-panel").load("<?= site_url('master/checkexistencearray/') ?>/" +table_name+'/'+field_name+'/'+val,function(data) { if(data==1) { $("#success-panel").fadeIn(900,0); $("#success-panel").html("<div style=\"border:1px solid #BE7832; width:170px;height:40px;\" ><font color=\"#AA6B2C\" >Records with relation exist. Cannot be deleted.</font></div>"); $("#success-panel").fadeOut(2000,0); } else { $("#success-panel").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#success-panel").load("<?= site_url('master/deletedata/') ?>/"+id,function(){ viewdata(controller,controllerfunction,modelfunction,page,'1'); }); } }); } else { viewdata(controller,controllerfunction,modelfunction,page,'1'); } } function deletedataperm(id,table,field,controller,controllerfunction,modelfunction,page) { if(confirmDelete()) { $("#success-panel").load("<?= site_url('master/deletedataperm/') ?>/"+id+"/"+table+"/"+field,function(){ viewdata(controller,controllerfunction,modelfunction,page,'1'); }); } else { viewdata(controller,controllerfunction,modelfunction,page,'1'); } } function sendsms(smsid) { $("#success-panel").load("<?= site_url('sms/senddraft/') ?>/"+smsid,function(){ viewdata('sms','viewinsmssearch','searchdraft','viewdraft','1'); }); } function checkexistence(table,field,value) { if(value!="") { $("#success-panel").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#success-panel").load("<?= site_url('master/checkexistence/') ?>/" +table+'/'+field+'/'+value,function(data){ if(data==1) { $("input#"+field).val(""); $("#"+field).css('border','solid 1px red'); $("#"+field).focus(); $("#success-panel").fadeIn(900,0); $("#success-panel").html("<div style=\"border:1px solid #BE7832; width:170px;height:20px;\" ><font color=\"#AA6B2C\" >Duplicate Entry Recorded</font></div>"); $("#success-panel").fadeOut(2000,0); } else { $("#"+field).css('border',''); } }); } } function checkexistenceedit(table,field,value,masterid,masterfield) { $("#success-panel").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#success-panel").load("<?= site_url('master/checkexistenceedit/') ?>/" +table+'/'+field+'/'+value+'/'+masterid+'/'+masterfield,function(data){ if(data==1) { $("input#"+field).val(""); $("#"+field).css('border','solid 1px red'); $("#"+field).focus(); $("#success-panel").fadeIn(900,0); $("#success-panel").html("<div style=\"border:1px solid #BE7832; width:170px;height:20px;\" ><font color=\"#AA6B2C\" >Duplicate Entry Recorded</font></div>"); $("#success-panel").fadeOut(2000,0); } else { $("#"+field).css('border',''); } }); } function viewdatadoc(controller,controllerfunction,modelfunction,page,pagenum,parent_id) { $("#section_content").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#section_content").load("<?= site_url() ?>/" +controller+'/'+controllerfunction+'/'+modelfunction+'/'+page+'/'+pagenum+'/'+parent_id); } function validatedate(date1,date2) { var fromdate=$("#"+date1).val(); var todate=$("#"+date2).val(); if(todate<fromdate) { $("#success-panel").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("input#"+date2).val(""); $("#"+date2).css('border','solid 1px red'); $("#"+date2).focus(); $("#success-panel").fadeIn(900,0); $("#success-panel").html("<div style=\"border:1px solid #BE7832; width:170px;height:20px;\" ><font color=\"#AA6B2C\" >Wrong date entry</font></div>"); $("#success-panel").fadeOut(2000,0); } } function checkpassword(pass,pass1) { if(document.getElementById(pass).value != document.getElementById(pass1).value) { $("input#"+pass1).val(""); $("#success-panel").fadeIn(900,0); $("#success-panel").html("<div style=\"border:1px solid #BE7832; width:170px;height:20px;\" ><font color=\"#AA6B2C\" >Passwords do not match</font></div>"); $("#success-panel").fadeOut(2000,0); } } function showPreloader(divid) { $("#"+divid).empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); } function callvalidate(formid) { $("#"+formid).validate(); return $("#"+formid).valid(); } function showhideuser(status) { if(status.checked==true) { $('#createuser').show(); $("#username").addClass("required"); $("#password").addClass("required"); $("#password1").addClass("required"); $("#profile_id").addClass("required"); } else { $('#createuser').hide(); $("#username").removeClass("required"); $("#password").removeClass("required"); $("#password1").removeClass("required"); $("#profile_id").removeClass("required"); } } function showuploaddiv(record_id) { $("#uploaddiv").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#uploaddiv").load("<?= site_url() ?>/master/uploadform/"+record_id); $(".inliexample2").colorbox({width:"35%",height:"35%", inline:true, href:"#uploaddiv"}); } function showeditdiv(record_id) { $("#editdiv").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#editdiv").load("<?= site_url() ?>/master/editstatus/"+record_id); $(".inliexample3").colorbox({width:"35%",height:"35%", inline:true, href:"#editdiv"}); } function loadpage(controller,controllerfunction,page) { $("#section_content").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#section_content").load("<?= site_url()?>"+'/'+controller+'/'+controllerfunction+'/'+page+'/'); } function suggeststudent(class_type) { $("#student").autocomplete("<?= site_url() ?>/master/autosuggeststudent/"+class_type, { width: 250, selectFirst: false }); } function suggestparentf() { $("#parentf").autocomplete("<?= site_url() ?>/master/autosuggestparentf/", { width: 250, selectFirst: false }); } function suggestparentm() { $("#parentm").autocomplete("<?= site_url() ?>/master/autosuggestparentm/", { width: 250, selectFirst: false }); } function suggestteacher() { $("#teacher").autocomplete("<?= site_url() ?>/master/autosuggestteacher/", { width: 250, selectFirst: false }); } function suggeststaff() { $("#staff").autocomplete("<?= site_url() ?>/master/autosuggeststaff/", { width: 250, selectFirst: false }); } function suggestsubject() { $("#subject").autocomplete("<?= site_url() ?>/master/autosuggestsubject/", { width: 500, selectFirst: false }); } function suggeststudents() { $("#students").autocomplete("<?= site_url() ?>/master/autosuggeststudents/", { width: 250, selectFirst: false }); } </script>