Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed subscriptions action

  • Loading branch information...
commit 808dc6b9269a469070f83b3bf7f7ad12a092b2b8 1 parent 2b70f31
@dutow authored
View
12 Controller/UserController.php
@@ -258,16 +258,18 @@ public function profileAction($term)
public function subscriptionsAction($term)
{
$tpRep = $this->getDoctrine()->getRepository('\EotvosVersenyrBundle:TextPage');
- $pageRec = $tpRep->getForTermWithSpecial($term, 'special');
$term = $this->getDoctrine()
->getRepository('EotvosVersenyrBundle:Term')
->findOneByName($term)
;
+
if (!$term) {
throw $this->createNotFoundException('Term not found');
}
+ $pageRec = $tpRep->getForTermWithSpecial($term->getName(), 'register');
+
// TODO: not logged in
// TODO: move tu user controller
if (!$pageRec) {
@@ -275,12 +277,18 @@ public function subscriptionsAction($term)
}
$secRep = $this->getDoctrine()->getRepository('\EotvosVersenyrBundle:Section');
- $sections = $secRep->getForTerm($term);
+ $sections = $secRep->getForTerm($term->getName());
+
+ $sec = $this->get('security.context');
+ $curruser = $sec->getToken()->getUser();
+
+ $registration = $curruser->getRegistrationForTerm($term);
return array(
'page' => $pageRec,
'sections' => $sections,
'term' => $term,
+ 'registration' => $registration,
);
}
View
8 Resources/views/User/subscriptions.html.twig
@@ -15,13 +15,13 @@
</thead>
<tbody>
{% for item in sections %}
- <tr class="{% if app.user.hasSection(item) %}st_subscribed{% else %}{% if app.user.mayJoin(item) %}st_joinable{% else %}st_disabled{% endif %}{% endif %}" id="section_{{ item.page.slug }}">
+ <tr class="{% if registration.hasSection(item) %}st_subscribed{% else %}{% if app.user.mayJoin(item) %}st_joinable{% else %}st_disabled{% endif %}{% endif %}" id="section_{{ item.page.slug }}">
<td><a href="{{ item | ecvurl }}">{{ item.page.title }}</a></td>
<td>
- {% if app.user.hasSection(item) %}
+ {% if registration.hasSection(item) %}
jelentkezve
{% else %}
- {% if app.user.mayJoin(item) %}
+ {% if registration.mayJoin(item) %}
<a href="{{ url('competition_subscribe', { 'term' : term.getName(), 'section' : item.page.slug } ) }}">jelentkezés</a>
{% else %}
-
@@ -29,7 +29,7 @@
{% endif %}
</td>
<td>{{ item.registrationUntil|date("Y. m. d.") }}</td>
- <td>{% if item.nextRound is not null %}{{ item.nextRound.start|date("Y. m. d. H:i:s") }}{% else %}-{% endif %}</td>
+ <td>{% if item.nextRound is not null %}{{ item.nextRound.start|date("Y. m. d. H:i") }}{% else %}-{% endif %}</td>
</tr>
{% endfor %}
</tbody>
Please sign in to comment.
Something went wrong with that request. Please try again.