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 update_status() { $id = $_POST[tpl_models::models() . '_' . tpl_models::id()]; $status = $_POST[tpl_models::models() . '_' . tpl_models::active()]; $db = new data_base(tpl_models::models(), array(tpl_models::active() => $status), array(tpl_models::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_models() { $db = new data_base(tpl_models::models(), array(tpl_models::id()), array(tpl_models::active() => 1)); return count($db->get_where()); }
} function update_status(id, value) { $(document).ready(function () { $.post('<?php echo site_url('admin/' . tpl_models::models() . '/update_status'); ?> ', { '<?php echo tpl_models::models() . '_' . tpl_models::id(); ?> ': id, '<?php echo tpl_models::models() . '_' . tpl_models::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');
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; }