public function run() { $image = ImageUtils::getDefaultImage('profiles'); $ids = array(); foreach ($this->users as $user) { $ids[] = $user->id; } $images = UserPhotosApi::getPrimaryImageForUsers($ids); $this->render('peopleResults', array('modelProperty' => $this->modelProperty, 'modelUser' => $this->modelUser, 'modelProfile' => $this->modelProfile, 'users' => $this->users, 'images' => $images, 'ids' => $ids, 'image' => $image, 'totalResults' => $this->totalResults, 'pages' => $this->pages, 'userType' => $this->userType)); }
public function run() { $image = ImageUtils::getDefaultImage('properties'); $ids = array(); foreach ($this->properties as $property) { $ids[] = $property->id; } $images = PropertyImagesApi::getPrimaryImageForProperties($ids); $this->render('propertylist', array('properties' => $this->properties, 'images' => $images, 'ids' => $ids, 'image' => $image)); }
public function run() { $image = ImageUtils::getDefaultImage('profiles'); $ids = array(); foreach ($this->users as $user) { $ids[] = $user->id; } $images = UserPhotosApi::getPrimaryImageForUsers($ids); $this->render('peopleSearchResults', array('modelProperty' => $this->modelProperty, 'modelUser' => $this->modelUser, 'modelProfile' => $this->modelProfile, 'users' => $this->users, 'images' => $images, 'ids' => $ids, 'image' => $image, 'pagesAgent' => $this->pagesAgent, 'pagesUser' => $this->pagesUser, 'pagesBuilder' => $this->pagesBuilder, 'pagesSpecialists' => $this->pagesSpecialists)); }
public function run() { $image = ImageUtils::getDefaultImage('projects'); $ids = array(); if ($this->projects) { foreach ($this->projects as $project) { $ids[] = $project->id; } } $images = ProjectImagesApi::getPrimaryImageForProjects($ids); $this->render('projectSearchResults', array('modelProject' => $this->modelProject, 'modelCity' => $this->modelCity, 'projectAmenities' => $this->projectAmenities, 'projects' => $this->projects, 'images' => $images, 'ids' => $ids, 'image' => $image, 'pagesProject' => $this->pagesProject)); }
public function run() { $images = null; $image = ImageUtils::getDefaultImage('properties'); $ids = array(); if ($this->properties) { foreach ($this->properties as $property) { $ids[] = $property->id; } $images = PropertyImagesApi::getPrimaryImageForProperties($ids); } $this->render('propertySearchResults', array('pages' => $this->pages, 'modelProperty' => $this->modelProperty, 'modelCity' => $this->modelCity, 'propertyAmenities' => $this->propertyAmenities, 'properties' => $this->properties, 'images' => $images, 'ids' => $ids, 'image' => $image, 'propertiesCount' => $this->propertiesCount, 'wishlistRemove' => $this->wishlistRemove)); }
public static function getImage($userId) { $model = UserBuilderProfile::model()->find('user_id=:userId', array(':userId' => $userId)); $result = ImageUtils::getDefaultImage('builders'); if ($model && $model->image) { $result = ImageUtils::getImageUrl('builders', $userId, $model->image); } return $result; }
<div> <table width="909" border="0" cellspacing="0" cellpadding="0" class="my_messages"> <thead> <tr> <th width="400" style="padding-left: 8px;">Property Name</th> <th width="130">City</th> <th width="128" align="left">Property Type</th> <th width="198" align="left">Looking To</th> <th width="42" align="left"></th> </tr> </thead> <?php if ($properties) { foreach ($properties as $property) { $image = ImageUtils::getDefaultImage('properties'); if (isset($propertyImages[$property->id])) { $image = $propertyImages[$property->id]; } echo '<tr> <td colspan="5"> <a href="/property/' . $property->id . '"><div class="c1_1">' . $property->property_name . '</div> <div class="c2_1">' . $propertyLocations[$property->city_id] . '</div> <div class="c3_1">' . $propertyTypes[$property->property_type_id] . '</div> <div class="c4">' . $property->i_want_to . '</div><div class="c5_1"><img src="' . $image . '" alt="" width="61" height="40" /></div></a></td> </tr>'; } echo '<tr><td colspan="5"><div align="right"><a href="/properties" class="red-txt">View All Properties</a></div></td></tr>'; } else { echo '<tr> <td colspan="5"> <div class="red-txt" align="center"><b>No Properties</b></div> </td> </tr>';
public function actionAllwheels() { $userId = Yii::app()->user->id; $userId = 2; $wheelDetails = array(); $allWheels = WheelApi::getWheelsByUserId($userId); $i = 0; foreach ($allWheels as $allWheel) { $wheelArray[$i++] = $allWheel->id; } $wheelImages = ImagesApi::getPrimaryImageForWheels($wheelArray); $wheelDefaultImage = ImageUtils::getDefaultImage('wheel'); if ($allWheels) { foreach ($allWheels as $wheel) { $color = ColorApi::getColorById($wheel->color_id); $make = MakeApi::getMakeById($wheel->make_id); $model = ModelApi::getModelById($wheel->model_id); $entityId = EntityApi::getIdByType('WHEEL'); $wheelRate = FeedbackApi::getRating($wheel->id, $entityId, 'WHEEL'); $wheelRides = RidesApi::getCountOfWheelRides($wheel->id); $wheelPals = WheelApi::getNoOfPalsMetByWheelId($wheel->id); $wheelEcoMiles = RidesApi::getEcoMilesDrivenByWheel($wheel->id); $wheelRidesCount = 0; $wheelNotification = RidesApi::getUpcomingWheelRides($wheel->id); if ($wheelNotification) { $wheelRidesCount = count($wheelNotification); } $wheelDetails[$wheel->id] = array('color' => $color->color, 'make' => $make->make, 'model' => $model->model, 'rate' => round($wheelRate), 'wheelRides' => $wheelRides, 'wheelPals' => $wheelPals[0]['palcnt'], 'wheelEcoMiles' => $wheelEcoMiles, 'wheelRidesCount' => $wheelRidesCount); } } $this->render('allwheels', array('allWheels' => $allWheels, 'wheelDetails' => $wheelDetails, 'wheelImages' => $wheelImages, 'wheelDefaultImage' => $wheelDefaultImage)); }
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'); }