@@ 345-369 (lines=25) @@ | ||
342 | * @return EE_Datetime[] |
|
343 | * @throws EE_Error |
|
344 | */ |
|
345 | public function get_datetimes_for_event_ordered_by_start_time( |
|
346 | $EVT_ID, |
|
347 | $include_expired = true, |
|
348 | $include_deleted = true, |
|
349 | $limit = null |
|
350 | ) { |
|
351 | //sanitize EVT_ID |
|
352 | $EVT_ID = absint($EVT_ID); |
|
353 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
|
354 | $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
355 | $query_params = array(array('Event.EVT_ID' => $EVT_ID), 'order_by' => array('DTT_EVT_start' => 'asc')); |
|
356 | if (! $include_expired) { |
|
357 | $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', true)); |
|
358 | } |
|
359 | if ($include_deleted) { |
|
360 | $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
361 | } |
|
362 | if ($limit) { |
|
363 | $query_params['limit'] = $limit; |
|
364 | } |
|
365 | /** @var EE_Datetime[] $result */ |
|
366 | $result = $this->get_all($query_params); |
|
367 | $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
368 | return $result; |
|
369 | } |
|
370 | ||
371 | ||
372 | /** |
|
@@ 383-407 (lines=25) @@ | ||
380 | * @return EE_Datetime[] |
|
381 | * @throws EE_Error |
|
382 | */ |
|
383 | public function get_datetimes_for_ticket_ordered_by_start_time( |
|
384 | $TKT_ID, |
|
385 | $include_expired = true, |
|
386 | $include_deleted = true, |
|
387 | $limit = null |
|
388 | ) { |
|
389 | //sanitize TKT_ID |
|
390 | $TKT_ID = absint($TKT_ID); |
|
391 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
|
392 | $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
393 | $query_params = array(array('Ticket.TKT_ID' => $TKT_ID), 'order_by' => array('DTT_EVT_start' => 'asc')); |
|
394 | if (! $include_expired) { |
|
395 | $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', true)); |
|
396 | } |
|
397 | if ($include_deleted) { |
|
398 | $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
399 | } |
|
400 | if ($limit) { |
|
401 | $query_params['limit'] = $limit; |
|
402 | } |
|
403 | /** @var EE_Datetime[] $result */ |
|
404 | $result = $this->get_all($query_params); |
|
405 | $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
406 | return $result; |
|
407 | } |
|
408 | ||
409 | ||
410 | /** |
|
@@ 422-447 (lines=26) @@ | ||
419 | * @return EE_Datetime[] |
|
420 | * @throws EE_Error |
|
421 | */ |
|
422 | public function get_datetimes_for_ticket_ordered_by_DTT_order( |
|
423 | $TKT_ID, |
|
424 | $include_expired = true, |
|
425 | $include_deleted = true, |
|
426 | $limit = null |
|
427 | ) { |
|
428 | //sanitize id. |
|
429 | $TKT_ID = absint($TKT_ID); |
|
430 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
|
431 | $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
432 | $where_params = array('Ticket.TKT_ID' => $TKT_ID); |
|
433 | $query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC')); |
|
434 | if (! $include_expired) { |
|
435 | $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', true)); |
|
436 | } |
|
437 | if ($include_deleted) { |
|
438 | $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
439 | } |
|
440 | if ($limit) { |
|
441 | $query_params['limit'] = $limit; |
|
442 | } |
|
443 | /** @var EE_Datetime[] $result */ |
|
444 | $result = $this->get_all($query_params); |
|
445 | $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
446 | return $result; |
|
447 | } |
|
448 | ||
449 | ||
450 | /** |