function OnPostback()
 {
     $this->o_competition = $this->o_edit->GetDataObject();
     # save data if valid
     if ($this->IsValid()) {
         $i_id = $this->o_comp_manager->SaveCompetition($this->o_competition);
         $this->o_competition->SetId($i_id);
         $this->Redirect($this->o_competition->GetNavigateUrl());
     }
 }
 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 OnPageLoad()
    {
        require_once 'xhtml/navigation/tabs.class.php';
        echo new XhtmlElement('h1', Html::Encode($this->GetPageTitle()));
        $season = $this->season;
        $tabs = array('Summary' => $season->GetNavigateUrl());
        if ($season->MatchTypes()->Contains(MatchType::LEAGUE)) {
            $tabs['Table'] = $season->GetTableUrl();
        }
        $tabs['Map'] = '';
        $tabs['Statistics'] = $season->GetStatisticsUrl();
        echo new Tabs($tabs);
        ?>
            <div class="box tab-box">
                <div class="dataFilter"></div>
    
        <?php 
        if ($this->has_map) {
            ?>
 
                <div id="map" class="map"><p>Loading map&#8230;</p>
                <p><small>If the map doesn't appear here, you may have JavaScript turned off. 
                    Turn it on if you can, or view the <a href="<?php 
            echo Html::Encode($this->competition->GetNavigateUrl());
            ?>
"><?php 
            echo Html::Encode($this->competition->GetName());
            ?>
 page</a>.</small></p></div>
                <div class="box-content">
                <?php 
            $this->ShowOtherSeasons();
            ?>
                </div>
                <?php 
        } else {
            ?>
            <div class="box-content">
            <p>There is no map for this season as there are no teams.</p>
            <?php 
            $this->ShowOtherSeasons();
            ?>
            </div>
            <?php 
        }
        ?>
        
            </div>

        <?php 
        $this->ShowSocialAccounts();
    }
    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 
            }
        }
    }