/opendominion/models/round.php
PHP | 34 lines | 27 code | 7 blank | 0 comment | 2 complexity | a82e69900a1c235a0c609dc09af91f6f MD5 | raw file
- <?php
- class Round extends DataMapper
- {
- public $has_many = array('dominion');
- static public function get_active_round()
- {
- $active_round = new Round();
- $active_round->where('start_date <= CURDATE()');
- $active_round->where('end_date > CURDATE()');
- $active_round->get();
- if ($active_round->result_count() === 1) {
- return $active_round;
- }
- return null;
- }
- static public function get_next_round()
- {
- $next_round = new Round();
- $next_round->where('start_date > CURDATE()');
- $next_round->order_by('start_date');
- $next_round->get();
- if ($next_round->result_count() > 0) {
- return $next_round;
- }
- return null;
- }
- }