/**
  * Instantiates a SupportedContentControl
  *
  * @param XhtmlElement $o_all_content
  */
 public function __construct(XhtmlElement $o_all_content)
 {
     parent::XhtmlElement('div');
     $this->SetCssClass('supportedContentContainer');
     $o_all_content->AddCssClass('supportedContent');
     $this->AddControl($o_all_content);
 }
 /**
  * Instantiates a UserEditPanel
  *
  * @param SiteSettings $o_settings
  * @param string $s_about
  */
 public function __construct(SiteSettings $o_settings, $s_about = '')
 {
     parent::XhtmlElement('div');
     $this->o_settings = $o_settings;
     $this->a_links = array();
     $this->s_about = (string) $s_about;
 }
 /**
  * @return XhtmlForm
  * @desc Creates an XHTML form
  */
 function XhtmlForm()
 {
     parent::XhtmlElement('form');
     $this->SetNavigateUrl(htmlentities($_SERVER['REQUEST_URI']));
     $this->AddAttribute('method', 'post');
     $this->csrf_token = isset($_SESSION['csrf_token']) ? $_SESSION['csrf_token'] : base64_encode(mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB)));
 }
 /**
  * Create an image
  * @param SiteSettings $settings
  * @param string $s_path
  * @return void
  */
 public function __construct($o_settings = null, $s_path = '')
 {
     parent::XhtmlElement('img');
     $this->o_settings = $o_settings;
     // $settings must remain nullable, to support using external images which don't need local paths
     $this->SetEmpty(true);
     # <img /> is an empty element
     $this->AddAttribute('alt', '');
     # default to empty alt text
     if ($s_path) {
         # check image exists
         if (file_exists($o_settings->GetFolder('ImagesServer') . $s_path) and !is_dir($o_settings->GetFolder('ImagesServer') . $s_path)) {
             # get its size
             $a_image_details = getimagesize($o_settings->GetFolder('ImagesServer') . $s_path);
             if (is_array($a_image_details)) {
                 $this->SetWidth($a_image_details[0]);
                 # Don't set height, so that photos can resize down to the width of a small screen
                 # $this->SetHeight($a_image_details[1]);
             }
             # set other properties
             $this->AddAttribute('src', $o_settings->GetFolder('Images') . $s_path);
         } else {
             return null;
             #image doesn't exist
         }
     } else {
         return null;
         # insufficient data
     }
 }
 /**
  * Create new TeamNameControl
  * @param Team $team
  * @param string $container_element
  */
 public function __construct(Team $team, $container_element)
 {
     parent::XhtmlElement($container_element);
     $name = $team->GetName();
     $type = is_null($team->GetPlayerType()) ? '' : PlayerType::Text($team->GetPlayerType());
     if ($type and strpos(strtolower(str_replace("'", '', $name)), strtolower(str_replace("'", '', $type))) !== false) {
         $type = "";
     }
     $town = (is_null($team->GetGround()) or is_null($team->GetGround()->GetAddress())) ? "" : $team->GetGround()->GetAddress()->GetTown();
     if ($town and strpos(strtolower($name), strtolower($town)) !== false) {
         $town = "";
     }
     if ($type or $town) {
         $html = '<span property="schema:name">' . htmlentities($name, ENT_QUOTES, "UTF-8", false) . '</span>';
         if ($town) {
             $html .= htmlentities(", {$town}", ENT_QUOTES, "UTF-8", false);
         }
         if ($type) {
             $html .= htmlentities(" ({$type})", ENT_QUOTES, "UTF-8", false);
         }
         $this->AddControl($html);
     } else {
         $this->AddAttribute("property", "schema:name");
         $this->AddControl(htmlentities($name, ENT_QUOTES, "UTF-8", false));
     }
 }
 function XhtmlTable()
 {
     parent::XhtmlElement('table');
     $this->a_rowgroups = array();
     $this->a_rowgroups[] = new XhtmlRowGroup();
     $this->a_colgroups = array();
 }
 function SeasonListControl($a_seasons = null)
 {
     parent::XhtmlElement("div");
     $this->SetCssClass("season-list");
     $this->a_seasons = is_array($a_seasons) ? $a_seasons : array();
     $this->a_excluded = array();
 }
 public function __construct(ForumTopic $o_topic, AuthenticationManager $authentication_manager)
 {
     $this->o_topic = $o_topic;
     $this->authentication_manager = $authentication_manager;
     parent::XhtmlElement('div');
     $this->SetCssClass('forumNavbar');
 }
 function PostalAddressControl(PostalAddress $o_address)
 {
     # set up element
     parent::XhtmlElement('p');
     $this->SetCssClass('adr');
     $this->AddAttribute("typeof", "schema:PostalAddress");
     $this->SetAddress($o_address);
 }
 function Button($id, $text)
 {
     parent::XhtmlElement('input');
     $this->SetXhtmlId($id);
     $this->AddAttribute('name', $this->GetXhtmlId());
     $this->AddAttribute('type', 'submit');
     $this->SetEmpty(true);
     $this->AddAttribute('value', $text);
 }
 /**
  * @return FormPart
  * @param XhtmlElement/string $m_label
  * @param XhtmlElement $o_control
  * @desc Create a container for a form control and its label
  */
 function FormPart($s_label = null, $o_control = null)
 {
     parent::XhtmlElement('div');
     $this->SetCssClass('formPart');
     $this->SetLabel($s_label);
     $this->SetControl($o_control);
     $this->SetIsRequired(false);
     $this->SetIsFieldset(false);
 }
 public function __construct()
 {
     parent::XhtmlElement('ul');
     $this->SetCssClass('az');
     $this->s_page = $_SERVER['REQUEST_URI'];
     $query = strpos($this->s_page, "?");
     if ($query) {
         $this->s_page = substr($this->s_page, 0, $query);
     }
 }
 function ValidationSummary($a_controls_to_validate, $s_header_text = '')
 {
     if (!is_array($a_controls_to_validate)) {
         die('No controls to validate');
     }
     parent::XhtmlElement('div');
     $this->SetCssClass('validationSummary');
     $this->a_controls_to_validate =& $a_controls_to_validate;
     $this->s_header_text = trim($s_header_text);
 }
 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');
     }
 }
 /**
  * Creates a TextBox
  *
  * @param string $s_id
  * @param string $s_value
  * @param bool $page_valid
  * @return TextBox
  */
 function TextBox($s_id, $s_value = '', $page_valid = null)
 {
     # set options assuming <input type="text" />
     parent::XhtmlElement("input");
     $this->SetMode(TextBoxMode::SingleLine());
     $this->SetXhtmlId($s_id);
     if ($page_valid === false and isset($_POST[$this->GetXhtmlId()])) {
         $this->SetText($_POST[$this->GetXhtmlId()]);
     } else {
         $this->SetText($s_value);
     }
 }
 function XhtmlRow($a_values = null)
 {
     parent::XhtmlElement('tr');
     if (is_array($a_values)) {
         foreach ($a_values as $m_value) {
             $this->AddCell($m_value);
         }
     } else {
         if (!is_null($a_values)) {
             throw new Exception('Table row values must be supplied in an array');
         }
     }
     $this->b_is_header = false;
     $this->i_columns = -1;
 }
 /**
  * Control to select a date and, optionally, a time
  *
  * @param XHTML id of the control $s_id
  * @param UNIX timestamp to select by default $i_timestamp
  * @param true if the timestamp's time is valid, otherwise false $b_time_known
  * @param bool $page_valid
  * @return DateControl
  */
 public function DateControl($s_id, $i_timestamp = null, $b_time_known = true, $page_valid = null)
 {
     parent::XhtmlElement('span');
     $this->SetXhtmlId($s_id);
     $this->SetCssClass('dateControl');
     $this->SetTimestamp($i_timestamp, $b_time_known);
     $this->SetMinuteInterval(1);
     $this->b_page_valid = $page_valid;
     $this->month_start = 1;
     $this->month_end = 12;
     $this->year_start = 1997;
     $i_thisyear = (int) gmdate('Y', gmdate('U'));
     $i_nextyear = $i_thisyear + 1;
     $this->year_end = $i_nextyear;
 }
 /**
  * Creates a new RadioButton
  *
  * @param string $s_id
  * @param string $s_group_name
  * @param string $s_label
  * @param string $s_value
  * @param bool $b_checked
  * @param bool $page_valid
  * @return RadioButton
  */
 function RadioButton($s_id, $s_group_name, $s_label, $s_value = '', $b_checked = false, $page_valid = null)
 {
     # this element is the label for the radio button
     parent::XhtmlElement('label');
     $this->AddAttribute('for', $s_id);
     $this->SetCssClass('radioButton');
     # create radio button as child control
     $o_radio = new XhtmlElement('input');
     $o_radio->SetEmpty(true);
     $o_radio->AddAttribute('type', 'radio');
     $o_radio->AddAttribute('value', $s_value);
     $this->a_controls[0] =& $o_radio;
     $this->SetGroupName($s_group_name);
     # wait to set id, because it'll set both controls at once
     $this->SetXhtmlId($s_id);
     # wait to set label so that it comes after radio button
     $this->a_controls[1] = htmlentities($s_label, ENT_QUOTES, "UTF-8", false);
     if ($page_valid === false) {
         $this->b_checked = (isset($_POST[$s_group_name]) and $_POST[$s_group_name] == $s_value);
     } else {
         $this->b_checked = (bool) $b_checked;
     }
 }
 /**
  * A colum group within an XHTML table
  *
  * @param int $i_column_count
  * @return XhtmlColumnGroup
  */
 public function XhtmlColumnGroup($i_column_count = 1)
 {
     parent::XhtmlElement('colgroup');
     $this->SetColumnCount($i_column_count);
 }
 function ClubListControl($a_clubs = null)
 {
     parent::XhtmlElement('ul');
     $this->a_clubs = is_array($a_clubs) ? $a_clubs : array();
 }
 public function __construct($matches = null)
 {
     parent::XhtmlElement('ul');
     $this->SetCssClass("match-list");
     $this->matches = is_array($matches) ? $matches : array();
 }
 public function XhtmlCell($b_is_header = false, $m_content = null)
 {
     $this->b_is_header = (bool) $b_is_header;
     parent::XhtmlElement($this->b_is_header ? 'th' : 'td');
     $this->AddControl($m_content);
 }
 function XhtmlRowGroup($b_is_header = false)
 {
     parent::XhtmlElement($b_is_header ? 'thead' : 'tbody');
 }
 public function XhtmlAnchor($s_text = '', $s_navigate_url = '')
 {
     parent::XhtmlElement('a');
     $this->AddControl($s_text);
     $this->SetNavigateUrl($s_navigate_url);
 }
 /**
  * A column in an XHTML table
  *
  * @return XhtmlColumn
  */
 public function XhtmlColumn()
 {
     parent::XhtmlElement('col');
     $this->SetEmpty(true);
 }
 public function __construct(AuditData $audit, $thing)
 {
     $this->audit = $audit;
     $this->thing = $thing;
     parent::XhtmlElement("p");
 }
 public function __construct(SiteSettings $o_settings, $a_subs)
 {
     parent::XhtmlElement('div');
     $this->o_settings = $o_settings;
     $this->a_subs = $a_subs;
 }
 function GroundListControl($a_grounds = null)
 {
     parent::XhtmlElement('ul');
     $this->a_grounds = is_array($a_grounds) ? $a_grounds : array();
 }
 function AuthenticationControl(SiteSettings $o_settings, User $o_user)
 {
     parent::XhtmlElement('div');
     $this->o_settings = $o_settings;
     $this->o_user = $o_user;
 }