public function addDownloadButton($applicantId, Form $form, ControllerBase $controller) { $router = $controller->getEvent()->getRouter(); $downloadUrl = $router->assemble(['controller' => 'applicants', 'action' => 'downloadCv', 'id' => $applicantId], ['name' => 'recruitment/applicants']); $removeUrl = $router->assemble(['controller' => 'applicants', 'action' => 'removeAttachment', 'id' => $applicantId], ['name' => 'recruitment/applicants']); $form->add(array('name' => 'download', 'type' => 'Zend\\Form\\Element\\Button', 'attributes' => array('value' => $downloadUrl, 'id' => 'download-attachment', 'class' => 'btn btn-info btn-large pull-left self-submitter state hidden-file-input'), 'options' => array('label' => 'Download Attachment', 'download-icon' => 'icon-download-alt icon-white', 'remove-icon' => 'icon-remove icon-white', 'remove-url' => $removeUrl)), array('name' => 'download', 'priority' => 9)); }
public function addDownloadButton($docId, Form $form, ControllerBase $controller) { $router = $controller->getEvent()->getRouter(); $downloadUrl = $router->assemble(['controller' => 'user', 'action' => 'download-document-attachment', 'id' => $docId], ['name' => 'backoffice/default']); $removeUrl = $router->assemble(['controller' => 'user', 'action' => 'removeAttachment', 'id' => $docId], ['name' => 'backoffice/default']); $form->add(['name' => 'download', 'type' => 'Zend\\Form\\Element\\Button', 'attributes' => ['value' => $downloadUrl, 'id' => 'download-attachment', 'class' => 'btn btn-info btn-large pull-left self-submitter state hidden-file-input'], 'options' => ['label' => 'Download Attachment', 'download-icon' => 'icon-download-alt icon-white', 'remove-icon' => 'icon-remove icon-white', 'remove-url' => $removeUrl]], ['name' => 'download', 'priority' => 9]); }
/** * @param int $id * @param ControllerBase $controller * @return array | bool */ public function getReservationCard($id, ControllerBase $controller) { /** * @var \DDD\Dao\Booking\Booking $reservationDao */ $card = false; /** * @var $reservationDao \DDD\Dao\Booking\Booking * @var $cccaDao \DDD\Dao\Finance\Ccca */ $reservationDao = $this->getServiceLocator()->get('dao_booking_booking'); $cccaDao = $this->getServiceLocator()->get('dao_finance_ccca'); $result = $reservationDao->getTheCard($id); // check has frontier charge permission $auth = $this->getServiceLocator()->get('library_backoffice_auth'); $router = $controller->getEvent()->getRouter(); if ($result) { $card = ['id' => $result->getId(), 'bookingStatus' => $result->getBookingStatus(), 'resNumber' => $result->getResNumber(), 'name' => $result->getResNumber(), 'guest' => $result->getGuest(), 'apartmentAssignedId' => $result->getApartmentAssignedId(), 'apartmentAssigned' => $result->getApartmentAssigned(), 'building' => $result->getBuilding(), 'buildingId' => $result->getBuildingId(), 'unitNumber' => $result->getUnitNumber(), 'guest_phone' => $result->getGuestPhone(), 'travelPhone' => $result->getGuestTravelPhone(), 'dateFrom' => $result->getDateFrom() ? date(Constants::GLOBAL_DATE_FORMAT, strtotime($result->getDateFrom())) : '', 'dateTo' => $result->getDateTo() ? date(Constants::GLOBAL_DATE_FORMAT, strtotime($result->getDateTo())) : '', 'arrivalDate' => $result->getArrivalDate() ? date(Constants::GLOBAL_DATE_FORMAT . ' H:i', strtotime($result->getArrivalDate())) : '', 'departureDate' => $result->getDepartureDate() ? date(Constants::GLOBAL_DATE_FORMAT . ' H:i', strtotime($result->getDepartureDate())) : '', 'now' => Helper::getCurrenctDateByTimezone($result->getTimezone()), 'arrivalStatus' => $result->getArrivalStatus(), 'occupancy' => $result->getOccupancy(), 'guestBalance' => $result->getGuestBalance(), 'housekeepingComments' => $result->getHousekeepingComments(), 'cccaVerified' => $result->getCccaVerified(), 'parking' => $result->getParking(), 'parking_url' => $router->assemble(['res_num' => $result->getResNumber()], ['name' => 'frontier/print-parking-permits']), 'key_task' => $result->getKeyTask(), 'keyTask' => $result->getKeyTask(), 'guestEmail' => $result->getGuestEmail(), 'cccaPageStatus' => $result->getCccaPageStatus(), 'cccaPageToken' => $result->getCccaPageToken(), 'apartmentCurrencyCode' => $result->getApartmentCurrencyCode(), 'cccaPageLink' => '']; if (strtotime($card['now']) <= strtotime($card['dateTo']) && $result->getKiPageStatus() == ReservationTicketService::SEND_KI_PAGE_STATUS && $result->getKiPageHash()) { $card['keyUrl'] = 'https://' . DomainConstants::WS_SECURE_DOMAIN_NAME . '/key?code=' . $result->getKiPageHash() . '&view=0' . '&bo=' . $result->getKiPageGodModeCode(); } if ($auth->hasRole(Roles::ROLE_FRONTIER_CHARGE)) { $card['frontierCharge'] = '/frontier/charge/' . $result->getId() . '/0/' . Helper::hashForFrontierCharge($result->getId()); } if (is_null($result->getArrivalTime())) { $card['arrivalTime'] = date('H:i', strtotime($result->getApartmentCheckInTime())); } else { $card['arrivalTime'] = date('H:i', strtotime($result->getArrivalTime())); } /* @var $chargeAuthorizationService \DDD\Service\Reservation\ChargeAuthorization */ $chargeAuthorizationService = $this->getServiceLocator()->get('service_reservation_charge_authorization'); $card['creditCardsForAuthorization'] = $chargeAuthorizationService->getCreditCardsForAuthorization($id); // CCCA page link $cccaData = $cccaDao->getAllSentCcca($id); if ($cccaData) { foreach ($cccaData as $index => $row) { $lastDigit = 0; foreach ($card['creditCardsForAuthorization'] as $cardInfo) { if ($cardInfo->getId() == $row->getCcId()) { $lastDigit = $cardInfo->getLast4Digits(); break; } } $card['cccaPageLink'][$index] = ['link' => 'https://' . DomainConstants::WS_SECURE_DOMAIN_NAME . '/ccca-page?token=' . $row->getPageToken(), 'lastDigit' => $lastDigit]; } } $card['hasMoreCards'] = false; if (count($card['creditCardsForAuthorization']) > $cccaData->count()) { $card['hasMoreCards'] = true; } } return $card; }