本文整理汇总了PHP中Apartment::getI18nTypesArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Apartment::getI18nTypesArray方法的具体用法?PHP Apartment::getI18nTypesArray怎么用?PHP Apartment::getI18nTypesArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Apartment
的用法示例。
在下文中一共展示了Apartment::getI18nTypesArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionMainform
public function actionMainform($isFancy = 0)
{
$model = new SimpleformModel();
$model->scenario = 'forrent';
if (isset($_POST['SimpleformModel']) && BlockIp::checkAllowIp(Yii::app()->controller->currentUserIpLong)) {
$request = Yii::app()->request;
$isForBuy = $request->getPost('isForBuy', 0);
$model->attributes = $_POST['SimpleformModel'];
if ($isForBuy) {
$model->scenario = 'forbuy';
}
if ($model->validate()) {
if (!$isForBuy) {
$model->time_inVal = $this->getI18nTimeIn($model->time_in);
$model->time_outVal = $this->getI18nTimeOut($model->time_out);
}
$types = Apartment::getI18nTypesArray();
$model->type = $types[$model->type];
$notifier = new Notifier();
if (!$isForBuy) {
$notifier->raiseEvent('onNewSimpleBookingForRent', $model);
} else {
$notifier->raiseEvent('onNewSimpleBookingForBuy', $model);
}
Yii::app()->user->setFlash('success', tt('Operation successfully complete. Your order will be reviewed by administrator.'));
}
}
$user = null;
if (!Yii::app()->user->isGuest) {
$user = User::model()->findByPk(Yii::app()->user->getId());
}
$type = Apartment::getTypesWantArray();
if ($isFancy) {
$this->excludeJs();
$this->renderPartial('simpleform', array('model' => $model, 'type' => $type, 'user' => $user, 'isFancy' => true), false, true);
} else {
$this->render('simpleform', array('model' => $model, 'type' => $type, 'user' => $user, 'isFancy' => false));
}
}
示例2: actionBookingform
public function actionBookingform($isFancy = 0)
{
Yii::app()->getModule('apartments');
$this->modelName = 'Apartment';
$apartment = $this->loadModel();
$this->modelName = 'Booking';
$booking = new Booking();
$booking->scenario = 'bookingform';
if (isset($_POST['Booking'])) {
$booking->attributes = $_POST['Booking'];
$booking->apartment_id = $apartment->id;
if ($booking->validate()) {
$booking->time_inVal = $this->getI18nTimeIn($booking->time_in);
$booking->time_outVal = $this->getI18nTimeOut($booking->time_out);
if (issetModule('bookingtable')) {
Bookingtable::addRecord($booking);
}
$notifier = new Notifier();
$types = Apartment::getI18nTypesArray();
$booking->type = $types[Apartment::TYPE_RENTING];
$ownerApartment = User::model()->findByPk($apartment->owner_id);
$booking->ownerEmail = $ownerApartment->email;
$notifier->raiseEvent('onNewBooking', $booking, array('user' => $ownerApartment));
Yii::app()->user->setFlash('success', tt('Operation successfully complete. Your order will be reviewed by owner.'));
$this->redirect($apartment->getUrl());
}
}
$user = null;
if (!Yii::app()->user->isGuest) {
$user = User::model()->findByPk(Yii::app()->user->getId());
}
if ($isFancy) {
$this->excludeJs();
$this->renderPartial('bookingform', array('apartment' => $apartment, 'model' => $booking, 'isFancy' => true, 'user' => $user), false, true);
} else {
$this->render('bookingform', array('apartment' => $apartment, 'model' => $booking, 'isFancy' => false, 'user' => $user));
}
}