@@ 736-760 (lines=25) @@ | ||
733 | * @return boolean true yes, false no |
|
734 | * @throws EE_Error |
|
735 | */ |
|
736 | public function is_upcoming() |
|
737 | { |
|
738 | // check if event id is present and if this event is published |
|
739 | if ($this->is_inactive()) { |
|
740 | return false; |
|
741 | } |
|
742 | // set initial value |
|
743 | $upcoming = false; |
|
744 | // next let's get all datetimes and loop through them |
|
745 | $datetimes = $this->datetimes_in_chronological_order(); |
|
746 | foreach ($datetimes as $datetime) { |
|
747 | if ($datetime instanceof EE_Datetime) { |
|
748 | // if this dtt is expired then we continue cause one of the other datetimes might be upcoming. |
|
749 | if ($datetime->is_expired()) { |
|
750 | continue; |
|
751 | } |
|
752 | // if this dtt is active then we return false. |
|
753 | if ($datetime->is_active()) { |
|
754 | return false; |
|
755 | } |
|
756 | // otherwise let's check upcoming status |
|
757 | $upcoming = $datetime->is_upcoming(); |
|
758 | } |
|
759 | } |
|
760 | return $upcoming; |
|
761 | } |
|
762 | ||
763 | ||
@@ 768-792 (lines=25) @@ | ||
765 | * @return bool |
|
766 | * @throws EE_Error |
|
767 | */ |
|
768 | public function is_active() |
|
769 | { |
|
770 | // check if event id is present and if this event is published |
|
771 | if ($this->is_inactive()) { |
|
772 | return false; |
|
773 | } |
|
774 | // set initial value |
|
775 | $active = false; |
|
776 | // next let's get all datetimes and loop through them |
|
777 | $datetimes = $this->datetimes_in_chronological_order(); |
|
778 | foreach ($datetimes as $datetime) { |
|
779 | if ($datetime instanceof EE_Datetime) { |
|
780 | // if this dtt is expired then we continue cause one of the other datetimes might be active. |
|
781 | if ($datetime->is_expired()) { |
|
782 | continue; |
|
783 | } |
|
784 | // if this dtt is upcoming then we return false. |
|
785 | if ($datetime->is_upcoming()) { |
|
786 | return false; |
|
787 | } |
|
788 | // otherwise let's check active status |
|
789 | $active = $datetime->is_active(); |
|
790 | } |
|
791 | } |
|
792 | return $active; |
|
793 | } |
|
794 | ||
795 | ||
@@ 800-820 (lines=21) @@ | ||
797 | * @return bool |
|
798 | * @throws EE_Error |
|
799 | */ |
|
800 | public function is_expired() |
|
801 | { |
|
802 | // check if event id is present and if this event is published |
|
803 | if ($this->is_inactive()) { |
|
804 | return false; |
|
805 | } |
|
806 | // set initial value |
|
807 | $expired = false; |
|
808 | // first let's get all datetimes and loop through them |
|
809 | $datetimes = $this->datetimes_in_chronological_order(); |
|
810 | foreach ($datetimes as $datetime) { |
|
811 | if ($datetime instanceof EE_Datetime) { |
|
812 | // if this dtt is upcoming or active then we return false. |
|
813 | if ($datetime->is_upcoming() || $datetime->is_active()) { |
|
814 | return false; |
|
815 | } |
|
816 | // otherwise let's check active status |
|
817 | $expired = $datetime->is_expired(); |
|
818 | } |
|
819 | } |
|
820 | return $expired; |
|
821 | } |
|
822 | ||
823 |