ProfileAction::_assignFollowGroup PHP Method

_assignFollowGroup() private method

调整分组列表
private _assignFollowGroup ( array $fids )
$fids array 指定用户关注的用户列表
    private function _assignFollowGroup($fids)
    {
        $follow_group_list = model('FollowGroup')->getGroupList($this->mid);
        // 调整分组列表
        if (!empty($follow_group_list)) {
            $group_count = count($follow_group_list);
            for ($i = 0; $i < $group_count; $i++) {
                if ($follow_group_list[$i]['follow_group_id'] != $data['gid']) {
                    $follow_group_list[$i]['title'] = (strlen($follow_group_list[$i]['title']) + mb_strlen($follow_group_list[$i]['title'], 'UTF8')) / 2 > 8 ? getShort($follow_group_list[$i]['title'], 3) . '...' : $follow_group_list[$i]['title'];
                }
                if ($i < 2) {
                    $data['follow_group_list_1'][] = $follow_group_list[$i];
                } else {
                    if ($follow_group_list[$i]['follow_group_id'] == $data['gid']) {
                        $data['follow_group_list_1'][2] = $follow_group_list[$i];
                        continue;
                    }
                    $data['follow_group_list_2'][] = $follow_group_list[$i];
                }
            }
            if (empty($data['follow_group_list_1'][2]) && !empty($data['follow_group_list_2'][0])) {
                $data['follow_group_list_1'][2] = $data['follow_group_list_2'][0];
                unset($data['follow_group_list_2'][0]);
            }
        }
        $data['follow_group_status'] = model('FollowGroup')->getGroupStatusByFids($this->mid, $fids);
        $this->assign($data);
    }