JezK
Edit File: calenderview.php
<?php session_start(); include("menuheader.php"); if(!(in_array(3,$access) && in_array(3,$allow))) echo "<script>location.replace('dashboard.php');</script>"; include_once("school_admin_access.php"); include_once("school_admin_student.php"); include_once("encription_key.php"); define('NOTICEBOARD_IMAGES_PATH',ADMIN_PATH.'uploads/noticeboard/timthumb.php?h=100&w=100&src='); $admin=new adminaccess(); $student=new studentacess(); $encry=new Encryption(); if($_GET['type']){ $type = $_GET['type']; }else { //$type= '2'; $type= '1'; } if($_GET['date']){ $date = $_GET['date']; }else { $date=date('Y-m-d'); } $dates=$admin->getacademicdates($_SESSION); //print_r($dates); if(isset($_POST['submit'])) { $event_data=$_POST['event']; $cal_date=$_POST['cal_date']; //echo "<script>alert('".$cal_date."');</script>"; //exit; $details_cal =$admin->insert_calenderdata($_SESSION,$event_data,$cal_date); if($details_cal==1) { echo "<script>alert('Event submitted successfully.');</script>"; echo "<script>location.replace('calenderview.php?date=".$cal_date."');</script>"; } } $notice_data = $student->generalnotice_data($_SESSION,$type); $notice_calender = $student->generalnotice_calenderview($_SESSION,$type,$date); $school_id = $_SESSION['child']['log_school_id']; $details_class =$admin->get_classes_byschool($school_id); $sections=$admin->get_sections_all(); ?> <style> #nav { margin: auto; width:930px; padding-left:0; padding-right:0; list-style: none; background: #18b88d; } #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: rgb(54, 120, 102); width:90px; } #nav li.selected { background: rgb(54, 120, 102); } select { width: 62px !important; background-color: #FFF; border: 1px solid #CCC; } .table-condensed > thead > tr > th, .table-condensed > tbody > tr > th, .table-condensed > tfoot > tr > th, .table-condensed > thead > tr > td, .table-condensed > tbody > tr > td, .table-condensed > tfoot > tr > td { padding: 3px; } .ui-datepicker-inline { margin: 0 auto; } .modal { left: 41%!important; width: 765px!important; height: 450px!important; background:rgba(0, 0, 0,0.1); } </style> <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/south-street/jquery-ui.css" id="theme"> <link rel="stylesheet" href="//blueimp.github.io/Gallery/css/blueimp-gallery.min.css"> <body style=" overflow-x: hidden;"> <div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls"> <div class="slides"></div> <a class="prev">‹</a> <a class="next">›</a> <a class="close">×</a> <a class="play-pause"></a> <ol class="indicator"></ol> </div> <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;"> <img src="images/noticeboard@2x.png" title =" Notice Board" style="font-size: 24px;"/> Calendar </div> <div class="col-md-2 text-center" style="float:right;"> <!--<button type="button" onClick="location.href='send_message.php?type=2'" class="btn btn-default" style="margin-right:20px;font-family: Arial, Helvetica, sans-serif; font-size:14px;padding:4px 10px;"> New Message </button>--> </div> </div> <br> <div class="menuu"> <ul id="nav" class="margn_auto"> <li class="selected" style="border-right:1px solid #FFFFFF;width:150px; text-align:center;margin-left:-3px;font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"><a href="calenderview.php"><img src="images/general@2x.png" title ="General" style="margin-right:5px;"/>Calendar</a></li> <li style="border-right:1px solid #FFFFFF;width:150px; 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 style="border-right:1px solid #FFFFFF; width:150px; 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="border-right:1px solid #FFFFFF; width:150px; 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 style="border-right:1px solid #FFFFFF; width:150px; 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 style="width:150px; text-align:center; margin-left:-3px; font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"><a href="for_you.php"><img src="images/for-you@2x.png" title ="For You" style="margin-right:5px;"/>For You</a></li> </ul> </div> <!---<div class="row" style="margin-top: 30px;"> <div class="col-md-12 text-center" style="font:Arial, Helvetica, sans-serif;font-style:normal;font-size:18px; margin-left:20px; margin-top:-5px;"> <img src="images/vacation@2x.png" style="color:#000000; background:#000000; font-size:25px;color:black;" title ="calender" /> Calender </div> </div>--> <div id="datepicker" style="margin:0 auto;" data-toggle="modal" data-target="#myModal"></div> <input type="hidden" id="now_dated" name="now_dates" value="<?php echo date('Y-m-d');?>"> <div class="row" style="margin-left:10px;margin-right:10px;"> <div class="col-md-12 centered" style="font-family: Arial, Helvetica, sans-serif;margin-top:30px;"> <table id="myTable" class="table table-condensed table-hover" style="margin-top:-10px;"> <thead> <tr class="info"> <th class="col-md-1 text-center" style="width:5%">Sl.No</th> <!--<th style="width:12%">Class</th> <th style="width:10%">Section</th>--> <th style="width:50%">Message</th> <th style="width:10%">Created On</th> <th style="width:10%">Action</th> <!--<th style="width:10%">Type</th>--> </tr> </thead> <tbody> <?php $i =1; $j=1; if($notice_calender){ foreach($notice_calender as $kk=>$val) { //$notice_data_images = $student->generalnotice_images_data($val['notification_id']); $notice_data_images =''; $date_date_new = explode(" ",$val['created_on']); $date_date = explode("-",$date_date_new[0]); $notice_date = $date_date['1']."/".$date_date['2']."/".$date_date['0']; if($val['class_id'] == "all"){ $class = "All"; }else{ $class = $details_class[$val['class_id']]['class_name']; } if($val['section_id'] == "all"){ $section = "All"; }else{ $section = $sections[$val['section_id']]['section_name']; } if($val['student_id'] != "all"){ $ids = explode(",",$val['student_id']); $details_students =$student->get_students_data_notice_byids($val['class_id'],$val['section_id'],$val['student_id'],$school_id); $students = ''; if($details_students){ foreach($details_students as $key=>$row){ $students .= $row['student_firstname']." ".$row['student_lastname']."<br>"; } } }else { $students = "All"; } ?> <tr> <td class="col-sm-1 text-center" style=" font-size:14px;width:10%"><?=$i?></td> <!--<td class="col-sm-1 text-center" style=" font-size:14px;width:10%"><=$class?></td> <td class="col-sm-1 text-center" style=" font-size:14px;width:10%"><=$section?></td>--> <td style=" font-size:14px;width:50%"><?=$val['notification_description']?><br> <?php if($notice_data_images){ ?> <div id="links<?=$j?>" > <?php foreach($notice_data_images as $k=>$fl){ ?> <a onclick="changeimage('<?=$j?>')" href="uploads/noticeboard/<?=$fl['image']?>" title="<?=$fl['image']?>"> <img src="<?=NOTICEBOARD_IMAGES_PATH.$fl['image']?>" height="100px" width="100px" alt=""> </a> <?php } ?> </div> <?php }?> </td> <td style="font-size:14px;width:10%"><?=$notice_date?></td> <!--<td style="font-size:14px;width:10%"><=$students?></td> <td style="font-size:14px;width:10%"><if($val['notification_type']==1)echo 'General';else if($val['notification_type']==2) echo 'Vacations';else if($val['notification_type']==3) echo 'Activities';else if($val['notification_type']==4) echo 'Ptm';else if($val['notification_type']==5) echo 'For you';?></td>--> <td class="center" style="width:10%"> <!--<a class=" buttonn" href="javascript:void(0);" onclick="edit_event(<?=$val['notification_id']?>)" style="margin:4px;"> <i class="glyphicon glyphicon-pencil" title ="Edit" style="font-size: 14px; color:#01aee6;"></i> </a>--> <a class="buttonn" onclick="delete_event(<?=$val['notification_id']?>)" href="javascript:void(0);" style="margin:4px;"> <i class=" glyphicon glyphicon-remove" title="Delete" style="font-size: 14px; color:#01aee6;"></i> </a> </td> </tr> <?php $i++; $j++; } }else{ ?> <tr> <td></td> <td></td> <td></td> <td>No data available in table</td> <td></td> <td></td> </tr> <?php } ?> </tbody> </table> <div><!-- Trigger the modal with a button --> <!--<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>--> <!-- Modal --> <div id="myModal" class="modal fade" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <form method="post"> <div class="modal-content"> <div class="modal-header" style="background:#18b88d;color:#fff"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Event</h4> </div> <div class="modal-body"> <p> Add Event:</p> <p><textarea name="event" id="event" class="form-control" style="height:100px;margin-left: 58px; width: 438px;" id=""></textarea></p> <input type="hidden" id="cal_date" name="cal_date"> </div> <div class="modal-footer"> <input type="submit" id="submit" name="submit" class="btn btn-default" data-dismiss="modaldads" value="Add" onclick="return validation()" /> <button type="button" class="btn btn-default" data-dismiss="modal" onclick="test();">Close</button> </div> </div> </form> </div> </div></div> </div> </div> <!--------EDIT EVENT MODEL> <div><!-- Trigger the modal with a button --> <!--<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>--> <!-- Modal --> <div id="myModal22" class="modal fade" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <form method="post"> <div class="modal-content"> <div class="modal-header" style="background:#18b88d;color:#fff"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Event</h4> </div> <div class="modal-body"> <p> Edit Event:</p> <p><textarea name="edit_event" id="edit_event" class="form-control" style="height:100px;margin-left: 58px; width: 438px;" id=""></textarea></p> <input type="hidden" id="cal_date" name="cal_date"> </div> <div class="modal-footer"> <input type="submit" id="edit_submit" name="edit_submit" class="btn btn-default" data-dismiss="modaldads" value="Edit" onclick="return validation()" /> <button type="button" class="btn btn-default" data-dismiss="modal" onclick="test();">Close</button> </div> </div> </form> </div> </div></div> </div> </div> <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script> <script src="//blueimp.github.io/Gallery/js/jquery.blueimp-gallery.min.js"></script> <script src="js/jquery.image-gallery.min.js"></script> <script src="//code.jquery.com/jquery-1.12.0.min.js"></script> <script src="https://cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/buttons/1.1.2/js/dataTables.buttons.min.js"></script> <script src="//cdn.datatables.net/buttons/1.1.2/js/buttons.print.min.js"></script> <script src="//cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/pdfmake.min.js"></script> <script src="//cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/vfs_fonts.js"></script> <script src="//cdn.datatables.net/buttons/1.1.2/js/buttons.html5.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script> <script type="text/javascript" language="javascript" class="init"> $(document).ready(function() { /*$('#myTable').DataTable({ "pageLength":100, stateSave: true, dom: 'T<"clear">lfrtip', "oLanguage": { "sSearch": "" }, tableTools: { "aButtons": [ { "sExtends": "xls", "mColumns": [0, 1, 2, 3, 4] }, { "sExtends": "pdf", "sPdfOrientation": "landscape", "mColumns": [0, 1, 2, 3, 4] }, { "sExtends": "print", "mColumns": [0, 1, 2, 3, 4] } ] } }); $('div.dataTables_filter input').attr('placeholder', 'Search');*/ $('#myTable').DataTable( { dom: 'B<"clear">lfrtip', "iDisplayLength": 100, stateSave: true, buttons: [ { extend: 'print', title: '<center><h3><?php echo $_SESSION['child']['school_name']?></h3></center>', message: 'Notice Board Management - Vacation<br>Academic Year:<?php echo $_SESSION[child][choosen_year_name]?><br>', exportOptions: { columns: [ 0, 1, 2, 3, 4 ] } }, { extend: 'pdfHtml5', title:'<?php echo $_SESSION['child']['school_name']?>', message: 'Notice Board Management - Vacation \nAcademic Year:<?php echo $_SESSION[child][choosen_year_name]?>\n', exportOptions: { columns: [ 0, 1, 2, 3, 4 ] } }, { extend: 'excelHtml5', exportOptions: { columns: [ 0, 1, 2, 3, 4 ] } } ] } ); } ); </script> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.12.4.js"></script> <script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script> $(document).ready(function(){ //$('#myModal22').modal('show'); //var d = new Array(); //d[0] = "2016-11-02" ; //d[1] = "2016-11-03" ; ////alert(d.length); //for(i=0;i<d.length;i++) //{ //var simple = d[i]; //var values = simple.split('-'); //$('#datepicker').datepicker("setDate", new Date(values[0],values[1]-1,values[2])); //} var simple = '<?php echo $date; ?>'; var values = simple.split('-'); $('#datepicker').datepicker("setDate", new Date(values[0],values[1]-1,values[2])); $('#myTable').dataTable(); }); </script> <script> function changeimage(j){ document.getElementById('links'+j).onclick = function (event) { event = event || window.event; var target = event.target || event.srcElement, link = target.src ? target.parentNode : target, options = {index: link, event: event}, links = this.getElementsByTagName('a'); blueimp.Gallery(links, options); }; } function test() { var cmp= $("#datepicker").val(); //location.replace('calenderview.php?date='+cmp); } function validation() { //alert('hi'); var des=document.getElementById('event').value; if(des=='') { alert('Please enter description'); return false; }else { } } //function edit_event(notid) //{ //alert(notid); ////$('#datepicker').hide(); //$('#myModal22').modal('show'); //} </script> <script> $( "#datepicker" ).datepicker({ dateFormat: 'yy-mm-dd' }).on('change', function() { //alert('Hi'); //$('#datepicker').hide(); var start_date='<?php echo $dates['academic_startdate']?>'; var end_date='<?php echo $dates['academic_enddate'] ?>'; //alert('startdate'+start_date); //alert('enddate'+end_date); var cmp= $("#datepicker").val(); var nwdate=$("#now_dated").val(); var cudate=nwdate.split("-"); var dcmp=cmp.split('-'); var mcdate=dcmp[1]-1; var mcheck=cudate[1]-1; var cdate= new Date(dcmp[0],mcdate,dcmp[2]); var checkd= new Date(cudate[0],mcheck,cudate[2]); var asdate=start_date.split('-'); var aedate=end_date.split('-'); var amc_smonth=asdate[1]-1; var amc_emonth=aedate[1]-1; var sd1= new Date(asdate[0],amc_smonth,asdate[2]); var end1= new Date(aedate[0],amc_emonth,aedate[2]); //alert(sd1); //alert(end1); //alert('selectdate'+cdate); //alert('currentdate'+checkd); //if(cdate>sd1) //{ //alert('success'); //}else //{ //alert('fail'); //} //return false; if(cdate<sd1) { alert("Please choose a date with in the range of Academic Year"); //$('#myModal').modal('show'); $('#datepicker').show(); document.getElementById('cal_date').value=cmp; //$('#myModal').modal('show'); //location.replace('calenderview.php?date='+cmp); } else if(cdate>end1) { alert("Please choose a date with in the range of Academic Year"); //$("#datepicker").val(''); document.getElementById('cal_date').value=cmp; //$('#myModal').modal('show'); $('#datepicker').show(); }else { document.getElementById('cal_date').value=cmp; $('#myModal').modal('show'); $('#datepicker').show(); } }); function delete_event(dairy_id) { var dte = '<?php echo $date; ?>'; //alert(dairy_id); var res=confirm("Do you want to delete the Message ?"); if(res) { $.ajax({ url: "ajaxcalls_attn.php", type:"POST", data:"mode="+"delete_event"+"¬ification_id="+dairy_id, success: function(result) { if(result==1) { //document.getElementById("mydairyid").innerHTML=""; location.replace('calenderview.php?date='+dte); } else { } }, error : function(e) { alert(e); } }); } } </script> <!--<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>--> <!-- <script> function edit_event(notid) { alert(notid); $('#myModal22').modal('show'); } </script> --> </body> </html>