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); }