예제 #1
0
 public function __invoke(League $tournament, LeaguePeriod $period)
 {
     $html = '<ul class="pager">';
     $html .= '<li class="previous ' . ($period->hasPrevious() ? '' : 'disabled') . '">';
     $html .= '<a href="' . ($period->hasPrevious() ? $this->getUrl($tournament, $period->getPrevious()) : '#') . '">&larr; Older</a>';
     $html .= '</li>';
     $html .= '<li class="next ' . ($period->inCurrentMonth() ? 'disabled' : '') . '">';
     $html .= '<a href="' . ($period->inCurrentMonth() ? '#' : $this->getUrl($tournament, $period->getNext())) . '">Newer &rarr;</a>';
     $html .= '</li>';
     $html .= '</ul>';
     return $html;
 }
예제 #2
0
파일: Match.php 프로젝트: 0ida/fussi
 /**
  * @param LeaguePeriod  $period
  * @param League    $tournament
  * @param SingleMatch[] $matches
  * @param Player        $player1
  * @param Player        $player2
  *
  * @return string
  */
 public function __invoke(LeaguePeriod $period, League $tournament, array $matches, Player $player1, Player $player2)
 {
     $allow = $period->inCurrentMonth();
     $out = '';
     if ($player1 != $player2) {
         $ok = false;
         foreach ($matches as $match) {
             $url = $this->getView()->url('match/edit', array('mid' => $match->getId()));
             if ($match->isPlayedBy($player1, $player2)) {
                 $title = $player1->getName() . " vs. " . $player2->getName();
                 $results = array();
                 $counter = 1;
                 foreach ($match->getGames() as $game) {
                     $results[] = "Game " . $counter . ": " . $game->getGoalsTeamOne() . ' / ' . $game->getGoalsTeamTwo();
                     $counter++;
                 }
                 $content = implode("<br>", $results);
                 if ($allow) {
                     $content .= "<br><br><a href='" . $url . "' class='btn btn-small'>Edit</a>";
                 }
                 $out .= '<span title="' . $title . '" data-content="' . $content . '" class="match btn result">';
                 $out .= $match->getScore();
                 $out .= '</span>';
                 $ok = true;
             }
         }
         if (!$ok && $allow) {
             $url = $this->getView()->url('match/new', array('tid' => $tournament->getId(), 'player1' => $player1->getId(), 'player2' => $player2->getId()));
             $out .= '<a href="' . $url . '" class="btn btn-small">Edit</a>';
         }
     }
     return $out;
 }