public function pageAction()
 {
     $this->init();
     //Get the params
     $arcId = $this->params('arc');
     $pageUrl = $this->params('pageUrl');
     //Get the current arc
     $arc = new \ATPComic\Model\Arc();
     $arc->loadByUrl($arcId);
     //Get the current page
     $page = new \ATPComic\Model\Page();
     $page->loadByUrl($pageUrl);
     //Make sure the page is active
     if (!$page->isActive) {
         $this->getResponse()->setStatusCode(404);
         return;
     }
     //Get the arc/page node
     $node = new \ATPComic\Model\Node($arc, $page);
     //Save the current page in the session
     $this->remember->currentComicPage = $node->id;
     $view = new \Zend\View\Model\ViewModel();
     $view->node = $node;
     //Create the page widget
     $comicPage = new \ATPComic\View\Widget\Page();
     $comicPage->node = $node;
     $view->addChild($comicPage, 'comicPage');
     return $view;
 }
 /**
  * @param MvcEvent $event
  *
  * @return parent::onDispatch
  */
 public function onDispatch(MvcEvent $event)
 {
     $request = $event->getRequest();
     $remoteAddr = $request->getServer('REMOTE_ADDR');
     // check IP address is allowed
     $application = $event->getApplication();
     $config = $application->getConfig();
     $autoDeployConfig = $config['auto_deploy'];
     $allowedIpAddresses = $autoDeployConfig['ipAddresses'];
     // error if ip is not allowed
     if (!in_array($remoteAddr, $allowedIpAddresses, true)) {
         $baseModel = new \Zend\View\Model\ViewModel();
         $baseModel->setTemplate('layout/output');
         $model = new \Zend\View\Model\ViewModel();
         $model->setTemplate('error/403');
         $baseModel->addChild($model);
         $baseModel->setTerminal(true);
         $event->setViewModel($baseModel);
         $response = $event->getResponse();
         $response->setStatusCode(403);
         $response->sendHeaders();
         $event->setResponse($response);
         exit;
     }
     return parent::onDispatch($event);
 }
 public function indexAction()
 {
     $this->noCache();
     $view = new \Zend\View\Model\ViewModel();
     $field = new \ATPContact\Model\Field();
     $view->fields = $field->loadMultiple(array('orderBy' => 'sort_order ASC'));
     $view->addChild(new \ATPCore\View\Widget\FlashWidget($this->flashMessenger()), 'flash');
     return $view;
 }
 public function categoryAction()
 {
     $this->init();
     $catUrl = $this->params('id');
     $category = new \ATPCms\Model\Category();
     $category->loadByUrl($catUrl);
     if (!$category->id) {
         $this->getResponse()->setStatusCode(404);
         return;
     }
     //Create the view
     $view = new \Zend\View\Model\ViewModel();
     $view->category = $category;
     //Create post list widget
     $posts = new \ATPCms\View\Widget\MostRecentPost();
     $posts->category = $category;
     $posts->postCount = 0;
     $view->addChild($posts, 'posts');
     return $view;
 }
 /** Nested file */
 public function homeAction()
 {
     /** Tao view chính */
     $view = new \Zend\View\Model\ViewModel();
     $view->setTemplate('mvc\\view-manager\\home');
     /** Tạo view header => là con của home */
     $headerView = new \Zend\View\Model\ViewModel(array('headerContent' => 'header Content'));
     $headerView->setTemplate('mvc\\view-manager\\header');
     /** Tạo view mainContent => là con của home */
     $mainContentView = new \Zend\View\Model\ViewModel();
     $mainContentView->setTemplate('mvc\\view-manager\\main-content');
     /** Tạo view leftContent => là con của mainContent */
     $leftContentView = new \Zend\View\Model\ViewModel();
     $leftContentView->setTemplate('mvc\\view-manager\\left-content');
     $mainContentView->addChild($leftContentView, 'leftContentView');
     /** Tạo view rightContent => là con của mainContent */
     $rightContentView = new \Zend\View\Model\ViewModel(array('right_abc' => 'right', 'right-abc' => 'sdasdas_xxxxxxxxx'));
     $rightContentView->setTemplate('mvc\\view-manager\\right-content');
     $mainContentView->addChild($rightContentView, 'rightContentView');
     $view->addChild($headerView, 'headerView')->addChild($mainContentView, 'mainContentView');
     return $view;
 }
Exemple #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;
 }
Exemple #7
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;
 }