@@ 232-250 (lines=19) @@ | ||
229 | * @param int $limit |
|
230 | * @return EE_Datetime[] |
|
231 | */ |
|
232 | public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted= true, $limit = NULL ){ |
|
233 | //sanitize EVT_ID |
|
234 | $EVT_ID = intval( $EVT_ID ); |
|
235 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
|
236 | $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
237 | $query_params =array(array('Event.EVT_ID'=>$EVT_ID),'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
238 | if( ! $include_expired){ |
|
239 | $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
240 | } |
|
241 | if( $include_deleted){ |
|
242 | $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
243 | } |
|
244 | if($limit){ |
|
245 | $query_params['limit'] = $limit; |
|
246 | } |
|
247 | $result = $this->get_all( $query_params ); |
|
248 | $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
249 | return $result; |
|
250 | } |
|
251 | ||
252 | /** |
|
253 | * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered |
|
@@ 261-279 (lines=19) @@ | ||
258 | * @param int $limit |
|
259 | * @return EE_Datetime[] |
|
260 | */ |
|
261 | public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){ |
|
262 | //sanitize TKT_ID |
|
263 | $TKT_ID = intval( $TKT_ID ); |
|
264 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
|
265 | $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
266 | $query_params =array(array('Ticket.TKT_ID'=>$TKT_ID),'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
267 | if( ! $include_expired){ |
|
268 | $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
269 | } |
|
270 | if( $include_deleted){ |
|
271 | $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
272 | } |
|
273 | if($limit){ |
|
274 | $query_params['limit'] = $limit; |
|
275 | } |
|
276 | $result = $this->get_all( $query_params ); |
|
277 | $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
278 | return $result; |
|
279 | } |
|
280 | ||
281 | ||
282 | ||
@@ 293-312 (lines=20) @@ | ||
290 | * that number |
|
291 | * @return EE_Datetime[] |
|
292 | */ |
|
293 | public function get_datetimes_for_ticket_ordered_by_DTT_order( $TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL ) { |
|
294 | //sanitize id. |
|
295 | $TKT_ID = intval( $TKT_ID ); |
|
296 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
|
297 | $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
298 | $where_params = array( 'Ticket.TKT_ID' => $TKT_ID ); |
|
299 | $query_params = array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ) ); |
|
300 | if( ! $include_expired){ |
|
301 | $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
302 | } |
|
303 | if( $include_deleted){ |
|
304 | $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
305 | } |
|
306 | if($limit){ |
|
307 | $query_params['limit'] = $limit; |
|
308 | } |
|
309 | $result = $this->get_all( $query_params ); |
|
310 | $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
311 | return $result; |
|
312 | } |
|
313 | ||
314 | ||
315 | /** |