本文整理汇总了PHP中Booking::getYiiDateFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP Booking::getYiiDateFormat方法的具体用法?PHP Booking::getYiiDateFormat怎么用?PHP Booking::getYiiDateFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Booking
的用法示例。
在下文中一共展示了Booking::getYiiDateFormat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: myDateValidator
public function myDateValidator($param)
{
$dateStart = CDateTimeParser::parse($this->date_start, Booking::getYiiDateFormat());
// format to unix timestamp
$dateEnd = CDateTimeParser::parse($this->date_end, Booking::getYiiDateFormat());
// format to unix timestamp
if ($param == 'date_start' && $dateStart < CDateTimeParser::parse(date('Y-m-d'), 'yyyy-MM-dd')) {
$this->addError('date_start', tt('Wrong check-in date', 'booking'));
}
if ($param == 'date_end' && $dateEnd <= $dateStart) {
$this->addError('date_end', tt('Wrong check-out date', 'booking'));
}
}
示例2: actionMainsearch
public function actionMainsearch($rss = null)
{
$countAjax = Yii::app()->request->getParam('countAjax');
$href = Yii::app()->getBaseUrl(true) . '/' . Yii::app()->request->getPathInfo();
Yii::app()->clientScript->registerLinkTag('canonical', null, $href);
unset($href);
if (Yii::app()->request->getParam('currency')) {
setCurrency();
$this->redirect(array('mainsearch'));
}
$criteria = new CDbCriteria();
$criteria->addCondition('t.active = ' . Apartment::STATUS_ACTIVE);
$criteria->addCondition('t.deleted = 0');
if (param('useUserads')) {
$criteria->addCondition('t.owner_active = ' . Apartment::STATUS_ACTIVE);
}
$criteria->addInCondition('t.type', Apartment::availableApTypesIds());
$criteria->addInCondition('t.price_type', array_keys(Apartment::getPriceArray(Apartment::PRICE_SALE, true)));
$this->sApId = (int) Yii::app()->request->getParam('sApId');
if ($this->sApId) {
$criteria->addCondition('id = :sApId');
$criteria->params[':sApId'] = $this->sApId;
$apCount = Apartment::model()->count($criteria);
if ($countAjax && Yii::app()->request->isAjaxRequest) {
$this->echoAjaxCount($apCount);
}
if ($apCount) {
$apartmentModel = Apartment::model()->findByPk($this->sApId);
Yii::app()->controller->redirect($apartmentModel->getUrl());
Yii::app()->end();
}
}
// rooms
if (issetModule('selecttoslider') && param('useRoomSlider') == 1) {
$roomsMin = Yii::app()->request->getParam('room_min');
$roomsMax = Yii::app()->request->getParam('room_max');
if ($roomsMin || $roomsMax) {
$criteria->addCondition('num_of_rooms >= :roomsMin AND num_of_rooms <= :roomsMax');
$criteria->params[':roomsMin'] = $roomsMin;
$criteria->params[':roomsMax'] = $roomsMax;
$this->roomsCountMin = $roomsMin;
$this->roomsCountMax = $roomsMax;
}
} else {
$rooms = Yii::app()->request->getParam('rooms');
if ($rooms) {
if ($rooms == 4) {
$criteria->addCondition('num_of_rooms >= :rooms');
} else {
$criteria->addCondition('num_of_rooms = :rooms');
}
$criteria->params[':rooms'] = $rooms;
$this->roomsCount = $rooms;
}
}
$this->bStart = Yii::app()->request->getParam('b_start');
$this->bEnd = Yii::app()->request->getParam('b_end');
if ($this->bStart) {
$dateStart = Yii::app()->dateFormatter->format('yyyy-MM-dd', CDateTimeParser::parse($this->bStart, Booking::getYiiDateFormat()));
if ($this->bEnd) {
$dateEnd = Yii::app()->dateFormatter->format('yyyy-MM-dd', CDateTimeParser::parse($this->bEnd, Booking::getYiiDateFormat()));
} else {
$dateEnd = $dateStart;
}
if ($dateStart && $dateEnd) {
$criteria->addCondition('t.id NOT IN (
SELECT DISTINCT b.apartment_id
FROM {{booking_calendar}} AS b
WHERE b.date_start BETWEEN :b_start AND :b_end
OR :b_start BETWEEN b.date_start AND b.date_end
)');
$criteria->params['b_start'] = $dateStart;
$criteria->params['b_end'] = $dateEnd;
}
}
// floor
if (issetModule('selecttoslider') && param('useFloorSlider') == 1) {
$floorMin = Yii::app()->request->getParam('floor_min');
$floorMax = Yii::app()->request->getParam('floor_max');
if ($floorMin || $floorMax) {
$criteria->addCondition('floor >= :floorMin AND floor <= :floorMax');
$criteria->params[':floorMin'] = $floorMin;
$criteria->params[':floorMax'] = $floorMax;
$this->floorCountMin = $floorMin;
$this->floorCountMax = $floorMax;
}
} else {
$floor = Yii::app()->request->getParam('floor');
if ($floor) {
$criteria->addCondition('floor = :floor');
$criteria->params[':floor'] = $floor;
$this->floorCount = $floor;
}
}
// square
if (issetModule('selecttoslider') && param('useSquareSlider') == 1) {
$squareMin = Yii::app()->request->getParam('square_min');
$squareMax = Yii::app()->request->getParam('square_max');
if ($squareMin || $squareMax) {
$criteria->addCondition('square >= :squareMin AND square <= :squareMax');
//.........这里部分代码省略.........
示例3: addRecord
public static function addRecord(Booking $booking)
{
$dateStart = Yii::app()->dateFormatter->format('yyyy-MM-dd', CDateTimeParser::parse($booking->date_start, Booking::getYiiDateFormat()));
$dateEnd = Yii::app()->dateFormatter->format('yyyy-MM-dd', CDateTimeParser::parse($booking->date_end, Booking::getYiiDateFormat()));
$model = new Bookingtable();
$model->active = self::STATUS_NEW;
$model->apartment_id = $booking->apartment_id;
$model->username = $booking->username;
$model->email = $booking->useremail;
$model->phone = $booking->phone;
$model->date_start = $dateStart;
$model->date_end = $dateEnd;
$model->time_in = $booking->time_in;
$model->time_out = $booking->time_out;
$model->comment = $booking->comment;
$model->user_ip = $booking->user_ip;
$model->user_ip_ip2_long = $booking->user_ip_ip2_long;
$model->save(false);
}