本文整理汇总了PHP中Library\Utility\Helper::setFlashMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::setFlashMessage方法的具体用法?PHP Helper::setFlashMessage怎么用?PHP Helper::setFlashMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Library\Utility\Helper
的用法示例。
在下文中一共展示了Helper::setFlashMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajaxUpdateSpotAvailabilitiesAction
public function ajaxUpdateSpotAvailabilitiesAction()
{
/**
* @var \DDD\Service\Parking\Spot\Inventory $spotInventoryService
* @var \DDD\Dao\Parking\Spot\Inventory $inventoryDao
*/
$inventoryDao = $this->getServiceLocator()->get('dao_parking_spot_inventory');
$request = $this->getRequest();
$output = ['bo' => ['status' => 'success', 'msg' => TextConstants::SUCCESS_UPDATE]];
try {
$date = $request->getPost('date', null);
$availability = $request->getPost('availability', null);
if ($date) {
$date = current(explode(' ', $date));
}
if ($request->isPost() && $request->isXmlHttpRequest()) {
if (strtotime($date) !== false && is_array($availability)) {
foreach ($availability as $spotId => $spotAvailability) {
$inventoryDao->save(['availability' => (int) $spotAvailability], ['spot_id' => $spotId, 'date' => $date]);
$message = ['success' => TextConstants::SUCCESS_UPDATE];
Helper::setFlashMessage($message);
}
} else {
$output['bo']['msg'] = 'Bad parameters.';
}
} else {
$output['bo']['msg'] = 'Bad request.';
}
} catch (\Exception $ex) {
$output['bo']['msg'] = $ex->getMessage();
}
return new JsonModel($output);
}
示例2: ajaxSaveAction
public function ajaxSaveAction()
{
$result = ['status' => 'error', 'msg' => TextConstants::SERVER_ERROR];
try {
if (!$this->getRequest()->isXmlHttpRequest()) {
throw new \Exception(TextConstants::AJAX_ONLY_POST_ERROR);
}
$postData = $this->params()->fromPost();
$venueId = isset($postData['venue_id']) ? $postData['venue_id'] : 0;
/**
* @var \DDD\Dao\Venue\Venue $venueDao
*/
$venueDao = $this->getServiceLocator()->get('dao_venue_venue');
$venueData = $venueDao->getVenueById($venueId);
if ($venueData === false) {
throw new \Exception('It is impossible to create a charge for a non-existent venue');
}
/**
* @var \DDD\Service\Venue\Items $itemsService
*/
$itemsService = $this->getServiceLocator()->get('service_venue_items');
$saveResult = $itemsService->saveItems($venueId, $postData);
if ($saveResult) {
Helper::setFlashMessage(['success' => TextConstants::SUCCESS_UPDATE]);
$result = ['status' => 'success', 'msg' => TextConstants::SUCCESS_UPDATE, 'url' => $this->url()->fromRoute('venue', ['action' => 'edit', 'id' => $venueId]) . '#items'];
}
} catch (\Exception $e) {
$this->gr2logException($e);
$result = ['status' => 'error', 'msg' => TextConstants::SERVER_ERROR . PHP_EOL . $e->getMessage()];
}
return new JsonModel($result);
}
示例3: downloadDatabaseBackupAction
public function downloadDatabaseBackupAction()
{
try {
$fileString = $this->params()->fromQuery('file');
if (strstr($fileString, '..')) {
return new JsonModel(['status' => 'error', 'msg' => TextConstants::ERROR]);
}
$filePath = DirectoryStructure::FS_GINOSI_ROOT . DirectoryStructure::FS_DATABASE_BACKUP . $fileString;
if (file_exists($filePath)) {
ini_set('memory_limit', '512M');
/**
* @var \FileManager\Service\GenericDownloader $genericDownloader
*/
$genericDownloader = $this->getServiceLocator()->get('fm_generic_downloader');
$genericDownloader->setFileSystemMode(GenericDownloader::FS_MODE_DB_BACKUP);
$genericDownloader->downloadAttachment($fileString);
if ($genericDownloader->hasError()) {
Helper::setFlashMessage(['error' => $genericDownloader->getErrorMessages(true)]);
if ($this->getRequest()->getHeader('Referer')) {
$url = $this->getRequest()->getHeader('Referer')->getUri();
$this->redirect()->toUrl($url);
}
}
return true;
}
} catch (\Exception $e) {
return new JsonModel(['status' => 'error', 'msg' => $e->getMessage()]);
}
}
示例4: ajaxSaveMovesAction
public function ajaxSaveMovesAction()
{
$return = ['status' => 'error', 'msg' => 'Moving apartments is not possible.'];
try {
$request = $this->getRequest();
/**
* @var \DDD\Service\Booking $bookingService
*/
$bookingService = $this->getServiceLocator()->get('service_booking');
if ($request->isXmlHttpRequest()) {
$moves = $request->getPost('moves');
$movesMapping = [];
foreach ($moves as $move) {
$movesMapping[$move['resNumber']] = $move['moveTo'];
}
$return = $bookingService->simultaneouslyMoveReservations($movesMapping);
if ($return['status'] == 'success') {
Helper::setFlashMessage(['success' => $return['msg']]);
}
}
} catch (\Exception $e) {
$return['msg'] = $e->getMessage();
}
return new JsonModel($return);
}
示例5: deactivateAction
/**
* @return JsonModel
*/
public function deactivateAction()
{
$apartmentGroupId = $this->params()->fromRoute('id', 0);
if ($apartmentGroupId) {
/**
* @var \DDD\Service\ApartmentGroup\Main $apartmentGroupMainService
*/
$apartmentGroupMainService = $this->getServiceLocator()->get('service_apartment_group_main');
$accGroupsManagementDao = $this->getServiceLocator()->get('dao_apartment_group_apartment_group');
/* @var $apartmentGroupCurrentState \DDD\Domain\ApartmentGroup\ApartmentGroup */
$apartmentGroupCurrentState = $accGroupsManagementDao->getRowById($apartmentGroupId);
/* @var $apartmentGroupService \DDD\Service\ApartmentGroup */
$apartmentGroupService = $this->getServiceLocator()->get('service_apartment_group');
$currentAccommodations = $apartmentGroupService->getApartmentGroupItems($apartmentGroupId);
if ($apartmentGroupCurrentState->isBuilding() && $currentAccommodations) {
Helper::setFlashMessage(['error' => TextConstants::SERVER_ERROR]);
return new JsonModel(['status' => 'error', 'msg' => 'Please move all apartments of this building group to another building before deactivation group']);
}
// Deactivation
$result = $apartmentGroupMainService->deactivate($apartmentGroupId);
if ($result) {
Helper::setFlashMessage(['success' => TextConstants::SUCCESS_DEACTIVATE]);
return new JsonModel(['status' => 'success', 'msg' => 'Successful']);
} else {
Helper::setFlashMessage(['error' => TextConstants::SERVER_ERROR]);
return new JsonModel(['status' => 'error', 'msg' => 'Something went wrong while trying to deactivate apartment group.']);
}
} else {
Helper::setFlashMessage(['error' => 'Wrong Apartment Group ID']);
return new JsonModel(['status' => 'error', 'msg' => 'Wrong Apartment Group ID']);
}
}
示例6: saveAction
public function saveAction()
{
$request = $this->getRequest();
$result = array("status" => "error", "msg" => "Something went wrong. Cannot save video links.");
if ($request->isXmlHttpRequest() or $request->isPost()) {
$postData = $request->getPost();
if (count($postData)) {
$form = new MediaForm('apartment_media');
$form->setData($postData);
$form->prepare();
if ($form->isValid()) {
$data = $form->getData();
unset($data['save_button']);
/**
* @var \DDD\Service\Apartment\Media $apartmentMediaService
*/
$apartmentMediaService = $this->getServiceLocator()->get('service_apartment_media');
$apartmentMediaService->saveVideos($this->apartmentId, $data);
$result = ["status" => "success", "msg" => "Video links successfully updated"];
} else {
$result = ["status" => "error", "msg" => $form->getMessages()];
}
}
}
Helper::setFlashMessage([$result['status'] => $result['msg']]);
return new JsonModel($result);
}
示例7: itemAction
public function itemAction()
{
/**
* @var $auth \Library\Authentication\BackofficeAuthenticationService
*/
$id = (int) $this->params()->fromRoute('id', 0);
$service = $this->getConcierge();
if (!$id || !($rowObj = $service->getConciergeByGroupId($id))) {
Helper::setFlashMessage(['error' => TextConstants::ERROR_NO_ITEM]);
return $this->redirect()->toRoute('backoffice/default', ['controller' => 'concierge', 'action' => 'view']);
}
$auth = $this->getServiceLocator()->get('library_backoffice_auth');
$authId = (int) $auth->getIdentity()->id;
$external = (int) $auth->getIdentity()->external;
$usermanagerDao = $this->getServiceLocator()->get('dao_user_user_manager');
$userInfo = $usermanagerDao->fetchOne(['id' => $authId]);
$currentDate = time();
if (!is_null($userInfo->getTimezone())) {
$currentDate = Helper::getCurrenctDateByTimezone($userInfo->getTimezone());
}
if ($auth->hasRole(Roles::ROLE_GLOBAL_APARTMENT_GROUP_MANAGER)) {
$userId = false;
} elseif ($auth->hasRole(Roles::ROLE_CONCIERGE_DASHBOARD) || $auth->hasRole(Roles::ROLE_APARTMENT_GROUP_MANAGEMENT)) {
$userId = $authId;
} else {
return ['errorPage' => 'error'];
}
$isBookingManager = false;
if ($auth->hasRole(Roles::ROLE_BOOKING_MANAGEMENT)) {
$isBookingManager = true;
}
$hasFronterCharg = false;
if ($auth->hasRole(Roles::ROLE_FRONTIER_CHARGE)) {
$hasFronterCharg = true;
}
$hasFrontierCard = false;
if ($auth->hasRole(Roles::ROLE_FRONTIER_MANAGEMENT)) {
$hasFrontierCard = true;
}
$hasCurrentStayView = false;
if ($auth->hasRole(Roles::ROLE_CONCIERGE_CURRENT_STAYS)) {
$hasCurrentStayView = true;
}
$checkID = $service->checkGroupForUser($id, $userId);
if (!$checkID) {
return ['errorPage' => 'error'];
}
$timezone = 'UTC';
$group_name = '';
$accommodationList = $service->getApartmentGroupItems($id);
if (is_object($rowObj)) {
$timezone = $rowObj->getTimezone();
$group_name = $rowObj->getName();
}
$conciergeView = $service->getConciergeView($accommodationList, $timezone);
// get bad email list
$getBadEmail = BookingTicket::getBadEmail();
return ['currentStays' => $conciergeView['currentStays'], 'arrivalsYesterday' => $conciergeView['arrivalsYesterday'], 'arrivalsToday' => $conciergeView['arrivalsToday'], 'arrivalsTomorrow' => $conciergeView['arrivalsTomorrow'], 'checkoutsToday' => $conciergeView['checkoutsToday'], 'checkoutsTomorrow' => $conciergeView['checkoutsTomorrow'], 'checkoutsYesterday' => $conciergeView['checkoutsYesterday'], 'dateInTimezone' => $conciergeView['dateInTimezone'], 'groupId' => $id, 'groupName' => $group_name, 'isBookingManager' => $isBookingManager, 'hasFronterCharg' => $hasFronterCharg, 'hasCurrentStayView' => $hasCurrentStayView, 'currentDate' => $currentDate, 'hasFrontierCard' => $hasFrontierCard, 'getBadEmail' => json_encode($getBadEmail), 'userIsExternal' => $external];
}
示例8: ajaxGeneratePageAction
public function ajaxGeneratePageAction()
{
/**
* @var BackofficeAuthenticationService $authenticationService
* @var BookingDao $reservationDao
*/
$authenticationService = $this->getServiceLocator()->get('library_backoffice_auth');
$reservationDao = $this->getServiceLocator()->get('dao_booking_booking');
$result = ['status' => 'error', 'msg' => TextConstants::ERROR];
if (!$authenticationService->hasRole(Roles::ROLE_CREDIT_CARD)) {
$result['msg'] = 'You have no permission for this operation';
return new JsonModel($result);
}
$result = ['success' => TextConstants::SUCCESS_UPDATE];
try {
/**
* @var ChargeAuthorizationService $chargeAuthorizationService
* @var Logger $logger
*/
$chargeAuthorizationService = $this->getServiceLocator()->get('service_reservation_charge_authorization');
$logger = $this->getServiceLocator()->get('ActionLogger');
$request = $this->getRequest();
if ($request->isXmlHttpRequest()) {
$reservationId = (int) $request->getPost('reservation_id');
$ccId = (int) $request->getPost('cc_id');
$customEmail = $request->getPost('custom_email');
$amount = $request->getPost('amount');
$emailSection = '';
if (!empty($customEmail)) {
$emailSection = ' --email=' . $customEmail;
}
$cccaResponse = $chargeAuthorizationService->generateChargeAuthorizationPageLink($reservationId, $ccId, $amount);
$cmd = 'ginosole reservation-email send-ccca --id=' . escapeshellarg($reservationId) . ' --ccca_id=' . $cccaResponse['cccaId'] . $emailSection;
$output = shell_exec($cmd);
if (strstr(strtolower($output), 'error')) {
$result['status'] = 'error';
$result['msg'] = TextConstants::ERROR_SEND_MAIL;
return new JsonModel($result);
}
// log
$logger->save(Logger::MODULE_BOOKING, $reservationId, Logger::ACTION_RESERVATION_CCCA_FORM_GENERATED_AND_SENT, ChargeAuthorization::CHARGE_AUTHORIZATION_PAGE_STATUS_GENERATED);
// create auto task
/**
* @var TaskService $taskService
*/
$taskService = $this->getServiceLocator()->get('service_task');
$taskService->createAutoTaskReceiveCccaForm($reservationId);
$reservationDao->save(['ccca_verified' => BookingService::CCCA_NOT_VERIFIED], ['id' => $reservationId]);
$result['success'] .= "<br>" . TextConstants::SUCCESS_SEND_MAIL;
Helper::setFlashMessage($result);
}
} catch (\Exception $e) {
$result['status'] = 'error';
$result['msg'] = TextConstants::ERROR;
Helper::setFlashMessage($result);
}
return new JsonModel($result);
}
示例9: indexAction
public function indexAction()
{
/**
* @var \Library\Authentication\BackofficeAuthenticationService $auth
* @var \DDD\Service\ApartmentGroup\Facilities $facilitiesService
* @var \DDD\Service\ApartmentGroup\FacilityItems $facilitiyItemsService
* @var ApartmentGroup $conciergeService
* */
$auth = $this->getServiceLocator()->get('library_backoffice_auth');
$id = (int) $this->params()->fromRoute('id', 0);
if ($id && !$this->getServiceLocator()->get('dao_apartment_group_apartment_group')->checkRowExist(DbTables::TBL_APARTMENT_GROUPS, 'id', $id)) {
Helper::setFlashMessage(['error' => TextConstants::ERROR_NO_ITEM]);
return $this->redirect()->toRoute('backoffice/default', ['controller' => 'apartment-group']);
}
$form = $this->getForm($id);
$global = false;
/**
* @var \DDD\Service\ApartmentGroup $apartmentGroupService
*/
$apartmentGroupService = $this->getServiceLocator()->get('service_apartment_group');
if ($auth->hasRole(Roles::ROLE_GLOBAL_APARTMENT_GROUP_MANAGER)) {
$global = true;
} else {
$manageableList = $apartmentGroupService->getManageableList();
if (!in_array($id, $manageableList)) {
$this->redirect()->toRoute('home');
}
}
$apartmentGroupName = '';
$logsAaData = [];
if ($id > 0) {
$apartmentGroupName = $apartmentGroupService->getApartmentGroupNameById($id);
$apartmentGroupLogs = $apartmentGroupService->getApartmentGroupLogs($id);
if (count($apartmentGroupLogs) > 0) {
foreach ($apartmentGroupLogs as $log) {
$rowClass = '';
if ($log['user_name'] == TextConstants::SYSTEM_USER) {
$rowClass = "warning";
}
$apartmentGroupLogsArray[] = [date(Constants::GLOBAL_DATE_TIME_FORMAT, strtotime($log['timestamp'])), $log['user_name'], $this->identifyApartmentGroupAction($log['action_id']), $log['value'], "DT_RowClass" => $rowClass];
}
} else {
$apartmentGroupLogsArray = [];
}
$logsAaData = $apartmentGroupLogsArray;
}
$logsAaData = json_encode($logsAaData);
$viewModel = new ViewModel();
$viewModel->setVariables(['apartmentGroupName' => $apartmentGroupName, 'id' => $id, 'global' => $global, 'historyAaData' => $logsAaData]);
$resolver = new TemplateMapResolver(['backoffice/apartment-group/usages/history' => '/ginosi/backoffice/module/Backoffice/view/backoffice/apartment-group/usages/history.phtml']);
$renderer = new PhpRenderer();
$renderer->setResolver($resolver);
$viewModel->setTemplate('backoffice/apartment-group/usages/history');
return $viewModel;
}
示例10: statusAction
public function statusAction()
{
$reviewID = (int) $this->params()->fromRoute('review_id', 0);
$status = $this->params()->fromRoute('status', '0');
if ($reviewID > 0) {
$service = $this->getServiceLocator()->get('service_apartment_review');
$service->updateReview($reviewID, $status, $this->apartmentId);
Helper::setFlashMessage(['success' => TextConstants::SUCCESS_UPDATE]);
} else {
Helper::setFlashMessage(['success' => TextConstants::SERVER_ERROR]);
}
return $this->redirect()->toRoute('apartment/review', ['apartment_id' => $this->apartmentId]);
}
示例11: indexAction
public function indexAction()
{
try {
if ($this->apartelId > 0) {
/** @var \DDD\Dao\Apartel\Details $apartelDetailsDao */
$apartelDetailsDao = $this->getServiceLocator()->get('dao_apartel_details');
$apartelCurrentData = $apartelDetailsDao->getApartelDetailsById($this->apartelId);
/** @var Logger $logger */
$logger = $this->getServiceLocator()->get('ActionLogger');
$logger->setOutputFormat(Logger::OUTPUT_HTML);
$apartelLogsArray = $logger->getDatatableData(Logger::MODULE_APARTEL, $this->apartelId);
return new ViewModel(['historyAaData' => $apartelLogsArray, 'apartelId' => $this->apartelId, 'apartelName' => $apartelCurrentData->getName()]);
} else {
throw new \Exception('Apartel not found');
}
} catch (\Exception $e) {
Helper::setFlashMessage(['error' => $e->getMessage()]);
return $this->redirect()->toUrl('/');
}
}
示例12: ajaxOrderItemsAction
public function ajaxOrderItemsAction()
{
$result = ['status' => 'error', 'msg' => TextConstants::ERROR];
$request = $this->getRequest();
if ($request->isPost() && $request->isXmlHttpRequest()) {
try {
/**
* @var \DDD\Service\Venue\Charges $venueChargeService
*/
$venueChargeService = $this->getServiceLocator()->get('service_venue_charges');
$post = $request->getPost();
if ($venueChargeService->createChargeForLunchroom(iterator_to_array($post))) {
Helper::setFlashMessage(["success" => "Your order is accepted"]);
$result = ['status' => 'success'];
}
} catch (\Exception $ex) {
}
} else {
$result['msg'] = TextConstants::ERROR_BAD_REQUEST;
}
return new JsonModel($result);
}
示例13: deleteAction
public function deleteAction()
{
$request = $this->getRequest();
$response = ['status' => 'success', 'msg' => TextConstants::SUCCESS_UPDATE];
if ($request->isXmlHttpRequest()) {
$categoryId = (int) $request->getPost('id');
/**
* @var ReviewCategoryService $reviewCategoryService
*/
$reviewCategoryService = $this->getServiceLocator()->get('service_apartment_review_category');
$result = $reviewCategoryService->delete($categoryId);
if ($result) {
Helper::setFlashMessage(['success' => 'Review Category Was Successfully Removed.']);
} else {
$response['status'] = 'error';
$response['msg'] = 'Problem Caused While Trying To Remove.';
}
} else {
$response['status'] = 'error';
$response['msg'] = 'Problem Caused While Trying To Remove.';
}
return new JsonModel($response);
}
示例14: ajaxChangeTransactionStatusAction
public function ajaxChangeTransactionStatusAction()
{
try {
/**
* @var \DDD\Service\Booking\BankTransaction $service
* @var \DDD\Service\Booking\BookingTicket $ticketService
*/
$request = $this->getRequest();
$auth = $this->getServiceLocator()->get('library_backoffice_auth');
$message = TextConstants::ERROR;
$status = 'error';
if (!$auth->hasRole(Roles::ROLE_BOOKING_TRANSACTION_VERIFIER) && !$auth->hasDashboard(UserService::DASHBOARD_CASH_PAYMENTS) && !$auth->hasDashboard(UserService::DASHBOARD_TRANSACTION_PENDING) && !$auth->hasDashboard(UserService::DASHBOARD_FRONTIER_CHARGE_REVIEWED)) {
throw new \Exception('No has permission');
}
if ($request->isPost() && $request->isXmlHttpRequest()) {
$service = $this->getServiceLocator()->get('service_booking_bank_transaction');
$transactionStatus = (int) $request->getPost('transaction_status');
$transactionId = (int) $request->getPost('transaction_id');
$transactionType = (int) $request->getPost('transaction_type');
$reservationId = (int) $request->getPost('reservation_id');
$responseData = $service->changeTransactionState($transactionId, $transactionStatus, $transactionType);
$status = $responseData['status'];
$message = $responseData['msg'];
if ($transactionStatus !== BankTransaction::BANK_TRANSACTION_STATUS_APPROVED) {
$ticketService = $this->getServiceLocator()->get('service_booking_booking_ticket');
$ticketService->markAsUnsettledReservationById($reservationId);
}
} else {
$message = TextConstants::BAD_REQUEST;
}
} catch (\Exception $e) {
$this->gr2logException($e, 'Change Transaction Status Failed');
$status = 'error';
}
Helper::setFlashMessage([$status => $message]);
return new JsonModel(['status' => $status, 'msg' => $message]);
}
示例15: ajaxGenerateResetAction
public function ajaxGenerateResetAction()
{
$auth = $this->getServiceLocator()->get('library_backoffice_auth');
$request = $this->getRequest();
$result = ['status' => 'error', 'msg' => TextConstants::ERROR];
if (!$auth->hasRole(Roles::ROLE_CREDIT_CARD) && !$auth->hasRole(Roles::ROLE_FRONTIER_CHARGE)) {
return new JsonModel($result);
}
$result = ['success' => TextConstants::SUCCESS_UPDATE];
try {
if ($request->isXmlHttpRequest()) {
$booking_id = (int) $request->getPost('id');
/**
* @var \DDD\Service\Booking $bookingService
*/
$bookingService = $this->getServiceLocator()->get('service_booking');
$bookingService->generateCcDataUpdatePage($booking_id, 0);
Helper::setFlashMessage($result);
}
} catch (\Exception $e) {
$result['error'] = TextConstants::ERROR;
}
return new JsonModel($result);
}