public function following()
{
// 获取用户信息
$user_info = model('User')->getUserInfo($this->uid);
// 用户为空,则跳转用户不存在
if (empty($user_info)) {
$this->error(L('PUBLIC_USER_NOEXIST'));
}
// 个人空间头部
$this->_top();
// 判断隐私设置
$userPrivacy = $this->privacy($this->uid);
if ($userPrivacy['space'] !== 1) {
$key = t($_REQUEST['follow_key']);
if ($key === '') {
$following_list = model('Follow')->getFollowingList($this->uid, intval($_GET['gid']), 20);
} else {
$following_list = model('Follow')->searchFollows($key, 'following', 20, $this->uid);
$this->assign('follow_key', $key);
$this->assign('jsonKey', json_encode($key));
}
$fids = getSubByKey($following_list['data'], 'fid');
if ($fids) {
$uids = array_merge($fids, array($this->uid));
} else {
$uids = array($this->uid);
}
// 获取用户组信息
$userGroupData = model('UserGroupLink')->getUserGroupData($uids);
$this->assign('userGroupData', $userGroupData);
$this->_assignFollowState($uids);
$this->_assignUserInfo($uids);
$this->_assignUserProfile($uids);
$this->_assignUserTag($uids);
$this->_assignUserCount($fids);
// 关注分组
$this->mid == $this->uid && $this->_assignFollowGroup($fids);
$this->assign('following_list', $following_list);
} else {
$this->_assignUserInfo($this->uid);
}
$this->assign('userPrivacy', $userPrivacy);
$this->setTitle(L('PUBLIC_TA_FOLLOWING', array('user' => $GLOBALS['ts']['_user']['uname'])));
$this->setKeywords(L('PUBLIC_TA_FOLLOWING', array('user' => $GLOBALS['ts']['_user']['uname'])));
// 获取登录用户的所有分组
if ($this->mid == $this->uid) {
$userGroupList = model('FollowGroup')->getGroupList($this->mid);
$userGroupListFormat = array();
foreach ($userGroupList as $value) {
$userGroupListFormat[] = array('gid' => $value['follow_group_id'], 'title' => $value['title']);
}
$groupList = array(array('gid' => 0, 'title' => '全部'), array('gid' => -1, 'title' => '相互关注'), array('gid' => -2, 'title' => '未分组'));
!empty($userGroupListFormat) && ($groupList = array_merge($groupList, $userGroupListFormat));
$this->assign('groupList', $groupList);
$this->assign('gid', intval($_GET['gid']));
$groupList_ids = getSubByKey($groupList, 'gid');
$this->assign('groupList_ids', $groupList_ids);
$gTitle = D('FollowGroup')->where('follow_group_id=' . intval($_GET['gid']))->getField('title');
$this->assign('gTitle', $gTitle);
// dump($groupList);
// 显示的分类个数
$this->assign('groupNums', 5);
}
$this->display();
}