public function run() { $userIds = null; if ($this->messages) { foreach ($this->messages as $message) { $userIds[] = $message->from_user_id; } } $first_name = DbUtils::getDbValues(new UserProfiles(), 'user_id', $userIds, 'first_name'); $last_name = DbUtils::getDbValues(new UserProfiles(), 'user_id', $userIds, 'last_name'); $this->render('pmbInbox', array('messages' => $this->messages, 'first_name' => $first_name, 'last_name' => $last_name, 'unread' => $this->unread, 'pages' => $this->pages)); }
public function actionView($id) { Yii::beginProfile('requirements_view'); //$requirements=RequirementApi::getRequirementByUserId(Yii::app()->user->id); //$this->render('view',array('requirements'=>$requirements)); $session = Yii::app()->session; $requirement = RequirementApi::getRequirementById($id); if (!$requirement) { throw new CHttpException(404, 'The requested page does not exist.'); } $userDetails = UserApi::getUserProfileDetails($requirement->user_id); $propertyIds = RequirementPropertyTypesApi::getPropertyTypesByRequirementId($id); $properties = ""; $propertyNames = ""; if ($propertyIds) { foreach ($propertyIds as $propertyId) { $properties[] = $propertyId->property_type_id; } $propertyNames = DbUtils::getDbValues(new PropertyTypes(), 'id', $properties, 'property_type'); } $amenityIds = RequirementAmenitiesApi::getAmenitiesByRequirementId($id); $amenities = ""; $amenityNames = ""; if ($amenityIds) { foreach ($amenityIds as $amenityId) { $amenities[] = $amenityId->amenity_id; } $amenityNames = DbUtils::getDbValues(new CategoryAmenities(), 'id', $amenities, 'amenity'); } $cityIds = RequirementCitiesApi::getCitiesByRequirementId($id); $cities = ""; $cityNames = ""; if ($cityIds) { foreach ($cityIds as $cityId) { $cities[] = $cityId->city_id; } $cityNames = DbUtils::getDbValues(new GeoCity(), 'id', $cities, 'city'); } $bedroomsRequirement = RequirementBedroomsApi::getBedroomsByRequirementId($id); $this->render('view', array('requirement' => $requirement, 'amenityNames' => $amenityNames, 'cityNames' => $cityNames, 'propertyNames' => $propertyNames, 'bedroomsRequirement' => $bedroomsRequirement, 'userDetails' => $userDetails)); Yii::endProfile('requirements_view'); }
public function actionIndex() { $userId = Yii::app()->user->id; $projectImages = ''; $propertyImages = ''; $projectCount = ''; $propertyCount = ''; $propertyTypes = ''; $propertyLocations = ''; $propertyid = ''; $projectLocations = ''; $projectOwnerships = ''; $projectTypes = ''; $users = ''; $userIds[] = ''; $myJukeBox = ''; $jukeBoxcategoryName = ''; $jukecount = '0'; $propertyWishList = ''; $propertyName = ''; $projectWishlist = ''; $projectName = ''; $propertywishlistcount = 0; $inbox = PmbApi::getInbox($userId); $userName = UserApi::getUserProfileDetails($userId); if ($inbox) { foreach ($inbox as $messages) { $userIds[] = $messages->from_user_id; } $users = DbUtils::getDbValues(new UserProfiles(), 'user_id', $userIds, 'first_name'); } $properties = PropertyApi::getPropertiesOfUser($userId, Yii::app()->params['dashboardResultsPerPage']); $countUnread = PmbApi::getUnreadInboxCount($userId); $propertyCount = PropertyApi::getAllPropertiesCount($userId); $locations = ''; if ($properties) { foreach ($properties as $location) { $locations[] = $location->city_id; } $propertyLocations = DbUtils::getDbValues(new GeoCity(), 'id', $locations, 'city'); } if ($properties) { foreach ($properties as $property) { $propertyTypes[] = $property->property_type_id; $propertyid[] = $property->id; } $propertyImages = PropertyImagesApi::getPrimaryImageForProperties($propertyid); $propertyTypes = DbUtils::getDbValues(new PropertyTypes(), 'id', $propertyTypes, 'property_type'); } $projects = ProjectApi::getProjectsOfUser($userId, Yii::app()->params['dashboardResultsPerPage']); if ($projects) { foreach ($projects as $project) { $projectLocationIds[] = $project->city_id; $projectTypeIds[] = $project->project_type_id; $projectOwnershipIds[] = $project->ownership_type_id; $projectIds[] = $project->id; } $projectImages = ProjectImagesApi::getPrimaryImageForProjects($projectIds); $projectLocations = DbUtils::getDbValues(new GeoCity(), 'id', $projectLocationIds, 'city'); $projectTypes = DbUtils::getDbValues(new ProjectTypes(), 'id', $projectTypeIds, 'project_type'); $projectOwnerships = DbUtils::getDbValues(new CategoryOwnershipTypes(), 'id', $projectOwnershipIds, 'ownership_type'); } $projectCount = ProjectApi::getProjectsofUserCount($userId); $isProfile['agent'] = AgentProfileApi::isAgent($userId); $isProfile['builder'] = BuilderProfileApi::isBuilder($userId); $isProfile['specialist'] = SpecialistProfileApi::isSpecialist($userId); //MyJuckbox $myJukeBox = JukeboxQuestionsApi::getAllJukeboxQuestionsOfUser($userId, Yii::app()->params['dashboardResultsPerPage']); if ($myJukeBox) { foreach ($myJukeBox as $jukeBox) { $categoryIdArray[] = $jukeBox->category_id; } $jukeBoxcategoryName = DbUtils::getDbValues(new JukeboxCategory(), 'id', $categoryIdArray, 'category'); $jukecount = count($myJukeBox); } //my wishlists $propertyWishList = PropertyWishlistApi::getWishlist($userId, Yii::app()->params['dashboardResultsPerPage']); if ($propertyWishList) { foreach ($propertyWishList as $propertyWish) { $propertyWishlistArray[] = $propertyWish->property_id; } $propertyName = DbUtils::getDbValues(new Property(), 'id', $propertyWishlistArray, 'property_name'); } $propertywishlistcount = PropertyWishlistApi::getWishlistCount($userId); $totalWishlistCount = $propertywishlistcount; //+$projectwishlistcount; //requirements $requirements = RequirementApi::getRequirementByUserId($userId, Yii::app()->params['dashboardResultsPerPage']); if ($requirements) { $requirementscount = count($requirements); } else { $requirementscount = 0; } $this->render('index', array('inbox' => $inbox, 'users' => $users, 'properties' => $properties, 'countUnread' => $countUnread, 'propertyLocations' => $propertyLocations, 'propertyTypes' => $propertyTypes, 'projects' => $projects, 'projectLocations' => $projectLocations, 'projectTypes' => $projectTypes, 'projectOwnerships' => $projectOwnerships, 'propertyCount' => $propertyCount, 'projectCount' => $projectCount, 'propertyid' => $propertyid, 'propertyImages' => $propertyImages, 'projectImages' => $projectImages, 'isProfile' => $isProfile, 'myJukeBox' => $myJukeBox, 'jukeBoxcategoryName' => $jukeBoxcategoryName, 'jukecount' => $jukecount, 'propertyWishList' => $propertyWishList, 'propertyName' => $propertyName, 'projectName' => $projectName, 'totalWishlistCount' => $totalWishlistCount, 'requirements' => $requirements, 'requirementscount' => $requirementscount, 'userName' => $userName)); }
echo $specialistProfile->email; ?> </p> <br class="clear" /> </td> </tr> </table> <br class="clear" /> <?php if ($specialistProjects) { $specialistIds = null; foreach ($specialistProjects as $specialistProject) { $specialistIds[] = $specialistProject->specialist_type_id; } $specialists = DbUtils::getDbValues(new Specializations(), 'id', $specialistIds, 'specialist'); echo '<div class="specialist_project_details"><h1>Project Details</h1><ul>'; foreach ($specialistProjects as $specialistProject) { echo '<li><img src="images/photo1.jpg" alt="" class="left" /> <div class="right" style="width:550px;"> <h2>' . $specialistProject->project_name . '</h2> <p class="red-txt"><b>' . $specialists[$specialistProject->specialist_type_id] . '</b> </p> <p>' . $specialistProject->description . '</p> </div> <br class="clear" /> </li>'; } echo '</ul></div>'; } ?> </div>
public static function getAmenitiesById($amenitiesId) { return DbUtils::getDbValues(new CategoryAmenities(), 'id', $amenitiesId, 'amenity '); $models = CategoryAmenities::model()->findAllBySql("SELECT * FROM category_amenities where id IN\n\t\t(SELECT amenity_id FROM property_amenities WHERE property_id=:propertyId)", array(':propertyId' => $propertyId)); }