| @@ 299-330 (lines=32) @@ | ||
| 296 | } |
|
| 297 | ||
| 298 | $filter_data = json_decode($filters); |
|
| 299 | if (!empty($filter_data)) { |
|
| 300 | $params = array( |
|
| 301 | 'type' => 'object', |
|
| 302 | 'subtype' => 'mission', |
|
| 303 | 'limit' => $limit, |
|
| 304 | 'offset' => $offset |
|
| 305 | ); |
|
| 306 | ||
| 307 | if ($filter_data->type) { |
|
| 308 | $params['metadata_name'] = 'job_type'; |
|
| 309 | $params['metadata_value'] = $filter_data->type; |
|
| 310 | } |
|
| 311 | ||
| 312 | if ($filter_data->name) { |
|
| 313 | $db_prefix = elgg_get_config('dbprefix'); |
|
| 314 | $params['joins'] = array("JOIN {$db_prefix}objects_entity oe ON e.guid = oe.guid"); |
|
| 315 | $params['wheres'] = array("(oe.title LIKE '%" . $filter_data->name . "%' OR oe.description LIKE '%" . $filter_data->name . "%')"); |
|
| 316 | } |
|
| 317 | ||
| 318 | if ($filter_data->mine) { |
|
| 319 | $all_opportunities = elgg_list_entities_from_relationship($params); |
|
| 320 | } else { |
|
| 321 | $all_opportunities = elgg_list_entities_from_metadata($params); |
|
| 322 | } |
|
| 323 | } else { |
|
| 324 | $all_opportunities = elgg_list_entities(array( |
|
| 325 | 'type' => 'object', |
|
| 326 | 'subtype' => 'mission', |
|
| 327 | 'limit' => $limit, |
|
| 328 | 'offset' => $offset |
|
| 329 | )); |
|
| 330 | } |
|
| 331 | ||
| 332 | $opportunities = json_decode($all_opportunities); |
|
| 333 | ||
| @@ 145-175 (lines=31) @@ | ||
| 142 | } |
|
| 143 | ||
| 144 | $filter_data = json_decode($filters); |
|
| 145 | if (!empty($filter_data)) { |
|
| 146 | $params = array( |
|
| 147 | 'type' => 'object', |
|
| 148 | 'subtype' => 'groupforumtopic', |
|
| 149 | 'limit' => $limit, |
|
| 150 | 'offset' => $offset |
|
| 151 | ); |
|
| 152 | ||
| 153 | if ($filter_data->mine) { |
|
| 154 | $params['owner_guid'] = $user_entity->guid; |
|
| 155 | } |
|
| 156 | ||
| 157 | if ($filter_data->name) { |
|
| 158 | $db_prefix = elgg_get_config('dbprefix'); |
|
| 159 | $params['joins'] = array("JOIN {$db_prefix}objects_entity oe ON e.guid = oe.guid"); |
|
| 160 | $params['wheres'] = array("(oe.title LIKE '%" . $filter_data->name . "%' OR oe.description LIKE '%" . $filter_data->name . "%')"); |
|
| 161 | } |
|
| 162 | ||
| 163 | if ($filter_data->mine) { |
|
| 164 | $all_discussions = elgg_list_entities_from_relationship($params); |
|
| 165 | } else { |
|
| 166 | $all_discussions = elgg_list_entities_from_metadata($params); |
|
| 167 | } |
|
| 168 | } else { |
|
| 169 | $all_discussions = elgg_list_entities(array( |
|
| 170 | 'type' => 'object', |
|
| 171 | 'subtype' => 'groupforumtopic', |
|
| 172 | 'limit' => $limit, |
|
| 173 | 'offset' => $offset |
|
| 174 | )); |
|
| 175 | } |
|
| 176 | ||
| 177 | $discussions = json_decode($all_discussions); |
|
| 178 | ||