Beispiel #1
0
Route::get('regenerate', function () {
    $property = new Property();
    $props = $property->get()->toArray();
    $seq = new Sequence();
    foreach ($props as $p) {
        $_id = new MongoId($p['_id']);
        $nseq = $seq->getNewId('property');
        $sdata = array('sequence' => $nseq, 'propertyId' => Config::get('ia.property_id_prefix') . $nseq);
        if ($property->where('_id', '=', $_id)->update($sdata)) {
            print $p['_id'] . '->' . $sdata['propertyId'] . '<br />';
        }
    }
});
Route::get('tonumber', function () {
    $property = new Property();
    $props = $property->get()->toArray();
    $seq = new Sequence();
    foreach ($props as $p) {
        $_id = new MongoId($p['_id']);
        $price = new MongoInt32($p['listingPrice']);
        $fmv = new MongoInt32($p['FMV']);
        $sdata = array('listingPrice' => $price, 'FMV' => $fmv);
        if ($property->where('_id', '=', $_id)->update($sdata)) {
            print $p['_id'] . '->' . $sdata['listingPrice'] . '<br />';
        }
    }
});
Route::get('regeneratepic/{obj?}', function ($obj = null) {
    set_time_limit(0);
    if (is_null($obj)) {
        $product = new Product();
 public function FeaturedProperties()
 {
     return Property::get()->filter(array('FeaturedOnHomepage' => true))->limit(6);
 }
Beispiel #3
0
 public function FeaturedProperty()
 {
     return Property::get()->filter(array('FeaturedOnHomepage' => true))->limit(6)->sort('Created', 'DESC');
 }
 public function removeprop($propertyId)
 {
     if (!Owner::isAuthenticated()) {
         $this->redirect('/');
     } else {
         if ($property = Property::get(['id' => $propertyId])[0]) {
             $property->delete();
             Flash::set('message', 'You removed a property!');
             $this->redirect('/propertyowner/manage');
         } else {
             Flash::set('message', 'This property does not exist!');
             $this->redirect('/propertyowner/manage');
         }
     }
 }
 public function index(SS_HTTPRequest $request)
 {
     $properties = Property::get();
     if ($search = $request->getVar('Keywords')) {
         $properties = $properties->filter(array('Title:PartialMatch' => $search));
     }
     if ($arrival = $request->getVar('ArrivalDate')) {
         $arrivalStamp = strtotime($arrival);
         $nightAdder = '+' . $request->getVar('Nights') . ' days';
         $startDate = date('Y-m-d', $arrivalStamp);
         $endDate = date('Y-m-d', strtotime($nightAdder, $arrivalStamp));
         $properties = $properties->filter(array('AvailableStart:LessThanOrEqual' => $startDate, 'AvailableEnd:GreaterThanOrEqual' => $endDate));
     }
     if ($bedrooms = $request->getVar('Bedrooms')) {
         $properties = $properties->filter(array('Bedrooms:GreaterThanOrEqual' => $bedrooms));
     }
     if ($bathrooms = $request->getVar('Bathrooms')) {
         $properties = $properties->filter(array('Bathrooms:GreaterThanOrEqual' => $bathrooms));
     }
     if ($minPrice = $request->getVar('MinPrice')) {
         $properties = $properties->filter(array('PricePerNight:GreaterThanOrEqual' => $minPrice));
     }
     if ($maxPrice = $request->getVar('MaxPrice')) {
         $properties = $properties->filter(array('PricePerNight:LessThanOrEqual' => $maxPrice));
     }
     $paginatedProperties = PaginatedList::create($properties, $request)->setPageLength(15)->setPaginationGetVar('s');
     $data = array('Results' => $paginatedProperties);
     if ($request->isAjax()) {
         return $this->customise($data)->renderWith('PropertySearchResults');
     }
     return $data;
 }
 public function index(SS_HTTPRequest $request)
 {
     $properties = Property::get();
     $filters = ArrayList::create();
     if ($search = $request->getVar('Keywords')) {
         $filters->push(ArrayData::create(array('Label' => "Keywords: '{$search}'", 'RemoveLink' => HTTP::setGetVar('Keywords', null))));
         $properties = $properties->filter(array('Title:PartialMatch' => $search));
     }
     if ($arrival = $request->getVar('ArrivalDate')) {
         $arrivalStamp = strtotime($arrival);
         $nightAdder = '+' . $request->getVar('Nights') . ' days';
         $startDate = date('Y-m-d', $arrivalStamp);
         $endDate = date('Y-m-d', strtotime($nightAdder, $arrivalStamp));
         $properties = $properties->filter(array('AvailableStart:GreaterThanOrEqual' => $startDate, 'AvailableEnd:LessThanOrEqual' => $endDate));
     }
     if ($bedrooms = $request->getVar('Bedrooms')) {
         $filters->push(ArrayData::create(array('Label' => "{$bedrooms} bedrooms", 'RemoveLink' => HTTP::setGetVar('Bedrooms', null))));
         $properties = $properties->filter(array('Bedrooms:GreaterThanOrEqual' => $bedrooms));
     }
     if ($bathrooms = $request->getVar('Bathrooms')) {
         $filters->push(ArrayData::create(array('Label' => "{$bathrooms} bathrooms", 'RemoveLink' => HTTP::setGetVar('Bathrooms', null))));
         $properties = $properties->filter(array('Bathrooms:GreaterThanOrEqual' => $bathrooms));
     }
     if ($minPrice = $request->getVar('MinPrice')) {
         $filters->push(ArrayData::create(array('Label' => "Min. \${$minPrice}", 'RemoveLink' => HTTP::setGetVar('MinPrice', null))));
         $properties = $properties->filter(array('PricePerNight:GreaterThanOrEqual' => $minPrice));
     }
     if ($maxPrice = $request->getVar('MaxPrice')) {
         $filters->push(ArrayData::create(array('Label' => "Max. \${$maxPrice}", 'RemoveLink' => HTTP::setGetVar('MaxPrice', null))));
         $properties = $properties->filter(array('PricePerNight:LessThanOrEqual' => $maxPrice));
     }
     $paginatedProperties = PaginatedList::create($properties, $request)->setPageLength(15)->setPaginationGetVar('s');
     return array('Results' => $paginatedProperties, 'ActiveFilters' => $filters);
 }