File manager - Edit - /home/wwwroot/camplus.hk/master.camplus.hk/public_html/application/modules/timetable/views/check_timetable.php
Back
<style> .tablegenrate table td { cursor:pointer } table tr td { text-align: center; } .event { display:block; width:100%; } </style> <div class="portlet light bordered"> <div class="portlet-title"> <div class="caption"> <i class="icon-doc font-dark"></i> <span class="bold"><?php echo "Edit ".$pagetitle; ?></span> </div> <div class="actions"></div> </div> <div class="portlet-body"> <div class="row"> <?php // echo $timetablesdata[1]['id'];?> <form action="<?php echo base_url();?>timetable/timetable/edit" method="post" > <div class="dd col-md-12" > <div class="dd col-md-3" > <?php //echo $timetables['ts_id'];//print_r($timetables);die;?> <div class="form-group"> <select class="selectacademicyear select2" id="ay_id" name="ay_id" style="width: 100%;" readonly > <option value="">Select Academic Year</option> <?php foreach ($academic_years as $key => $academic_year) { ?> <option value="<?php echo $academic_year['id']?>" ><?php echo $academic_year['year_label']?></option> <?php } ?> </select> </div> <div class="form-group"> <input type="hidden" id="cycle_day" value="" name="cycle_day" class="form-control" placeholder="How many day per cycle"/> <select class="selecttimeslots select2" id="selectTimeTable" name="ts_id" style="width: 100%;" readonly > <option value="">Select Timetable</option> </select> </div> </div> <div class="dd col-md-12" > <table id="timeslotstable" class="table table-bordered table-hover" style="padding:none" border="1"></table> </div> </form> </div> <div id="actionModal" class="modal fade" tabindex="-1" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> </div> <div class="modal-body"> <h4><?php echo $this->lang->line('are_you_sure'); ?></h4> </div> <div class="modal-footer"> <button type="button" data-dismiss="modal" class="btn default"><?php echo $this->lang->line('close'); ?></button> <a href="" type="button" class="btn default green confirmAction"><?php echo $this->lang->line('yes'); ?></a> </div> </div> </div> </div> <div id="messagemodel" class="modal fade" tabindex="-1" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> <h4 class="modal-title" style="color:red"><?php echo "Error Message"; ?> </h4> </div> <div class="modal-body"> <h4>Please select correct input.</h4> </div> <div class="modal-footer"> <button type="button" data-dismiss="modal" class="btn default"><?php echo $this->lang->line('close'); ?></button> </div> </div> </div> </div> <script> $(document).ready(function(){ $(".selectacademicyear").select2({ placeholder: "Select Academic Year"}); $(".selecttimeslots").select2({ placeholder: "Select Timeslot set"}); // users get subjects $(document).on('change', '.selectacademicyear', function(event) { $('#subjecttable tbody').html(''); var ay_id=$("#ay_id").val(); $.ajax({ type: "POST", url: BASE_URL + "timetable/timetable/getUserTimetableByYear/" + ay_id, dataType: "json", success: function(data) { //alert(data[0]['name_eng']); $('.selecttimeslots').empty(); $('.selecttimeslots').append('<option value="">Select Timetable</option>'); console.log(data); for(i=0;i<data.length;i++) { $('.selecttimeslots').append('<option data-cycle='+data[i].cycle_day+' data-timeslot='+data[i].ts_id+' value="'+data[i].id+'">'+data[i].ap_name+' ('+data[i].timeslot_title+')</option>'); } $('#selectTimeTable').select2(); } }); }); $(document).on('change', '#selectTimeTable', function(event) { render_table(); }) }) function render_table() { $.ajax({ type: 'GET', // <-- get method of form url: BASE_URL + '/timetable/timetable/getTeacherTimetable/'+$('#selectTimeTable').select2("val") + '/<?php echo $this->session->userdata['id'] ?>', // <-- get action of form beforeSend: function(){ }, success: function(response){ var data = jQuery.parseJSON(response) //console.log(data); // $('#result').html(data); // alert('sus'); $('#timeslotstable tbody').html(''); var ay_id=$("#ay_id").val(); var day=parseInt($('#selectTimeTable').select2("data")[0].element.dataset.cycle); $.ajax({ type: 'GET', // <-- get method of form url: BASE_URL + '/timeslot/get/'+$('#selectTimeTable').select2("data")[0].element.dataset.timeslot, // <-- get action of form beforeSend: function(){ }, success: function(response){ var timeslots = jQuery.parseJSON(response) console.log(timeslots) var i,header='<tr><th style="width: 12%;">Timeslots</th>',row=''; for( i=1; i<=day; i++ ) { header += '<th>D'+i+'</th>'; } header += '</tr>'; for(j=0;j<timeslots.length;j++) { row +='<tr>'; for(k=0;k<=day;k++) { if(k==0){ row +='<td style="text-align:left;">'+timeslots[j].title+' ('+timeslots[j].time_from+'-'+timeslots[j].time_to+')</td>'; } else { var class_sub_venue=""; for(l=0;l<data.length;l++) { var lesson_1=data[l]['slot_id']; var day_1=data[l]['day']; if(lesson_1==j+1 && day_1==k) { class_sub_venue ='<span class="event" id="'+i+'" draggable="true" data-venue="'+ data[l]['class_title']+'_'+data[l]['shortname_eng'] +'" data-time-id="'+data[l]['teacher_time_id'] +'" data-id="'+data[l]['id']+'_'+data[l]['venue_id']+'" >'+ data[l]['class_title']+'_'+data[l]['shortname_eng']+'<hr style="margin:0px">'+data[l]['venue_title'] +' <input type="hidden" name="'+ data[l]['class_title']+'" value="'+data[l]['id']+'_'+data[l]['venue_id'] +'" /> </span>'; break; } } if(class_sub_venue) row +='<td id="'+(j+1)+'_'+k+'" style="background-color: rgb(0, 153, 204);"> '+class_sub_venue+'</td>'; else row +='<td id="'+(j+1)+'_'+k+'"></td>'; } } row +='</tr>'; } var table=''; table = header +row; //$('#timeslotstable').append(table); $('#timeslotstable').append(table); } }) } }); // $('#subjecttable tbody').html(''); } </script>
| ver. 1.4 |
Github
|
.
| PHP 7.2.34 | Generation time: 0.18 |
proxy
|
phpinfo
|
Settings