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