public function update_status()
 {
     $id = $_POST[tpl_degree::degree() . '_' . tpl_degree::id()];
     $status = $_POST[tpl_degree::degree() . '_' . tpl_degree::active()];
     $db = new data_base(tpl_degree::degree(), array(tpl_degree::active() => $status), array(tpl_degree::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'));
     }
 }
 public function count_degree()
 {
     $db = new data_base(tpl_degree::degree(), array(tpl_degree::id()), array(tpl_degree::active() => 1));
     return count($db->get_where());
 }
 public function find_degree()
 {
     $db = new data_base(tpl_degree::degree(), array(tpl_degree::id(), tpl_degree::name()), array(tpl_degree::active() => 1));
     $data = $db->get();
     $w = '';
     foreach ($data as $row) {
         $w = $w . '<option value="' . $row[tpl_degree::id()] . '">' . $row[tpl_degree::name()] . '</option>';
     }
     return $w;
 }
?>
 + ',1)" type="checkbox"/>';
    }
    function update_status(id, value) {
        $(document).ready(function () {
            $.post('<?php 
echo site_url('admin/' . tpl_degree::degree() . '/update_status');
?>
',
                {
                    '<?php 
echo tpl_degree::degree() . '_' . tpl_degree::id();
?>
': id,
                    '<?php 
echo tpl_degree::degree() . '_' . tpl_degree::active();
?>
': 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');