本文整理汇总了PHP中JsonResponse::success方法的典型用法代码示例。如果您正苦于以下问题:PHP JsonResponse::success方法的具体用法?PHP JsonResponse::success怎么用?PHP JsonResponse::success使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonResponse
的用法示例。
在下文中一共展示了JsonResponse::success方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
echo JsonResponse::success($response);
exit;
}
} else {
echo JsonResponse::error("Incomplete request parameters!");
exit;
}
} elseif ($intent == 'newBed') {
if (isset($_POST[BedTable::ward_id], $_POST[BedTable::bed_description])) {
$warden = new WardController();
$response = $warden->createBed($_POST[BedTable::ward_id], $_POST[BedTable::bed_description]);
if (is_array($response) and isset($response[P_STATUS]) and $response[P_STATUS] == STATUS_ERROR) {
echo JsonResponse::error($response[P_MESSAGE]);
exit;
} else {
echo JsonResponse::success($response);
exit;
}
} else {
echo JsonResponse::error("Incomplete request parameters!");
exit;
}
} elseif ($intent == 'deleteBed') {
if (isset($_POST[BedTable::bed_id])) {
$warden = new WardController();
$response = $warden->deleteBed($_POST[BedTable::bed_id]);
if (is_array($response)) {
echo JsonResponse::error($response[P_MESSAGE]);
exit;
} else {
echo JsonResponse::message(STATUS_OK, "Bed successfully deleted!");
示例2: elseif
if ($response) {
echo JsonResponse::success("Profile Successfully Updated!");
exit;
} else {
echo JsonResponse::error("Could not update Profile. Please try again!");
exit;
}
} else {
echo JsonResponse::error("Profile data not set");
exit;
}
} elseif ($intent == 'getProfile') {
if (isset($_REQUEST['userid'])) {
$userid = $_REQUEST['userid'];
$userController = new UserController();
$profile = $userController->getUserProfile($userid);
if ($profile && is_array($profile)) {
echo JsonResponse::success($profile);
exit;
} else {
echo JsonResponse::error("Could not fetch user profile. Please try again later.");
exit;
}
} else {
echo JsonResponse::error("Expected parameter not set");
exit;
}
} else {
echo JsonResponse::error('Invalid intent!');
exit;
}
示例3: elseif
} else {
echo JsonResponse::error("No test found for this patient");
exit;
}
} else {
echo JsonResponse::error("Please select a lab type");
exit;
}
} elseif ($intent == 'labRequest') {
if (isset($_REQUEST['labType'])) {
$type = $_REQUEST['labType'];
$doctorId = intval(CxSessionHandler::getItem('userid'));
$treatmentId = intval($_REQUEST['treatmentId']);
$encounterId = isset($_REQUEST['encounterId']) ? $_REQUEST['encounterId'] : 0;
$description = isset($_REQUEST['description']) ? $_REQUEST['description'] : "";
$lab = new LaboratoryController();
$result = $lab->requestLabTest($type, $doctorId, $treatmentId, $encounterId, $description);
if ($result) {
echo JsonResponse::success("Request successful");
exit;
} else {
echo JsonResponse::error("Request unsuccessful. Try again!");
exit;
}
} else {
echo JsonResponse::error("Please select a lab type");
exit;
}
} else {
JsonResponse::error("No intent set");
}
示例4: elseif
echo JsonResponse::error('Could not add drug units');
exit;
}
} else {
echo JsonResponse::error('Adding hospital information unsuccessful');
exit;
}
} elseif ($intent == 'addBillingItems') {
$values = $_REQUEST['billItems'];
$bills = new BillingController();
$result = $bills->addBillingItems($values);
if ($result) {
echo JsonResponse::success('Successfully added billing items.');
exit;
} else {
echo JsonResponse::error('Adding of billing items unsuccessful.');
exit;
}
} elseif ($intent == 'setupComplete') {
$result = $setup->setupComplete();
if ($result) {
echo JsonResponse::success('Setup Successful');
exit;
} else {
echo JsonResponse::error('Setup unsuccessful');
exit;
}
} else {
echo JsonResponse::error("Invalid intent!");
exit;
}
示例5: isset
$name = isset($_REQUEST['name']) ? $_REQUEST['name'] : "";
$address = isset($_REQUEST['address']) ? $_REQUEST['address'] : "";
$hospitalDetailsController = new HospitalDetailsController();
if ($id) {
$hospitalInfo = $hospitalDetailsController->updateHospitalDetails($id, $name, $address);
} else {
$hospitalInfo = $hospitalDetailsController->createHospitalDetails($name, $address);
}
if ($hospitalInfo) {
CxSessionHandler::setItem(HOSPITAL_NAME, $name);
// RESETS THE HOSPITAL NAME IN SESSION
echo JsonResponse::success("Successfully updated hospital details");
exit;
} else {
echo JsonResponse::error("Could not update hospital details.");
exit;
}
} elseif ($intent == 'addDrugUnits') {
$values = $_REQUEST['values'];
$units = new PharmacistController();
$result = $units->addDrugUnits($values);
if ($result) {
echo JsonResponse::success('Successfully added drug units.');
exit;
} else {
echo JsonResponse::error('Adding of drug units unsuccessful.');
exit;
}
} else {
echo JsonResponse::error("Invalid intent!");
}
示例6: elseif
} elseif ($intent == 'getRegNos') {
$patientController = new PatientController();
$regNos = $patientController->getExistingPatientRegNos();
if (is_array($regNos)) {
echo JsonResponse::success($regNos);
exit;
} else {
echo JsonResponse::error("Not available");
exit;
}
} elseif ($intent == 'verifyRegNo') {
$regNo = $_REQUEST['regNo'];
if ($regNo) {
$patientController = new PatientController();
if (!$patientController->regNoExists($regNo)) {
echo JsonResponse::success("Registration number does not exist");
exit;
} else {
echo JsonResponse::error("Registration number already exists.");
exit;
}
} else {
echo JsonResponse::error("No registration number entered");
exit;
}
} else {
echo JsonResponse::error('Invalid intent!');
exit;
}
}
}
示例7: elseif
exit;
} else {
echo JsonResponse::accessDenied();
exit;
}
} elseif ($intent == 'addDrugUnits') {
$values = $_REQUEST['values'];
$units = new PharmacistController();
$result = $units->addDrugUnits($values);
if ($result) {
echo JsonResponse::success('Successfully added drug units!');
exit;
} else {
echo JsonResponse::error('Adding of drug units unsuccessful!');
exit;
}
} elseif ($intent == 'removeDrugUnit') {
$unitRefId = $_REQUEST['id'];
$units = new PharmacistController();
$result = $units->removeDrugUnit($unitRefId);
if ($result) {
echo JsonResponse::success('Successfully removed drug unit!');
exit;
} else {
echo JsonResponse::error('Removal of drug unit unsuccessful!');
exit;
}
} else {
echo JsonResponse::error("Invalid intent");
exit;
}
示例8: elseif
exit;
} else {
echo JsonResponse::error("Could Not Restore System. Try Again Later!");
exit;
}
} else {
echo JsonResponse::error("Please select a .sql file!");
exit;
}
} elseif ($intent == 'upload') {
$dumpFileName = isset($_FILES['fileToUpload']['name']) ? $_FILES['fileToUpload']['name'] : NULL;
$dumpFileTmpName = isset($_FILES['fileToUpload']['tmp_name']) ? $_FILES['fileToUpload']['tmp_name'] : NULL;
var_dump($dumpFileName);
if ($dumpFileName) {
$restore = new BackupAndRestoreController();
$response = $restore->uploadDumpFile($dumpFileName, $dumpFileTmpName);
if ($response) {
echo JsonResponse::success("File upload Successful!");
exit;
} else {
echo JsonResponse::error("Could Not Upload File. Try Again Later!");
exit;
}
} else {
echo JsonResponse::error("Please select a .sql file!");
exit;
}
} else {
echo JsonResponse::error("Invalid intent!");
exit;
}
示例9: elseif
exit;
} else {
echo JsonResponse::error("Could not delete bill item");
exit;
}
} else {
echo JsonResponse::error('Error! Bill item id not set');
exit;
}
} elseif ($intent == 'editBillItem') {
$id = isset($_REQUEST[BillablesTable::billables_id]) ? $_REQUEST[BillablesTable::billables_id] : null;
$bill = isset($_REQUEST[BillablesTable::bill]) ? $_REQUEST[BillablesTable::bill] : "";
$amount = isset($_REQUEST[BillablesTable::amount]) ? $_REQUEST[BillablesTable::amount] : 0;
if ($id) {
$billItems = new BillingController();
$result = $billItems->editBillItem($id, $bill, $amount);
if ($result) {
echo JsonResponse::success('Successfully edited bill item.');
exit;
} else {
echo JsonResponse::error("Could not edit bill item");
exit;
}
} else {
echo JsonResponse::error('Error! Bill item id not set');
exit;
}
} else {
echo JsonResponse::error("Invalid intent!");
exit;
}
示例10: elseif
}
} else {
echo JsonResponse::error("No lab type or data to add");
exit;
}
} elseif ($intent == 'updateLabDetails') {
if (isset($_REQUEST['labType']) && $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->updateLabDetails($labType, $data);
/*echo JsonResponse::success($data);
exit();*/
if ($response['status']) {
echo JsonResponse::success("Successfully updated");
exit;
} else {
echo JsonResponse::error($response['message']);
exit;
}
} else {
echo JsonResponse::accessDenied();
exit;
}
} else {
echo JsonResponse::error("No lab type or data to update");
exit;
}
} else {
echo JsonResponse::error("Invalid intent!");
示例11: elseif
echo JsonResponse::error($response[P_MESSAGE]);
exit;
} else {
echo $response ? JsonResponse::message(STATUS_OK, "Patient succesfully added to queue!") : JsonResponse::error("Error adding patient to queue!");
exit;
}
} else {
echo JsonResponse::error("Incomplete request parameters!");
exit;
}
} elseif ($intent == 'removeFromQueue') {
if (isset($_REQUEST[PatientQueueTable::patient_id])) {
$usher = new ArrivalController();
$response = $usher->removePatient($_REQUEST[PatientQueueTable::patient_id]);
if ($response) {
echo JsonResponse::success("Patient succesfully removed from queue!");
exit;
} else {
echo JsonResponse::error("Error removing patient from queue!");
exit;
}
} else {
echo JsonResponse::error("Incomplete request parameters!");
exit;
}
} elseif ($intent == 'switchQueue') {
if (isset($_REQUEST['patient_id'], $_REQUEST['to_doctor'], $_REQUEST['from_doctor'])) {
// die(var_dump($_REQUEST));
$usher = new ArrivalController();
$patient = $_REQUEST['patient_id'];
$to_doctor = empty($_REQUEST['to_doctor']) ? GENERAL_QUEUE : $_REQUEST['to_doctor'];
示例12: StaffRosterController
$controller = new StaffRosterController();
$request = $controller->updateTask($rosterId, $dutyDate, $modifiedBy);
if ($request) {
echo JsonResponse::success("Successfully updated");
exit;
} else {
echo JsonResponse::error('Could not update task, try again!');
exit;
}
} elseif ($intent == 'deleteTask') {
$modifiedBy = CxSessionHandler::getItem(UserAuthTable::userid);
$rosterId = $_REQUEST['roster_id'];
$controller = new StaffRosterController();
$request = $controller->deleteTask($rosterId, $modifiedBy);
if ($request) {
echo JsonResponse::success("Successfully deleted");
exit;
} else {
echo JsonResponse::error('Could not update task, try again!');
exit;
}
} elseif ($intent == 'getAllRoster') {
$staffs = new StaffRosterController();
$staffRoster = $staffs->getAllRoster();
// Accumulate an output array of event data arrays.
$output_arrays = array();
foreach ($staffRoster as $array) {
$params['title'] = ucwords($array['firstname'] . " " . $array['middlename'] . " " . $array['lastname']);
$params['start'] = $array['duty_date'];
$params['roster_id'] = $array['roster_id'];
if ($array['duty'] == 9) {
示例13: elseif
} else {
echo JsonResponse::error("Unable to request admission!");
exit;
}
} else {
echo JsonResponse::error("Incomplete request parameters!");
exit;
}
} elseif ($intent == 'getAdmissionRequests') {
$response = AdmissionController::admissionRequests();
if (is_array($response)) {
if (isset($response[P_MESSAGE])) {
echo JsonResponse::message($response[P_STATUS], $response[P_MESSAGE]);
exit;
} else {
echo JsonResponse::success($response[P_DATA]);
exit;
}
} else {
echo JsonResponse::error("Unable to get pending admission requests!");
exit;
}
} elseif ($intent == 'searchAdmissionRequests') {
if (isset($_REQUEST[TERM])) {
$warden = new AdmissionController();
$patient_details = $warden->searchAdmissionRequests($_REQUEST[TERM]);
if (is_array($patient_details)) {
echo json_encode($patient_details);
exit;
} else {
echo JsonResponse::error("No patients match the search parameter!");