public function info_companies()
 {
     $session = new session_students();
     $id = $session->Get_id_user();
     $db = new data_base(tpl_models::models(), array(tpl_models::id(), tpl_models::id_student(), tpl_models::active(), tpl_models::id_companies(), tpl_models::id_department(), tpl_models::id_section(), data_base::select_multiple_table(tpl_companies::companies(), tpl_companies::companies() . '.' . tpl_companies::id(), tpl_models::models() . '.' . tpl_models::id_companies(), tpl_companies::name(), tpl_companies::companies() . '_' . tpl_companies::name()), data_base::select_multiple_table(tpl_department::department(), tpl_department::department() . '.' . tpl_department::id(), tpl_models::models() . '.' . tpl_models::id_department(), tpl_department::name(), tpl_department::department() . '_' . tpl_department::name()), data_base::select_multiple_table(tpl_section::section(), tpl_section::section() . '.' . tpl_section::id(), tpl_models::models() . '.' . tpl_models::id_section(), tpl_section::name(), tpl_section::section() . '_' . tpl_section::name())), array(tpl_models::id_student() => $id));
     return $db->get_where();
 }
 public function find($id)
 {
     $db = new data_base(tpl_models::models(), array("*"), array(tpl_models::id() => $id));
     $results = $db->get_where();
     if (!empty($results)) {
         return $results;
     } else {
         return false;
     }
 }
 public function count_models()
 {
     $db = new data_base(tpl_models::models(), array(tpl_models::id()), array(tpl_models::active() => 1));
     return count($db->get_where());
 }
 public function ajax_find_students()
 {
     $db = new data_base(tpl_models::models(), array(tpl_models::id(), tpl_models::id_companies(), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_models::models() . '.' . tpl_models::id_student(), tpl_students::first_name(), tpl_students::students() . '_' . tpl_students::first_name()), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_models::models() . '.' . tpl_models::id_student(), tpl_students::last_name(), tpl_students::students() . '_' . tpl_students::last_name()), data_base::select_multiple_table(tpl_supervisor::supervisor(), tpl_supervisor::supervisor() . '.' . tpl_supervisor::id(), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_models::models() . '.' . tpl_models::id_student(), tpl_students::id_supervisor()), tpl_supervisor::name(), tpl_supervisor::supervisor() . '_' . tpl_supervisor::name()), data_base::select_multiple_table(tpl_university::university(), tpl_university::university() . '.' . tpl_university::id(), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_models::models() . '.' . tpl_models::id_student(), tpl_students::id_supervisor()), tpl_university::name(), tpl_university::university() . '_' . tpl_university::name()), data_base::select_multiple_table(tpl_college::college(), tpl_college::college() . '.' . tpl_college::id(), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_models::models() . '.' . tpl_models::id_student(), tpl_students::id_supervisor()), tpl_college::name(), tpl_college::college() . '_' . tpl_college::name()), data_base::select_multiple_table(tpl_specialty::specialty(), tpl_specialty::specialty() . '.' . tpl_specialty::id(), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_models::models() . '.' . tpl_models::id_student(), tpl_students::id_supervisor()), tpl_specialty::name(), tpl_specialty::specialty() . '_' . tpl_specialty::name()), data_base::select_multiple_table(tpl_department::department(), tpl_department::department() . '.' . tpl_department::id(), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_models::models() . '.' . tpl_models::id_student(), tpl_students::id_supervisor()), tpl_department::name(), tpl_department::department() . '_' . tpl_department::name()), data_base::select_multiple_table(tpl_section::section(), tpl_section::section() . '.' . tpl_section::id(), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_models::models() . '.' . tpl_models::id_student(), tpl_students::id_supervisor()), tpl_section::name(), tpl_section::section() . '_' . tpl_section::name())), array(tpl_models::id_companies() => $_GET['id']));
     echo json_encode($db->get_where());
 }
                        <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-formatter="operate<?php 
echo tpl_companies::companies();
?>
"
                            data-halign="center" data-sortable="true"> name
                        </th>
                        <th data-field="<?php 
echo tpl_models::models() . '_' . tpl_models::id();
?>
"
                            data-halign="center"
                            data-sortable="true"># students
                        </th>
                    </tr>
                    </thead>
                </table>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function operate<?php 
echo tpl_companies::companies();
//$new = new models_lib_ad(); echo $new->find_section()
?>
                        </select>
                    </div>

                    <div class="form-group">
                        <label>Supervisor <?php 
echo tpl_models::models();
?>
 : </label>
                        <select name="<?php 
echo tpl_models::models() . '_' . tpl_models::id_supervisor() . '_update';
?>
"
                                id="<?php 
echo tpl_models::models() . '_' . tpl_models::id_supervisor() . '_update';
?>
"
                                class="form-control">
                            <?php 
//$new = new models_lib_ad(); echo $new->find_supervisor()
?>
                        </select>
                    </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>
 public function find_models()
 {
     $db = new data_base(tpl_models::models(), array(tpl_models::id(), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_models::models() . '.' . tpl_models::id_student(), tpl_students::first_name(), tpl_students::students() . '_' . tpl_students::first_name())), array(tpl_models::active() => 1));
     $data = $db->get();
     $w = '';
     foreach ($data as $row) {
         $w = $w . '<option value="' . $row[tpl_models::id()] . '">' . $row[tpl_students::students() . '_' . tpl_students::first_name()] . '</option>';
     }
     return $w;
 }