} } else { echo JsonResponse::accessDenied(); exit; } } else { echo JsonResponse::error("No lab type or treatment id chosen"); exit; } } elseif ($intent == 'setLabDetails') { if (isset($_REQUEST['labType']) && isset($_REQUEST['data'])) { $labType = $_REQUEST['labType']; $role = isset($labType_Role[$labType]) ? $labType_Role[$labType] : null; if ($role && RoleController::hasPermission($lab_attendant_id, $role, READ_WRITE)) { $lab = new LaboratoryController(); $response = $lab->setLabDetails($labType, $data); if ($response['status']) { echo JsonResponse::success("Successfully added"); exit; } else { echo JsonResponse::error("Could not add the lab details"); exit; } } else { echo JsonResponse::accessDenied(); exit; } } else { echo JsonResponse::error("No lab type or data to add"); exit; }