コード例 #1
0
ファイル: MainController.php プロジェクト: barricade86/raui
 public function actionPlaceorder()
 {
     $country = Yii::app()->request->getParam('country');
     $region = Yii::app()->request->getParam('region');
     $objType = Yii::app()->request->getParam('objType');
     $city = Yii::app()->request->getParam('city');
     $price = !is_null(Yii::app()->request->getParam('price')) ? Yii::app()->request->getParam('price') : 0;
     $pricePoa = $price == 0 ? 1 : 0;
     $numOfRooms = !is_null(Yii::app()->request->getParam('numOfRooms')) ? Yii::app()->request->getParam('numOfRooms') : 1;
     $square = !($objType == 4 || $objType == 19) ? Yii::app()->request->getParam('square') : Yii::app()->request->getParam('squareOther');
     $squareLive = !($objType == 4 || $objType == 19) ? Yii::app()->request->getParam('squareLive') : Yii::app()->request->getParam('squareLiveOther');
     $squareKitchen = !($objType == 4 || $objType == 19) ? Yii::app()->request->getParam('squareKitchen') : Yii::app()->request->getParam('squareKitchenOther');
     $floorTotal = !($objType == 4 || $objType == 19) ? Yii::app()->request->getParam('numOfFloors') : Yii::app()->request->getParam('numOfFloorsOther');
     $floor = Yii::app()->request->getParam('floor');
     $roomFormula = !($objType == 4 || $objType == 19) ? Yii::app()->request->getParam('roomFormula') : Yii::app()->request->getParam('roomFormulaOther');
     $windowTo = !($objType == 4 || $objType == 19) ? Yii::app()->request->getParam('window') : Yii::app()->request->getParam('windowOther');
     $apType = Yii::app()->request->getParam('renttype') ? Yii::app()->request->getParam('renttype') : 1;
     $moneyType = Yii::app()->request->getParam('moneyType');
     if (Yii::app()->request->getParam('renttype') == 2) {
         $apType = 2;
     }
     $streetName = Yii::app()->request->getParam('street');
     $metro = Yii::app()->request->getParam('metro');
     $date = new \DateTime();
     $createDate = $date->format('Y-m-d H:i:s');
     $howLong = Yii::app()->request->getParam('rentlimit') ? Yii::app()->request->getParam('rentlimit') : 3;
     $limitDate = $date->add(new \DateInterval('P' . $howLong . 'D'))->format('Y-m-d');
     $objectDescription = Yii::app()->request->getParam('additional');
     $agentbonus = Yii::app()->request->getParam('agentbonus');
     $clientbonus = Yii::app()->request->getParam('clientbonus');
     $conditions = Yii::app()->request->getParam('condition');
     $elevatorPass = Yii::app()->request->getParam('elevatorPass');
     $elevatorCargo = Yii::app()->request->getParam('elevatorCargo');
     $buildingType = !($objType == 4 || $objType == 19) ? Yii::app()->request->getParam('buildingType') : Yii::app()->request->getParam('buildingTypeOther');
     $floorType = !($objType == 4 || $objType == 19) ? Yii::app()->request->getParam('floorType') : Yii::app()->request->getParam('floorTypeOther');
     $facingType = !($objType == 4 || $objType == 19) ? Yii::app()->request->getParam('facingtype') : Yii::app()->request->getParam('facingtypeOther');
     $balcony = !($objType == 4 || $objType == 19) ? Yii::app()->request->getParam('balcony') : Yii::app()->request->getParam('balconyOther');
     $closet = !($objType == 4 || $objType == 19) ? Yii::app()->request->getParam('closet') : Yii::app()->request->getParam('closetOther');
     $floorsHeight = Yii::app()->request->getParam('floorsHeight');
     $bedrooms = Yii::app()->request->getParam('bedrooms');
     $bathrooms = Yii::app()->request->getParam('bathrooms');
     $pools = Yii::app()->request->getParam('pools');
     $water = Yii::app()->request->getParam('water');
     $center = Yii::app()->request->getParam('citycenter');
     $mountains = Yii::app()->request->getParam('mountains');
     $address = LocationCountry::getAllCountries()[$country] . "," . LocationRegion::getAllRegions()[$region] . "," . LocationCity::getCities()[$city];
     if (!is_null($metro)) {
         $address .= $metro;
     }
     if (!is_null($streetName)) {
         $address .= $streetName;
     }
     $lat = Apartment::model()->getCoordinates($address)[0];
     $lng = Apartment::model()->getCoordinates($address)[1];
     $command = Yii::app()->db->createCommand();
     $params = ['type' => $apType, 'obj_type_id' => $objType, 'loc_country' => $country, 'loc_region' => $region, 'loc_city' => $city, 'city_id' => 0, 'visits' => 0, 'date_updated' => $createDate, 'date_created' => $createDate, 'date_end_activity' => $limitDate, 'activity_always' => 1, 'is_price_poa' => $pricePoa, 'price' => $price, 'price_to' => 0, 'num_of_rooms' => $numOfRooms, 'floor' => $floor, 'floor_total' => $floorTotal, 'square' => $square, 'live_square' => $squareLive, 'land_square' => 0, 'ci_square' => $squareKitchen, 'squareFormula' => $roomFormula, 'window_to' => $windowTo, 'title_ru' => LocationCity::getCities()[$city] . ',' . $streetName, 'description_ru' => $objectDescription, 'description_near_ru' => $objectDescription, 'living_conditions' => 0, 'services' => 0, 'address_ru' => $streetName, 'berths' => 0, 'active' => 1, 'lat' => $lat, 'lng' => $lng, 'rating' => 0, 'date_up_search' => $createDate, 'is_special_offer' => 0, 'is_free_to' => $limitDate, 'price_type' => 1, 'sorter' => 1, 'owner_active' => 1, 'owner_id' => Yii::app()->user->id, 'exchange_to_ru' => 'exchange_not_available', 'note' => 'just note', 'phone' => Yii::app()->user->phone, 'autoVKPostId' => 'no', 'autoFBPostId' => 'no', 'autoTwitterPostId' => 'no', 'count_img' => 0, 'deleted' => 0, 'metro' => $metro, 'agentbonus' => $agentbonus, 'clientbonus' => $clientbonus, 'elevatorPass' => $elevatorPass, 'elevatorCargo' => $elevatorCargo, 'buildingType' => $buildingType, 'floorType' => $floorsHeight, 'floors' => $floorType, 'facingType' => $facingType, 'balcony' => $balcony, 'closet' => $closet, 'bedrooms' => $bedrooms, 'bathrooms' => $bathrooms, 'pools' => $pools, 'waterNear' => $water, 'centerNear' => $center, 'mountainsNear' => $mountains, 'moneyType' => $moneyType];
     $command->insert('bt_apartment', $params);
     $apartmentId = Yii::app()->db->getLastInsertID();
     foreach ($conditions as $key => $value) {
         $paramsList = ['apartment_id' => $apartmentId, 'conditionname' => $key];
         $command->insert('bt_apartments_conditions', $paramsList);
     }
     $this->redirect('/usercpanel/main/rentorders');
 }
コード例 #2
0
ファイル: rentorders.php プロジェクト: barricade86/raui
                            </div>
                            <div class="block-2">
                                <div class="col-1">
                                    <img src="<?php 
echo Yii::app()->theme->baseUrl . '/images/content/col_1_addres.png';
?>
">
                                </div>
                                <div class="col-2">
                                    <?php 
$selectedCountryIndex = LocationCountry::getAllCountries()[0];
echo CHtml::dropDownList('country', $select, LocationCountry::getAllCountries(), ['class' => 'long-select', 'options' => [$selectedCoutryIndex => ['selected' => 'selected']]]);
?>
                                    <?php 
$selectedRegionIndex = LocationRegion::getAllRegions()[0];
echo CHtml::dropDownList('region', $select, LocationRegion::getAllRegions(), ['class' => 'long-select', 'options' => [$selectedRegionIndex => ['selected' => 'selected']]]);
?>
                                    <?php 
$selectedCityIndex = LocationCity::getCities()[0];
echo CHtml::dropDownList('city', $select, LocationCity::getCities(), ['class' => 'long-select', 'options' => [$selectedCityIndex => ['selected' => 'selected']]]);
?>
                                    <select class="long-select" name="streetname">
                                        <option>Авиамоторная улица</option>
                                    </select>
                                    <select class="long-select">
                                        <option>12</option>
                                    </select>
                                </div>
                                <div class="col-3">
                                    <div class="map-search"></div>
                                </div>