当前位置: 首页>>代码示例>>PHP>>正文


PHP Utility\Helper类代码示例

本文整理汇总了PHP中Library\Utility\Helper的典型用法代码示例。如果您正苦于以下问题:PHP Helper类的具体用法?PHP Helper怎么用?PHP Helper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Helper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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']);
     }
 }
开发者ID:arbi,项目名称:MyCode,代码行数:35,代码来源:ApartmentGroupController.php

示例2: 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);
 }
开发者ID:arbi,项目名称:MyCode,代码行数:33,代码来源:Calendar.php

示例3: 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);
 }
开发者ID:arbi,项目名称:MyCode,代码行数:27,代码来源:Media.php

示例4: avatarAction

 public function avatarAction()
 {
     try {
         /**
          * @var \DDD\Service\Upload $uploadService
          */
         $uploadService = $this->getServiceLocator()->get('service_upload');
         $request = $this->getRequest();
         // check request method
         if ($request->getMethod() !== 'POST') {
             throw new \Exception(TextConstants::AJAX_NO_POST_ERROR);
         }
         // take avatar file and user id from POST
         $avatarFile = $request->getFiles();
         $profileId = $request->getPost('userId');
         // send resoult to service
         $newAvatar = $uploadService->updateAvatar((int) $profileId, [$avatarFile['file']]);
         if (is_array($newAvatar) && $newAvatar['status'] === 'error') {
             return new JsonModel($newAvatar);
         }
         $session = Helper::getSession('Zend_Auth');
         $session['storage']->avatar = $newAvatar;
         $result['status'] = 'success';
         $result['msg'] = TextConstants::SUCCESS_UPDATE;
         $result['src'] = $profileId . '/' . $newAvatar;
         return new JsonModel($result);
     } catch (Exception $e) {
         throw new \Exception($e->getMessage());
     }
 }
开发者ID:arbi,项目名称:MyCode,代码行数:30,代码来源:UploadController.php

示例5: 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()]);
     }
 }
开发者ID:arbi,项目名称:MyCode,代码行数:29,代码来源:SystemController.php

示例6: testBookingProcess

 /**
  * Test booking process
  */
 public function testBookingProcess()
 {
     $bookingTicketService = $this->getApplicationServiceLocator()->get('service_booking_booking_ticket');
     $channelManagerService = $this->getApplicationServiceLocator()->get('service_channel_manager');
     $apartmentGroupService = $this->getApplicationServiceLocator()->get('service_apartment_group');
     $reservationService = $this->getApplicationServiceLocator()->get('service_reservation_main');
     $partnerService = $this->getApplicationServiceLocator()->get('service_partners');
     $syncService = $this->getApplicationServiceLocator()->get('service_queue_inventory_synchronization_queue');
     $currencyService = $this->getApplicationServiceLocator()->get('service_currency_currency');
     $this->assertInstanceOf('\\DDD\\Service\\Booking\\BookingTicket', $bookingTicketService);
     $this->assertInstanceOf('\\DDD\\Service\\ChannelManager', $channelManagerService);
     $this->assertInstanceOf('\\DDD\\Service\\ApartmentGroup', $apartmentGroupService);
     $this->assertInstanceOf('\\DDD\\Service\\Reservation\\Main', $reservationService);
     $this->assertInstanceOf('\\DDD\\Service\\Partners', $partnerService);
     $this->assertInstanceOf('\\DDD\\Service\\Queue\\InventorySynchronizationQueue', $syncService);
     $this->assertInstanceOf('\\DDD\\Service\\Currency\\Currency', $currencyService);
     // dummy data
     $resNumber = $bookingTicketService->generateResNumber();
     $timeStamp = date('Y-m-d H:i:s');
     $reservationData = ["apartment_id_assigned" => 662, "apartment_id_origin" => 662, "room_id" => 1366, "acc_name" => "Hollywood Al Pacino", "acc_country_id" => 213, "acc_province_id" => 19, "acc_city_id" => 48, "acc_province_name" => "California", "acc_city_name" => "Hollywood Los Angeles", "acc_address" => "1714 N McCadden Pl", "building_name" => $apartmentGroupService->getBuildingName(662), "date_from" => date('Y-m-d'), "date_to" => date('Y-m-d', strtotime(' +1 day')), "currency_rate" => $currencyService->getCurrencyConversionRate(Helper::getCurrency(), "USD"), "currency_rate_usd" => $currencyService->getCurrencyConversionRate('USD', 'USD'), "booker_price" => "249.00", "guest_currency_code" => Helper::getCurrency(), "occupancy" => 2, "res_number" => $resNumber, "timestamp" => $timeStamp, "apartment_currency_code" => 'USD', "rateId" => "3536", "ki_page_status" => BookingTicket::NOT_SEND_KI_PAGE_STATUS, "ki_page_hash" => $bookingTicketService->generatePageHash($resNumber, $timeStamp), "review_page_hash" => $bookingTicketService->generatePageHash($resNumber, 662), "remarks" => "", "guest_first_name" => "Test", "guest_last_name" => "PhpUnit", "guest_email" => "test@ginosi.com", "guest_address" => "Test Street 2", "guest_city_name" => "Yerevan", "guest_country_id" => 2, "guest_language_iso" => 'en', "guest_zip_code" => "12121", "guest_phone" => "37499000000", "partner_ref" => "", "partner_id" => 5, "partner_name" => "Staff", "partner_commission" => 0, "model" => 2];
     $customerData['email'] = $reservationData['guest_email'];
     $reservationData['customer_data'] = $customerData;
     $otherInfo = ['cc_provided' => false, 'availability' => 0, 'no_send_guest_mail' => true, 'ratesData' => $reservationService->getRateDataByRateIdDates($reservationData['rateId'], $reservationData['date_from'], $reservationData['date_to'])];
     unset($reservationData['rateId']);
     $reservationId = $reservationService->registerReservation($reservationData, $otherInfo, true);
     $this->assertLessThan($reservationId, 0, 'Reservation is not correct or not available - [Apartment ID: 662]');
     $syncOutput = $syncService->push($reservationData['apartment_id_origin'], $reservationData['date_from'], $reservationData['date_to']);
     $this->assertTrue($syncOutput, 'Synchronization Queue is not correct');
 }
开发者ID:arbi,项目名称:MyCode,代码行数:32,代码来源:BookingTest.php

示例7: saveBudget

 /**
  * @param $data
  * @param $budgetId
  * @return int
  */
 public function saveBudget($data, $budgetId)
 {
     /** @var \DDD\Dao\Finance\Budget\Budget $budgetDao */
     $budgetDao = $this->getServiceLocator()->get('dao_finance_budget_budget');
     $dateRange = Helper::refactorDateRange($data['period']);
     if ($budgetId) {
         // Apply amount changes to balance
         $oldData = $budgetDao->getBudgetData($budgetId);
         $balance = $oldData['balance'] + $data['amount'] - $oldData['amount'];
     } else {
         // Starting balance is the same as amount
         $balance = $data['amount'];
     }
     $params = ['name' => $data['name'], 'status' => $data['status'], 'from' => $dateRange['date_from'], 'to' => $dateRange['date_to'], 'amount' => $data['amount'], 'balance' => $balance, 'description' => $data['description'], 'department_id' => $data['is_global'] ? null : $data['department_id'], 'is_global' => $data['is_global']];
     if ($data['country_id'] > 0) {
         $params['country_id'] = $data['country_id'];
     } else {
         $params['country_id'] = null;
     }
     if ($budgetId) {
         $budgetDao->save($params, ['id' => $budgetId]);
     } else {
         $auth = $this->getServiceLocator()->get('library_backoffice_auth');
         $userId = $auth->getIdentity()->id;
         $params['user_id'] = $userId;
         $budgetId = $budgetDao->save($params);
     }
     return $budgetId;
 }
开发者ID:arbi,项目名称:MyCode,代码行数:34,代码来源:Budget.php

示例8: sendApplicantRejectionsAction

 public function sendApplicantRejectionsAction()
 {
     /**
      * @var \DDD\Service\Queue\EmailQueue $emailQueueService
      * @var \Mailer\Service\Email $mailer
      */
     $emailQueueService = $this->getServiceLocator()->get('service_queue_email_queue');
     $list = $emailQueueService->fetch(EmailQueue::TYPE_APPLICANT_REJECTION);
     if ($list && $list->count()) {
         /**
          * @var \DDD\Service\Textline $textlineService
          */
         $textlineService = $this->getServiceLocator()->get('service_textline');
         foreach ($list as $item) {
             //Don't send an email if applicant is not rejected anymore
             if (Applicant::APPLICANT_STATUS_REJECT != $item['status']) {
                 $emailQueueService->delete($item['id']);
                 continue;
             }
             $mailer = $this->getServiceLocator()->get('Mailer\\Email');
             $emailValidator = new EmailAddress();
             if (!$emailValidator->isValid($item['email'])) {
                 $this->outputMessage('[error] Applicant email is not valid: ' . $item['email'] . ' Removing from queue.');
                 $this->gr2err("Applicant rejection mail wasn't sent", ['applicant_id' => $item['entity_id'], 'applicant_name' => $item['applicant_name']]);
                 continue;
             }
             $mailer->send('applicant-rejection', ['to' => $item['email'], 'bcc' => EmailAliases::HR_EMAIL, 'to_name' => $item['applicant_name'], 'replyTo' => EmailAliases::HR_EMAIL, 'from_address' => EmailAliases::HR_EMAIL, 'from_name' => 'Ginosi Apartments', 'subject' => $textlineService->getUniversalTextline(1608, true), 'msg' => Helper::evaluateTextline($textlineService->getUniversalTextline(1607), ['{{APPLICANT_NAME}}' => $item['applicant_name'], '{{POSITION_TITLE}}' => $item['position_title']])]);
             $emailQueueService->delete($item['id']);
             $this->outputMessage("[1;32mRejection email to {$item['applicant_name']} sent. [0m");
         }
     } else {
         $this->outputMessage("[1;32mQueue is empty. [0m");
     }
     $this->outputMessage("[1;32mDone. [0m");
 }
开发者ID:arbi,项目名称:MyCode,代码行数:35,代码来源:EmailController.php

示例9: 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);
 }
开发者ID:arbi,项目名称:MyCode,代码行数:32,代码来源:Items.php

示例10: downloadCsvAction

 public function downloadCsvAction()
 {
     $apartmentGeneralService = $this->getServiceLocator()->get('service_apartment_general');
     $currency = $apartmentGeneralService->getCurrencySymbol($this->apartmentId);
     $expenseDao = new ExpenseCost($this->getServiceLocator(), '\\ArrayObject');
     $costs = $expenseDao->getApartmentCosts($this->apartmentId);
     $costArray = [];
     foreach ($costs as $cost) {
         $costArray[] = ["ID" => $cost['id'], "Category" => $cost['category'], "Date" => date(Constants::GLOBAL_DATE_FORMAT, strtotime($cost['date'])), "Amount ({$currency})" => $cost['amount'], "Purpose" => $cost['purpose']];
     }
     if (!empty($costArray)) {
         $response = $this->getResponse();
         $headers = $response->getHeaders();
         $utilityCsvGenerator = new CsvGenerator();
         $filename = 'costs_apartment_' . str_replace(' ', '_', date('Y-m-d')) . '.csv';
         $utilityCsvGenerator->setDownloadHeaders($headers, $filename);
         $csv = $utilityCsvGenerator->generateCsv($costArray);
         $response->setContent($csv);
         return $response;
     } else {
         $flash_session = Helper::getSessionContainer('use_zf2');
         $flash_session->flash = ['notice' => 'There are empty data, nothing to download.'];
         $url = $this->getRequest()->getHeader('Referer')->getUri();
         $this->redirect()->toUrl($url);
     }
 }
开发者ID:arbi,项目名称:MyCode,代码行数:26,代码来源:Cost.php

示例11: 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);
 }
开发者ID:arbi,项目名称:MyCode,代码行数:25,代码来源:GroupInventoryController.php

示例12: 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];
 }
开发者ID:arbi,项目名称:MyCode,代码行数:59,代码来源:ConciergeController.php

示例13: 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);
 }
开发者ID:arbi,项目名称:MyCode,代码行数:58,代码来源:ChargeAuthorizationController.php

示例14: 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;
 }
开发者ID:arbi,项目名称:MyCode,代码行数:55,代码来源:ApartmentGroupHistoryController.php

示例15: getAllBudgets

 /**
  * @param $params
  * @param $userId
  * @return array
  */
 public function getAllBudgets($params, $userId)
 {
     $this->resultSetPrototype->setArrayObjectPrototype(new \ArrayObject());
     $where = new Where();
     if (isset($params['name']) && $params['name']) {
         $where->like($this->getTable() . '.name', $params['name'] . '%');
     }
     if (isset($params['status']) && $params['status']) {
         $where->equalTo($this->getTable() . '.status', $params['status']);
     }
     if (isset($params['user']) && $params['user']) {
         $where->equalTo($this->getTable() . '.user_id', $params['user']);
     }
     if (isset($params['period']) && $params['period']) {
         $dateRange = Helper::refactorDateRange($params['period']);
         $where->greaterThanOrEqualTo($this->getTable() . '.to', $dateRange['date_from']);
         $where->lessThanOrEqualTo($this->getTable() . '.from', $dateRange['date_to']);
     }
     if (isset($params['frozen']) && $params['frozen'] >= 0) {
         $where->equalTo($this->getTable() . '.frozen', $params['frozen']);
     }
     if (isset($params['archived']) && $params['archived'] >= 0) {
         $where->equalTo($this->getTable() . '.archived', $params['archived']);
     }
     if ($userId) {
         $where->equalTo($this->getTable() . '.user_id', $userId);
     }
     if (isset($params['department']) && $params['department'] >= 0) {
         $where->equalTo($this->getTable() . '.department_id', $params['department']);
     }
     if (isset($params['country']) && $params['country'] >= 0) {
         $where->equalTo($this->getTable() . '.country_id', $params['country']);
     }
     if (isset($params['global']) && $params['global'] >= 0) {
         $where->equalTo($this->getTable() . '.is_global', $params['global']);
     }
     $offset = $params['iDisplayStart'];
     $limit = $params['iDisplayLength'];
     $sortCol = $params['iSortCol_0'];
     $sortDir = $params['sSortDir_0'];
     $result = $this->fetchAll(function (Select $select) use($offset, $limit, $sortCol, $sortDir, $where) {
         $sortColumns = ['status', 'name', 'department_name', 'from', 'amount', 'balance', 'user_name'];
         $select->columns(['id', 'name', 'from', 'to', 'amount', 'description', 'status', 'user_id', 'department_id', 'country_id', 'is_global', 'balance']);
         $select->join(['users' => DbTables::TBL_BACKOFFICE_USERS], $this->getTable() . '.user_id = users.id', ['user_name' => new Expression('CONCAT(firstname, " ", lastname)')], Select::JOIN_LEFT);
         $select->join(['teams' => DbTables::TBL_TEAMS], $this->getTable() . '.department_id = teams.id', ['department_name' => 'name'], Select::JOIN_LEFT);
         $select->where($where);
         $select->group($this->getTable() . '.id')->order($sortColumns[$sortCol] . ' ' . $sortDir)->offset((int) $offset)->limit((int) $limit);
         $select->quantifier(new Expression('SQL_CALC_FOUND_ROWS'));
     });
     $statement = $this->adapter->query('SELECT FOUND_ROWS() as total');
     $resultCount = $statement->execute();
     $row = $resultCount->current();
     $total = $row['total'];
     return ['result' => $result, 'total' => $total];
 }
开发者ID:arbi,项目名称:MyCode,代码行数:60,代码来源:Budget.php


注:本文中的Library\Utility\Helper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。