1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
class Exam_model extends CI_Model {
public function _consruct(){
parent::_construct();
}
function addExams($examData){
/*$check_exam_name = $this->db->get_where('tbl_exams',array('exam_procedure'=>$examData['exam_procedure']));
if($check_exam_name->num_rows() > 0){
return false;
}else{*/
$exam_procedure = ucfirst($examData['exam_procedure']);
$observation = ucfirst($examData['observation']);
if($this->db->query("INSERT INTO `tbl_exams`(`exam_procedure`, `observation`) VALUES (AES_ENCRYPT('".$exam_procedure."','Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA'),AES_ENCRYPT('".$observation."','Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA'))")){
return true;
}
// if($this->db->insert('tbl_exams',array('exam_procedure'=>encrypt_data(ucfirst($examData['exam_procedure'])),'observation'=>encrypt_data(ucfirst($examData['observation']))))) {
// return true;
// }
//}
}
function get_all_exams(){
$this->db->select("CAST(AES_DECRYPT(`exam_procedure`,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR) as exam_procedure,id,CAST(AES_DECRYPT(`observation`,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR) as observation");
$all_exams = $this->db->get('tbl_exams');
if($all_exams->num_rows() > 0){
$result = $all_exams->result_array();
/*echo $this->db->last_query();exit();
print_r($result);exit();*/
return $result;
}
}
function delete_exams($id){
if($this->db->delete('tbl_exams',array('id'=>$id))){
return true;
}
}
function get_single_exam($id){
$this->db->select("CAST(AES_DECRYPT(`exam_procedure`,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR) as exam_procedure,id,CAST(AES_DECRYPT(`observation`,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR) as observation ");
$single_exams = $this->db->get_where('tbl_exams',array('id' => $id));
if($single_exams->num_rows() > 0){
return $single_exams->row_array();
}
}
function update_exam($data,$id){
/*$this->db->where('exam_procedure',$data['exam_procedure']);
$this->db->where('id !=',$id);
$res = $this->db->get('tbl_exams')->row();
if($res){
return false;
}else{*/
$exam_procedure = ucfirst($data['exam_procedure']);
$observation = ucfirst($data['observation']);
if($this->db->query("update `tbl_exams` set `exam_procedure` = AES_ENCRYPT('".$exam_procedure."','Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA'),`observation` = AES_ENCRYPT('".$observation."','Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') where id = $id ")) {
return true;
}
/*if($this->db->update('tbl_exams',array('exam_procedure'=>encrypt_data(ucfirst($data['exam_procedure'])),'observation'=>encrypt_data(ucfirst($data['observation']))),array('id'=>$id))){
return true;
}*/
//}
}
}