function OnPreRender() { /* @var $o_season Season */ /* @var $o_team Team */ $this->SetCaption($this->o_competition->GetName()); $o_headings = new XhtmlRow(array('Name of team', 'Ground address', 'Contact details')); $o_headings->SetIsHeader(true); $this->AddRow($o_headings); foreach ($this->o_competition->GetLatestSeason()->GetTeams() as $o_team) { if ($o_team instanceof Team) { $o_row = new XhtmlRow(); $o_row->AddCell(new XhtmlAnchor(Html::Encode($o_team->GetName()), $o_team->GetEditTeamUrl())); $o_row->AddCell(new PostalAddressControl($o_team->GetGround()->GetAddress())); $private = $o_team->GetPrivateContact(); $public = $o_team->GetContact(); $private_header = '<h2 style="margin:0; font-size:1.1em; color: #900;">Private</h2>'; if ($private and $public) { $contact = $public . $private_header . $private; } else { $contact = $private ? $private_header . $private : $public; } $o_row->AddCell(nl2br(XhtmlMarkup::ApplySimpleTags(XhtmlMarkup::ApplyLinks($contact, true)))); $this->AddRow($o_row); } } parent::OnPreRender(); }
public function __construct(Competition $competition) { $this->competition = $competition; $season = $competition->GetLatestSeason(); $teams = $season->GetTeams(); $keywords = array(); $content = array(); $keywords[] = $competition->GetName(); foreach ($teams as $team) { $keywords[] = $team->GetName(); $keywords[] = $team->GetGround()->GetAddress()->GetLocality(); $keywords[] = $team->GetGround()->GetAddress()->GetTown(); } $content[] = $competition->GetIntro(); $content[] = $competition->GetContact(); $this->searchable = new SearchItem("competition", "competition" . $competition->GetId(), $competition->GetNavigateUrl(), $competition->GetName()); $this->searchable->WeightOfType(700); $this->searchable->Description($this->GetSearchDescription()); $this->searchable->Keywords(implode(" ", $keywords)); $this->searchable->FullText(implode(" ", $content)); $related = '<ul>'; if ($season->GetShowTable()) { $related .= '<li><a href="' . $season->GetTableUrl() . '">Table</a></li>'; } $related .= '<li><a href="' . $competition->GetCompetitionMapUrl() . '">Map</a></li>' . '<li><a href="' . $competition->GetStatisticsUrl() . '">Statistics</a></li>' . '</ul>'; $this->searchable->RelatedLinksHtml($related); }
function OnPrePageLoad() { /* @var $o_competition Competition */ /* @var $o_season Season */ $this->SetPageTitle(is_object($this->o_competition) ? $this->o_competition->GetName() . ': Edit stoolball competition' : 'New stoolball competition'); $this->LoadClientScript("/scripts/tiny_mce/jquery.tinymce.js"); $this->LoadClientScript("/scripts/tinymce.js"); }
function OnPageLoad() { echo new XhtmlElement('h1', Html::Encode('Delete competition: ' . $this->data_object->GetName())); if ($this->deleted) { ?> <p>The competition has been deleted.</p> <p><a href="/competitions">View all competitions</a></p> <?php } else { if ($this->has_permission) { ?> <p>Deleting a competition cannot be undone. All seasons will be deleted, and matches will no longer be part of this competition.</p> <p>Are you sure you want to delete this competition?</p> <form action="<?php echo Html::Encode($this->data_object->GetDeleteCompetitionUrl()); ?> " method="post" class="deleteButtons"> <div> <input type="submit" value="Delete competition" name="delete" /> <input type="submit" value="Cancel" name="cancel" /> </div> </form> <?php $this->AddSeparator(); require_once 'stoolball/user-edit-panel.class.php'; $panel = new UserEditPanel($this->GetSettings(), 'this competition'); $panel->AddLink('view this competition', $this->data_object->GetNavigateUrl()); $panel->AddLink('edit this competition', $this->data_object->GetEditCompetitionUrl()); echo $panel; } else { ?> <p>Sorry, you're not allowed to delete this competition.</p> <p><a href="<?php echo Html::Encode($this->data_object->GetNavigateUrl()); ?> ">Go back to the competition</a></p> <?php } } }
private function ShowOtherSeasons() { # Check for other seasons. Check is >2 because current season is there twice - added above if (count($this->competition->GetSeasons()) > 2) { require_once "stoolball/season-list-control.class.php"; echo new XhtmlElement('h2', 'Other seasons in the ' . Html::Encode($this->competition->GetName()), "screen"); $season_list = new SeasonListControl($this->competition->GetSeasons()); $season_list->SetExcludedSeasons(array($this->season)); $season_list->AddCssClass("screen"); $season_list->SetUrlMethod('GetMapUrl'); echo $season_list; } }
/** * @return string * @desc Gets the name of the competition and season - eg Sussex Mixed League, 2005 season */ public function GetCompetitionName() { if (!isset($this->o_competition)) { return $this->GetName(); } $s_name = $this->o_competition->GetName(); if ($this->GetName()) { $s_name .= ', ' . $this->GetName() . ' season'; } else { $s_years = $this->GetYears(); if ($s_years) { $s_name .= ', ' . $s_years . ' season'; } } return $s_name; }