PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/opendominion/models/round.php

https://bitbucket.org/WaveHack/opendominion
PHP | 34 lines | 27 code | 7 blank | 0 comment | 2 complexity | a82e69900a1c235a0c609dc09af91f6f MD5 | raw file
  1. <?php
  2. class Round extends DataMapper
  3. {
  4. public $has_many = array('dominion');
  5. static public function get_active_round()
  6. {
  7. $active_round = new Round();
  8. $active_round->where('start_date <= CURDATE()');
  9. $active_round->where('end_date > CURDATE()');
  10. $active_round->get();
  11. if ($active_round->result_count() === 1) {
  12. return $active_round;
  13. }
  14. return null;
  15. }
  16. static public function get_next_round()
  17. {
  18. $next_round = new Round();
  19. $next_round->where('start_date > CURDATE()');
  20. $next_round->order_by('start_date');
  21. $next_round->get();
  22. if ($next_round->result_count() > 0) {
  23. return $next_round;
  24. }
  25. return null;
  26. }
  27. }