multi user

This commit is contained in:
afornerot 2024-10-26 12:08:33 +02:00
parent ecfb7d82d4
commit b85d03f78c
26 changed files with 1310 additions and 240 deletions

View File

@ -39,8 +39,6 @@ security:
access_control:
- { path: ^/user, roles: [ROLE_ADMIN, ROLE_MODO, ROLE_MASTER, ROLE_USER] }
- { path: ^/master, roles: [ROLE_ADMIN, ROLE_MODO, ROLE_MASTER] }
- { path: ^/modo, roles: [ROLE_ADMIN, ROLE_MODO] }
- { path: ^/admin, roles: [ROLE_ADMIN] }
- { path: ^/user, roles: [ROLE_ADMIN, ROLE_USER] }
- { path: ^/config, roles: [ROLE_ADMIN] }

View File

@ -76,21 +76,29 @@ app_config:
defaults: { _controller: App\Controller\ConfigController:list }
app_config_render:
path: /admin/config/render/{category}
path: /admin/config/render/{mode}/{category}/{userid}
defaults: { _controller: App\Controller\ConfigController:listrender }
app_config_submit:
path: /admin/config/submit
defaults: { _controller: App\Controller\ConfigController:submit }
app_config_user_render:
path: /user/config/render/{mode}/{category}
defaults: { _controller: App\Controller\ConfigController:listuserrender }
app_config_update:
path: /admin/config/update/{id}
path: /admin/config/update/{mode}/{id}/{userid}
defaults: { _controller: App\Controller\ConfigController:update }
app_config_user_update:
path: /user/config/update/{mode}/{id}
defaults: { _controller: App\Controller\ConfigController:updateuser }
app_config_delete:
path: /admin/config/delete/{id}
path: /admin/config/delete/{mode}/{id}/{userid}
defaults: { _controller: App\Controller\ConfigController:delete }
app_config_user_delete:
path: /user/config/delete/{mode}/{id}
defaults: { _controller: App\Controller\ConfigController:deleteuser }
app_config_logo:
path: /admin/config/logo
defaults: { _controller: App\Controller\ConfigController:logo }
@ -124,10 +132,6 @@ app_user_profil:
path: /user/profil
defaults: { _controller: App\Controller\UserController:profil }
app_user_survey:
path: /user/surveys
defaults: { _controller: App\Controller\UserController:survey }
#== Group ========================================================================================================
app_group:
path: /admin/group
@ -250,3 +254,9 @@ app_webzine_upload:
app_slide:
path: /slide
defaults: { _controller: App\Controller\SlideController:slide }
#== Home USer==================================================================================================
app_home_user:
path: /{userpseudo}
defaults: { _controller: App\Controller\HomeController:user }

View File

@ -50,7 +50,7 @@ services:
app.session.init:
public: true
class: App\Service\sessionInit
arguments: ["@service_container","@doctrine.orm.entity_manager","@session",]
arguments: ["@doctrine.orm.entity_manager","@session",]
tags:
- { name: kernel.event_listener, event: kernel.request, method: onDomainParse }
@ -86,3 +86,8 @@ services:
tags:
- { name: twig.extension }
App\Service\UserSubscriber:
public: true
arguments: ["@doctrine.orm.entity_manager"]
tags:
- name: "doctrine.event_subscriber"

View File

@ -34,6 +34,7 @@ services:
- ./config:/app/config:delegated
- ./public/uploads:/app/public/uploads:delegated
- ./misc:/app/misc:delegated
- ./public/styles:/app/public/styles:delegated
adminer:
image: adminer

View File

@ -306,6 +306,39 @@ th.dt-center, td.dt-center { text-align: center; }
border:none;
}
.herousers {
position: absolute;
top: 100px;
flex-wrap: wrap;
left: 400px;
z-index: 10000;
display: flex;
}
.herousers h3 {
width:100%;
padding-left:15px;
}
.herouser {
padding:15px;
width:250px;
background-color: var(--colorbgbodydark);
margin:10px;
border-radius:5px;
text-align:center;
}
.herouser img {
width:80px;
height: 80px;
}
.herouser h4 {
font-size:16px;
margin-top:15px;
}
.heromenu {
padding-top: 30px;
font-size: 20px;
@ -338,7 +371,10 @@ th.dt-center, td.dt-center { text-align: center; }
width: 100%;
}
.herologo img {max-height:200px;}
.herologo img {
max-height:200px;
border-radius: 100%;
}
@media (max-width: 980px) {
.herobox { display: none; }
@ -347,7 +383,11 @@ th.dt-center, td.dt-center { text-align: center; }
.heromenu .facatmenu {display: none;}
.catmenu { display:none }
.heromenu .linkmenu {zoom:200%}
.herousers { top:315px; left:0px; width: 100%; justify-content: center; }
.herousers { text-align: center; }
.herousers h3{ padding-left: 0px; }
.herouser { width:170px}
.herouser img { width:50px;height:50px}
.herofloatmenu a {
font-size: 40px;
}
@ -392,7 +432,7 @@ th.dt-center, td.dt-center { text-align: center; }
border-bottom: 1px solid var(--colorftbodydark);
}
.foliomenu .logo { float:left; height:40px; margin-top:7px }
.foliomenu .logo { float:left; height:40px; margin-top:7px; border-radius: 100%; }
.foliomenu .avatar { height: 20px; margin: 3px 3px 0px 0px; width: 20px; }
.foliomenu div { padding: 10px; line-height:35px; float:left;}
.foliomenu a {

View File

@ -53,22 +53,14 @@ class AppInitCommand extends Command
$output->writeln('APP = Default Data');
// Création du compte admin si non existant
$this->insertUser("admin",$this->container->getParameter('appInitpwdadmin'),$this->appname,"Admin",$this->appmailnoreply,['ROLE_ADMIN'],"admin.jpg");
// Init Media
//$this->initMedia();
// Création d'une catégory par défaut
$this->insertCategory(-100,1,"Illustrations");
// colorbgbody = Couleur des fonds de page
$this->insertConfig(
1, // order
false, // customizable
"site", // category
"appname", // id
"Titre de votre site", // title
"", // value
$this->appname, // value
"string", // type,
true, // visible
true, // changeable
@ -79,10 +71,11 @@ class AppInitCommand extends Command
$this->insertConfig(
2, // order
true, // customizable
"site", // category
"appsubname", // id
"Sous-titre de votre site", // title
"", // value
"Portefolio", // value
"string", // type,
true, // visible
true, // changeable
@ -93,6 +86,7 @@ class AppInitCommand extends Command
$this->insertConfig(
3, // order
true, // customizable
"site", // category
"appdescription", // id
"Description de votre site", // title
@ -107,6 +101,7 @@ class AppInitCommand extends Command
$this->insertConfig(
4, // order
false, // customizable
"site", // category
"appthumbwidth", // id
"Largeur des miniatures", // title
@ -121,6 +116,7 @@ class AppInitCommand extends Command
$this->insertConfig(
5, // order
false, // customizable
"site", // category
"appthumbheight", // id
"Hauteur des miniatures", // title
@ -135,6 +131,7 @@ class AppInitCommand extends Command
$this->insertConfig(
6, // order
false, // customizable
"site", // category
"appthumbfilter", // id
"Filtre sur les miniatures", // title
@ -149,7 +146,8 @@ class AppInitCommand extends Command
$this->insertConfig(
7, // order
"site", // category
false, // customizable
"false", // category
"appthumbfiltergrayscale", // id
"Filtre grayscale sur les miniatures", // title
"100", // value
@ -163,6 +161,7 @@ class AppInitCommand extends Command
$this->insertConfig(
8, // order
false, // customizable
"site", // category
"appthumbfilteropacity", // id
"Filtre opacity sur les miniatures", // title
@ -177,6 +176,7 @@ class AppInitCommand extends Command
$this->insertConfig(
9, // order
false, // customizable
"site", // category
"appthumbfiltersepia", // id
"Filtre sepia sur les miniatures", // title
@ -192,6 +192,7 @@ class AppInitCommand extends Command
$this->insertConfig(
10, // order
false, // customizable
"site", // category
"appmaxthumbwidth", // id
"Largeur maximum de la grille des thumbs", // title
@ -207,6 +208,7 @@ class AppInitCommand extends Command
// colorbgbody = Couleur des fonds de page
$this->insertConfig(
1, // order
false, // customizable
"colorbgbody", // category
"colorbgbodydark", // id
"Couleur de fond fonçée", // title
@ -221,6 +223,7 @@ class AppInitCommand extends Command
$this->insertConfig(
2, // order
false, // customizable
"colorbgbody", // category
"colorbgbodylight", // id
"Couleur de fond claire", // title
@ -236,6 +239,7 @@ class AppInitCommand extends Command
// colorfttitle = Couleur des fontes titre
$this->insertConfig(
1, // order
false, // customizable
"colorfttitle", // category
"colorfttitledark", // id
"Couleur des titres sur fond fonçé", // title
@ -250,6 +254,7 @@ class AppInitCommand extends Command
$this->insertConfig(
2, // order
false, // customizable
"colorfttitle", // category
"colorfttitlelight", // id
"Couleur des titres sur fond claire", // title
@ -265,6 +270,7 @@ class AppInitCommand extends Command
// colorftbody = Couleur des fontes titre
$this->insertConfig(
1, // order
false, // customizable
"colorftbody", // category
"colorftbodydark", // id
"Couleur de la police sur fond fonçé", // title
@ -279,6 +285,7 @@ class AppInitCommand extends Command
$this->insertConfig(
2, // order
false, // customizable
"colorftbody", // category
"colorftbodylight", // id
"Couleur de la police sur fond claire", // title
@ -294,6 +301,7 @@ class AppInitCommand extends Command
// font = nom des polices
$this->insertConfig(
1, // order
false, // customizable
"font", // category
"fonttitle", // id
"Police pour les titres", // title
@ -308,6 +316,7 @@ class AppInitCommand extends Command
$this->insertConfig(
2, // order
false, // customizable
"font", // category
"fontbody", // id
"Police principale", // title
@ -323,10 +332,11 @@ class AppInitCommand extends Command
// logo =
$this->insertConfig(
1, // order
false, // customizable
"logo", // category
"logodark", // id
"Logo sur fond fonçé", // title
"", // value
"logo.png", // value
"logo", // type,
true, // visible
true, // changeable
@ -337,10 +347,11 @@ class AppInitCommand extends Command
$this->insertConfig(
2, // order
false, // customizable
"logo", // category
"logolight", // id
"Logo sur fond clair", // title
"", // value
"logo.png", // value
"logo", // type,
true, // visible
true, // changeable
@ -352,10 +363,11 @@ class AppInitCommand extends Command
// image =
$this->insertConfig(
1, // order
true, // customizable
"image", // category
"imgcontact", // id
"Image Contact", // title
"", // value
"contact.jpg", // value
"image", // type,
true, // visible
true, // changeable
@ -366,10 +378,11 @@ class AppInitCommand extends Command
$this->insertConfig(
1, // order
true, // customizable
"image", // category
"imglink", // id
"Image Liens", // title
"", // value
"link.jpg", // value
"image", // type,
true, // visible
true, // changeable
@ -381,10 +394,11 @@ class AppInitCommand extends Command
// hero =
$this->insertConfig(
1, // order
true, // customizable
"hero", // category
"hero01", // id
"Carrousel 01", // title
"", // value
"hero.jpg", // value
"hero", // type,
true, // visible
true, // changeable
@ -395,6 +409,7 @@ class AppInitCommand extends Command
$this->insertConfig(
2, // order
true, // customizable
"hero", // category
"hero02", // id
"Carrousel 02", // title
@ -409,6 +424,7 @@ class AppInitCommand extends Command
$this->insertConfig(
3, // order
true, // customizable
"hero", // category
"hero03", // id
"Carrousel 03", // title
@ -423,6 +439,7 @@ class AppInitCommand extends Command
$this->insertConfig(
4, // order
true, // customizable
"hero", // category
"hero04", // id
"Carrousel 04", // title
@ -437,6 +454,7 @@ class AppInitCommand extends Command
$this->insertConfig(
5, // order
true, // customizable
"hero", // category
"hero05", // id
"Carrousel 05", // title
@ -452,6 +470,7 @@ class AppInitCommand extends Command
// Social =
$this->insertConfig(
1, // order
false, // customizable
"social", // category
"email", // id
"Email", // title
@ -466,6 +485,7 @@ class AppInitCommand extends Command
$this->insertConfig(
2, // order
true, // customizable
"social", // category
"facebook", // id
"Facebook", // title
@ -480,6 +500,7 @@ class AppInitCommand extends Command
$this->insertConfig(
3, // order
true, // customizable
"social", // category
"instagram", // id
"Instagram", // title
@ -494,6 +515,7 @@ class AppInitCommand extends Command
$this->insertConfig(
4, // order
true, // customizable
"social", // category
"twitter", // id
"Twitter", // title
@ -508,6 +530,7 @@ class AppInitCommand extends Command
$this->insertConfig(
5, // order
true, // customizable
"social", // category
"google", // id
"Google", // title
@ -522,6 +545,7 @@ class AppInitCommand extends Command
$this->insertConfig(
6, // order
true, // customizable
"social", // category
"youtube", // id
"Youtube", // title
@ -534,6 +558,11 @@ class AppInitCommand extends Command
"Le Youtube du site"
);
// Création du compte admin si non existant
$this->insertUser("admin",$this->container->getParameter('appInitpwdadmin'),$this->appname,"Admin",$this->appmailnoreply,['ROLE_ADMIN'],"admin.jpg");
$output->writeln('');
return Command::SUCCESS;
@ -547,6 +576,7 @@ class AppInitCommand extends Command
$entity->setPassword($password);
$entity->setFirstname($firstname);
$entity->setLastname($lastname);
$entity->SetPseudo($username);
$entity->setEmail($email);
$entity->setRoles($roles);
$entity->setAvatar($avatar);
@ -557,41 +587,38 @@ class AppInitCommand extends Command
$this->em->flush();
}
protected function insertCategory($id,$order,$name) {
$metadata = $this->em->getClassMetaData('App:Category');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
protected function insertCategory($name) {
// Création du compte admin par défaut
$entity = $this->em->getRepository('App:Category')->find($id);
if(!$entity) {
$entity = new Category;
$entity->setId($id);
$entity->setOrder($order);
$entity->setName($name);
$entity->setUsecategoryconfig(false);
$entity->setAppthumbfilter(false);
$entity->setAppthumbheight(0);
$entity->setAppthumbwidth(0);
$entity->setAppthumbfilter(false);
$entity->setAppthumbfiltergrayscale(100);
$entity->setAppthumbfilteropacity(100);
$entity->setAppthumbfiltersepia(0);
$this->em->persist($entity);
$users=$this->em->getRepository('App:User')->findAll();
foreach($users as $user) {
$category=$entity = $this->em->getRepository('App:Category')->findOneBy(["user"=>$user]);
if(!$category) {
$category = new Category;
$category->setOrder(1);
$category->setName($name);
$category->setUsecategoryconfig(false);
$category->setAppthumbfilter(false);
$category->setAppthumbheight(0);
$category->setAppthumbwidth(0);
$category->setAppthumbfilter(false);
$category->setAppthumbfiltergrayscale(100);
$category->setAppthumbfilteropacity(100);
$category->setAppthumbfiltersepia(0);
$category->setUser($user);
$this->em->persist($category);
$this->em->flush();
}
}
// On flush
$this->em->flush();
}
private function insertConfig($order,$category,$id,$title,$value,$type,$visible,$changeable,$required,$grouped,$help) {
$entity=$this->em->getRepository("App:Config")->find($id);
private function insertConfig($order,$customizable,$category,$key,$title,$value,$type,$visible,$changeable,$required,$grouped,$help) {
$entity=$this->em->getRepository("App:Config")->findOneBy(["keyid"=>$key,"user"=>null]);
if(!$entity) {
$entity= new Config();
$entity->setId($id);
$entity->setValue($value);
$entity->setKeyid($key);
$entity->setUser(null);
}
$entity->setDefvalue($value);
$entity->setCategory($category);
$entity->setOrder($order);
$entity->setTitle($title);
@ -601,48 +628,12 @@ class AppInitCommand extends Command
$entity->setRequired($required);
$entity->setGrouped($grouped);
$entity->setHelp($help);
$entity->setCustomizable($customizable&&$changeable&&$visible);
$this->em->persist($entity);
$this->em->flush();
}
private function initMedia() {
// Initialiser Filesystem
$filesystem = new Filesystem();
$sourcePath = $this->container->getParameter('kernel.project_dir') . '/public/styles/medias';
$destinationPath = $this->container->getParameter('kernel.project_dir') . '/public/uploads';
echo "====================";
echo get_current_user();
// Vérifier si le répertoire existe
if (!$filesystem->exists($destinationPath."/logo")) {
$filesystem->mkdir($destinationPath,0777);
$filesystem->mkdir($destinationPath."/image",0777);
$filesystem->mkdir($destinationPath."/logo",0777);
$filesystem->mkdir($destinationPath."/avatar",0777);
$filesystem->mkdir($destinationPath."/hero",0777);
$filesystem->chown($destinationPath, 'apache');
$filesystem->chown($destinationPath."/image",'apache');
$filesystem->chown($destinationPath."/logo",'apache');
$filesystem->chown($destinationPath."/avatar",'apache');
$filesystem->chown($destinationPath."/hero",'apache');
}
/*
$filesystem->copy($sourcePath."/admin.jpg", $destinationPath."/avatar/");
$filesystem->copy($sourcePath."/noavatar.png", $destinationPath."/avatar/");
$filesystem->copy($sourcePath."/system.jpg", $destinationPath."/avatar/");
$filesystem->copy($sourcePath."/contact.jpg", $destinationPath."/image");
$filesystem->copy($sourcePath."/link.jpg", $destinationPath."/image");
$filesystem->copy($sourcePath."/hero.jpg", $destinationPath."/hero");
$filesystem->copy($sourcePath."/logo.png", $destinationPath."/logo");
*/
echo "====================";
}
private function writelnred($string) {
$this->output->writeln('<fg=red>'.$string.'</>');
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");

View File

@ -20,32 +20,53 @@ class ConfigController extends AbstractController
public function list()
{
$em = $this->getDoctrine()->getManager();
$datas = $em->getRepository($this->entity)->findBy(["visible"=>true]);
$datas = $em->getRepository($this->entity)->findBy(["visible"=>true,"user"=>null]);
return $this->render($this->render.'list.html.twig',[
$this->data."s" => $datas,
"useheader" => true,
"usesidebar" => true,
"mode" => "config",
]);
}
public function listrender($category)
public function listrender($mode,$category,$userid)
{
$em = $this->getDoctrine()->getManager();
$datas = $em->getRepository($this->entity)->findBy(["visible"=>true,"category"=>$category]);
$user=null;
if($userid) $user=$em->getRepository("App:User")->find($userid);
$datas = $em->getRepository($this->entity)->findBy(["visible"=>true,"category"=>$category,"user"=>$user]);
return $this->render($this->render.'render.html.twig',[
$this->data."s" => $datas,
"useheader" => true,
"usesidebar" => true,
"mode" => $mode,
"userid" => $userid,
]);
}
public function update($id,Request $request)
public function listuserrender($mode,$category)
{
$em = $this->getDoctrine()->getManager();
$datas = $em->getRepository($this->entity)->findBy(["visible"=>true,"category"=>$category,"user"=>$this->getUser()]);
return $this->render($this->render.'render.html.twig',[
$this->data."s" => $datas,
"useheader" => true,
"usesidebar" => true,
"mode" => $mode,
]);
}
public function update($mode,$id,$userid,Request $request)
{
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data=$em->getRepository($this->entity)->find($id);
$user=null;
if($mode!="config") $user=$em->getRepository("App:User")->find($userid);
$data=$em->getRepository($this->entity)->findOneBy(["id"=>$id,"user"=>$user]);
// Création du formulaire
$form = $this->createForm(Form::class,$data,array("mode"=>"update","id"=>$data->getId(),"type"=>$data->getType(),"required"=>$data->getRequired()));
@ -63,7 +84,12 @@ class ConfigController extends AbstractController
$em->flush();
// Retour à la liste
return $this->redirectToRoute($this->route);
if($mode!="config") {
return $this->redirectToRoute("app_user_update",["id"=>$userid]);
}
else {
return $this->redirectToRoute($this->route);
}
}
// Affichage du formulaire
@ -71,23 +97,76 @@ class ConfigController extends AbstractController
'useheader' => true,
'usesidebar' => true,
$this->data => $data,
'mode' => 'update',
'form' => $form->createView()
'mode' => $mode,
'form' => $form->createView(),
'userid' => $userid,
]);
}
public function delete($id,Request $request)
public function updateuser($mode,$id,Request $request)
{
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data=$em->getRepository($this->entity)->findOneBy(["id"=>$id,"user"=>$this->getUser()]);
// Création du formulaire
$form = $this->createForm(Form::class,$data,array("mode"=>"update","id"=>$data->getId(),"type"=>$data->getType(),"required"=>$data->getRequired()));
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm($id,$form,$request,$data,"update");
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$em->persist($data);
$em->flush();
// Retour à la liste
return $this->redirectToRoute("app_user_profil");
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => false,
$this->data => $data,
'mode' => $mode,
'form' => $form->createView(),
'userid' => $this->getUser()->getId(),
]);
}
public function delete($mode,$id,$userid,Request $request)
{
// Récupération de l'enregistrement courant
$em = $this->getDoctrine()->getManager();
$config=$em->getRepository($this->entity)->find($id);
if(!$config->getRequired()) {
$config->setValue("");
$em = $this->getDoctrine()->getManager();
$em->persist($config);
$em->flush();
$config=$em->getRepository($this->entity)->find(["id"=>$id]);
$config->setValue(null);
$em = $this->getDoctrine()->getManager();
$em->persist($config);
$em->flush();
// Retour à la liste
if($mode!="config") {
return $this->redirectToRoute("app_user_update",["id"=>$userid]);
}
return $this->redirectToRoute('app_config');
else {
return $this->redirectToRoute($this->route);
}
}
public function deleteuser($id,Request $request)
{
// Récupération de l'enregistrement courant
$em = $this->getDoctrine()->getManager();
$config=$em->getRepository($this->entity)->findOneBy(["id"=>$id,"user"=>$this->getUser()]);
$config->setValue(null);
$em = $this->getDoctrine()->getManager();
$em->persist($config);
$em->flush();
return $this->redirectToRoute('app_user_profil');
}
public function logo()

View File

@ -12,20 +12,47 @@ class HomeController extends AbstractController
public function home()
{
$em = $this->getDoctrine()->getManager();
$categorys = $em->getRepository("App:Category")->findAll();
$links = $em->getRepository("App:Link")->findAll();
$webzines = $em->getRepository("App:Webzine")->findBy([], ['set' => 'ASC', 'order' => 'ASC']);
$users = $em->getRepository("App:User")->findBy([],["pseudo"=>"ASC"]);
$categorys = $em->getRepository("App:Category")->findBy(["user"=>null]);
$links = $em->getRepository("App:Link")->findBy(["user"=>null]);
$webzines = $em->getRepository("App:Webzine")->findBy(["user"=>null], ['set' => 'ASC', 'order' => 'ASC']);
return $this->render('Home/home.html.twig',[
"useheader" => false,
"usesidebar" => false,
"usemonocolor" => true,
"users" => $users,
"categorys" => $categorys,
"links" => $links,
"webzines" => $webzines
]);
}
public function user($userpseudo)
{
$em = $this->getDoctrine()->getManager();
$user=$em->getRepository("App:User")->findOneBy(["slug"=>$userpseudo]);
if(!$user) return $this->redirectToRoute("app_home");
$categorys = $em->getRepository("App:Category")->findBy(["user"=>$user]);
$links = $em->getRepository("App:Link")->findBy(["user"=>$user]);
$webzines = $em->getRepository("App:Webzine")->findBy(["user"=>$user], ['set' => 'ASC', 'order' => 'ASC']);
$config = $em->getRepository("App:Config")->getUserConfig($user);
return $this->render('Home/user.html.twig',[
"useheader" => false,
"usesidebar" => false,
"usemonocolor" => true,
"user" => $user,
"config" => $config,
"categorys" => $categorys,
"links" => $links,
"webzines" => $webzines
]);
}
public function feed($nb)
{
$feeds=[];

View File

@ -82,6 +82,7 @@ class SecurityController extends AbstractController
$user->setUsername($username);
$user->setLastname($lastname);
$user->setFirstname($firstname);
$user->setPseudo($username);
$user->setEmail($email);
$user->setPassword("CASPWD-".$username);

View File

@ -157,7 +157,7 @@ class UserController extends AbstractController
$em->flush();
// Retour à la liste
return $this->redirectToRoute("app_home");
return $this->redirectToRoute("app_home_user",["userpseudo"=>$data->getPseudo()]);
}
// Affichage du formulaire

View File

@ -66,6 +66,11 @@ class Category
*/
private $appthumbfiltersepia;
/**
* @ORM\ManyToOne(targetEntity="User")
*/
private $user;
/**
* @ORM\OneToMany(targetEntity="Illustration", mappedBy="category", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"id" = "DESC"})
@ -227,4 +232,16 @@ class Category
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
}

View File

@ -7,15 +7,22 @@ use Doctrine\ORM\Mapping as ORM;
/**
* Cron
*
* @ORM\Table(name="config")
* @ORM\Table(name="config",uniqueConstraints={@ORM\UniqueConstraint(name="configkeyid", columns={"keyid","user_id"})})
* @ORM\Entity(repositoryClass="App\Repository\ConfigRepository")
*/
class Config
{ /**
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\Column(type="string")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
private $id;
/**
* @ORM\Column(type="string", length=250)
*/
protected $keyid;
/**
* @ORM\Column(type="string", length=250)
@ -23,10 +30,15 @@ class Config
protected $title;
/**
* @ORM\Column(type="text")
* @ORM\Column(type="text", nullable=true)
*/
protected $value;
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $defvalue;
/**
* @ORM\Column(name="roworder", type="string")
*/
@ -67,30 +79,69 @@ class Config
*/
protected $help;
public function getId(): ?string
/**
* @ORM\Column(type="boolean")
*/
protected $customizable;
/**
* @ORM\ManyToOne(targetEntity="User")
*/
private $user;
public function getId(): ?int
{
return $this->id;
}
public function setId(string $id): self
public function getKeyid(): ?string
{
$this->id = $id;
return $this->keyid;
}
public function setKeyid(string $keyid): self
{
$this->keyid = $keyid;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getValue(): ?string
{
return $this->value;
return ($this->value?$this->value:($this->user?null:$this->defvalue));
}
public function setValue(string $value): self
public function setValue(?string $value): self
{
$this->value = $value;
return $this;
}
public function getDefvalue(): ?string
{
return $this->defvalue;
}
public function setDefvalue(?string $defvalue): self
{
$this->defvalue = $defvalue;
return $this;
}
public function getOrder(): ?string
{
return $this->order;
@ -187,14 +238,26 @@ class Config
return $this;
}
public function getTitle(): ?string
public function getCustomizable(): ?bool
{
return $this->title;
return $this->customizable;
}
public function setTitle(string $title): self
public function setCustomizable(bool $customizable): self
{
$this->title = $title;
$this->customizable = $customizable;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}

View File

@ -36,6 +36,11 @@ class Link
*/
protected $url;
/**
* @ORM\ManyToOne(targetEntity="User")
*/
private $user;
public function getId(): ?int
{
return $this->id;
@ -77,4 +82,16 @@ class Link
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
}

View File

@ -14,7 +14,9 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
*
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
* @ORM\Table(name="user",uniqueConstraints={@ORM\UniqueConstraint(name="username", columns={"username"})})
* @ORM\Table(name="user",uniqueConstraints={@ORM\UniqueConstraint(name="pseudo", columns={"pseudo"})})
* @UniqueEntity("username", message="Ce nom d'utilisateur existe dèja")
* @UniqueEntity("pseudo", message="Ce pseudo d'utilisateur existe dèja")
*/
class User implements UserInterface, \Serializable
@ -65,6 +67,16 @@ class User implements UserInterface, \Serializable
private $lastname;
private $displayname;
/**
* @ORM\Column(type="string", length=250)
*/
private $pseudo;
/**
* @ORM\Column(type="string", length=250)
*/
private $slug;
/**
* @ORM\Column(type="string", length=200, nullable=true, options={"default" : 0})
*/
@ -84,11 +96,29 @@ class User implements UserInterface, \Serializable
*/
private $groups;
/**
* @ORM\OneToMany(targetEntity="Category", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true)
*/
private $illustrations;
/**
* @ORM\OneToMany(targetEntity="Webzine", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true)
*/
private $webzines;
/**
* @ORM\OneToMany(targetEntity="Link", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true)
*/
private $links;
public function __construct()
{
$this->groups = new ArrayCollection();
$this->surveys = new ArrayCollection();
$this->guests = new ArrayCollection();
$this->illustrations = new ArrayCollection();
$this->webzines = new ArrayCollection();
$this->links = new ArrayCollection();
}
public function getUsername(): ?string
@ -267,4 +297,120 @@ class User implements UserInterface, \Serializable
return $this;
}
/**
* @return Collection|Category[]
*/
public function getIllustrations(): Collection
{
return $this->illustrations;
}
public function addIllustration(Category $illustration): self
{
if (!$this->illustrations->contains($illustration)) {
$this->illustrations[] = $illustration;
$illustration->setUser($this);
}
return $this;
}
public function removeIllustration(Category $illustration): self
{
if ($this->illustrations->removeElement($illustration)) {
// set the owning side to null (unless already changed)
if ($illustration->getUser() === $this) {
$illustration->setUser(null);
}
}
return $this;
}
/**
* @return Collection|Webzine[]
*/
public function getWebzines(): Collection
{
return $this->webzines;
}
public function addWebzine(Webzine $webzine): self
{
if (!$this->webzines->contains($webzine)) {
$this->webzines[] = $webzine;
$webzine->setUser($this);
}
return $this;
}
public function removeWebzine(Webzine $webzine): self
{
if ($this->webzines->removeElement($webzine)) {
// set the owning side to null (unless already changed)
if ($webzine->getUser() === $this) {
$webzine->setUser(null);
}
}
return $this;
}
/**
* @return Collection|Link[]
*/
public function getLinks(): Collection
{
return $this->links;
}
public function addLink(Link $link): self
{
if (!$this->links->contains($link)) {
$this->links[] = $link;
$link->setUser($this);
}
return $this;
}
public function removeLink(Link $link): self
{
if ($this->links->removeElement($link)) {
// set the owning side to null (unless already changed)
if ($link->getUser() === $this) {
$link->setUser(null);
}
}
return $this;
}
public function getPseudo(): ?string
{
return $this->pseudo;
}
public function setPseudo(?string $pseudo): self
{
$this->pseudo = $pseudo;
$pseudo=strtolower($pseudo);
if($pseudo=="admin"||$pseudo=="user"||$pseudo=="feed"||$pseudo=="_uploader") $pseudo.="home";
$this->slug = $pseudo;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
}

View File

@ -51,6 +51,11 @@ class Webzine
*/
private $mode;
/**
* @ORM\ManyToOne(targetEntity="User")
*/
private $user;
/**
* @ORM\OneToMany(targetEntity="Webzinepage", mappedBy="webzine", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"order" = "ASC"})
@ -169,4 +174,16 @@ class Webzine
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
}

View File

@ -21,7 +21,7 @@ class ConfigType extends AbstractType
array("label" => "Valider",
"attr" => array("class" => "btn btn-success")));
$builder->add('id',
$builder->add('keyid',
TextType::class,
array("label" =>"Clé",
"label_attr" => array("style" => 'margin-top:15px;'),

View File

@ -42,11 +42,15 @@ class UserType extends AbstractType
]
);
$builder->add('pseudo',
TextType::class, [
"label" =>"Pseudo",
]
);
if($options["mode"]!="profil") {
$choices=[];
$choices['Administrateur']='ROLE_ADMIN';
$choices['Modérateur']='ROLE_MODO';
$choices['Master']='ROLE_MASTER';
$choices['Utilisateur']='ROLE_USER';
$builder->add('roles',

View File

@ -3,6 +3,7 @@
namespace App\Repository;
use App\Entity\Config;
use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Persistence\ManagerRegistry;
@ -12,4 +13,28 @@ class ConfigRepository extends ServiceEntityRepository
{
parent::__construct($registry, Config::class);
}
public function getUserConfig(User $user): array {
$tbconfig=[];
$custos=$this->_em->getRepository('App:Config')->findBy(["user"=>$user]);
foreach($custos as $custo) {
if($custo->getValue()) {
$tbcusto[$custo->getKeyid()]=$custo->getValue();
}
else {
// On va prendre la valeur global pour les category hero et image
if($custo->getCategory()=="image"||$custo->getCategory()=="hero") {
$config=$this->_em->getRepository('App:Config')->findOneBy(["keyid"=>$custo->getKeyid(),"user"=>null]);
if($config) {
$tbcusto[$custo->getKeyid()]=$config->getValue();
}
}
// Sinon clé vide
else {
$tbcusto[$custo->getKeyid()]=null;
}
}
}
return $tbcusto;
}
}

108
src/Service/UserSubscriber.php Executable file
View File

@ -0,0 +1,108 @@
<?php
namespace App\Service;
use App\Entity\User;
use App\Entity\UserGroup;
use App\Entity\Category;
use App\Entity\Config;
use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Events;
use Doctrine\Persistence\Event\LifecycleEventArgs;
use Ramsey\Uuid\Uuid;
class UserSubscriber implements EventSubscriberInterface
{
private $em;
private $user;
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
}
public function getSubscribedEvents(): array
{
return [
Events::postPersist,
Events::postUpdate,
];
}
public function postPersist(LifecycleEventArgs $args): void
{
$this->upinsertUser($args);
}
public function postUpdate(LifecycleEventArgs $args): void
{
$this->upinsertUser($args);
}
private function upinsertUser(LifecycleEventArgs $args): void {
$this->user = $args->getObject();
if (!$this->user instanceof User) {
return;
}
// On s'assure que le user a au moins une category d'illustration
$this->insertCategory();
// On initialise l'ensemble des config customizable
$this->insertConfig();
}
private function insertCategory(): void {
$user=$this->user;
$category=$entity = $this->em->getRepository('App:Category')->findOneBy(["user"=>$this->user]);
if(!$category) {
$category = new Category;
$category->setOrder(1);
$category->setName("Illustrations");
$category->setUsecategoryconfig(false);
$category->setAppthumbfilter(false);
$category->setAppthumbheight(0);
$category->setAppthumbwidth(0);
$category->setAppthumbfilter(false);
$category->setAppthumbfiltergrayscale(100);
$category->setAppthumbfilteropacity(100);
$category->setAppthumbfiltersepia(0);
$category->setUser($this->user);
$this->em->persist($category);
$this->em->flush();
$this->user=$user;
}
dump($this->user);
}
private function insertConfig(): void {
$user=$this->user;
$configs=$entity = $this->em->getRepository('App:Config')->findBy(["user"=>null,"customizable"=>true]);
foreach($configs as $config) {
$custo=$this->em->getRepository('App:Config')->findBy(["user"=>$user,"keyid"=>$config->getKeyid()]);
if(!$custo) {
$custo=new Config;
$custo->setKeyid($config->getKeyid());
$custo->setValue(null);
$custo->setDefvalue(null);
$custo->setCategory($config->getCategory());
$custo->setOrder($config->getOrder());
$custo->setTitle($config->getTitle());
$custo->setType($config->getType());
$custo->setVisible($config->getVisible());
$custo->setChangeable($config->getChangeable());
$custo->setRequired($config->getRequired());
$custo->setGrouped($config->getGrouped());
$custo->setHelp($config->getHelp());
$custo->setCustomizable($config->getCustomizable());
$custo->setUser($user);
$this->em->persist($custo);
$this->em->flush();
$this->user=$user;
}
}
}
}

View File

@ -1,60 +1,25 @@
<?php
namespace App\Service;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpFoundation\Session\Session;
use Doctrine\ORM\EntityManager;
class sessionInit {
private $container;
protected $em;
protected $session;
public function __construct(ContainerInterface $container, EntityManager $em,Session $session)
public function __construct(EntityManager $em, Session $session)
{
$this->container = $container;
$this->session = $session;
$this->em = $em;
}
public function onDomainParse(RequestEvent $event) {
$configs = $this->em->getRepository("App:Config")->findAll();
$havehero=false;
public function onDomainParse(RequestEvent $event): void
{
$configs = $this->em->getRepository("App:Config")->findBy(["user"=>null]);
foreach($configs as $config) {
if($config->getCategory()=="hero" && $config->getValue()!="") $havehero=true;
$this->session->set($config->getId(), strval($config->getValue()));
$this->session->set($config->getKeyid(), strval($config->getValue()));
}
// Valeur par défaut appname
if($this->session->get("appname")=="")
$this->session->set("appname", $this->container->getParameter('appName'));
// Valeur par defaut hero
if(!$havehero) $this->session->set("hero01", "hero.jpg");
// Valeur par defaut logo
if($this->session->get("logodark")==""&&$this->session->get("logolight")=="") {
$this->session->set("logodark", "logo.png");
$this->session->set("logolight", "logo.png");
}
elseif($this->session->get("logodark")=="")
$this->session->set("logodark", $this->session->get("logolight"));
elseif($this->session->get("logolight")=="")
$this->session->set("logolight", $this->session->get("logodark"));
// Valeur par défaut imgcontact
if($this->session->get("imgcontact")=="")
$this->session->set("imgcontact", "contact.jpg");
// Valeur par défaut imglink
if($this->session->get("imglink")=="")
$this->session->set("imglink", "link.jpg");
// Calcul des couleurs
/*
$color = $this->container->get('cadoles.core.service.color');
$color->setColor();
*/
}
}

View File

@ -3,24 +3,17 @@
{% block body %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
Modification CONFIGURATION
{% elseif mode=="submit" %}
Création CONFIGURATION
{% endif %}
</h1>
{{ form_widget(form.submit) }}
<a class="btn btn-secondary" href={{ path('app_config') }}>Annuler</a>
{% if mode=="update" and not config.required %}
<a href="{{ path('app_config_delete',{'id':config.id}) }}"
class="btn btn-danger float-right"
data-method="delete"
data-confirm="Êtes-vous sûr de vouloir supprimer cet entregistrement ?">
Supprimer
</a>
{% if mode=="profil" %}
<a class="btn btn-secondary" href={{ path('app_user_profil') }}>Annuler</a>
{% elseif mode=="update" %}
<a class="btn btn-secondary" href={{ path('app_user_update',{id:userid}) }}>Annuler</a>
{% else %}
<a class="btn btn-secondary" href={{ path('app_config') }}>Annuler</a>
{% endif %}
<br><br>
@ -49,7 +42,7 @@
</div>
<div class="card-body">
{{ form_row(form.id) }}
{{ form_row(form.keyid) }}
{{ form_row(form.value) }}
{% if config.type=="logo" %}
<div style="width:90px; margin:10px auto;">

View File

@ -9,43 +9,43 @@ CONFIGURATIONS
<div class="row mt-4">
<div class="col-md-12">
<h3>Générale</h3>
{{ render(path("app_config_render",{category:"site"})) }}
{{ render(path("app_config_render",{mode:mode,category:"site",userid:-1})) }}
</div>
<div class="col-md-6">
<h3>Couleurs des fonds de page</h3>
{{ render(path("app_config_render",{category:"colorbgbody"})) }}
{{ render(path("app_config_render",{mode:mode,category:"colorbgbody",userid:-1})) }}
</div>
<div class="col-md-6">
<h3>Polices</h3>
{{ render(path("app_config_render",{category:"font"})) }}
{{ render(path("app_config_render",{mode:mode,category:"font",userid:-1})) }}
</div>
<div class="col-md-6">
<h3>Couleurs des titres </h3>
{{ render(path("app_config_render",{category:"colorfttitle"})) }}
{{ render(path("app_config_render",{mode:mode,category:"colorfttitle",userid:-1})) }}
</div>
<div class="col-md-6">
<h3>Couleurs de la police </h3>
{{ render(path("app_config_render",{category:"colorftbody"})) }}
{{ render(path("app_config_render",{mode:mode,category:"colorftbody",userid:-1})) }}
</div>
<div class="col-md-6">
<h3>Logo</h3>
{{ render(path("app_config_render",{category:"logo"})) }}
{{ render(path("app_config_render",{mode:mode,category:"logo",userid:-1})) }}
<h3>Social</h3>
{{ render(path("app_config_render",{category:"social"})) }}
{{ render(path("app_config_render",{mode:mode,category:"social",userid:-1})) }}
</div>
<div class="col-md-6">
<h3>Carrousel</h3>
{{ render(path("app_config_render",{category:"hero"})) }}
{{ render(path("app_config_render",{mode:mode,category:"hero",userid:-1})) }}
<h3>Image</h3>
{{ render(path("app_config_render",{category:"image"})) }}
{{ render(path("app_config_render",{mode:mode,category:"image",userid:-1})) }}
</div>
</div>

View File

@ -13,11 +13,13 @@
<tr>
<td width="70px">
{% if config.changeable %}
<a href="{{path("app_config_update",{id:config.id})}}"><i class="fa fa-file"></i></a>
{% endif %}
{% if not config.required %}
<a href="{{path("app_config_delete",{id:config.id})}}"><i class="fa fa-trash"></i></a>
{% if mode=="profil" %}
<a href="{{path("app_config_user_update",{mode:mode,id:config.id})}}"><i class="fa fa-file"></i></a>
<a href="{{path("app_config_user_delete",{mode:mode,id:config.id})}}"><i class="fa fa-trash"></i></a>
{% else %}
<a href="{{path("app_config_update",{mode:mode,id:config.id,userid:userid})}}"><i class="fa fa-file"></i></a>
<a href="{{path("app_config_delete",{mode:mode,id:config.id,userid:userid})}}"><i class="fa fa-trash"></i></a>
{% endif %}
{% endif %}
</td>
<td width="50%">{{config.title}}</td>

View File

@ -76,9 +76,6 @@
<a href={{ path("app_illustration") }} class="btn btn-link" title="Configuration">
<i class="fa fa-cog fa-fw"></i>
</a>
<a href="/arnocompta" class="btn btn-link" title="Compta">
<i class="fas fa-euro-sign fa-fw"></i>
</a>
<a href={{ path("app_illustration_submit") }} class="btn btn-link" title="Créer une Illustration">
<i class="fa fa-paint-brush fa-fw"></i>
</a>
@ -131,9 +128,6 @@
<a href={{ path("app_illustration") }} class="btn btn-link" title="Configuration">
<i class="fa fa-cog fa-fw"></i>
</a>
<a href="/arnocompta" class="btn btn-link" title="Compta">
<i class="fas fa-euro-sign fa-fw"></i>
</a>
<a href={{ path("app_illustration_submit") }} class="btn btn-link" title="Créer une Illustration">
<i class="fa fa-paint-brush fa-fw"></i>
</a>
@ -149,15 +143,13 @@
</div>
<div class="herobox"></div>
<div class="herotitle">
<h1>{{ app.session.get("appname") }}</h1>
<h1>{{ (app.session.get("appname")) }}</h1>
<div class="heromenu" >
{% if not app.session.get("appsubname") is empty %}
<i style="font-size:80%;">{{ app.session.get("appsubname") }}</i><br>
{% endif %}
<div class="linkmenu" style="clear:both">
{% if app.session.get('email') is not empty %}
<a href="mailto:{{ app.session.get('email') }}" target="_blank" title="Email"><i class="fas fa-envelope fa-2x"></i></a>
@ -180,22 +172,38 @@
<a href="{{ path("app_feed") }}" target="_blank" title="RSS"><i class="fa fa-rss-square fa-2x"></i></a>
</div>
<div class="catmenu">
{% for category in categorys|sort((a, b) => a.order <=> b.order) %}
{% if not category.illustrations is empty %}
<a href="#{{ category.name }}"><i class="fa fa-arrow-circle-right fa-fw facatmenu"></i> {{category.name}}</a><br>
{% endif %}
{% endfor %}
{% if not webzines is empty %}
<a href="#webzine"><i class="fa fa-arrow-circle-right fa-fw facatmenu"></i> Webzines</a><br>
<a href="#webzine"><i class="fa fa-arrow-circle-right fa-fw facatmenu"></i> Webzines</a><br>
{% endif %}
<a href="#link"><i class="fa fa-arrow-circle-right fa-fw facatmenu"></i> Liens</a><br>
{% if not links is empty %}
<a href="#link"><i class="fa fa-arrow-circle-right fa-fw facatmenu"></i> Liens</a><br>
{% endif %}
<a href="#contact"><i class="fa fa-arrow-circle-right fa-fw facatmenu"></i> Contact</a><br>
</div>
</div>
</div>
<div class="herousers">
<h3>Membres</h3>
{% for user in users %}
<div class="herouser">
<a href="{{path("app_home_user",{userpseudo:user.slug})}}">
<img src="/{{ appAlias }}/uploads/avatar/{{ user.avatar }}" class="avatar"><br>
<h4>{{user.pseudo}}</h4>
</a>
</div>
{% endfor %}
</div>
<div class="herologo">
<img src="/{{ appAlias }}/uploads/logo/{{ app.session.get('logodark') }}">
</div>
@ -267,7 +275,6 @@
{% endfor %}
<!-- WEBZINE ------------------------------------------------------------------------------------------------------------------------------------------------------!-->
{% if not webzines is empty %}
<div id="webzine" class="grid-item grid-item-full"><h1 class="mt-5">Webzines</h1></div>
{% endif %}
@ -293,16 +300,18 @@
{% endfor %}
<!-- LINK ------------------------------------------------------------------------------------------------------------------------------------------------------!-->
<div id="link" class="grid-item grid-item-full"><h1 class="mt-5">Liens</h1></div>
{% if not webzines is empty %}
<div id="link" class="grid-item grid-item-full"><h1 class="mt-5">Liens</h1></div>
<div class="grid-item grid-item-size grid-item-size-3 grid-item-size-square cssfilter" style="height:200px;background-position: center; background-size: cover; background-image: url(/{{ appAlias }}/uploads/image/{{ app.session.get("imglink")}});">
</div>
<div class="grid-item grid-item-size grid-item-size-3 grid-item-size-square cssfilter" style="height:200px;background-position: center; background-size: cover; background-image: url(/{{ appAlias }}/uploads/image/{{ app.session.get("imglink")}});">
</div>
<div class="grid-item grid-item-size grid-item-size-6 grid-item-size-noresize linkurl" style="padding:0px 15px;">
{% for link in links|sort((a, b) => a.order <=> b.order) %}
<a href="{{link.url}}" target="_blank">{{ link.name }}</a>
{% endfor %}
</div>
<div class="grid-item grid-item-size grid-item-size-6 grid-item-size-noresize linkurl" style="padding:0px 15px;">
{% for link in links|sort((a, b) => a.order <=> b.order) %}
<a href="{{link.url}}" target="_blank">{{ link.name }}</a>
{% endfor %}
</div>
{% endif %}
<!-- CONTACT ------------------------------------------------------------------------------------------------------------------------------------------------------!-->
<div id="contact" class="grid-item grid-item-full"><h1 class="mt-5">Contact</h1></div>

View File

@ -0,0 +1,496 @@
{% extends "base.html.twig" %}
{% block localstyle %}
#main {
padding: 0px;
display:none;
margin-bottom:200px;
}
{% if app.session.get("appthumbfilter")=="1" %}
.cssfilter {
filter: grayscale({{app.session.get("appthumbfiltergrayscale")}}%) opacity({{app.session.get("appthumbfilteropacity")}}%) sepia({{app.session.get("appthumbfiltersepia")}}%);
transition: -webkit-filter 0.1s;
}
.cssfilter:hover {
filter: unset;
-webkit-filter: unset;
-moz-filter: unset;
-o-filter: unset;
-ms-filter: unset;
-webkit-transition: -webkit-filter 0.1s;
transition: -webkit-filter 0.1s;
}
{% endif %}
{% for category in categorys|sort((a, b) => a.order <=> b.order) %}
{% if category.usecategoryconfig and category.appthumbfilter %}
.cssfilter-{{category.id}} {
filter: grayscale({{category.appthumbfiltergrayscale}}%) opacity({{category.appthumbfilteropacity}}%) sepia({{category.appthumbfiltersepia}}%);
transition: -webkit-filter 0.1s;
}
.cssfilter-{{category.id}}:hover {
filter: unset;
-webkit-filter: unset;
-moz-filter: unset;
-o-filter: unset;
-ms-filter: unset;
-webkit-transition: -webkit-filter 0.1s;
transition: -webkit-filter 0.1s;
}
{% endif %}
{% endfor %}
{% endblock %}
{% block body %}
<!-- FOLIOMENU -----------------------------------------------------------------------------------------------------------------------------------------------!-->
<div class="foliomenu">
<a href="#top"><img src="/{{ appAlias }}/uploads/avatar/{{ user.avatar }}" class="logo"></a>
<div>
<i class="fa fa-circle fa-fw"></i> <a href="{{ path("app_home") }}">Accueil</a>&nbsp;
{% for category in categorys|sort((a, b) => a.order <=> b.order) %}
{% if not category.illustrations is empty %}
<i class="fa fa-circle fa-fw"></i> <a href="#{{ category.name }}">{{category.name}}</a>&nbsp;
{% endif %}
{% endfor %}
{% if not webzines is empty %}
<i class="fa fa-circle fa-fw"></i> <a href="#webzine">Webzines</a>&nbsp;
{% endif %}
<i class="fa fa-circle fa-fw"></i> <a href="#link">Liens</a>&nbsp;
<i class="fa fa-circle fa-fw"></i> <a href="#contact">Contact</a>&nbsp;
</div>
<div class="float-right">
{% if app.user %}
<a href="{{path("app_user_profil")}}">
<img src="{{app.user.avatar|urlavatar}}" class="avatar">
</a>
{% if is_granted('ROLE_ADMIN') %}
<a href={{ path("app_illustration") }} class="btn btn-link" title="Configuration">
<i class="fa fa-cog fa-fw"></i>
</a>
<a href={{ path("app_illustration_submit") }} class="btn btn-link" title="Créer une Illustration">
<i class="fa fa-paint-brush fa-fw"></i>
</a>
{% endif %}
<a href={{ path("app_logout") }} class="btn btn-link" title="Déconnexion">
<i class="fa fa-sign-out-alt fa-fw"></i>
</a>
{% else %}
<a href={{ path("app_login") }} class="btn btn-link" title="Connexion">
<i class="fa fa-sign-in-alt fa-fw"></i>
</a>
{% endif %}
</div>
</div>
<div class="foliotop">
<a href="#top"><i class="fa fa-chevron-up"></i></a>
</div>
<!-- HEROHEADER ------------------------------------------------------------------------------------------------------------------------------------------------!-->
<div id="top" class="heroheader" displaynone>
{%if not config.hero01 is empty %}
<div class="cssfilter" style="background-image:url(/{{appAlias}}/uploads/hero/{{config.hero01}})"></div>
{%endif%}
{%if not config.hero02 is empty %}
<div class="cssfilter" style="background-image:url(/{{appAlias}}/uploads/hero/{{config.hero02}})"></div>
{%endif%}
{%if not config.hero03 is empty %}
<div class="cssfilter" style="background-image:url(/{{appAlias}}/uploads/hero/{{config.hero03}})"></div>
{%endif%}
{%if not config.hero04 is empty %}
<div class="cssfilter" style="background-image:url(/{{appAlias}}/uploads/hero/{{config.hero04}})"></div>
{%endif%}
{%if not config.hero05 is empty %}
<div class="cssfilter" style="background-image:url(/{{appAlias}}/uploads/hero/{{config.hero05}})"></div>
{%endif%}
</div>
<div class="herofloatmenu" style="position: absolute; top: 0px; right: 10px;">
{% if app.user %}
<a href="{{path("app_user_profil")}}">
<img src="{{app.user.avatar|urlavatar}}" class="avatar">
</a>
{% if is_granted('ROLE_ADMIN') %}
<a href={{ path("app_illustration") }} class="btn btn-link" title="Configuration">
<i class="fa fa-cog fa-fw"></i>
</a>
<a href={{ path("app_illustration_submit") }} class="btn btn-link" title="Créer une Illustration">
<i class="fa fa-paint-brush fa-fw"></i>
</a>
{% endif %}
<a href={{ path("app_logout") }} class="btn btn-link" title="Déconnexion">
<i class="fa fa-sign-out-alt fa-fw"></i>
</a>
{% else %}
<a href={{ path("app_login") }} class="btn btn-link" title="Connexion">
<i class="fa fa-sign-in-alt fa-fw"></i>
</a>
{% endif %}
</div>
<div class="herobox"></div>
<div class="herotitle">
<h1 style="text-transform:uppercase">{{ (user.pseudo?user.pseudo:user.displayname) }}</h1>
<div class="heromenu" >
{% if not config.appsubname is empty %}
<i style="font-size:80%;">{{ config.appsubname }}</i><br>
{% endif %}
<div class="linkmenu" style="clear:both">
{% if user.email is not empty %}
<a href="mailto:{{ user.email }}" target="_blank" title="Email"><i class="fas fa-envelope fa-2x"></i></a>
{% endif %}
{% if config.facebook is not empty %}
<a href="{{ config.facebook }}" target="_blank" title="Facebook"><i class="fab fa-facebook fa-2x"></i></a>
{% endif %}
{% if config.instagram is not empty %}
<a href="{{ config.instagram }}" target="_blank" title="Instagram"><i class="fab fa-instagram fa-2x"></i></a>
{% endif %}
{% if config.twitter is not empty %}
<a href="{{ config.twitter }}" target="_blank" title="Twitter"><i class="fab fa-twitter fa-2x"></i></a>
{% endif %}
{% if config.google is not empty %}
<a href="{{ config.google }}" target="_blank" title="Google"><i class="fab fa-google-plus fa-2x"></i></a>
{% endif %}
{% if config.youtube is not empty %}
<a href="{{ config.youtube }}" target="_blank" title="Youtube"><i class="fab fa-youtube fa-2x"></i></a>
{% endif %}
<a href="{{ path("app_feed") }}" target="_blank" title="RSS"><i class="fa fa-rss-square fa-2x"></i></a>
</div>
<div class="catmenu">
<a href="{{ path("app_home") }}"><i class="fa fa-arrow-circle-right fa-fw facatmenu"></i> Accueil</a><br>
{% for category in categorys|sort((a, b) => a.order <=> b.order) %}
{% if not category.illustrations is empty %}
<a href="#{{ category.name }}"><i class="fa fa-arrow-circle-right fa-fw facatmenu"></i> {{category.name}}</a><br>
{% endif %}
{% endfor %}
{% if not webzines is empty %}
<a href="#webzine"><i class="fa fa-arrow-circle-right fa-fw facatmenu"></i> Webzines</a><br>
{% endif %}
{% if not links is empty %}
<a href="#link"><i class="fa fa-arrow-circle-right fa-fw facatmenu"></i> Liens</a><br>
{% endif %}
<a href="#contact"><i class="fa fa-arrow-circle-right fa-fw facatmenu"></i> Contact</a><br>
</div>
</div>
</div>
<div class="herologo">
<img src="/{{ appAlias }}/uploads/avatar/{{ user.avatar }}">
</div>
<!-- GRID ------------------------------------------------------------------------------------------------------------------------------------------------------!-->
{% set style="margin:30px" %}
{% if app.session.get("appmaxthumbwidth")!="0" %}
{% set style="max-width:"~app.session.get("appmaxthumbwidth")~"px; margin:30px auto;" %}
{% endif %}
<div class="grid" style="{{ style }}">
<div class="grid-sizer"></div>
<div class="gutter-sizer"></div>
{% for category in categorys|sort((a, b) => a.order <=> b.order) %}
{% if not category.illustrations is empty %}
<div id="{{ category.name }}" class="grid-item grid-item-full"><h1 class="mt-5">{{ category.name }}</h1></div>
{% for illustration in category.illustrations %}
{% set appthumbwidth=app.session.get("appthumbwidth") %}
{% set appthumbheight=app.session.get("appthumbheight") %}
{% if category.usecategoryconfig %}
{% set appthumbwidth=category.appthumbwidth %}
{% set appthumbheight=category.appthumbheight %}
{% endif %}
{% if appthumbwidth==0 %}
{% set class="" %}
{% if loop.index < 40 %}
{% if loop.index == 1 %}
{% set class="grid-item-size-4" %}
{% elseif loop.index is divisible by(28) %}
{% set class="grid-item-size-4" %}
{% elseif loop.index is divisible by(7) %}
{% set class="grid-item-size-2" %}
{% elseif loop.index is divisible by(46) %}
{% set class="grid-item-size-4" %}
{% endif %}
{% elseif loop.index > 48 %}
{% if loop.index == 49 %}
{% set class="grid-item-size-4" %}
{% elseif (loop.index-49) is divisible by(28) %}
{% set class="grid-item-size-4" %}
{% elseif (loop.index-49) is divisible by(7) %}
{% set class="grid-item-size-2" %}
{% endif %}
{% endif %}
{% elseif appthumbwidth==1 %} {% set class="" %}
{% elseif appthumbwidth==2 %} {% set class="grid-item-size-2" %}
{% endif %}
{%if appthumbheight==0 %}
{% set class=class~" grid-item-size-square" %}
{% elseif appthumbheight==1 %}
{% set class=class~" grid-item-size-proportion" %}
{% else %}
{% set class=class~" grid-item-size-page" %}
{% endif %}
{% set source="thumb_"~illustration.illustration %}
{% if appthumbheight!=0 %}
{% set source="thumbori_"~illustration.illustration %}
{% endif %}
<a href="{{ path("app_illustration_view",{"idcat":category.id,"id":illustration.id}) }}">
<div id="illustration{{illustration.id}}" class="grid-item grid-item-size {{class}} cssfilter cssfilter-{{category.id}} no-cache-bg" data-width="{{illustration.width}}" data-background-image="/{{ appAlias }}/uploads/illustration/{{source}}" data-height="{{illustration.height}}" style="height:auto;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/illustration/{{source}}");">
</div>
</a>
{% endfor %}
{% endif %}
{% endfor %}
<!-- WEBZINE ------------------------------------------------------------------------------------------------------------------------------------------------------!-->
{% if not webzines is empty %}
<div id="webzine" class="grid-item grid-item-full"><h1 class="mt-5">Webzines</h1></div>
{% endif %}
{% set setname="" %}
{% for webzine in webzines %}
{% if not webzine.webzinepages is empty %}
{% if setname!=webzine.set %}
{% if not webzine.set is empty %}
<div id="webzine" class="grid-item grid-item-full"><h2 class="mt-3 pl-3">{{webzine.set}}</h2></div>
{% endif %}
{% set setname=webzine.set %}
{% endif %}
{% set page=webzine.webzinepages[0] %}
{% 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}) }}">
<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>
{% endif %}
{% endfor %}
<!-- LINK ------------------------------------------------------------------------------------------------------------------------------------------------------!-->
{% if not links is empty %}
<div id="link" class="grid-item grid-item-full"><h1 class="mt-5">Liens</h1></div>
<div class="grid-item grid-item-size grid-item-size-3 grid-item-size-square cssfilter" style="height:200px;background-position: center; background-size: cover; background-image: url(/{{ appAlias }}/uploads/image/{{ config.imglink }});">
</div>
<div class="grid-item grid-item-size grid-item-size-6 grid-item-size-noresize linkurl" style="padding:0px 15px;">
{% for link in links|sort((a, b) => a.order <=> b.order) %}
<a href="{{link.url}}" target="_blank">{{ link.name }}</a>
{% endfor %}
</div>
{%endif%}
<!-- CONTACT ------------------------------------------------------------------------------------------------------------------------------------------------------!-->
<div id="contact" class="grid-item grid-item-full"><h1 class="mt-5">Contact</h1></div>
<div class="grid-item grid-item-size grid-item-size-3 grid-item-size-square cssfilter" style="height:200px;background-position: center; background-size: cover; background-image: url(/{{ appAlias }}/uploads/image/{{ config.imgcontact }});">
</div>
<div class="grid-item grid-item-size grid-item-size-6 grid-item-size-noresize" style="padding:0px 15px;">
<h3>{{ user.pseudo }}</h3>
{% if not config.appsubname is empty %}
{{ config.appsubname }}<br>
{%endif%}
{% if not config.appdescription is empty %}
<small><br>{{ config.appdescription|raw }}</small><br>
{%endif%}
<br>
{% if user.email is not empty %}
<i class="fas fa-envelope"></i> Email = <a href="mailto:{{ user.email }}" target="_blank" title="Email">{{ user.email }}</a><br>
{% endif %}
{% if config.facebook is not empty %}
<i class="fab fa-facebook"></i> Facebook = <a href="{{ config.facebook }}" target="_blank" title="Facebook">{{ config.facebook }}</a><br>
{% endif %}
{% if config.instagram is not empty %}
<i class="fab fa-instagram"></i> Instagram = <a href="{{ config.instagram }}" target="_blank" title="Instagram">{{ config.instagram }}</a><br>
{% endif %}
{% if config.twitter is not empty %}
<i class="fab fa-twitter"></i> Twitter = <a href="{{ config.twitter }}" target="_blank" title="Twitter">{{ config.twitter }}</a><br>
{% endif %}
{% if config.google is not empty %}
<i class="fab fa-google-plus"></i> Google = <a href="{{ config.google }}" target="_blank" title="Google">{{ config.google }}</a><br>
{% endif %}
{% if config.youtube is not empty %}
<i class="fab fa-youtube"></i> Youtube = <a href="{{ config.youtube }}" target="_blank" title="Youtube">{{ config.youtube }}</a><br>
{% endif %}
</div>
</div>
{% endblock %}
{% block localjavascript %}
function getNoCacheBgElements() {
return document.querySelectorAll('.no-cache-bg');
}
function loadBgImageForElement(element) {
element.style['background-image'] =
'url('+ element.attributes['data-background-image'].value + '?' + (new Date()).getTime() +')';
}
function loadBgImages() {
for(
var i = 0, elements = getNoCacheBgElements();
i < elements.length;
loadBgImageForElement(elements[i]), i++
);
}
window.onload = function() {
loadBgImages();
};
$(document).ready(function() {
$('body').imagesLoaded(function() {
height=Math.max(500,$(window).height());
$('.heroheader').height(height);
$('.herologo').css({ top: (height-250) +'px' });
$('.heroheader').slick({
slidesToShow: 1,
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 6000,
dots: true,
touchMove: false,
pauseOnDotsHover: true,
fade: true,
cssEase: 'linear',
prevArrow: false,
nextArrow: false,
customPaging: function(slider, i) {
return '<span class="heroheader-dot fa fa-circle fa-fw"></span>';
}
});
$("#main").show();
resizeThumb();
$('.grid').masonry({
columnWidth: '.grid-sizer',
gutter: '.gutter-sizer',
itemSelector: '.grid-item',
percentPosition: true,
horizontalOrder: false,
});
if (location.hash) {
console.log(location.hash);
$(document).scrollTop( $(location.hash).offset().top -60);
// = location.hash;
}
});
});
$(window).resize(function() {
$(window).scroll();
height=Math.max(500,$(window).height());
$('.heroheader').height(height);
$('.herologo').css({ top: (height-250) +'px' });
resizeThumb();
});
$(window).scroll(function () {
if($(window).width()>=980) {
// set distance user needs to scroll before we start fadeIn
if ($(this).scrollTop() > 300) {
if($('.foliomenu').is(":hidden")) $('.foliomenu').show();
} else {
if($('.foliomenu').is(":visible")) $('.foliomenu').hide();
}
}
else {
if($('.foliomenu').is(":hidden")) $('.foliomenu').show();
}
if ($(this).scrollTop() > 300) {
if($('.foliotop').is(":hidden")) $('.foliotop').show();
} else {
if($('.foliotop').is(":visible")) $('.foliotop').hide();
}
});
function resizeThumb() {
{% if app.session.get("appmaxthumbwidth")!="0" %}
width=$(window).width();
maxwidth={{ app.session.get("appmaxthumbwidth") }};
if(maxwidth+30>width) {
$(".grid").css("max-width","none");
$(".grid").css("margin","30px");
}
else {
$(".grid").css("max-width","{{ app.session.get("appmaxthumbwidth") }}px");
$(".grid").css("margin","30px auto");
}
{% endif %}
$(".grid-item-size").each(function() {
if(!$(this).hasClass("grid-item-size-noresize")) {
if($(this).hasClass("grid-item-size-square")) {
$(this).height($(this).width());
}
else if($(this).hasClass("grid-item-size-proportion")) {
var width=$(this).width();
var oriwidth=$(this).data("width")
if(oriwidth>0) {
pourcentage=width*100/oriwidth;
height=$(this).data("height")*pourcentage/100;
$(this).height(height);
}
else {
$(this).height($(this).width());
}
}
else {
$(this).height($(this).width()*30/21);
}
}
});
}
{% endblock %}

View File

@ -15,7 +15,7 @@
{{ form_widget(form.submit) }}
{% if mode=="profil" %}
<a class="btn btn-secondary" href={{ path('app_home') }}>Annuler</a>
<a class="btn btn-secondary" href={{ path('app_home_user',{userpseudo:user.pseudo}) }}>Annuler</a>
{% else %}
<a class="btn btn-secondary" href={{ path('app_user') }}>Annuler</a>
{% endif %}
@ -61,7 +61,7 @@
<div class="row justify-content-md-center">
<div class="col-md-6">
<div class="card">
<div class="card mb-3">
<div class="card-header">
<i class="fa fa-pencil-alt fa-fw"></i> Informations
</div>
@ -73,25 +73,81 @@
{%endif%}
{{ form_row(form.lastname) }}
{{ form_row(form.firstname) }}
{{ form_row(form.pseudo) }}
{{ form_row(form.email) }}
</div>
</div>
</div>
{% if form.roles is defined %}
<div class="col-md-6">
<div class="card">
{% if form.roles is defined %}
<div class="card mb-2">
<div class="card-header">
<i class="fa fa-pencil-alt fa-fw"></i> Organisation
</div>
<div class="card-body">
{{ form_row(form.groups) }}
{{ form_row(form.roles) }}
</div>
<div class="card-body">
{{ form_row(form.groups) }}
{{ form_row(form.roles) }}
</div>
</div>
{%endif%}
{%if mode!="submit" %}
<div class="card mb-3">
<div class="card-header">
<i class="fa fa-pencil-alt fa-fw"></i> Ma Page
</div>
<div class="card-body">
{% if mode=="profil" %}
{{ render(path("app_config_user_render",{mode:mode,category:"site"})) }}
{% else %}
{{ render(path("app_config_render",{mode:mode,category:"site",userid:user.id})) }}
{% endif %}
</div>
</div>
<div class="card mb-3">
<div class="card-header">
<i class="fa fa-pencil-alt fa-fw"></i> Social
</div>
<div class="card-body">
{% if mode=="profil" %}
{{ render(path("app_config_user_render",{mode:mode,category:"social"})) }}
{% else %}
{{ render(path("app_config_render",{mode:mode,category:"social",userid:user.id})) }}
{% endif %}
</div>
</div>
<div class="card mb-3">
<div class="card-header">
<i class="fa fa-pencil-alt fa-fw"></i> Hero
</div>
<div class="card-body">
{% if mode=="profil" %}
{{ render(path("app_config_user_render",{mode:mode,category:"hero"})) }}
{% else %}
{{ render(path("app_config_render",{mode:mode,category:"hero",userid:user.id})) }}
{% endif %}
</div>
</div>
<div class="card mb-3">
<div class="card-header">
<i class="fa fa-pencil-alt fa-fw"></i> Images
</div>
<div class="card-body">
{% if mode=="profil" %}
{{ render(path("app_config_user_render",{mode:mode,category:"image"})) }}
{% else %}
{{ render(path("app_config_render",{mode:mode,category:"image",userid:user.id})) }}
{% endif %}
</div>
</div>
{% endif %}
</div>
</div>
{%endif%}
</div>
{{ form_end(form) }}