protected function renderContent()
 {
     $propertySpotlight = PropertyApi::getFeaturedProperties(10, $this->location);
     $propertyImages = '';
     if ($propertySpotlight) {
         foreach ($propertySpotlight as $property) {
             $propertyIds[] = $property->id;
         }
         $propertyImages = PropertyImagesApi::getPrimaryImageForProperties($propertyIds);
     }
     $this->render('propertyspotlight', array('propertySpotlight' => $propertySpotlight, 'propertyImages' => $propertyImages));
 }
Exemple #2
0
	
}

</script>
<fieldset><legend>About Area &amp; Price</legend>
<ul>
	<li><span><label for="Property_description" class="required">Covered Area </label></span>
		<?php 
echo $form->textField($model, 'covered_area_from', array('class' => 'txtbox sml'));
?>
To
		<?php 
echo $form->textField($model, 'covered_area_to', array('class' => 'txtbox sml'));
?>
		<?php 
echo $form->dropDownList($model, 'covered_area_units', PropertyApi::getUnits('plot'), array('class' => 'slctbox sml'));
?>
	</li>
	<li class="error_message"><?php 
echo $form->error($model, 'covered_area_from');
?>
</li>
</ul>
<ul>
	<li>
		<span>
		<label for="Requirement[min_price]" class="required">Budget</label>
		</span>
		<span id="buy_lease" style="width:200px; padding:0px;">
		<select name="Requirement[min_price]" id="min_price" class="slctbox sml" onchange="javascript:validateMin('min_price','max_price');">
				<option value="0">Min</option>
 public function actionIndex()
 {
     $userId = Yii::app()->user->id;
     $projectImages = '';
     $propertyImages = '';
     $projectCount = '';
     $propertyCount = '';
     $propertyTypes = '';
     $propertyLocations = '';
     $propertyid = '';
     $projectLocations = '';
     $projectOwnerships = '';
     $projectTypes = '';
     $users = '';
     $userIds[] = '';
     $myJukeBox = '';
     $jukeBoxcategoryName = '';
     $jukecount = '0';
     $propertyWishList = '';
     $propertyName = '';
     $projectWishlist = '';
     $projectName = '';
     $propertywishlistcount = 0;
     $inbox = PmbApi::getInbox($userId);
     $userName = UserApi::getUserProfileDetails($userId);
     if ($inbox) {
         foreach ($inbox as $messages) {
             $userIds[] = $messages->from_user_id;
         }
         $users = DbUtils::getDbValues(new UserProfiles(), 'user_id', $userIds, 'first_name');
     }
     $properties = PropertyApi::getPropertiesOfUser($userId, Yii::app()->params['dashboardResultsPerPage']);
     $countUnread = PmbApi::getUnreadInboxCount($userId);
     $propertyCount = PropertyApi::getAllPropertiesCount($userId);
     $locations = '';
     if ($properties) {
         foreach ($properties as $location) {
             $locations[] = $location->city_id;
         }
         $propertyLocations = DbUtils::getDbValues(new GeoCity(), 'id', $locations, 'city');
     }
     if ($properties) {
         foreach ($properties as $property) {
             $propertyTypes[] = $property->property_type_id;
             $propertyid[] = $property->id;
         }
         $propertyImages = PropertyImagesApi::getPrimaryImageForProperties($propertyid);
         $propertyTypes = DbUtils::getDbValues(new PropertyTypes(), 'id', $propertyTypes, 'property_type');
     }
     $projects = ProjectApi::getProjectsOfUser($userId, Yii::app()->params['dashboardResultsPerPage']);
     if ($projects) {
         foreach ($projects as $project) {
             $projectLocationIds[] = $project->city_id;
             $projectTypeIds[] = $project->project_type_id;
             $projectOwnershipIds[] = $project->ownership_type_id;
             $projectIds[] = $project->id;
         }
         $projectImages = ProjectImagesApi::getPrimaryImageForProjects($projectIds);
         $projectLocations = DbUtils::getDbValues(new GeoCity(), 'id', $projectLocationIds, 'city');
         $projectTypes = DbUtils::getDbValues(new ProjectTypes(), 'id', $projectTypeIds, 'project_type');
         $projectOwnerships = DbUtils::getDbValues(new CategoryOwnershipTypes(), 'id', $projectOwnershipIds, 'ownership_type');
     }
     $projectCount = ProjectApi::getProjectsofUserCount($userId);
     $isProfile['agent'] = AgentProfileApi::isAgent($userId);
     $isProfile['builder'] = BuilderProfileApi::isBuilder($userId);
     $isProfile['specialist'] = SpecialistProfileApi::isSpecialist($userId);
     //MyJuckbox
     $myJukeBox = JukeboxQuestionsApi::getAllJukeboxQuestionsOfUser($userId, Yii::app()->params['dashboardResultsPerPage']);
     if ($myJukeBox) {
         foreach ($myJukeBox as $jukeBox) {
             $categoryIdArray[] = $jukeBox->category_id;
         }
         $jukeBoxcategoryName = DbUtils::getDbValues(new JukeboxCategory(), 'id', $categoryIdArray, 'category');
         $jukecount = count($myJukeBox);
     }
     //my wishlists
     $propertyWishList = PropertyWishlistApi::getWishlist($userId, Yii::app()->params['dashboardResultsPerPage']);
     if ($propertyWishList) {
         foreach ($propertyWishList as $propertyWish) {
             $propertyWishlistArray[] = $propertyWish->property_id;
         }
         $propertyName = DbUtils::getDbValues(new Property(), 'id', $propertyWishlistArray, 'property_name');
     }
     $propertywishlistcount = PropertyWishlistApi::getWishlistCount($userId);
     $totalWishlistCount = $propertywishlistcount;
     //+$projectwishlistcount;
     //requirements
     $requirements = RequirementApi::getRequirementByUserId($userId, Yii::app()->params['dashboardResultsPerPage']);
     if ($requirements) {
         $requirementscount = count($requirements);
     } else {
         $requirementscount = 0;
     }
     $this->render('index', array('inbox' => $inbox, 'users' => $users, 'properties' => $properties, 'countUnread' => $countUnread, 'propertyLocations' => $propertyLocations, 'propertyTypes' => $propertyTypes, 'projects' => $projects, 'projectLocations' => $projectLocations, 'projectTypes' => $projectTypes, 'projectOwnerships' => $projectOwnerships, 'propertyCount' => $propertyCount, 'projectCount' => $projectCount, 'propertyid' => $propertyid, 'propertyImages' => $propertyImages, 'projectImages' => $projectImages, 'isProfile' => $isProfile, 'myJukeBox' => $myJukeBox, 'jukeBoxcategoryName' => $jukeBoxcategoryName, 'jukecount' => $jukecount, 'propertyWishList' => $propertyWishList, 'propertyName' => $propertyName, 'projectName' => $projectName, 'totalWishlistCount' => $totalWishlistCount, 'requirements' => $requirements, 'requirementscount' => $requirementscount, 'userName' => $userName));
 }
 public function actionDeleteProperty($id)
 {
     if (Yii::app()->user->isGuest) {
         throw new CHttpException(403, 'You are not authorized.');
     }
     $property = PropertyApi::getPropertyById($id);
     if ($property->user_id !== Yii::app()->user->id) {
         throw new CHttpException(403, 'You are not authorized.');
     }
     if (PropertyApi::deletePropertyById($property->id)) {
         Yii::app()->user->setFlash('success', 'The property was removed successfully');
     } else {
         Yii::app()->user->setFlash('error', 'The property could not be removed. Please contact the admin.');
     }
     $this->redirect('/properties');
 }
Exemple #5
0
<div class="view">

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('id'));
?>
:</b>
	<?php 
echo CHtml::link(CHtml::encode($data->id), array('view', 'id' => $data->id));
?>
	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('property_id'));
?>
:</b>
	<?php 
echo PropertyApi::getNameByPropertyId($data->property_id);
?>
	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('image'));
?>
:</b>
	<?php 
echo CHtml::encode($data->image);
?>
	<br />
</div>
 public function actionPost()
 {
     Yii::beginProfile('requirement_post');
     $userId = Yii::app()->user->id;
     $model = new Requirement();
     $modelState = new GeoState();
     $requirementCities = new RequirementCities();
     $requirementAmenities = new RequirementAmenities();
     $requirementPropertyTypes = new RequirementPropertyTypes();
     $requirementBedrooms = new RequirementBedrooms();
     $amenities = null;
     $propertyTypes = null;
     $bedrooms = null;
     $cities = null;
     $this->performAjaxValidation(array($model));
     if (isset($_POST['minsubmit'])) {
         $modelState->attributes = $_POST['GeoState'];
     } elseif (isset($_POST['PostRequirementMin'])) {
         $model->attributes = $_POST['Requirement'];
         if (isset($_POST['GeoCity']['city'])) {
             $cities[0] = $_POST['GeoCity']['city'];
         }
     } elseif (isset($_POST['submit'])) {
         $model->attributes = $_POST['Requirement'];
         $amenities = isset($_POST['amenity_id']) ? $_POST['amenity_id'] : null;
         $propertyTypes = isset($_POST['property_type_id']) ? $_POST['property_type_id'] : null;
         $bedrooms = isset($_POST['bedrooms']) ? $_POST['bedrooms'] : null;
         $cities = isset($_POST['city_id']) ? $_POST['city_id'] : null;
         $valid = true;
         $model->user_id = $userId;
         $valid = $valid && $model->validate();
         if ($propertyTypes == null) {
             $requirementPropertyTypes->addError('property_type_id', 'Property Type cannot be blank.');
             $valid = false;
         }
         if ($cities == null || empty($cities) || $cities[0] == '') {
             $requirementCities->addError('city_id', 'City cannot be blank.');
             $valid = false;
         }
         if ($valid) {
             $data = $_POST['Requirement'];
             if ($data['covered_area_from'] == null) {
                 $data['covered_area_from'] == 0;
             }
             if ($data['min_price'] == null) {
                 $data['min_price'] = 0;
             }
             $requirement = RequirementApi::createRequirement($userId, $data);
             if (!$requirement->hasErrors()) {
                 $addAmenities = true;
                 $addCities = true;
                 $addBedrooms = true;
                 $addPropertyTypes = true;
                 if (isset($_POST['amenity_id'])) {
                     $addAmenities = RequirementAmenitiesApi::addAmenitiesForRequirement($requirement->id, $_POST['amenity_id']);
                 }
                 if (isset($_POST['city_id'])) {
                     $addCities = RequirementCitiesApi::addCitiesForRequirement($requirement->id, $_POST['city_id']);
                 }
                 if (isset($_POST['bedrooms']) && !empty($_POST['bedrooms'])) {
                     $addBedrooms = RequirementBedroomsApi::addBedroomForRequirement($requirement->id, $_POST['bedrooms']);
                 }
                 if (isset($_POST['property_type_id'])) {
                     $addPropertyTypes = RequirementPropertyTypesApi::addPropertyTypesForRequirement($requirement->id, $_POST['property_type_id']);
                 }
                 if ($addAmenities && $addCities && $addBedrooms && $addPropertyTypes) {
                     //$this->refresh();
                     $this->redirect('/requirement/' . $requirement->id);
                 } else {
                     RequirementAmenitiesApi::deleteAllAmenitiesForRequirement($requirement->id);
                     RequirementCitiesApi::deleteAllCitiesForRequirement($requirement->id);
                     RequirementBedroomsApi::deleteAllBedroomsForRequirement($requirement->id);
                     RequirementPropertyTypesApi::deleteAllPropertyTypesForRequirement($requirement->id);
                 }
             } else {
                 if (isset($property->id)) {
                     PropertyApi::deletePropertyById($property->id);
                 }
             }
         }
     }
     $this->render('post', array('model' => $model, 'modelState' => $modelState, 'requirementCities' => $requirementCities, 'requirementAmenities' => $requirementAmenities, 'requirementPropertyTypes' => $requirementPropertyTypes, 'requirementBedrooms' => $requirementBedrooms, 'amenities' => $amenities, 'propertyTypes' => $propertyTypes, 'bedrooms' => $bedrooms, 'cities' => $cities));
     Yii::endProfile('requirement_post');
 }
Exemple #7
0
<?php

$this->breadcrumbs = array('Property Images' => array('index'), $model->id);
$this->menu = array(array('label' => 'List PropertyImages', 'url' => array('index')), array('label' => 'Create PropertyImages', 'url' => array('create')), array('label' => 'Update PropertyImages', 'url' => array('update', 'id' => $model->id)), array('label' => 'Delete PropertyImages', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage PropertyImages', 'url' => array('admin')));
?>

<h1>View PropertyImages #<?php 
echo $model->id;
?>
</h1>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', array('name' => 'property_id', 'value' => PropertyApi::getNameByPropertyId($model->property_id)), array('name' => 'image', 'type' => 'raw', 'value' => '<img src="' . PropertyImagesApi::getImageByUrl($model->property_id, $model->image) . '" />'))));
             	<h1><a href="#">' . $profile['company_name'] . '</a></h1>
                 <h4>Office Address : <span>' . $profile['address_line1'] . ', ' . $profile['address_line2'] . ', ' . $address['city'] . ', ' . $address['state'] . ', ' . $address['country'] . '</span> </h4>';
 if ($user_type == "specialist") {
     $specialists = SpecialistTypeApi::getSpecialistTypeByUserId($user->id);
     if ($specialists) {
         $types = null;
         foreach ($specialists as $i => $specialist) {
             if ($i != 0) {
                 $types .= ', ';
             }
             $types .= $specialist->specialist;
         }
         echo '<h4>Specialist in : <span>' . $types . '</span> </h4>';
     }
 } else {
     $properties = PropertyApi::getPropertyTypesByUserId($user->id);
     if ($properties) {
         $types = null;
         foreach ($properties as $i => $property) {
             if ($i != 0) {
                 $types .= ', ';
             }
             $types .= PropertyTypesApi::getPropertyTypeById($property->property_type_id);
         }
         echo '<h4>Dealing in : <span>' . $types . '</span> </h4>';
     } else {
         echo '<h4>Dealing in : <span>Residential Land</span> </h4>';
     }
 }
 echo '<h4 class="left">Description : </h4>
                 <p class="right">' . substr($profile['company_description'], 0, 150) . ' .....
Exemple #9
0
 public function actionView($userId)
 {
     Yii::beginProfile('agent_view');
     $agentRatingReadOnly = false;
     $session = Yii::app()->session;
     $agent = AgentProfileApi::getAgentDetails($userId);
     if (!$agent) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     $agentInfo = UserApi::getUserProfileDetails($agent->user_id);
     $agentAddress = DbUtils::getAddress($agent->city_id);
     $agentPropertyTypeIds = PropertyApi::getPropertyTypesByUserId($agent->user_id);
     $agentPropertyTypes = "";
     if ($agentPropertyTypeIds) {
         foreach ($agentPropertyTypeIds as $agentPropertyTypeId) {
             $agentPropertyTypes[$agentPropertyTypeId->property_type_id] = PropertyTypesApi::getPropertyTypeById($agentPropertyTypeId->property_type_id);
         }
     }
     $agentProperties = PropertyApi::getPropertiesOfUser($agent->user_id, Yii::app()->params['dashboardResultsPerPage']);
     $agentLocations = UserAgentLocationsApi::getLocations($agent->id);
     $agentPropertyLocations = "";
     if ($agentLocations) {
         foreach ($agentLocations as $agentLocation) {
             $agentPropertyLocations[] = DbUtils::getAddress($agentLocation->city_id);
         }
     }
     $agentRatingReadOnly = AgentRatingApi::isRated($agent->id, Yii::app()->user->id);
     $agentRating = AgentRatingApi::getRating($agent->id);
     if (!$agentRatingReadOnly) {
         if ($agent->user_id == Yii::app()->user->id) {
             $agentRatingReadOnly = true;
         } else {
             $agentRatingReadOnly = false;
         }
     } else {
         $agentRatingReadOnly = true;
     }
     $this->render('view', array('agent' => $agent, 'agentInfo' => $agentInfo, 'agentAddress' => $agentAddress, 'agentPropertyTypes' => $agentPropertyTypes, 'agentPropertyLocations' => $agentPropertyLocations, 'agentProperties' => $agentProperties, 'agentRatingReadOnly' => $agentRatingReadOnly, 'agentRating' => $agentRating));
     Yii::endProfile('agent_view');
 }
Exemple #10
0
 public function actionSearch()
 {
     Yii::beginProfile('search_property_and_people');
     // Initiate the entities.
     $properties = null;
     $users = null;
     $projects = null;
     $data = null;
     $data_user = null;
     $data_project = null;
     $data_user['user_type'] = 'agent';
     $amenities = null;
     $pages = null;
     $pagesAgent = null;
     $pagesBuilder = null;
     $pagesSpecialists = null;
     $pagesProject = null;
     $criteria = PropertyApi::getCriteriaObject($data);
     $totalProp = Property::model()->count();
     $pages = new CPagination($totalProp);
     $pages->pageSize = Yii::app()->params['resultsPerPage'];
     $pages->applyLimit($criteria);
     $properties = PropertyApi::searchPropertyWithCriteria($criteria);
     $propertiesCount = $totalProp;
     $totalUser = 0;
     $criteria = UserApi::getCriteriaObject($data_user);
     $users = UserApi::searchUser($data_user);
     if ($users) {
         $totalUser = count($users);
     }
     $pagesUser = new CPagination($totalUser);
     $pagesUser->pageSize = Yii::app()->params['resultsPerPage'];
     $pagesUser->applyLimit($criteria);
     $users = UserApi::searchUserWithCriteria($criteria);
     //$users = UserApi::searchUser($data_user);
     $projects = ProjectApi::searchProject($data_project);
     /* Property Model */
     $modelProperty = new Property();
     $modelState = new GeoState();
     $modelCity = new GeoCity();
     $propertyAmenities = new PropertyAmenities();
     // echo '<pre>';var_dump($pages);die();
     /* People Models */
     $modelUser = new UserCredentials();
     $modelProfile = new UserProfiles();
     $modelSpecialistType = new UserSpecialistType();
     /* Project Model */
     $modelProject = new Projects();
     $projectAmenities = new ProjectAmenities();
     if (isset($_POST['search']) && isset($_POST['mode'])) {
         if ($_POST['mode'] == "property") {
             $modelProperty->attributes = $_POST['Property'];
             //$modelProperty['i_want_to'] = isset($_POST['Property']['i_want_to'])?$_POST['Property']['i_want_to'] : null;
             $data = $_POST['Property'];
             $data['keyword'] = isset($_POST['keyword']) ? $_POST['keyword'] : null;
             $data['city'] = $_POST['GeoCity']['city'];
             $data['budget_min'] = $_POST['budget_min'];
             $data['budget_max'] = $_POST['budget_max'];
             $data['without_budget'] = isset($_POST['without_budget']) ? $_POST['without_budget'] : 0;
             $data['PropertyAmenities'] = isset($_POST['amenity_id']) ? $_POST['amenity_id'] : null;
             $data['posted_by_all'] = isset($_POST['posted_by_all']) ? $_POST['posted_by_all'] : 0;
             $data['posted_by'] = isset($_POST['posted_by']) ? $_POST['posted_by'] : null;
             $criteria = PropertyApi::getCriteriaObject($data);
             $totalProp = Property::model()->count();
             $pages = new CPagination($totalProp);
             $pages->pageSize = Yii::app()->params['resultsPerPage'];
             $pages->applyLimit($criteria);
             $properties = PropertyApi::searchPropertyWithCriteria($criteria);
             $propertiesCount = $totalProp;
             //$properties = PropertyApi::searchProperty($data);
         } elseif ($_POST['mode'] == "people") {
             $modelProfile->attributes = $_POST['UserProfiles'];
             $data_user = null;
             $data_user = $_POST['UserProfiles'];
             $data_user['user_type'] = $_POST['user_type'];
             $data_user['property_type_id'] = isset($_POST['property_type_id']) ? $_POST['property_type_id'] : null;
             $data_user['keyword'] = isset($_POST['keyword']) ? $_POST['keyword'] : null;
             $data_user['specialist_type_id'] = isset($_POST['specialist_type_id']) ? $_POST['specialist_type_id'] : null;
             //$users = UserApi::searchUser($data_user);
             if ($_POST['user_type'] == "agent") {
                 $totalAgent = '0';
                 $criteria = AgentProfileApi::getCriteriaObject($data_user);
                 $users = AgentProfileApi::searchAgents($data_user);
                 if ($users) {
                     $totalAgent = count($users);
                 }
                 $pagesAgent = new CPagination($totalAgent);
                 $pagesAgent->pageSize = Yii::app()->params['resultsPerPage'];
                 $pagesAgent->applyLimit($criteria);
                 $users = AgentProfileApi::searchAgentWithCriteria($criteria);
                 //	$users = AgentProfileApi::searchAgents($data_user);
             }
             if ($_POST['user_type'] == "builder") {
                 $totalBuilder = '0';
                 $criteria = BuilderProfileApi::getCriteriaObject($data_user);
                 $users = BuilderProfileApi::searchBuilderWithCriteria($criteria);
                 if ($users) {
                     $totalBuilder = count($users);
                 }
                 $pagesBuilder = new CPagination($totalBuilder);
                 $pagesBuilder->pageSize = Yii::app()->params['resultsPerPage'];
                 $pagesBuilder->applyLimit($criteria);
                 $users = BuilderProfileApi::searchBuilderWithCriteria($criteria);
             }
             if ($_POST['user_type'] == "specialist") {
                 $totalSpecialists = '0';
                 $criteria = SpecialistProfileApi::getCriteriaObject($data_user);
                 $users = SpecialistProfileApi::searchSpecialistsWithCriteria($criteria);
                 if ($users) {
                     $totalSpecialists = count($users);
                 }
                 $pagesSpecialists = new CPagination($totalSpecialists);
                 $pagesSpecialists->pageSize = Yii::app()->params['resultsPerPage'];
                 $pagesSpecialists->applyLimit($criteria);
                 $users = SpecialistProfileApi::searchSpecialistsWithCriteria($criteria);
             }
         } elseif ($_POST['mode'] == "project") {
             $modelProject->attributes = $_POST['Projects'];
             $amenities = isset($_POST['ProjectAmenities']['amenity_id']) ? $_POST['ProjectAmenities']['amenity_id'] : null;
             if ($amenities) {
                 $amenity_data = null;
                 foreach ($amenities as $i => $amenity) {
                     if ($i != 0) {
                         $amenity_data .= ',';
                     }
                     $amenity_data .= $amenity;
                 }
                 $amenities = $amenity_data;
             }
             $data = $_POST['Projects'];
             $data['keyword'] = isset($_POST['keyword']) ? $_POST['keyword'] : null;
             $data['city'] = $_POST['GeoCity']['city'];
             $data['budget_min'] = $_POST['budget_min'];
             $data['budget_max'] = $_POST['budget_max'];
             $data['ProjectAmenities'] = isset($_POST['ProjectAmenities']['amenity_id']) ? $_POST['ProjectAmenities']['amenity_id'] : null;
             $data['posted_by_all'] = isset($_POST['posted_by_all']) ? $_POST['posted_by_all'] : 0;
             $data['posted_by'] = isset($_POST['posted_by']) ? $_POST['posted_by'] : null;
             $totalProject = '0';
             $criteria = ProjectApi::getCriteriaObject($data);
             $users = ProjectApi::searchProjectWithCriteria($criteria);
             if ($users) {
                 $totalProject = count($users);
             }
             $pagesProject = new CPagination($totalProject);
             $pagesProject->pageSize = Yii::app()->params['resultsPerPage'];
             $pagesProject->applyLimit($criteria);
             $projects = ProjectApi::searchProjectWithCriteria($criteria);
         }
     }
     // echo '<br><pre>';var_dump($pages);die();
     $this->render('search', array('pages' => $pages, 'modelState' => $modelState, 'modelProperty' => $modelProperty, 'modelCity' => $modelCity, 'propertyAmenities' => $propertyAmenities, 'modelUser' => $modelUser, 'modelProfile' => $modelProfile, 'modelSpecialistType' => $modelSpecialistType, 'properties' => $properties, 'amenities' => $amenities, 'users' => $users, 'modelProject' => $modelProject, 'projectAmenities' => $projectAmenities, 'projects' => $projects, 'pagesAgent' => $pagesAgent, 'pagesUser' => $pagesUser, 'pagesBuilder' => $pagesBuilder, 'pagesSpecialists' => $pagesSpecialists, 'pagesProject' => $pagesProject, 'propertiesCount' => $propertiesCount));
     $this->render('search', array('pages' => $pages, 'modelProperty' => $modelProperty, 'modelCity' => $modelCity, 'propertyAmenities' => $propertyAmenities, 'modelUser' => $modelUser, 'modelProfile' => $modelProfile, 'modelSpecialistType' => $modelSpecialistType, 'properties' => $properties, 'amenities' => $amenities, 'users' => $users, 'modelProject' => $modelProject, 'projectAmenities' => $projectAmenities, 'projects' => $projects, 'pagesAgent' => $pagesAgent, 'pagesUser' => $pagesUser, 'pagesBuilder' => $pagesBuilder, 'pagesSpecialists' => $pagesSpecialists, 'pagesProject' => $pagesProject, 'propertiesCount' => $propertiesCount));
     $this->render('search', array('pages' => $pages, 'modelProperty' => $modelProperty, 'modelCity' => $modelCity, 'propertyAmenities' => $propertyAmenities, 'modelUser' => $modelUser, 'modelProfile' => $modelProfile, 'modelSpecialistType' => $modelSpecialistType, 'properties' => $properties, 'amenities' => $amenities, 'users' => $users, 'modelProject' => $modelProject, 'projectAmenities' => $projectAmenities, 'projects' => $projects, 'pagesAgent' => $pagesAgent, 'pagesUser' => $pagesUser, 'pagesBuilder' => $pagesBuilder, 'pagesSpecialists' => $pagesSpecialists, 'pagesProject' => $pagesProject, 'propertiesCount' => $propertiesCount));
     Yii::endProfile('search_property_and_people');
 }
Exemple #11
0
echo $form->error($model, 'c_area_units');
?>
</li>
	<li class="error_message"><?php 
echo $form->error($model, 'covered_area');
?>
</li> 
</ul>
<ul>
	<li><span><?php 
echo $form->labelEx($model, 'land_area');
?>
</span> 
	<?php 
echo $form->textField($model, 'land_area', array('class' => 'txtbox sml'));
echo $form->dropDownList($model, 'l_area_units', PropertyApi::getUnits('plot'), array('empty' => 'Select', 'class' => 'slctbox sml'));
?>
	</li>
	<li class="error_message"><?php 
echo $form->error($model, 'l_area_units');
?>
</li>
	<li class="error_message"><?php 
echo $form->error($model, 'land_area');
?>
</li> 
</ul>
<ul>
	<li><span><?php 
echo $form->labelEx($model, 'total_price');
?>
Exemple #12
0
 public function actionProperty()
 {
     Yii::beginProfile('search_property');
     $session = new CHttpSession();
     $session->open();
     //$session->destroy();
     //
     // Initiate the pagination variables.
     $properties = null;
     $data = null;
     //$data['new_launches'] = isset($_POST['new_launches']) ? $_POST['new_launches'] : '';
     $data['new_launches'] = isset($_GET['new_launches']) ? $_GET['new_launches'] : '';
     $data['agent_id'] = isset($_GET['agent_id']) ? $_GET['agent_id'] : '';
     $data['builder_id'] = isset($_GET['builder_id']) ? $_GET['builder_id'] : '';
     $data['i_want_to'] = isset($_GET['i_want_to']) ? $_GET['i_want_to'] : 'Sell';
     //	var_dump($data);die();
     //var_dump($data);die();
     // Initiate the models to be used in the search screen.
     $modelProperty = new Property();
     $modelState = new GeoState();
     $modelCity = new GeoCity();
     $modelLocality = new GeoLocality();
     $propertyAmenities = new PropertyAmenities();
     //	var_dump(Yii::app()->params['resultsPerPage']);die();
     //	var_dump($_POST);
     if (isset($_POST['Property'])) {
         // Populate the search criteria to a variable and pass it to the Api to get the criteria object.
         $modelProperty->attributes = $_POST['Property'];
         $data = $_POST['Property'];
         if (isset($_POST['minbuysearch'])) {
             $data['property_type_id'] = '';
             $data['transaction_type_id'] = '';
             $data['age_of_construction'] = '';
             $data['ownership_type_id'] = '';
             $data['jackpot_investment'] = '0';
             $data['featured'] = '0';
             $data['instant_home'] = '0';
             $data['keyword'] = '';
         }
         //$data['new_launches'] = isset($_POST['new_launches']) ? $_POST['new_launches'] : '';
         $data['new_launches'] = isset($_GET['new_launches']) ? $_GET['new_launches'] : '';
         $data['agent_id'] = isset($_GET['agent_id']) ? $_GET['agent_id'] : '';
         $data['builder_id'] = isset($_GET['builder_id']) ? $_GET['builder_id'] : '';
         $data['keyword'] = isset($_POST['keyword']) ? $_POST['keyword'] : null;
         $data['city_id'] = isset($_POST['GeoCity']['city']) ? $_POST['GeoCity']['city'] : '';
         $data['state_id'] = isset($_POST['GeoState']['state']) ? $_POST['GeoState']['state'] : '';
         $data['locality_id'] = isset($_POST['GeoLocality']['locality']) ? $_POST['GeoLocality']['locality'] : '';
         if ($data['locality_id'] != '') {
             $locality = GeoLocality::model()->find('locality=:locality', array(':locality' => $data['locality_id']));
             if ($locality) {
                 $data['locality_id'] = $locality->id;
             }
         }
         if ($data['keyword'] = 'Eg: Builder') {
             $data['keyword'] = '';
         }
         //var_dump($_POST['Property']['i_want_to']);
         if (isset($_POST['Property']['i_want_to'])) {
             if ($_POST['Property']['i_want_to'] == 'Rent') {
                 if (isset($_POST['budget_min_rent'])) {
                     $data['budget_min'] = $_POST['budget_min_rent'];
                 } elseif (isset($_POST['budget_min'])) {
                     $data['budget_min'] = $_POST['budget_min'];
                 }
                 if (isset($_POST['budget_max_rent'])) {
                     $data['budget_max'] = $_POST['budget_max_rent'];
                 } elseif (isset($_POST['budget_max'])) {
                     $data['budget_max'] = $_POST['budget_max'];
                 }
             } else {
                 if (isset($_POST['budget_min'])) {
                     $data['budget_min'] = $_POST['budget_min'];
                 }
                 if (isset($_POST['budget_max'])) {
                     $data['budget_max'] = $_POST['budget_max'];
                 }
             }
         } else {
             $data['i_want_to'] = 'sell';
             if (isset($_POST['budget_min'])) {
                 $data['budget_min'] = $_POST['budget_min'];
             }
             if (isset($_POST['budget_max'])) {
                 $data['budget_max'] = $_POST['budget_max'];
             }
         }
         $data['without_budget'] = isset($_POST['without_budget']) ? $_POST['without_budget'] : 0;
         $data['PropertyAmenities'] = isset($_POST['PropertyAmenities']['amenity_id']) ? $_POST['PropertyAmenities']['amenity_id'] : null;
         $data['posted_by_all'] = isset($_POST['posted_by_all']) ? $_POST['posted_by_all'] : 0;
         $data['posted_by'] = isset($_POST['posted_by']) ? $_POST['posted_by'] : null;
         $criteria = PropertyApi::getCriteriaObject($data);
         $total = Property::model()->count($criteria);
         $pages = new CPagination($total);
         $pages->pageSize = Yii::app()->params['resultsPerPage'];
         $pages->applyLimit($criteria);
         $properties = PropertyApi::searchPropertyWithCriteria($criteria);
         $propertiesCount = $total;
         $session['search-criteria-property'] = $criteria;
         $session['results-page'] = $total;
     } else {
         /*if(isset($_GET['page'])) {
         
         			$total=0;
         			$criteria = $session['search-criteria'];
         			$total = $session['results-page'];
         			$pages = new CPagination($total);
         			$pages->pageSize =  Yii::app()->params['resultsPerPage'];
         			$pages->applyLimit($criteria);
         			$propertiesCount=$totalProp;
         			$properties = PropertyApi::searchPropertyWithCriteria($criteria);
         			$total = count($properties);
         
         			} else {*/
         //	unset($session['search-criteria']);
         if (isset($session['search-criteria-property'])) {
             $criteria = $session['search-criteria-property'];
             //$criteria = new CDbCriteria;
         } else {
             $criteria = PropertyApi::getCriteriaObject($data);
         }
         if ($data['new_launches']) {
             $totalProp = Property::model()->count();
             $properties = PropertyApi::searchPropertyWithCriteria();
         } else {
             $totalProp = Property::model()->count($criteria);
             $properties = PropertyApi::searchPropertyWithCriteria($criteria);
         }
         $pages = new CPagination($totalProp);
         $pages->pageSize = Yii::app()->params['resultsPerPage'];
         $pages->applyLimit($criteria);
         $propertiesCount = $totalProp;
         //	}
     }
     $this->render('property', array('pages' => $pages, 'modelState' => $modelState, 'modelProperty' => $modelProperty, 'modelCity' => $modelCity, 'modelLocality' => $modelLocality, 'propertyAmenities' => $propertyAmenities, 'properties' => $properties, 'propertiesCount' => $propertiesCount));
     Yii::endProfile('search_property');
 }