public function find_companies()
 {
     $db = new data_base(tpl_companies::companies(), array(tpl_companies::id(), tpl_companies::active(), tpl_companies::name()), array(tpl_companies::active() => 1));
     $data = $db->get_where();
     $w = '';
     foreach ($data as $row) {
         $w = $w . '<option value="' . $row[tpl_companies::id()] . '">' . $row[tpl_companies::name()] . '</option>';
     }
     return $w;
 }
 public function update_status()
 {
     $id = $_POST[tpl_companies::companies() . '_' . tpl_companies::id()];
     $status = $_POST[tpl_companies::companies() . '_' . tpl_companies::active()];
     $db = new data_base(tpl_companies::companies(), array(tpl_companies::active() => $status), array(tpl_companies::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_companies()
 {
     $db = new data_base(tpl_companies::companies(), array(tpl_companies::id()), array(tpl_companies::active() => 1));
     return count($db->get_where());
 }
 public function get_all_companies()
 {
     if (isset($_POST['id_category'])) {
         $id = $_POST['id_category'];
         if (!empty($id)) {
             $db = new data_base(tpl_companies::companies(), array(tpl_companies::id(), tpl_companies::name()), array(tpl_companies::id_category() => $id, tpl_companies::active() => 1));
             $data = $db->get_where();
             $w = '   <option></option>';
             foreach ($data as $row) {
                 $w = $w . '<option value="' . $row[tpl_specialty::id()] . '">' . $row[tpl_specialty::name()] . '</option>';
             }
             echo $w;
         } else {
             echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'error empty'));
         }
     } else {
         echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'error isset'));
     }
 }
?>
 + ',1)" type="checkbox"/>';
    }
    function update_status(id, value) {
        $(document).ready(function () {
            $.post('<?php 
echo site_url('admin/' . tpl_companies::companies() . '/update_status');
?>
',
                {
                    '<?php 
echo tpl_companies::companies() . '_' . tpl_companies::id();
?>
': id,
                    '<?php 
echo tpl_companies::companies() . '_' . tpl_companies::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');