public function info_onus_designate() { $session = new session_students(); $id = $session->Get_id_user(); $db = new data_base(tpl_onus_designate::onus_designate(), array(tpl_onus_designate::id(), tpl_onus_designate::id_degree(), tpl_onus_designate::id_models(), tpl_onus_designate::id_student(), tpl_onus_designate::id_onus(), data_base::select_multiple_table(tpl_onus::onus(), tpl_onus::onus() . '.' . tpl_onus::id(), tpl_onus_designate::onus_designate() . '.' . tpl_onus_designate::id_onus(), tpl_onus::name(), tpl_onus::onus() . '_' . tpl_onus::name()), data_base::select_multiple_table(tpl_onus::onus(), tpl_onus::onus() . '.' . tpl_onus::id(), tpl_onus_designate::onus_designate() . '.' . tpl_onus_designate::id_onus(), tpl_onus::description(), tpl_onus::onus() . '_' . tpl_onus::description()), data_base::select_multiple_table(tpl_degree::degree(), tpl_degree::degree() . '.' . tpl_degree::id(), tpl_onus_designate::onus_designate() . '.' . tpl_onus_designate::id_degree(), tpl_degree::name(), tpl_degree::degree() . '_' . tpl_degree::name())), array(tpl_onus_designate::id_student() => $id, tpl_onus_designate::status() => 1)); return $db->get_where(); }
public function update_status() { $id = $_POST[tpl_onus_designate::onus_designate() . '_' . tpl_onus_designate::id()]; $status = $_POST[tpl_onus_designate::onus_designate() . '_' . tpl_onus_designate::status()]; $db = new data_base(tpl_onus_designate::onus_designate(), array(tpl_onus_designate::status() => $status), array(tpl_onus_designate::id() => $id)); $results = $db->change(); $status_data = $status == 1 ? 'active' : 'dative'; if ($results) { echo json_encode(array('valid' => 1, 'title' => 'Successfully !!', 'massage' => 'I\'ve been Update ' . $status_data)); } else { echo json_encode(array('valid' => 0, 'title' => 'Oops !!', 'massage' => 'Was not Update ' . $status_data . ', please try again')); } }
?> + ',1)" type="checkbox"/>'; } function update_status(id, value) { $(document).ready(function () { $.post('<?php echo site_url('admin/' . tpl_onus_designate::onus_designate() . '/update_status'); ?> ', { '<?php echo tpl_onus_designate::onus_designate() . '_' . tpl_onus_designate::id(); ?> ': id, '<?php echo tpl_onus_designate::onus_designate() . '_' . tpl_onus_designate::status(); ?> ': value }, function (result) { var data = JSON.parse(result); if (data['valid']) { $('#status_massage').html(<?php echo class_massage::info('title', 'massage'); ?> ); window.setTimeout(function () { $('#status_massage').html(''); }, 2000); var $table = $('#table'); $table.bootstrapTable('showLoading'); $table.bootstrapTable('refresh');