svg
Cadoles/nineskeletor/pipeline/head There was a failure building this commit Details

This commit is contained in:
afornerot 2024-07-02 09:09:54 +02:00
parent f659e27ad6
commit 671b37197e
30 changed files with 1909 additions and 972 deletions

View File

@ -251,7 +251,6 @@ app_admin_niveau01_delete:
controller: App\Controller\Niveau01Controller::delete controller: App\Controller\Niveau01Controller::delete
defaults: { access: admin } defaults: { access: admin }
#== Niveau02 ==================================================================================================== #== Niveau02 ====================================================================================================
#-- Access admin #-- Access admin
app_admin_niveau02: app_admin_niveau02:
@ -965,7 +964,6 @@ app_admin_item_order:
controller: App\Controller\ItemController::order controller: App\Controller\ItemController::order
defaults: { access: admin } defaults: { access: admin }
#== ITEM CATEGORY ======================================================================================================================================== #== ITEM CATEGORY ========================================================================================================================================
#-- Access admin #-- Access admin
@ -1033,7 +1031,6 @@ app_all_bookmark_heart:
controller: App\Controller\BookmarkController::heart controller: App\Controller\BookmarkController::heart
defaults: { access: all } defaults: { access: all }
#== FILE ================================================================================================================= #== FILE =================================================================================================================
#-- Access admin #-- Access admin
@ -1158,8 +1155,6 @@ app_all_file_download:
controller: App\Controller\FileController::download controller: App\Controller\FileController::download
defaults: { access: all } defaults: { access: all }
#== PAGEWIDGETSLIDE ================================================================================================================================================ #== PAGEWIDGETSLIDE ================================================================================================================================================
#-- Access admin #-- Access admin
@ -1214,8 +1209,6 @@ app_all_pagewidgetslide_delete:
controller: App\Controller\PagewidgetslideController::delete controller: App\Controller\PagewidgetslideController::delete
defaults: { access: all } defaults: { access: all }
#== PAGE TEMPLATE ======================================================================================================================================== #== PAGE TEMPLATE ========================================================================================================================================
#-- Access admin #-- Access admin
@ -1255,7 +1248,6 @@ app_all_page_template_selectlist:
controller: App\Controller\PagetemplateController::selectlist controller: App\Controller\PagetemplateController::selectlist
defaults: { access: admin, usage: template } defaults: { access: admin, usage: template }
#== PAGE ================================================================================================================================================= #== PAGE =================================================================================================================================================
#-- Access admin #-- Access admin
@ -1362,8 +1354,6 @@ app_all_page_application:
controller: App\Controller\PageController::application controller: App\Controller\PageController::application
defaults: { access: all } defaults: { access: all }
#== PAGE WIDGET ========================================================================================================================================== #== PAGE WIDGET ==========================================================================================================================================
#-- Access admin #-- Access admin
@ -1618,3 +1608,34 @@ app_all_pagewidget_view_groupmessage:
controller: App\Controller\PagewidgetController::viewgroupmessage controller: App\Controller\PagewidgetController::viewgroupmessage
defaults: { access: all } defaults: { access: all }
#== DOCUMENTCATEGORY ========================================================================================================
#-- Access admin
app_admin_documentcategory:
path: /admin/documentcategory
controller: App\Controller\DocumentcategoryController::list
defaults: { access: admin }
app_admin_documentcategory_submit:
path: /admin/documentcategory/submit
controller: App\Controller\DocumentcategoryController::submit
defaults: { access: admin }
app_admin_documentcategory_update:
path: /admin/documentcategory/update/{id}
controller: App\Controller\DocumentcategoryController::update
defaults: { access: admin }
app_admin_documentcategory_delete:
path: /admin/documentcategory/delete/{id}
controller: App\Controller\DocumentcategoryController::delete
defaults: { access: admin }
app_admin_documentcategory_render:
path: /admin/documentcategory/render/{id}
controller: App\Controller\DocumentcategoryController::renderid
defaults: { access: admin }
app_admin_documentcategory_order:
path: /admin/documentcategory/order
controller: App\Controller\DocumentcategoryController::order
defaults: { access: admin }

View File

@ -0,0 +1,159 @@
<?php
namespace App\Controller;
use App\Entity\Documentcategory;
use App\Form\DocumentcategoryType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class DocumentcategoryController extends AbstractController
{
private $data = 'documentcategory';
private $entity = "App\Entity\Documentcategory";
private $twig = 'Documentcategory/';
private $route = 'app_admin_documentcategory';
public function list($access, ManagerRegistry $em): Response
{
$datas = $em->getRepository($this->entity)->findBy(['parent' => null], ['roworder' => 'ASC']);
return $this->render($this->twig.'list.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'access' => $access,
$this->data.'s' => $datas,
]);
}
public function renderid($id, $access, ManagerRegistry $em): Response
{
$data = $em->getRepository($this->entity)->find($id);
return $this->render($this->twig.'render.html.twig', [
'access' => $access,
$this->data => $data,
]);
}
public function submit($access, Request $request, ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data = new Documentcategory();
$data->setRoworder(0);
// Création du formulaire
$form = $this->createForm(DocumentcategoryType::class, $data, ['mode' => 'submit', 'access' => $access]);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
// Sauvegarde
$em->getManager()->persist($data);
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route));
}
// Affichage du formulaire
return $this->render($this->twig.'edit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'access' => $access,
$this->data => $data,
'mode' => 'submit',
'form' => $form->createView(),
]);
}
public function update($id, $access, Request $request, ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Création du formulaire
$form = $this->createForm(DocumentcategoryType::class, $data, ['mode' => 'update']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
// Sauvegarde
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route));
}
// Affichage du formulaire
return $this->render($this->twig.'edit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'access' => $access,
$this->data => $data,
'mode' => 'update',
'form' => $form->createView(),
]);
}
public function delete($id, $access, Request $request, ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Tentative de suppression
try {
$em->getManager()->remove($data);
$em->getManager()->flush();
} catch (\Exception $e) {
$request->getSession()->getFlashBag()->add('error', $e->getMessage());
return $this->redirectToRoute($this->route.'_update', ['id' => $id]);
}
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route));
}
public function order($access, Request $request, ManagerRegistry $em): Response
{
$output = [];
$id = $request->request->get('id');
$parent = $request->request->get('parent');
$roworder = $request->request->get('roworder');
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
if ($parent) {
$parent = $em->getRepository($this->entity)->find($parent);
}
$data->setRoworder($roworder);
$data->setParent($parent);
$em->getManager()->flush();
return new JsonResponse($output);
}
}

View File

@ -3,6 +3,8 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**

View File

@ -2,6 +2,8 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**

View File

@ -2,6 +2,7 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**

View File

@ -2,6 +2,7 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**

View File

@ -2,6 +2,7 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;

224
src/Entity/Document.php Executable file
View File

@ -0,0 +1,224 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* Document.
*
* @ORM\Entity
* @ORM\Table(name="document")
*/
class Document
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="label", type="string", length=100)
*/
private $label;
/**
* @var int
*
* @ORM\Column(name="roworder", type="integer")
*/
private $roworder;
/**
* @ORM\ManyToOne(targetEntity="User", inversedBy="documents")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $user;
/**
* @ORM\ManyToOne(targetEntity="Documentcategory", inversedBy="documents")
*/
private $documentcategory;
/**
* @var ArrayCollection
* @var Document
*
* @ORM\OneToMany(targetEntity="Document", mappedBy="documentcategory", cascade={"persist"}, orphanRemoval=false)
*/
private $documents;
/**
* @var ArrayCollection
* @var Documentelement
*
* @ORM\OneToMany(targetEntity="Documentelement", mappedBy="parent", cascade={"persist"}, orphanRemoval=true)
*/
private $parents;
/**
* @var ArrayCollection
* @var Documentelement
*
* @ORM\OneToMany(targetEntity="Documentelement", mappedBy="child", cascade={"persist"}, orphanRemoval=true)
*/
private $childs;
public function __construct()
{
$this->documents = new ArrayCollection();
$this->parents = new ArrayCollection();
$this->childs = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): self
{
$this->label = $label;
return $this;
}
public function getRoworder(): ?int
{
return $this->roworder;
}
public function setRoworder(int $roworder): self
{
$this->roworder = $roworder;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getDocumentcategory(): ?Documentcategory
{
return $this->documentcategory;
}
public function setDocumentcategory(?Documentcategory $documentcategory): self
{
$this->documentcategory = $documentcategory;
return $this;
}
/**
* @return Collection<int, Document>
*/
public function getDocuments(): Collection
{
return $this->documents;
}
public function addDocument(Document $document): self
{
if (!$this->documents->contains($document)) {
$this->documents->add($document);
$document->setDocumentcategory($this);
}
return $this;
}
public function removeDocument(Document $document): self
{
if ($this->documents->removeElement($document)) {
// set the owning side to null (unless already changed)
if ($document->getDocumentcategory() === $this) {
$document->setDocumentcategory(null);
}
}
return $this;
}
/**
* @return Collection<int, Documentelement>
*/
public function getParents(): Collection
{
return $this->parents;
}
public function addParent(Documentelement $parent): self
{
if (!$this->parents->contains($parent)) {
$this->parents->add($parent);
$parent->setParent($this);
}
return $this;
}
public function removeParent(Documentelement $parent): self
{
if ($this->parents->removeElement($parent)) {
// set the owning side to null (unless already changed)
if ($parent->getParent() === $this) {
$parent->setParent(null);
}
}
return $this;
}
/**
* @return Collection<int, Documentelement>
*/
public function getChilds(): Collection
{
return $this->childs;
}
public function addChild(Documentelement $child): self
{
if (!$this->childs->contains($child)) {
$this->childs->add($child);
$child->setChild($this);
}
return $this;
}
public function removeChild(Documentelement $child): self
{
if ($this->childs->removeElement($child)) {
// set the owning side to null (unless already changed)
if ($child->getChild() === $this) {
$child->setChild(null);
}
}
return $this;
}
}

130
src/Entity/Documentcategory.php Executable file
View File

@ -0,0 +1,130 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* Documentcategory
*
* @ORM\Entity
* @ORM\Table(name="documentcategory")
*/
class Documentcategory
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="label", type="string", length=100)
*/
private $label;
/**
* @var int
*
* @ORM\Column(name="roworder", type="integer")
*/
private $roworder;
/**
* @ORM\ManyToOne(targetEntity="Documentcategory", inversedBy="childs")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $parent;
/**
* @var ArrayCollection
* @var Documentcategory
*
* @ORM\OneToMany(targetEntity="Documentcategory", mappedBy="parent", cascade={"persist"}, orphanRemoval=false)
* @ORM\OrderBy({"roworder" = "ASC"})
*/
private $childs;
public function __construct()
{
$this->childs = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): self
{
$this->label = $label;
return $this;
}
public function getRoworder(): ?int
{
return $this->roworder;
}
public function setRoworder(int $roworder): self
{
$this->roworder = $roworder;
return $this;
}
public function getParent(): ?self
{
return $this->parent;
}
public function setParent(?self $parent): self
{
$this->parent = $parent;
return $this;
}
/**
* @return Collection<int, Documentcategory>
*/
public function getChilds(): Collection
{
return $this->childs;
}
public function addChild(Documentcategory $child): self
{
if (!$this->childs->contains($child)) {
$this->childs->add($child);
$child->setParent($this);
}
return $this;
}
public function removeChild(Documentcategory $child): self
{
if ($this->childs->removeElement($child)) {
// set the owning side to null (unless already changed)
if ($child->getParent() === $this) {
$child->setParent(null);
}
}
return $this;
}
}

100
src/Entity/Documentelement.php Executable file
View File

@ -0,0 +1,100 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Documenttype.
*
* @ORM\Entity
* @ORM\Table(name="documentelement")
*/
class Documentelement
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=100)
*/
private $name;
/**
* @var int
*
* @ORM\Column(name="roworder", type="integer")
*/
private $roworder;
/**
* @ORM\ManyToOne(targetEntity="Document", inversedBy="parents")
*/
private $parent;
/**
* @ORM\ManyToOne(targetEntity="Document", inversedBy="childs")
*/
private $child;
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getRoworder(): ?int
{
return $this->roworder;
}
public function setRoworder(int $roworder): self
{
$this->roworder = $roworder;
return $this;
}
public function getParent(): ?Document
{
return $this->parent;
}
public function setParent(?Document $parent): self
{
$this->parent = $parent;
return $this;
}
public function getChild(): ?Document
{
return $this->child;
}
public function setChild(?Document $child): self
{
$this->child = $child;
return $this;
}
}

View File

@ -5,6 +5,7 @@ namespace App\Entity;
use App\Validator; use App\Validator;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

View File

@ -3,6 +3,7 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
@ -84,14 +85,6 @@ class Icon
*/ */
private $bookmarks; private $bookmarks;
/**
* @var ArrayCollection
* @var Group
*
* @ORM\OneToMany(targetEntity="Group", mappedBy="icon", cascade={"persist"}, orphanRemoval=false)
*/
private $groups;
/** /**
* Constructor. * Constructor.
*/ */
@ -103,7 +96,6 @@ class Icon
$this->pagewidgets = new \Doctrine\Common\Collections\ArrayCollection(); $this->pagewidgets = new \Doctrine\Common\Collections\ArrayCollection();
$this->widgets = new \Doctrine\Common\Collections\ArrayCollection(); $this->widgets = new \Doctrine\Common\Collections\ArrayCollection();
$this->bookmarks = new \Doctrine\Common\Collections\ArrayCollection(); $this->bookmarks = new \Doctrine\Common\Collections\ArrayCollection();
$this->groups = new ArrayCollection();
} }
/** /**
@ -344,36 +336,6 @@ class Icon
return $this->bookmarks; return $this->bookmarks;
} }
/**
* Add group.
*
* @return Icon
*/
public function addGroup(Group $group)
{
$this->groups[] = $group;
return $this;
}
/**
* Remove group.
*/
public function removeGroup(Group $group)
{
$this->groups->removeElement($group);
}
/**
* Get groups.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getGroups()
{
return $this->groups;
}
/** /**
* Set tags. * Set tags.
* *

View File

@ -4,6 +4,7 @@ namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**

View File

@ -3,6 +3,7 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

View File

@ -5,6 +5,7 @@ namespace App\Entity;
use App\Validator; use App\Validator;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

View File

@ -5,6 +5,7 @@ namespace App\Entity;
use App\Validator; use App\Validator;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

View File

@ -5,6 +5,7 @@ namespace App\Entity;
use App\Validator; use App\Validator;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

View File

@ -5,6 +5,7 @@ namespace App\Entity;
use App\Validator; use App\Validator;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

View File

@ -3,6 +3,8 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**

View File

@ -3,6 +3,7 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**

View File

@ -4,6 +4,7 @@ namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**

View File

@ -3,6 +3,7 @@
namespace App\Entity; namespace App\Entity;
use App\Validator; use App\Validator;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\LegacyPasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\LegacyPasswordAuthenticatedUserInterface;

View File

@ -5,6 +5,7 @@ namespace App\Entity;
use App\Validator; use App\Validator;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\LegacyPasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\LegacyPasswordAuthenticatedUserInterface;
@ -191,6 +192,30 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
*/ */
private $modos; private $modos;
/**
* @var ArrayCollection
* @var UserGroup
*
* @ORM\OneToMany(targetEntity="Page", mappedBy="user", cascade={"persist"}, orphanRemoval=true)
*/
private $pages;
/**
* @var ArrayCollection
* @var UserGroup
*
* @ORM\OneToMany(targetEntity="Icon", mappedBy="user", cascade={"persist"}, orphanRemoval=true)
*/
private $icons;
/**
* @var ArrayCollection
* @var UserGroup
*
* @ORM\OneToMany(targetEntity="Bookmark", mappedBy="user", cascade={"persist"}, orphanRemoval=true)
*/
private $bookmarks;
/** /**
* @ORM\ManyToMany(targetEntity="App\Entity\Alert", mappedBy="readers") * @ORM\ManyToMany(targetEntity="App\Entity\Alert", mappedBy="readers")
*/ */
@ -202,6 +227,9 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
$this->ownergroups = new ArrayCollection(); $this->ownergroups = new ArrayCollection();
$this->modos = new ArrayCollection(); $this->modos = new ArrayCollection();
$this->alertreaders = new ArrayCollection(); $this->alertreaders = new ArrayCollection();
$this->pages = new ArrayCollection();
$this->icons = new ArrayCollection();
$this->bookmarks = new ArrayCollection();
} }
// == CODE A NE PAS REGENERER // == CODE A NE PAS REGENERER
@ -710,4 +738,94 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
return $this; return $this;
} }
/**
* @return Collection<int, Page>
*/
public function getPages(): Collection
{
return $this->pages;
}
public function addPage(Page $page): self
{
if (!$this->pages->contains($page)) {
$this->pages->add($page);
$page->setUser($this);
}
return $this;
}
public function removePage(Page $page): self
{
if ($this->pages->removeElement($page)) {
// set the owning side to null (unless already changed)
if ($page->getUser() === $this) {
$page->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, Icon>
*/
public function getIcons(): Collection
{
return $this->icons;
}
public function addIcon(Icon $icon): self
{
if (!$this->icons->contains($icon)) {
$this->icons->add($icon);
$icon->setUser($this);
}
return $this;
}
public function removeIcon(Icon $icon): self
{
if ($this->icons->removeElement($icon)) {
// set the owning side to null (unless already changed)
if ($icon->getUser() === $this) {
$icon->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, Bookmark>
*/
public function getBookmarks(): Collection
{
return $this->bookmarks;
}
public function addBookmark(Bookmark $bookmark): self
{
if (!$this->bookmarks->contains($bookmark)) {
$this->bookmarks->add($bookmark);
$bookmark->setUser($this);
}
return $this;
}
public function removeBookmark(Bookmark $bookmark): self
{
if ($this->bookmarks->removeElement($bookmark)) {
// set the owning side to null (unless already changed)
if ($bookmark->getUser() === $this) {
$bookmark->setUser(null);
}
}
return $this;
}
} }

View File

@ -2,6 +2,7 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

View File

@ -4,6 +4,7 @@ namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**

View File

@ -0,0 +1,37 @@
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class DocumentcategoryType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('submit',
SubmitType::class, [
'label' => 'Valider',
'attr' => ['class' => 'btn btn-success'],
]
);
$builder->add('label',
TextType::class, [
'label' => 'Label',
]
);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'App\Entity\Documentcategory',
'access' => 'string',
'mode' => 'string',
]);
}
}

View File

@ -0,0 +1,62 @@
{% extends 'base.html.twig' %}
{% block body %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
Modification Catégorie de Document = {{documentcategory.label}}
{% elseif mode=="submit" %}
Création Catégorie de Document
{% endif %}
</h1>
{{ form_widget(form.submit) }}
<a class="btn btn-secondary" href={{ path('app_admin_documentcategory') }}>Annuler</a>
{% if mode=="update" %}
<a class="btn btn-danger float-end" href={{ path('app_admin_documentcategory_delete',{id:documentcategory.id}) }} data-method="delete" data-confirm="Êtes-vous sûr de vouloir supprimer cet enregistrement ?">Supprimer</a>
{% endif %}
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="card mt-4">
<div class="card-header">
<i class="fa fa-pencil-alt fa-fw"></i> Informations
</div>
<div class="card-body">
{{ form_row(form.label) }}
</div>
</div>
{% if auditUse and mode=="update" and (access=="admin" or access=="modo" or access=="audit") %}
<div class="float-end" style="width:700px;max-width:100%">
{{ render(path("app_"~access~"_audit_renderid",{entityname:"Documentcategory",entityid:documentcategory.id})) }}
</div>
{% endif %}
{{ form_end(form) }}
{% endblock %}
{% block localscript %}
<script>
$('document').ready(function(){
$("#documentcategory_label").focus();
});
</script>
{% endblock %}

View File

@ -0,0 +1,81 @@
{% extends 'base.html.twig' %}
{% block localstyle %}
<style>
.list-sort {
padding:10px;
background-color: var(--bs-card-cap-bg);
border: var(--bs-card-border-width) solid var(--bs-card-border-color);
border-radius: var(--bs-card-inner-border-radius);
}
</style>
{% endblock %}
{% block body %}
<h1 class="page-header">Gestion des Catégories de Document </h1>
<a class="btn btn-success" href="{{ path('app_'~access~'_documentcategory_submit') }}">Ajouter</a>
{% if auditUse and (access=="admin" or access=="audit") %}
<a class="btn btn-secondary float-end" href="{{ path('app_'~access~'_audit_render',{entityname:'Documentcategory'}) }}"><i class="fas fa-eye fa-fw"></i> Audit</a>
{% endif %}
</p>
<div class="card mt-4">
<div class="card-header">
<i class="fa fa-table fa-fw"></i> Liste des Catégories de Document
</div>
{% set childs=[] %}
<div class="card-body">
<ul class="list-sort">
{% for documentcategory in documentcategorys %}
{{ render(path("app_"~access~"_documentcategory_render",{id:documentcategory.id})) }}
{% endfor %}
</ul>
</div>
</div>
{% endblock %}
{% block localscript %}
<script>
function updateItems() {
roworder=0;
$('.itemcat').each(function(i) {
// Order
roworder++;
// On récupère id et order
var id = $(this).data('id');
// On récupère le parent
var parent=$(this).parents('.itemcat').data('id');
//if(id==parent) parent=null;
console.log({id: id, parent:parent, roworder: roworder});
// Mise à jour en base de l'order
$.ajax({
method: "POST",
url: "{{ path('app_'~access~'_documentcategory_order') }}",
data: {
id:id,
parent:parent,
roworder:roworder
}
});
});
}
$( ".list-sort" ).sortable({
connectWith: ".list-sort",
items: ".itemcat",
placeholder: "item placeholder",
stop: updateItems
});
</script>
{% endblock %}

View File

@ -0,0 +1,10 @@
<div class="itemcat list-group-item mb-3" data-id="{{ documentcategory.id }}" >
<a href="{{ path('app_'~access~'_documentcategory_update',{id:documentcategory.id})}}">{{ documentcategory.label }}</a>
<ul class="p-3 list-sort">
{% if not documentcategory.childs is empty %}
{% for documentcategory in documentcategory.childs %}
{{ render(path("app_"~access~"_documentcategory_render",{id:documentcategory.id,access:access})) }}
{% endfor %}
{% endif %}
</ul>
</div>

View File

@ -5,13 +5,13 @@
'name' : 'CONFIGURATION', 'name' : 'CONFIGURATION',
'items' : [ 'items' : [
{ {
icon: 'fa fa-table', icon: 'fa fa-table fa-fw',
route: 'app_admin_config', route: 'app_admin_config',
name: 'Général', name: 'Général',
}, },
{ {
icon: 'fas fa-paint-brush', icon: 'fas fa-paint-brush fa-fw',
route: 'app_admin_theme', route: 'app_admin_theme',
name: 'Thème', name: 'Thème',
}, },
@ -19,46 +19,46 @@
}, },
{ {
'id': 'sidebar-organisation', 'id': 'sidebar-organisation',
'icon': 'fa fa-sitemap', 'icon': 'fa fa-sitemap fa-fw',
'name' : 'ORGANISATION', 'name' : 'ORGANISATION',
'items' : [ 'items' : [
{ {
icon: 'fa fa-building', icon: 'fa fa-building fa-fw',
route: 'app_admin_niveau01', route: 'app_admin_niveau01',
name: appNiveau01labels, name: appNiveau01labels,
}, },
{ {
icon: 'fa fa-sitemap', icon: 'fa fa-sitemap fa-fw',
route: 'app_admin_niveau02', route: 'app_admin_niveau02',
name: appNiveau02labels, name: appNiveau02labels,
}, },
{ {
icon: 'fas fa-store-alt', icon: 'fas fa-store-alt fa-fw',
route: 'app_admin_niveau03', route: 'app_admin_niveau03',
name: appNiveau03labels, name: appNiveau03labels,
}, },
{ {
icon: 'fas fa-monument', icon: 'fas fa-monument fa-fw',
route: 'app_admin_niveau04', route: 'app_admin_niveau04',
name: appNiveau04labels, name: appNiveau04labels,
}, },
{ {
icon: 'fa fa-users', icon: 'fa fa-users fa-fw',
route: 'app_admin_group', route: 'app_admin_group',
name: 'Groupes', name: 'Groupes',
}, },
{ {
icon: 'fa fa-child', icon: 'fa fa-child fa-fw',
route: 'app_admin_user', route: 'app_admin_user',
name: 'Utilisateurs', name: 'Utilisateurs',
}, },
{ {
icon: 'fa fa-edit', icon: 'fa fa-edit fa-fw',
route: 'app_admin_registration', route: 'app_admin_registration',
name: 'Inscriptions', name: 'Inscriptions',
}, },
{ {
icon: 'fa fa-tasks', icon: 'fa fa-tasks fa-fw',
route: 'app_admin_whitelist', route: 'app_admin_whitelist',
name: 'Listes Blanche', name: 'Listes Blanche',
}, },
@ -80,35 +80,47 @@
name: 'Pages', name: 'Pages',
}, },
{ {
icon: 'fa fa-desktop', icon: 'fa fa-desktop fa-fw',
route: 'app_admin_item', route: 'app_admin_item',
name: 'Items', name: 'Items',
}, },
{ {
icon: 'fa fa-bell', icon: 'fa fa-bell fa-fw',
route: 'app_admin_alert', route: 'app_admin_alert',
name: 'Annonces', name: 'Annonces',
}, },
{ {
icon: 'fa fa-bug', icon: 'fa fa-bug fa-fw',
route: 'app_admin_icon', route: 'app_admin_icon',
name: 'Icônes', name: 'Icônes',
}, },
] ]
}, },
{
'id': 'sidebar-document',
'icon': 'fa fa-file fa-fw',
'name' : 'DOCUMENTS',
'items' : [
{
icon: 'fa fa-cogs',
route: 'app_admin_documentcategory',
name: 'Catégories',
},
]
},
{ {
'id': 'sidebar-cron', 'id': 'sidebar-cron',
'icon': 'fa fa-wrench', 'icon': 'fa fa-wrench',
'name' : 'OUTILS', 'name' : 'OUTILS',
'items' : [ 'items' : [
{ {
icon: 'fa fa-cogs', icon: 'fa fa-cogs fa-fw',
route: 'app_admin_cron', route: 'app_admin_cron',
name: 'Cron Jobs', name: 'Cron Jobs',
}, },
{ {
icon: 'fas fa-star-of-life', icon: 'fas fa-star-of-life fa-fw',
route: 'app_rest', route: 'app_rest',
name: 'API', name: 'API',
}, },