@@ 278-302 (lines=25) @@ | ||
275 | * @return EE_Datetime[] |
|
276 | * @throws \EE_Error |
|
277 | */ |
|
278 | public function get_datetimes_for_event_ordered_by_start_time( |
|
279 | $EVT_ID, |
|
280 | $include_expired = true, |
|
281 | $include_deleted = true, |
|
282 | $limit = null |
|
283 | ) { |
|
284 | //sanitize EVT_ID |
|
285 | $EVT_ID = absint($EVT_ID); |
|
286 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
|
287 | $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
288 | $query_params = array(array('Event.EVT_ID' => $EVT_ID), 'order_by' => array('DTT_EVT_start' => 'asc')); |
|
289 | if ( ! $include_expired) { |
|
290 | $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', true)); |
|
291 | } |
|
292 | if ($include_deleted) { |
|
293 | $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
294 | } |
|
295 | if ($limit) { |
|
296 | $query_params['limit'] = $limit; |
|
297 | } |
|
298 | /** @var EE_Datetime[] $result */ |
|
299 | $result = $this->get_all($query_params); |
|
300 | $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
301 | return $result; |
|
302 | } |
|
303 | ||
304 | ||
305 | ||
@@ 317-341 (lines=25) @@ | ||
314 | * @return EE_Datetime[] |
|
315 | * @throws \EE_Error |
|
316 | */ |
|
317 | public function get_datetimes_for_ticket_ordered_by_start_time( |
|
318 | $TKT_ID, |
|
319 | $include_expired = true, |
|
320 | $include_deleted = true, |
|
321 | $limit = null |
|
322 | ) { |
|
323 | //sanitize TKT_ID |
|
324 | $TKT_ID = absint($TKT_ID); |
|
325 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
|
326 | $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
327 | $query_params = array(array('Ticket.TKT_ID' => $TKT_ID), 'order_by' => array('DTT_EVT_start' => 'asc')); |
|
328 | if ( ! $include_expired) { |
|
329 | $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', true)); |
|
330 | } |
|
331 | if ($include_deleted) { |
|
332 | $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
333 | } |
|
334 | if ($limit) { |
|
335 | $query_params['limit'] = $limit; |
|
336 | } |
|
337 | /** @var EE_Datetime[] $result */ |
|
338 | $result = $this->get_all($query_params); |
|
339 | $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
340 | return $result; |
|
341 | } |
|
342 | ||
343 | ||
344 | ||
@@ 357-382 (lines=26) @@ | ||
354 | * @return EE_Datetime[] |
|
355 | * @throws \EE_Error |
|
356 | */ |
|
357 | public function get_datetimes_for_ticket_ordered_by_DTT_order( |
|
358 | $TKT_ID, |
|
359 | $include_expired = true, |
|
360 | $include_deleted = true, |
|
361 | $limit = null |
|
362 | ) { |
|
363 | //sanitize id. |
|
364 | $TKT_ID = absint($TKT_ID); |
|
365 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
|
366 | $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
367 | $where_params = array('Ticket.TKT_ID' => $TKT_ID); |
|
368 | $query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC')); |
|
369 | if ( ! $include_expired) { |
|
370 | $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', true)); |
|
371 | } |
|
372 | if ($include_deleted) { |
|
373 | $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
374 | } |
|
375 | if ($limit) { |
|
376 | $query_params['limit'] = $limit; |
|
377 | } |
|
378 | /** @var EE_Datetime[] $result */ |
|
379 | $result = $this->get_all($query_params); |
|
380 | $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
381 | return $result; |
|
382 | } |
|
383 | ||
384 | ||
385 |