function processCollectionData($collection, $tf = array(), $orderby = '')
{
    if (count($collection) <= 0) {
        return array();
    }
    require_once libfile('function/discuzcode');
    foreach ($collection as $ctid => &$curvalue) {
        $curvalue['updated'] = $curvalue['lastupdate'] > $tf[$ctid]['lastvisit'] ? 1 : 0;
        $curvalue['tflastvisit'] = $tf[$ctid]['lastvisit'];
        $curvalue['lastupdate'] = dgmdate($curvalue['lastupdate']);
        $curvalue['dateline'] = dgmdate($curvalue['dateline']);
        $curvalue['lastposttime'] = dgmdate($curvalue['lastposttime']);
        $curvalue['avgrate'] = number_format($curvalue['rate'], 1);
        $curvalue['star'] = imgdisplayrate($curvalue['rate']);
        $curvalue['lastposterhtml'] = rawurlencode($curvalue['lastposter']);
        $curvalue['shortdesc'] = cutstr(strip_tags(discuzcode($curvalue['desc'])), 50);
        $curvalue['arraykeyword'] = parse_keyword($curvalue['keyword'], false, false);
        if ($curvalue['arraykeyword']) {
            foreach ($curvalue['arraykeyword'] as $kid => $s_keyword) {
                $curvalue['urlkeyword'][$kid] = rawurlencode($s_keyword);
            }
        }
        if ($orderby == 'commentnum') {
            $curvalue['displaynum'] = $curvalue['commentnum'];
        } elseif ($orderby == 'follownum') {
            $curvalue['displaynum'] = $curvalue['follownum'];
        } else {
            $curvalue['displaynum'] = $curvalue['threadnum'];
        }
    }
    return $collection;
}
Beispiel #2
0
        $commentlist = C::t('forum_collectioncomment')->fetch_all_by_ctid($_G['collection']['ctid'], 0, 5);
        foreach ($commentlist as &$curvalue) {
            $curvalue['dateline'] = dgmdate($curvalue['dateline'], 'u', '9999', getglobal('setting/dateformat'));
            $curvalue['message'] = cutstr($curvalue['message'], 50);
            $curvalue['rateimg'] = imgdisplayrate($curvalue['rate']);
        }
        $memberrate = C::t('forum_collectioncomment')->fetch_rate_by_ctid_uid($_G['collection']['ctid'], $_G['uid']);
    }
    $followers = C::t('forum_collectionfollow')->fetch_all($ctid, true, 0, 6);
    include template('forum/collection_view');
} elseif ($op == 'comment') {
    $navtitle = lang('core', 'title_collection_comment_list') . ' - ' . $navtitle;
    if ($_G['collection']['commentnum'] > 0) {
        $start = ($page - 1) * $_G['setting']['postperpage'];
        $commentlist = C::t('forum_collectioncomment')->fetch_all_by_ctid($_G['collection']['ctid'], $start, $_G['setting']['postperpage']);
        foreach ($commentlist as &$curvalue) {
            $curvalue['dateline'] = dgmdate($curvalue['dateline'], 'u', '9999', getglobal('setting/dateformat'));
            $curvalue['rateimg'] = imgdisplayrate($curvalue['rate']);
        }
        $multipage = multi($_G['collection']['commentnum'], $_G['setting']['postperpage'], $page, "forum.php?mod=collection&action=view&op=comment&ctid={$_G['collection']['ctid']}");
        $memberrate = C::t('forum_collectioncomment')->fetch_rate_by_ctid_uid($_G['collection']['ctid'], $_G['uid']);
    }
    include template('forum/collection_comment');
} elseif ($op == 'followers') {
    $navtitle = lang('core', 'title_collection_followers_list') . ' - ' . $navtitle;
    $cmemberperpage = 28;
    $start = ($page - 1) * $cmemberperpage;
    $followers = C::t('forum_collectionfollow')->fetch_all($ctid, true, $start, $cmemberperpage);
    $multipage = multi($_G['collection']['follownum'], $cmemberperpage, $page, "forum.php?mod=collection&action=view&op=followers&ctid={$_G['collection']['ctid']}");
    include template('forum/collection_followers');
}