コード例 #1
0
 /**
  * Insert city if not found and has correct district, otherwise return id.  Return -1 for incorrect district
  */
 public static function insertIfNotFound($cityName, $province_id, $district_id = null)
 {
     if (!$cityName) {
         return false;
     }
     if ($district_id) {
         // verify district is in correct province
         require_once 'models/table/LocationDistrict.php';
         if (LocationDistrict::validateDistrict($district_id, $province_id) !== true) {
             return -1;
         }
     }
     $cityTable = new LocationCity();
     $select = $cityTable->select()->from($cityTable->_name, "id")->where("city_name = '{$cityName}' AND parent_province_id = {$province_id}");
     if ($district_id) {
         $select->where("parent_district_id = {$district_id}");
     }
     $row = $cityTable->fetchRow($select);
     if ($row) {
         return $row->id;
     } else {
         // insert
         $data = array();
         $data['city_name'] = $cityName;
         $data['parent_district_id'] = $district_id;
         $data['parent_province_id'] = $province_id;
         return $cityTable->insert($data);
     }
 }
コード例 #2
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');
 }
コード例 #3
0
ファイル: XMLFeedItem.php プロジェクト: barricade86/raui
 public static function generateLists()
 {
     return array('types' => array('покупка' => Apartment::TYPE_BUY, 'обмен' => Apartment::TYPE_CHANGE, 'съем' => Apartment::TYPE_RENT, 'сдача' => Apartment::TYPE_RENTING, 'продажа' => Apartment::TYPE_SALE), 'category' => CHtml::listData(ApartmentObjType::model()->findAll(), 'name_ru', 'id'), 'location_city' => CHtml::listData(LocationCity::model()->findAll(), 'name_ru', 'id'), 'window_view' => CHtml::listData(WindowTo::model()->findAll(), 'title_ru', 'id'));
 }
コード例 #4
0
ファイル: rentorders.php プロジェクト: barricade86/raui
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>
                            </div>
                            <div class="block-3">
                                <div class="col-1">
                                    <img src="<?php 
コード例 #5
0
ファイル: negatives.php プロジェクト: barricade86/raui
                                            Смотреть фото<br>
                                            <a href="#" class="objectPhoto lookPhoto">
                                                <?php 
        echo $negative->count_img;
        ?>
 фото</a>
                                        <?php 
    } else {
        ?>
                                            <div class="objectPhoto noPhoto"></div>
                                            <?php 
    }
    ?>
                                    </div></td>
                                <td><?php 
    echo LocationCity::getCities()[$negative->loc_city] . '.' . $negative->address_ru;
    ?>
</td>
                                <td><?php 
    echo 'Общая:' . $negative->square . 'м2 Кухня:' . $negative->ci_square . 'м2';
    ?>
</td>
                                <td>До 30 000 р. Предоплата 1 месяц Аренда от года</td>
                                <td>100% агенту</td>
                                <td><?php 
    echo $negative->floor . '/' . $negative->floor_total;
    ?>
</td>
                                <td>мебель холодильник стир. машина балкон евроремонт</td>
                                <td><div > <a href="#" class="lookContact"></a> показать </div></td>
                                <td><table width="100%" border="0" cellspacing="0">
コード例 #6
0
ファイル: clients.php プロジェクト: barricade86/raui
                            </tr>
                            <?php 
foreach ($rentorders as $rentorder) {
    ?>
                            <tr>
                                <td><img class="star-mark" src="<?php 
    echo Yii::app()->theme->baseUrl . '/views/modules/usercpanel/images/content/star-mark.png';
    ?>
" width="15" height="15" alt=""/></td>
                                <td><div class="tableObject">
                                    <?php 
    echo $rentorder->numOfRooms . '-к ' . ApartmentObjType::getApartmentObjects()[$rentorder->objTypeId];
    ?>
                                </td>
                                <td><?php 
    echo LocationCity::getCities()[$rentorder->loc_city_id] . ',' . $rentorder->stationName;
    ?>
                                </td>
                                <td><?php 
    echo 'Общая:' . $rentorder->square . 'м2 Кухня:' . $rentorder->squareKitchen . 'м2';
    ?>
</td>
                                <td>
                                    <?php 
    echo $rentorder->price . ($rentorder->moneyType == 1 ? 'р.' : '$') . "<br>" . ApartmentsRents::getStrLabels($rentorder->searchRequirements);
    ?>
                                </td>
                                <td>Не важно</td>
                                <td><?php 
    echo !($rentorder->objTypeId == 4 || $rentorder->objTypeId == 19) ? $rentorder->floor . '/' . $rentorder->numOfFloors : $rentorder->numOfFloors;
    ?>
コード例 #7
0
ファイル: index.php プロジェクト: barricade86/raui
                                    <a href="#" class="objectPhoto lookPhoto">
                                        <?php 
        echo $rentorder->count_img;
        ?>
 фото</a>
                                <?php 
    } else {
        ?>
                                    <div class="objectPhoto noPhoto"></div>
                                    <?php 
    }
    ?>
                            </div>
                        </td>
                        <td><?php 
    echo LocationCity::getCities()[$rentorder->loc_city] . '.' . $rentorder->address_ru;
    ?>
</td>
                        <td>Общая:<?php 
    echo $rentorder->square;
    ?>
м2 Кухня: <?php 
    echo $rentorder->ci_square;
    ?>
м2
                        </td>
                        <td><?php 
    echo $rentorder->price . ($rentorder->moneyType == 1 ? 'р.' : '$');
    ?>
 р. Предоплата 1 месяц Аренда от года</td>
                        <td><?php