Пример #1
0
 public function find_users_login()
 {
     if (isset($_POST['username']) && isset($_POST['password'])) {
         if (!empty($_POST['username']) && !empty($_POST['password'])) {
             $this->use->use_model('data_base');
             $this->use->use_lib('table/tpl_users');
             $tpl = new tpl_users();
             $db = new data_base($tpl->table(), array($tpl->id()), array($tpl->username() => $_POST['username'], $tpl->password() => md5($_POST['password'])));
             $data = $db->get_where();
             if (!empty($data)) {
                 $this->use->use_lib('site/sessions');
                 $session = new sessions();
                 if ($session->new_login_admin()) {
                     $session->info_user($data);
                     return json_encode(array('valid' => true, 'massage' => '<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true"></button><h4>Alert!</h4> <strong>welcome Back </strong></div>'));
                 } else {
                     return json_encode(array('valid' => false, 'massage' => '<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true"></button><h4>Alert!</h4> <strong>Error login</strong></div>'));
                 }
             } else {
                 return json_encode(array('valid' => false, 'massage' => '<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true"></button><h4>Alert!</h4> <strong>Incorrect password or username </strong></div>'));
             }
         } else {
             return json_encode(array('valid' => false, 'massage' => '<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true"></button><h4>Alert!</h4> <strong>The field is required and can\'t be empty</strong></div>'));
         }
     } else {
         return json_encode(array('valid' => false, 'massage' => '<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true"></button><h4>Alert!</h4> <strong>The field is required and can\'t be empty</strong></div>'));
     }
 }
Пример #2
0
 public function find_slider()
 {
     $this->use->use_model('data_base');
     $this->use->use_lib('table/tpl_slider');
     $tpl = new tpl_slider();
     $db = new data_base($tpl->table(), array($tpl->id(), $tpl->text(), $tpl->image()), array($tpl->status() => 1));
     return $db->get_where();
 }
 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 find($id)
 {
     $db = new data_base(tpl_college::college(), array("*"), array(tpl_college::id() => $id));
     $results = $db->get_where();
     if (!empty($results)) {
         return $results;
     } else {
         return false;
     }
 }
Пример #5
0
 public function find_all_specialty_select()
 {
     $this->use->use_model('data_base');
     $this->use->use_lib('table/tpl_specialty');
     $tpl_specialty = new tpl_specialty();
     $db = new data_base($tpl_specialty->table(), array($tpl_specialty->id(), $tpl_specialty->name()), array($tpl_specialty->id_college() => $_POST['id_college']));
     $data = $db->get_where();
     $w = '<option value="">Select Specialty</option>';
     foreach ($data as $row) {
         $w = $w . '<option value="' . $row[$tpl_specialty->id()] . '">' . $row[$tpl_specialty->name()] . '</option>';
     }
     return $w;
 }
 public function find_users_login()
 {
     $db = new data_base(tpl_user_site::user_site(), array(tpl_user_site::id()), array(tpl_user_site::username() => $this->data[tpl_user_site::user_site() . '_' . tpl_user_site::username()], tpl_user_site::password() => $this->hash_password($this->data[tpl_user_site::user_site() . '_' . tpl_user_site::password()]), tpl_user_site::status() => 1));
     $results = $db->get_where();
     $results = array_shift($results);
     if (!empty($results[tpl_user_site::id()])) {
         $this->session->new_login_admin();
         $this->session->set_id_user($results[tpl_user_site::id()]);
         return json_encode(array('valid' => true));
     } else {
         return json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'The password you\'ve entered is incorrect'));
     }
 }
Пример #7
0
 public function check_elect()
 {
     $this->use->use_model('data_base');
     $this->use->use_lib('site/sessions');
     $this->use->use_lib('table/tpl_election');
     $tpl = new tpl_election();
     $session = new sessions();
     $id_login = array_shift(array_shift($session->get_info_user()));
     $db = new data_base($tpl->table(), array($tpl->id()), array($tpl->id_students() => $id_login));
     $data = $db->get_where();
     if (empty($data)) {
         return true;
     } else {
         return false;
     }
 }
 public function count_university()
 {
     $db = new data_base(tpl_university::university(), array(tpl_university::id()), array(tpl_university::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());
 }
 public function find_supervisor()
 {
     if (isset($_POST[tpl_students::id() . '_' . tpl_students::students()])) {
         $id = $_POST[tpl_students::id() . '_' . tpl_students::students()];
         if (!empty($id)) {
             $db = new data_base(tpl_students::students(), array(tpl_students::id(), tpl_students::id_supervisor(), data_base::select_multiple_table(tpl_supervisor::supervisor(), tpl_supervisor::supervisor() . '.' . tpl_supervisor::id(), tpl_students::students() . '.' . tpl_students::id_supervisor(), tpl_supervisor::name(), tpl_supervisor::supervisor() . '_' . tpl_supervisor::name())), array(tpl_students::status() => 1, tpl_students::id() => $id));
             $data = $db->get_where();
             $w = '<option></option>';
             foreach ($data as $row) {
                 $w = $w . '<option value="' . $row[tpl_students::id_supervisor()] . '">' . $row[tpl_supervisor::supervisor() . '_' . tpl_supervisor::name()] . '</option>';
             }
             echo $w;
         } else {
             echo 'error empty';
             die;
         }
     } else {
         echo 'error isset';
         exit;
     }
 }
 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'));
     }
 }
 public function select()
 {
     $db = new data_base(tpl_university::university(), array(tpl_university::id(), tpl_university::name()), array(tpl_university::active() => 1));
     $data = $db->get_where();
     $w = '<option value="">Select ' . tpl_university::university() . '</option>';
     foreach ($data as $row) {
         $w = $w . '<option value="' . $row[tpl_university::id()] . '">' . $row[tpl_university::name()] . '</option>';
     }
     return $w;
 }
 public function ajax_find_students()
 {
     $db = new data_base(tpl_students::students(), array(tpl_students::id(), tpl_students::first_name(), tpl_students::last_name(), tpl_students::id_college(), tpl_students::id_specialty(), data_base::select_multiple_table(tpl_specialty::specialty(), tpl_specialty::specialty() . '.' . tpl_specialty::id(), tpl_students::students() . '.' . tpl_students::id_specialty(), tpl_specialty::name(), tpl_specialty::specialty() . '_' . tpl_specialty::name()), data_base::select_multiple_table(tpl_college::college(), tpl_college::college() . '.' . tpl_college::id(), tpl_students::students() . '.' . tpl_students::id_college(), tpl_college::name(), tpl_college::college() . '_' . tpl_college::name())), array(tpl_students::id_college() => $_GET['id']));
     echo json_encode($db->get_where());
 }
 public function info_onus_designate($id = null)
 {
     $db = new data_base(tpl_onus_designate::onus_designate(), array(tpl_onus_designate::id(), tpl_onus_designate::id_degree(), tpl_onus_designate::id_models(), tpl_onus_designate::id_student(), tpl_onus_designate::id_onus(), data_base::select_multiple_table(tpl_onus::onus(), tpl_onus::onus() . '.' . tpl_onus::id(), tpl_onus_designate::onus_designate() . '.' . tpl_onus_designate::id_onus(), tpl_onus::name(), tpl_onus::onus() . '_' . tpl_onus::name()), data_base::select_multiple_table(tpl_onus::onus(), tpl_onus::onus() . '.' . tpl_onus::id(), tpl_onus_designate::onus_designate() . '.' . tpl_onus_designate::id_onus(), tpl_onus::description(), tpl_onus::onus() . '_' . tpl_onus::description()), data_base::select_multiple_table(tpl_degree::degree(), tpl_degree::degree() . '.' . tpl_degree::id(), tpl_onus_designate::onus_designate() . '.' . tpl_onus_designate::id_degree(), tpl_degree::name(), tpl_degree::degree() . '_' . tpl_degree::name())), array(tpl_onus_designate::id_student() => $id));
     return $db->get_where();
 }