Пример #1
0
 public function editAction()
 {
     /**
      * @var \DDD\Service\Parking\Spot $parkingSpotService
      * @var \DDD\Service\Parking\General $parkingGeneralService
      */
     $parkingSpotService = $this->getServiceLocator()->get('service_parking_spot');
     $parkingGeneralService = $this->getServiceLocator()->get('service_parking_general');
     $spots = $parkingSpotService->getParkingSpots($this->parkingLotId);
     $parkingLot = $parkingGeneralService->getParkingById($this->parkingLotId);
     $selectedSpotId = $this->params()->fromRoute('spot_id', 0);
     $viewModel = new \Zend\View\Model\ViewModel();
     $form = new SpotForm($this->parkingLotId, 'parking-spot');
     if ($selectedSpotId) {
         $usages = $parkingSpotService->getUsages($selectedSpotId);
         $parkingSpotDao = $this->getServiceLocator()->get('dao_parking_spot');
         $selectedSpot = $parkingSpotDao->getParkingSpotById($selectedSpotId);
         if (!$selectedSpot) {
             Helper::setFlashMessage(['error' => 'Spot not found']);
             return $this->redirect()->toRoute('parking/spots', ['parking_lot_id' => $this->parkingLotId]);
         }
         $form->prepare();
         $form->populateValues(['id' => $selectedSpot->getId(), 'lot_id' => $selectedSpot->getLotId(), 'unit' => $selectedSpot->getUnit(), 'price' => $selectedSpot->getPrice(), 'permit_id' => $selectedSpot->getPermitId()]);
         $viewModel->setVariables(['usages' => $usages]);
     }
     $viewModel->setVariables(['parkingLotId' => $this->parkingLotId, 'spots' => $spots, 'spotCount' => count($spots), 'form' => $form, 'selectedSpotId' => $selectedSpotId, 'parkingLot' => $parkingLot]);
     return $viewModel;
 }
Пример #2
0
 /**
  * Apartment Welcome Note Page
  *
  * @return \Zend\View\Model\ViewModel
  */
 public function indexAction()
 {
     /**
      * @var \DDD\Service\Apartment\General $apartmentGeneralService
      * @var \DDD\Service\Task $taskService
      * @var \DDD\Dao\Textline\Apartment $texLineApartmentDao
      */
     $apartmentGeneralService = $this->getServiceLocator()->get('service_apartment_general');
     $taskService = $this->getServiceLocator()->get('service_task');
     $textLineApartmentDao = $this->getServiceLocator()->get('dao_textline_apartment');
     $apartmentTasks = $taskService->getFrontierTasksOnApartment($this->apartmentId);
     // get apartment usage information
     $apartmentUsage = $textLineApartmentDao->getApartmentUsageByApartmentId($this->apartmentId);
     // get building usage information
     $apartmentBuildingUsage = $textLineApartmentDao->getApartmentBuildingUsageByApartmentId($this->apartmentId);
     // get building facilities information
     $apartmentBuildingFacility = $textLineApartmentDao->getApartmentBuildingFacilityByApartmentId($this->apartmentId);
     // get building policy information
     $apartmentBuildingPolicy = $textLineApartmentDao->getApartmentBuildingPolicyByApartmentId($this->apartmentId);
     // get apartment information
     $generalInfo = $apartmentGeneralService->getApartmentGeneral($this->apartmentId);
     $viewModel = new \Zend\View\Model\ViewModel();
     $viewModel->setTerminal(true);
     $viewModel->setVariables(['apartment' => $generalInfo, 'apartmentTasks' => $apartmentTasks, 'apartmentUsage' => $apartmentUsage, 'apartmentBuildingUsage' => $apartmentBuildingUsage, 'apartmentBuildingFacility' => $apartmentBuildingFacility, 'apartmentBuildingPolicy' => $apartmentBuildingPolicy]);
     return $viewModel;
 }
 public function indexAction()
 {
     $config = $this->getServiceLocator()->get('Config');
     $viewModel = new \Zend\View\Model\ViewModel();
     $viewModel->setVariables(['application' => $config['dragonjsonserver']['application'], 'serverurl' => $config['dragonjsonserver']['serverurl'], 'apiclient' => $config['dragonjsonserverapiclient']])->setTerminal(true);
     return $viewModel;
 }
Пример #4
0
 public function indexAction()
 {
     /**
      * @var \DDD\Service\Apartment\General $apartmentGeneralService
      * @var \DDD\Service\Apartment\Main $apartmentMainService
      * @var \DDD\Service\Apartment\OTADistribution $apartmentOTAService
      * @var $taskService \DDD\Service\Task
      * @var $bookingTicketService \DDD\Service\Booking\BookingTicket
      */
     $apartmentGeneralService = $this->getServiceLocator()->get('service_apartment_general');
     $apartmentMainService = $this->getServiceLocator()->get('service_apartment_main');
     $apartmentOTAService = $this->getServiceLocator()->get('service_apartment_ota_distribution');
     $taskService = $this->getServiceLocator()->get('service_task');
     $bookingTicketService = $this->getServiceLocator()->get('service_booking_booking_ticket');
     $apartmentTasks = $taskService->getFrontierTasksOnApartment($this->apartmentId);
     $apartmentOTAList = $apartmentOTAService->getOTAList($this->apartmentId);
     $building = $apartmentMainService->getApartmentBuilding($this->apartmentId);
     $apartels = $apartmentMainService->getApartmentApartels($this->apartmentId);
     $bookingDao = new Booking($this->getServiceLocator(), 'ArrayObject');
     $mediaDao = new Media($this->getServiceLocator(), 'ArrayObject');
     $dateDisabled = $currentReservation = $nextReservation = false;
     $apartmentDates = $apartmentMainService->getApartmentDates($this->apartmentId);
     $generalInfo = $apartmentGeneralService->getApartmentGeneral($this->apartmentId);
     if ($this->apartmentStatus == Objects::PRODUCT_STATUS_DISABLED) {
         $dateDisabled = $apartmentDates['disable_date'];
     } else {
         $currentReservation = $bookingDao->getCurrentReservationByAcc($this->apartmentId, date('Y-m-d'));
         $resId = $currentReservation['id'];
         $pin = $currentReservation['pin'];
         $current = true;
         if (!$currentReservation) {
             $nextReservation = $bookingDao->getNextReservationByAcc($this->apartmentId, date('Y-m-d'));
             $resId = $nextReservation['id'];
             $pin = $nextReservation['pin'];
             $current = false;
         }
         if ($resId && $pin) {
             $lockDatas = $bookingTicketService->getLockByReservation($resId, $pin, [LockService::USAGE_APARTMENT_TYPE]);
             foreach ($lockDatas as $key => $lockData) {
                 switch ($key) {
                     case LockService::USAGE_APARTMENT_TYPE:
                         if ($current) {
                             $currentReservation['pin'] = $lockData['code'];
                         } else {
                             $nextReservation['pin'] = $lockData['code'];
                         }
                         break;
                 }
             }
         }
     }
     $img = $mediaDao->getFirstImage($this->apartmentId)['img1'];
     $viewModel = new \Zend\View\Model\ViewModel();
     $viewModel->setVariables(['apartmentId' => $this->apartmentId, 'apartmentStatus' => $this->apartmentStatus, 'currentReservation' => $currentReservation, 'nextReservation' => $nextReservation, 'dateCreated' => $apartmentDates['create_date'], 'dateDisabled' => $dateDisabled, 'img' => str_replace('orig', 445, $img), 'OTAList' => $apartmentOTAList, 'building' => $building, 'apartels' => $apartels, 'apartment' => $generalInfo, 'apartmentTasks' => $apartmentTasks]);
     $viewModel->setTemplate('apartment/main/index');
     return $viewModel;
 }
Пример #5
0
 /**
  * 分页方法
  * $dql 查询dql语句
  * $maxlist 每页显示条数
  * $pageNumberOld 当前页数
  * */
 public function fenye($dql, $maxlist, $pageNumberOld)
 {
     $firstResult = 0;
     if ($pageNumberOld == null) {
         $pageNumberOld = 1;
     }
     if ($pageNumberOld == 1) {
         $firstResult = 0;
     } else {
         $pageNumberNew = $pageNumberOld * $maxlist;
         $firstResult = $pageNumberNew - $maxlist;
     }
     $entityManager = $this->getEntityManager();
     $query = $entityManager->createQuery($dql)->setFirstResult($firstResult)->setMaxResults($maxlist);
     $paginator = new Paginator($query, $fetchJoinCollection = true);
     $countNumber = count($paginator);
     $bugs = $query->getArrayResult();
     $paginator = new \Zend\Paginator\Paginator(new \Zend\Paginator\Adapter\null($countNumber));
     $paginator->setCurrentPageNumber($pageNumberOld)->setItemCountPerPage($maxlist);
     $vm = new \Zend\View\Model\ViewModel();
     $vm->setVariables(array('paginator' => $paginator, 'bugs' => $bugs));
     return $vm;
 }
Пример #6
0
 public function indexAction()
 {
     /**
      * @var \DDD\Service\Apartment\Location $apartmentLocationService
      */
     $apartmentLocationService = $this->getServiceLocator()->get('service_apartment_location');
     /* @var $location \DDD\Domain\Apartment\Location\Location */
     $location = $apartmentLocationService->getApartmentLocation($this->apartmentId);
     $preparedData = $this->prepareFormContent($location->getCountryID(), $location->getProvinceID(), $location->getBuildingID());
     $preparedData['countryId'] = $location->getCountryID();
     $form = new LocationForm('apartment_location', $preparedData);
     // Google map configuration
     $config = array('sensor' => 'true', 'div_id' => 'map', 'div_class' => '', 'zoom' => 10, 'width' => "", 'height' => "300px", 'lat' => $location->getX_pos(), 'lon' => $location->getY_pos());
     $map = $this->getServiceLocator()->get('GMaps\\Service\\GoogleMapDragableMarker');
     //getting the google map object using service manager
     $map->initialize($config);
     //loading the config
     $mapHTML = $map->generate();
     //generating the html map content
     $form->populateValues(['longitude' => $location->getY_pos(), 'latitude' => $location->getX_pos(), 'location_description' => $location->getDescriptionText(), 'directions' => $location->getDirectionsText(), 'description_textline' => $location->getDescriptionTextlineID(), 'directions_textline' => $location->getDirectionsTextlineID(), 'country_id' => $location->getCountryID(), 'province_id' => $location->getProvinceID(), 'city_id' => $location->getCityID(), 'building' => $location->getBuildingID(), 'building_section' => $location->getBuildingSectionId(), 'address' => $location->getAddress(), 'postal_code' => $location->getPostalCode(), 'block' => $location->getBlock(), 'floor' => $location->getFloor(), 'unit_number' => $location->getUnitNumber()]);
     // set form type and template
     $formTemplate = 'form-templates/location';
     // passing form and map to the view
     $viewModelForm = new \Zend\View\Model\ViewModel();
     $viewModelForm->setVariables(['form' => $form, 'mapHTML' => $mapHTML, 'apartmentId' => $this->apartmentId, 'apartmentStatus' => $this->apartmentStatus, 'countryId' => $location->getCountryID(), 'building' => $location->getBuilding(), 'buildingSectionsShow' => isset($preparedData['buildingSectionOptions']) && $preparedData['buildingSectionOptions'] > 1 ? true : false]);
     //Country Currency List
     $locationService = $this->getServiceLocator()->get('service_location');
     $listCountryWithCurrecny = $locationService->getCountriesWithCurrecny();
     $viewModelForm->setTemplate($formTemplate);
     $viewModel = new \Zend\View\Model\ViewModel();
     $viewModel->setVariables(['apartmentId' => $this->apartmentId, 'apartmentStatus' => $this->apartmentStatus, 'listCountryWithCurrecny' => $listCountryWithCurrecny]);
     // child view to render form
     $viewModel->addChild($viewModelForm, 'formOutput');
     $viewModel->setTemplate('apartment/location/index');
     return $viewModel;
 }
Пример #7
0
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require './vendor/autoload.php';
$vm = new \Zend\View\Model\ViewModel();
$vm->setVariables(array('nom' => 'tintin'));
$vm->setTemplate('liste');
$rendu = new \Zend\View\Renderer\PhpRenderer();
echo $rendu->render($vm);
Пример #8
0
<?php

require './vendor/autoload.php';
$vm = new \Zend\View\Model\ViewModel(array('nom' => 'tintin'));
$vm->setVariables(array('title' => 'tintin', 'description' => 'bande dessinée', 'link' => 'http://manews.fr'));
$vm->setTemplate('liste');
$resol = new Zend\View\Resolver\TemplateMapResolver(array('liste' => __DIR__ . '/liste.phtml'));
$rendu = new \Zend\View\Renderer\FeedRenderer();
$rendu->setResolver($resol);
echo $rendu->render($vm);
Пример #9
0
 public function indexAction()
 {
     /** @var \DDD\Service\Apartment\Details $apartmentDetailsService */
     $apartmentDetailsService = $this->getServiceLocator()->get('service_apartment_details');
     /** @var \DDD\Service\Apartment\Furniture $apartmentFurnitureService */
     $apartmentFurnitureService = $this->getServiceLocator()->get('service_apartment_furniture');
     /** @var \DDD\Service\Apartment\General $apartmentGeneralService */
     $apartmentGeneralService = $this->getServiceLocator()->get('service_apartment_general');
     /** @var \DDD\Service\Apartment\Amenities $apartmentAmenitiesService */
     $apartmentAmenitiesService = $this->getServiceLocator()->get('service_apartment_amenities');
     /** @var \DDD\Service\Apartment\AmenityItems $apartmentAmenityItemsService */
     $apartmentAmenityItemsService = $this->getServiceLocator()->get('service_apartment_amenity_items');
     /** @var \DDD\Service\Parking\General $parkingGeneralService */
     $parkingGeneralService = $this->getServiceLocator()->get('service_parking_general');
     /** @var \DDD\Service\Parking\Spot $parkingSpotService */
     $parkingSpotService = $this->getServiceLocator()->get('service_parking_spot');
     /** @var \DDD\Dao\Accommodation\Accommodations $accDao */
     $accDao = $this->getServiceLocator()->get('dao_accommodation_accommodations');
     /** @var \DDD\Dao\Textline\Apartment $texlineApartmentDao */
     $texlineApartmentDao = $this->getServiceLocator()->get('dao_textline_apartment');
     /** @var \DDD\Dao\Apartment\Spots $apartmentSpotsDao */
     $apartmentSpotsDao = $this->getServiceLocator()->get('dao_apartment_spots');
     $formOptions = [];
     $details = $apartmentDetailsService->getApartmentDetails($this->apartmentId);
     $furnitureList = $apartmentFurnitureService->getApartmentFurnitureList($this->apartmentId);
     $furnitureTypes = $apartmentFurnitureService->getFurnitureTypes();
     $roomId = $apartmentGeneralService->getRoomID($this->apartmentId);
     $generalDetails = $apartmentGeneralService->getInfoForDetailsController($this->apartmentId);
     $lockId = $generalDetails['lock_id'];
     $formOptions['parkingLots'] = $parkingGeneralService->getParkingLotsForSelect($this->apartmentId);
     $apartmentAmenities = $apartmentAmenityItemsService->getApartmentAmenities($this->apartmentId);
     $amenitiesList = $apartmentAmenitiesService->getAmenitiesList();
     $accInfo = $accDao->getAccById($this->apartmentId);
     $accCurrency = $accInfo->getCurrencyCode();
     $facilities = $apartmentGeneralService->getBuildingFacilitiesByApartmentId($this->apartmentId);
     $moneyAccountId = isset($details['money_account_id']) ? $details['money_account_id'] : null;
     $lockApartmentUsageService = $this->getServiceLocator()->get('service_lock_usages_apartment');
     $formOptions['freeLocks'] = $lockApartmentUsageService->getLockByUsage($this->apartmentId);
     $bankAccountDao = new \DDD\Dao\MoneyAccount\MoneyAccount($this->getServiceLocator());
     $formOptions['bankAccounts'] = $bankAccountDao->getMoneyAccountOptions($moneyAccountId);
     $lotId = $accInfo->getLotId();
     $parkingLotData = $parkingGeneralService->getParkingById($lotId);
     $spots = $parkingSpotService->getSpotsByBuilding($accInfo->getBuildingId());
     $formOptions['parkingSpots'] = ['' => '-- Choose Parking Spot --'];
     if ($spots->count()) {
         foreach ($spots as $spot) {
             $formOptions['parkingSpots'][$spot->getId()] = $spot->getLotName() . ': ' . $spot->getUnit();
         }
     }
     $apartmentSpots = $apartmentSpotsDao->getApartmentSpots($this->apartmentId);
     $apartmentParkingSpots = [];
     if ($apartmentSpots->count()) {
         foreach ($apartmentSpots as $apartmentSpot) {
             array_push($apartmentParkingSpots, $apartmentSpot['spot_id']);
         }
     }
     $form = new DetailsForm('apartment_details', $formOptions);
     $form->prepare();
     $details['lock_id'] = $lockId;
     $form->populateValues($details);
     // set form type and template
     $formTemplate = 'form-templates/details';
     $router = $this->getEvent()->getRouter();
     $editKiDirectTypeTextlineLink = $router->assemble(['controller' => 'translation', 'action' => 'editkidirectentry', 'id' => $this->apartmentId], ['name' => 'backoffice/default']);
     // get apartment usage information
     $apartmentUsage = $texlineApartmentDao->getApartmentUsageByApartmentId($this->apartmentId);
     // get building usage information
     $apartmentBuildingUsage = $texlineApartmentDao->getApartmentBuildingUsageByApartmentId($this->apartmentId);
     // get building facilities information
     $apartmentBuildingFacility = $texlineApartmentDao->getApartmentBuildingFacilityByApartmentId($this->apartmentId);
     // get building policy information
     $apartmentBuildingPolicy = $texlineApartmentDao->getApartmentBuildingPolicyByApartmentId($this->apartmentId);
     $buildingDirectEntryTextline = $texlineApartmentDao->getBuildingDirectEntryTextline($this->apartmentId);
     // passing form and map to the view
     $viewModelForm = new \Zend\View\Model\ViewModel();
     $viewModelForm->setVariables(['form' => $form, 'apartmentUsage' => $apartmentUsage, 'apartmentBuildingUsage' => $apartmentBuildingUsage, 'apartmentBuildingFacility' => $apartmentBuildingFacility, 'apartmentBuildingPolicy' => $apartmentBuildingPolicy, 'buildingDirectEntryTextline' => $buildingDirectEntryTextline, 'editKiDirectEntryTypeLink' => $editKiDirectTypeTextlineLink, 'furnitureList' => $furnitureList, 'amenitiesList' => $amenitiesList, 'apartmentAmenities' => $apartmentAmenities, 'furnitureTypes' => $furnitureTypes, 'apartmentId' => $this->apartmentId, 'apartmentStatus' => $this->apartmentStatus, 'roomId' => $roomId, 'accCurrency' => $accCurrency, 'facilities' => $facilities]);
     $viewModelForm->setTemplate($formTemplate);
     $viewModel = new \Zend\View\Model\ViewModel();
     $viewModel->setVariables(['apartmentId' => $this->apartmentId, 'apartmentStatus' => $this->apartmentStatus, 'apartmentParkingSpots' => $apartmentParkingSpots, 'parkingLotIsVirtualStatus' => $parkingLotData ? $parkingLotData->isVirtual() : false]);
     // child view to render form
     $viewModel->addChild($viewModelForm, 'formOutput');
     $viewModel->setTemplate('apartment/details/index');
     return $viewModel;
 }