/** * Generates the XHTML for the control * * @return string */ public function __toString() { $s_xhtml = parent::__toString(); if ($this->o_season->PointsAdjustments()->GetCount()) { $s_xhtml .= '<p>The results table includes the following points adjustments:</p><ul>'; $this->o_season->PointsAdjustments()->SortByProperty('GetDate'); foreach ($this->o_season->PointsAdjustments() as $o_point) { /* @var $o_point PointsAdjustment */ # Convert sign to positive the non-maths way $i_positive_points = (int) str_replace('-', '', $o_point->GetPoints()); $s_points = $i_positive_points > 1 ? ' points' : ' point'; $s_reason = $o_point->GetReason() ? ' for ' . $o_point->GetReason() : ''; # Display a message about each adjustment if ($o_point->GetPoints() > 0) { $s_xhtml .= '<li>' . htmlentities($i_positive_points . $s_points . ' awarded to ' . $o_point->GetTeam()->GetName() . $s_reason, ENT_QUOTES, "UTF-8", false) . '</li>'; } elseif ($o_point->GetPoints() < 0) { $s_xhtml .= '<li>' . htmlentities($i_positive_points . $s_points . ' deducted from ' . $o_point->GetTeam()->GetName() . $s_reason, ENT_QUOTES, "UTF-8", false) . '</li>'; } } $s_xhtml .= '</ul>'; } if (count($this->a_results_missing)) { $s_xhtml .= '<p class="resultPending">Waiting for results from:</p><ul class="resultPending"><li>' . implode('</li><li>', $this->a_results_missing) . '</li></ul>'; } return $s_xhtml; }