ProfileAction::data PHP Method

data() public method

获取用户详细资料
public data ( )
    public function data()
    {
        if (!CheckPermission('core_normal', 'read_data') && $this->uid != $this->mid) {
            $this->error('对不起,您没有权限浏览该内容!');
        }
        // 获取用户信息
        $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) {
            $this->_sidebar();
            // 档案类型
            $ProfileType = model('UserProfile')->getCategoryList();
            $this->assign('ProfileType', $ProfileType);
            // 个人资料
            $this->_assignUserProfile($this->uid);
            // 获取用户职业信息
            $userCategory = model('UserCategory')->getRelatedUserInfo($this->uid);
            if (!empty($userCategory)) {
                foreach ($userCategory as $value) {
                    $user_category .= '<a href="#" class="link btn-cancel"><span>' . $value['title'] . '</span></a>&nbsp;&nbsp;';
                }
            }
            $this->assign('user_category', $user_category);
        } else {
            $this->_assignUserInfo($this->uid);
        }
        $this->assign('userPrivacy', $userPrivacy);
        $this->setTitle($user_info['uname'] . '的资料');
        $this->setKeywords($user_info['uname'] . '的资料');
        $user_tag = model('Tag')->setAppName('User')->setAppTable('user')->getAppTags(array($this->uid));
        $this->setDescription(t($user_category . $user_info['location'] . ',' . implode(',', $user_tag[$this->uid]) . ',' . $user_info['intro']));
        $this->display();
    }