示例#1
0
 private function getData($id = 'all')
 {
     if ($id === 'all') {
         $games = $this->games->all();
         foreach ($games as &$game) {
             $data = new GameData($this->jig, $game['id']);
             $gameData[$game['id']] = $data->all()[0]->cast();
         }
     } else {
         $data = new GameData($this->jig, intval($id));
         $gameData = $data->all()[0]->cast();
     }
     return $gameData;
 }
示例#2
0
 private function updateDue()
 {
     $audit = \Audit::instance();
     $this->f3->scrub($_POST);
     $this->f3->set('SESSION.flash', array());
     // process form if there are no errors
     if (count($this->f3->get('SESSION.flash')) === 0) {
         $games = $this->games->all();
         foreach ($games as $game) {
             $gameData = new GameData($this->jig, $game['id']);
             $data = $gameData->all()[0]->cast();
             // if current time is the same or past the scheduled update date
             if (time() >= strtotime($data['schedule'], $game['updated'])) {
                 if ($data['schedule-enabled']) {
                     $this->f3->set('POST.updated', time());
                 }
                 if ($data['current-round'] + 1 <= count($data['rounds'])) {
                     $this->f3->set('POST[current-round]', $data['current-round'] + 1);
                 }
                 $this->games->edit($game['id']);
                 $gameData->edit($game['id']);
             }
         }
         $this->f3->clear('POST');
         $this->f3->push('SESSION.flash', array('type' => 'success', 'msg' => 'Bulk game update complete!'));
     }
 }