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());
 }
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 
echo tpl_category::category() . '_' . tpl_category::name() . '_update';
?>
"/>
                    </div>

                    <button type="submit" class="btn btn-success" id="update" name="update">Save</button>
                </form>
                </br>
                </br>
                <div class="" id="result_massages_update"></div>
            </div>
        </div>
    </div>
</div>
?>
"
                                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();
?>
"
"
                           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">
                        <thead>
                        <tr>
                            <th data-field="<?php 
echo tpl_companies::id();
?>
" data-halign="center" data-sortable="true"> ID</th>
                            <th data-field="<?php 
echo tpl_companies::name();
?>
" data-halign="center" data-sortable="true"> Name
                            <th data-field="<?php 
echo tpl_category::category() . '_' . tpl_university::name();
?>
"
                                data-halign="center" data-sortable="true"> Category
                            </th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>

       <div class="row">
           <div class="col-sm-4">
               <h3 class="page-header">Degree</h3>
               <div class="table-responsive">
    });
    //
</script>




<div class="modal fade" id="update" style="background-color: rgba(60, 60, 60, 0.81);" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width: 50%">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4>Update <?php 
echo tpl_category::category();
?>
                    <small id="TitlePostSmall"></small>
                </h4>
            </div>
            <div class="modal-body">
                <form class="form" id="update_form" method="post"
                      action="<?php 
echo site_url('admin/' . tpl_models::models() . '/update');
?>
">

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