JezK
Edit File: edit_comment93.php
<?php session_start(); include("menuheader.php"); if(!(in_array(2,$access) && in_array(2,$allow))) echo "<script>location.replace('dashboard.php');</script>"; include_once("encription_key.php"); include_once("school_admin_access.php"); include_once("school_admin_student.php"); include_once("student_access.php"); include 'android_push.php'; $admin=new adminaccess(); $student=new studentacess(); $student_new =new student_access(); $encrypted_id = $_GET['id']; $encry=new Encryption(); //$comment_id = $encry->decode($encrypted_id); $comment_id = $encrypted_id; //echo $comment_id; $page = basename($_SERVER['PHP_SELF']); if( $page == "general_comments.php"){ $menuclass = "selected"; }else if($page == "edit_comment.php"){ $menuclassu = "selected"; } $sch_id = $_SESSION['child']['log_school_id']; $sch_id = $_SESSION['child']['log_school_id']; $auth_id = $_SESSION['child']['auth_id']; $acadamic_year = $_SESSION['child']['choosen_academic_id']; $details = $admin->get_classes_byschool_total($sch_id,$acadamic_year); $coment_details = $student->data_comment($comment_id); $students_details_all = $student->student_details_completedata($coment_details['class_id'],$coment_details['section_id'],$coment_details['school_id'],$coment_details['academic_year_id']); $student_str = ''; foreach($students_details_all as $skey=>$sval){ $student_str .= ",".$skey; $student_str = ltrim($student_str,","); } $details_sections =$student_new->get_sections_data_byclass($coment_details['class_id']); //$sch_id = 1; //$class_id= 1; $subjects_data = $student->get_subjects_dairy($coment_details['class_id'],$sch_id,$acadamic_year); if($_POST['action'] == "update"){ $today_date =date('d/m/Y'); if($today_date == $_POST['dairy_date']){ $date_msg = "Today"; }else { $date_msg = $_POST['dairy_date']; } $dateInput = explode('/',$_POST['dairy_date']); $dairy_newdate=$dateInput[2].'-'.$dateInput[1].'-'.$dateInput[0]; //$check_comment = $student->check_generalcomment_edit($_POST); //if($check_comment['cnt'] > 0 ){ $result = $student->update_generalcomment_edit($_POST,$_SESSION); /*} else { $result = $student->insert_generalcomment($_POST); }*/ //$result = $student->insert_generalcomment($_POST); if($result!=ERR204) { /*$check_parents_data = $student->check_parent_data($_POST); $subject_name = $admin->getsubject_name($_POST['subjects'],$sch_id,$acadamic_year); if($check_parents_data){ $message=mysql_real_escape_string($_POST['dairy_desription']); $msg['message'] = "General Comments Assigned"; $msg['type'] = "gencmnt"; $msg['apldate'] = $dairy_newdate; $msg['result'] = $message; foreach($check_parents_data as $key=>$val){ $registatoin_ids[] = $val['device_id']; $msg['student_id'] = $val['student_id']; $student_name = $admin->student_name($msg['student_id']); $msg['message'] = $student_name." has been assigned Individual Work for ".$subject_name." for ".$date_msg; $msg['result'] = $message; $resultss = send_notification($registatoin_ids, $msg); } }*/ echo "<script>location.replace('general_comments.php?cresult=ERR203');</script>" ; } else { echo "<script>location.replace('update_general_comments.php?cresult=ERR204');</script>" ; } } ?> <style> #nav { margin: auto; width:427px; padding-left:0; padding-right:0; list-style: none; background: #66CEF0; } #nav li { display:inline-block; margin:0 auto; text-align:center; } #nav li a { display: inline-block; padding: 7px 0; text-align:center; text-decoration: none; color: #FFFFFF; margin:auto; } #nav li:hover, li:active { background-color: #01749a; width:90px; } #nav li.selected { background: #01749a; } select { width: 62px !important; background-color: #FFF; border: 1px solid #CCC; } .multiselect { width: 290px; } .selectBox { position: relative; } .selectBox select { width: 100%; font-weight: bold; } .overSelect { position: absolute; left: 0; right: 0; top: 0; bottom: 0; } #checkboxes { display: none; border: 1px #dadada solid; } #checkboxes label { display: block; } #checkboxes label:hover { background-color: #1e90ff; } </style> <script> $(document).ready(function(){ $('#err_class').hide(); $('#err_section').hide(); $('#err_dairy').hide(); $('#err_subject').hide(); $('#err_description').hide(); }); function inputvalidations(){ //alert('test'); var dairy_class = document.getElementById('classes').value; if(dairy_class != ''){ var dairy_section = document.getElementById('sections').value; } var dairy_date = document.getElementById('dairy_date').value; var dairy_desription = document.getElementById('dairy_desription').value; if(dairy_section != '0'){ var dairy_subjects = document.getElementById('subjects').value; } //var dairy_desription = document.getElementById('dairy_desription').value; if(dairy_class == ''){ $('#err_class').show(); return false; }else if(dairy_section == '0'){ $('#err_section').show(); return false; }else if(dairy_date == ''){ $('#err_dairy').show(); return false; }else if(dairy_subjects == '0'){ $('#err_subject').show(); return false; }else if(dairy_desription == ''){ $('#err_description').show(); return false; } } </script> <body style="overflow-x: hidden;"> <div class="row" style="margin-top: 30px;"> <div class="col-md-9 text-left" style="font:Arial, Helvetica, sans-serif;font-style:normal;font-size:24px; margin-left:20px;"> <a href="general_comments.php"> <i class="glyphicon glyphicon-plus" title ="Update General Comments" style="font-size: 21px;"></i> Update General Comments</a> </div> </div> <div class="menuu"> <ul id="nav"> <li class="<?php echo $menuclass?>" style="border-right:1px solid #FFFFFF;width:214px; text-align:center;margin-left:-3px;font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"><a href="diary_management.php"><img src="images/hom-work_white.png" title ="Home Work" style="margin-right:5px;"/>Home Work</a></li> <li class="<?php echo $menuclassu?>" style="border-right:1px solid #FFFFFF; width:215px; text-align:center; margin-left:-3px; font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"><a href="general_comments.php"><img src="images/general-comments_white.png" title ="General Comments" style="margin-right:5px;"/>General Comments</a></li> </ul> </div> <form class="form-horizontal" style="margin-top:30px;" method="post"> <div class="box-body" style="background-color:#fff; padding: 10px; font-family:Arial, Helvetica, sans-serif; font-size:13px; "> <div class="clear"> <div class="form-group col-md-6" style="margin-bottom:1.0%;"> <div class="col-md-4 col-md-offset-1 text-right"><b style="color:#666666; ">Class</b><span style="color:#FF0000; margin:2px;">*</span> </div> <div class="col-md-7"> <select class="form-control" id="classes" name="classes" style="height:29px; width:295px!important;font-size:12px;" tabindex="2" disabled > <option selected="selected" value='' >Select Class</option> <?php foreach($details as $key=>$row) { $dateInput = explode('-',$coment_details['diary_date']); $dairy_date=$dateInput[2].'/'.$dateInput[1].'/'.$dateInput[0]; if($row['class_id'] == $coment_details['class_id']) echo "<option value='".$row['class_id']."' selected>".$row['class_name']."</option>"; else echo "<option value='".$row['class_id']."'>".$row['class_name']."</option>"; }?> </select> <!-- if there is an error--> <div class="col-md-7" id="err_class" style="color:#990000;margin-left:-15px; display:none;">Please Enter Class</div> <!--- end error--> </div> </div> </div> <div class="clear"> <div class="form-group col-md-6" style="margin-bottom:1.0%;"> <div class="col-md-4 col-md-offset-1 text-right"><b style="color:#666666; ">Section</b><span style="color:#FF0000; margin:2px;">*</span> </div> <div class="col-md-7"> <select class="form-control" id="sections" name="sections" style="height:29px; width:295px!important;font-size:12px;" tabindex="2" disabled> <option selected="selected" value='' >Select Section</option> <?php foreach($details_sections as $key=>$row) { if($row['section_id'] == $coment_details['section_id']) echo "<option value='".$row['section_id']."' selected>".$row['section_name']."</option>"; else echo "<option value='".$row['section_id']."'>".$row['section_name']."</option>"; } ?> </select> <!-- if there is an error--> <div class="col-md-7" id="err_section" style="color:#990000;margin-left:-15px; display:none;">Please Enter Section</div> <!--- end error--> </div> </div> </div> <div class="clear"> <div class="form-group col-md-6" style="margin-bottom:1.0%;"> <div class="col-md-4 col-md-offset-1 text-right"><b style="color:#666666; ">Student</b><span style="color:#FF0000; margin:2px;"></span> </div> <div class="col-md-7"> <div class="multiselect"> <div class="selectBox" > <select class="form-control" id="students" name="students" style="height:29px; width:295px!important;font-size:12px;" tabindex="2" disabled> <option selected="selected" value='' >Select Students</option> </select> <div class="overSelect"></div> </div> <div id="checkboxes"> </div> </div> <!-- if there is an error--> <div class="col-md-7" id="err_section" style="color:#990000;margin-left:-15px;display:none;">Please Enter Student</div> <!--- end error--> </div> </div> </div> <div class="class" > <div class="form-group col-md-6" style="margin-bottom:1.0%; clear:both;"> <div class="col-md-4 col-md-offset-1 text-right"><b style="color:#666666;">Date</b><span style="color:#FF0000; margin:2px; ">*</span> </div> <div class="col-md-7 "> <div id="datetimepicker" class="input-append date"> <input type="text" name="dairy_date" id="dairy_date" value="<?php echo $dairy_date?>" style="height:30px; width:268px;font-size:13px;" tabindex="5" disabled></input> <span class="add-on" style="height:30px; "> <i data-time-icon="icon-time" data-date-icon="icon-calendar" readonly ></i> </span> </div> <!-- if there is an error--> <div class="col-md-7" id="err_dairy" style="color:#990000;margin-left:-15px; display:none;">Please Enter Date</div> <!--- end error--> </div> </div> <div class="clear"> <div class="form-group col-md-6" style="margin-bottom:1.0%;"> <div class="col-md-4 col-md-offset-1 text-right"><b style="color:#666666; ">Subject</b><span style="color:#FF0000; margin:2px;">*</span> </div> <div class="col-md-7"> <select class="form-control" id="subjects" name="subjects" style="height:29px; width:295px!important;font-size:12px;" tabindex="2" disabled> <option value='' >Select Subjects</option> <?php foreach($subjects_data as $key=>$row) { if($row['subject_id'] == $coment_details['subject_id']){ echo "<option value='".$row['subject_id']."' selected>". $coment_details['subject_name']."</option>"; }else{ echo "<option value='".$row['subject_id']."'>". $coment_details['subject_name']."</option>"; } } ?> </select> <!-- if there is an error--> <div class="col-md-7" id="err_subject" style="color:#990000;margin-left:-15px; display:none;">Please Enter Subject</div> <!--- end error--> </div> </div> </div> <div class="clear"> <div class="form-group col-md-6" style="margin-bottom:1.0%;"> <div class="col-md-4 col-md-offset-1 text-right"><b style="color:#666666; ">Description</b><span style="color:#FF0000; margin:2px;">*</span> </div> <div class="col-md-7"> <textarea class="form-control" rows="2" id="dairy_desription" name="dairy_desription" style="font-size:13px; width:295px!important;"tabindex="16" maxlength="1000"><?php echo $coment_details['description']?></textarea> <!-- if there is an error--> <div class="col-md-7" id="err_description" style="color:#990000;margin-left:-15px; display:none;">Please Enter Description</div> <!--- end error--> </div> </div> </div> <input type="hidden" name="school_id" id="school_id" value="<?php echo $sch_id?>"> <input type="hidden" name="auth_id" id="auth_id" value="<?php echo $auth_id?>"> <input type="hidden" name="acadamic_id" id="acadamic_id" value="<?php echo $acadamic_year?>"> <input type="hidden" name="student_ids_data" id="student_ids_data" value="<?php echo $coment_details['student_id']?>"> <input type="hidden" name="student_ids_all" id="student_ids_all" value=""> <input type="hidden" name="dairy_ids" id="dairy_ids" value=""> <input type="hidden" name="sudent_dairy_id" id="sudent_dairy_id" value="<?php echo $comment_id ?>"> <input type="hidden" name="student_status_checkdata" id="student_status_checkdata" value=""> <input type="hidden" name="student_editdata_data" id="student_editdata_data" value=""> <input type="hidden" name="student_allnamesedit_data" id="student_allnamesedit_data" value=""> <input type="hidden" name="student_allnames_data" id="student_allnames_data" value=""> <input type="hidden" name="student_names_data" id="student_names_data" value=""> <input type="hidden" name="student_status" id="student_status" value=""> <input type="hidden" name="checkval" id="checkval" value="0"> <input type="hidden" name="student_status_check" id="student_status_check" value=""> <input type="hidden" name="classes" id="classes" value="<?php echo $coment_details['class_id']?>"> <input type="hidden" name="subjects" id="subjects" value="<?php echo $coment_details['subject_id']?>"> <input type="hidden" name="sections" id="sections" value="<?php echo $coment_details['section_id']?>"> <input type="hidden" name="dairy_date" id="dairy_date" value="<?php echo $dairy_date?>"> </div> <div class="form-group"> <div class="col-md-8" align="center"> <button type="submit" class="btn btn-default custom-button-width .navbar-right" tabindex="16" style="font-family:Arial, Helvetica, sans-serif;font-style:normal;font-size:13px; margin:10px; " onclick="return inputvalidations()">Update</button> <button type="button" class="btn btn-default custom-button-width .navbar-right" tabindex="24" style="font-family:Arial, Helvetica, sans-serif;font-style:normal;font-size:13px; margin:20px; " onclick="return clearall()">Cancel</button> </div> <input type="hidden" name="action" id="action" value="update"> </form> <script type="text/javascript" src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.min.js"> </script> <script type="text/javascript" src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.pt-BR.js"> </script> <script type="text/javascript"> $('#datetimepicker').datetimepicker({ format: 'dd/MM/yyyy', pickTime: false }).on('changeDate', function(){ $(this).datetimepicker('hide'); var class_id = $("#classes").val(); var school_id = $("#school_id").val(); var sec_id = $("#sections").val(); var dairy_date = $("#dairy_date").val(); var subject = $("#subjects").val(); var acadamic_id = <?php echo $acadamic_year ?>; var student_ids_all = $("#student_ids_data").val(); //alert(student_ids_all); if(dairy_date == ''){ alert("Choose Date"); return false; }else { $.ajax({ url: "ajaxcalls.php", type:"POST", data:"mode="+"choose_description_dairy"+"&school_id="+school_id+"&class_id="+class_id+"&sec_id="+sec_id+"&acadamic_id="+acadamic_id+"&studentids="+student_ids_all+"&subject="+subject+"&dairy_date="+dairy_date, success: function(result) { var res = eval("("+result+")"); if(res.description != undefined){ document.getElementById('dairy_desription').value =res.description; document.getElementById('dairy_ids').value = res.School_diary_id; }else { document.getElementById('dairy_desription').value =""; document.getElementById('dairy_ids').value = ""; } } }); } }); </script> <script type="text/javascript"> $(window).click(function(e) { var checkval = $('#checkval').val(); var student = $('#students').val(); var student_status = $('#student_status').val(); var student_data = document.getElementById('student_names_data').value; var student_edit_data = $('#student_allnamesedit_data').val(); var student_status_check = $('#student_status_check').val(); student_data = student_data.replace(/^,/g, ''); student_data = student_data.replace(/,$/g, ''); student_edit_data = student_edit_data.replace(/^,/g, ''); student_edit_data = student_edit_data.replace(/,$/g, ''); if(checkval == '' || checkval == '0' ){ if(student_status != '' && student_edit_data == ''){ students_data = '<option selected="selected" > Select Students </option>'; $("#students").html(students_data); }else if(student_data.length == student_edit_data.length){ students_data = '<option selected="selected" > All </option>'; $("#students").html(students_data); $(".checkboxall").prop("checked", true); }else if(student_status == 'all' ){ var student_names = $('#student_allnamesedit_data').val(); }else if(student_status == 'singles' && student_status_check == '1') { var student_names = $('#student_allnamesedit_data').val(); }else { var student_names = $('#student_editdata_data').val(); } }else { } if(student_status != '' && student_status != 'all' ){ student_names = student_names .replace(",,",","); students_data = '<option selected="selected" > '+student_names+' </option>'; $("#students").html(students_data); } }); $(document).ready(function() { $("#datetimepicker").datetimepicker('disable'); var class_id=$("#classes").val(); var school_id=$("#school_id").val(); var sec_id=$("#sections").val(); var acadamic_id =<?php echo $acadamic_year ?>; var student_str ='<?php echo $student_str ?>'; var subject_id = '<?php echo $coment_details['subject_id'] ?>'; var stuids = document.getElementById('student_ids_data').value; var student_idss = document.getElementById('student_ids_all').value; student_idss = student_idss.replace(/^,/g, ''); student_idss = student_idss.replace(/,$/g, ''); var check = ''; $.ajax({ url: "ajaxcalls.php", type:"POST", data:"mode="+"choose_subject_dairy"+"&school_id="+school_id+"&class_id="+class_id+"&sec_id="+sec_id+"&acadamic_id="+acadamic_id, success: function(result) { var arr = result.split('@'); var result2 = eval("("+arr[0]+")"); var result_stu = eval("("+arr[1]+")"); var subject_option = ''; for(var i = 0;i < result2.length;i++){ if(subject_id == result2[i].subject_id){ var select = 'selected=selected'; }else{ var select = ''; } subject_option += '<option value="'+result2[i].subject_id+'" '+select+'>'+result2[i].subject_name+'</option>'; } var students_ids =''; var students_ids_all = ''; var students_names = ''; var name_edit = ''; if(student_str == stuids || stuids == "all"){ var check_all = 'checked=checked'; }else { var check_all = ''; } var students_data = '<input type="checkbox" class="checkboxall" '+check_all+' name="selectall" id="selectall" onclick="check_all()" > All <br>'; for(var j = 0;j < result_stu.length;j++){ var fullname = result_stu[j].student_firstname+' '+result_stu[j].student_lastname; n = stuids.indexOf(result_stu[j].student_id); if(n != "-1" || stuids == "all"){ check = 'checked=checked'; name_edit += ","+fullname; var type = '0'; }else { check = ''; var type ='1'; } students_ids_all += ","+result_stu[j].student_id; students_data += '<label for="one"><input type="checkbox" onclick="check_single(this.value,\''+fullname+'\')" class="checkbox1" value="'+result_stu[j].student_id+'" '+check+' name="students_ids[]" id="student_id'+result_stu[j].student_id+'" style="margin-top:-2px;"/ >'+result_stu[j].student_firstname+' '+result_stu[j].student_lastname+'</label>'; students_ids += ","+result_stu[j].student_id; students_names += ","+fullname; } document.getElementById('checkboxes').innerHTML= students_data; //document.getElementById('student_ids_data').value = students_ids; students_ids_all = students_ids_all.replace(/^,/g, ''); students_ids_all = students_ids_all.replace(/,$/g, ''); // students_names = students_names.replace(/^,/g, ''); // students_names = students_names.replace(/,$/g, ''); // name_edit = name_edit.replace(/^,/g, ''); // name_edit = name_edit.replace(/,$/g, ''); document.getElementById('student_ids_all').value = students_ids_all; document.getElementById('student_allnames_data').value = students_names; document.getElementById('student_names_data').value = students_names; document.getElementById('student_allnamesedit_data').value = name_edit; document.getElementById('student_status').value = "all"; //students_data = '<option selected="selected" > All </option>'; var edinames = document.getElementById('student_allnamesedit_data').value; if(student_str.length == stuids.length || stuids == "all"){ students_data = '<option selected="selected" > All </option>'; $("#students").html(students_data); $(".checkboxall").prop("checked", true); }else if(edinames != ''){ en = edinames.indexOf(','); if(en != "-1"){ edinames=edinames.substring(1); } students_data = '<option selected="selected" > '+edinames+' </option>'; $("#students").html(students_data); }else { //alert('333'); $("#students").html(students_names); } $("#subjects").html(subject_option); } }); }); $("#subjects").change(function(){ var class_id = $("#classes").val(); var school_id = $("#school_id").val(); var sec_id = $("#sections").val(); var dairy_date = $("#dairy_date").val(); var subject = $("#subjects").val(); var acadamic_id = <?php echo $acadamic_year ?>; var student_ids_all = $("#student_ids_all").val(); var student_ids_data = $("#student_ids_data").val(); student_ids_data = student_ids_data .replace(",,",","); var student_status = $('#student_status').val(); if(dairy_date == ''){ alert("Choose Date"); return false; }else { $.ajax({ url: "ajaxcalls.php", type:"POST", data:"mode="+"choose_description_dairy"+"&school_id="+school_id+"&class_id="+class_id+"&sec_id="+sec_id+"&acadamic_id="+acadamic_id+"&studentids="+student_ids_data+"&subject="+subject+"&dairy_date="+dairy_date, success: function(result) { var res = eval("("+result+")"); if(res.description != undefined){ document.getElementById('dairy_desription').value =res.description; document.getElementById('dairy_ids').value = res.School_diary_id; }else { document.getElementById('dairy_desription').value =""; document.getElementById('dairy_ids').value = ""; } } }); } }); $("#sections").change(function(){ var class_id=$("#classes").val(); var school_id=$("#school_id").val(); var sec_id=$("#sections").val(); var acadamic_id =<?php echo $acadamic_year ?>; if($(this).val() == 0) { alert("Choose Section"); var subject_option = '<option value="0">Select Subject</option>'; $("#subjects").html(subject_option); document.getElementById('checkboxes').innerHTML = ''; return false; }else { $.ajax({ url: "ajaxcalls.php", type:"POST", data:"mode="+"choose_subject_dairy"+"&school_id="+school_id+"&class_id="+class_id+"&sec_id="+sec_id+"&acadamic_id="+acadamic_id, success: function(result) { var arr = result.split('@'); var result2 = eval("("+arr[0]+")"); var result_stu = eval("("+arr[1]+")"); var subject_option = '<option value="0">Select Subject</option>'; for(var i = 0;i < result2.length;i++){ subject_option += '<option value="'+result2[i].subject_id+'">'+result2[i].subject_name+'</option>'; } var students_ids =''; var students_names =''; if(result_stu == null){ students_data = '<option selected="selected" > Select Students </option>'; $("#students").html(students_data); document.getElementById('checkboxes').innerHTML = ''; }else{ var students_data = '<input type="checkbox" class="checkboxall" name="selectall" id="selectall" onclick="check_all()" checked="checked"> All <br>'; for(var j = 0;j < result_stu.length;j++){ var fullname = result_stu[j].student_firstname+' '+result_stu[j].student_lastname; students_data += '<label for="one"><input type="checkbox" onclick="check_single(this.value)" class="checkbox1" checked="checked" value="'+result_stu[j].student_id+'" name="students_ids[]" id="student_id'+result_stu[j].student_id+'" style="margin-top:-2px;"/ >'+fullname+'</label>'; students_ids += ","+result_stu[j].student_id; students_names += ", "+result_stu[j].fullname; } document.getElementById('checkboxes').innerHTML= students_data; document.getElementById('student_ids_data').value = students_ids; document.getElementById('student_allnames_data').value = students_names; document.getElementById('student_status').value = "all"; students_data = '<option selected="selected" > All </option>'; $("#students").html(students_data); } $("#subjects").html(subject_option); } }); } }); $('#datetimepicker1').datetimepicker({ format: 'dd/MM/yyyy', pickTime: false }).on('changeDate', function(){ $(this).datetimepicker('hide'); var class_id = $("#classes").val(); var school_id = $("#school_id").val(); var sec_id = $("#sections").val(); var dairy_date = $("#dairy_date").val(); var subject = $("#subjects").val(); var acadamic_id = <?php echo $acadamic_year ?>; var student_ids_all = $("#student_ids_data").val(); if(dairy_date == ''){ alert("Choose Date"); return false; }else { $.ajax({ url: "ajaxcalls.php", type:"POST", data:"mode="+"choose_description_dairy"+"&school_id="+school_id+"&class_id="+class_id+"&sec_id="+sec_id+"&acadamic_id="+acadamic_id+"&studentids="+student_ids_all+"&subject="+subject+"&dairy_date="+dairy_date, success: function(result) { var res = eval("("+result+")"); if(res.description != undefined){ document.getElementById('dairy_desription').value =res.description; document.getElementById('dairy_ids').value = res.School_diary_id; }else { document.getElementById('dairy_desription').value =""; document.getElementById('dairy_ids').value = ""; } } }); } }); $("#classes").change(function() { var acadamic_id =<?php echo $acadamic_year ?>; if($(this).val() == 0) { alert("Choose Class"); var section_option = '<option value="0">Select Section</option>'; $("#sections").html(section_option); var subject_option = '<option value="0">Select Subject</option>'; $("#subjects").html(subject_option); document.getElementById('checkboxes').innerHTML =''; document.getElementById('dairy_desription').value =""; document.getElementById('dairy_ids').value = ""; return false; } else { var x = $(this).val(); $.ajax({ url: "ajaxcalls.php", type:"POST", data:"mode="+"choose_class_dairy"+"&data="+x+"&acadamic_id="+acadamic_id, success: function(result) { var result2 = eval("("+result+")"); var section_option = '<option value="0">Select Section</option>'; for(var i = 0;i < result2.length;i++){ section_option += '<option value="'+result2[i].section_id+'">'+result2[i].section_name+'</option>'; } $("#sections").html(section_option); document.getElementById('dairy_desription').value =""; document.getElementById('dairy_ids').value = ""; students_data = '<option selected="selected" > Select Students </option>'; subject_option = '<option selected="selected" > Select Subjects </option>'; $("#subjects").html(subject_option); $("#students").html(students_data); }, error : function(e) { } }); } }); </script> <script> var expanded = false; function showCheckboxes() { var checkboxes = document.getElementById("checkboxes"); if (!expanded) { checkboxes.style.display = "block"; expanded = true; } else { checkboxes.style.display = "none"; expanded = false; } } function check_all(){ var class_id = $("#classes").val(); var school_id = $("#school_id").val(); var sec_id = $("#sections").val(); var dairy_date = $("#dairy_date").val(); var subject = $("#subjects").val(); var student_ids_all = $("#student_ids_all").val() var acadamic_id = <?php echo $acadamic_year ?>; student_ids_all = student_ids_all.replace(/^,/g, ''); student_ids_all = student_ids_all.replace(/,$/g, ''); if(document.getElementById("selectall").checked == true){ $(".checkbox1").prop("checked", true); document.getElementById('student_ids_data').value= document.getElementById('student_ids_all').value; document.getElementById('student_editdata_data').value=''; //document.getElementById('student_allnamesedit_data').value=''; document.getElementById('student_status').value = "all"; students_data = '<option selected="selected" > All </option>'; $("#students").html(students_data); if(subject != '' && dairy_date != '' && class_id !='' && school_id != '') { $.ajax({ url: "ajaxcalls.php", type:"POST", data:"mode="+"choose_description_dairy"+"&school_id="+school_id+"&class_id="+class_id+"&sec_id="+sec_id+"&acadamic_id="+acadamic_id+"&studentids="+student_ids_all+"&subject="+subject+"&dairy_date="+dairy_date, success: function(result) { var res = eval("("+result+")"); if(res.description != undefined){ document.getElementById('dairy_desription').value =res.description; document.getElementById('dairy_ids').value = res.School_diary_id; }else { document.getElementById('dairy_desription').value =""; document.getElementById('dairy_ids').value = ""; } } }); } }else{ $(".checkbox1").prop("checked", false); document.getElementById('student_status_check').value = ""; students_data = '<option selected="selected" > Select Students </option>'; $("#students").html(students_data); document.getElementById('checkval').value = '0'; document.getElementById('student_ids_data').value = ''; document.getElementById('dairy_desription').value =""; } } function check_single(val,name){ var student_status_check = $('#student_status_check').val(); var student_status_checkdata = $('#student_status_checkdata').val(); var student_status = $('#student_status').val(); var class_id = $("#classes").val(); var school_id = $("#school_id").val(); var sec_id = $("#sections").val(); var dairy_date = $("#dairy_date").val(); var subject = $("#subjects").val(); var acadamic_id = <?php echo $acadamic_year ?>; if(document.getElementById('checkval').value == ''){ document.getElementById('checkval').value = '1'; } var ids = document.getElementById('student_ids_data').value; var names = document.getElementById('student_allnames_data').value; var namesedit = document.getElementById('student_allnamesedit_data').value; var editdata = document.getElementById('student_editdata_data').value; if(document.getElementById("student_id"+val).checked == false){ if(student_status == "all"){ names = names; }else if(student_status == "singles"){ names = editdata; } if( student_status_check == 'all'){ names_data = names .replace(name,""); names_data = names_data .replace(",,",","); editdata = names_data; namesedit = names_data; document.getElementById('student_editdata_data').value = names_data; }else{ editdata = editdata .replace(name,""); editdata = editdata .replace(",",""); editdata = editdata .replace(",,",","); // namesedit = namesedit .replace(name,""); namesedit = names .replace(name,""); namesedit = namesedit .replace(",,",","); } ids = ids .replace(val,""); ids = ids .replace(",,",","); ids_new = ids.replace(/^,/g, ''); ids_new = ids.replace(/,$/g, ''); document.getElementById('student_status_check').value = '1'; if(subject != '' && dairy_date != '' && class_id !='' && school_id != '') { $.ajax({ url: "ajaxcalls.php", type:"POST", data:"mode="+"choose_description_dairy"+"&school_id="+school_id+"&class_id="+class_id+"&sec_id="+sec_id+"&acadamic_id="+acadamic_id+"&studentids="+ids_new+"&subject="+subject+"&dairy_date="+dairy_date, success: function(result) { var res = eval("("+result+")"); if(res.description != undefined){ document.getElementById('dairy_desription').value =res.description; document.getElementById('dairy_ids').value = res.School_diary_id; }else { document.getElementById('dairy_desription').value =""; document.getElementById('dairy_ids').value = ""; } } }); } }else { ids += ","+val; namesedit += ","+name; editdata += ","+name; // document.getElementById('student_status_check').value = "2"; ids = ids .replace(",,",","); ids_new = ids.replace(/^,/g, ''); ids_new = ids.replace(/,$/g, ''); if(subject != '' && dairy_date != '' && class_id !='' && school_id != '') { $.ajax({ url: "ajaxcalls.php", type:"POST", data:"mode="+"choose_description_dairy"+"&school_id="+school_id+"&class_id="+class_id+"&sec_id="+sec_id+"&acadamic_id="+acadamic_id+"&studentids="+ids_new+"&subject="+subject+"&dairy_date="+dairy_date, success: function(result) { var res = eval("("+result+")"); if(res.description != undefined){ document.getElementById('dairy_desription').value =res.description; document.getElementById('dairy_ids').value = res.School_diary_id; }else { document.getElementById('dairy_desription').value =""; document.getElementById('dairy_ids').value = ""; } } }); } } $(".checkboxall").prop("checked", false); ids = ids .replace(",,",","); document.getElementById('student_ids_data').value = ids; document.getElementById('student_allnames_data').value = document.getElementById('student_names_data').value; document.getElementById('student_editdata_data').value = editdata; namesedit = namesedit.replace(/^,/g, ''); namesedit = namesedit.replace(/,$/g, ''); document.getElementById('student_allnamesedit_data').value = namesedit; document.getElementById('student_editdata_data').value = editdata; document.getElementById('student_status').value = "singles"; document.getElementById('student_status_check').value = "1"; } function clearall() { window.location="general_comments.php"; } </script> </body> </html>