function OnPageLoad()
 {
     echo new XhtmlElement('h1', Html::Encode($this->GetPageTitle()));
     $user = AuthenticationManager::GetUser();
     $list = '';
     if ($user->Permissions()->HasPermission(PermissionType::MANAGE_CATEGORIES)) {
         $list .= '<li><a href="/yesnosorry/categorylist.php">Categories</a></li>';
     }
     if ($user->Permissions()->HasPermission(PermissionType::MANAGE_TEAMS)) {
         $list .= '<li><a href="/play/clubs">Clubs and schools</a></li>';
         $list .= '<li><a href="/yesnosorry/contact-audit.php">Contact details audit</a></li>';
     }
     if ($user->Permissions()->HasPermission(PermissionType::MANAGE_GROUNDS)) {
         $list .= '<li><a href="/yesnosorry/groundlist.php">Grounds</a></li>';
     }
     if ($user->Permissions()->HasPermission(PermissionType::MANAGE_USERS_AND_PERMISSIONS)) {
         $list .= '<li><a href="/yesnosorry/personlist.php">Users</a></li>' . '<li><a href="/yesnosorry/roles.php">Roles</a></li>';
     }
     if ($user->Permissions()->HasPermission(PermissionType::MANAGE_URLS)) {
         $list .= '<li><a href="regenerate-short-urls.php">Regenerate short URL cache</a></li>';
     }
     if ($user->Permissions()->HasPermission(PermissionType::MANAGE_SEARCH)) {
         $list .= '<li><a href="/search/reindex.php">Reindex search</a></li>';
     }
     if ($user->Permissions()->HasPermission(PermissionType::MANAGE_STATISTICS)) {
         $list .= '<li><form action="/play/statistics/recalculate-player-statistics.php" method="post"><div><input type="submit" value="Recalculate player statistics" /></div></form></li>';
     }
     if ($list) {
         echo '<ul>' . $list . '</ul>';
     }
 }
    function OnPageLoad()
    {
        if (is_object($this->data_object)) {
            echo new XhtmlElement('h1', Html::Encode('Delete role: ' . $this->data_object->getRoleName()));
        } else {
            echo new XhtmlElement('h1', 'Delete role');
            $this->deleted = true;
        }
        if ($this->deleted) {
            ?>
			<p>The role has been deleted.</p>
			<p><a href="roles.php">View all roles</a></p>
			<?php 
        } else {
            ?>
				<p>Deleting a role cannot be undone.</p>
				<p>Are you sure you want to delete this role?</p>
				<form method="post" class="deleteButtons">
				<div>
				<input type="submit" value="Delete role" 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 role');
            $panel->AddLink('edit this role', "role.php?item=" . $this->data_object->getRoleId());
            echo $panel;
        }
    }
    function OnPageLoad()
    {
        ?>
<h1>Manage roles</h1>
<table>
    <thead><tr><th>Role</th><th>Action</th></tr></thead>
    <tbody>
	<?php 
        foreach ($this->roles as $role) {
            ?>
		<tr>
		    <td><a href="role.php?item=<?php 
            echo Html::Encode($role->getRoleId());
            ?>
"><?php 
            echo Html::Encode($role->getRoleName());
            ?>
</a></td>
		    <td><a href="roledelete.php?item=<?php 
            echo Html::Encode($role->getRoleId());
            ?>
">Delete</a></td>
		</tr>
		<?php 
        }
        ?>
	</tbody>
</table>
<?php 
        $this->AddSeparator();
        require_once 'stoolball/user-edit-panel.class.php';
        $panel = new UserEditPanel($this->GetSettings(), '');
        $panel->AddLink('add a role', 'role.php');
        echo $panel;
    }
 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 OnPreRender()
 {
     /* @var $o_settings SiteSettings */
     /* @var $o_user User */
     $o_settings = $this->o_settings;
     $o_user =& $this->o_user;
     if ($o_user->IsSignedIn()) {
         # Show username
         $this->AddControl(new XhtmlElement('p', 'Welcome ' . $o_user->GetName(), "large"));
         $token = isset($_SESSION['csrf_token']) ? $_SESSION['csrf_token'] : base64_encode(mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB)));
         $_SESSION['csrf_token'] = $token;
         $html = '<form method="post" class="sign-out" action="/you/sign-out"><div>
         <input type="hidden" name="action" value="signout" />
         <input type="hidden" name="securitytoken" value="' . Html::Encode($token) . '" />
         <input type="submit" value="Sign out" /></div></form>';
         $this->AddControl($html);
         # Build edit profile link
         $o_profile = new XhtmlAnchor('Edit profile', $o_settings->GetUrl('AccountEdit'));
         $o_profile->AddAttribute('accesskey', '0');
         $o_profile->SetCssClass('editProfile');
         $this->AddControl($o_profile);
     } else {
         # Build sign in link
         $o_sign_in = new XhtmlAnchor('Sign in', $o_settings->GetFolder('Account'));
         $o_sign_in->AddAttribute('accesskey', '0');
         $o_sign_in->SetCssClass('signIn');
         $this->AddControl($o_sign_in);
         # Build register link
         $register = new XhtmlAnchor('Register', $o_settings->GetUrl('AccountCreate'));
         $this->AddControl($register);
     }
 }
 function OnPageLoad()
 {
     echo '<h1>' . Html::Encode($this->GetPageTitle()) . '</h1>';
     $new_user = is_object($this->new_user) ? $this->new_user : new User();
     $this->form->SetDataObject($new_user);
     echo $this->form;
 }
 public function OnPreRender()
 {
     $by = $this->player->GetPlayerRole() == \Player::PLAYER ? ", " : " conceded by ";
     $this->AddControl('<h1><span property="schema:name">' . \Html::Encode($this->player->GetName()) . '</span>' . \Html::Encode($by . ' ' . $this->player->Team()->GetName() . $this->filter_description) . "</h1>");
     # When has this player played?
     $match_or_matches = $this->player->GetTotalMatches() == 1 ? " match" : " matches";
     $years = $this->player->GetPlayingYears();
     $filtered = "";
     if ($this->filter_description) {
         # If first played date is missing, the player came from PlayerManager because there were no statistics found
         if (!$this->filter_matched_nothing) {
             $filtered = " matching this filter";
         } else {
             $filtered = ", but none match this filter";
             $years = '';
         }
     }
     $team_name = '<span rel="schema:memberOf"><span about="' . \Html::Encode($this->player->Team()->GetLinkedDataUri()) . '" typeof="schema:SportsTeam"><a property="schema:name" rel="schema:url" href="' . \Html::Encode($this->player->Team()->GetNavigateUrl()) . "\">" . \Html::Encode($this->player->Team()->GetName()) . "</a></span></span>";
     if ($this->player->GetPlayerRole() == \Player::PLAYER) {
         if ($this->player->GetTotalMatches() == 0) {
             $played_total = " hasn't played any " . $match_or_matches;
         } else {
             $played_total = ' played <a href="/play/statistics/player-performances' . $this->filter_querystring . '">' . $this->player->GetTotalMatches() . $match_or_matches . '</a>';
         }
         $this->AddControl("<p>" . \Html::Encode($this->player->GetName()) . $played_total . " for {$team_name}{$filtered}{$years}.</p>");
         # Player of match
         if ($this->player->GetTotalPlayerOfTheMatchNominations() > 0) {
             $match_or_matches = $this->player->GetTotalPlayerOfTheMatchNominations() == 1 ? " match." : " matches.";
             $this->AddControl('<p>Nominated <a href="/play/statistics/player-of-match' . $this->filter_querystring . '">player of the match</a> in ' . $this->player->GetTotalPlayerOfTheMatchNominations() . $match_or_matches . "</p>");
         }
     } else {
         $this->AddControl("<p>{$team_name} recorded " . \Html::Encode($this->player->TotalRuns() . " " . strtolower($this->player->GetName()) . " in " . $this->player->GetTotalMatches() . $match_or_matches . "{$filtered}{$years}.") . "</p>");
     }
 }
    function OnPageLoad()
    {
        if ($this->b_success) {
            ?>
<h1>Confirmation successful</h1>
<p>Thank you for confirming your email address. Your profile has been updated.</p>
<p>When you next sign in to <?php 
            echo Html::Encode($this->GetSettings()->GetSiteName());
            ?>
 you'll
need to use your new email address, <strong><?php 
            echo Html::Encode(AuthenticationManager::GetUser()->GetEmail());
            ?>
</strong>, along with your existing password.</p>
<p><a href="<?php 
            echo Html::Encode($this->GetSettings()->GetUrl('AccountEdit'));
            ?>
">Back to your profile</a></p>
			<?php 
        } else {
            ?>
<h1>Confirmation failed</h1>
<p>Sorry, your request to change your registered email address could not be confirmed.</p>
<p>Please check that you used the exact address in the email you received, or try to <a href="<?php 
            echo Html::Encode($this->GetSettings()->GetUrl('AccountEssential'));
            ?>
">change your email address</a> again.</p>
			<?php 
        }
    }
 function OnPreRender()
 {
     # get email address to populate form
     $s_email = '';
     if (isset($_GET['address']) and $_GET['address']) {
         $s_email = $_GET['address'];
     } else {
         if (isset($_POST['email']) and $_POST['email']) {
             $s_email = $_POST['email'];
         }
     }
     # get password to populate form
     $s_pass = (isset($_POST['password']) and $_POST['password']) ? $_POST['password'] : '';
     # remember whether to remember
     $s_remember = $this->authentication_manager->HasCookies() ? ' checked="checked"' : '';
     # work out which page to redirect to once signed in
     if (isset($_GET['page']) and $_GET['page']) {
         $s_page_to_return_to = $_GET['page'];
     } else {
         if (isset($_POST['page']) and $_POST['page']) {
             $s_page_to_return_to = $_POST['page'];
         } else {
             if (isset($_SERVER['HTTP_REFERER']) and $_SERVER['HTTP_REFERER'] and strstr($_SERVER['HTTP_REFERER'], $this->settings->GetUrl('AccountCreate')) === false and strstr($_SERVER['HTTP_REFERER'], $this->settings->GetFolder('Account')) === false) {
                 $s_page_to_return_to = $_SERVER['HTTP_REFERER'];
             } else {
                 $s_page_to_return_to = $this->settings->GetClientRoot();
             }
         }
     }
     # home page is last resort
     # build up form xhtml
     $this->AddControl('<div class="formPart"><label for="email2" class="formLabel">Your email address</label> <div class="formControl"><input type="email" size="30" maxlength="100" autocorrect="off" autocapitalize="off" id="email2" name="email" value="' . Html::Encode($s_email) . '" /></div></div>' . "\n" . '<div class="formPart"><label for="password2" class="formLabel">Your password</label> <div class="formControl"><input type="password" size="30" autocorrect="off" autocapitalize="off" id="password2" name="password" value="' . Html::Encode($s_pass) . '" /></div></div>' . "\n" . '<div class="formPart"><div class="formControl"><label for="remember_me"><input type="checkbox" name="remember_me" id="remember_me"' . Html::Encode($s_remember) . ' /> Keep me signed in <small>(uses a cookie)</small></label></div></div>' . "\n" . '<input type="hidden" name="page" value="' . Html::Encode($s_page_to_return_to) . '" />' . "\n" . '<div><input type="submit" class="submit" value="Sign in" /></div>' . "\n" . '<p id="authGetPassword"><a href="/you/request-password-reset">Reset password</a></p>' . "\n" . '<script>' . "\n" . '<!--' . "\n" . "document.getElementById('email2').focus();\n" . '//-->' . "\n" . '</script>' . "\n");
 }
 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();
 }
    function OnPageLoad()
    {
        echo new XhtmlElement('h1', Html::Encode('Delete category: ' . $this->data_object->GetName()));
        if ($this->deleted) {
            ?>
			<p>The category has been deleted.</p>
			<p><a href="/yesnosorry/categorylist.php">View all categories</a></p>
			<?php 
        } else {
            if ($this->has_permission) {
                ?>
				<p>Deleting a category cannot be undone.</p>
				<ul>
					<li>Its competitions will not be listed in a category</li>
				</ul> 
					
				<p>Are you sure you want to delete this category?</p>
				<form action="<?php 
                echo Html::Encode($this->data_object->GetDeleteCategoryUrl());
                ?>
" method="post" class="deleteButtons">
				<div>
				<input type="submit" value="Delete category" name="delete" />
				<input type="submit" value="Cancel" name="cancel" />
				</div>
				</form>
				<?php 
            } else {
                ?>
				<p>Sorry, you're not allowed to delete this category.</p>
				<p><a href="/yesnosorry/categorylist.php">Go back to the list of categories</a></p>
				<?php 
            }
        }
    }
    public function OnLoadPageData()
    {
        require_once 'stoolball/competition-manager.class.php';
        $manager = new CompetitionManager($this->GetSettings(), $this->GetDataConnection());
        $manager->ReadById(null, array($this->season_id));
        $competition = $manager->GetFirst();
        unset($manager);
        if (!$competition instanceof Competition) {
            return;
        }
        require_once 'stoolball/ground-manager.class.php';
        $manager = new GroundManager($this->GetSettings(), $this->GetDataConnection());
        $manager->FilterBySeason(array($competition->GetWorkingSeason()->GetId()));
        $manager->ReadAll();
        $grounds = $manager->GetItems();
        unset($manager);
        ?>
$(function() {
// Make the placeholder big enough for a map
var mapControl = document.getElementById("map");
mapControl.style.width = '100%';
mapControl.style.height = '500px'; // Create the map var
var bounds = new google.maps.LatLngBounds();
var myOptions = { mapTypeId : google.maps.MapTypeId.ROADMAP };
var map = new google.maps.Map(mapControl, myOptions);
var markers = [];
var info;
		<?php 
        foreach ($grounds as $ground) {
            /* @var $ground Ground */
            if (!$ground->GetAddress()->GetLatitude() or !$ground->GetAddress()->GetLongitude()) {
                continue;
            }
            $content = "'<div class=\"map-info\">' +\n\t'<h2>" . str_replace("'", "\\'", Html::Encode($ground->GetNameAndTown())) . "</h2>' +\n\t'<p>Home to: ";
            $teams = $ground->Teams()->GetItems();
            $length = count($teams);
            for ($i = 0; $i < $length; $i++) {
                if ($i > 0 and $i == $length - 1) {
                    $content .= " and ";
                } else {
                    if ($i > 0) {
                        $content .= ", ";
                    }
                }
                $content .= '<a href="' . Html::Encode($teams[$i]->GetNavigateUrl()) . '">' . str_replace("'", "\\'", Html::Encode($teams[$i]->GetNameAndType())) . '</a>';
            }
            $content .= "</p></div>'";
            # And marker and click event to trigger info window. Wrap info window in function to isolate marker, otherwise the last marker
            # is always used for the position of the info window.
            echo "var marker = new google.maps.Marker({\n\t\t\tposition : new google.maps.LatLng(" . $ground->GetAddress()->GetLatitude() . "," . $ground->GetAddress()->GetLongitude() . "),\n\t\t\tshadow: Stoolball.Maps.WicketShadow(),\n\t\t\ticon: Stoolball.Maps.WicketIcon(),\n\t\t\ttitle : '" . str_replace("'", "\\'", $ground->GetNameAndTown()) . "'\n\t\t  });\n\t\t  markers.push(marker);\n\t\t  bounds.extend(marker.position);\n\n\t\t  (function(marker){\n\t\t\t  google.maps.event.addListener(marker, 'click', function()\n\t\t\t  {\n\t\t\t  \tvar content = {$content};\n\t\t\t  \tif (!info) info = new google.maps.InfoWindow();\n\t\t\t  \tinfo.setContent(content);\n\t\t\t  \tinfo.open(map, marker);\n\t\t\t  });\n\t\t  })(marker);\n\t\t  ";
        }
        ?>
map.fitBounds(bounds);
var style = [{ url: '/images/features/map-markers.gif', height: 67, width: 31, textColor: '#ffffff', textSize: 10 }];
var clusterer = new MarkerClusterer(map, markers, { 'gridSize': 30, styles: style});
});
		<?php 
        exit;
    }
 function OnPageLoad()
 {
     echo new XhtmlElement('h1', Html::Encode($this->GetPageTitle()));
     echo '<p>You can subscribe to emails for ' . Html::Encode($this->GetSettings()->GetSiteName()) . '\'s match comments. ' . 'Once you have subscribed, as soon as anyone else adds their comments,  you\'ll get an email.</p>';
     # display tables of subscriptions
     echo new SubscriptionGrid($this->GetSettings(), $this->a_subs);
     echo '<form method="get" action="' . Html::Encode($this->GetSettings()->GetUrl('AccountEdit')) . '"><div>' . '<input type="submit" class="submit" value="Done" title="Return to your edit profile options page" />' . '</div></form>';
 }
 function OnPageLoad()
 {
     echo new XhtmlElement('h1', Html::Encode($this->GetPageTitle()));
     # display the club
     $o_club = is_object($this->o_club) ? $this->o_club : new Club($this->GetSettings());
     $this->o_edit->SetDataObject($o_club);
     echo $this->o_edit;
     parent::OnPageLoad();
 }
 function OnPageLoad()
 {
     echo new XhtmlElement('h1', Html::Encode($this->GetPageTitle()));
     # display the competition
     $o_competition = is_object($this->o_competition) ? $this->o_competition : new Competition($this->GetSettings());
     $this->o_edit->SetDataObject($o_competition);
     echo $this->o_edit;
     parent::OnPageLoad();
 }
 function OnPageLoad()
 {
     echo new XhtmlElement('h1', Html::Encode($this->GetPageTitle()));
     echo new CategoryTreeControl($this->GetCategories());
     $this->AddSeparator();
     require_once "stoolball/user-edit-panel.class.php";
     $panel = new UserEditPanel($this->GetSettings());
     $panel->AddLink("add a category", "categoryedit.php");
     echo $panel;
 }
 function OnPageLoad()
 {
     echo new XhtmlElement('h1', Html::Encode($this->GetPageTitle()));
     if (!is_object($this->role)) {
         $this->role = new Role();
     }
     $this->editor->SetDataObject($this->role);
     echo $this->editor;
     parent::OnPageLoad();
 }
 protected function OnPreRender()
 {
     foreach ($this->tabs as $name => $url) {
         if ($url) {
             $this->AddControl('<div class="tab-option tab-inactive' . Html::Encode($this->tab_class) . '"><p><a href="' . Html::Encode($url) . '">' . Html::Encode($name) . '</a></p></div>');
         } else {
             $this->AddControl('<div class="tab-option tab-active' . Html::Encode($this->tab_class) . '"><h2>' . Html::Encode($name) . '</h2></div>');
         }
     }
 }
 /**
  * Create and populate the controls used to edit the data object
  *
  */
 protected function CreateControls()
 {
     $this->SetButtonText('Register');
     $s_known_as = isset($_POST['known_as']) ? $_POST['known_as'] : '';
     $s_email = isset($_POST['email']) ? $_POST['email'] : '';
     $s_pass1 = isset($_POST['password1']) ? $_POST['password1'] : '';
     $s_pass2 = isset($_POST['password2']) ? $_POST['password2'] : '';
     $s_remember = isset($_POST['remember_me']) ? ' checked="checked"' : '';
     $this->AddControl('<div class="formPart">' . "\n" . '<label for="known_as" class="formLabel">Your name</label>' . "\n" . '<div class="formControl"><input type="text" size="25" maxlength="210" id="known_as" name="known_as" value="' . Html::Encode($s_known_as) . '" /></div>' . "\n" . '</div>' . "\n" . '<div class="formPart">' . "\n" . '<label for="email" class="formLabel">Your email address</label>' . "\n" . '<div class="formControl"><input type="text" size="25" maxlength="100" autocorrect="off" autocapitalize="off" id="email" name="email" value="' . Html::Encode($s_email) . '" /></div>' . "\n" . '</div>' . "\n" . '<p>Passwords must be at least 10 characters long. We recommend a mix of numbers, letters and punctuation. Avoid passwords you already use elsewhere.</p>' . '<div class="formPart">' . "\n" . '<label for="password1" class="formLabel">Your password</label>' . "\n" . '<div class="formControl"><input type="password" size="25" autocorrect="off" autocapitalize="off" id="password1" name="password1" value="' . Html::Encode($s_pass1) . '" /></div>' . "\n" . '</div>' . "\n" . '<div class="formPart">' . "\n" . '<label for="password2" class="formLabel">Confirm password</label>' . "\n" . '<div class="formControl"><input type="password" size="25" autocorrect="off" autocapitalize="off" id="password2" name="password2" value="' . Html::Encode($s_pass2) . '" /></div>' . "\n" . '</div>' . "\n" . '<label class="aural" for="dummy">Ignore this if you\'re human <input type="text" name="dummy" id="dummy" /></label>' . "\n" . '<script>' . "\n" . '<!--' . "\n" . "document.getElementById('known_as').focus();\n" . '//-->' . "\n" . '</script>' . "\n");
 }
 public function __construct($s_text = null, $s_value = null, $selected = false)
 {
     parent::XhtmlElement('option');
     # store text
     $this->AddControl(Html::Encode((string) $s_text));
     # use text as value if no value supplied
     $this->AddAttribute('value', is_null($s_value) ? $s_text : $s_value);
     if ($selected) {
         $this->AddAttribute('selected', 'selected');
     }
 }
 function OnPageLoad()
 {
     echo new XhtmlElement('h1', Html::Encode($this->GetPageTitle()));
     echo new ClubListControl($this->a_clubs);
     if (AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_TEAMS)) {
         require_once "stoolball/user-edit-panel.class.php";
         $this->AddSeparator();
         $panel = new UserEditPanel($this->GetSettings(), "clubs and schools");
         $panel->AddLink("add a club or school", "/play/clubs/clubedit.php");
         echo $panel;
     }
 }
 function OnPreRender()
 {
     foreach ($this->a_clubs as $o_club) {
         if ($o_club instanceof Club) {
             $o_link = new XhtmlElement('a', Html::Encode($o_club->GetName()));
             $o_link->AddAttribute('href', $o_club->GetNavigateUrl());
             $o_li = new XhtmlElement('li');
             $o_li->AddControl($o_link);
             $this->AddControl($o_li);
         }
     }
 }
 /**
  * (non-PHPdoc)
  * @see data/DataEditControl#CreateControls()
  */
 protected function CreateControls()
 {
     $s_known_as = isset($_POST['known_as']) ? $_POST['known_as'] : $this->user->GetName();
     $s_first_name = isset($_POST['first_name']) ? $_POST['first_name'] : $this->user->GetFirstName();
     $s_last_name = isset($_POST['last_name']) ? $_POST['last_name'] : $this->user->GetLastName();
     $s_email = isset($_POST['email']) ? $_POST['email'] : $this->user->GetEmail();
     $s_remember = (isset($_POST['remember_me']) and $_POST['remember_me'] or $this->authentication_manager->HasCookies()) ? ' checked="checked"' : '';
     $this->AddControl('<fieldset>' . "\n" . '<legend>Your name</legend>' . "\n" . '<div class="formPart">' . "\n" . '<label for="known_as" class="formLabel">Nickname</label>' . "\n" . '<div class="formControl"><input type="text" size="50" maxlength="255" name="known_as" id="known_as" value="' . Html::Encode($s_known_as) . '" /></div>' . "\n" . '</div>' . "\n" . '<div class="formPart">' . "\n" . '<label for="first_name" class="formLabel">First name</label>' . "\n" . '<div class="formControl"><input type="text" size="50" maxlength="100" name="first_name" id="first_name" value="' . Html::Encode($s_first_name) . '" /></div>' . "\n" . '</div>' . "\n" . '<div class="formPart">' . "\n" . '<label for="last_name" class="formLabel">Last name</label>' . "\n" . '<div class="formControl"><input type="text" size="50" maxlength="100" name="last_name" id="last_name" value="' . Html::Encode($s_last_name) . '" /></div>' . "\n" . '</div>' . "\n" . '</fieldset>' . "\n" . '<fieldset>' . "\n" . '<legend>Change your email address</legend>' . '<div class="formPart">' . "\n" . '<label for="email" class="formLabel">Email address</label>' . "\n" . '<div class="formControl"><input type="email" size="50" maxlength="100" name="email" id="email" autocorrect="off" autocapitalize="off" value="' . Html::Encode($s_email) . '" /></div>' . "\n" . '</div>');
     if ($this->user->GetRequestedEmail() && $this->user->GetEmail() != $this->user->GetRequestedEmail() and $this->user->GetPassword() and !$this->suppress_email_message) {
         $this->AddControl("<p>Waiting to change email address to <strong>" . Html::Encode($this->user->GetRequestedEmail()) . "</strong>. Please check your email.</p>");
     }
     $this->AddControl('</fieldset>' . "\n" . '<fieldset>' . "\n" . '<legend>Change your password</legend>' . "\n" . '<p>Passwords must be at least 10 characters long. We recommend a mix of numbers, letters and punctuation. Avoid passwords you already use elsewhere.</p>' . '<div class="formPart">' . "\n" . '<label for="password2" class="formLabel">New password</label>' . "\n" . '<div class="formControl"><input type="password" size="25" name="password2" id="password2" value="" autocorrect="off" autocapitalize="off" /></div>' . "\n" . '</div>' . "\n" . '<div class="formPart">' . "\n" . '<label for="password3" class="formLabel">Confirm new password</label>' . "\n" . '<div class="formControl"><input type="password" size="25" name="password3" id="password3" value="" autocorrect="off" autocapitalize="off" /></div>' . "\n" . '</div>' . "\n" . '</fieldset>' . "\n" . '<fieldset>' . "\n" . '<legend>Sign in automatically</legend>' . "\n" . '<div class="radioButtonList"><label for="remember_me"><input type="checkbox" name="remember_me" id="remember_me" value="1"' . $s_remember . ' /> Keep me signed in <small>(uses a cookie)</small></label></div>' . "\n" . '</fieldset>' . "\n" . '<fieldset>' . "\n" . '<legend>Confirm your current password</legend>' . "\n" . '<p>To change your password or email address, or to sign in automatically, please enter your current password.</p>' . '<div class="formPart">' . "\n" . '<label for="password1" class="formLabel">Current password</label>' . "\n" . '<div class="formControl"><input type="password" size="25" maxlength="12" name="password1" id="password1" value="" autocorrect="off" autocapitalize="off" /></div>' . "\n" . '</div>' . "\n" . '</fieldset>' . "\n" . '<script>' . "\n" . '<!--' . "\n" . "document.getElementById('known_as').focus();\n" . '//-->' . "\n" . '</script>' . "\n");
 }
 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()
 {
     /* @var $o_top_level Category */
     $review_item = $this->o_topic->GetReviewItem();
     $s_suggested_title = urlencode(StringFormatter::PlainText(trim($review_item->GetTitle())));
     $s_page = urlencode($_SERVER['REQUEST_URI']);
     $s_subscribe_link = '/play/subscribe.php?type=' . $review_item->GetType() . '&amp;item=' . $review_item->GetId() . '&amp;title=' . $s_suggested_title . '&amp;page=' . $s_page;
     $s_subscribe_title = 'Get an email alert every time there are new comments on this page';
     $this->AddControl('<div class="forumSubscribe"><a href="' . $s_subscribe_link . '" title="' . $s_subscribe_title . '">Subscribe to comments</a></div>');
     if (!$this->authentication_manager->GetUser()->Permissions()->HasPermission(PermissionType::ForumAddMessage())) {
         $add = $this->o_topic->GetCount() ? 'Add your comments' : 'Be the first to add your comments!';
         $this->AddControl('<div class="forumPost"><a href="' . Html::Encode($this->authentication_manager->GetPermissionUrl()) . urlencode('#forumMessageForm') . '">' . $add . '</a></div>');
     }
 }
    function OnPageLoad()
    {
        ?>
		<h1>Contact details audit</h1>

        <p>All current teams (except representative teams) should have a phone number, email address and postcode. 
            All current competitions should have a phone number and email address. This is a list of those that haven't.</p>

        <p>One benefit of having both phone and email is that we can publicise the team automatically on services like BBC Get Inspired, which demand both.</p>

        <p><strong>Do not publish contact details without explicit permission as that would be against the Data Protection Act.</strong></p>
		<table>
		    <caption>Teams</caption>
		    <thead><tr><th>Team</th><th>Phone</th><th>Email</th><th>Postcode</th><th>Private contact</th></tr></thead>
		    <tbody>
		<?php 
        foreach ($this->teams as $team) {
            /* @var $team Team */
            $phone = Html::Encode($team->GetContactPhone());
            $email = Html::Encode($team->GetContactEmail());
            $postcode = Html::Encode($team->GetGround()->GetAddress()->GetPostcode());
            $is_representative = $team->GetTeamType() == Team::REPRESENTATIVE;
            $private = $team->GetPrivateContact() ? "yes" : "no";
            if ((!$phone or !$email or !$postcode) and !$is_representative) {
                echo "<tr><td><a href=\"" . Html::Encode($team->GetNavigateUrl()) . "\">" . Html::Encode($team->GetName()) . "</a></td><td>{$phone}</td><td>{$email}</td><td>{$postcode}</td><td>{$private}</tr>";
            }
        }
        ?>
            </tbody>
        </table>

        <table>
            <caption>Competitions</caption>
            <thead><tr><th>Competitions</th><th>Phone</th><th>Email</th></tr></thead>
            <tbody>
        <?php 
        foreach ($this->competitions as $competition) {
            /* @var $competition Competition */
            $phone = Html::Encode($competition->GetContactPhone());
            $email = Html::Encode($competition->GetContactEmail());
            if (!$phone or !$email) {
                echo "<tr><td><a href=\"" . Html::Encode($competition->GetNavigateUrl()) . "\">" . Html::Encode($competition->GetName()) . "</a></td><td>" . $phone . "</td><td>" . $email . "</td></tr>";
            }
        }
        ?>
            </tbody>
        </table>
        <?php 
    }
 function OnPageLoad()
 {
     echo new XhtmlElement('h1', Html::Encode($this->GetPageTitle()));
     # display the category
     $o_category = is_object($this->o_category) ? $this->o_category : new Category();
     $this->o_edit->SetDataObject($o_category);
     echo $this->o_edit;
     if ($this->o_category instanceof Category) {
         $this->AddSeparator();
         require_once "stoolball/user-edit-panel.class.php";
         $panel = new UserEditPanel($this->GetSettings(), "this category");
         $panel->AddLink("delete this category", $this->o_category->GetDeleteCategoryUrl());
         echo $panel;
     }
 }
 function OnPageLoad()
 {
     echo '<h1>Subscribed to ' . Html::Encode($this->o_review_item->GetTitle() ? $this->o_review_item->GetTitle() : ' page') . '</h1>';
     # Confirm subscription to user
     $b_title = (bool) $this->o_review_item->GetTitle();
     echo new XhtmlElement('p', 'You have subscribed to ' . Html::Encode($b_title ? "'" . $this->o_review_item->GetTitle() . "'" : 'the page you selected') . '. You will get an email alert every time someone adds a comment.');
     echo new XhtmlElement('p', 'If you want to stop getting these email alerts, sign in to ' . Html::Encode($this->GetSettings()->GetSiteName()) . ' and delete your subscription from the email alerts page.');
     # Links suggesting what to do next
     $o_whatnext = new XhtmlElement('ul');
     if ($this->o_review_item->GetNavigateUrl()) {
         $o_whatnext->AddControl(new XhtmlElement('li', new XhtmlAnchor('Go back to ' . Html::Encode($b_title ? $this->o_review_item->GetTitle() : 'the page you came from'), $this->o_review_item->GetNavigateUrl())));
     }
     $o_whatnext->AddControl(new XhtmlElement('li', new XhtmlAnchor("Email alerts", $this->GetSettings()->GetUrl('EmailAlerts'))));
     echo $o_whatnext;
 }
 function OnPageLoad()
 {
     echo new XhtmlElement('h1', Html::Encode($this->GetPageTitle()));
     if (!is_null($this->error)) {
         echo $this->error;
     }
     if (!$this->valid_token) {
         echo "<p>Sorry, this password reset link isn't valid.</p><p>Reset links expire 24 hours after you request them.</p>";
     } else {
         if (isset($this->saved) and $this->saved) {
             echo '<p>Your password has been reset. Please <a href="' . Html::Encode($this->GetSettings()->GetFolder('Account')) . '">sign in</a>.</p>';
         } else {
             echo $this->form;
         }
     }
 }
 function OnPreRender()
 {
     /* @var $o_ground Ground */
     foreach ($this->a_grounds as $o_ground) {
         if ($o_ground instanceof Ground) {
             $o_link = new XhtmlElement('a', Html::Encode($o_ground->GetNameAndTown()));
             $o_link->AddAttribute('href', $o_ground->GetNavigateUrl());
             $o_li = new XhtmlElement('li');
             $o_li->AddControl($o_link);
             $precision = array(GeoPrecision::Unknown() => 'No map', GeoPrecision::Exact() => 'Exact', GeoPrecision::Postcode() => 'Postcode', GeoPrecision::StreetDescriptor() => 'Street', GeoPrecision::Town() => 'Town');
             if (!is_null($o_ground->GetAddress()->GetGeoPrecision())) {
                 $o_li->AddControl(' (Map: ' . Html::Encode($precision[$o_ground->GetAddress()->GetGeoPrecision()]) . ')');
             }
             $this->AddControl($o_li);
         }
     }
 }