function OnPageLoad() { if ($this->page_not_found) { require_once $_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/stoolball/section-404.php"; return; } echo "<h1>" . Html::Encode($this->GetPageTitle()) . "</h1>"; require_once 'xhtml/navigation/tabs.class.php'; $tabs = array('Summary' => $this->tournament->GetNavigateUrl(), 'Tournament statistics' => ''); echo new Tabs($tabs); ?> <div class="box tab-box"> <div class="dataFilter"></div> <div class="box-content"> <?php # See what stats we've got available require_once "_summary-data-found.php"; if (!$has_player_stats) { echo "<p>There aren't any statistics for the " . htmlentities($this->tournament->GetTitle(), ENT_QUOTES, "UTF-8", false) . ' yet.</p> <p>To find out how to add them, see <a href="/play/manage/website/matches-and-results-why-you-should-add-yours/">Matches and results - why you should add yours</a>.</p>'; } else { require_once "_summary-controls.php"; } ?> </div> </div> <?php }
function generate_vars($section, &$vars) { if (!$vars['is_logged'] || !$vars['is_admin']) { return; } $matches = Match::find_all(); $vars['matches'] = $matches; $vars['arenas'] = Arena::filter(''); if (isset($_POST['description0'])) { for ($i = 0; $i < count($matches); $i++) { $match = $matches[$i]; if (isset($_POST['delete' . $i])) { $match->delete(); continue; } if ($match->description != $_POST['description' . $i] || $match->date != $_POST['date' . $i] || $match->arena != $_POST['arena' . $i] || $match->prix != $_POST['prix' . $i]) { $match->description = $_POST['description' . $i]; $match->date = $_POST['date' . $i]; $match->arena = $_POST['arena' . $i]; $match->prix = $_POST['prix' . $i]; $match->save(); } } } if (!empty($_POST['description-nouveau']) && !empty($_POST['date-nouveau']) && !empty($_POST['arena-nouveau']) && !empty($_POST['prix-nouveau'])) { $match = new Match(); $match->description = $_POST['description-nouveau']; $match->date = $_POST['date-nouveau']; $match->arena = $_POST['arena-nouveau']; $match->prix = $_POST['prix-nouveau']; $match->save(); } $matches = Match::find_all(); $vars['matches'] = $matches; }
private function loadAllMatches() { $matches = getArray("\n SELECT *\n FROM matches\n WHERE matches.seasonID = '{$this->season}'\n ORDER BY date ASC;"); $lineUps = getArray("\n SELECT * FROM lineups"); if (count($matches) > 0) { foreach ($matches as &$match) { $newMatch = new Match($match["date"], $match["time"], $match["tournamentName"], $match["location"], $match["opposition"], $match["goalsFor"], $match["goalsAgainst"]); if (count($matches) > 0) { foreach ($lineUps as &$lineUp) { if ($lineUp["date"] == $match["date"]) { $newMatch->setLineUp($lineUp); } } } if ($match["location"] == 'Home') { $this->homeMatches[$match["date"]] = $newMatch; } else { if ($match["location"] == 'Away') { $this->awayMatches[$match["date"]] = $newMatch; } } $this->allMatches[$match["date"]] = $newMatch; $this->tournaments[$match["tournamentName"]]->addMatch($newMatch); } } }
function __construct(SiteSettings $settings, Match $match) { if ($match->GetMatchType() != MatchType::TOURNAMENT) { throw new Exception('No match for tournament control'); } $this->settings = $settings; $this->match = $match; }
public static function create($server, $map, $gameMode, $timestamp = null) { $match = new Match(0, $timestamp ? $timestamp : time(), $server, $map, $gameMode); $match->insert(); if ($match->getId()) { return $match; } else { return null; } }
/** * Find out whether this Match is better (aka. - has less difference) than * the given Match. * * @param \forevermatt\mosaic\Match $otherMatch * @return boolean */ public function isBetterMatchThan(Match $otherMatch) { if ($otherMatch === null) { return true; } $otherMatchDifference = $otherMatch->getDifference(); if ($otherMatchDifference === null) { return $this->difference !== null; } else { return $this->difference < $otherMatchDifference; } }
public function __construct(Match $match) { $this->match = $match; $this->searchable = new SearchItem("match", "match" . $match->GetId(), $match->GetNavigateUrl()); $this->searchable->Title($match->GetTitle() . ", " . $match->GetStartTimeFormatted(true, false)); $this->searchable->Description($this->GetSearchDescription()); $this->searchable->FullText($match->GetNotes()); $this->searchable->RelatedLinksHtml('<ul>' . '<li><a href="' . $match->GetNavigateUrl() . '/statistics">Statistics</a></li>' . '<li><a href="' . $match->GetCalendarNavigateUrl() . '">Add to calendar</a></li>' . '<li><a href="' . $match->GetEditNavigateUrl() . '">Update result</a></li>' . '</ul>'); # Assign more weight to newer matches $weight = $match->GetStartTime() / 60 / 60 / 24 / 365; $this->searchable->WeightWithinType($weight); }
/** * export matches collection from xml node * @param $node DOMElement xml node * @return array of Match */ protected function exportMatchesCollection(DOMElement $node) { $out = array(); $matchesList = $node->getElementsByTagName('match'); for ($i = 0; $i < $matchesList->length; ++$i) { $matchNode = $matchesList->item($i); $match = new Match(); $match->initFromXmlNode($matchNode); $out[] = $match; } return $out; }
/** * 录入 * */ public function actionCreate() { parent::_acl('match_create'); $model = new Match(); if (isset($_POST['Match'])) { $model->attributes = $_POST['Match']; if ($model->save()) { AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入房屋配套,ID:' . $model->id)); $this->redirect(array('index')); } } $this->render('create', array('model' => $model)); }
function OnPageLoad() { # Matches this page shouldn't edit are page not found if ($this->page_not_found) { require_once $_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/stoolball/section-404.php"; return; } echo "<h1>" . Html::Encode($this->GetPageTitle()) . "</h1>"; require_once 'xhtml/navigation/tabs.class.php'; $tabs = array('Summary' => $this->match->GetNavigateUrl()); if ($this->match->GetMatchType() == MatchType::TOURNAMENT_MATCH) { $tabs['Match statistics'] = ''; $tabs['Tournament statistics'] = $this->match->GetTournament()->GetNavigateUrl() . '/statistics'; } else { $tabs['Statistics'] = ''; } echo new Tabs($tabs); ?> <div class="box tab-box"> <div class="dataFilter"></div> <div class="box-content"> <?php if (!$this->has_statistics) { echo "<p>There aren't any statistics for " . htmlentities($this->match->GetTitle(), ENT_QUOTES, "UTF-8", false) . ' yet.</p> <p>To find out how to add them, see <a href="/play/manage/website/matches-and-results-why-you-should-add-yours/">Matches and results - why you should add yours</a>.</p>'; } else { ?> <div class="statsColumns"> <div class="statsColumn"> <div class="chart-js-template" id="worm-chart"></div> </div> <div class="statsColumn"> <div class="chart-js-template" id="run-rate-chart"></div> </div> </div> <div class="statsColumns manhattan"> <h2>Scores in each over</h2> <div class="statsColumn"> <div class="chart-js-template" id="manhattan-chart-first-innings"></div> </div> <div class="statsColumn"> <div class="chart-js-template" id="manhattan-chart-second-innings"></div> </div> </div> <?php } ?> </div> </div> <?php }
function OnPreRender() { # list subscriptions to pages (which may not yet be topics) $this->SetCssClass('subscriptions'); if (is_array($this->a_subs) and count($this->a_subs)) { # build table $o_table = new XhtmlElement('table'); # build header row $o_row = new XhtmlElement('tr'); $o_row->AddControl(new XhtmlElement('th', 'What you subscribed to')); $o_row->AddControl(new XhtmlElement('th', 'Date subscribed')); $o_row->AddControl(new XhtmlElement('th', 'Unsubscribe')); $o_thead = new XhtmlElement('thead', $o_row); $o_table->AddControl($o_thead); # build table body $o_tbody = new XhtmlElement('tbody'); foreach ($this->a_subs as $o_sub) { $o_item = null; # build table row for each subscription if ($o_sub->GetType() == ContentType::STOOLBALL_MATCH) { $o_item = new Match($this->o_settings); $o_item->SetShortUrl($o_sub->GetSubscribedItemUrl()); } if (is_object($o_item)) { $o_row = new XhtmlElement('tr'); $o_link = new XhtmlElement('a', Html::Encode($o_sub->GetTitle())); $o_link->AddAttribute('href', $o_item->GetNavigateUrl()); $o_td_item = new XhtmlElement('td', $o_link); if ($o_sub->GetContentDate()) { $o_qualifier = new XhtmlElement('span', ' on ' . Html::Encode($o_sub->GetContentDate())); $o_qualifier->SetCssClass('subscriptionQualifier'); $o_td_item->AddControl($o_qualifier); } $o_row->AddControl($o_td_item); # admin cells $o_row->AddControl($this->GetSubscribeDateCell($o_sub)); $o_row->AddControl($this->GetActionCell($o_sub)); $o_tbody->AddControl($o_row); unset($o_item); } } $o_table->AddControl($o_tbody); $this->AddControl($o_table); } else { $o_p = new XhtmlElement('p', 'You have not subscribed to any email alerts.'); $o_p->SetCssClass('subscriptionNone'); $this->AddControl($o_p); } }
public function getInfo() { $query = "SELECT m. * , c.name\n FROM matches m\n JOIN competitions c ON m.compID = c.id\n WHERE c.id = :compID"; $params = array(":compID" => $this->id); $result = $this->helper->queryDB($query, $params, false); $this->name = $result[0]['name']; foreach ($result as $row) { $match = new Match(null, null); $match->id = $row['id']; $match->matchNumber = $row['matchNumber']; $match->compID = $row['compID']; $match->getInfo(); array_push($this->matches, $match); } }
/** * @param $password * @param $begin * @param $end * @param $token * @param $cardinality */ public function __construct($password, $begin, $end, $token, $cardinality = null) { parent::__construct($password, $begin, $end, $token); $this->pattern = 'bruteforce'; // Cardinality can be injected to support full password cardinality instead of token. $this->cardinality = $cardinality; }
public function OnPageLoad() { # Matches this page shouldn't edit are page not found if ($this->page_not_found) { require_once $_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/stoolball/section-404.php"; return; } $edit_or_update = ($this->b_user_is_match_admin or $this->b_user_is_match_owner) ? "Edit" : "Update"; if ($this->match->GetStartTime() > gmdate('U') and !$this->b_user_is_match_admin and !$this->b_user_is_match_owner) { $step = ""; # definitely only this step because match in future and can't change date } else { $step = " – step 1 of 4"; } echo new XhtmlElement('h1', "{$edit_or_update} " . htmlentities($this->match->GetTitle(), ENT_QUOTES, "UTF-8", false) . $step); # If result only there's room for a little help if (!$this->b_user_is_match_admin and !$this->b_user_is_match_owner) { /* Create instruction panel */ $o_panel = new XhtmlElement('div'); $o_panel->SetCssClass('panel instructionPanel'); $o_title_inner1 = new XhtmlElement('div', 'Add your matches quickly:'); $o_title = new XhtmlElement('h2', $o_title_inner1); $o_panel->AddControl($o_title); $o_tab_tip = new XhtmlElement('ul'); $o_tab_tip->AddControl(new XhtmlElement('li', 'You can add runs, wickets and the winning team on the next few pages')); $o_tab_tip->AddControl(new XhtmlElement('li', 'Don\'t worry if you don\'t know – fill in what you can and leave the rest blank.')); $o_panel->AddControl($o_tab_tip); echo $o_panel; } # OK to edit the match $this->editor->SetDataObject($this->match); echo $this->editor; }
function generate_vars($section, &$vars) { if (!isset($_GET['id'])) { return; } $vars['match'] = Match::get($_GET['id']); }
public function OnPageLoad() { # Matches this page shouldn't edit are page not found if ($this->page_not_found) { require_once $_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/stoolball/section-404.php"; return; } $edit_or_update = ($this->b_user_is_match_admin or $this->b_user_is_match_owner) ? "Edit" : "Update"; $step = " – step " . $this->editor->GetCurrentPage() . " of 4"; echo new XhtmlElement('h1', "{$edit_or_update} " . htmlentities($this->match->GetTitle(), ENT_QUOTES, "UTF-8", false) . $step); if ($this->IsValid()) { /* Create instruction panel */ $panel = new XhtmlElement('div'); $panel->SetCssClass('panel instructionPanel'); $title_inner1 = new XhtmlElement('div', 'Fill in scorecards quickly:'); $title = new XhtmlElement('h2', $title_inner1, "large"); $panel->AddControl($title); $tab_tip = new XhtmlElement('ul'); $tab_tip->AddControl(new XhtmlElement('li', 'Use the <span class="tab">tab</span> and up and down keys to move through the form', "large")); $tab_tip->AddControl(new XhtmlElement('li', 'Use the <span class="tab">tab</span> key to select a player\'s name from the suggestions', "large")); $tab_tip->AddControl(new XhtmlElement('li', "List everyone on the batting card, even if they didn't bat, so we know who played.")); $tab_tip->AddControl(new XhtmlElement('li', 'Don\'t worry if you don\'t know – fill in what you can and leave the rest blank.')); $panel->AddControl($tab_tip); echo $panel; } # OK to edit the match $this->editor->SetDataObject($this->match); echo $this->editor; }
public function run() { DB::table('matches')->delete(); Match::create(array('myChar' => 'Akuma', 'opponentChar' => 'Cammy', 'result' => 'Win')); Match::create(array('myChar' => 'Juri', 'opponentChar' => 'Chun-li', 'result' => 'Draw')); Match::create(array('myChar' => 'Ryu', 'opponentChar' => 'Rose', 'result' => 'Loss')); }
function OnPageLoad() { echo '<h1>' . htmlentities($this->GetPageTitle(), ENT_QUOTES, "UTF-8", false) . '</h1>'; if (is_object($this->match)) { echo "<p>Thank you. You have added the following match:</p>"; echo new MatchListControl(array($this->match)); echo "<p>Don't worry if you made a mistake, just <a href=\"" . htmlentities($this->match->GetEditNavigateUrl(), ENT_QUOTES, "UTF-8", false) . '">edit this match</a> or <a href="' . htmlentities($this->match->GetDeleteNavigateUrl(), ENT_QUOTES, "UTF-8", false) . '">delete this match</a>.</p>'; $this->edit->SetHeading('Add another {0}'); # Configure edit control $this->edit->SetCssClass('panel addAnotherPanel'); } else { /* Create instruction panel */ $o_panel = new XhtmlElement('div'); $o_panel->SetCssClass('panel instructionPanel large'); $o_title_inner1 = new XhtmlElement('div', 'Add your matches quickly:'); $o_title = new XhtmlElement('h2', $o_title_inner1); $o_panel->AddControl($o_title); $o_tab_tip = new XhtmlElement('ul'); $o_tab_tip->AddControl(new XhtmlElement('li', 'Use the <span class="tab">tab</span> key on your keyboard to move through the form')); $o_tab_tip->AddControl(new XhtmlElement('li', 'Type the first letter or number to select from a dropdown list')); if ($this->i_match_type != MatchType::TOURNAMENT_MATCH) { $o_tab_tip->AddControl(new XhtmlElement('li', 'If you\'re not sure when the match starts, leave the time blank')); } $o_panel->AddControl($o_tab_tip); echo $o_panel; # Configure edit control $this->edit->SetCssClass('panel'); } # display the match to edit echo $this->edit; parent::OnPageLoad(); }
function OnPageLoad() { if (!$this->tournament instanceof Match or !$this->b_is_tournament) { http_response_code(404); require_once $_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/stoolball/section-404.php"; return; } echo new XhtmlElement('h1', htmlentities($this->GetPageTitle(), ENT_QUOTES, "UTF-8", false)); # check permission if (!$this->b_user_is_match_admin and !$this->b_user_is_match_owner) { ?> <p>Sorry, you can't edit a tournament unless you added it.</p> <p><a href="<?php echo htmlentities($this->tournament->GetNavigateUrl(), ENT_QUOTES, "UTF-8", false); ?> ">Go back to tournament</a></p> <?php return; } # OK to edit the match $o_match = is_object($this->tournament) ? $this->tournament : new Match($this->GetSettings()); $this->editor->SetDataObject($o_match); echo $this->editor; echo '<p class="facebook-tournaments">You can also list your tournament on the <a href="https://www.facebook.com/groups/1451559361817258/">Sussex Stoolball tournaments Facebook group</a>.</p>'; parent::OnPageLoad(); }
/** * Creates a new entry, puts the id into the session and * redirects back to the index page. */ public function store() { if (Entry::canCreateOrEdit() === false) { return Redirect::route('entry.index')->withMessage("Sorry, the competition has now started and new entries cannot be created."); } $input = Input::all(); $validator = Validator::make($input, Entry::$entry_rules); if ($validator->fails()) { return Redirect::route('entry.create')->withInput()->withErrors($validator); } DB::beginTransaction(); $entry = new Entry(); $entry->email = $input['email']; $entry->secret = Hash::make($input['secret']); $entry->confirmation = uniqid('', true); $entry->first_name = $input['first_name']; $entry->last_name = $input['last_name']; $entry->peer_group = $input['peer_group']; $entry->save(); $matches = Match::all(); foreach ($matches as $match) { $match_prediction = new MatchPrediction(); $match_prediction->team_a = $match->team_a; $match_prediction->team_b = $match->team_b; $match_prediction->pool = $match->pool; $match_prediction->match_date = $match->match_date; $entry->matchPredictions()->save($match_prediction); } DB::commit(); $this->sendConfirmationEmail($entry); $this->putEntryIdIntoSession($entry->id); return View::make('entry.edit')->with('entry', $entry); }
function OnPageLoad() { if (!$this->tournament instanceof Match or !$this->b_is_tournament) { http_response_code(404); require_once $_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/stoolball/section-404.php"; return; } echo new XhtmlElement('h1', Html::Encode($this->GetPageTitle())); # check permission if (!$this->b_user_is_match_admin and !$this->b_user_is_match_owner) { ?> <p>Sorry, you can't edit a tournament unless you added it.</p> <p><a href="<?php echo Html::Encode($this->tournament->GetNavigateUrl()); ?> ">Go back to tournament</a></p> <?php return; } # OK to edit the match $o_match = is_object($this->tournament) ? $this->tournament : new Match($this->GetSettings()); $this->editor->SetDataObject($o_match); echo $this->editor; parent::OnPageLoad(); }
function generate_vars($section, &$vars) { $vars['ok'] = false; $vars['full'] = false; if (!isset($_GET['match_id']) || !isset($_GET['nombre_billet'])) { return; } $nombre_billet = $_GET['nombre_billet']; $match = Match::get($_GET['match_id']); if ($match == null || $nombre_billet <= 0) { return; } if ($match->places < $nombre_billet) { $vars['full'] = true; return; } $match->places = $match->places - $nombre_billet; $match->save(); $reservation = new Reservation(); $reservation->utilisateur = $vars['userid']; $reservation->match_id = $match->id; $reservation->qte = $nombre_billet; $reservation->expiration = 'now()'; $reservation->save(); $vars['ok'] = true; }
/** * {@inheritdoc} */ public function enter($form) { $firstTeam = $form->get('first_team'); $secondTeam = $form->get('second_team'); $serverInfo = $this->getServerInfo($form->get('server_address')); $match = \Match::enterMatch($firstTeam->get('team')->getData()->getId(), $secondTeam->get('team')->getData()->getId(), $firstTeam->get('score')->getData(), $secondTeam->get('score')->getData(), $form->get('duration')->getData(), $this->me->getId(), $form->get('time')->getData(), $this->getPlayerList($firstTeam), $this->getPlayerList($secondTeam), $serverInfo[0], $serverInfo[1], null, $form->get('map')->getData()->getId()); return $match; }
public function __construct($node, $parent) { parent::__construct($node, $parent); self::$possible_attributes = array_merge(parent::$possible_attributes, self::$possible_attributes); self::$required_attributes = array_merge(parent::$required_attributes, self::$required_attributes); self::$possible_children = array_merge(parent::$possible_children, self::$possible_children); self::$required_children = array_merge(parent::$required_children, self::$required_children); }
function ajust_ticket_and_delete($reservation) { $match = Match::get($reservation->match_id); $new_places = $match->places + $reservation->qte; $match->places = $new_places; $match->save(); $reservation->delete(); }
/** * @return array */ public static function getBest() { $result = Match::selectRaw('winner_id, COUNT(*) as won')->whereNotNull('winner_id')->where('winner_id', '!=', 0)->orderByRaw('COUNT(*) DESC')->groupBy('winner_id')->take(self::TEAM_STATS_LIMIT)->get()->keyBy('winner_id')->toArray(); $teams = Team::whereIn('id', array_keys($result))->get()->toArray(); $result = array_map(function ($team) use($result) { return array_merge($team, $result[$team['id']]); }, $teams); return $result; }
/** * @param $password * @param $begin * @param $end * @param $token * @param array $params * Array with keys: day, month, year, separator. */ public function __construct($password, $begin, $end, $token, $params) { parent::__construct($password, $begin, $end, $token); $this->pattern = 'date'; $this->day = $params['day']; $this->month = $params['month']; $this->year = $params['year']; $this->separator = $params['separator']; }
/** * {@inheritdoc} */ public function enter($form) { $firstTeam = $form->get('first_team'); $secondTeam = $form->get('second_team'); $firstId = $firstTeam->get('team')->getData()->getId(); $secondId = $secondTeam->get('team')->getData()->getId(); $official = $form->get('type')->getData() === \Match::OFFICIAL; $match = \Match::enterMatch($official ? $firstId : null, $official ? $secondId : null, $firstTeam->get('score')->getData(), $secondTeam->get('score')->getData(), $form->get('duration')->getData(), $this->me->getId(), $form->get('time')->getData(), $this->getPlayerList($firstTeam), $this->getPlayerList($secondTeam), $form->get('server_address')->getData(), null, $form->get('map')->getData()->getId(), $form->get('type')->getData(), $official ? null : $firstId, $official ? null : $secondId); return $match; }
/** * @param $password * @param $begin * @param $end * @param $token * @param array $params */ public function __construct($password, $begin, $end, $token, $params = array()) { parent::__construct($password, $begin, $end, $token); $this->pattern = 'sequence'; if (!empty($params)) { $this->sequenceName = isset($params['sequenceName']) ? $params['sequenceName'] : null; $this->sequenceSpace = isset($params['sequenceSpace']) ? $params['sequenceSpace'] : null; $this->ascending = isset($params['ascending']) ? $params['ascending'] : null; } }
/** * @param $password * @param $begin * @param $end * @param $token * @param array $params */ public function __construct($password, $begin, $end, $token, $params = array()) { parent::__construct($password, $begin, $end, $token); $this->pattern = 'dictionary'; if (!empty($params)) { $this->dictionaryName = isset($params['dictionary_name']) ? $params['dictionary_name'] : null; $this->matchedWord = isset($params['matched_word']) ? $params['matched_word'] : null; $this->rank = isset($params['rank']) ? $params['rank'] : null; } }