JezK
Edit File: edit_noticeback_06.php
<?php session_start(); //print_r($_SESSION); include("menuheader.php"); include_once("school_admin_access.php"); include_once("school_admin_student.php"); include_once("encription_key.php"); include_once("student_access.php"); $encrypted_id = $_GET['id']; $admin=new adminaccess(); $student=new studentacess(); $encry=new Encryption(); $student_new =new student_access(); $notice_id = $encry->decode($encrypted_id); $sch_id = $_SESSION['child']['log_school_id']; $acadamic_id = $_SESSION['child']['choosen_academic_id']; $notice_details = $student->notice_data_byid($notice_id); $details_sections =$student_new->get_sections_data_byclass($notice_details['class_id']); // print_r($notice_details); if($_POST['action'] == "update"){ /*$check_generalnotice = $student->check_generalnotice_data($_POST); echo "<pre>"; print_r($check_generalnotice); if($check_generalnotice['cnt'] > 0 ){ $result = $student->update_generalnotice_new($_POST,$check_generalnotice['notification_id']); } else { */ $result = $student->update_generalnotice($_POST,$_SESSION); echo "<script>location.replace('noticeboard_management.php?cresult=ERR203&type=".$_POST['category']."');</script>" ; //} } $details=$admin->get_classes_byschool_total($sch_id,$acadamic_id); ?> <style> .upload { background-color: #E1E1E1; width: 86px; margin: -30px 0px 0px 150px; height: 30px; text-align: center; font-size: 14px; padding: 5px 5px; color:#555555; border-radius:4px; cursor:pointer; } #nav { margin: auto; width:428px; 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; } </style> <script> $(document).ready(function(){ $('#err_category').hide(); $('#err_class').hide(); $('#err_section').hide(); $('#err_student').hide(); $('#err_subject_title').hide(); $('#err_description').hide(); }); function inputvalidations(){ var notice_description = document.getElementById('notice_description').value; if(notice_description == ''){ $('#err_description').show(); return false; } //return false; } </script> <div class="row" style="margin-top: 30px; margin-left:20px;margin-top:30px;"> <div class="col-md-9 text-left" style="font:Arial, Helvetica, sans-serif;font-style:normal;font-size:1.4em; margin-left:20px;"> <i class=" glyphicon glyphicon-pencil" title ="Edit Message" style="font-size: 20px;"></i> Edit Message </div> </div> <div class="menuu"> <ul id="nav"> <li class="<?=$gen_class?>" style="border-right:1px solid #FFFFFF;width:85px; text-align:center;margin-left:-3px;font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"><a href="noticeboard_management.php"><img src="images/general@2x.png" title ="General" style="margin-right:5px;"/>General</a></li> <li class="<?=$vac_class?>" style="border-right:1px solid #FFFFFF; width:85px; text-align:center; margin-left:-3px; font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"><a href="vacation.php"><img src="images/vacation@2x.png" title ="Vacation" style="margin-right:5px;"/>Vacation</a></li> <li class="<?=$act_class?>" style="border-right:1px solid #FFFFFF; width:85px; text-align:center; margin-left:-3px; font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"><a href="activities.php"><img src="images/activity@2x.png" title ="Activities" style="margin-right:5px;"/>Activities</a></li> <li class="<?=$ptm_class?>" style="border-right:1px solid #FFFFFF; width:85px; text-align:center; margin-left:-3px; font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"><a href="ptm.php"><img src="images/ptm@2x.png" title ="PTM" style="margin-right:5px;"/>PTM</a></li> <li style="width:85px; text-align:center; margin-left:-3px; font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"><a href="#"><img src="images/for-you@2x.png" title ="For You" style="margin-right:5px;"/>For You</a></li> </ul> </div> <form class="form-horizontal" style="margin-top:30px; margin-left:-10px;" method="post" enctype="multipart/form-data"> <div class="box-body" style="background-color:#fff; padding: 10px; font-family:Arial, Helvetica, sans-serif; font-size:13px; "> <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-left"><b style="color:#666666; ">Category</b> </div> <div class="col-md-7" style="margin-left:-40px;"> <select class="form-control" id="category" name="category" style="height:29px; width:328px!important;font-size:12px;" tabindex="1" disabled> <option value='' >--Select Category--</option> <?php if($notice_details['notification_type'] == "1") { ?> <option value="1" selected>General</option> <?php } else if($notice_details['notification_type'] == "2") { ?> <option value='2' selected>Vacation</option> <?php }else if($notice_details['notification_type'] == "3") { ?> <option value='3' selected>Activities</option> <?php }else if($notice_details['notification_type'] == "4") {?> <option value='4' selected>PTM</option> <?php } else if($notice_details['notification_type'] == "5") {?> <option value='5' selected>For You</option> <?php } ?> </select> <!-- if there is an error--> <div class="col-md-7" id="err_category" style="color:#990000;margin-left:-15px;">Please Enter Category</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-left"><b style="color:#666666; ">Class</b> </div> <div class="col-md-7" style="margin-left:-40px;"> <select class="form-control" id="classes" name="classes" style="height:29px; width:328px!important;font-size:12px;" tabindex="2" disabled> <option selected="selected" value='' >--Select Class--</option> <?php if($notice_details['class_id'] == "all") { ?> <option value='all' selected>All</option> <?php }else { foreach($details as $key=>$row) { if($row['class_id'] == $notice_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;">Please Enter Class</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-left"><b style="color:#666666; ">Section</b> </div> <div class="col-md-7" style="margin-left:-40px;"> <select class="form-control" id="sections" name="sections" style="height:29px; width:328px!important;font-size:12px;" tabindex="3" disabled> <option selected="selected" value='' >--Select Section--</option> <?php if($notice_details['section_id'] == "all"){ ?> <option value='all' selected>All</option> <?php }else { foreach($details_sections as $key=>$row) { if($row['section_id'] == $notice_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;">Please Enter Section</div> <!--- end error--> </div> </div> </div> <div class="class" id="student_details" style="display:none;"> <div class="form-group col-md-6" style="margin-bottom:1.0%; clear:both;"> <div class="col-md-4 col-md-offset-1 text-left"><b style="color:#666666; ">Student Name</b><span style="color:#FF0000; margin:2px;">*</span> </div> <div class="col-md-7" style="margin-left:-40px;"> <select class="form-control" id="student" name="student[]" value="<?=$_POST['student']?>" style="height:100px; width:328px!important;font-size:12px;" tabindex="1" name="student" multiple > </select> <!-- if there is an error--> <div class="col-md-7" id="err_student" style="color:#990000;margin-left:-15px;">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-left"><b style="color:#666666;">Message</b><span style="color:#FF0000; margin:2px; ">*</span></div> <div class="col-md-7" style="margin-left:-40px;"> <textarea class="form-control" id="notice_description" name="notice_description"rows="3" style="font-size:13px;width:329px;"tabindex="5"><?=$notice_details['notification_description']?></textarea> <!-- if there is an error--> <div class="col-md-7" id="err_description" style="color:#990000;margin-left:-15px;">Please Enter Description</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-left"><b style="color:#666666; ">Images</b> </div> <div class="col-md-7" style="margin-left:-40px;"> <input type="text" class="form-control" value=" " name="file_name1" id="file_name1" style="height:30px; width:165px;" readonly > <div class="upload" onclick="$('#slide1').click()" >Browse</div> <input type="file" name="slide1[]" multiple id="slide1" class="img" onchange="updateFileName1()" style="display:none;" tabindex="6"> </div> </div> </div> <div class="form-group" style="margin-left:-50px;"> <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; " tabindex="7" onclick="return inputvalidations()" >Send</button> <button type="button" class="btn btn-default custom-button-width .navbar-right" tabindex="17" style="font-family:Arial, Helvetica, sans-serif;font-style:normal;font-size:13px; margin:10px; " tabindex="8" onclick="return clearall('<?=$notice_details['notification_type']?>')">Cancel</button> </div> </div> </div> </div> <input type="hidden" name="school_id" id="school_id" value="<?=$sch_id?>"> <input type="hidden" name="academic_id" id="academic_id" value="<?=$acadamic_id?>"> <input type="hidden" name="notice_id" id="notice_id" value="<?=$notice_id?>"> <input type="hidden" name="classes" id="classes" value="<?=$notice_details['class_id']?>"> <input type="hidden" name="sections" id="sections" value="<?=$notice_details['section_id']?>"> <input type="hidden" name="category" id="category" value="<?=$notice_details['notification_type']?>"> <input type="hidden" name="action" id="action" value="update"> </form> <script> /*$("#category").change(function(){ if($(this).val() != 5){ var class_option = '<option value="0">Choose Class</option>'; class_option += '<option value="all">All</option>'; } $("#classes").html(class_option); }); */ $("#sections").change(function(){ var class_id=$("#classes").val(); var section_id=$("#sections").val(); var school_id=$("#school_id").val(); var category_id=$("#category").val(); if(category_id == 5){ document.getElementById('student_details').style.display="block"; } $.ajax({ url: "ajaxcalls.php", type:"POST", data:"mode="+"choose_students"+"&school_id="+school_id+"&class_id="+class_id+"§ion_id="+section_id, success: function(result) { var result2 = eval("("+result+")"); var students_option = ''; for(var i = 0;i < result2.length;i++){ students_option += '<option value="'+result2[i].student_id+'">'+result2[i].student_firstname+'</option>'; } $("#student").html(students_option); } }); }); $("#classes").change(function() { var category_id=$("#category").val(); if(category_id == 5 && $(this).val() == "all"){ alert("Please select the one class for the for you section"); return false; } else if($(this).val() == 0) { alert("Choose Class"); return false; } else if($(this).val() == 'all'){ var section_option = '<option value="0">Choose Section</option>'; section_option += '<option value="all">All</option>'; $("#sections").html(section_option); }else { var x = $(this).val(); $.ajax({ url: "ajaxcalls.php", type:"POST", data:"mode="+"choose_class"+"&data="+x, success: function(result) { var result2 = eval("("+result+")"); var section_option = '<option value="0">Choose Section</option>'; section_option += '<option value="all">All</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); }, error : function(e) { } }); } }); function clearall(type) { window.location="noticeboard_management.php?type="+type; } </script> </body> </html>