public function find_category()
 {
     $db = new data_base(tpl_category::category(), array(tpl_category::id(), tpl_category::active(), tpl_category::name()), array(tpl_category::active() => 1));
     $data = $db->get_where();
     $w = '';
     foreach ($data as $row) {
         $w = $w . '<option value="' . $row[tpl_category::id()] . '">' . $row[tpl_category::name()] . '</option>';
     }
     return $w;
 }
 public function update_status()
 {
     $id = $_POST[tpl_category::category() . '_' . tpl_category::id()];
     $status = $_POST[tpl_category::category() . '_' . tpl_category::active()];
     $db = new data_base(tpl_category::category(), array(tpl_category::active() => $status), array(tpl_category::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 update()
 {
     $id = $_POST[tpl_category::category() . '_' . tpl_category::id() . '_update'];
     $id_student = $_POST[tpl_models::models() . '_' . tpl_models::id_student() . '_update'];
     $id_companies = $_POST[tpl_models::models() . '_' . tpl_models::id_companies() . '_update'];
     $id_department = $_POST[tpl_models::models() . '_' . tpl_models::id_department() . '_update'];
     $id_section = $_POST[tpl_models::models() . '_' . tpl_models::id_section() . '_update'];
     $id_supervisor = $_POST[tpl_models::models() . '_' . tpl_models::id_supervisor() . '_update'];
     $db = new data_base(tpl_models::models(), array(tpl_models::id_student() => $id_student, tpl_models::id_companies() => $id_companies, tpl_models::id_department() => $id_department, tpl_models::id_section() => $id_section, tpl_models::id_supervisor() => $id_supervisor, tpl_models::date_in() => date_time::Date_time_24()), array(tpl_models::id() => $id));
     $results = $db->change();
     if ($results) {
         echo json_encode(array('valid' => 1, 'title' => 'Successfully !!', 'massage' => 'I\'ve been Update ' . $id_student));
     } else {
         echo json_encode(array('valid' => 0, 'title' => 'Oops !!', 'massage' => 'Was not Update ' . $id_student . ', please try again'));
     }
 }
                </br>
            </div>
            <div class="table-responsive">
                <table id="table" data-toggle="table"
                       data-url="<?php 
echo site_url('admin/onus_designate/ajax_all');
?>
"
                       data-cache="false" data-height="400" data-show-refresh="true" data-show-toggle="true"
                       data-show-columns="true" data-pagination="true" data-page-list="[5, 10, 20, 50, 100, 200]"
                       data-search="true" data-flat="true" data-toolbar="#toolbar">
                    <thead>
                    <tr>

                        <th data-field="<?php 
echo tpl_category::id();
?>
" data-halign="center" data-sortable="true"> id</th>

                        <th data-field="<?php 
echo tpl_onus::onus() . '_' . tpl_onus::name();
?>
"
                            data-halign="center" data-sortable="true">onus name
                        </th>

                        <th data-field="<?php 
echo tpl_students::students() . '_' . tpl_students::first_name();
?>
"
                            data-halign="center" data-sortable="true">students name
 public function count_category()
 {
     $db = new data_base(tpl_category::category(), array(tpl_category::id()), array(tpl_category::active() => 1));
     return count($db->get_where());
 }
            </div>
            <div class="modal-body">
                <form class="form" id="update_form" method="post"
                      action="<?php 
echo site_url('admin/' . tpl_category::category() . '/update');
?>
">

                    <div class="form-group">
                        <input type="hidden"
                               name="<?php 
echo tpl_category::category() . '_' . tpl_category::id() . '_update';
?>
"
                               id="<?php 
echo tpl_category::category() . '_' . tpl_category::id() . '_update';
?>
"/>
                    </div>

                    <div class="form-group">
                        <label for=""><?php 
echo tpl_category::name() . ' ' . tpl_category::category();
?>
 : </label>
                        <input type="text" class="form-control"
                               id="<?php 
echo tpl_category::category() . '_' . tpl_category::name() . '_update';
?>
"
                               name="<?php 
?>
"
                                class="form-control">

                        </select>
                    </div>


                    <div class="form-group Category" style="display: none">
                        <label>Category : </label>
                        <select name="<?php 
echo tpl_category::category() . '_' . tpl_category::id();
?>
"
                                id="<?php 
echo tpl_category::category() . '_' . tpl_category::id();
?>
"
                                class="form-control">
                            <?php 
echo $class_students->get_all_category();
?>
                        </select>
                    </div>

                    <div class="form-group companies" style="display: none">
                        <label>Companies : </label>
                        <select name="<?php 
echo tpl_companies::companies() . '_' . tpl_companies::id();
?>
"