87 lines
2.2 KiB
PHP
Executable File
87 lines
2.2 KiB
PHP
Executable File
<?php
|
|
|
|
if (!defined('BASEPATH'))
|
|
exit('No direct script access allowed');
|
|
|
|
class Groups_model extends CI_model {
|
|
|
|
function __construct() {
|
|
parent::__construct();
|
|
$this->load->database();
|
|
}
|
|
|
|
function insertGroup($data) {
|
|
$this->db->insert('groups', $data);
|
|
}
|
|
|
|
function getGroups() {
|
|
$query = $this->db->get('groups');
|
|
return $query->result();
|
|
}
|
|
|
|
// function getDoctorBySearch($search) {
|
|
// $this->db->order_by('id', 'desc');
|
|
// $this->db->like('id', $search);
|
|
// $this->db->or_like('name', $search);
|
|
// $this->db->or_like('phone', $search);
|
|
// $this->db->or_like('address', $search);
|
|
// $this->db->or_like('email', $search);
|
|
// $this->db->or_like('department', $search);
|
|
// $query = $this->db->get('users');
|
|
// return $query->result();
|
|
// }
|
|
|
|
// function getDoctorByLimit($limit, $start) {
|
|
// $this->db->order_by('id', 'desc');
|
|
// $this->db->limit($limit, $start);
|
|
// $query = $this->db->get('users');
|
|
// return $query->result();
|
|
// }
|
|
|
|
// function getDoctorByLimitBySearch($limit, $start, $search) {
|
|
|
|
// $this->db->like('id', $search);
|
|
|
|
// $this->db->order_by('id', 'desc');
|
|
|
|
// $this->db->or_like('name', $search);
|
|
// $this->db->or_like('phone', $search);
|
|
// $this->db->or_like('address', $search);
|
|
// $this->db->or_like('email', $search);
|
|
// $this->db->or_like('department', $search);
|
|
|
|
// $this->db->limit($limit, $start);
|
|
// $query = $this->db->get('users');
|
|
// return $query->result();
|
|
// }
|
|
|
|
function getGroupById($id) {
|
|
$this->db->where('id', $id);
|
|
$query = $this->db->get('groups');
|
|
return $query->row();
|
|
}
|
|
|
|
function getDoctorByIonUserId($id) {
|
|
$this->db->where('ion_user_id', $id);
|
|
$query = $this->db->get('users');
|
|
return $query->row();
|
|
}
|
|
|
|
function updateGroup($id, $data) {
|
|
$this->db->where('id', $id);
|
|
$this->db->update('groups', $data);
|
|
}
|
|
|
|
function delete($id) {
|
|
$this->db->where('id', $id);
|
|
$this->db->delete('groups');
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|