Commit 4b8edb03 by Jansa Jose

Notification Pagination Fixx

parent 787233f1
......@@ -5180,58 +5180,50 @@ print_r(date('H:i',$ms));exit();*/
$start = 0;
$page_no = 0;
}
$notificationResult = $this->Webservice_model->get_doctor_notification_list($authtoken->doctor_id, 0, 0);
$result = $this->Webservice_model->get_doctor_notification_list($authtoken->doctor_id,$start,$per_page);
$count = $this->Webservice_model->get_doctor_notification_list_unread_count($authtoken->doctor_id);
if($count){
$unread_count = $count->count;
}else{
$unread_count = 0;
}
if($notificationResult != false){
$total_count = count($notificationResult);
$total_count = $count->count;
}else{
$total_count = 0;
}
$notifArray = array();
if($result != false){
$total = count($result);
}else{
$total = 0;
}
if($total >= $per_page){
$notifArray = array();
// if($result != false){
// $total = count($result);
// }else{
// $total = 0;
// }
if($total_count >= $per_page){
$totalPages = (int)($total_count / $per_page);
}
else{
$totalPages = 1;
}
//print_r($result);exit;
if($result != ''){
foreach (array_slice($result,$start,$per_page) as $key => $value) {
$value->read_status = $value->read_status!=0 ? true : false;
array_push($notifArray, $value);
$totalPages = (int)($total / $per_page);
}
}
else{
$totalPages = 1;
}
//print_r($result);exit;
if($result != ''){
foreach (array_slice($result,$start,$per_page) as $key => $value) {
$value->read_status = $value->read_status!=0 ? true : false;
array_push($notifArray, $value);
}
}
if($result != false){
$res = array(
'status'=>'success',
'data'=>array('unread_count'=>$unread_count,'notifications'=>$notifArray),
'data'=>array('unread_count'=>$total_count,'notifications'=>$notifArray),
'meta' => array('total_pages' => $totalPages,
'total' => $total_count,
'total' => $total,
'current_page' =>$currentpage+1,
'per_page' => $per_page)
);
}else{
$res = array(
'status'=>'success',
'data'=>array('unread_count'=>$unread_count,'notifications'=>[]),
'data'=>array('unread_count'=>$total_count,'notifications'=>[]),
'meta' => array('total_pages' => $totalPages,
'total' => $total_count,
'total' => $total,
'current_page' =>$currentpage+1,
'per_page' => $per_page)
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment