mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-27 12:18:54 +02:00
Moved Admin Pages to its own folder.
This commit is contained in:
parent
2ea0dc16e0
commit
0826f5e6aa
8 changed files with 8 additions and 9 deletions
109
src/Controller/AdminPages/AttachmentTypeController.php
Normal file
109
src/Controller/AdminPages/AttachmentTypeController.php
Normal file
|
@ -0,0 +1,109 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* part-db version 0.1
|
||||
* Copyright (C) 2005 Christoph Lechner
|
||||
* http://www.cl-projects.de/
|
||||
*
|
||||
* part-db version 0.2+
|
||||
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||
* http://code.google.com/p/part-db/
|
||||
*
|
||||
* Part-DB Version 0.4+
|
||||
* Copyright (C) 2016 - 2019 Jan Böhmer
|
||||
* https://github.com/jbtronics
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\Controller\AdminPages;
|
||||
|
||||
|
||||
use App\Entity\AttachmentType;
|
||||
|
||||
use App\Form\BaseEntityAdminForm;
|
||||
use App\Services\EntityExporter;
|
||||
use App\Services\EntityImporter;
|
||||
use App\Services\StructuralElementRecursionHelper;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
/**
|
||||
* @Route("/attachment_type")
|
||||
* @package App\Controller
|
||||
*/
|
||||
class AttachmentTypeController extends BaseAdminController
|
||||
{
|
||||
|
||||
protected $entity_class = AttachmentType::class;
|
||||
protected $twig_template = 'AdminPages/AttachmentTypeAdmin.html.twig';
|
||||
protected $form_class = BaseEntityAdminForm::class;
|
||||
protected $route_base = "attachment_type";
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", requirements={"id"="\d+"}, name="attachment_type_edit")
|
||||
* @Route("/{id}/", requirements={"id"="\d+"})
|
||||
*/
|
||||
public function edit(AttachmentType $entity, Request $request, EntityManagerInterface $em)
|
||||
{
|
||||
return $this->_edit($entity, $request, $em);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/new", name="attachment_type_new")
|
||||
* @Route("/")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer)
|
||||
{
|
||||
return $this->_new($request, $em, $importer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}", name="attachment_type_delete", methods={"DELETE"})
|
||||
*/
|
||||
public function delete(Request $request, AttachmentType $entity, StructuralElementRecursionHelper $recursionHelper)
|
||||
{
|
||||
return $this->_delete($request, $entity, $recursionHelper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/export", name="attachment_type_export_all")
|
||||
* @param Request $request
|
||||
* @param SerializerInterface $serializer
|
||||
* @param EntityManagerInterface $em
|
||||
* @return Response
|
||||
*/
|
||||
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request)
|
||||
{
|
||||
return $this->_exportAll($em, $exporter, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/export", name="attachment_type_export")
|
||||
* @param Request $request
|
||||
* @param AttachmentType $entity
|
||||
*/
|
||||
public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request)
|
||||
{
|
||||
return $this->_exportEntity($entity, $exporter, $request);
|
||||
}
|
||||
|
||||
}
|
177
src/Controller/AdminPages/BaseAdminController.php
Normal file
177
src/Controller/AdminPages/BaseAdminController.php
Normal file
|
@ -0,0 +1,177 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* part-db version 0.1
|
||||
* Copyright (C) 2005 Christoph Lechner
|
||||
* http://www.cl-projects.de/
|
||||
*
|
||||
* part-db version 0.2+
|
||||
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||
* http://code.google.com/p/part-db/
|
||||
*
|
||||
* Part-DB Version 0.4+
|
||||
* Copyright (C) 2016 - 2019 Jan Böhmer
|
||||
* https://github.com/jbtronics
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\Controller\AdminPages;
|
||||
|
||||
use App\Entity\AttachmentType;
|
||||
use App\Entity\StructuralDBElement;
|
||||
use App\Form\BaseEntityAdminForm;
|
||||
use App\Form\ImportType;
|
||||
use App\Services\EntityExporter;
|
||||
use App\Services\EntityImporter;
|
||||
use App\Services\StructuralElementRecursionHelper;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Validator\ConstraintViolationList;
|
||||
|
||||
abstract class BaseAdminController extends AbstractController
|
||||
{
|
||||
|
||||
protected $entity_class = "";
|
||||
protected $form_class = "";
|
||||
protected $twig_template = "";
|
||||
protected $route_base = "";
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
if ($this->entity_class === "" || $this->form_class === "" || $this->twig_template === "" || $this->route_base === "") {
|
||||
throw new \InvalidArgumentException('You have to override the $entity_class, $form_class, $route_base and $twig_template value in your subclasss!');
|
||||
}
|
||||
}
|
||||
|
||||
protected function _edit(StructuralDBElement $entity, Request $request, EntityManagerInterface $em)
|
||||
{
|
||||
|
||||
$this->denyAccessUnlessGranted('read', $entity);
|
||||
|
||||
$form = $this->createForm($this->form_class, $entity);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$em->persist($entity);
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
return $this->render($this->twig_template, [
|
||||
'entity' => $entity,
|
||||
'form' => $form->createView()
|
||||
]);
|
||||
}
|
||||
|
||||
protected function _new(Request $request, EntityManagerInterface $em, EntityImporter $importer)
|
||||
{
|
||||
/** @var StructuralDBElement $new_entity */
|
||||
$new_entity = new $this->entity_class();
|
||||
|
||||
$this->denyAccessUnlessGranted('read', $new_entity);
|
||||
|
||||
//Basic edit form
|
||||
$form = $this->createForm($this->form_class, $new_entity);
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$em->persist($new_entity);
|
||||
$em->flush();
|
||||
//$this->addFlash('success', $translator->trans('part.created_flash'));
|
||||
|
||||
return $this->redirectToRoute($this->route_base . '_edit', ['id' => $new_entity->getID()]);
|
||||
}
|
||||
|
||||
//Import form
|
||||
$import_form = $this->createForm(ImportType::class, ['entity_class' => $this->entity_class]);
|
||||
$import_form->handleRequest($request);
|
||||
|
||||
if ($import_form->isSubmitted() && $import_form->isValid()) {
|
||||
/** @var UploadedFile $file */
|
||||
$file = $import_form['file']->getData();
|
||||
$data = $import_form->getData();
|
||||
|
||||
$options = array('parent' => $data['parent'], 'preserve_children' => $data['preserve_children'],
|
||||
'format' => $data['format'], 'csv_separator' => $data['csv_separator']);
|
||||
|
||||
$errors = $importer->fileToDBEntities($file, $this->entity_class, $options);
|
||||
|
||||
foreach ($errors as $name => $error) {
|
||||
/** @var $error ConstraintViolationList */
|
||||
$this->addFlash('error', $name . ":" . $error);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render($this->twig_template, [
|
||||
'entity' => $new_entity,
|
||||
'form' => $form->createView(),
|
||||
'import_form' => $import_form->createView()
|
||||
]);
|
||||
}
|
||||
|
||||
protected function _delete(Request $request, StructuralDBElement $entity, StructuralElementRecursionHelper $recursionHelper)
|
||||
{
|
||||
$this->denyAccessUnlessGranted('delete', $entity);
|
||||
|
||||
if ($this->isCsrfTokenValid('delete'.$entity->getId(), $request->request->get('_token'))) {
|
||||
$entityManager = $this->getDoctrine()->getManager();
|
||||
|
||||
//Check if we need to remove recursively
|
||||
if ($request->get('delete_recursive', false)) {
|
||||
$recursionHelper->delete($entity, false);
|
||||
} else {
|
||||
$parent = $entity->getParent();
|
||||
|
||||
//Move all sub entities to the current parent
|
||||
foreach ($entity->getSubelements() as $subelement) {
|
||||
$subelement->setParent($parent);
|
||||
$entityManager->persist($subelement);
|
||||
}
|
||||
|
||||
//Remove current element
|
||||
$entityManager->remove($entity);
|
||||
}
|
||||
|
||||
//Flush changes
|
||||
$entityManager->flush();
|
||||
|
||||
$this->addFlash('success', 'attachment_type.deleted');
|
||||
}
|
||||
|
||||
return $this->redirectToRoute($this->route_base . '_new');
|
||||
}
|
||||
|
||||
protected function _exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request)
|
||||
{
|
||||
$entity = new $this->entity_class();
|
||||
|
||||
$this->denyAccessUnlessGranted('read', $entity);
|
||||
|
||||
$entities = $em->getRepository($this->entity_class)->findAll();
|
||||
|
||||
return $exporter->exportEntityFromRequest($entities,$request);
|
||||
}
|
||||
|
||||
protected function _exportEntity(StructuralDBElement $entity, EntityExporter $exporter, Request $request)
|
||||
{
|
||||
$this->denyAccessUnlessGranted('read', $entity);
|
||||
|
||||
return $exporter->exportEntityFromRequest($entity, $request);
|
||||
}
|
||||
}
|
110
src/Controller/AdminPages/CategoryController.php
Normal file
110
src/Controller/AdminPages/CategoryController.php
Normal file
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* part-db version 0.1
|
||||
* Copyright (C) 2005 Christoph Lechner
|
||||
* http://www.cl-projects.de/
|
||||
*
|
||||
* part-db version 0.2+
|
||||
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||
* http://code.google.com/p/part-db/
|
||||
*
|
||||
* Part-DB Version 0.4+
|
||||
* Copyright (C) 2016 - 2019 Jan Böhmer
|
||||
* https://github.com/jbtronics
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\Controller\AdminPages;
|
||||
|
||||
|
||||
use App\Entity\AttachmentType;
|
||||
use App\Entity\Category;
|
||||
use App\Form\BaseEntityAdminForm;
|
||||
use App\Form\CategoryAdminForm;
|
||||
use App\Services\EntityExporter;
|
||||
use App\Services\EntityImporter;
|
||||
use App\Services\StructuralElementRecursionHelper;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
/**
|
||||
* @Route("/category")
|
||||
* @package App\Controller
|
||||
*/
|
||||
class CategoryController extends BaseAdminController
|
||||
{
|
||||
|
||||
protected $entity_class = Category::class;
|
||||
protected $twig_template = 'AdminPages/CategoryAdmin.html.twig';
|
||||
protected $form_class = CategoryAdminForm::class;
|
||||
protected $route_base = "category";
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", requirements={"id"="\d+"}, name="category_edit")
|
||||
* @Route("/{id}/", requirements={"id"="\d+"})
|
||||
*/
|
||||
public function edit(Category $entity, Request $request, EntityManagerInterface $em)
|
||||
{
|
||||
return $this->_edit($entity, $request, $em);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/new", name="category_new")
|
||||
* @Route("/")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer)
|
||||
{
|
||||
return $this->_new($request, $em, $importer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}", name="category_delete", methods={"DELETE"})
|
||||
*/
|
||||
public function delete(Request $request, Category $entity, StructuralElementRecursionHelper $recursionHelper)
|
||||
{
|
||||
return $this->_delete($request, $entity, $recursionHelper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/export", name="category_export_all")
|
||||
* @param Request $request
|
||||
* @param SerializerInterface $serializer
|
||||
* @param EntityManagerInterface $em
|
||||
* @return Response
|
||||
*/
|
||||
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request)
|
||||
{
|
||||
return $this->_exportAll($em, $exporter, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/export", name="category_export")
|
||||
* @param Request $request
|
||||
* @param AttachmentType $entity
|
||||
*/
|
||||
public function exportEntity(Category $entity, EntityExporter $exporter, Request $request)
|
||||
{
|
||||
return $this->_exportEntity($entity, $exporter, $request);
|
||||
}
|
||||
|
||||
}
|
110
src/Controller/AdminPages/DeviceController.php
Normal file
110
src/Controller/AdminPages/DeviceController.php
Normal file
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* part-db version 0.1
|
||||
* Copyright (C) 2005 Christoph Lechner
|
||||
* http://www.cl-projects.de/
|
||||
*
|
||||
* part-db version 0.2+
|
||||
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||
* http://code.google.com/p/part-db/
|
||||
*
|
||||
* Part-DB Version 0.4+
|
||||
* Copyright (C) 2016 - 2019 Jan Böhmer
|
||||
* https://github.com/jbtronics
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\Controller\AdminPages;
|
||||
|
||||
|
||||
use App\Entity\AttachmentType;
|
||||
|
||||
use App\Entity\Device;
|
||||
use App\Form\BaseEntityAdminForm;
|
||||
use App\Services\EntityExporter;
|
||||
use App\Services\EntityImporter;
|
||||
use App\Services\StructuralElementRecursionHelper;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
/**
|
||||
* @Route("/device")
|
||||
* @package App\Controller
|
||||
*/
|
||||
class DeviceController extends BaseAdminController
|
||||
{
|
||||
|
||||
protected $entity_class = Device::class;
|
||||
protected $twig_template = 'AdminPages/DeviceAdmin.html.twig';
|
||||
protected $form_class = BaseEntityAdminForm::class;
|
||||
protected $route_base = "device";
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", requirements={"id"="\d+"}, name="device_edit")
|
||||
* @Route("/{id}/", requirements={"id"="\d+"})
|
||||
*/
|
||||
public function edit(Device $entity, Request $request, EntityManagerInterface $em)
|
||||
{
|
||||
return $this->_edit($entity, $request, $em);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/new", name="device_new")
|
||||
* @Route("/")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer)
|
||||
{
|
||||
return $this->_new($request, $em, $importer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}", name="device_delete", methods={"DELETE"})
|
||||
*/
|
||||
public function delete(Request $request, Device $entity, StructuralElementRecursionHelper $recursionHelper)
|
||||
{
|
||||
return $this->_delete($request, $entity, $recursionHelper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/export", name="device_export_all")
|
||||
* @param Request $request
|
||||
* @param SerializerInterface $serializer
|
||||
* @param EntityManagerInterface $em
|
||||
* @return Response
|
||||
*/
|
||||
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request)
|
||||
{
|
||||
return $this->_exportAll($em, $exporter, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/export", name="device_export")
|
||||
* @param Request $request
|
||||
* @param AttachmentType $entity
|
||||
*/
|
||||
public function exportEntity(Device $entity, EntityExporter $exporter, Request $request)
|
||||
{
|
||||
return $this->_exportEntity($entity, $exporter, $request);
|
||||
}
|
||||
|
||||
}
|
110
src/Controller/AdminPages/FootprintController.php
Normal file
110
src/Controller/AdminPages/FootprintController.php
Normal file
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* part-db version 0.1
|
||||
* Copyright (C) 2005 Christoph Lechner
|
||||
* http://www.cl-projects.de/
|
||||
*
|
||||
* part-db version 0.2+
|
||||
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||
* http://code.google.com/p/part-db/
|
||||
*
|
||||
* Part-DB Version 0.4+
|
||||
* Copyright (C) 2016 - 2019 Jan Böhmer
|
||||
* https://github.com/jbtronics
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\Controller\AdminPages;
|
||||
|
||||
|
||||
use App\Entity\AttachmentType;
|
||||
|
||||
use App\Entity\Footprint;
|
||||
use App\Form\BaseEntityAdminForm;
|
||||
use App\Services\EntityExporter;
|
||||
use App\Services\EntityImporter;
|
||||
use App\Services\StructuralElementRecursionHelper;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
/**
|
||||
* @Route("/footprint")
|
||||
* @package App\Controller
|
||||
*/
|
||||
class FootprintController extends BaseAdminController
|
||||
{
|
||||
|
||||
protected $entity_class = Footprint::class;
|
||||
protected $twig_template = 'AdminPages/FootprintAdmin.html.twig';
|
||||
protected $form_class = BaseEntityAdminForm::class;
|
||||
protected $route_base = "footprint";
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", requirements={"id"="\d+"}, name="footprint_edit")
|
||||
* @Route("/{id}/", requirements={"id"="\d+"})
|
||||
*/
|
||||
public function edit(Footprint $entity, Request $request, EntityManagerInterface $em)
|
||||
{
|
||||
return $this->_edit($entity, $request, $em);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/new", name="footprint_new")
|
||||
* @Route("/")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer)
|
||||
{
|
||||
return $this->_new($request, $em, $importer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}", name="footprint_delete", methods={"DELETE"})
|
||||
*/
|
||||
public function delete(Request $request, Footprint $entity, StructuralElementRecursionHelper $recursionHelper)
|
||||
{
|
||||
return $this->_delete($request, $entity, $recursionHelper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/export", name="footprint_export_all")
|
||||
* @param Request $request
|
||||
* @param SerializerInterface $serializer
|
||||
* @param EntityManagerInterface $em
|
||||
* @return Response
|
||||
*/
|
||||
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request)
|
||||
{
|
||||
return $this->_exportAll($em, $exporter, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/export", name="footprint_export")
|
||||
* @param Request $request
|
||||
* @param AttachmentType $entity
|
||||
*/
|
||||
public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request)
|
||||
{
|
||||
return $this->_exportEntity($entity, $exporter, $request);
|
||||
}
|
||||
|
||||
}
|
112
src/Controller/AdminPages/ManufacturerController.php
Normal file
112
src/Controller/AdminPages/ManufacturerController.php
Normal file
|
@ -0,0 +1,112 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* part-db version 0.1
|
||||
* Copyright (C) 2005 Christoph Lechner
|
||||
* http://www.cl-projects.de/
|
||||
*
|
||||
* part-db version 0.2+
|
||||
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||
* http://code.google.com/p/part-db/
|
||||
*
|
||||
* Part-DB Version 0.4+
|
||||
* Copyright (C) 2016 - 2019 Jan Böhmer
|
||||
* https://github.com/jbtronics
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\Controller\AdminPages;
|
||||
|
||||
|
||||
use App\Entity\AttachmentType;
|
||||
|
||||
use App\Entity\Manufacturer;
|
||||
use App\Entity\Supplier;
|
||||
use App\Form\BaseEntityAdminForm;
|
||||
use App\Form\CompanyForm;
|
||||
use App\Services\EntityExporter;
|
||||
use App\Services\EntityImporter;
|
||||
use App\Services\StructuralElementRecursionHelper;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
/**
|
||||
* @Route("/manufacturer")
|
||||
* @package App\Controller
|
||||
*/
|
||||
class ManufacturerController extends BaseAdminController
|
||||
{
|
||||
|
||||
protected $entity_class = Manufacturer::class;
|
||||
protected $twig_template = 'AdminPages/ManufacturerAdmin.html.twig';
|
||||
protected $form_class = CompanyForm::class;
|
||||
protected $route_base = 'manufacturer';
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", requirements={"id"="\d+"}, name="manufacturer_edit")
|
||||
* @Route("/{id}/", requirements={"id"="\d+"})
|
||||
*/
|
||||
public function edit(Manufacturer $entity, Request $request, EntityManagerInterface $em)
|
||||
{
|
||||
return $this->_edit($entity, $request, $em);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/new", name="manufacturer_new")
|
||||
* @Route("/")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer)
|
||||
{
|
||||
return $this->_new($request, $em, $importer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}", name="manufacturer_delete", methods={"DELETE"})
|
||||
*/
|
||||
public function delete(Request $request, Manufacturer $entity, StructuralElementRecursionHelper $recursionHelper)
|
||||
{
|
||||
return $this->_delete($request, $entity, $recursionHelper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/export", name="manufacturer_export_all")
|
||||
* @param Request $request
|
||||
* @param SerializerInterface $serializer
|
||||
* @param EntityManagerInterface $em
|
||||
* @return Response
|
||||
*/
|
||||
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request)
|
||||
{
|
||||
return $this->_exportAll($em, $exporter, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/export", name="manufacturer_export")
|
||||
* @param Request $request
|
||||
* @param Supplier $entity
|
||||
*/
|
||||
public function exportEntity(Manufacturer $entity, EntityExporter $exporter, Request $request)
|
||||
{
|
||||
return $this->_exportEntity($entity, $exporter, $request);
|
||||
}
|
||||
|
||||
}
|
111
src/Controller/AdminPages/StorelocationController.php
Normal file
111
src/Controller/AdminPages/StorelocationController.php
Normal file
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* part-db version 0.1
|
||||
* Copyright (C) 2005 Christoph Lechner
|
||||
* http://www.cl-projects.de/
|
||||
*
|
||||
* part-db version 0.2+
|
||||
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||
* http://code.google.com/p/part-db/
|
||||
*
|
||||
* Part-DB Version 0.4+
|
||||
* Copyright (C) 2016 - 2019 Jan Böhmer
|
||||
* https://github.com/jbtronics
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\Controller\AdminPages;
|
||||
|
||||
use App\Entity\AttachmentType;
|
||||
|
||||
use App\Entity\Storelocation;
|
||||
use App\Form\BaseEntityAdminForm;
|
||||
use App\Form\StorelocationAdminForm;
|
||||
use App\Services\EntityExporter;
|
||||
use App\Services\EntityImporter;
|
||||
use App\Services\StructuralElementRecursionHelper;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\HttpCache\Store;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
/**
|
||||
* @Route("/store_location")
|
||||
* @package App\Controller
|
||||
*/
|
||||
class StorelocationController extends BaseAdminController
|
||||
{
|
||||
|
||||
protected $entity_class = Storelocation::class;
|
||||
protected $twig_template = 'AdminPages/StorelocationAdmin.html.twig';
|
||||
protected $form_class = StorelocationAdminForm::class;
|
||||
protected $route_base = "store_location";
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", requirements={"id"="\d+"}, name="store_location_edit")
|
||||
* @Route("/{id}/", requirements={"id"="\d+"})
|
||||
*/
|
||||
public function edit(Storelocation $entity, Request $request, EntityManagerInterface $em)
|
||||
{
|
||||
return $this->_edit($entity, $request, $em);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/new", name="store_location_new")
|
||||
* @Route("/")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer)
|
||||
{
|
||||
return $this->_new($request, $em, $importer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}", name="store_location_delete", methods={"DELETE"})
|
||||
*/
|
||||
public function delete(Request $request, Storelocation $entity, StructuralElementRecursionHelper $recursionHelper)
|
||||
{
|
||||
return $this->_delete($request, $entity, $recursionHelper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/export", name="store_location_export_all")
|
||||
* @param Request $request
|
||||
* @param SerializerInterface $serializer
|
||||
* @param EntityManagerInterface $em
|
||||
* @return Response
|
||||
*/
|
||||
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request)
|
||||
{
|
||||
return $this->_exportAll($em, $exporter, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/export", name="store_location_export")
|
||||
* @param Request $request
|
||||
* @param AttachmentType $entity
|
||||
*/
|
||||
public function exportEntity(Storelocation $entity, EntityExporter $exporter, Request $request)
|
||||
{
|
||||
return $this->_exportEntity($entity, $exporter, $request);
|
||||
}
|
||||
|
||||
}
|
111
src/Controller/AdminPages/SupplierController.php
Normal file
111
src/Controller/AdminPages/SupplierController.php
Normal file
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* part-db version 0.1
|
||||
* Copyright (C) 2005 Christoph Lechner
|
||||
* http://www.cl-projects.de/
|
||||
*
|
||||
* part-db version 0.2+
|
||||
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||
* http://code.google.com/p/part-db/
|
||||
*
|
||||
* Part-DB Version 0.4+
|
||||
* Copyright (C) 2016 - 2019 Jan Böhmer
|
||||
* https://github.com/jbtronics
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\Controller\AdminPages;
|
||||
|
||||
|
||||
use App\Entity\AttachmentType;
|
||||
|
||||
use App\Entity\Supplier;
|
||||
use App\Form\BaseEntityAdminForm;
|
||||
use App\Form\CompanyForm;
|
||||
use App\Services\EntityExporter;
|
||||
use App\Services\EntityImporter;
|
||||
use App\Services\StructuralElementRecursionHelper;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
/**
|
||||
* @Route("/supplier")
|
||||
* @package App\Controller
|
||||
*/
|
||||
class SupplierController extends BaseAdminController
|
||||
{
|
||||
|
||||
protected $entity_class = Supplier::class;
|
||||
protected $twig_template = 'AdminPages/SupplierAdmin.html.twig';
|
||||
protected $form_class = CompanyForm::class;
|
||||
protected $route_base = "supplier";
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", requirements={"id"="\d+"}, name="supplier_edit")
|
||||
* @Route("/{id}/", requirements={"id"="\d+"})
|
||||
*/
|
||||
public function edit(Supplier $entity, Request $request, EntityManagerInterface $em)
|
||||
{
|
||||
return $this->_edit($entity, $request, $em);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/new", name="supplier_new")
|
||||
* @Route("/")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer)
|
||||
{
|
||||
return $this->_new($request, $em, $importer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}", name="supplier_delete", methods={"DELETE"})
|
||||
*/
|
||||
public function delete(Request $request, Supplier $entity, StructuralElementRecursionHelper $recursionHelper)
|
||||
{
|
||||
return $this->_delete($request, $entity, $recursionHelper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/export", name="supplier_export_all")
|
||||
* @param Request $request
|
||||
* @param SerializerInterface $serializer
|
||||
* @param EntityManagerInterface $em
|
||||
* @return Response
|
||||
*/
|
||||
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request)
|
||||
{
|
||||
return $this->_exportAll($em, $exporter, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/export", name="supplier_export")
|
||||
* @param Request $request
|
||||
* @param Supplier $entity
|
||||
*/
|
||||
public function exportEntity(Supplier $entity, EntityExporter $exporter, Request $request)
|
||||
{
|
||||
return $this->_exportEntity($entity, $exporter, $request);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue