/**
  * Guarantees that the old summits that pre-date the Summit object are represented
  * @return void
  */
 private function ensureLegacySummits()
 {
     $created = 0;
     if (!Summit::get()->filterAny(['Title:PartialMatch' => 'San Diego'])->first()) {
         $sanDiego = Summit::create(['Title' => 'San Diego', 'Location' => 'San Diego, CA', 'SummitBeginDate' => '2012-10-15 00:00:00', 'SummitEndDate' => '2012-10-18 00:00:00', 'SubmissionBeginDate' => '2012-08-15 00:00:00', 'SubmissionEndDate' => '2012-08-18 00:00:00', 'VotingBeginDate' => '2012-08-20 00:00:00', 'VotingEndDate' => '2012-08-25 00:00:00', 'SelectionBeginDate' => '2012-09-15 00:00:00', 'SelectionEndDate' => '2012-09-18 00:00:00', 'RegistrationBeginDate' => '2012-10-01 00:00:00', 'RegistrationEndDate' => '2012-10-10 00:00:00', 'StartShowingVenuesDate' => '2012-05-05 00:00:00', 'TimeZone' => '132']);
         $sanDiego->write();
         echo "Created San Diego summit!" . $this->br();
         $created++;
     }
     if (!Summit::get()->filterAny(['Title:PartialMatch' => 'Portland'])->first()) {
         $portland = Summit::create(['Title' => 'Portland', 'Location' => 'Portland, OR', 'SummitBeginDate' => '2013-04-15 00:00:00', 'SummitEndDate' => '2013-04-18 00:00:00', 'SubmissionBeginDate' => '2013-01-15 00:00:00', 'SubmissionEndDate' => '2013-01-18 00:00:00', 'VotingBeginDate' => '2013-02-20 00:00:00', 'VotingEndDate' => '2013-02-25 00:00:00', 'SelectionBeginDate' => '2013-03-15 00:00:00', 'SelectionEndDate' => '2013-03-18 00:00:00', 'RegistrationBeginDate' => '2013-04-01 00:00:00', 'RegistrationEndDate' => '2013-04-10 00:00:00', 'StartShowingVenuesDate' => '2013-01-01 00:00:00', 'TimeZone' => '132']);
         $portland->write();
         echo "Created Portland summit!" . $this->br();
         $created++;
     }
     if (!Summit::get()->filter('Title:PartialMatch', 'Atlanta')->first()) {
         $atlanta = Summit::create(['Title' => 'Atlanta', 'SummitBeginDate' => '2013-05-05 00:00:00', 'SummitEndDate' => '2013-05-08 00:00:00', 'SubmissionBeginDate' => '2013-01-15 00:00:00', 'SubmissionEndDate' => '2013-01-18 00:00:00', 'VotingBeginDate' => '2013-02-20 00:00:00', 'VotingEndDate' => '2013-02-25 00:00:00', 'SelectionBeginDate' => '2013-03-15 00:00:00', 'SelectionEndDate' => '2013-03-18 00:00:00', 'RegistrationBeginDate' => '2013-04-01 00:00:00', 'RegistrationEndDate' => '2013-04-10 00:00:00', 'StartShowingVenuesDate' => '2013-01-01 00:00:00', 'TimeZone' => '151']);
         $atlanta->write();
         echo "Created Atlanta summit!" . $this->br();
         $created++;
     }
     // Hong Kong has no date
     if ($hongKong = Summit::get()->filter('Title:PartialMatch', 'Hong Kong')->first()) {
         if (!$hongKong->SummitBeginDate) {
             $hongKong->SummitBeginDate = '2013-11-05 00:00:00';
             $hongKong->SummitEndDate = '2013-11-08 00:00:00';
             $hongKong->write();
             echo "Fixed HongKong date!" . $this->br();
         }
     }
     $this->stats['Summits created'] += $created;
     // Clean up junk data from old summits
     DB::query("UPDATE Summit SET SummitBeginDate = StartDate WHERE SummitBeginDate IS NULL");
     DB::query("UPDATE Summit SET SummitEndDate = EndDate WHERE SummitEndDate IS NULL");
 }
예제 #2
0
 public static function get_active()
 {
     $summit = Summit::get()->filter(array('Active' => true))->first();
     return $summit ?: Summit::create();
 }