File manager - Edit - /home/wwwroot/camplus.hk/master.camplus.hk/public_html/application/modules/timetable/views/subject_arrangement.php
Back
<link href="<?php echo base_url(); ?>assets/global/plugins/jquery-multi-select/css/multi-select.css" rel="stylesheet" > <script src="<?php echo base_url(); ?>assets/global/plugins/jquery-multi-select/js/jquery.multi-select.js"></script> <script src="<?php echo base_url(); ?>assets/custom/js/jquery.quicksearch.js"></script> <style> .dd-handle { height:35px; } .ms-container { width:100%; } .search-input { width:100%; margin-bottom:10px; } form td { padding:10px 0px; } .disabled { color:grey; text-decoration: line-through; } </style> <?php require_once('progress_bar.php'); ?> <div class="portlet light bordered"> <div class="portlet-title"> <div class="caption"> <i class="icon-doc font-dark"></i> <span class="bold"><?php echo $pagetitle; ?></span> </div> </div> <div class="portlet-body"> <div class="row"> <form action="<?php echo base_url();?>timetable/subject_arrangement/edit/<?php echo $ay_id;?>" method="post"> <div class="col-md-3" id="subjectdiv"> <div class="form-group"> <select class="selectacademicyear select2" placeholder="Select Academic Year" id="ay_id" name="ay_id" style="width: 100%;" required disabled > <option value="">Select Academic Year</option> <?php foreach ($academic_years as $key => $academic_year) { ?> <option value="<?php echo $academic_year['id']?>" <?php if($ay_id==$academic_year['id']){ echo "selected"; }?> > <?php echo $academic_year['year_label']?></option> <?php } ?> </select> <input type="hidden" name="ay_id" value="<?php echo $ay_id;?>" /> </div> <table style="margin-top: 22px;" class="table table-striped table-bordered table-hover" id="data_table"> <tbody> <!-- load variables from controller --> <?php foreach($subjects as $key => $sub): ?> <tr class=""> <td> <a class="btn-edit" data-name="<?php echo $sub['name_eng']; ?>" data-id="<?php echo $sub['id']; ?>"> <?php echo$sub['name_eng']; ?></a> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> <div class="col-md-4" id="editModal"> <input type="hidden" name="sub_id" id="sub_id" class="form-control"> <h3><span class="subjectname">Select Subject</span></h3> <table style="width:100%"> <thead> <tr><td> <select multiple="multiple" id="users_select" name="my-select[]" required> <?php foreach($users as $user) { echo "<option value='".$user['id']."'>".allUsers($user['id'],1)."</option>"; } ?> </select> </td></tr> </thead> </table> </div> <div class="col-md-5 userclasses"> <h3><span >Class(es)</span></h3> <table style="margin-top: 20px;" class="table table-bordered table-hover" id="classestable"> <thead> <tr><td style="width: 45%;">Selected Teachers</td><td style="width: 55%;">Teaching Class(es)</td></tr> </thead> <tbody> </tbody> </table> </div> <div class="col-md-12"> <span class="pull-right"> <a href="<?php echo base_url();?>timetable/setup" class="btn btn-default" data-toggle="modal"> <?php echo $this->lang->line('cancel'); ?></a> <input type="submit" id="saveSettings" type="button" class="btn btn-success" value="<?php echo $this->lang->line('save'); ?> "/></span> </div> </form> </div> </div> </div> <script> $(document).on('change', '.selectacademicyear', function() { var year = $(this).val; if (year != "") $("#data_table").show(); }); $(document).ready(function() { var data_user = []; //$("#data_table").hide(); $("#editModal").hide(); $(".userclasses").hide(); $(".selectacademicyear").select2({ placeholder: "Select Academic Year" }); $(document).on('click', '.btn-edit', function(event) { $("#subjectdiv table td").css('background-color', ''); //$(this).parents('td').css('background-color',''); $(this).closest('td').css('background-color', '#CCCCCC'); var id = $(this).attr('data-id'); var name = $(this).attr('data-name'); var ay_id = $('#ay_id').val(); $('.subjectname').html(name); $('#users_select').multiSelect("deselect_all"); $('#users_select').multiSelect("refresh"); $('#sub_id').val(id); $('#edit_subjectname').val(name); $('#classestable tbody').html('') $.ajax({ type: "POST", url: BASE_URL + "timetable/subject_arrangement/getUsers/" + ay_id + "/" + id, dataType: "json", success: function(data) { data_user = data; for (i = 0; i < data.length; i++) { $('#users_select option[value="' + data[i]['uid'] + '"]').prop('selected', true); } $('#users_select').multiSelect("refresh"); } }); $("#editModal").show(); $(".userclasses").show(); var myVar = setInterval(function() { $('#classestable tbody').html(''); $('#users_select option:selected').each(function() { var id = $(this).val(); var i, option; var text; $.ajax({ type: "POST", url: BASE_URL + "timetable/subject_arrangement/getClasses/" + id, dataType: "json", success: function(data) { var userclass = []; var user_name = data['user_name']['name_english']; var uid = data['user_name']['id']; var data = data['all_classes']; for (j = 0; j < data_user.length; j++) { if (data_user[j]['uid'] == uid) { userclass.push(data_user[j]['class_id']); } } text += '<tr><td>' + user_name + '</td><td><select id="multiple" class="form-control select2-multiple multiple" multiple placeholder="select classes" name="class_id' + id + '[]" required >'; for (i = 0; i < data.length; i++) { if (userclass.indexOf(data[i]['id']) >= 0) { option += '<option value="' + data[i]['id'] + '" selected>' + data[i]['title'] + '</option>'; } else { option += '<option value="' + data[i]['id'] + '" >' + data[i]['title'] + '</option>'; } } text += option + '</select></td></tr>'; option = ""; $('#classestable tbody').append(text); text = ""; $(".select2-multiple").select2(); } }); }); clearInterval(myVar); }, 1000); // }) $(document).on('click', '.ms-elem-selectable', function(event) { $(".userclasses").show(); $('#classestable tbody').html(''); $('#users_select option:selected').each(function() { var id = $(this).val(); var i, option; var text; $.ajax({ type: "POST", url: BASE_URL + "timetable/subject_arrangement/getClasses/" + id, dataType: "json", success: function(data) { var userclass = []; var user_name = data['user_name']['name_english']; var uid = data['user_name']['id']; var data = data['all_classes']; for (j = 0; j < data_user.length; j++) { if (data_user[j]['uid'] == uid) { userclass.push(data_user[j]['class_id']); } } text += '<tr><td>' + user_name + '</td><td><select id="multiple" class="form-control select2-multiple multiple" multiple placeholder="select classes" name="class_id' + id + '[]" required >'; for (i = 0; i < data.length; i++) { if (userclass.indexOf(data[i]['id']) >= 0) { option += '<option value="' + data[i]['id'] + '" selected>' + data[i]['title'] + '</option>'; } else { option += '<option value="' + data[i]['id'] + '" >' + data[i]['title'] + '</option>'; } } text += option + '</select></td></tr>'; option = ""; $('#classestable tbody').append(text); text = ""; $(".select2-multiple").select2(); } }); }); }); $(document).on('click', '.ms-elem-selection', function(event) { $('#classestable tbody').html(''); $('#users_select option:selected').each(function() { var id = $(this).val(); var i, option; var text = ''; $.ajax({ type: "POST", url: BASE_URL + "timetable/subject_arrangement/getClasses/" + id, dataType: "json", success: function(data) { var userclass = []; var user_name = data['user_name']['name_english']; var uid = data['user_name']['id']; var data = data['all_classes']; for (j = 0; j < data_user.length; j++) { if (data_user[j]['uid'] == uid) { userclass.push(data_user[j]['class_id']); } } text += '<tr><td>' + user_name + '</td><td><select id="multiple" class="form-control select2-multiple" multiple name="class_id' + id + '[]" placeholder="select classes" >'; for (i = 0; i < data.length; i++) { if (userclass.indexOf(data[i]['id']) >= 0) { option += '<option value="' + data[i]['id'] + '" selected>' + data[i]['title'] + '</option>'; } else { option += '<option value="' + data[i]['id'] + '" >' + data[i]['title'] + '</option>'; } } text += option + '</select></td></tr>'; option = ""; $('#classestable tbody').append(text); text = ""; $(".select2-multiple").select2(); } }); }); }); }); $('#users_select').multiSelect({ selectableHeader: "<input type='text' class='search-input' autocomplete='off' placeholder='Search Users...'>", selectionHeader: "<input type='text' class='search-input' autocomplete='off' placeholder='Search Users...'>", afterInit: function(ms) { var that = this, $selectableSearch = that.$selectableUl.prev(), $selectionSearch = that.$selectionUl.prev(), selectableSearchString = '#' + that.$container.attr('id') + ' .ms-elem-selectable:not(.ms-selected)', selectionSearchString = '#' + that.$container.attr('id') + ' .ms-elem-selection.ms-selected'; that.qs1 = $selectableSearch.quicksearch(selectableSearchString).on('keydown', function(e) { if (e.which === 40) { that.$selectableUl.focus(); return false; } }); that.qs2 = $selectionSearch.quicksearch(selectionSearchString).on('keydown', function(e) { if (e.which == 40) { that.$selectionUl.focus(); return false; } }); }, afterSelect: function() { this.qs1.cache(); this.qs2.cache(); }, afterDeselect: function() { this.qs1.cache(); this.qs2.cache(); } }) </script>
| ver. 1.4 |
Github
|
.
| PHP 7.2.34 | Generation time: 0.25 |
proxy
|
phpinfo
|
Settings