Пример #1
0
 protected function runLocationSchedule($nefubId, $date)
 {
     if (is_numeric($nefubId) && $date) {
         if ($oLocation = Location::getByNefubId($nefubId)) {
             $formattedDate = strftime("%A %e %B %Y", strtotime($date));
             $filename = 'agenda ' . $date . ' ' . $oLocation->name;
             $oSeason = Season::getInstance();
             $aGames = Game::getAll(array('date' => $date, 'location_nefub_id' => $oLocation->nefub_id), 'time` ASC, `field', 'asc');
             if (count($aGames)) {
                 $title = 'Programma ' . $formattedDate;
                 $includeField = false;
                 $footer = $title . ' in ' . $oLocation->name . ', ' . $oLocation->city . '. Gedownload van http://' . $_SERVER['HTTP_HOST'] . '/locatie/' . $nefubId;
                 $this->renderGames($filename, $title, $aGames, $footer);
             }
         }
     }
     $this->redirect();
 }
Пример #2
0
    $current_score = $active_players[0]->setScore2(0);
    $current_score = $active_players[0]->getScore2();
    $current_hand = array();
    $draw = array();
    for ($i = 0; $i <= 4; $i++) {
        array_push($current_hand, rand(1, 2));
    }
    for ($z = 0; $z <= 4; $z++) {
        if ($current_hand[0] == $current_hand[1] && $current_hand[0] == $current_hand[2] && $current_hand[0] == $current_hand[3]) {
            $active_players[0]->setScore2($current_score + 1);
        }
    }
    // var_dump($current_hand);
    for ($x = 0; $x <= 4; $x++) {
        if ($current_hand[$x] != $current_hand[1] || $current_hand[$x] != $current_hand[2] || $current_hand[$x] != $current_hand[3] || $current_hand[$x] != $current_hand[4]) {
            $current_hand[$x] = rand(1, 2);
        }
    }
    return $app['twig']->render('player_two_hand.html.twig', array('player_two_cards' => $current_hand, 'games' => $current_players));
});
$app->get('/current_game', function () use($app) {
    $active_game = Game::getAll();
    $active_players = Player::getAll();
    $current_players = $active_players[0]->getPlayers();
    return $app['twig']->render('current_game.html.twig', array('games' => $current_players));
});
$app->get('/restart_game', function () use($app) {
    Game::restartGame();
    return $app['twig']->render('restart_game.html.twig');
});
return $app;
Пример #3
0
 /**
  * 
  * @return Game[]
  */
 public function getFinishedGames()
 {
     return Game::getAll(array('competition_nefub_id' => $this->nefub_id, 'finished' => 1), 'date` desc, `time', 'desc');
 }
Пример #4
0
 $rid = intval($_GPC['rid']);
 if (!empty($rid)) {
     $sql = 'SELECT * FROM ' . tablename('mbrl_records') . ' WHERE `id`=' . $rid;
     $record = pdo_fetch($sql);
     if (empty($record) || $record['activity'] != $activity['actid'] || $record['uid'] != $user['uid']) {
         exit('非法的访问');
     }
     $ret = $record;
 } else {
     if (empty($error)) {
         $g = new Game();
         $filters = array();
         $filters['uid'] = $user['uid'];
         $filters['activity'] = $activity['actid'];
         $filters['status'] = 'paid';
         $trades = $g->getAll($filters);
         if (empty($trades)) {
             exit('没有可用的' . $activity['tag']['label']);
         }
         $ret = $a->grap($user, $activity);
         if (!is_error($ret)) {
             $g->touch($trades[0]['id'], 'completed');
         }
     } else {
         exit($error['message']);
     }
 }
 if (is_error($ret)) {
     exit($ret['message']);
 } elseif ($ret['status'] == 'none') {
     exit('这次游戏没有获得红包, 再来一次 ? ? ?');
Пример #5
0
 /**
  * Render all pages so they load fast
  */
 public function clear_renders()
 {
     error_reporting(0);
     self::put("build main page: " . HOST . '/?clear=1');
     get_headers(HOST . '/?clear=1');
     self::put("build calendar " . HOST . '/agenda?clear=1');
     get_headers(HOST . '/agenda?clear=1');
     self::put("build scores " . HOST . '/uitslagen?clear=1');
     get_headers(HOST . '/uitslagen?clear=1');
     self::put("build scores " . HOST . '/uitslagen?clear=1');
     get_headers(HOST . '/speler?clear=1');
     $oSeason = $this->getSeason();
     $aPoules = $oSeason->getPoules();
     foreach ($aPoules as $oPoule) {
         $url = HOST . '/poule/' . $oPoule->nefub_id . '?clear=1';
         self::put("Maak pagina voor poule " . $oPoule->name);
         get_headers($url);
         $aTeams = $oPoule->getPouleTeams();
         foreach ($aTeams as $oPouleTeam) {
             $url = HOST . '/team/' . $oPouleTeam->team_nefub_id . '?clear=1';
             self::put("Maak pagina voor team " . $oPouleTeam->getTeam()->name);
             get_headers($url);
         }
     }
     $aGames = Game::getAll();
     foreach ($aGames as $oGame) {
         $url = HOST . '/wedstrijd/' . $oGame->nefub_id . '?clear=1';
         self::put("Maak pagina voor wedstrijd " . $oGame->nefub_id);
         get_headers($url);
     }
     $this->clearLocationRenders();
 }
Пример #6
0
 public function getFinishedGames()
 {
     // The 'or' here means  that it says team1_id = getId() OR team2_id = getId();
     // The relationship between the 'or ...' and finished => 1 is 'AND'
     return Game::getAll(array('or' => array('team1_nefub_id' => $this->nefub_id, 'team2_nefub_id' => $this->nefub_id), 'finished' => 1), 'date', 'DESC');
 }