Example #1
0
                 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) . ' .....
                     	<a href="/profile/' . $profile->id . '#' . $user_type . '">more</a></p>
                         <br class="clear" />
                   <div class="right"><a href="/profile/' . $profile->id . '#' . $user_type . '" class="btn-view-details"></a> </div>
                 </div>
                 <br class="clear" />
             </div>';
 }
Example #2
0
 public function actionView($id)
 {
     Yii::beginProfile('property_view');
     $session = Yii::app()->session;
     $property = PropertyApi::getPropertyById($id);
     if (!$property) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     if (!$property->furnished) {
         $property->furnished = '-';
     }
     if (!$property->floor_number) {
         $property->floor_number = '-';
     }
     if (!$property->total_floors) {
         $property->total_floors = '-';
     }
     if (!$property->facing) {
         $property->facing = '-';
     }
     $recentlyViewed = UserApi::getUserProfileDetails($property->recently_viewed);
     $propertyAgentInfo = AgentProfileApi::getAgentDetails($property->user_id);
     $propertyUser = "";
     $propertyAgent = "";
     $propertyBuilder = "";
     $propertyBuilderInfo = "";
     $propertySpecialist = "";
     $propertySpecialistInfo = "";
     $propertyRating = "";
     $propertyRating = PropertyRatingApi::getRating($id);
     if ($propertyAgentInfo) {
         $propertyAgent = UserApi::getUserProfileDetails($propertyAgentInfo->user_id);
     } else {
         $propertyBuilderInfo = BuilderProfileApi::getBuilderDetails($property->user_id);
         if ($propertyBuilderInfo) {
             $propertyBuilder = UserApi::getUserProfileDetails($propertyBuilderInfo->user_id);
         } else {
             $propertySpecialistInfo = SpecialistProfileApi::getSpecialistDetails($property->user_id);
             if ($propertySpecialistInfo) {
                 $propertySpecialist = UserApi::getUserProfileDetails($propertySpecialistInfo->user_id);
             } else {
                 $propertyUser = UserApi::getUser($property->user_id);
             }
         }
     }
     $propertySimilar = PropertyApi::getSimilarProperties($property, 3, $id);
     $propertySimilarAddress = "";
     $propertySimilarUser = "";
     if ($propertySimilar) {
         foreach ($propertySimilar as $similar) {
             $propertySimilarAddress[$similar->id] = PropertyApi::getLocation($similar->id);
             $propertySimilarUser[$similar->id] = UserApi::getUserProfileDetails($similar->user_id);
         }
     }
     $recentlyViewedIds[] = '';
     $recentlyViewedIds_total = $session['properties'];
     if ($recentlyViewedIds_total) {
         $re_array = array_reverse($recentlyViewedIds_total);
         $i = 0;
         foreach ($re_array as $re) {
             $recentlyViewedIds = $re;
             $i++;
             if ($i > 2) {
                 break;
             }
         }
     }
     $property_ids[] = $recentlyViewedIds;
     $property_ids[] = $id;
     $session['properties'] = array_unique($property_ids);
     $propertyRecentlyViewed = "";
     $propertyRecentlyViewedAddress = "";
     $propertyRecentlyViewedUser = "";
     if ($recentlyViewedIds) {
         foreach ($recentlyViewedIds as $recent) {
             $modelProperty = PropertyApi::getPropertyById($recent);
             if ($modelProperty) {
                 $propertyRecentlyViewed[] = $modelProperty;
                 $propertyRecentlyViewedAddress[] = PropertyApi::getLocation($recent);
                 $propertyRecentlyViewedUser[] = UserApi::getUserProfileDetails($modelProperty->user_id);
             }
         }
     }
     $propertyImages = PropertyImagesApi::getAllImages($property->id);
     $propertyType = PropertyTypesApi::getPropertyTypeById($property->property_type_id);
     $transactionType = PropertyTransactionTypesApi::getTransactionTypeById($property->transaction_type_id);
     $ownershipType = OwnershipTypesApi::getOwnershipTypeById($property->ownership_type_id);
     $propertyAge = PropertyAgeOfConstructionApi::getpropertyAgeById($property->age_of_construction);
     $propertyAmenities = PropertyAmenitiesApi::getAmenitiesForProperty($property->id);
     $propertyAddress = PropertyApi::getLocation($property->id);
     $propertyRating = PropertyRatingApi::getRating($property->id);
     $propertyWishlist = PropertyWishlistApi::getWishlistUserOnProperty($property->id, Yii::app()->user->id);
     $this->render('view', array('property' => $property, 'recentlyViewed' => $recentlyViewed, 'propertyAgentInfo' => $propertyAgentInfo, 'propertyBuilderInfo' => $propertyBuilderInfo, 'propertySpecialistInfo' => $propertySpecialistInfo, 'propertyUser' => $propertyUser, 'propertyAgent' => $propertyAgent, 'propertyBuilder' => $propertyBuilder, 'propertySpecialist' => $propertySpecialist, 'propertySimilar' => $propertySimilar, 'propertySimilarAddress' => $propertySimilarAddress, 'propertySimilarUser' => $propertySimilarUser, 'propertyRecentlyViewed' => $propertyRecentlyViewed, 'propertyRecentlyViewedAddress' => $propertyRecentlyViewedAddress, 'propertyRecentlyViewedUser' => $propertyRecentlyViewedUser, 'propertyImages' => $propertyImages, 'propertyType' => $propertyType, 'propertyAddress' => $propertyAddress, 'transactionType' => $transactionType, 'ownershipType' => $ownershipType, 'propertyAge' => $propertyAge, 'propertyAmenities' => $propertyAmenities, 'propertyRating' => $propertyRating, 'propertyWishlist' => $propertyWishlist));
     Yii::endProfile('property_view');
 }
Example #3
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');
 }