In this project doctors will be informed through message if any appointments are taken by patient.
Controller
function message_view()
{
if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'] === true && $_SESSION['role'] === '2' && $_SESSION['role_des'] === 'doctor')
{
$this->session->all_userdata();
$id = $this->session->userdata('user_id');
$data['count']=$this->appoint_model->get_msg_count($id);
$data['msg']=$this->appoint_model->get_doctor_appoin($id);
//var_dump($data['msg']);die();
$this->load->view('doctor/header', $data);
$this->load->view('doctor/modal_message',$data);
}
}
Model
public function get_msg_count($id)
{
$this->db->select('*');
$this->db->from('tbl_appointment');
$this->db->where('status','1');
$this->db->where('dr_id',$id);
$q = $this->db->get();
return $q->num_rows();
}
<div class="modal fade" id="myModal" style="z-index:10000;" role="dialog">
<div class="modal-dialog modal-xs">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Message</h4>
</div>
<div class="modal-body" >
<div class="row">
<div class="col-md-8 col-md-offset-2">
<?php
foreach ($msg->result() as $row) {?>
<center><h4>You have an appointment on <?php echo $row->appoint_date;?> at <?php echo $row->time;?>. Patient Name: <?php echo $row->ap_name;?></h4>
</center>
<?php }
?>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
In this screenshot a red color round in the menu Message, this red round must be disappear after the doctor reading the message.