<?php use_helper('Date', 'opCommunityEvent', 'opCommunityTopic'); $data = array(); if (isset($events[0]['id'])) { foreach ($events as $event) { $event->setOpenDate(date($event->getOpenDate())); $event->setApplicationDeadline(date($event->getApplicationDeadline())); $_event = op_api_community_event($event); $_event['images'] = array(''); $images = $event->getImages(); if (count($images)) { foreach ($images as $image) { $_event['images'][] = op_api_topic_image($image); } } $_event['is_event_member'] = $event->isEventMember($memberId); $data[] = $_event; } } return array('status' => 'success', 'data' => $data, 'data_count' => $count);
<?php use_helper('opCommunityTopic'); $data = array(); if (count($topics)) { foreach ($topics as $topic) { $_topic = op_api_community_topic($topic); $_topic['editable'] = $topic->isEditable($memberId); $images = $topic->getImages(); if (count($images)) { foreach ($images as $image) { $_topic['images'][] = op_api_topic_image($image); } } $data[] = $_topic; } } return array('status' => 'success', 'data' => $data, 'data_count' => $count);
<?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);