public static function getTopPrioritiesInternational($excludeCityId = '', $count = '', $metroOnly = true) { $dependencyState = new CDbCacheDependency('SELECT MAX(updated_time) FROM geo_state'); $india = GeoCountryApi::getCountryByName('india'); if ($india) { $stateModels = GeoState::model()->cache(1000, $dependencyState)->findAll('country_id!=:countryId', array(':countryId' => $india->id)); if (empty($stateModels)) { return false; } foreach ($stateModels as $state) { $states[] = $state->id; } $criteria = new CDbCriteria(); $criteria->addInCondition('state_id', $states); if ($metroOnly) { $criteria->addCondition('metro=1'); } if ($count) { $criteria->limit = $count; } if ($excludeCityId) { //$criteria->addCondition('id=!id',array(':id'=>$excludeCityId)); $criteria->addCondition("id!={$excludeCityId}"); } $criteria->order = 'priority ASC'; $dependencyCity = new CDbCacheDependency('SELECT MAX(updated_time) FROM geo_city'); $cities = GeoCity::model()->cache(1000, $dependencyCity)->findAll($criteria); if (!empty($cities)) { return $cities; } else { return false; } } }
public static function getStatesId($state) { if ($state) { $model = GeoState::model()->findAll('SELECT id from GeoCity where id IN :b', array(':b' => $state)); return $model; } else { return ''; } }
public static function getList($country_id) { $model = GeoState::model()->findAll('country_id=:country_id', array(':country_id' => $country_id)); $stateList = null; foreach ($model as $state) { $stateList[$state->id] = $state->state; } return $stateList; }
public static function getAddressByLocalityId($localityId) { $address[] = ""; $locality = GeoLocality::model()->findByPk($localityId); if ($locality) { $address['locality'] = $locality->locality; $city = GeoCity::model()->findByPk($locality->city_id); $address['city'] = $city->city; $state = GeoState::model()->findByPk($city->state_id); $address['state'] = $state->state; $country = GeoCountry::model()->findByPk($state->country_id); $address['country'] = $country->country; return $address; } else { return false; } }
<li class="error_message"><?php echo $form->error($model, 'project_type_id'); ?> </li> </ul> </fieldset> <fieldset><legend>Location</legend> <ul> <li><span><?php echo $form->labelEx($model, 'state_id'); ?> </span> <?php echo $form->dropdownList($model, 'state_id', CHtml::listData(GeoState::model()->findAll(), 'id', 'state'), array('empty' => 'All', 'class' => 'slctbox', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('/location/city/getList/page/project'), 'update' => '#city_content', 'data' => 'js:jQuery(this).serialize()'))); ?> </li> <li class="error_message"><?php echo $form->error($model, 'state_id'); ?> </li> </ul> <div id="city_content"> <ul> <li><span><?php echo $form->labelEx($model, 'city_id'); ?>
return false; } } </script><script type="text/javascript"> function fnrentcityid(){ var var1=document.getElementById('geo_city_rent').value; if(var1==""){ alert("Select the City"); document.getElementById('geo_city_rent').focus(); return false; } } </script> <?php $stateList = CHtml::listData(GeoState::model()->findAll(), 'id', 'state'); $cityList = CHtml::listData(GeoCity::model()->with('state')->findAll(), 'id', 'city', 'state.state'); $propertyType = CHtml::listData(PropertyTypes::model()->findAll(), 'id', 'property_type'); ?> <div class="home-search-cntr"> <div class="tabs3"> <ul class="tabNavigation3 left"> <li class="search-tab-top"><a href="#searchtab1" class="selected">Buy</a></li> <li class="search-tab-mid"><a href="#searchtab2">Rent In / Lease</a></li> <li class="search-tab-mid"><a href="#searchtab3">Sell / Rent Out</a></li> <li class="search-tab-bot"><a href="#searchtab4">WF Specialist</a></li> </ul> <div id="searchtab1" class="right" style="display: block; "> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'buy', 'enableAjaxValidation' => false, 'action' => $this->buyurl, 'htmlOptions' => array('name' => 'thisProperty')));
echo $form->dropdownList($profilesModel, 'country_id', CHtml::listData(GeoCountry::model()->findAll(), 'id', 'country'), array('empty' => 'Select', 'class' => 'slctbox', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('/location/state/getList/page/register'), 'update' => '#state_content', 'data' => 'js:jQuery(this).serialize()'))); ?> </li> <li class="error_message"><?php echo $form->error($profilesModel, 'country_id'); ?> </li> </ul> <div id="state_content" class="pad10"><ul> <li><span><?php echo $form->label($profilesModel, 'state_id'); ?> <span class="required">*</span></span></li> <li> <?php echo $form->dropdownList($profilesModel, 'state_id', CHtml::listData(GeoState::model()->findAll('country_id=:country_id', array(':country_id' => $profilesModel->country_id)), 'id', 'state'), array('empty' => 'Select', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('/location/city/getList/page/register'), 'update' => '#city_content', 'data' => 'js:jQuery(this).serialize()'))); ?> </li> <li class="error_message"><?php echo $form->error($profilesModel, 'state_id'); ?> </li> </ul> <div id="city_content" class="pad10"> <ul> <li><span><?php echo $form->label($profilesModel, 'city_id'); ?> <span class="required">*</span></span></li> <li> <?php
if(var1==""){ alert("Select the City"); document.getElementById('GeoCity_city_property').focus(); return false; } } </script> <?php $modelProperty = new Property(); $modelCity = new GeoCity(); $modelState = new GeoState(); $modelProfile = new UserProfiles(); $modelRequirement = new Requirement(); $specializations = new Specializations(); $stateCache = new CDbCacheDependency('SELECT MAX(updated_time) FROM geo_state'); $stateList = CHtml::listData(GeoState::model()->cache(1000, $stateCache)->findAll(), 'id', 'state'); $propertyTypeList = CHtml::listData(PropertyTypes::model()->with('category')->findAll(), 'id', 'property_type', 'category.category'); $cityCache = new CDbCacheDependency('SELECT MAX(updated_time) FROM geo_city'); $cityList = CHtml::listData(GeoCity::model()->with('state')->cache(1000, $cityCache)->findAll(), 'id', 'city', 'state.state'); $specializationList = Specializations::model()->findAll(); if ($this->beginCache('topmenu', array('duration' => 0))) { ?> <div id="menu-part"> <div id="menu"> <ul> <li class="home-icon"><a href="<?php echo Yii::app()->homeUrl; ?> "> <img src="<?php echo Yii::app()->theme->baseUrl;
public static function getLocation($cityId) { $userModel = UserProfiles::model()->find('city_id=:cityId', array(':cityId' => $cityId)); $address[] = ""; if ($userModel) { $city = GeoCity::model()->findByPk($userModel->city_id); $address['city'] = $city ? $city->city : ""; $state = GeoState::model()->findByPk($city->state_id); $address['state'] = $state->state; $country = GeoCountry::model()->findByPk($state->country_id); $address['country'] = $country->country; return $address; } else { return false; } }
?> <?php echo $form->dropDownList($profilesModel, 'city', CHtml::listData(GeoCity::model()->findAll(), 'id', 'city'), array('empty' => 'Select')); ?> <?php echo $form->error($profilesModel, 'city'); ?> </div> <div class="row"> <?php echo $form->labelEx($profilesModel, 'state'); ?> <?php echo $form->dropDownList($profilesModel, 'city', CHtml::listData(GeoState::model()->findAll(), 'id', 'state'), array('empty' => 'Select')); ?> <?php echo $form->error($profilesModel, 'state'); ?> </div> <div class="row"> <?php echo $form->labelEx($profilesModel, 'zip'); ?> <?php echo $form->textField($profilesModel, 'zip'); ?> <?php echo $form->error($profilesModel, 'zip');
public static function getLocation($projectId) { $project = Projects::model()->findByPk($projectId); $address[] = ""; if ($project) { $locality = isset($_POST['GeoLocality']['locality_id']) ? $_POST['GeoLocality']['locality_id'] : ''; if ($locality) { $locality = GeoLocality::model()->findByPk($project->locality_id); $address['locality'] = $locality ? $locality->locality : ""; $city = GeoCity::model()->findByPk($locality->city_id); $address['city'] = $city->city; $state = GeoState::model()->findByPk($city->state_id); $address['state'] = $state->state; $country = GeoCountry::model()->findByPk($state->country_id); $address['country'] = $country->country; return $address; } } else { return false; } }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = GeoState::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public static function getLocationForSession($sessionProperty) { $locality = GeoLocality::model()->findByPk($sessionProperty['locality_id']); $address['locality'] = $locality ? $locality->locality : ""; $city = GeoCity::model()->findByPk($sessionProperty['city_id']); $address['city'] = $city->city; $state = GeoState::model()->findByPk($city->state_id); $address['state'] = $state->state; $country = GeoCountry::model()->findByPk($state->country_id); $address['country'] = $country->country; return $address; }