Skip to content

Commit

Permalink
Merge pull request #21 from Emmedy/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
nieck authored Sep 25, 2023
2 parents e8542c1 + 6e329c3 commit f887ec4
Show file tree
Hide file tree
Showing 20 changed files with 233 additions and 229 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: CI

on: [push]

jobs:
build-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
- uses: php-actions/phpstan@v3
with:
memory_limit: -1
34 changes: 0 additions & 34 deletions Command/CleanUpFilesCommand.php

This file was deleted.

17 changes: 14 additions & 3 deletions Command/H5pBundleCleanUpFilesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,26 @@

namespace Emmedy\H5PBundle\Command;

use Emmedy\H5PBundle\Core\H5POptions;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

class H5pBundleCleanUpFilesCommand extends Command
{

/**
* @var H5POptions $h5POptions
*/
private $h5POptions;

public function __construct(H5POptions $h5POptions)
{
$this->h5POptions = $h5POptions;
parent::__construct();
}

protected static $defaultName = 'h5p-bundle:cleanup-files';
protected function configure()
{
Expand All @@ -31,7 +42,7 @@ private function cleanupFiles(InputInterface $input)
{
$location = $input->getArgument('location');
if (!$location) {
$location = $this->get('emmedy_h5p.options')->getAbsoluteH5PPath() . '/editor';
$location = $this->h5POptions->getAbsoluteH5PPath() . '/editor';
}
\H5PCore::deleteFileTree($location);
}
Expand Down
46 changes: 0 additions & 46 deletions Command/IncludeAssetsCommand.php

This file was deleted.

18 changes: 5 additions & 13 deletions Controller/H5PAJAXController.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,9 @@ public function TranslationsCallback(Request $request)
/**
* Callback Install library from external file
*
* @param string $token Security token
* @param int $content_id Id of content
* @param string $machine_name Machine name of library
* @param Request $request
*
* @return JsonResponse
* @Route("/library-install/")
*/
public function libraryInstallCallback(Request $request)
Expand All @@ -121,11 +119,8 @@ public function libraryInstallCallback(Request $request)
/**
* Callback that returns data for a given library
*
* @param string $machine_name Machine name of library
* @param int $major_version Major version of library
* @param int $minor_version Minor version of library
* @param string $locale Language of your website and plugins for default is English (EN)
* @param Request $request
* @return JsonResponse
*/
private function libraryCallback(Request $request)
{
Expand Down Expand Up @@ -158,10 +153,9 @@ private function libraryCallback(Request $request)
/**
* Callback for uploading a library
*
* @param string $token Editor security token
* @param int $content_id Id of content that is being edited
* @param Request $request
*
* @return JsonResponse
* @throws Exception
* @Route("/library-upload/")
*/
Expand Down Expand Up @@ -194,9 +188,8 @@ public function libraryUploadCallback(Request $request)
/**
* Callback for file uploads.
*
* @param string $token SecuritlibraryCallbacky token
* @param int $content_id Content id
* @param Request $request
* @return JsonResponse
* @Route("/files/")
*/
public function filesCallback(Request $request)
Expand All @@ -220,9 +213,8 @@ public function filesCallback(Request $request)
/**
* Callback for filtering.
*
* @param string $token Security token
* @param int $content_id Content id
* @param Request $request
* @return JsonResponse
* @Route("/filter/")
*/
public function filterCallback(Request $request)
Expand Down
11 changes: 8 additions & 3 deletions Controller/H5PController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Emmedy\H5PBundle\Controller;

use Doctrine\ORM\EntityManagerInterface;
use Emmedy\H5PBundle\Core\H5POptions;
use Emmedy\H5PBundle\Editor\LibraryStorage;
use Emmedy\H5PBundle\Entity\Content;
Expand All @@ -22,13 +23,16 @@ class H5PController extends AbstractController

protected $h5PIntegrations;
protected $libraryStorage;
protected $entityManager;

public function __construct(
H5PIntegration $h5PIntegration,
LibraryStorage $libraryStorage
LibraryStorage $libraryStorage,
EntityManagerInterface $entityManager
) {
$this->h5PIntegrations = $h5PIntegration;
$this->libraryStorage = $libraryStorage;
$this->entityManager = $entityManager;
}

/**
Expand All @@ -37,7 +41,7 @@ public function __construct(
*/
public function listAction()
{
$contents = $this->getDoctrine()->getRepository('Emmedy\H5PBundle\Entity\Content')->findAll();
$contents = $this->entityManager->getRepository('Emmedy\H5PBundle\Entity\Content')->findAll();
return $this->render('@EmmedyH5P/list.html.twig', ['contents' => $contents]);
}
/**
Expand Down Expand Up @@ -78,11 +82,12 @@ public function newAction(Request $request)
{
return $this->handleRequest($request );
}

/**
* @Route("edit/{content}")
* @param Request $request
* @param Content $content
* @return
* @return RedirectResponse|Response
*/
public function editAction(Request $request, Content $content)
{
Expand Down
Loading

0 comments on commit f887ec4

Please sign in to comment.