public function run()
 {
     $userId = Yii::app()->user->id;
     $isAgent = AgentProfileApi::isAgent($userId);
     $isBuilder = BuilderProfileApi::isBuilder($userId);
     $isSpecialist = SpecialistApi::isSpecialist($userId);
     $users = array('isAgent' => $isAgent, 'isBuilder' => $isBuilder, 'isSpecialist' => $isSpecialist);
     $this->render('manageownerprofile', array('users' => $users));
 }
Beispiel #2
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');
 }
 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');
 }