Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Update: MatchCenter, Match, Competition detail, My matches
  • Loading branch information
bert.beeckman committed Jan 11, 2013
1 parent b4d6320 commit 5c71410
Show file tree
Hide file tree
Showing 10 changed files with 249 additions and 72 deletions.
3 changes: 1 addition & 2 deletions www/app/Resources/views/base.html.twig
Expand Up @@ -38,8 +38,7 @@
<ul class="nav">
<li {% if active_page == "home" %} class="active"{% endif %}><a href="{{ path('homepage') }}">Home</a></li>
<li {% if active_page == "competition" %} class="active"{% endif %}><a href="{{ path('competition') }}">Competities</a></li>
<li {% if active_page == "leagues" %} class="active"{% endif %}><a href="">Wedstrijden</a></li>
<li {% if active_page == "matchcenter" %} class="active"{% endif %}><a href="">MatchCenter</a></li>
<li {% if active_page == "matchcenter" %} class="active"{% endif %}><a href="{{ path('matchcenter') }}">MatchCenter</a></li>

{% if is_granted('IS_AUTHENTICATED_FULLY') %}
{% render "MatchTrackerUserBundle:Menu:userMenuDropdown" %}
Expand Down
Expand Up @@ -36,17 +36,29 @@ public function indexAction($sport) {
* @param $name
* @return \Symfony\Component\HttpFoundation\Response
*/
public function detailAction($nameCanonical) {
public function detailAction($nameCanonical, $option) {

$league = $this->getDoctrine()
->getRepository('MatchTrackerAppBundle:Leagues')
->findOneBy(array('nameCanonical' => $nameCanonical));

$standing = $league->getStandings();

$matches = $this->getDoctrine()
->getRepository('MatchTrackerAppBundle:Matches')
->findBy(
array('leagues' => $league),
array('date' => 'ASC')
)
;

return $this->render('MatchTrackerAppBundle:Competition:detail.html.twig',
array('league' => $league,
'standings' => $standing));
array(
'league' => $league,
'standings' => $standing,
'option' => $option,
'matches' => $matches
));
}

}
Expand Up @@ -227,7 +227,7 @@ public function matchesAction() {
$matches = $this->getDoctrine()
->getRepository('MatchTrackerAppBundle:Matches')
->findBy(
array('leagues' => $leagues),
array('leagues' => $leagues, 'finished'),
array('date' => 'ASC')
)
;
Expand Down
Expand Up @@ -6,10 +6,28 @@

class MatchCenterController extends Controller {

public function indexAction() {
return $this->render('MatchTrackerAppBundle:MatchCenter:index.html.twig');
/**
* Matchecenter: overview
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function indexAction() {
$matches = $this->getDoctrine()
->getRepository('MatchTrackerAppBundle:Matches')
->findBy(array('finished' => '0'),array('date' => 'ASC', 'startTime' => 'ASC'))
;

return $this->render('MatchTrackerAppBundle:MatchCenter:index.html.twig',
array('matches' => $matches));
}


/**
* Matchcenter: detail
*
* @param $id
* @return \Symfony\Component\HttpFoundation\Response
*/
public function detailAction($id) {
// fetch the competitions related to the user
$match = $this->getDoctrine()
Expand All @@ -27,4 +45,43 @@ public function detailAction($id) {
)
);
}

public function reportAction($id, $request) {
// fetch the competitions related to the user
/*
$match = $this->getDoctrine()
->getRepository('MatchTrackerAppBundle:Matches')
->find($id);
$MatchEvents = $this->getDoctrine()
->getRepository('MatchTrackerAppBundle:MatchesHasMatchEvents')
->findBy(array('matches' => $id), array('time' => 'desc'));
$builder = $this->createFormBuilder($MatchEvents);
$form = $builder->add('event', 'collection', array(
'label' => 'Events',
'label_attr' => array('class' => 'control-label'),
'type' => new TeamsType(),
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false
))->getForm();
if ($request->isMethod('POST')) {
$form->bind($request);
if ($form->isValid()) {
}
}
return $this->render('MatchTrackerAppBundle:MatchCenter:report.html.twig',
array(
'form' => $form
)
);*/
}
}
27 changes: 20 additions & 7 deletions www/src/MatchTracker/Bundle/AppBundle/Resources/config/routing.yml
Expand Up @@ -57,13 +57,20 @@ competition:
parent: "homepage"
label: "Competities"

competition_show_option:
pattern: /competities/detail/{nameCanonical}/{option}
defaults:
_controller: MatchTrackerAppBundle:Competition:detail
parent: "competition"
label: "Detail"

competition_show:
pattern: /competities/detail/{nameCanonical}
defaults:
_controller: MatchTrackerAppBundle:Competition:detail
parent: "competition"
label: "Detail"

option: "info"

# Dashboard and subpages
dashboard:
Expand Down Expand Up @@ -93,7 +100,7 @@ mycompetitions_teams:
parent: "mycompetitions"
label: "Teams"

<<<<<<< HEAD

matchSchedule_maker:
pattern: /dashboard/mijncompetities/{nameCanonical}/schedule
defaults:
Expand All @@ -102,14 +109,13 @@ matchSchedule_maker:
label: "schedule"


=======
mymatches:
pattern: /dashboard/mijnwedstrijden
defaults:
_controller: MatchTrackerAppBundle:Dashboard:matches
parent: "dashboard"
label: "Mijn wedstrijden"
>>>>>>> b5cef36414afc266c15c931856e6ae1fc49fce87


# Team page and editor
team:
Expand All @@ -134,9 +140,16 @@ matchcenter:
parent: "homepage"
label: "Matchcenter"

matchcenter:
matchcenter_detail:
pattern: /matchcenter/{id}
defaults:
_controller: MatchTrackerAppBundle:MatchCenter:detail
parent: "homepage"
label: "Matchcenter"
parent: "matchcenter"
label: "Detail"

matchcenter_report:
pattern: /matchcenter/{id}/verslag
defaults:
_controller: MatchTrackerAppBundle:MatchCenter:report
parent: "Matchcenter"
label: "Live verslag geven"
Expand Up @@ -8,9 +8,95 @@

{% block body %}
<div class="container">
<nav id="breadcrumbs">U bevindt zich hier: {{ xi_breadcrumbs() }} >> {{ league.name }}</nav>
<nav id="breadcrumbs">U bevindt zich hier: {{ xi_breadcrumbs() }}</nav>

<h1>{{ league.name }}</h1>

<ul class="nav nav-tabs">
<li {% if option == "info" %} class="active" {% endif %}>
<a href="{{ path('competition_show_option', { 'nameCanonical' : league.nameCanonical, 'option' : 'info' }) }}">Info</a>
</li>
<li {% if option == "klassement" %} class="active" {% endif %}>
<a href="{{ path('competition_show_option', { 'nameCanonical' : league.nameCanonical, 'option' : 'klassement' }) }}">Klassement</a>
</li>
<li{% if option == "wedstrijdschema" %} class="active" {% endif %}>
<a href="{{ path('competition_show_option', { 'nameCanonical' : league.nameCanonical, 'option' : 'wedstrijdschema' }) }}">Wedstrijden</a>
</li>
</ul>

{% if option == "klassement" %}
<div class="row-fluid">
<div class="span6">
<article id="standing">
{% for standing in standings %}
<h2>{{ standing.name }}</h2>
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>Team</th>
<th>W</th>
<th>G</th>
<th>V</th>
<th>P</th>
</tr>
</thead>
<tbody>
{% for statistic in standing.getSortedStatistics %}
<tr>
<td>{{ statistic.position }}</td>
<td>{{ statistic.teams.getName }}</td>
<td>{{ statistic.wins }}</td>
<td>{{ statistic.draws }}</td>
<td>{{ statistic.losses }}</td>
<td>{{ statistic.points }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endfor %}
</article>
</div>
</div>
</div>


{% elseif option == "wedstrijdschema" %}

<div class="row-fluid">
<div class="span6">

<table class="table table-striped">
<thead>
<tr>
<th>Datum</th>
<th>Wedstrijd</th>
<th>Score</th>
<th></th>
</tr>
</thead>

<tbody>
{% for match in matches %}
<tr>
<td>{{ match.date|date('d-m-Y') }} {{ match.startTime|date('H:i') }}</td>
<td><a href="{{ path('matchcenter_detail', { 'id' : match.id }) }}">{{ match.homeTeam.name }} - {{ match.awayTeam.name }}</a></td>
<td>{% if match.homeScore is null and match.awayScore is null %}
... - ...
{% else %}
{{ match.homeScore }} - {{ match.awayScore }}
{% endif %}
</td>
<td>{% if match.active == 1 %}Live!{% endif %}</td>
</tr>
{% endfor %}
</tbody>

</table>
</div>
</div>
{% else %}

<ul id="competitionInfo">
<li>Type: {{ league.sportTypes.name }}</li>
<li>Beheerder: {{ league.user.firstname }} {{ league.user.lastname }}</li>
Expand All @@ -24,45 +110,7 @@
<h3>Omschrijving:</h3>
{{ league.description }}

<article id="standing">

{% for standing in standings %}
<h2>{{ standing.name }}</h2>
<table class="table table-bordered">
<thead>
<tr>
<th>#</th>
<th>Team</th>
<th>W</th>
<th>G</th>
<th>V</th>
<th>P</th>
</tr>
</thead>
<tbody>
{% for statistic in standing.getSortedStatistics %}
<tr>
<td>{{ statistic.position }}</td>
<td>{{ statistic.teams.getName }}</td>
<td>{{ statistic.wins }}</td>
<td>{{ statistic.draws }}</td>
<td>{{ statistic.losses }}</td>
<td>{{ statistic.points }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endfor %}
</article>

<article id="previousMatches">
<h3>Laatst gespeelde wedstrijden</h3>
</article>

<article id="nextMatches">
<h3>Volgende wedstrijden</h3>
</article>

{% endif %}
</div>
{% endblock %}

Expand Down
Expand Up @@ -12,7 +12,7 @@
<h1>Mijn wedstrijden</h1>

<div class="row-fluid">
<div class="span6">
<div class="span7">
{% if matches != null %}
<table class="table table-striped">

Expand All @@ -21,16 +21,18 @@
<th>Wedstrijd</th>
<th>Datum</th>
<th>Competitie</th>
<th></th>
</tr>
</thead>
<tbody>

{% for match in matches %}
<tr>
<td><a href="#">{{ match.homeTeam.name }} - {{ match.awayTeam.name }}</a></td>
<td><a href="{{ path('matchcenter_detail', { 'id' : match.id }) }}">{{ match.homeTeam.name }} - {{ match.awayTeam.name }}</a></td>
<td>{{ match.date|date('d-m-Y') }}</td>
<td><a href="{{ path('competition_show', { 'nameCanonical' : match.leagues.nameCanonical }) }}">{{ match.leagues.name}}</a></td>
</tr>
<td>{% if match.active == 1 %}Live!{% endif %}</td>
</tr>
{% endfor %}
</tbody>

Expand Down
Expand Up @@ -29,10 +29,10 @@
</div>

Status:
{% if match.finished %}
{% if match.finished == 1 %}
EINDE
{% else %}
{% if match.active %}
{% if match.active == 1 %}
BEZIG
{% else %}
{{ match.date|date('d/m') }}
Expand Down

0 comments on commit 5c71410

Please sign in to comment.