public function indexAction() { /** * @var \DDD\Service\Apartel\Connection $connectionService * @var \DDD\Service\Cubilis\Connection $cubilisConnectionService * @var \DDD\Service\Apartel\Type $typeService * @var OTADistribution $apartelOTAService */ $connectionService = $this->getServiceLocator()->get('service_apartel_connection'); $cubilisConnectionService = $this->getServiceLocator()->get('service_cubilis_connection'); $typeService = $this->getServiceLocator()->get('service_apartel_type'); // set Connection From $cubilisDetails = $connectionService->getCubilisConnectionDetails($this->apartelId); $form = new ApartelForm(); $form->prepare(); $form->populateValues($cubilisDetails); // syn Ginosi Type/Rate width Cubilis $ginosiTypeRateList = $typeService->getApartelTypesWithRates($this->apartelId); $cubilisTypeRateList = $cubilisConnectionService->getCubilisTypes($this->apartelId, $ginosiTypeRateList, true); // OTA connection $apartelOTAService = $this->getServiceLocator()->get('service_apartel_ota_distribution'); $apartelOTAList = $apartelOTAService->getOTAList($this->apartelId); $partnerList = $apartelOTAService->getPartnerList(); return ['form' => $form, 'cubilisDetails' => $cubilisDetails, 'ginosiTypeRateList' => $ginosiTypeRateList, 'cubilisTypeRateList' => $cubilisTypeRateList, 'apartelOTAList' => $apartelOTAList, 'partnerList' => $partnerList, 'OTAStatus' => Objects::getOTADistributionStatusList()]; }
public function indexAction() { /** * @var \DDD\Service\Cubilis\Connection $cubilisConnectionService * @var General $apartmentGeneralService */ $cubilisConnectionService = $this->getServiceLocator()->get('service_cubilis_connection'); $apartmentGeneralService = $this->getServiceLocator()->get('service_apartment_general'); $cubilisDetails = $apartmentGeneralService->getCubilisDetailsAsArray($this->apartmentId); $form = new CubilisConnection($this->url()->fromRoute('apartment/channel-connection/save', ['apartment_id' => $this->apartmentId])); $form->prepare(); $form->populateValues($cubilisDetails); $formTemplate = 'form-templates/cubilis-connection'; $viewModelForm = new ViewModel(); $viewModelForm->setVariables(['form' => $form]); $viewModelForm->setTemplate($formTemplate); $rates = $apartmentGeneralService->getRoomRates($this->apartmentId); $rateConnections = $cubilisConnectionService->getCubilisTypes($this->apartmentId, $rates); $urlLinkRates = $this->url()->fromRoute('apartment/channel-connection/link', ['apartment_id' => $this->apartmentId]); $apartmentOTAService = $this->getServiceLocator()->get('service_apartment_ota_distribution'); $apartmentOTAList = $apartmentOTAService->getOTAList($this->apartmentId); $partnerList = $apartmentOTAService->getPartnerList(); $hasApartmentConnectionRole = false; $auth = $this->getServiceLocator()->get('library_backoffice_auth'); if ($auth->hasRole(Roles::ROLE_APARTMENT_CONNECTION)) { $hasApartmentConnectionRole = true; } $viewModel = new ViewModel(); $viewModel->setVariables(['apartmentId' => $this->apartmentId, 'apartmentStatus' => $this->apartmentStatus, 'rateConnections' => $rateConnections, 'rates' => $rates, 'urlLinkRates' => $urlLinkRates, 'cubilisDetails' => $cubilisDetails, 'apartmentOTAList' => $apartmentOTAList, 'partnerList' => $partnerList, 'OTAStatus' => Objects::getOTADistributionStatusList(), 'isCubilisConnecter' => $hasApartmentConnectionRole]); // child view to render form $viewModel->addChild($viewModelForm, 'formOutput'); $viewModel->setTemplate('apartment/channel-connection/index'); return $viewModel; }