Exemplo n.º 1
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');
 }
Exemplo n.º 2
0
echo $form->textField($model, 'project_name', array('class' => 'txtbox'));
?>
	</li>
	<li class="error_message"><?php 
echo $form->error($model, 'project_name');
?>
</li>
</ul>
<ul>
	<li>
		<span><?php 
echo $form->labelEx($model, 'project_type_id');
?>
</span> 
		<?php 
echo $form->dropDownList($model, 'project_type_id', CHtml::listData(ProjectTypesApi::getAll(), 'id', 'project_type'), array('empty' => 'Select', 'class' => 'slctbox'));
?>
	</li>
	<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');
?>
Exemplo n.º 3
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');
 }