Skip to content

Commit

Permalink
Create getDaysOfWeekArray method
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Aug 4, 2023
1 parent 69eaa01 commit ff25192
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/Resources/views/admin/period/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,14 @@
<table>
<thead>
<tr>
{% for key,day in days_of_week %}
{% for key,day in period_service.getDaysOfWeekArray() %}
<th>{{ day }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
<tr>
{% for key,day in days_of_week %}
{% for key,day in period_service.getDaysOfWeekArray() %}
<td>
{% for period in periods_by_day[key] %}
{% if ((filling_filter == null) and (beneficiary_filter == null))
Expand Down
4 changes: 2 additions & 2 deletions app/Resources/views/period/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ It display a page with all the avaible periods (a.k.a the "Semaine type")
<table>
<thead>
<tr>
{% for key,day in days_of_week %}
{% for key,day in period_service.getDaysOfWeekArray() %}
<th>{{ day }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
<tr>
{% for key,day in days_of_week %}
{% for key,day in period_service.getDaysOfWeekArray() %}
<td>
{% for period in periods_by_day[key] %}
{% if (filling_filter == null)
Expand Down
1 change: 0 additions & 1 deletion src/AppBundle/Controller/AdminPeriodController.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public function indexAction(Request $request, PeriodFormHelper $formHelper)
}

return $this->render('admin/period/index.html.twig', array(
'days_of_week' => Period::DAYS_OF_WEEK,
'periods_by_day' => $periodsByDay,
'filter_form' => $form->createView(),
'week_filter' => $week_filter,
Expand Down
1 change: 0 additions & 1 deletion src/AppBundle/Controller/PeriodController.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public function indexAction(Request $request, PeriodFormHelper $formHelper)
}

return $this->render('period/index.html.twig', array(
'days_of_week' => Period::DAYS_OF_WEEK,
'periods_by_day' => $periodsByDay,
'filter_form' => $form->createView(),
'week_filter' => $week_filter,
Expand Down
1 change: 1 addition & 0 deletions src/AppBundle/Entity/Period.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Period
{
const DAYS_OF_WEEK = ["Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"];
const DAYS_OF_WEEK_LIST_WITH_INT = ["Lundi" => 0, "Mardi" => 1, "Mercredi" => 2, "Jeudi" => 3, "Vendredi" => 4, "Samedi" => 5, "Dimanche" => 6];
const WEEK_CYCLE = ["A", "B", "C", "D"];

/**
* @var int
Expand Down
9 changes: 8 additions & 1 deletion src/AppBundle/Service/PeriodService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@

namespace AppBundle\Service;

use AppBundle\Entity\Period;

class PeriodService
{
public function __construct()
{
}

public function getDaysOfWeekArray()
{
return Period::DAYS_OF_WEEK;
}

public function getWeekCycleArray()
{
return ["A", "B", "C", "D"];
return Period::WEEK_CYCLE;
}
}

0 comments on commit ff25192

Please sign in to comment.