本文整理汇总了PHP中Property::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Property::get方法的具体用法?PHP Property::get怎么用?PHP Property::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Property
的用法示例。
在下文中一共展示了Property::get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
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;
}
示例2: index
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);
}
示例3: function
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();
示例4: FeaturedProperties
public function FeaturedProperties()
{
return Property::get()->filter(array('FeaturedOnHomepage' => true))->limit(6);
}
示例5: FeaturedProperty
public function FeaturedProperty()
{
return Property::get()->filter(array('FeaturedOnHomepage' => true))->limit(6)->sort('Created', 'DESC');
}
示例6: removeprop
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');
}
}
}