| @@ 716-740 (lines=25) @@ | ||
| 713 | * @return boolean true yes, false no | |
| 714 | * @throws EE_Error | |
| 715 | */ | |
| 716 | public function is_upcoming() | |
| 717 |     { | |
| 718 | // check if event id is present and if this event is published | |
| 719 |         if ($this->is_inactive()) { | |
| 720 | return false; | |
| 721 | } | |
| 722 | // set initial value | |
| 723 | $upcoming = false; | |
| 724 | //next let's get all datetimes and loop through them | |
| 725 | $datetimes = $this->datetimes_in_chronological_order(); | |
| 726 |         foreach ($datetimes as $datetime) { | |
| 727 |             if ($datetime instanceof EE_Datetime) { | |
| 728 | //if this dtt is expired then we continue cause one of the other datetimes might be upcoming. | |
| 729 |                 if ($datetime->is_expired()) { | |
| 730 | continue; | |
| 731 | } | |
| 732 | //if this dtt is active then we return false. | |
| 733 |                 if ($datetime->is_active()) { | |
| 734 | return false; | |
| 735 | } | |
| 736 | //otherwise let's check upcoming status | |
| 737 | $upcoming = $datetime->is_upcoming(); | |
| 738 | } | |
| 739 | } | |
| 740 | return $upcoming; | |
| 741 | } | |
| 742 | ||
| 743 | ||
| @@ 748-772 (lines=25) @@ | ||
| 745 | * @return bool | |
| 746 | * @throws EE_Error | |
| 747 | */ | |
| 748 | public function is_active() | |
| 749 |     { | |
| 750 | // check if event id is present and if this event is published | |
| 751 |         if ($this->is_inactive()) { | |
| 752 | return false; | |
| 753 | } | |
| 754 | // set initial value | |
| 755 | $active = false; | |
| 756 | //next let's get all datetimes and loop through them | |
| 757 | $datetimes = $this->datetimes_in_chronological_order(); | |
| 758 |         foreach ($datetimes as $datetime) { | |
| 759 |             if ($datetime instanceof EE_Datetime) { | |
| 760 | //if this dtt is expired then we continue cause one of the other datetimes might be active. | |
| 761 |                 if ($datetime->is_expired()) { | |
| 762 | continue; | |
| 763 | } | |
| 764 | //if this dtt is upcoming then we return false. | |
| 765 |                 if ($datetime->is_upcoming()) { | |
| 766 | return false; | |
| 767 | } | |
| 768 | //otherwise let's check active status | |
| 769 | $active = $datetime->is_active(); | |
| 770 | } | |
| 771 | } | |
| 772 | return $active; | |
| 773 | } | |
| 774 | ||
| 775 | ||
| @@ 780-800 (lines=21) @@ | ||
| 777 | * @return bool | |
| 778 | * @throws EE_Error | |
| 779 | */ | |
| 780 | public function is_expired() | |
| 781 |     { | |
| 782 | // check if event id is present and if this event is published | |
| 783 |         if ($this->is_inactive()) { | |
| 784 | return false; | |
| 785 | } | |
| 786 | // set initial value | |
| 787 | $expired = false; | |
| 788 | //first let's get all datetimes and loop through them | |
| 789 | $datetimes = $this->datetimes_in_chronological_order(); | |
| 790 |         foreach ($datetimes as $datetime) { | |
| 791 |             if ($datetime instanceof EE_Datetime) { | |
| 792 | //if this dtt is upcoming or active then we return false. | |
| 793 |                 if ($datetime->is_upcoming() || $datetime->is_active()) { | |
| 794 | return false; | |
| 795 | } | |
| 796 | //otherwise let's check active status | |
| 797 | $expired = $datetime->is_expired(); | |
| 798 | } | |
| 799 | } | |
| 800 | return $expired; | |
| 801 | } | |
| 802 | ||
| 803 | ||