Ejemplo n.º 1
0
<?php

use_helper('opCommunityTopic');
$data = array();
if (count($topics)) {
    foreach ($topics as $topic) {
        $_topic = op_api_community_topic_mini($topic);
        $comments = $topic->getCommunityTopicComment();
        $_topic['latest_comment'] = '';
        $_topic['latest_comment_id'] = '';
        if (count($comments)) {
            $latest_comment = op_api_community_topic_comment($comments->getLast());
            $_topic['latest_comment'] = $latest_comment['body'];
            $_topic['latest_comment_id'] = $latest_comment['id'];
        }
        $data[] = $_topic;
    }
}
return array('status' => 'success', 'data' => $data, 'data_count' => $count);
Ejemplo n.º 2
0
<?php

use_helper('opCommunityTopic');
$data = array();
if (count($comments)) {
    foreach ($comments as $comment) {
        $_comment = op_api_community_topic_comment($comment);
        $_comment['deletable'] = $comment->isDeletable($memberId);
        $images = $comment->getImages();
        if (count($images) > 0) {
            foreach ($images as $image) {
                $_comment['images'][] = op_api_topic_image($image);
            }
        }
        $data[] = $_comment;
    }
    $data = array_reverse($data);
}
return array('status' => 'success', 'data' => $data, 'data_count' => $count);