コード例 #1
0
 public function login_supervisor()
 {
     if (isset($_POST[tpl_supervisor::username() . '_sup']) && isset($_POST[tpl_supervisor::password() . '_sup'])) {
         $username = $_POST[tpl_supervisor::username() . '_sup'];
         $password = $_POST[tpl_supervisor::password() . '_sup'];
         if (!empty($username) && !empty($password)) {
             $db = new data_base(tpl_supervisor::supervisor(), array(tpl_supervisor::id(), tpl_supervisor::name()), array(tpl_supervisor::username() => $username, tpl_supervisor::password() => $this->hash_password($password), tpl_supervisor::active() => 1));
             $data = $db->get_where();
             if (!empty($data)) {
                 $session = new session_supervisor();
                 $session->new_login_supervisors();
                 $session->set_id_user($data[0][tpl_supervisor::id()]);
                 if ($session->get_login_supervisors()) {
                     echo json_encode(array('valid' => true, 'title' => 'Welcome !!', 'massage' => $data[0][tpl_supervisor::name()]));
                 } else {
                     echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'Was not username & password, please try again'));
                 }
             } else {
                 echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'Was not username & password, please try again'));
             }
         } else {
             echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'Was not username & password, please try again'));
         }
     } else {
         echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'Was not username & password, please try again'));
     }
 }
コード例 #2
0
 public function find_supervisor()
 {
     $db = new data_base(tpl_supervisor::supervisor(), array(tpl_supervisor::id(), tpl_supervisor::name()), array(tpl_supervisor::active() => 1));
     $data = $db->get_where();
     $w = '';
     foreach ($data as $row) {
         $w = $w . '<option value="' . $row[tpl_supervisor::id()] . '">' . $row[tpl_supervisor::name()] . '</option>';
     }
     return $w;
 }
コード例 #3
0
 public function update_status()
 {
     $id = $_POST[tpl_supervisor::supervisor() . '_' . tpl_supervisor::id()];
     $status = $_POST[tpl_supervisor::supervisor() . '_' . tpl_supervisor::active()];
     $db = new data_base(tpl_supervisor::supervisor(), array(tpl_supervisor::active() => $status), array(tpl_supervisor::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'));
     }
 }
コード例 #4
0
 public function count_supervisor()
 {
     $db = new data_base(tpl_supervisor::supervisor(), array(tpl_supervisor::id()), array(tpl_supervisor::active() => 1));
     return count($db->get_where());
 }
コード例 #5
0
 public function get_all_supervisor()
 {
     if (isset($_POST['id_university']) && isset($_POST['id_college'])) {
         $id_university = $_POST['id_university'];
         $id_college = $_POST['id_university'];
         if (!empty($id_university) && !empty($id_college)) {
             $db = new data_base(tpl_supervisor::supervisor(), array(tpl_supervisor::id(), tpl_supervisor::name()), array(tpl_supervisor::id_university() => $id_university, tpl_supervisor::id_college() => $id_college, tpl_supervisor::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'));
     }
 }
コード例 #6
0
?>
 + ',1)" type="checkbox"/>';
    }
    function update_status(id, value) {
        $(document).ready(function () {
            $.post('<?php 
echo site_url('admin/' . tpl_supervisor::supervisor() . '/update_status');
?>
',
                {
                    '<?php 
echo tpl_supervisor::supervisor() . '_' . tpl_supervisor::id();
?>
': id,
                    '<?php 
echo tpl_supervisor::supervisor() . '_' . tpl_supervisor::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');