当前位置: 首页>>代码示例>>PHP>>正文


PHP Application_Model_User::getUserConnection方法代码示例

本文整理汇总了PHP中Application_Model_User::getUserConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP Application_Model_User::getUserConnection方法的具体用法?PHP Application_Model_User::getUserConnection怎么用?PHP Application_Model_User::getUserConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Application_Model_User的用法示例。


在下文中一共展示了Application_Model_User::getUserConnection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkRelation

 public function checkRelation($userId, $loggedinUserId)
 {
     $objModelUser = new Application_Model_User();
     $strPermission = "permission='5'";
     if ($loggedinUserId != "") {
         $strPermission .= " OR permission='1'";
     }
     $relation = $objModelUser->getUserConnection($userId, $loggedinUserId);
     switch ($relation) {
         case 'friend':
             $strPermission .= " OR permission='2' OR  permission='6'";
             break;
         case 'own':
             $strPermission .= " OR permission='2' OR  permission='3' OR  permission='4'";
             break;
         case 'family':
             $strPermission .= " OR permission='3' OR  permission='6'";
             break;
     }
     return $strPermission;
 }
开发者ID:riteshsahu1981,项目名称:we,代码行数:21,代码来源:ProfileController.php

示例2: travelWallAction

 public function travelWallAction()
 {
     $username = $this->_getParam('username');
     $user = $this->getLeftPanel($username);
     $this->view->userObject = $user;
     $userM = new Application_Model_User();
     //Redirect user if not active, added by Mahipal Adhikari on 3-jan-2011
     if (false === $userM->checkUserActiveStatus($user->getId())) {
         $this->_helper->redirector('index', 'index');
     }
     /************************ Check user privacy settings START *****************/
     $userNs = new Zend_Session_Namespace('members');
     $loggedin_id = $userNs->userId;
     $user_id = $user->getId();
     //now check user profile privacy permissions
     $view_profile = false;
     $view_profile = $userM->checkUserPrivacySettings($user_id, $loggedin_id, 2);
     //if logged in user has no permission then display error page
     if (!$view_profile) {
         $this->view->user_id = $user_id;
         $this->render('error');
     }
     /************************ Check user privacy settings END *****************/
     //only users friend can post on Travel Wall
     $this->view->postWallAccess = false;
     if (false !== $userM->getUserConnection($user_id, $loggedin_id)) {
         $this->view->postWallAccess = true;
     }
     $this->view->loginUrl = "";
     $facebook = $this->view->facebook();
     if ($user->getFacebookId() == "" || is_null($user->getFacebookId())) {
         $this->view->loginUrl = $facebook->getLoginUrl();
     }
     if ($this->getRequest()->isPost()) {
         $userId = $user->getId();
         $this->_helper->layout->disableLayout();
         $this->_helper->viewRenderer->setNoRender(true);
         $params = $this->getRequest()->getParams();
         //$params['userId'] = $userId;
         //Added by Mahipal Adhikari on 28-Jan-2011, to save user profile id in which wall is posted and commented above
         $params['userId'] = $loggedin_id;
         $params['status'] = nl2br($params['status']);
         $wall = new Application_Model_Wall($params);
         $id = $wall->save();
         if ($id > 0) {
             //added by mahipal on 28-jan-2011
             /********  send email to User to whom wall is submitted START *************/
             $userM = new Application_Model_User();
             //get user details who submit comment
             $user = $userM->find($loggedin_id);
             $CommentedByName = $user->getFirstName() . " " . $user->getLastName();
             //get user details to whom wall is posted
             $objCommentedUser = $userM->find($params['profileId']);
             $mailOptions['CommentedPersonName'] = $objCommentedUser->getFirstName();
             $mailOptions['Comment'] = $params['status'];
             $mailOptions['wall_id'] = $id;
             $mailOptions['CommentedByName'] = $CommentedByName;
             $mailOptions['email'] = $objCommentedUser->getEmail();
             //send email to user if not posting own profile
             if ($params['profileId'] != $loggedin_id) {
                 $mail = new Base_Mail();
                 $mail->sendTravelWallEmail($mailOptions);
             }
             /********  send email to User to whom wall is submitted END *************/
             $arrayResult = array("id" => $id, 'error' => 0);
             //insert into feeds for logged in user
             $userM = new Application_Model_User();
             $userM = $userM->find($userId);
             $feed = "<b>" . $userM->getFirstName() . " " . $userM->getLastName() . "</b> | " . $params['status'] . "<br>";
             $feed .= "<span>1 Min ago</span> | <span>Comment</span> | <span><b>Like</b>";
             $feeds = new Application_Model_Feeds();
             $feeds->setUserId($userId);
             $feeds->setType('wall');
             $feeds->setFeed($feed);
             $feeds->save();
             // insert into feeds for friends
         } else {
             $arrayResult = array('error' => 1);
         }
         if (isset($params['facebook'])) {
             if ($user->getFacebookId() != "" && !is_null($user->getFacebookId())) {
                 $statusUpdate = $facebook->api('/' . $user->getFacebookId() . '/feed', 'post', array('message' => $params['status'], 'cb' => ''));
             }
         }
         echo Zend_Json::encode($arrayResult);
     }
     //Get last update
     $whereUser = "username='{$username}'";
     $arrUser = $userM->fetchAll($whereUser);
     $userId = $arrUser[0]->id;
     $objModelWall = new Application_Model_Wall();
     //$whereWall	=	"active_status=1 AND user_id={$userId}";
     $whereWall = "active_status=1 AND user_id={$userId} AND profile_id={$userId}";
     $orderWall = "addedon DESC";
     $countWall = 1;
     $offsetWall = 0;
     $arrWall = $objModelWall->fetchAll($whereWall, $orderWall, $countWall, $offsetWall);
     if ($arrWall) {
         $latestUpdates = $arrWall[0]->status;
         $latestupdatesDate = date("d F Y, g:i a", $arrWall[0]->addedon);
//.........这里部分代码省略.........
开发者ID:riteshsahu1981,项目名称:we,代码行数:101,代码来源:ProfileController-Backup-08-March-2011.php

示例3: checkBlogPrivacySettings

 /**
  * @Created By	: Mahipal Singh Adhikari
  * @Created On	: 28-Mar-2011
  * @Description	: Used to check individual blog permission check
  * @Param		: int - $userId, int-$loggedinUserId, int-$blogPermission
  * @Return		: boolean
  */
 public function checkBlogPrivacySettings($userId, $loggedinUserId, $blogPermission = 0)
 {
     $strPermissionArr = array(5);
     //select default public
     $view = false;
     //if user is Logged In & Permission is 1 (GD community)
     if ($loggedinUserId != "" && $blogPermission == 1) {
         $strPermissionArr = array(1, 5);
     }
     $objModelUser = new Application_Model_User();
     $relation = $objModelUser->getUserConnection($userId, $loggedinUserId);
     if (false !== $relation) {
         switch ($relation) {
             case 'own':
                 $strPermissionArr = array(1, 2, 4, 5, 6);
                 break;
             case 'friend':
                 $strPermissionArr = array(1, 2, 5, 6);
                 break;
             case 'family':
                 $strPermissionArr = array(1, 5, 6);
                 break;
         }
     }
     if (in_array($blogPermission, $strPermissionArr)) {
         $view = true;
     }
     return $view;
 }
开发者ID:riteshsahu1981,项目名称:we,代码行数:36,代码来源:Blog.php


注:本文中的Application_Model_User::getUserConnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。