static function removeInstructor() { $id = $_POST['id']; $cursor = Dispatcher::$mysqli->query("select * from instructor where status='default'"); $row = $cursor->fetch_assoc(); $defaultInstructorID = $row['Person_id']; $default_calendar_id = $row['calendar_id']; Dispatcher::$mysqli->query("update custom_intsructor set instructor_id={$defaultInstructorID} where instructor_id={$id}"); Dispatcher::$mysqli->query("update instructor_has_hours set instructor_id={$defaultInstructorID} where instructor_id={$id}"); $cursor = Dispatcher::$mysqli->query("select * from instructor where `Person_id`={$id}"); $row = $cursor->fetch_assoc(); $prev_calendar_id = $row['calendar_id']; $cursor = Dispatcher::$mysqli->query("select * from event where `instructor_Person_id`={$id}"); $instructorCalendarEvents = new InstructorCalendarEvents(); while ($row = $cursor->fetch_assoc()) { $instructorCalendarEvents->setDefaultInstructor($prev_calendar_id, $row['clndr_event_id'], $default_calendar_id); } Dispatcher::$mysqli->query("delete from instructor where `Person_id`='{$id}'"); Dispatcher::$mysqli->query("delete from person where id='{$id}'"); print_r(Dispatcher::$mysqli->error); $instructors_array = self::getInstructors(); get_instructors_view($instructors_array); }
<div class="modal-title" id="myModalLabel">Instructors</div> </div> <div class="modal-body timetable-modal-body"> <button id="add-instructor-btn" class="add-instructor-btn popover-dismiss" data-placement="bottom"> <span class="add_instructor_plus"></span><span class="add-instructor-label">Add instuctor</span> </button> <!-- <button id="add-instructor-btn" type="button" data-placement="bottom" class="add-instructor-btn popover-dismiss btn btn-default btn-lg"> <span class="glyphicon glyphicon-plus-sign"></span> Add instuctor </button>--> <!--<input type="text" name='instructor-name' value=""/>--> <table class="list-of-instructors"> <?php get_instructors_view($instructors_array); ?> </table> </div> <div class="modal-footer timetable-modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <!--<button id="new_service_save_btn" type="button" class="btn-next" onclick="">Save</button>--> </div> </div> </div> </div> <div id="add-instructor-head" class="hide">Add intructor</div> <div id="add-instructor-content" class="hide"> <table class="add-instructors-table">