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'); }
$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 /> </div> <div class="right" style="width:533px;"> <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;
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'); }
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'); }
public function actionView($userId) { Yii::beginProfile('specialist_view'); $session = Yii::app()->session; $specialist = SpecialistProfileApi::getSpecialistDetails($userId); if (!$specialist) { throw new CHttpException(404, 'The requested page does not exist.'); } $specialistInfo = UserApi::getUserProfileDetails($specialist->user_id); $specialistAddress = DbUtils::getAddress($specialist->city_id); $specialistTypes = SpecialistTypeApi::getSpecialistTypeByUserId($specialist->user_id); $specialistProjects = SpecialistApi::getSpecialistProjectsByUserId($specialist->user_id); $specialistRatingReadOnly = SpecialistRatingApi::isRated($specialist->id, Yii::app()->user->id); $specialistRating = SpecialistRatingApi::getRating($specialist->user_id); $specialistLocations = UserSpecialistLocationsApi::getLocations($specialist->id); $specialistPropertyLocations = ""; if ($specialistLocations) { foreach ($specialistLocations as $specialistLocation) { $specialistPropertyLocations[] = DbUtils::getAddress($specialistLocation->city_id); } } if (!$specialistRatingReadOnly) { if ($specialist->user_id == Yii::app()->user->id) { $specialistRatingReadOnly = true; } else { $specialistRatingReadOnly = false; } } else { $specialistRatingReadOnly = true; } $this->render('view', array('specialist' => $specialist, 'specialistInfo' => $specialistInfo, 'specialistAddress' => $specialistAddress, 'specialistTypes' => $specialistTypes, 'specialistProjects' => $specialistProjects, 'specialistRatingReadOnly' => $specialistRatingReadOnly, 'specialistRating' => $specialistRating, 'specialistPropertyLocations' => $specialistPropertyLocations)); Yii::endProfile('specialist_view'); }
public function actionView($id) { Yii::beginProfile('view_profile'); //$session = Yii::app()->session; $wheelsImages = array(); $wheelImages = array(); $lastRide = array(); $user = UserApi::getUserById($id); if (!$user) { throw new CHttpException(404, 'The requested page does not exist.'); } $userAge = UserApi::getAge($user->dob); $userAddress = ""; if ($user->city_id) { $userAddress = DbUtils::getAddress($user->city_id); } $imageUserId = array($id); $image = ImagesApi::getPrimaryImageForUsers($imageUserId); if ($image) { $userImage = $image[$id]; } else { $userImage = ImageUtils::getDefaultImage('user'); } $userWheelDefault = ImageUtils::getDefaultImage('wheel'); $userRides = RidesApi::getCountOfUserRides($id); $userEcoMiles = RidesApi::getEcoMilesDrivenByUser($id); $userWheel = WheelApi::getWheelsCount($id); $userPalsCount = UserPalsApi::getPalsCount($id); $entityId = EntityApi::getIdByType("user"); $driverRating = round(FeedbackApi::getRating($id, $entityId, 'DRIVER')); $passengerRating = round(FeedbackApi::getRating($id, $entityId, 'PASSENGER')); $userPals = UserPalsApi::getAllPals($id); $userPalDefaultImage = ImageUtils::getDefaultImage('user'); $lastRide = RidesApi::getLastRide($id); $lastRideWheel = WheelApi::getWheelById($lastRide[0]['wheel_id']); $userWheels = WheelApi::getWheelsByUserId($id); $favoriteWheel = WheelApi::getFavouriteWheel($id); $userFeedback = FeedbackApi::getAllFeedback($id, $entityId); $favWheelDetail = ""; $wheelMake = ""; $wheelModel = ""; $wheelColor = ""; $wheelRides = ""; $wheelEcoMiles = ""; $wheelPals = ""; $wheelPalCnt = ""; if ($favoriteWheel) { $favWheelDetail = WheelApi::getWheelById($favoriteWheel[0]["wheel_id"]); $wheelMake = MakeApi::getMakeById($favWheelDetail->make_id); $wheelModel = ModelApi::getModelById($favWheelDetail->model_id); $wheelColor = ColorApi::getColorById($favWheelDetail->color_id); $wheelRides = RidesApi::getCountOfWheelRides($favWheelDetail->id); $wheelImage = ImagesApi::getPrimaryImageForWheels(array($favoriteWheel[0]["wheel_id"])); if (!$wheelImage) { $wheelImage = $userWheelDefault; } $wheelEcoMiles = RidesApi::getEcoMilesDrivenByWheel($favWheelDetail->id); $wheelPals = WheelApi::getNoOfPalsMetByWheelId($favWheelDetail->id); $wheelPalCnt = $wheelPals[0]['palcnt']; } $i = 0; if ($userFeedback) { foreach ($userFeedback as $feedback) { $fromUserProfile = UserApi::getUserById($feedback->from_user_id); $fromUserIds[$i] = $feedback->from_user_id; $userName = UserApi::getNameByUserId($fromUserProfile->id); $userFeedbackDetails[$i++] = array('from_id' => $feedback->from_user_id, 'userName' => $userName, 'feedback' => $feedback->feedback); } } $i = 0; $j = 0; $userPalList = ""; $palScrollLabel = ""; $mergeArray = array_merge($userPals, $fromUserIds); $userIdList = array_unique($mergeArray); $userImages = ImagesApi::getPrimaryImageForUsers($userIdList); $imageArrayIndex = array_keys($userImages); $imageArrayIndexSize = count($imageArrayIndex); //var_dump($userPals); // var_dump($fromUserIds);die(); if ($userPals) { foreach ($userPals as $userPal) { $userPalList[$i++] = userapi::getUserById($userPal); } } if ($userIdList) { foreach ($userIdList as $userId) { for ($j = 0; $j < $imageArrayIndexSize; $j++) { $palsImages[$userId] = ''; if ($imageArrayIndex[$j] == $userId) { $palsImages[$userId] = $userImages[$userId]; break; } } if ($palsImages[$userId] == '') { $palsImages[$userId] = $userPalDefaultImage; } } } if ($userWheels) { foreach ($userWheels as $wheel) { $wheelIds[$wheel->id] = $wheel->id; } if ($wheelIds) { $wheelImages = ImagesApi::getPrimaryImageForWheels($wheelIds); if ($wheelImages) { $imageArrayIndex = array_keys($wheelImages); $imageArrayIndexSize = count($imageArrayIndex); foreach ($wheelIds as $wheelId) { for ($j = 0; $j < $imageArrayIndexSize; $j++) { $wheelsImages[$wheelId] = ''; if ($imageArrayIndex[$j] == $wheelId) { $wheelsImages[$wheelId] = $wheelImages[$wheelId]; break; } } if ($wheelsImages[$wheelId] == '') { $wheelsImages[$wheelId] = $userWheelDefault; } } } } } /*$palCntArray=ceil($userPalsCount/3); $l=0; if($userPalsCount>2){ for($i=0;$i<$palCntArray-1;$i++){ $palScroll[$i]=array($userPalList[$l],$userPalList[$l+1],$userPalList[$l+2]); $l=$l+3; } } while($l<$userPalsCount) { $palScroll[$palCntArray-1]=array($userPalList[$l]); $l++; } $palScrollLabel=$palScroll[0]; } $k=1; if (isset($_POST['ajxbtn'])){ if($k < $palCntArray) $palScrollLabel=$palScroll[$k]; $k++; } */ $this->render('view', array('user' => $user, 'userAddress' => $userAddress, 'userPalsCount' => $userPalsCount, 'userAge' => $userAge, 'userImage' => $userImage, 'userEcoMiles' => $userEcoMiles, 'userPals' => $userPals, 'userRides' => $userRides, 'userWheel' => $userWheel, 'driverRating' => $driverRating, 'passengerRating' => $passengerRating, 'userPalList' => $userPalList, 'favWheelDetail' => $favWheelDetail, 'wheelMake' => $wheelMake, 'wheelColor' => $wheelColor, 'wheelModel' => $wheelModel, 'wheelRides' => $wheelRides, 'wheelEcoMiles' => $wheelEcoMiles, 'wheelPalCnt' => $wheelPalCnt, 'palScrolls' => $palScrollLabel, 'palImages' => $palsImages, 'userFeedbackDetails' => $userFeedbackDetails, 'wheelsImages' => $wheelsImages, 'userWheels' => $userWheels, 'wheelImage' => $wheelImage, 'lastRide' => $lastRide, 'lastRideWheel' => $lastRideWheel)); Yii::endProfile('view_profile'); }