This commit is contained in:
afornerot 2024-10-31 11:48:30 +01:00
parent 86c4296061
commit ad60b9372c
16 changed files with 323 additions and 129 deletions

View File

@ -212,12 +212,16 @@ app_illustration_view:
defaults: { _controller: App\Controller\IllustrationController:view }
#== Webzine ==================================================================================================
app_webzine:
path: /admin/webzine/list/{by}
app_admin_webzine:
path: /admin/webzine/list/{by}/{userid}
defaults: { _controller: App\Controller\WebzineController:list }
app_user_webzine:
path: /user/webzine/list
defaults: { _controller: App\Controller\WebzineController:listuser }
app_webzine_submit:
path: /admin/webzine/submit/{by}
path: /user/webzine/submit/{by}/{userid}
defaults: { _controller: App\Controller\WebzineController:submit }
app_webzine_update:
@ -228,18 +232,18 @@ app_webzine_delete:
path: /admin/webzine/delete/{id}/{by}
defaults: { _controller: App\Controller\WebzineController:delete }
app_webzine_view:
path: /webzine/view/{idcat}/{id}/{by}
defaults: { _controller: App\Controller\WebzineController:view }
app_webzine_crop:
path: /admin/webzine/crop/{type}/{reportinput}/{by}
path: /admin/webzine/crop/{type}/{reportinput}
defaults: { _controller: App\Controller\CropController:crop02 }
app_webzine_upload:
path: /admin/webzine/upload
defaults: { _controller: App\Controller\WebzineController:upload }
app_webzine_view:
path: /webzine/view/{idcat}/{id}/{by}
defaults: { _controller: App\Controller\WebzineController:view }
#== Link ===========================================================================================================
app_link:
path: /admin/link

View File

@ -67,6 +67,7 @@ class CategoryController extends AbstractController
$data->setAppthumbfilteropacity(100);
$data->setAppthumbfiltersepia(0);
// Permissions
if(!$this->getUser()->hasRole("ROLE_ADMIN")&&($by=="admin"||$by=="update")) {
return $this->redirectToRoute("app_home");
}
@ -104,7 +105,7 @@ class CategoryController extends AbstractController
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => true,
'usesidebar' => ($by=="admin" || $by=="update"),
$this->data => $data,
'mode' => 'submit',
'form' => $form->createView(),
@ -130,7 +131,7 @@ class CategoryController extends AbstractController
}
// Création du formulaire
$form = $this->createForm(Form::class,$data,array("mode"=>"update","by"=>$by,"user"=>$this->getUser()));
$form = $this->createForm(Form::class,$data,array("mode"=>"update","by"=>$by,"user"=>$em->getRepository("App:User")->find($data->getUser()->getId())));
// Récupération des data du formulaire
$form->handleRequest($request);
@ -157,7 +158,7 @@ class CategoryController extends AbstractController
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => true,
'usesidebar' => ($by=="admin" || $by=="update"),
$this->data => $data,
'mode' => 'update',
'form' => $form->createView(),

View File

@ -16,7 +16,7 @@ class HomeController extends AbstractController
$users = $em->getRepository("App:User")->findBy([],["pseudo"=>"ASC"]);
$illustrations = $em->getRepository("App:Illustration")->findBy([],["submittime"=>"DESC"]);
$links = $em->getRepository("App:Link")->findBy(["user"=>null]);
$webzines = $em->getRepository("App:Webzine")->findBy(["user"=>null], ['set' => 'ASC', 'order' => 'ASC']);
$webzines = $em->getRepository("App:Webzine")->findBy([],["submittime"=>"DESC"]);
return $this->render('Home/home.html.twig',[
"useheader" => false,

View File

@ -98,7 +98,7 @@ class IllustrationController extends AbstractController
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => false,
'usesidebar' => ($by=="admin" || $by=="update"),
$this->data => $data,
'mode' => 'submit',
'form' => $form->createView(),
@ -152,7 +152,7 @@ class IllustrationController extends AbstractController
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => false,
'usesidebar' => ($by=="admin" || $by=="update"),
$this->data => $data,
'mode' => 'update',
'form' => $form->createView(),

View File

@ -14,13 +14,14 @@ use App\Entity\Webzinepage as Webzinepage;
class WebzineController extends AbstractController
{
private $data = "webzine";
private $route = "app_webzine";
private $route = "app_admin_webzine";
private $render = "Webzine/";
private $entity = "App:Webzine";
public function list(Request $request)
public function list($by,$userid)
{
$em = $this->getDoctrine()->getManager();
if($by=="admin") {
$datas = $em->getRepository($this->entity)->findAll();
return $this->render($this->render.'list.html.twig',[
@ -29,41 +30,48 @@ class WebzineController extends AbstractController
"usesidebar" => true,
]);
}
else {
$datas = $em->getRepository($this->entity)->findBy(["user"=>$em->getRepository("App:User")->find($userid)]);
public function view($idcat,$id,Request $request)
{
$em = $this->getDoctrine()->getManager();
$webzine=$em->getRepository($this->entity)->find($idcat);
$page=$em->getRepository("App:Webzinepage")->find($id);
$sets=$em->getRepository($this->entity)->findBy(["set"=>$webzine->getSet()],["order"=>"ASC"]);
$datanext=$this->getDataAllNext($idcat,$id,$webzine);
$dataprev=$this->getDataAllPrev($idcat,$id,$webzine);
$pathinfo=pathinfo($page->getIllustration());
if(!$page) return $this->redirectToRoute('app_home');
return $this->render($this->render.'view.html.twig', array(
$this->data => $webzine,
"page" => $page,
"sets" => $sets,
"prev" => $dataprev,
"next" => $datanext,
"pathinfo" => $pathinfo,
"usemonocolor" => true,
));
return $this->render($this->render.'listrender.html.twig',[
$this->data."s" => $datas,
"by" => $by,
"userid" => $userid,
]);
}
}
public function listuser()
{
$em = $this->getDoctrine()->getManager();
public function submit($by, Request $request)
$datas = $em->getRepository($this->entity)->findByUser($this->getUser());
return $this->render($this->render.'listrender.html.twig',[
$this->data."s" => $datas,
"by" => "profil",
"userid" => $this->getUser()->getId(),
]);
}
public function submit($by, $userid, Request $request)
{
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data = new Entity();
// Permissions
if(!$this->getUser()->hasRole("ROLE_ADMIN")&&($by=="admin"||$by=="update")) {
return $this->redirectToRoute("app_home");
}
// Création du formulaire
$form = $this->createForm(Form::class,$data,array("mode"=>"submit"));
if($by=="admin"||$by=="update") {
$form = $this->createForm(Form::class,$data,array("mode"=>"submit","by"=>$by,"user"=>$em->getRepository("App:User")->find($userid)));
} else {
$userid=$this->getUser()->getId();
$form = $this->createForm(Form::class,$data,array("mode"=>"submit","by"=>$by,"user"=>$this->getUser()));
}
// Récupération des data du formulaire
$form->handleRequest($request);
@ -98,23 +106,31 @@ class WebzineController extends AbstractController
$em->persist($page);
$em->flush();
if($order==1) $firstpage=$page;
}
$em->flush();
// Retour à la liste
if($by=="console")
return $this->redirectToRoute($this->route);
if($by=="admin")
return $this->redirectToRoute($this->route,["by"=>$by,"userid"=>-1]);
elseif($by=="update")
return $this->redirectToRoute("app_user_update",["id"=>$data->getUser()->getId()]);
elseif($by=="profil")
return $this->redirectToRoute("app_user_profil");
else
return $this->redirectToRoute("app_home");
{
return $this->redirectToRoute("app_webzine_view",["by"=>"user","idcat"=>$data->getId(),"id"=>$page->getId()]);
}
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => false,
'usesidebar' => ($by=="admin" || $by=="update"),
$this->data => $data,
'mode' => 'submit',
'form' => $form->createView(),
'by' => $by,
'userid' => $userid,
]);
}
@ -123,13 +139,24 @@ class WebzineController extends AbstractController
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data=$em->getRepository($this->entity)->find($id);
if(!$data) return $this->redirectToRoute("app_home");
// Permission
if(!$this->getUser()->hasRole("ROLE_ADMIN")&&($by=="admin"||$by=="update")) {
return $this->redirectToRoute("app_home");
}
if($by!="admin"&&$by!="update") {
if($this->getUser()!=$data->getUser()&&!$this->getUser()->hasRole("ROLE_ADMIN"))
return $this->redirectToRoute("app_home");
}
$oldlstpages = array();
foreach($data->getWebzinepages() as $page){
$oldlstpages[] = $page->getIllustration();
}
// Création du formulaire
$form = $this->createForm(Form::class,$data,array("mode"=>"update"));
$form = $this->createForm(Form::class,$data,array("mode"=>"update","by"=>$by,"user"=>$em->getRepository("App:User")->find($data->getUser()->getId())));
// Récupération des data du formulaire
$form->handleRequest($request);
@ -184,21 +211,26 @@ class WebzineController extends AbstractController
$em->flush();
// Retour à l'webzine
if($by=="console")
return $this->redirectToRoute($this->route);
else
return $this->redirectToRoute($this->route.'_view',array("idcat"=>$data->getId(),"id"=> $data->getWebzinepages()[0]->getId()));
// Retour à la liste
if($by=="admin")
return $this->redirectToRoute($this->route,["by"=>$by,"userid"=>-1]);
elseif($by=="update")
return $this->redirectToRoute("app_user_update",["id"=>$data->getUser()->getId()]);
elseif($by=="profil")
return $this->redirectToRoute("app_user_profil");
elseif($by=="illustration")
return $this->redirectToRoute("app_webzine_view",["by"=>"user","idcat"=>$data->getId(),"id"=>$data->getWebzinepages()[0]->getId()]);
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => false,
'usesidebar' => ($by=="admin" || $by=="update"),
$this->data => $data,
'mode' => 'update',
'form' => $form->createView(),
'by' => $by,
'userid' => $data->getUser()->getId(),
]);
}
@ -207,6 +239,16 @@ class WebzineController extends AbstractController
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data=$em->getRepository($this->entity)->find($id);
if(!$data) return $this->redirectToRoute("app_home");
// Permission
if(!$this->getUser()->hasRole("ROLE_ADMIN")&&($by=="admin"||$by=="update")) {
return $this->redirectToRoute("app_home");
}
if($by!="admin"&&$by!="update") {
if($this->getUser()!=$data->getUser()&&!$this->getUser()->hasRole("ROLE_ADMIN"))
return $this->redirectToRoute("app_home");
}
// Controle avant suppression
$error=false;
@ -219,10 +261,14 @@ class WebzineController extends AbstractController
$em->flush();
// Retour à la liste
if($by=="console")
return $this->redirectToRoute($this->route);
else
return $this->redirectToRoute("app_home");
if($by=="admin")
return $this->redirectToRoute($this->route,["by"=>$by,"userid"=>-1]);
elseif($by=="update")
return $this->redirectToRoute("app_user_update",["id"=>$data->getUser()->getId()]);
elseif($by=="profil")
return $this->redirectToRoute("app_user_profil");
elseif($by=="illustration")
return $this->redirectToRoute("app_home_user",["userpseudo"=>$data->getUser()->getSlug()]);
}
}
@ -231,7 +277,31 @@ class WebzineController extends AbstractController
return $this->render($this->render.'upload.html.twig');
}
public function view($idcat,$id,$by,Request $request)
{
$em = $this->getDoctrine()->getManager();
$webzine=$em->getRepository($this->entity)->find($idcat);
$page=$em->getRepository("App:Webzinepage")->find($id);
$sets=$em->getRepository($this->entity)->findBy(["set"=>$webzine->getSet()],["order"=>"ASC"]);
$datanext=$this->getDataAllNext($idcat,$id,$webzine);
$dataprev=$this->getDataAllPrev($idcat,$id,$webzine);
$pathinfo=pathinfo($page->getIllustration());
if(!$page) return $this->redirectToRoute('app_home');
return $this->render($this->render.'view.html.twig', array(
$this->data => $webzine,
"page" => $page,
"sets" => $sets,
"prev" => $dataprev,
"next" => $datanext,
"pathinfo" => $pathinfo,
"usemonocolor" => true,
"by" => $by,
));
}
protected function getDataAllNext($idcat,$id,$webzine)
@ -342,6 +412,10 @@ class WebzineController extends AbstractController
}
if ($form->get('submit')->isClicked() && ($mode=="submit" || $mode=="update")) {
// On récupère les pages et on cacule ceux à ajouter ou à supprimer
$lstpages=array_filter(explode(",",$form->get("linkpages")->getData()));
if(empty($lstpages))
$form->addError(new FormError('Un webzine doit avoir au moins une page'));
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {

View File

@ -11,6 +11,9 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
class WebzineType extends AbstractType
{
@ -42,6 +45,28 @@ class WebzineType extends AbstractType
]
);
if($options["by"]=="admin") {
$builder->add('user',
EntityType::class, [
"class" => "App:User",
"label" => "Utilisateur",
"choice_label"=> "username",
]
);
}
else {
$builder->add('user',
EntityType::class, [
"class" => "App:User",
"label" => "Utilisateur",
"choice_label"=> "username",
'query_builder' => function (EntityRepository $er) use ($options): QueryBuilder {
return $er->createQueryBuilder('u')->where('u.id=:user')->setParameter('user',$options['user']->getId());
},
]
);
}
$builder->add('mode',
ChoiceType::class, [
"label" =>"Mode de visualisation des planches",
@ -62,6 +87,7 @@ class WebzineType extends AbstractType
]
);
$builder->add('linkpages',HiddenType::class, array("mapped" => false));
}
@ -70,6 +96,8 @@ class WebzineType extends AbstractType
$resolver->setDefaults(array(
'data_class' => 'App\Entity\Webzine',
'mode' => 'string',
'by' => 'string',
'user' => 'App\Entity\User'
));
}
}

View File

@ -53,18 +53,18 @@
{% set color = app.session.get('colorbgbodylight') %}
{% endif %}
<img id="config_value_img" src="{{asset("uploads/logo/"~config.value)}}" style="background-color: {{color}}; width:90px;height:90px; margin:auto;display:block;">
<a class="btn btn-info" style="width:90px" onClick="ModalLoad('extraLargeModal','Logo','{{ path('app_user_config_logo') }}');" title='Ajouter un Logo'>Modifier</a>
<img id="config_value_img" src="{{asset("uploads/logo/"~config.value)}}" style="background-color: {{color}}; width:90px;height:90px; margin:auto;display:block;">
</div>
{% elseif config.type=="hero" %}
<div style="margin:10px auto;">
<img id="config_value_img" src="{{asset("uploads/hero/"~config.value)}}" style="width:100%;margin:auto;display:block;">
<a class="btn btn-info" style="width:100%" onClick="ModalLoad('extraLargeModal','Carrousel','{{ path('app_crop01', {"type": "hero", "reportinput": "config_value" }) }}');" title='Ajouter une Bannière'>Modifier</a>
<img id="config_value_img" src="{{asset("uploads/hero/"~config.value)}}" style="width:100%;margin:auto;display:block;">
</div>
{% elseif config.type=="image" %}
<div style="margin:10px auto;">
<img id="config_value_img" src="{{asset("uploads/image/"~config.value)}}" style="width:100%;margin:auto;display:block;">
<a class="btn btn-info" style="width:100%" onClick="ModalLoad('extraLargeModal','Image','{{ path('app_crop01', {"type": "image", "reportinput": "config_value" }) }}');" title='Ajouter une Image'>Modifier</a>
<img id="config_value_img" src="{{asset("uploads/image/"~config.value)}}" style="width:100%;margin:auto;display:block;">
</div>
{% endif %}
{{ form_row(form.help) }}

View File

@ -77,7 +77,6 @@
{% endif %}
{% elseif config.type=="hero" %}
{%if not config.value is empty %}
qsdfqsdf
<img src="{{asset("uploads/hero/"~config.value)}}" style="max-width:100%">
{% endif %}
{% elseif config.type=="image" %}

View File

@ -329,7 +329,7 @@
{% set source="thumbori_"~page.illustration %}
{% set class=" grid-item-size-2 grid-item-size-page" %}
<a href="{{ path("app_webzine_view",{"idcat":webzine.id,"id":page.id}) }}">
<a href="{{ path("app_webzine_view",{"by":"home","idcat":webzine.id,"id":page.id}) }}">
<div id="webzine{{webzine.id}}" class="grid-item grid-item-size {{class}} cssfilter no-cache-bg" data-width="{{page.width}}" data-background-image="/{{ appAlias }}/uploads/webzine/{{source}}" data-height="{{page.height}}" style="height:auto;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/webzine/{{source}}");">
</div>
</a>
@ -359,6 +359,7 @@
</div>
<!-- ADDMODAL ------------------------------------------------------------------------------------------------------------------------------------------------------!-->
{% if app.user %}
<div id="addmodal" class="modal" tabindex="-1" role="dialog" style="z-index:100000">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
@ -369,15 +370,19 @@
</button>
</div>
<div class="modal-body">
<div class="modal-body" style="display:flex; flex-direction: column;">
<a href={{ path("app_illustration_submit",{"by":"user","userid":app.user.id}) }} class="btn btn-link" title="Créer une Illustration">
Ajouter une illustration
</a>
<a href={{ path("app_webzine_submit",{"by":"user","userid":app.user.id}) }} class="btn btn-link" title="Créer une Illustration">
Ajouter un Webzine
</a>
</div>
</div>
</div>
</div>
{% endif %}
{% endblock %}
{% block localjavascript %}

View File

@ -291,7 +291,7 @@
{% set source="thumbori_"~page.illustration %}
{% set class=" grid-item-size-2 grid-item-size-page" %}
<a href="{{ path("app_webzine_view",{"idcat":webzine.id,"id":page.id}) }}">
<a href="{{ path("app_webzine_view",{"idcat":webzine.id,"id":page.id,"by":"user"}) }}">
<div id="webzine{{webzine.id}}" class="grid-item grid-item-size {{class}} cssfilter no-cache-bg" data-width="{{page.width}}" data-background-image="/{{ appAlias }}/uploads/webzine/{{source}}" data-height="{{page.height}}" style="height:auto;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/webzine/{{source}}");">
</div>
</a>
@ -355,6 +355,7 @@
</div>
<!-- ADDMODAL ------------------------------------------------------------------------------------------------------------------------------------------------------!-->
{% if app.user %}
<div id="addmodal" class="modal" tabindex="-1" role="dialog" style="z-index:100000">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
@ -365,15 +366,19 @@
</button>
</div>
<div class="modal-body">
<div class="modal-body" style="display:flex; flex-direction: column;">
<a href={{ path("app_illustration_submit",{"by":"user","userid":app.user.id}) }} class="btn btn-link" title="Créer une Illustration">
Ajouter une illustration
</a>
<a href={{ path("app_webzine_submit",{"by":"user","userid":app.user.id}) }} class="btn btn-link" title="Créer une Illustration">
Ajouter un Webzine
</a>
</div>
</div>
</div>
</div>
{% endif %}
{% endblock %}
{% block localjavascript %}

View File

@ -35,7 +35,7 @@
</li>
<li>
<a href="{{path("app_webzine",{"by":"admin"})}}">
<a href="{{path("app_admin_webzine",{"by":"admin","userid":-1})}}">
<i class="fas fa-book-open fa-fw"></i> Webzine
</a>
</li>

View File

@ -173,6 +173,19 @@
{% endif %}
</div>
</div>
<div class="card mb-3">
<div class="card-header">
<i class="fa fa-pencil-alt fa-fw"></i> Webzine
</div>
<div class="card-body">
{% if mode=="profil" %}
{{ render(path("app_user_webzine")) }}
{% else %}
{{ render(path("app_admin_webzine",{by:mode,userid:user.id})) }}
{% endif %}
</div>
</div>
</div>
{% endif %}
</div>

View File

@ -20,10 +20,16 @@
{{ form_widget(form.submit) }}
{% if by=="console" %}
<a class="btn btn-secondary" href={{ path('app_webzine') }}>Annuler</a>
{% if by=="admin" %}
<a class="btn btn-secondary" href={{ path('app_admin_webzine',{'by':by,'userid':-1}) }}>Annuler</a>
{% elseif by=="update" %}
<a class="btn btn-secondary" href={{ path('app_user_update',{id:userid}) }}>Annuler</a>
{% elseif by=="profil" %}
<a class="btn btn-secondary" href={{ path('app_user_profil') }}>Annuler</a>
{% elseif by=="illustration" %}
<a class="btn btn-secondary" href={{ path('app_webzine_view',{'by':"user","idcat":webzine.id,"id":webzine.webzinepages[0].id}) }}>Annuler</a>
{% else %}
<a class="btn btn-secondary" href={{ path('app_home') }}>Annuler</a>
<a class="btn btn-secondary" href={{ path('app_home_user',{'userpseudo':app.user.pseudo}) }}>Annuler</a>
{% endif %}
{% if mode=="update" %}
@ -63,6 +69,7 @@
</div>
<div class="card-body">
{{ form_row(form.user) }}
{{ form_row(form.name) }}
{{ form_row(form.set) }}
{{ form_row(form.order) }}

View File

@ -5,7 +5,7 @@
WEBZINES
</h1>
<p><a class="btn btn-success" href={{ path('app_webzine_submit',{by:'console'}) }}>Ajouter</a></p>
<p><a class="btn btn-success" href={{ path('app_webzine_submit',{by:"admin",userid:-1}) }}>Ajouter</a></p>
<div class="card">
<div class="card-header">
@ -19,6 +19,7 @@ WEBZINES
<tr>
<th width="70px" class="no-sort">Action</th>
<th width="70px" class="no-sort">Miniature</th>
<th width="100px">Utilisateur</th>
<th width="100px">Serie</th>
<th>Nom</th>
</tr>
@ -27,9 +28,9 @@ WEBZINES
{% for webzine in webzines %}
<tr>
<td>
<a href="{{path("app_webzine_update",{id:webzine.id,by:'console'})}}"><i class="fa fa-file"></i></a>
<a href="{{path("app_webzine_update",{id:webzine.id,by:'admin'})}}"><i class="fa fa-file"></i></a>
{% if webzine.id >=0 %}
<a href="{{path("app_webzine_delete",{id:webzine.id,by:'console'})}}" data-method="delete" data-confirm="Êtes-vous sûr de vouloir supprimer cet enregistrement ?"><i class="fa fa-trash"></i></a>
<a href="{{path("app_webzine_delete",{id:webzine.id,by:'admin'})}}" data-method="delete" data-confirm="Êtes-vous sûr de vouloir supprimer cet enregistrement ?"><i class="fa fa-trash"></i></a>
{% endif %}
</td>
@ -41,6 +42,7 @@ WEBZINES
<div style="width:90px; height:{{ height }}px;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/webzine/{{source}}");">
{% endif %}
</td>
<td>{{ webzine.user.username }}</td>
<td>{{ webzine.set }} #{{ webzine.order| format_number({min_integer_digit:'2'})}}</td>
<td>{{ webzine.name }}</td>
</tr>

View File

@ -0,0 +1,51 @@
<p><a class="btn btn-success" href={{ path('app_webzine_submit',{by:by,userid:userid}) }}>Ajouter</a></p>
<div class="dataTable_wrapper">
<table class="table table-striped table-bordered table-hover" id="webzines" style="width:100%">
<thead>
<tr>
<th width="70px" class="no-sort">Action</th>
<th width="70px" class="no-sort">Miniature</th>
<th width="100px">Serie</th>
<th>Nom</th>
</tr>
</thead>
<tbody>
{% for webzine in webzines %}
<tr>
<td>
<a href="{{path("app_webzine_update",{id:webzine.id,by:by})}}"><i class="fa fa-file"></i></a>
{% if webzine.id >=0 %}
<a href="{{path("app_webzine_delete",{id:webzine.id,by:by})}}" data-method="delete" data-confirm="Êtes-vous sûr de vouloir supprimer cet enregistrement ?"><i class="fa fa-trash"></i></a>
{% endif %}
</td>
<td>
{% if not webzine.webzinepages is empty %}
{% set source="thumbori_"~webzine.webzinepages[0].illustration %}
{% set height=30*90/21 %}
<div style="width:90px; height:{{ height }}px;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/webzine/{{source}}");">
{% endif %}
</td>
<td>{{ webzine.set }} #{{ webzine.order| format_number({min_integer_digit:'2'})}}</td>
<td>{{ webzine.name }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<script>
$(document).ready(function() {
$('#webzines').DataTable({
columnDefs: [ { "targets": "no-sort", "orderable": false }, { "targets": "no-string", "type" : "num" } ],
responsive: true,
iDisplayLength: 10,
order: [[ 2, "desc" ]]
});
});
</script>

View File

@ -49,10 +49,10 @@
</style>
{% if not prev is empty %}
<a id="bigleft" href="{{ path("app_webzine_view",{"idcat":prev[0].webzine.id,"id":prev[0].id})}}"><i class="fas fa-chevron-left fa-3x"></i></a>
<a id="bigleft" href="{{ path("app_webzine_view",{"by":by,"idcat":prev[0].webzine.id,"id":prev[0].id})}}"><i class="fas fa-chevron-left fa-3x"></i></a>
{% endif %}
{% if not next is empty %}
<a id="bigright" href="{{ path("app_webzine_view",{"idcat":next[0].webzine.id,"id":next[0].id})}}"><i class="fas fa-chevron-right fa-3x"></i></a>
<a id="bigright" href="{{ path("app_webzine_view",{"by":by,"idcat":next[0].webzine.id,"id":next[0].id})}}"><i class="fas fa-chevron-right fa-3x"></i></a>
{% endif %}
<img style="display:none;" id="webzine_webzine_img" src="/{{ appAlias }}/uploads/webzine/{{page.illustration}}">
@ -60,12 +60,17 @@
<div class="container mb-5">
<div class="text-center menuview" style="font-size:25px">
{% if by=="home" %}
<a id="up" href="{{ path("app_home")}}#webzine{{webzine.id}}"><i class="fa fa-home" aria-hidden="true"></i></a>
{% else %}
<a id="up" href="{{ path("app_home_user",{userpseudo:webzine.user.slug})}}#webzine{{webzine.id}}"><i class="fa fa-home" aria-hidden="true"></i></a>
{% endif %}
<a download="{{ webzine.name }}-{{page.order}}.{{ pathinfo.extension }}" href="/{{ appAlias }}/uploads/webzine/{{page.illustration}}"><i class="fa fa-download" aria-hidden="true"></i></a>
{% if is_granted("ROLE_ADMIN") %}
<a id="update" href="{{ path("app_webzine_update",{"id":webzine.id})}}"><i class="fa fa-file" aria-hidden="true"></i></a>
<a id="delete" href="{{ path("app_webzine_delete",{"id":webzine.id})}}" data-method="delete" data-confirm="Êtes-vous sûr de vouloir supprimer cet entregistrement ?"><i class="fa fa-trash" aria-hidden="true"></i></a>
{% if is_granted("ROLE_ADMIN") or (is_granted("ROLE_USER") and webzine.user.id==app.user.id) %}
<a id="update" href="{{ path("app_webzine_update",{"by":"illustration","id":webzine.id})}}"><i class="fa fa-file" aria-hidden="true"></i></a>
<a id="delete" href="{{ path("app_webzine_delete",{"by":"illustration","id":webzine.id})}}" data-method="delete" data-confirm="Êtes-vous sûr de vouloir supprimer cet entregistrement ?"><i class="fa fa-trash" aria-hidden="true"></i></a>
{% endif %}
</div>
@ -76,7 +81,7 @@
{% for page in webzine.webzinepages %}
{% set height=30*90/21 %}
<a href="{{ path("app_webzine_view",{"idcat":webzine.id,"id":page.id}) }}">
<a href="{{ path("app_webzine_view",{"by":by,"idcat":webzine.id,"id":page.id}) }}">
<div style="display: inline-block; width:90px; height:{{height}}px;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/webzine/thumbori_{{page.illustration}}"></div>
</a>
{% endfor %}
@ -86,7 +91,7 @@
<h3 class="mt-3">Dans la même série</h3>
{% for set in sets %}
{% if not set.webzinepages is empty %}
<a href="{{ path("app_webzine_view",{"idcat":set.id,"id":set.webzinepages[0].id}) }}">
<a href="{{ path("app_webzine_view",{"by":by,"idcat":set.id,"id":set.webzinepages[0].id}) }}">
<div style="display: inline-block; width:90px; height:{{height}}px;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/webzine/thumbori_{{set.webzinepages[0].illustration}}"></div>
</a>
{% endif %}