-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
automatic shifts add for waaiberg cantus
- Loading branch information
1 parent
a1e526d
commit 472cf25
Showing
6 changed files
with
255 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
* Handles system admin for calendar. | ||
* | ||
* @author Kristof Mariën <[email protected]> | ||
* @author Pedro Devogelaere <[email protected]> | ||
*/ | ||
class CalendarController extends \CommonBundle\Component\Controller\ActionController\AdminController | ||
{ | ||
|
@@ -85,6 +86,187 @@ public function addAction() | |
); | ||
} | ||
|
||
public function templateAction() | ||
{ | ||
$form = $this->getForm('calendar_event_add'); | ||
$shiftForm = $this->getForm('shift_shift_add'); | ||
|
||
if ($this->getRequest()->isPost()) { | ||
$formData = $this->getRequest()->getPost(); | ||
$form->setData($formData); | ||
|
||
if ($form->isValid()) { | ||
$event = $form->hydrateObject(); | ||
|
||
$this->getEntityManager()->persist($event); | ||
$this->getEntityManager()->flush(); | ||
|
||
$data = array( | ||
'manager' => false, | ||
'unit' => 3, | ||
'event' => $event->getId(), | ||
'location' => 2, | ||
'nb_responsibles' => 0, | ||
'handled_on_event' => false, | ||
'ticket_needed' => false, | ||
'points' => 0, | ||
); | ||
|
||
$startDate = $event->getStartDate()->format('d/m/Y'); | ||
$endDate = $event->getEndDate()->format('d/m/Y'); | ||
|
||
$data['name'] = 'Pispolitie'; | ||
$data['description'] = 'Mensen die naar het toilet willen een strafje geven'; | ||
$data['nb_volunteers'] = 2; | ||
$data['nb_volunteers_min'] = 2; | ||
$data['reward'] = 2; | ||
$data['start_date'] = $startDate . ' 20:30'; | ||
$data['end_date'] = $startDate . ' 22:00'; | ||
|
||
$this->getEntityManager()->persist( | ||
$shiftForm->getHydrator()->hydrate($data) | ||
); | ||
|
||
$data['start_date'] = $startDate . ' 22:15'; | ||
$data['end_date'] = $endDate . ' 00:00'; | ||
|
||
$this->getEntityManager()->persist( | ||
$shiftForm->getHydrator()->hydrate($data) | ||
); | ||
|
||
$data['name'] = 'Controleren QR-code + bandjes uitdelen'; | ||
$data['description'] = 'Controleren QR-code + bandjes uitdelen'; | ||
$data['reward'] = 1; | ||
$data['start_date'] = $startDate . ' 20:00'; | ||
$data['end_date'] = $startDate . ' 20:30'; | ||
|
||
$this->getEntityManager()->persist( | ||
$shiftForm->getHydrator()->hydrate($data) | ||
); | ||
|
||
$data['name'] = 'Stewarden'; | ||
$data['description'] = 'Zorgen dat er niemand luid is buiten en fiksen dat er geen drank buiten geraakt'; | ||
$data['start_date'] = $startDate . ' 22:00'; | ||
$data['end_date'] = $startDate . ' 22:15'; | ||
|
||
$this->getEntityManager()->persist( | ||
$shiftForm->getHydrator()->hydrate($data) | ||
); | ||
|
||
$data['start_date'] = $endDate . ' 00:00'; | ||
$data['end_date'] = $endDate . ' 00:15'; | ||
|
||
$this->getEntityManager()->persist( | ||
$shiftForm->getHydrator()->hydrate($data) | ||
); | ||
|
||
$data['name'] = 'Bijrijden'; | ||
$data['description'] = 'Chille in de kar. Locatie van de loods is: Tervuursevest 238'; | ||
$data['nb_volunteers_min'] = 1; | ||
$data['start_date'] = $startDate . ' 18:00'; | ||
$data['end_date'] = $startDate . ' 19:00'; | ||
|
||
$this->getEntityManager()->persist( | ||
$shiftForm->getHydrator()->hydrate($data) | ||
); | ||
|
||
$data['name'] = 'Corona stilhouden'; | ||
$data['description'] = 'Je mag ze ook buiten gooien als ze niet stil zijn xxx'; | ||
$data['start_date'] = $endDate . ' 00:15'; | ||
$data['end_date'] = $endDate . ' 01:00'; | ||
|
||
$this->getEntityManager()->persist( | ||
$shiftForm->getHydrator()->hydrate($data) | ||
); | ||
|
||
$data['name'] = 'Bandjes controleren'; | ||
$data['description'] = 'Bandjes controleren tijdens de tempus'; | ||
$data['nb_volunteers'] = 1; | ||
$data['start_date'] = $startDate . ' 22:00'; | ||
$data['end_date'] = $startDate . ' 22:15'; | ||
|
||
$this->getEntityManager()->persist( | ||
$shiftForm->getHydrator()->hydrate($data) | ||
); | ||
|
||
$data['start_date'] = $endDate . ' 00:00'; | ||
$data['end_date'] = $endDate . ' 00:15'; | ||
|
||
$this->getEntityManager()->persist( | ||
$shiftForm->getHydrator()->hydrate($data) | ||
); | ||
|
||
$data['name'] = 'Tappen & Rondbrengen'; | ||
$data['description'] = 'Tappen & Rondbrengen'; | ||
$data['nb_volunteers'] = 4; | ||
$data['nb_volunteers_min'] = 3; | ||
$data['reward'] = 2; | ||
$data['start_date'] = $startDate . ' 20:30'; | ||
$data['end_date'] = $startDate . ' 22:00'; | ||
|
||
$this->getEntityManager()->persist( | ||
$shiftForm->getHydrator()->hydrate($data) | ||
); | ||
|
||
$data['start_date'] = $startDate . ' 22:15'; | ||
$data['end_date'] = $endDate . ' 00:00'; | ||
|
||
$this->getEntityManager()->persist( | ||
$shiftForm->getHydrator()->hydrate($data) | ||
); | ||
|
||
$data['start_date'] = $endDate . ' 00:15'; | ||
$data['end_date'] = $endDate . ' 01:00'; | ||
$data['reward'] = 1; | ||
|
||
$this->getEntityManager()->persist( | ||
$shiftForm->getHydrator()->hydrate($data) | ||
); | ||
|
||
$data['name'] = 'Opbouwen'; | ||
$data['description'] = 'Wat tafels en stoelen klaar zetten voor de cantus'; | ||
$data['start_date'] = $startDate . ' 19:00'; | ||
$data['end_date'] = $startDate . ' 20:00'; | ||
|
||
$this->getEntityManager()->persist( | ||
$shiftForm->getHydrator()->hydrate($data) | ||
); | ||
|
||
$data['name'] = 'Afbraak'; | ||
$data['description'] = 'Please help ons mee en zorg dat we na een half uurtje klaar kunnen zijn :))'; | ||
$data['nb_volunteers'] = 5; | ||
$data['start_date'] = $endDate . ' 01:00'; | ||
$data['end_date'] = $endDate . ' 02:00'; | ||
|
||
$this->getEntityManager()->persist( | ||
$shiftForm->getHydrator()->hydrate($data) | ||
); | ||
|
||
$this->getEntityManager()->flush(); | ||
|
||
$this->flashMessenger()->success( | ||
'Success', | ||
'The event and shifts were successfully added!' | ||
); | ||
|
||
$this->redirect()->toRoute( | ||
'calendar_admin_calendar', | ||
array( | ||
'action' => 'manage', | ||
) | ||
); | ||
|
||
return new ViewModel(); | ||
} | ||
} | ||
|
||
return new ViewModel( | ||
array( | ||
'form' => $form, | ||
) | ||
); | ||
} | ||
|
||
public function editAction() | ||
{ | ||
$event = $this->getEventEntity(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
module/CalendarBundle/Resources/views/calendar/admin/calendar/template.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{% extends 'admin/base.twig' %} | ||
|
||
{% block content %} | ||
{% include 'calendar/admin/calendar/partials/navigation.twig' %} | ||
|
||
{% include 'admin/partials/flashMessenger.twig' %} | ||
|
||
<aside> | ||
{% if hasAccess('calendar_admin_calendar', 'add') %} | ||
<div class="sidebox" style="margin-top: 35px"> | ||
<div class="title">Go back</div> | ||
<div class="content"> | ||
<p> | ||
<i>Please hit the link below to go back to the normal add function!</i> | ||
</p> | ||
<p> | ||
<a href="{{ url('calendar_admin_calendar', {"action": "add"}) }}">→ Add</a> | ||
</p> | ||
</div> | ||
</div> | ||
{% endif %} | ||
</aside> | ||
|
||
<div id="controller_action"> | ||
{% import 'admin/partials/form.twig' as forms %} | ||
{{ forms.renderForm(form) }} | ||
</div> | ||
{% endblock %} | ||
|
||
{% block content_script %} | ||
<script type="text/javascript"> | ||
$(document).ready(function () { | ||
$('#languages a:first').click(); | ||
}); | ||
$(document).ready(function () { | ||
$('textarea').gollum({ | ||
toolbar: { | ||
"bold": ["bold", "Bold", "bold"], | ||
"italic": ["italic", "Italic", "italic"], | ||
"divider": "-", | ||
"link": ["link", "Link", "link"], | ||
"divider": "-", | ||
"ul": ["ul", "Unordered List", "u-list"], | ||
"ol": ["ol", "Ordered List", "o-list"], | ||
"blockquote": ["blockquote", "Blockquote", "quotemark"], | ||
"hr": ["hr", "Horizontal Rule", "horizontal-rule"], | ||
"divider": "-", | ||
"help": ["help", "Help", "help"], | ||
}, | ||
}); | ||
}); | ||
</script> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters