當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Model_Users::isFollowUser方法代碼示例

本文整理匯總了PHP中Model_Users::isFollowUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model_Users::isFollowUser方法的具體用法?PHP Model_Users::isFollowUser怎麽用?PHP Model_Users::isFollowUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Model_Users的用法示例。


在下文中一共展示了Model_Users::isFollowUser方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: returnHtmlTop

 public static function returnHtmlTop($user, $recache = false)
 {
     static $view = null, $model_images = null, $request = null;
     if ($view === null) {
         $view = JO_View::getInstance();
     }
     if ($model_images === null) {
         $model_images = new Helper_Images();
     }
     if ($request === null) {
         $request = JO_Request::getInstance();
     }
     /*$response = array();
                     
     		if($users) {
     			$view = JO_View::getInstance();
     			$view->loged = JO_Session::get('user[user_id]');
     			$model_images = new Helper_Images();
     			foreach($users AS $key => $user) {
     			*/
     $user['thumbs'] = array();
     /*
     				for( $i = 0; $i < 8; $i ++) {
     					$image = isset( $user['pins_array'][$i] ) ? $user['pins_array'][$i]['image'] : false;
     					if($image) {
     						$data_img = Helper_Uploadimages::pin($user['pins_array'][$i], '_A');
     						if($data_img) {
     							$user['thumbs'][] = array(
     									'thumb' => $data_img['image'],
     									'href' => WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $user['pins_array'][$i]['pin_id'] ),
     									'title' => $user['pins_array'][$i]['title']
     							);
     						}
     					}
     				}
     * 
     */
     ////
     $avatar = Helper_Uploadimages::avatar($user, '_B');
     $user['avatar'] = $avatar['image'];
     //$user['Likers'] = true;
     $user['userLikeIgnore'] = true;
     if ($view->loged) {
         $user['userIsFollow'] = Model_Users::isFollowUser($user['user_id']);
         $user['userFollowIgnore'] = $user['user_id'] == JO_Session::get('user[user_id]');
     } else {
         $user['userFollowIgnore'] = true;
     }
     $user['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user['user_id']);
     $user['pins_href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=pins&user_id=' . $user['user_id']);
     $user['follow'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $user['user_id']);
     //$view->key = $key%2==0;
     $view->user = $user;
     $response = $view->render('boxTop', 'users');
     /*
     	}
     }
     */
     return $response;
 }
開發者ID:noikiy,項目名稱:amatteur,代碼行數:60,代碼來源:User.php

示例2: peopleAction

 public function peopleAction()
 {
     $this->setViewChange('index');
     $request = $this->getRequest();
     $page = (int) $request->getRequest('page');
     if ($page < 1) {
         $page = 1;
     }
     $query = $request->getRequest('q');
     $this->view->query = $query;
     $this->view->menuSearch = $this->searchMenu($query);
     $data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_username' => $query);
     $this->view->pins = '';
     $users = Model_Users::getUsers($data);
     if ($users) {
         $this->view->follow_user = true;
         $view = JO_View::getInstance();
         $view->loged = JO_Session::get('user[user_id]');
         $model_images = new Helper_Images();
         foreach ($users as $key => $user) {
             $avatar = Helper_Uploadimages::avatar($user, '_B');
             $user['avatar'] = $avatar['image'];
             if ($view->loged) {
                 $user['userIsFollow'] = Model_Users::isFollowUser($user['user_id']);
                 $user['userFollowIgnore'] = $user['user_id'] == JO_Session::get('user[user_id]');
             } else {
                 $user['userFollowIgnore'] = true;
             }
             $user['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user['user_id']);
             $user['follow'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $user['user_id']);
             $view->key = $key % 2 == 0;
             $view->user = $user;
             $this->view->pins .= $view->render('boxSearch', 'users');
         }
     }
     if ($request->isXmlHttpRequest()) {
         echo $this->view->pins;
         $this->noViewRenderer(true);
     } else {
         $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
     }
 }
開發者ID:noikiy,項目名稱:amatteur,代碼行數:42,代碼來源:SearchController.php

示例3: profileHelp

 private function profileHelp()
 {
     $request = $this->getRequest();
     $user_data = new Model_Users_User($request->getRequest('user_id'));
     if (!$user_data->count()) {
         $this->forward('error', 'error404');
     }
     if (!$user_data['facebook_connect']) {
         $user_data['facebook_id'] = 0;
     }
     if (!$user_data['twitter_connect']) {
         $user_data['twitter_id'] = 0;
     }
     $user_data['avatars'] = Helper_Uploadimages::userAvatars($user_data);
     //$user_data['image_href'] = $user_data['avatar'];
     if ($user_data['user_id'] == JO_Session::get('user[user_id]')) {
         $user_data['image_href'] = WM_Router::create($request->getBaseUrl() . '?controller=settings');
     } else {
         $user_data['image_href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user_data['user_id']);
     }
     $this->view->active = 'boards';
     if ($user_data['website'] && !preg_match('/^https?:\\/\\//', $user_data['website'])) {
         $user_data['website'] = 'http://' . $user_data['website'];
     }
     $this->view->userdata = $user_data;
     $this->view->self_profile = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user_data['user_id']);
     $this->view->user_pins = WM_Router::create($request->getBaseUrl() . '?controller=users&action=pins&user_id=' . $user_data['user_id']);
     $this->view->user_pins_likes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=pins&user_id=' . $user_data['user_id'] . '&filter=likes');
     $this->view->settings = WM_Router::create($request->getBaseUrl() . '?controller=settings');
     $this->view->user_activity = WM_Router::create($request->getBaseUrl() . '?controller=users&action=activity&user_id=' . $user_data['user_id']);
     $this->view->user_followers = WM_Router::create($request->getBaseUrl() . '?controller=users&action=followers&user_id=' . $user_data['user_id']);
     $this->view->user_following = WM_Router::create($request->getBaseUrl() . '?controller=users&action=following&user_id=' . $user_data['user_id']);
     $this->view->edit_description = WM_Router::create($request->getBaseUrl() . '?controller=users&action=editDescription');
     $this->view->enable_edit = JO_Session::get('user[user_id]') && JO_Session::get('user[user_id]') == $user_data['user_id'];
     /* v2.2 mod */
     $this->view->enable_follow = JO_Session::get('user[user_id]') && JO_Session::get('user[user_id]') != $user_data['user_id'] && (Helper_Config::get('config_enable_follow_private_profile') ? $user_data['enable_follow'] : true);
     /* v2.2 mod */
     $this->view->order_boards = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=sort_order');
     $this->view->reload_page = $request->getFullUrl();
     if (JO_Session::get('user[user_id]') && $user_data['user_id'] != JO_Session::get('user[user_id]')) {
         $this->view->userIsFollow = Model_Users::isFollowUser($user_data['user_id']);
         $this->view->follow_user = WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $user_data['user_id']);
     }
     $this->view->class_contaner = $request->getAction();
     $data = array('start' => 0, 'limit' => 3, 'filter_history_action' => Model_History_Abstract::REPIN);
     $history = new Model_History_Activity($data, 'from_user_id', $user_data['user_id']);
     $this->view->history_data = array();
     $this->view->title_right = $this->translate('Repins from');
     if (!$history->count()) {
         $this->view->title_right = $this->translate('Following');
         $data['filter_history_action'] = Model_History_Abstract::FOLLOW_USER;
         $history = new Model_History_Activity($data, 'from_user_id', $user_data['user_id']);
     }
     if ($history->count()) {
         foreach ($history as $r) {
             $ud = array();
             foreach ($r as $k => $v) {
                 if (strpos($k, 'user_') === 0) {
                     $ud[substr($k, 5)] = $v;
                 }
             }
             $this->view->history_data[] = array('title' => $r['user_fullname'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $r['user_user_id']), 'avatars' => Helper_Uploadimages::userAvatars($ud));
         }
     }
     //extensions
     $user_data['user_social_icons'] = array();
     $user_login_buttons = Model_Extensions::getByMethod('user_login');
     $tmp = $user_data;
     foreach ($user_login_buttons as $id => $login) {
         $user_data['user_social_icons'][] = $this->view->callChildren('modules_' . $login . '_profileicons', (array) $tmp);
     }
     ////metas
     $user_data['meta_title'] = $user_data['fullname'] . ' ' . sprintf($this->translate('on %s'), Helper_Config::get('site_name'));
     $this->getLayout()->placeholder('title', $user_data['meta_title']);
     JO_Layout::getInstance()->placeholder('header_metas', $this->view->callChildren('users/header_metas', $user_data));
     return $user_data;
 }
開發者ID:NareshChennuri,項目名稱:pyng,代碼行數:77,代碼來源:UsersController.php

示例4: UnFollowBoard

 public static function UnFollowBoard($user_id, $board_id)
 {
     if (!(string) JO_Session::get('user[user_id]')) {
         return false;
     }
     $db = JO_Db::getDefaultAdapter();
     $row = $db->delete('users_following', array('user_id = ?' => (string) JO_Session::get('user[user_id]'), 'board_id = ?' => (string) $board_id));
     $flw = false;
     if ($row || ($flw = Model_Users::isFollowUser($user_id))) {
         $db->update('boards', array('followers' => new JO_Db_Expr('followers-1')), array('board_id = ?' => (string) $board_id));
         if ($flw) {
             $db->insert('users_following_ignore', array('user_id' => (string) JO_Session::get('user[user_id]'), 'board_id' => (string) $board_id, 'following_id' => (string) $user_id));
             $row = $db->lastInsertId();
         }
     }
     return $row;
 }
開發者ID:NareshChennuri,項目名稱:pyng,代碼行數:17,代碼來源:Users.php

示例5: returnHtmlDetail


//.........這裏部分代碼省略.........
         } else {
             $view->source = Model_Source::getSource($pin['source_id']);
         }
     } else {
         $view->source = Model_Source::getSource($pin['source_id']);
         if ($pin['repin_from']) {
             $repina = Model_Pins::getPin($pin['repin_from']);
             if ($repina) {
                 $view->replin_info = array('pin_href' => WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $pin['repin_from']), 'profile' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $repina['user_id']), 'fullname' => $repina['user']['fullname']);
             }
         }
     }
     if ($pin['from'] && !preg_match('/^https?:\\/\\//', $pin['from'])) {
         $pin['from'] = 'http://' . $pin['from'];
     }
     if ($pin['from_repin'] && !preg_match('/^https?:\\/\\//', $pin['from_repin'])) {
         $pin['from_repin'] = 'http://' . $pin['from_repin'];
     }
     $pin['onto_board'] = $pin['onto_board2'] = array();
     $pin['originally_pinned'] = $pin['originally_pinned2'] = array();
     if ($request->isXmlHttpRequest()) {
         $pin['onto_board'] = self::getBoardPins($pin['board_id']);
         $pin['originally_pinned'] = self::getOriginallyPinned($pin['via'] ? $pin['via'] : $pin['user_id']);
     } else {
         $pin['onto_board2'] = self::getBoardPins($pin['board_id']);
         $pin['originally_pinned2'] = self::getOriginallyPinned($pin['via'] ? $pin['via'] : $pin['user_id']);
     }
     if ($view->source && $request->isXmlHttpRequest()) {
         $pin['source_pins'] = self::getSourcePins($pin['source_id']);
     } else {
         $pin['source_pins'] = array();
     }
     $pin['boardIsFollow'] = Model_Users::isFollow(array('board_id' => $pin['board_id']));
     $pin['userIsFollow'] = Model_Users::isFollowUser($pin['user_id']);
     if ($pin['via']) {
         $pin['userViaIsFollow'] = Model_Users::isFollowUser($pin['via']);
     } else {
         $pin['userViaIsFollow'] = Model_Users::isFollowUser($pin['user_id']);
     }
     $pin['userFollowIgnore'] = $pin['user_id'] == JO_Session::get('user[user_id]');
     $pin['userViaFollowIgnore'] = ($pin['via'] ? $pin['via'] : $pin['user_id']) == JO_Session::get('user[user_id]');
     $view->follow = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=follow&user_id=' . $pin['user_id'] . '&board_id=' . $pin['board_id']);
     $view->follow_user = WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $pin['user_id']);
     if ($pin['via']) {
         $view->follow_user_via = WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $pin['via']);
     } else {
         $view->follow_user_via = WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $pin['user_id']);
     }
     $view->get_user_friends = WM_Router::create($request->getBaseUrl() . '?controller=users&action=friends');
     if (JO_Session::get('user[user_id]')) {
         $view->enable_follow = $pin['user_id'] != JO_Session::get('user[user_id]');
     } else {
         $view->enable_follow = false;
     }
     if (JO_Session::get('user[user_id]')) {
         $pin['url_like'] = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=like&pin_id=' . $pin['pin_id']);
         $pin['url_repin'] = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=repin&pin_id=' . $pin['pin_id']);
         $pin['url_comment'] = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=comment&pin_id=' . $pin['pin_id']);
         $pin['comment'] = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=comment&pin_id=' . $pin['pin_id']);
         $pin['edit'] = JO_Session::get('user[user_id]') == $pin['user_id'] ? WM_Router::create($request->getBaseUrl() . '?controller=pin&action=edit&pin_id=' . $pin['pin_id']) : false;
     } else {
         $pin['url_like'] = $pin['url_repin'] = $pin['url_comment'] = $pin['comment'] = WM_Router::create($request->getBaseUrl() . '?controller=landing');
         $pin['edit'] = false;
     }
     $likes = self::getPinLikes($pin['pin_id']);
     $pin['likes'] = $likes['data'];
開發者ID:noikiy,項目名稱:amatteur,代碼行數:67,代碼來源:Pin.php

示例6: indexAction

 public function indexAction()
 {
     /*	
     		$request = $this->getRequest();
     		
     		if($request->isPost()) {
     			if( !$request->getPost('category_id') || count($request->getPost('category_id')) < 1 ) {
     				$this->view->error = true;
     			} else {
     				JO_Session::set('category_id', $request->getPost('category_id'));
     				$this->redirect( WM_Router::create($request->getBaseUrl() . '?controller=welcome&action=second') );
     			}
     		}
     		
     		$this->helpas();
     		
     		//////////// Categories ////////////
     		$this->view->categories = array();
     		$categories = Model_Categories::getCategories(array(
     			'filter_status' => 1
     		));
     		
     		$model_images = new Helper_Images();
     		
     		foreach($categories AS $category) {
     			if($category['image']) {
     				$category['thumb'] = $model_images->resize($category['image'], 113, 113, true);
     			} else {
     				$category['thumb'] = $model_images->resize(JO_Registry::get('no_avatar'), 113, 113);
     			}
     			
     			$this->view->categories[] = $category;
     		}
     		
     		
     	}
     	
     	function secondAction() {
     */
     $request = $this->getRequest();
     $this->helpas();
     //$categories = JO_Session::get('category_id');
     $userSports = Model_Users::getUserSports(JO_Session::get('user[user_id]'));
     $categories = array();
     foreach ($userSports as $userSport) {
         $categories[] = $userSport["sport_category"];
     }
     $users = "";
     if (!$categories || count($categories) < 1) {
         $this->view->error = true;
         Model_Users::edit(JO_Session::get('user[user_id]'), array('first_login' => '0'));
     } else {
         JO_Session::set('category_id', $categories);
         $users = Model_Users::getUsers(array('filter_welcome' => $categories, 'start' => 0, 'limit' => 20));
     }
     /*if(!$users) {
     			JO_Session::clear('category_id');
     			$this->redirect( WM_Router::create($request->getBaseUrl() . '?controller=welcome') );
     		}
     		*/
     $this->view->boards = '';
     if ($users) {
         $view = JO_View::getInstance();
         $view->loged = JO_Session::get('user[user_id]');
         $model_images = new Helper_Images();
         foreach ($users as $key => $user) {
             $user['thumbs'] = array();
             for ($i = 0; $i < min(8, count($user['pins_array'])); $i++) {
                 $image = isset($user['pins_array'][$i]) ? $user['pins_array'][$i]['image'] : false;
                 if (isset($user['pins_array'][$i])) {
                     $image = Helper_Uploadimages::pin($user['pins_array'][$i], '_A');
                     if ($image) {
                         $user['thumbs'][] = array('thumb' => $image['image'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $user['pins_array'][$i]['pin_id']), 'title' => $user['pins_array'][$i]['title']);
                     }
                 }
             }
             $avatar = Helper_Uploadimages::avatar($user, '_B');
             $user['avatar'] = $avatar['image'];
             $user['userLikeIgnore'] = true;
             if (JO_Session::get('user[user_id]') == $user['user_id']) {
                 $user['userIsFollow'] = 1;
                 $user['userFollowIgnore'] = true;
             } else {
                 $user['userIsFollow'] = Model_Users::isFollowUser($user['user_id']);
                 if (!$user['userIsFollow']) {
                     $user['userIsFollow'] = Model_Users::FollowUser($user['user_id']);
                 }
                 $user['userFollowIgnore'] = false;
             }
             $user['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user['user_id']);
             $user['pins_href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=pins&user_id=' . $user['user_id']);
             $user['follow'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $user['user_id']);
             $view->key = $key % 2 == 0;
             $view->user = $user;
             $this->view->boards .= $view->render('box', 'users');
         }
     }
     $this->view->pinmarklet_href = WM_Router::create($request->getBaseUrl() . '?controller=pages&action=read&page_id=' . JO_Registry::get('page_pinmarklet'));
     //$this->view->direct_path = WM_Router::create( $request->getBaseUrl() . '?direct_path=true' );
     if (JO_Registry::get('isMobile')) {
//.........這裏部分代碼省略.........
開發者ID:noikiy,項目名稱:amatteur,代碼行數:101,代碼來源:WelcomeController.php

示例7: searchAction


//.........這裏部分代碼省略.........
                 }
                 $categorias = array();
                 $categories = Model_Categories::getCategory($pin['category_id']);
                 if ($categories['parent_id'] != 0) {
                     $categorias['category_id'] = $categories['parent_id'];
                     $categorias['subcategory_id'] = $categories['category_id'];
                 } else {
                     $categorias['category_id'] = $categories['category_id'];
                     $categorias['subcategory_id'] = $categories['parent_id'];
                 }
                 $pos = strripos($pin['image'], '.');
                 $return['data'][] = array('pin_id' => $pin['pin_id'], 'pinFooter' => $pin['description'], 'category_id' => $categorias['category_id'], 'subcategory_id' => $categorias['subcategory_id'], 'pinImage' => substr_replace($pin['image'], '_B.', $pos, 1), 'pinWidth' => $pin['width'], 'pinHeight' => $pin['height'], 'pinUrl' => WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $pin['pin_id']), 'userId' => $pin['user_id'], 'username' => $pin['username'], 'avatar' => $pin['avatar'], 'userLike' => $pin['liked'], 'pinVideo' => $pin['from']);
             }
             $return['next_page'] = WM_Router::create($request->getBaseUrl() . '?controller=apiv1&action=timeline' . $url);
         }
     } else {
         if ($kind == 1) {
             //boards
             $data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_title' => $query);
             $this->view->pins = '';
             $boards = Model_Boards::getBoards($data);
             if ($boards) {
                 $view = JO_View::getInstance();
                 $view->loged = JO_Session::get('user[user_id]');
                 $view->enable_sort = false;
                 $model_images = new Helper_Images();
                 foreach ($boards as $board) {
                     $board['href'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board['user_id'] . '&board_id=' . $board['board_id']);
                     $board['thumbs'] = array();
                     $get_big = false;
                     for ($i = 0; $i < 5; $i++) {
                         $image = isset($board['pins_array'][$i]) ? $board['pins_array'][$i]['image'] : false;
                         if ($image) {
                             if ($get_big) {
                                 $size = '_A';
                             } else {
                                 $size = '_C';
                                 $get_big = true;
                             }
                             $data_img = Helper_Uploadimages::pin($board['pins_array'][$i], $size);
                             if ($data_img) {
                                 $board['thumbs'][] = $data_img['image'];
                             } else {
                                 $board['thumbs'][] = false;
                             }
                         } else {
                             $board['thumbs'][] = false;
                         }
                     }
                     $board['boardIsFollow'] = Model_Users::isFollow(array('board_id' => $board['board_id']));
                     $board['userFollowIgnore'] = $board['user_id'] != JO_Session::get('user[user_id]');
                     $board['follow'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=follow&user_id=' . $board['user_id'] . '&board_id=' . $board['board_id']);
                     $board['edit'] = false;
                     if ($board['user_id'] == JO_Session::get('user[user_id]') || Model_Boards::allowEdit($board['board_id'])) {
                         $board['userFollowIgnore'] = false;
                         $board['edit'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=edit&user_id=' . $board['user_id'] . '&board_id=' . $board['board_id']);
                     }
                     $username = Model_Users::getUsername($board["user_id"]);
                     $url_base = WM_Router::create($request->getBaseUrl());
                     $return['data'][] = array('folderId' => $board['board_id'], 'folderName' => $board['title'], 'folderUrl' => $url_base . $username . "/" . $board['title'], 'folderImage' => $board['image'], 'folderQty' => $board['pins']);
                     //$return[] = $board;
                 }
             }
         } else {
             if ($kind == 2) {
                 //people
                 $data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_username' => $query);
                 $users = Model_Users::getUsers($data);
                 if ($users) {
                     $this->view->follow_user = true;
                     $view = JO_View::getInstance();
                     $view->loged = JO_Session::get('user[user_id]');
                     $model_images = new Helper_Images();
                     foreach ($users as $key => $user) {
                         $avatar = Helper_Uploadimages::avatar($user, '_B');
                         $user['avatar'] = $avatar['image'];
                         if ($view->loged) {
                             $user['userIsFollow'] = Model_Users::isFollowUser($user['user_id']);
                             $user['userFollowIgnore'] = $user['user_id'] == JO_Session::get('user[user_id]');
                         } else {
                             $user['userFollowIgnore'] = true;
                         }
                         $user['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user['user_id']);
                         $user['follow'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $user['user_id']);
                         $return['data'][] = array('userId' => $user['user_id'], 'userName' => $user['username'], 'userDesc' => $user['description'], 'userLocation' => $user['location'], 'avatar' => $user['avatar'], 'follower' => $user['followers'], 'following' => $user['following']);
                     }
                 }
             }
         }
     }
     if ($callback) {
         $return = $callback . '(' . JO_Json::encode($return) . ')';
     } else {
         $response->addHeader('Cache-Control: no-cache, must-revalidate');
         $response->addHeader('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
         $response->addHeader('Content-type: application/json');
         $return = JO_Json::encode($return);
     }
     $response->appendBody($return);
 }
開發者ID:noikiy,項目名稱:amatteur,代碼行數:101,代碼來源:Apiv1Controller.php

示例8: followAction

 public function followAction()
 {
     $this->noViewRenderer(true);
     $request = $this->getRequest();
     if ((int) JO_Session::get('user[user_id]')) {
         $user_id = $request->getRequest('user_id');
         $board_info = Model_Users::getUser($user_id);
         if ($board_info) {
             if ($user_id) {
                 if (Model_Users::isFollowUser($user_id)) {
                     $result = Model_Users::UnFollowUser($user_id);
                     if ($result) {
                         $this->view->ok = $this->translate('Follow');
                         $this->view->classs = 'add';
                         Model_History::addHistory($user_id, Model_History::UNFOLLOW_USER);
                     } else {
                         $this->view->error = true;
                     }
                 } else {
                     $result = Model_Users::FollowUser($user_id);
                     if ($result) {
                         $this->view->ok = $this->translate('Unfollow');
                         $this->view->classs = 'remove';
                         Model_History::addHistory($user_id, Model_History::FOLLOW_USER);
                         if ($board_info['email_interval'] == 1 && $board_info['follows_email']) {
                             $this->view->user_info = $board_info;
                             $this->view->profile_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]'));
                             $this->view->full_name = JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]');
                             $this->view->text_email = $this->translate('now follow you');
                             Model_Email::send($board_info['email'], JO_Registry::get('noreply_mail'), JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]') . ' ' . $this->translate('follow your'), $this->view->render('follow_user', 'mail'));
                         }
                     } else {
                         $this->view->error = true;
                     }
                 }
             } else {
                 $this->view->error = true;
             }
         } else {
             $this->view->error = true;
         }
     } else {
         $this->view->location = WM_Router::create($request->getBaseUrl() . '?controller=landing');
     }
     if ($request->isXmlHttpRequest()) {
         echo $this->renderScript('json');
     } else {
         $this->redirect($request->getServer('HTTP_REFERER'));
     }
 }
開發者ID:noikiy,項目名稱:amatteur,代碼行數:50,代碼來源:UsersController.php


注:本文中的Model_Users::isFollowUser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。