Example #1
0
 public function actionProfile($id)
 {
     Yii::beginProfile('account_profile');
     $userProfile = UserApi::getUser($id);
     if (!$userProfile) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     $userProfile = UserApi::getUserProfileDetails($id);
     $userAddress = DbUtils::getAddress($userProfile->city_id);
     $userImages = UserPhotosApi::getAllImages($id);
     $agentAddress = "";
     $agentImage = "";
     $agentProfile = AgentProfileApi::getAgentDetails($id);
     if ($agentProfile) {
         $agentAddress = DbUtils::getAddress($agentProfile->city_id);
         $agentImage = AgentProfileApi::getImage($id);
     }
     $builderAddress = "";
     $builderImage = "";
     $builderProfile = BuilderProfileApi::getBuilderDetails($id);
     if ($builderProfile) {
         $builderAddress = DbUtils::getAddress($builderProfile->city_id);
         $builderImage = BuilderProfileApi::getImage($id);
     }
     $specialistAddress = "";
     $specialistImage = "";
     $specialistProfile = SpecialistProfileApi::getSpecialistDetails($id);
     $specialistProjects = "";
     if ($specialistProfile) {
         $specialistAddress = DbUtils::getAddress($specialistProfile->city_id);
         $specialistImage = SpecialistProfileApi::getImage($id);
         $specialistProjects = SpecialistApi::getSpecialistProjects($id);
     }
     $this->render('profile', array('userProfile' => $userProfile, 'userAddress' => $userAddress, 'userImages' => $userImages, 'agentProfile' => $agentProfile, 'agentAddress' => $agentAddress, 'builderProfile' => $builderProfile, 'builderAddress' => $builderAddress, 'specialistProfile' => $specialistProfile, 'specialistAddress' => $specialistAddress, 'specialistProjects' => $specialistProjects, 'agentImage' => $agentImage, 'builderImage' => $builderImage, 'specialistImage' => $specialistImage));
     Yii::endProfile('account_profile');
 }
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
    echo '<div class="right cols2">
    	<div id="property_search_results">
        	<h1 class="property_search_results_top">' . count($users) . ' ' . $user_type . 's Found <span class="right"></span> </h1>
            <div id="user-results">';
    foreach ($users as $user) {
        if (isset($images[$user->id])) {
            $image = $images[$user->id];
        }
        $userProfile = userApi::getUserProfileDetails($user->id);
        ?>
			<?php 
        $profile = null;
        if ($user_type == "agent") {
            $profile = AgentProfileApi::getAgentDetails($user->id);
        } elseif ($user_type == "builder") {
            $profile = BuilderProfileApi::getBuilderDetails($user->id);
            //echo '<pre>';var_dump($profile->company_name);die();
        } elseif ($user_type == "specialist") {
            $profile = SpecialistProfileApi::getSpecialistDetails($user->id);
        }
        ?>
			<div class="post" style="cursor:pointer;" onClick="location.href='<?php 
        echo Yii::app()->createAbsoluteUrl('/profile/' . $profile->id);
        ?>
'">
            <?php 
        echo '<div class="left">';
        echo '<img src="' . $image . '" width="124" alt="" />';
        $address = DbUtils::getAddress($profile['city_id']);
        echo '<br />
                    
Example #4
0
 public function actionView($id)
 {
     Yii::beginProfile('project_view');
     $session = Yii::app()->session;
     $project = ProjectApi::getProjectById($id);
     if (!$project) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     $recentlyViewed = UserApi::getUserProfileDetails($project->recently_viewed);
     $projectAgentInfo = AgentProfileApi::getAgentDetails($project->user_id);
     $projectUser = "";
     $projectAgent = "";
     $projectBuilder = "";
     $projectBuilderInfo = "";
     $projectSpecialist = "";
     $projectSpecialistInfo = "";
     $projectRating = '';
     if ($projectAgentInfo) {
         $projectAgent = UserApi::getUserProfileDetails($projectAgentInfo->user_id);
     } else {
         $projectBuilderInfo = BuilderProfileApi::getBuilderDetails($project->user_id);
         if ($projectBuilderInfo) {
             $projectBuilder = UserApi::getUserProfileDetails($projectBuilderInfo->user_id);
         } else {
             $projectSpecialistInfo = SpecialistProfileApi::getSpecialistDetails($project->user_id);
             if ($projectSpecialistInfo) {
                 $projectSpecialist = UserApi::getUserProfileDetails($projectSpecialistInfo->user_id);
             } else {
                 $projectUser = UserApi::getUser($project->user_id);
             }
         }
     }
     $projectSimilar = ProjectApi::getSimilarProjects($project, 3);
     $projectSimilarAddress = "";
     $projectSimilarUser = "";
     if ($projectSimilar) {
         foreach ($projectSimilar as $similar) {
             $projectSimilarAddress[$similar->id] = ProjectApi::getLocation($similar->id);
             $projectSimilarUser[$similar->id] = UserApi::getUserProfileDetails($similar->user_id);
         }
     }
     $recentlyViewedIds = $session['projects'];
     $project_ids = $recentlyViewedIds;
     $project_ids[] = $id;
     $session['projects'] = array_unique($project_ids);
     $projectRecentlyViewed = "";
     $projectRecentlyViewedAddress = "";
     $projectRecentlyViewedUser = "";
     if ($recentlyViewedIds) {
         foreach ($recentlyViewedIds as $recent) {
             $modelProject = ProjectApi::getProjectById($recent);
             $projectRecentlyViewed[] = $modelProject;
             $projectRecentlyViewedAddress[] = ProjectApi::getLocation($recent);
             $projectRecentlyViewedUser[] = UserApi::getUserProfileDetails($modelProject->user_id);
         }
     }
     $projectImages = ProjectImagesApi::getAllImages($project->id);
     $projectType = ProjectTypesApi::getProjectTypeById($project->project_type_id);
     $ownershipType = OwnershipTypesApi::getOwnershipTypeById($project->ownership_type_id);
     $projectAmenities = ProjectAmenitiesApi::getAmenitiesForProject($project->id);
     $projectAddress = ProjectApi::getLocation($project->id);
     $projectProperties = ProjectPropertiesApi::getPropertiesModel($project->id);
     $projectWishlist = ProjectWishlistApi::getWishlistUserOnProject($project->id, Yii::app()->user->id);
     $projectRating = ProjectRatingApi::getRating($project->id);
     $projectViews = ProjectApi::getViews($project->id);
     ProjectApi::setViews($project->id);
     $this->render('view', array('project' => $project, 'recentlyViewed' => $recentlyViewed, 'projectAgentInfo' => $projectAgentInfo, 'projectBuilderInfo' => $projectBuilderInfo, 'projectSpecialistInfo' => $projectSpecialistInfo, 'projectUser' => $projectUser, 'projectAgent' => $projectAgent, 'projectBuilder' => $projectBuilder, 'projectSpecialist' => $projectSpecialist, 'projectSimilar' => $projectSimilar, 'projectSimilarAddress' => $projectSimilarAddress, 'projectSimilarUser' => $projectSimilarUser, 'projectRecentlyViewed' => $projectRecentlyViewed, 'projectRecentlyViewedAddress' => $projectRecentlyViewedAddress, 'projectRecentlyViewedUser' => $projectRecentlyViewedUser, 'projectImages' => $projectImages, 'projectType' => $projectType, 'projectAddress' => $projectAddress, 'ownershipType' => $ownershipType, 'projectAmenities' => $projectAmenities, 'projectProperties' => $projectProperties, 'projectRating' => $projectRating, 'projectWishlist' => $projectWishlist, 'projectViews' => $projectViews));
     Yii::endProfile('project_view');
 }
Example #5
0
 public function actionView($userId)
 {
     Yii::beginProfile('builder_view');
     $builderRatingReadOnly = false;
     $session = Yii::app()->session;
     $builder = BuilderProfileApi::getBuilderDetails($userId);
     if (!$builder) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     $builderInfo = UserApi::getUserProfileDetails($builder->user_id);
     $builderAddress = DbUtils::getAddress($builder->city_id);
     $builderProjectTypeIds = ProjectApi::getProjectTypesByUserId($builder->user_id);
     $builderProjectTypes = "";
     if ($builderProjectTypeIds) {
         foreach ($builderProjectTypeIds as $builderProjectTypeId) {
             $builderProjectTypes[$builderProjectTypeId->project_type_id] = ProjectTypesApi::getProjectTypeById($builderProjectTypeId->project_type_id);
         }
     }
     $builderProjects = ProjectApi::getProjectsOfUser($builder->user_id, Yii::app()->params['dashboardResultsPerPage']);
     $builderLocations = UserBuilderLocationsApi::getLocations($builder->id);
     $builderProjectLocations = "";
     if ($builderLocations) {
         foreach ($builderLocations as $builderLocation) {
             $builderProjectLocations[] = DbUtils::getAddress($builderLocation->city_id);
         }
     }
     $builderRatingReadOnly = BuilderRatingApi::isRated($builder->id, Yii::app()->user->id);
     $builderRating = BuilderRatingApi::getRating($builder->id);
     if (!$builderRatingReadOnly) {
         if ($builder->user_id == Yii::app()->user->id) {
             $builderRatingReadOnly = true;
         } else {
             $builderRatingReadOnly = false;
         }
     } else {
         $builderRatingReadOnly = true;
     }
     $this->render('view', array('builder' => $builder, 'builderInfo' => $builderInfo, 'builderAddress' => $builderAddress, 'builderProjectTypes' => $builderProjectTypes, 'builderProjectLocations' => $builderProjectLocations, 'builderProjects' => $builderProjects, 'builderRatingReadOnly' => $builderRatingReadOnly, 'builderRating' => $builderRating));
     Yii::endProfile('builder_view');
 }