Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature add page break #91

Open
wants to merge 7 commits into
base: line-timetable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Controller/AbstractController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;

abstract class AbstractController extends Controller
{
Expand All @@ -14,6 +16,17 @@ protected function isGranted($businessId, $object = null)
}
}

/**
* Checking the request is POST ajax
*
* @param Request $request
*/
protected function isPostAjax(Request $request)
{
if (!($request->isXmlHttpRequest() && $request->isMethod('POST')))
throw new AccessDeniedException();
}

protected function addFlashIfSeasonLocked($season)
{
$isLocked = (!empty($season) && $season->isLocked());
Expand Down Expand Up @@ -50,4 +63,19 @@ protected function addFlashMessage($type, $message, $parameters = array())
)
);
}

/**
* Preparing a JsonResponse
*
* @param array $data
* @param integer $statusCode
*/
protected function prepareJsonResponse($data = array(), $statusCode = JsonResponse::HTTP_STATUS_OK)
{
$response = new JsonResponse();
$response->setData($data);
$response->setStatusCode($statusCode);

return $response;
}
}
Loading