| @@ 130-153 (lines=24) @@ | ||
| 127 | ||
| 128 | $docs = json_decode($all_docs); |
|
| 129 | ||
| 130 | foreach ($docs as $doc) { |
|
| 131 | $doc->name = gc_explode_translation($doc->name, $lang); |
|
| 132 | ||
| 133 | $likes = elgg_get_annotations(array( |
|
| 134 | 'guid' => $doc->guid, |
|
| 135 | 'annotation_name' => 'likes' |
|
| 136 | )); |
|
| 137 | $doc->likes = count($likes); |
|
| 138 | ||
| 139 | $liked = elgg_get_annotations(array( |
|
| 140 | 'guid' => $doc->guid, |
|
| 141 | 'annotation_owner_guid' => $user_entity->guid, |
|
| 142 | 'annotation_name' => 'likes' |
|
| 143 | )); |
|
| 144 | $doc->liked = count($liked) > 0; |
|
| 145 | ||
| 146 | $docObj = new ElggPad($doc->guid); |
|
| 147 | $doc->owner = ($docObj->getOwnerEntity() == $user_entity); |
|
| 148 | $doc->iconURL = $docObj->getIconURL(); |
|
| 149 | $doc->url = $docObj->getPadPath(); |
|
| 150 | ||
| 151 | $doc->userDetails = get_user_block($doc->owner_guid, $lang); |
|
| 152 | $doc->description = clean_text(gc_explode_translation($doc->description, $lang)); |
|
| 153 | } |
|
| 154 | ||
| 155 | return $docs; |
|
| 156 | } |
|
| @@ 140-162 (lines=23) @@ | ||
| 137 | ||
| 138 | $opportunities = json_decode($all_opportunities); |
|
| 139 | ||
| 140 | foreach ($opportunities as $opportunity) { |
|
| 141 | $opportunity->title = gc_explode_translation($opportunity->title, $lang); |
|
| 142 | ||
| 143 | $likes = elgg_get_annotations(array( |
|
| 144 | 'guid' => $opportunity->guid, |
|
| 145 | 'annotation_name' => 'likes' |
|
| 146 | )); |
|
| 147 | $opportunity->likes = count($likes); |
|
| 148 | ||
| 149 | $liked = elgg_get_annotations(array( |
|
| 150 | 'guid' => $opportunity->guid, |
|
| 151 | 'annotation_owner_guid' => $user_entity->guid, |
|
| 152 | 'annotation_name' => 'likes' |
|
| 153 | )); |
|
| 154 | $opportunity->liked = count($liked) > 0; |
|
| 155 | ||
| 156 | $opportunityObj = get_entity($opportunity->guid); |
|
| 157 | $opportunity->owner = ($opportunityObj->getOwnerEntity() == $user_entity); |
|
| 158 | $opportunity->iconURL = $opportunityObj->getIconURL(); |
|
| 159 | ||
| 160 | $opportunity->userDetails = get_user_block($opportunity->owner_guid, $lang); |
|
| 161 | $opportunity->description = clean_text(gc_explode_translation($opportunity->description, $lang)); |
|
| 162 | } |
|
| 163 | ||
| 164 | return $opportunities; |
|
| 165 | } |
|