|  | @@ 492-525 (lines=34) @@ | 
                                                            
                                    | 489 |  |      * @return EE_Event[]|int | 
                                                            
                                    | 490 |  |      * @throws \EE_Error | 
                                                            
                                    | 491 |  |      */ | 
                                                            
                                    | 492 |  |     public function get_upcoming_events($query_params, $count = false) | 
                                                            
                                    | 493 |  |     { | 
                                                            
                                    | 494 |  |         if (array_key_exists(0, $query_params)) { | 
                                                            
                                    | 495 |  |             $where_params = $query_params[0]; | 
                                                            
                                    | 496 |  |             unset($query_params[0]); | 
                                                            
                                    | 497 |  |         } else { | 
                                                            
                                    | 498 |  |             $where_params = array(); | 
                                                            
                                    | 499 |  |         } | 
                                                            
                                    | 500 |  |         // if we have count make sure we don't include group by | 
                                                            
                                    | 501 |  |         if ($count && isset($query_params['group_by'])) { | 
                                                            
                                    | 502 |  |             unset($query_params['group_by']); | 
                                                            
                                    | 503 |  |         } | 
                                                            
                                    | 504 |  |         // let's add specific query_params for active_events | 
                                                            
                                    | 505 |  |         // keep in mind this will override any sent status in the query AND any date queries. | 
                                                            
                                    | 506 |  |         $where_params['status'] = array('IN', array('publish', EEM_Event::sold_out)); | 
                                                            
                                    | 507 |  |         // if there are already query_params matching DTT_EVT_start then we need to modify that to add them. | 
                                                            
                                    | 508 |  |         if (isset($where_params['Datetime.DTT_EVT_start'])) { | 
                                                            
                                    | 509 |  |             $where_params['Datetime.DTT_EVT_start*****'] = array( | 
                                                            
                                    | 510 |  |                 '>', | 
                                                            
                                    | 511 |  |                 EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'), | 
                                                            
                                    | 512 |  |             ); | 
                                                            
                                    | 513 |  |         } else { | 
                                                            
                                    | 514 |  |             $where_params['Datetime.DTT_EVT_start'] = array( | 
                                                            
                                    | 515 |  |                 '>', | 
                                                            
                                    | 516 |  |                 EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'), | 
                                                            
                                    | 517 |  |             ); | 
                                                            
                                    | 518 |  |         } | 
                                                            
                                    | 519 |  |         $query_params[0] = $where_params; | 
                                                            
                                    | 520 |  |         // don't use $query_params with count() | 
                                                            
                                    | 521 |  |         // because we don't want to include additional query clauses like "GROUP BY" | 
                                                            
                                    | 522 |  |         return $count | 
                                                            
                                    | 523 |  |             ? $this->count(array($where_params), 'EVT_ID', true) | 
                                                            
                                    | 524 |  |             : $this->get_all($query_params); | 
                                                            
                                    | 525 |  |     } | 
                                                            
                                    | 526 |  |  | 
                                                            
                                    | 527 |  |  | 
                                                            
                                    | 528 |  |  | 
                                                                                
                                |  | @@ 539-572 (lines=34) @@ | 
                                                            
                                    | 536 |  |      * @return EE_Event[]|int | 
                                                            
                                    | 537 |  |      * @throws \EE_Error | 
                                                            
                                    | 538 |  |      */ | 
                                                            
                                    | 539 |  |     public function get_active_and_upcoming_events($query_params, $count = false) | 
                                                            
                                    | 540 |  |     { | 
                                                            
                                    | 541 |  |         if (array_key_exists(0, $query_params)) { | 
                                                            
                                    | 542 |  |             $where_params = $query_params[0]; | 
                                                            
                                    | 543 |  |             unset($query_params[0]); | 
                                                            
                                    | 544 |  |         } else { | 
                                                            
                                    | 545 |  |             $where_params = array(); | 
                                                            
                                    | 546 |  |         } | 
                                                            
                                    | 547 |  |         // if we have count make sure we don't include group by | 
                                                            
                                    | 548 |  |         if ($count && isset($query_params['group_by'])) { | 
                                                            
                                    | 549 |  |             unset($query_params['group_by']); | 
                                                            
                                    | 550 |  |         } | 
                                                            
                                    | 551 |  |         // let's add specific query_params for active_events | 
                                                            
                                    | 552 |  |         // keep in mind this will override any sent status in the query AND any date queries. | 
                                                            
                                    | 553 |  |         $where_params['status'] = array('IN', array('publish', EEM_Event::sold_out)); | 
                                                            
                                    | 554 |  |         // add where params for DTT_EVT_end | 
                                                            
                                    | 555 |  |         if (isset($where_params['Datetime.DTT_EVT_end'])) { | 
                                                            
                                    | 556 |  |             $where_params['Datetime.DTT_EVT_end*****'] = array( | 
                                                            
                                    | 557 |  |                 '>', | 
                                                            
                                    | 558 |  |                 EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'), | 
                                                            
                                    | 559 |  |             ); | 
                                                            
                                    | 560 |  |         } else { | 
                                                            
                                    | 561 |  |             $where_params['Datetime.DTT_EVT_end'] = array( | 
                                                            
                                    | 562 |  |                 '>', | 
                                                            
                                    | 563 |  |                 EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'), | 
                                                            
                                    | 564 |  |             ); | 
                                                            
                                    | 565 |  |         } | 
                                                            
                                    | 566 |  |         $query_params[0] = $where_params; | 
                                                            
                                    | 567 |  |         // don't use $query_params with count() | 
                                                            
                                    | 568 |  |         // because we don't want to include additional query clauses like "GROUP BY" | 
                                                            
                                    | 569 |  |         return $count | 
                                                            
                                    | 570 |  |             ? $this->count(array($where_params), 'EVT_ID', true) | 
                                                            
                                    | 571 |  |             : $this->get_all($query_params); | 
                                                            
                                    | 572 |  |     } | 
                                                            
                                    | 573 |  |  | 
                                                            
                                    | 574 |  |  | 
                                                            
                                    | 575 |  |  |