Skip to content

Commit

Permalink
running full php fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
famoser committed Dec 24, 2017
1 parent 46e5d58 commit 36104f5
Show file tree
Hide file tree
Showing 185 changed files with 4,383 additions and 3,149 deletions.
4 changes: 2 additions & 2 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

$fileHeaderComment = <<<COMMENT
This file is part of the Symfony package.
This file is part of the nodika project.
(c) Fabien Potencier <fabien@symfony.com>
(c) Florian Moser <git@famoser.ch>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
Expand Down
9 changes: 9 additions & 0 deletions public/index.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the nodika project.
*
* (c) Florian Moser <git@famoser.ch>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

use App\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;
Expand Down
352 changes: 192 additions & 160 deletions src/Controller/AccessController.php

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<?php
/**
* Created by PhpStorm.
* User: famoser
* Date: 19/05/2017
* Time: 19:08

/*
* This file is part of the nodika project.
*
* (c) Florian Moser <git@famoser.ch>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace App\Controller\Administration\Organisation\EventLine;
Expand Down Expand Up @@ -31,9 +34,11 @@ class EventController extends BaseController
{
/**
* @Route("/new", name="administration_organisation_event_line_event_new")
* @param Request $request
*
* @param Request $request
* @param Organisation $organisation
* @param EventLine $eventLine
* @param EventLine $eventLine
*
* @return Response
*/
public function newAction(Request $request, Organisation $organisation, EventLine $eventLine)
Expand All @@ -49,142 +54,154 @@ public function newAction(Request $request, Organisation $organisation, EventLin
function ($form, $entity) use ($organisation, $eventLine) {
/* @var Form $form */
/* @var Event $entity */
$myService = $this->get("app.event_past_evaluation_service");
$myService = $this->get('app.event_past_evaluation_service');
$eventPast = $myService->createEventPast($this->getPerson(), null, $entity, EventChangeType::MANUALLY_CREATED_BY_ADMIN);
$this->fastSave($eventPast);
return $this->redirectToRoute("administration_organisation_event_line_event_new", ["organisation" => $organisation->getId(), "eventLine" => $eventLine->getId()]);

return $this->redirectToRoute('administration_organisation_event_line_event_new', ['organisation' => $organisation->getId(), 'eventLine' => $eventLine->getId()]);
},
["organisation" => $organisation]
['organisation' => $organisation]
);

if ($myForm instanceof Response) {
return $myForm;
}

$arr["organisation"] = $organisation;
$arr["eventLine"] = $eventLine;
$arr["new_form"] = $myForm->createView();
$arr['organisation'] = $organisation;
$arr['eventLine'] = $eventLine;
$arr['new_form'] = $myForm->createView();

return $this->renderWithBackUrl(
'administration/organisation/event_line/event/new.html.twig',
$arr,
$this->generateUrl("administration_organisation_event_line_administer", ["organisation" => $organisation->getId(), "eventLine" => $eventLine->getId()])
$this->generateUrl('administration_organisation_event_line_administer', ['organisation' => $organisation->getId(), 'eventLine' => $eventLine->getId()])
);
}

/**
* @Route("/{event}/edit", name="administration_organisation_event_line_event_edit")
* @param Request $request
*
* @param Request $request
* @param Organisation $organisation
* @param EventLine $eventLine
* @param Event $event
* @param EventLine $eventLine
* @param Event $event
*
* @return Response
*/
public function editAction(Request $request, Organisation $organisation, EventLine $eventLine, Event $event)
{
$this->denyAccessUnlessGranted(EventVoter::EDIT, $event);

$oldEvent = clone($event);
$oldEvent = clone $event;
$myForm = $this->handleCrudForm(
$request,
$event,
SubmitButtonType::EDIT,
function ($form, $entity) use ($organisation, $eventLine, $oldEvent) {
/* @var Form $form */
/* @var Event $entity */
$myService = $this->get("app.event_past_evaluation_service");
$myService = $this->get('app.event_past_evaluation_service');
$eventPast = $myService->createEventPast($this->getPerson(), $oldEvent, $entity, EventChangeType::MANUALLY_CHANGED_BY_ADMIN);
$this->fastSave($eventPast);
return $this->redirectToRoute("administration_organisation_event_line_administer", ["organisation" => $organisation->getId(), "eventLine" => $eventLine->getId()]);

return $this->redirectToRoute('administration_organisation_event_line_administer', ['organisation' => $organisation->getId(), 'eventLine' => $eventLine->getId()]);
},
["organisation" => $organisation]
['organisation' => $organisation]
);

if ($myForm instanceof Response) {
return $myForm;
}

$arr["organisation"] = $organisation;
$arr["eventLine"] = $eventLine;
$arr["event"] = $event;
$arr["edit_form"] = $myForm->createView();
$arr['organisation'] = $organisation;
$arr['eventLine'] = $eventLine;
$arr['event'] = $event;
$arr['edit_form'] = $myForm->createView();

return $this->renderWithBackUrl(
'administration/organisation/event_line/event/edit.html.twig',
$arr,
$this->generateUrl("administration_organisation_event_line_event_view", ["organisation" => $organisation->getId(), "eventLine" => $eventLine->getId(), "event" => $event->getId()])
$this->generateUrl('administration_organisation_event_line_event_view', ['organisation' => $organisation->getId(), 'eventLine' => $eventLine->getId(), 'event' => $event->getId()])
);
}

/**
* @Route("/{event}/remove", name="administration_organisation_event_line_event_remove")
* @param Request $request
*
* @param Request $request
* @param Organisation $organisation
* @param EventLine $eventLine
* @param Event $event
* @param EventLine $eventLine
* @param Event $event
*
* @return Response
*/
public function removeAction(Request $request, Organisation $organisation, EventLine $eventLine, Event $event)
{
$this->denyAccessUnlessGranted(EventVoter::REMOVE, $event);

$oldEvent = clone($event);
$oldEvent = clone $event;
$myForm = $this->handleCrudForm(
$request,
$event,
SubmitButtonType::REMOVE,
function ($form, $entity) use ($organisation, $eventLine, $oldEvent) {
/* @var Form $form */
/* @var Event $entity */
$myService = $this->get("app.event_past_evaluation_service");
$myService = $this->get('app.event_past_evaluation_service');
$eventPast = $myService->createEventPast($this->getPerson(), $oldEvent, $entity, EventChangeType::MANUALLY_REMOVED_BY_ADMIN);
$this->fastSave($eventPast);
return $this->redirectToRoute("administration_organisation_event_line_administer", ["organisation" => $organisation->getId(), "eventLine" => $eventLine->getId()]);

return $this->redirectToRoute('administration_organisation_event_line_administer', ['organisation' => $organisation->getId(), 'eventLine' => $eventLine->getId()]);
}
);

if ($myForm instanceof Response) {
return $myForm;
}

$arr["organisation"] = $organisation;
$arr["eventLine"] = $eventLine;
$arr["event"] = $event;
$arr["remove_form"] = $myForm->createView();
$arr['organisation'] = $organisation;
$arr['eventLine'] = $eventLine;
$arr['event'] = $event;
$arr['remove_form'] = $myForm->createView();

return $this->renderWithBackUrl(
'administration/organisation/event_line/event/remove.html.twig',
$arr,
$this->generateUrl("administration_organisation_event_line_event_view", ["organisation" => $organisation->getId(), "eventLine" => $eventLine->getId(), "event" => $event->getId()])
$this->generateUrl('administration_organisation_event_line_event_view', ['organisation' => $organisation->getId(), 'eventLine' => $eventLine->getId(), 'event' => $event->getId()])
);
}

/**
* @Route("/{event}/view", name="administration_organisation_event_line_event_view")
* @param Request $request
*
* @param Request $request
* @param Organisation $organisation
* @param EventLine $eventLine
* @param Event $event
* @param EventLine $eventLine
* @param Event $event
*
* @return Response
*/
public function viewAction(Request $request, Organisation $organisation, EventLine $eventLine, Event $event)
{
$this->denyAccessUnlessGranted(EventVoter::VIEW, $event);

$arr["organisation"] = $organisation;
$arr["eventLine"] = $eventLine;
$arr["event"] = $event;
$arr['organisation'] = $organisation;
$arr['eventLine'] = $eventLine;
$arr['event'] = $event;

$pasts = $event->getEventPast();
$eventPastService = $this->get("app.event_past_evaluation_service");
$eventPastService = $this->get('app.event_past_evaluation_service');
/* @var EventPastEvaluation[] $displayPasts */
$displayPasts = [];
foreach ($pasts as $past) {
$displayPasts[] = $eventPastService->createEventPastEvaluation($past);
}
$arr["eventPasts"] = $displayPasts;
$arr['eventPasts'] = $displayPasts;

return $this->renderWithBackUrl(
'administration/organisation/event_line/event/view.html.twig',
$arr,
$this->generateUrl("administration_organisation_event_line_administer", ["organisation" => $organisation->getId(), "eventLine" => $eventLine->getId()])
$this->generateUrl('administration_organisation_event_line_administer', ['organisation' => $organisation->getId(), 'eventLine' => $eventLine->getId()])
);
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

/**
* Created by PhpStorm.
* User: famoser
* Date: 19/05/2017
* Time: 19:08
/*
* This file is part of the nodika project.
*
* (c) Florian Moser <git@famoser.ch>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace App\Controller\Administration\Organisation\EventLine\Generate\Base;
Expand All @@ -21,6 +23,7 @@ class BaseGenerationController extends BaseController
{
/**
* @param EventLineGeneration $generation
*
* @return GenerationResult
*/
protected function getGenerationResult(EventLineGeneration $generation)
Expand All @@ -29,21 +32,20 @@ protected function getGenerationResult(EventLineGeneration $generation)
}

/**
* @param BaseConfiguration $configuration
* @param Organisation $organisation
* @param BaseConfiguration $configuration
* @param Organisation $organisation
* @param EventLineGeneration $eventLineGeneration
*/
protected function addEventLineConfiguration(BaseConfiguration $configuration, Organisation $organisation, EventLineGeneration $eventLineGeneration)
{
/* @var EventLine[] $eventLineById */
$eventLineById = [];
foreach ($organisation->getEventLines() as $eventLine) {
if ($eventLine->getId() != $eventLineGeneration->getEventLine()->getId()) {
if ($eventLine->getId() !== $eventLineGeneration->getEventLine()->getId()) {
$eventLineById[$eventLine->getId()] = $eventLine;
}
}


$removeKeys = [];
foreach ($configuration->eventLineConfiguration as $key => $value) {
if (isset($eventLineById[$value->id])) {
Expand All @@ -69,7 +71,7 @@ protected function addEventLineConfiguration(BaseConfiguration $configuration, O
//add events if applicable
foreach ($configuration->eventLineConfiguration as $item) {
if ($item->isEnabled && !$item->eventsSet) {
if (count($eventLineById) == 0) {
if (0 === count($eventLineById)) {
//cache event lines again
foreach ($organisation->getEventLines() as $eventLine) {
$eventLineById[$eventLine->getId()] = $eventLine;
Expand Down
Loading

0 comments on commit 36104f5

Please sign in to comment.