public function indexAction() { $this->_helper->layout->setLayout('3column-profile-user-where-i-am'); $this->view->otherUserId = $this->view->userId = $userid = $this->_getParam('id'); $userM = new Application_Model_User(); $userM = $userM->find($userid); $this->view->userObject = $userM; //Redirect user if not active, added by Mahipal Adhikari on 3-jan-2011 if (false === $userM->checkUserActiveStatus($userid)) { $this->_helper->redirector('index', 'index'); } //get logged in user id $userNs = new Zend_Session_Namespace('members'); $loggedin_id = $userNs->userId; //redirect user to Where-I-Am page if viewing own profile, added by mahipal on 7-Feb-2011 if ($loggedin_id == $userid) { $this->_redirect($this->view->seoUrl('/gapper/where-i-am/')); } /************************ Check user Whre-I-Am privacy settings START *****************/ $user_id = $userid; //echo "user id=".$user_id." and Login id=".$loggedin_id; //now check user where-i-am privacy permissions $view_profile = false; $userObj = new Application_Model_User(); $view_profile = $userObj->checkUserPrivacySettings($user_id, $loggedin_id, 1); //if logged in user has no permission then display error page if (!$view_profile) { //$this->view->error_message = "You are not authorised to view <b>".$userM->getFirstName()." ".$userM->getLastName()."</b>'s location."; $this->view->user_id = $user_id; $this->render('error'); } //get Where I am (Map) permission $view_map = false; $view_map = $userObj->checkUserPrivacySettings($user_id, $loggedin_id, 3); if (false == $view_map) { $this->_helper->redirector('view', 'profile', 'default', array('username' => $userM->getUsername())); //$this->view->error_message = "You are not authorised to view <b>".$userM->getFirstName()." ".$userM->getLastName()."</b>'s map location."; //$this->render('error'); } $this->view->view_map = $view_map; /************************ Check user privacy settings END *****************/ $this->view->postWallAccess = false; if (false !== $userObj->getUserConnection($user_id, $loggedin_id)) { $this->view->postWallAccess = true; } $this->view->countryName = $userM->getCountryName(); $this->view->cityName = $userM->getCityName(); $this->view->userThumb = $userM->getThumbnail(); $this->view->fullName = $userM->getFirstName() . " " . $userM->getLastName(); $destinationM = new Application_Model_Destination(); $destination = $destinationM->fetchAll(); $this->view->destination = $destination; $experienceM = new Application_Model_Experiences(); $destinationId = $this->getRequest()->getParam('destination_id'); /*--find the current location coordinates --*/ $gapperLocationM = new Application_Model_GapperLocation(); $where = "user_id='{$userid}'"; $order = "addedon desc"; $gapperLocation = $gapperLocationM->fetchRow($where, $order); if (false == $gapperLocation) { //these are default coordinates. $this->view->myLongitude = ""; $this->view->myLatitude = ""; //if user have no coordinates then redirect its profile page $this->_helper->redirector('view', 'profile', 'default', array('username' => $userM->getUsername())); } else { $this->view->myLongitude = $gapperLocation->getLongitude(); $this->view->myLatitude = $gapperLocation->getLatitude(); } /*------------------------------------------*/ }
public function whereIAmAction() { $this->_helper->layout->setLayout('3column-my-account'); $userNs = new Zend_Session_Namespace('members'); $this->view->userId = $userId = $userNs->userId; $user = new Application_Model_User(); $user = new Application_Model_User(); $this->view->loc = $user->getNearByUser($userId, 1000, 20); //var_dump($this->view->loc); $user = $user->find($userNs->userId); $this->view->loginUrl = ""; $facebook = $this->view->facebook(); if ($user->getFacebookId() == "" || is_null($user->getFacebookId())) { $return_url = Zend_Registry::get('siteurl') . "/index/do-fb-return/"; $cancel_url = Zend_Registry::get('siteurl') . "/index/cancel-facebook"; $this->view->loginUrl = $loginUrl = $facebook->getLoginUrl(array("cancel_url" => $cancel_url, "next" => $return_url, "req_perms" => "offline_access,publish_stream,read_stream,email,user_birthday,user_location", "display" => "popup")); } $userM = new Application_Model_User(); $userM = $userM->find($userId); $this->view->countryName = $userM->getCountryName(); $this->view->cityName = $userM->getCityName(); $this->view->userThumb = $userM->getThumbnail(); $this->view->fullName = $userM->getFirstName() . " " . $userM->getLastName(); $destinationM = new Application_Model_Destination(); $destination = $destinationM->fetchAll(); $this->view->destination = $destination; $experienceM = new Application_Model_Experiences(); $destinationId = $this->getRequest()->getParam('destination_id'); /*--find the current location coordinates --*/ $gapperLocationM = new Application_Model_GapperLocation(); $where = "user_id='{$userId}'"; $order = "addedon desc"; $gapperLocation = $gapperLocationM->fetchRow($where, $order); if (false == $gapperLocation) { //these are default coordinates. $this->view->myLongitude = ""; $this->view->myLatitude = ""; $this->view->addedon = ""; } else { $this->view->myLongitude = $gapperLocation->getLongitude(); $this->view->myLatitude = $gapperLocation->getLatitude(); $this->view->addedon = $gapperLocation->getAddedon(); } /*------------------------------------------*/ }