icon user + cache flux

This commit is contained in:
afornerot 2019-05-10 13:59:52 +02:00
parent 8e634842b3
commit 6517d7dca2
25 changed files with 571 additions and 134 deletions

View File

@ -306,6 +306,15 @@ class PurgeFileCommand extends Command
} }
} }
// /web/uploads/ckeditor
$this->writelnred('');
$this->writelnred('== Directory = Flux');
$directory=$this->container->get('kernel')->getRootDir()."/../web/uploads/flux";
$fs = new Filesystem();
$fs->remove($directory);
$this->writeln(''); $this->writeln('');
return 1; return 1;
} }

View File

@ -237,6 +237,13 @@ class User implements UserInterface, \Serializable
*/ */
private $blogarticles; private $blogarticles;
/**
* @var ArrayCollection $icon
* @var Icon
*
* @ORM\OneToMany(targetEntity="Cadoles\PortalBundle\Entity\Icon", mappedBy="user", cascade={"persist"}, orphanRemoval=true)
*/
private $icons;
//== CODE A NE PAS REGENERER //== CODE A NE PAS REGENERER
/** /**
@ -334,6 +341,7 @@ class User implements UserInterface, \Serializable
$this->blogs = new \Doctrine\Common\Collections\ArrayCollection(); $this->blogs = new \Doctrine\Common\Collections\ArrayCollection();
$this->blogwriters = new \Doctrine\Common\Collections\ArrayCollection(); $this->blogwriters = new \Doctrine\Common\Collections\ArrayCollection();
$this->blogarticles = new \Doctrine\Common\Collections\ArrayCollection(); $this->blogarticles = new \Doctrine\Common\Collections\ArrayCollection();
$this->icons = new \Doctrine\Common\Collections\ArrayCollection();
} }
/** /**
@ -1255,4 +1263,38 @@ class User implements UserInterface, \Serializable
{ {
return $this->blogarticles; return $this->blogarticles;
} }
/**
* Add icon
*
* @param \Cadoles\PortalBundle\Entity\Icon $icon
*
* @return User
*/
public function addIcon(\Cadoles\PortalBundle\Entity\Icon $icon)
{
$this->icons[] = $icon;
return $this;
}
/**
* Remove icon
*
* @param \Cadoles\PortalBundle\Entity\Icon $icon
*/
public function removeIcon(\Cadoles\PortalBundle\Entity\Icon $icon)
{
$this->icons->removeElement($icon);
}
/**
* Get icons
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getIcons()
{
return $this->icons;
}
} }

View File

@ -333,7 +333,7 @@ class InitDataCommand extends ContainerAwareCommand
$em->persist($entityWidget); $em->persist($entityWidget);
} }
// Widget Calendrier // Widget Blog
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1890); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1890);
if(!$entityWidget) { if(!$entityWidget) {
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_rocket.png"]); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_rocket.png"]);
@ -355,6 +355,28 @@ class InitDataCommand extends ContainerAwareCommand
$em->persist($entityWidget); $em->persist($entityWidget);
} }
// Widget RSS
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1880);
if(!$entityWidget) {
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_rss.png"]);
$entityWidget = new Widget();
$entityWidget->setId(-1880);
$entityWidget->setRoworder(13);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('RSS');
$entityWidget->setDescription("Afficher un flux RSS spécifique");
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_rss");
$entityWidget->setHeight("630");
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$parameter = json_decode('{"fields": [{"id": "url", "loc": "col1", "type": "string", "label": "URL du Flux RSS", "value": "", "mandatory": "true"},{"id": "nbarticle", "loc": "col1", "type": "integer", "label": "Nombre d\'articles affichés", "value": "10", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget);
}
// Widget Séparateur // Widget Séparateur
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1600); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1600);
if(!$entityWidget) { if(!$entityWidget) {

View File

@ -63,12 +63,17 @@ class BookmarkController extends Controller
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$idpage])); return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$idpage]));
} }
$icons=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>null]);
$iconsuser=null;
if($access=="user") $iconsuser=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>$this->getUser()]);
return $this->render($this->labelentity.':edit.html.twig', [ return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => ($access=="config"), 'useheader' => ($access=="config"),
'usemenu' => false, 'usemenu' => false,
'usesidebar' => ($access=="config"), 'usesidebar' => ($access=="config"),
'entity' => $data, 'entity' => $data,
'icons' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findAll(), 'icons' => $icons,
'iconsuser' => $iconsuser,
'mode' => "submit", 'mode' => "submit",
'access' => $access, 'access' => $access,
'idpage' => $idpage, 'idpage' => $idpage,
@ -122,6 +127,9 @@ class BookmarkController extends Controller
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$idpage])); return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$idpage]));
} }
$icons=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>null]);
$iconsuser=null;
if($access=="user") $iconsuser=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>$this->getUser()]);
// Affichage du formulaire // Affichage du formulaire
return $this->render($this->labelentity.':edit.html.twig', [ return $this->render($this->labelentity.':edit.html.twig', [
@ -129,7 +137,8 @@ class BookmarkController extends Controller
'usemenu' => false, 'usemenu' => false,
'usesidebar' => ($access=="config"), 'usesidebar' => ($access=="config"),
'entity' => $data, 'entity' => $data,
'icons' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findAll(), 'icons' => $icons,
'iconsuser' => $iconsuser,
'mode' => "update", 'mode' => "update",
'access' => $access, 'access' => $access,
'idpage' => $idpage, 'idpage' => $idpage,

View File

@ -19,18 +19,24 @@ class IconController extends Controller
private $labeldata = 'icon'; private $labeldata = 'icon';
private $labeldatas = 'icons'; private $labeldatas = 'icons';
public function listAction() public function listAction($access="config")
{ {
$em = $this->getDoctrine()->getManager();
if($access=="config")
$icons=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>null]);
else
$icons=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>$this->getUser()]);
return $this->render($this->labelentity.':list.html.twig',[ return $this->render($this->labelentity.':list.html.twig',[
'useheader' => true, 'useheader' => true,
'usemenu' => false, 'usemenu' => false,
'usesidebar' => true, 'usesidebar' => ($access=="config"),
$this->labeldatas => $this->getDatas() 'access' => $access,
$this->labeldatas => $icons
]); ]);
} }
public function submitAction(Request $request) public function submitAction(Request $request,$access="config")
{ {
// Initialisation de l'enregistrement // Initialisation de l'enregistrement
$data = new Icon(); $data = new Icon();
@ -47,6 +53,8 @@ class IconController extends Controller
// Sur validation // Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) { if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData(); $data = $form->getData();
if($access=="user") $data->setUser($this->getUser());
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
// Sauvegarde // Sauvegarde
@ -54,21 +62,22 @@ class IconController extends Controller
$em->flush(); $em->flush();
// Retour à la liste // Retour à la liste
return $this->redirectToRoute($this->labelroute); return $this->redirectToRoute('cadoles_portal_'.$access.'_icon');
} }
// Affichage du formulaire // Affichage du formulaire
return $this->render($this->labelentity.':edit.html.twig', [ return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => true, 'useheader' => true,
'usemenu' => false, 'usemenu' => false,
'usesidebar' => true, 'usesidebar' => ($access=="config"),
'access' => $access,
$this->labeldata => $data, $this->labeldata => $data,
'mode' => 'submit', 'mode' => 'submit',
'form' => $form->createView() 'form' => $form->createView(),
]); ]);
} }
public function updateAction($id,Request $request) public function updateAction($id,Request $request,$access="config")
{ {
// Récupération de l'enregistrement courant // Récupération de l'enregistrement courant
$data=$this->getData($id); $data=$this->getData($id);
@ -94,7 +103,7 @@ class IconController extends Controller
$em->flush(); $em->flush();
// Retour à la liste // Retour à la liste
return $this->redirectToRoute($this->labelroute); return $this->redirectToRoute('cadoles_portal_'.$access.'_icon');
} }
@ -102,14 +111,16 @@ class IconController extends Controller
return $this->render($this->labelentity.':edit.html.twig', [ return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => true, 'useheader' => true,
'usemenu' => false, 'usemenu' => false,
'usesidebar' => true, 'usesidebar' => ($access=="config"),
'access' => $access,
$this->labeldata => $data, $this->labeldata => $data,
'mode' => 'update', 'mode' => 'update',
'form' => $form->createView() 'form' => $form->createView(),
'refresh' => false,
]); ]);
} }
public function deleteAction($id,Request $request) public function deleteAction($id,Request $request,$access="config")
{ {
// Récupération de l'enregistrement courant // Récupération de l'enregistrement courant
$data=$this->getData($id); $data=$this->getData($id);
@ -121,7 +132,7 @@ class IconController extends Controller
$em->remove($data); $em->remove($data);
$em->flush(); $em->flush();
return $this->redirectToRoute($this->labelroute); return $this->redirectToRoute('cadoles_portal_'.$access.'_icon');
} }

View File

@ -130,13 +130,18 @@ class PagewidgetController extends Controller
return $this->redirect($this->generateUrl('cadoles_core_home',["id"=>$idpage])); return $this->redirect($this->generateUrl('cadoles_core_home',["id"=>$idpage]));
} }
$icons=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>null]);
$iconsuser=null;
if($access=="user") $iconsuser=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>$this->getUser()]);
return $this->render($this->labelentity.':edit.html.twig', [ return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => true, 'useheader' => true,
'usemenu' => false, 'usemenu' => false,
'usesidebar' => ($access=="config"), 'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"), 'maxwidth' => ($access=="user"),
'entity' => $entity, 'entity' => $entity,
'icons' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findAll(), 'icons' => $icons,
'iconsuser' => $iconsuser,
'mode' => "submit", 'mode' => "submit",
'access' => $access, 'access' => $access,
'idpage' => $idpage, 'idpage' => $idpage,
@ -191,13 +196,18 @@ class PagewidgetController extends Controller
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$idpage])); return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$idpage]));
} }
$icons=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>null]);
$iconsuser=null;
if($access=="user") $iconsuser=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>$this->getUser()]);
return $this->render($this->labelentity.':edit.html.twig', [ return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => ($access=="config"), 'useheader' => ($access=="config"),
'usemenu' => false, 'usemenu' => false,
'usesidebar' => ($access=="config"), 'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"), 'maxwidth' => ($access=="user"),
'entity' => $entity, 'entity' => $entity,
'icons' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findAll(), 'icons' => $icons,
'iconsuser' => $iconsuser,
'mode' => "update", 'mode' => "update",
'access' => $access, 'access' => $access,
'idpage' => $idpage, 'idpage' => $idpage,
@ -633,15 +643,40 @@ class PagewidgetController extends Controller
$feedIo = new \FeedIo\FeedIo($client, $logger); $feedIo = new \FeedIo\FeedIo($client, $logger);
$feeds=array(); $feeds=array();
$filesystem = new Filesystem();
foreach($fluxsordered as $flux) { foreach($fluxsordered as $flux) {
// On regarde si le flux a été lu il y a peu // On regarde si le flux a été lu il y a peu
$toregen=true;
if($filesystem->exists('uploads/flux/flux-'.$flux->getId().'.txt')) {
// On récupère la date de modification du fichier
$timestampfile = filemtime('uploads/flux/flux-'.$flux->getId().'.txt');
$datetimeFormat = 'Y-m-d H:i:s';
$datefile = new \DateTime();
$datefile->setTimestamp($timestampfile);
// On ajoute 30mn
$datefile->add(new \DateInterval('PT30M'));
// Si la date est inférieur à maintenant on regénère le flux
$now = new \DateTime();
if($datefile>=$now) {
$toregen=false;
$backup = unserialize(file_get_contents('uploads/flux/flux-'.$flux->getId().'.txt'));
$feeds=array_merge($feeds,$backup);
}
}
// Si le fichier est trop ancien on relit le flus
if($toregen) {
// On lit le flux rss // On lit le flux rss
$result = $feedIo->read($flux->getUrl()); $result = $feedIo->read($flux->getUrl());
$feedtitle = $result->getFeed()->getTitle(); $feedtitle = $result->getFeed()->getTitle();
$backup=[];
// Pour chaque articles // Pour chaque articles
$nbflux=0; $nbflux=0;
foreach ($result->getFeed() as $item) { foreach ($result->getFeed() as $item) {
@ -650,7 +685,7 @@ class PagewidgetController extends Controller
$description = substr(strip_tags($item->getDescription()),0,250); $description = substr(strip_tags($item->getDescription()),0,250);
$description = str_replace("¶","",$description); $description = str_replace("¶","",$description);
$date = $item->getLastModified(); $date = $item->getLastModified();
$dateformat = $item->getLastModified()->format('d/m/Y H:i:s'); $dateformat = ($date?$item->getLastModified()->format('d/m/Y H:i:s'):"");
$content = $item->getDescription(); $content = $item->getDescription();
$media = $item->getMedias(); $media = $item->getMedias();
$mediaurl = ""; $mediaurl = "";
@ -688,8 +723,8 @@ class PagewidgetController extends Controller
} }
// Garder le flux // Garder le flux
if($nbflux<26) {
array_push($feeds,array( $tmp=array(
"feedtitle" => $feedtitle, "feedtitle" => $feedtitle,
"title" => $title, "title" => $title,
"link" => $link, "link" => $link,
@ -698,13 +733,20 @@ class PagewidgetController extends Controller
"dateformat" => $dateformat, "dateformat" => $dateformat,
"content" => $content, "content" => $content,
"image" => $imgurl, "image" => $imgurl,
"color" => $flux->getColor(), "color" => "",
"fluxid" => $flux->getId(), "fluxid" => $flux->getId(),
)); );
}
array_push($feeds,$tmp);
array_push($backup,$tmp);
$nbflux++; $nbflux++;
if($nbflux>=$flux->getMaxread()) break; if($nbflux>=$flux->getMaxread()) break;
} }
// On sauvegarde le résultat en fichier on rechargera son contenu que s'il n'a pas été lu depuis 30mn
$filesystem->dumpFile('uploads/flux/flux-'.$flux->getId().'.txt', serialize($backup));
}
} }
$libelle=array(); $libelle=array();
@ -724,6 +766,166 @@ class PagewidgetController extends Controller
} }
public function viewrssAction($id,$access="config") {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
// Permissions
if($access=="config") {
$canupdate = true;
}
else {
// On s'assure que l'utilisateur à la permission de voir
$page=$entity->getPage();
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
if(!$cansee) throw $this->createNotFoundException('Permission denied');
}
// Récupération des paramétres du widget
$url="";
$nbarticle="_blank";
foreach($entity->getParameter()["fields"] as $parameter) {
switch($parameter["id"]) {
case "url":
$url=$parameter["value"];
break;
case "nbarticle":
$nbarticle=$parameter["value"];
break;
}
}
// On regarde si le flux a été lu il y a peu
$toregen=true;
$filesystem = new Filesystem();
if($filesystem->exists('uploads/flux/widget-'.$id.'.txt')) {
// On récupère la date de modification du fichier
$timestampfile = filemtime('uploads/flux/widget-'.$id.'.txt');
$datetimeFormat = 'Y-m-d H:i:s';
$datefile = new \DateTime();
$datefile->setTimestamp($timestampfile);
// On ajoute 30mn
$datefile->add(new \DateInterval('PT30M'));
// Si la date est inférieur à maintenant on regénère le flux
$now = new \DateTime();
if($datefile>=$now) {
$toregen=false;
$feeds = unserialize(file_get_contents('uploads/flux/widget-'.$id.'.txt'));
}
}
// Si le fichier est trop ancien on relit le flus
if($toregen) {
// Connexion au client
$PROXYactivate = $em->getRepository("CadolesCoreBundle:Config")->find("PROXYactivate")->getValue();
if($PROXYactivate) {
$PROXYserver = $em->getRepository("CadolesCoreBundle:Config")->find("PROXYserver")->getValue();
$PROXYport = $em->getRepository("CadolesCoreBundle:Config")->find("PROXYport")->getValue();
$clientguzzle = new \GuzzleHttp\Client(array('proxy' => ['http' => 'tcp://'.$PROXYserver.':'.$PROXYport,'https' => 'tcp://'.$PROXYserver.':'.$PROXYport]));
}
else
$clientguzzle = new \GuzzleHttp\Client();
$client = new \FeedIo\Adapter\Guzzle\Client($clientguzzle);
$logger = new \Psr\Log\NullLogger();
$feedIo = new \FeedIo\FeedIo($client, $logger);
$feeds=array();
// On lit le flux rss
$result = $feedIo->read($url);
$feedtitle = $result->getFeed()->getTitle();
// Pour chaque articles
$nbflux=0;
foreach ($result->getFeed() as $item) {
$title = $item->getTitle();
$link = $item->getLink();
$description = substr(strip_tags($item->getDescription()),0,250);
$description = str_replace("&para;","",$description);
$date = $item->getLastModified();
$dateformat = ($date?$item->getLastModified()->format('d/m/Y H:i:s'):"");
$content = $item->getDescription();
$media = $item->getMedias();
$mediaurl = "";
foreach ($item->getMedias() as $itemMedia) {
if($itemMedia->getType()=="image/jpeg")
$mediaurl=$itemMedia->getUrl();
}
foreach ($item->getAllElements() as $element) {
if($element->getName()=="content:encoded")
$content = $element->getValue();
}
if($mediaurl!="") {
$imgurl=$mediaurl;
}
else {
// Récupérer la première image du contenu
$imgcontent="";
$imgurl="";
$imgstart = stripos($content,"<img");
if($imgstart!== false) {
$imgend = stripos($content,">",$imgstart);
$imgcontent=substr($content,$imgstart,$imgend-$imgstart+1);
$imgstart = stripos($imgcontent,"src=");
$imgurl=substr($imgcontent,$imgstart+5);
$imgend = stripos($imgurl,'"');
if($imgend===false) $imgend = stripos($imgurl,"'");
$imgurl=substr($imgurl,0,$imgend);
}
}
// Garder le flux
array_push($feeds,array(
"feedtitle" => $feedtitle,
"title" => $title,
"link" => $link,
"description" => $description,
"date" => $date,
"dateformat" => $dateformat,
"content" => $content,
"image" => $imgurl,
// "color" => $flux->getColor(),
"fluxid" => 0,
));
$nbflux++;
if($nbflux>=$nbarticle) break;
}
$libelle=array();
foreach ($feeds as $key => $valeur) {
$libelle[$key] = $valeur["date"];
}
array_multisort($libelle, SORT_DESC, $feeds);
// On sauvegarde le résultat en fichier on rechargera son contenu que s'il n'a pas été lu depuis 30mn
$filesystem->dumpFile('uploads/flux/widget-'.$id.'.txt', serialize($feeds));
}
// Render
return $this->render($this->labelentity.':viewflux.html.twig', [
'entity' => $entity,
'canupdate' => $canupdate,
//'fluxs' => $fluxsordered,
'access' => $access,
'feeds' => $feeds,
]);
}
public function viewbookmarkAction($id,$access="config") { public function viewbookmarkAction($id,$access="config") {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id); $entity = $em->getRepository($this->labelentity)->find($id);

View File

@ -27,6 +27,12 @@ class Icon
*/ */
private $label; private $label;
/**
* @ORM\ManyToOne(targetEntity="Cadoles\CoreBundle\Entity\User", inversedBy="icons")
* @ORM\JoinColumn(nullable=true)
*/
private $user;
/** /**
* @var ArrayCollection $items * @var ArrayCollection $items
* @var Item * @var Item
@ -61,6 +67,7 @@ class Icon
private $bookmarks; private $bookmarks;
/** /**
* Constructor * Constructor
*/ */
@ -106,6 +113,30 @@ class Icon
return $this->label; return $this->label;
} }
/**
* Set user
*
* @param \Cadoles\CoreBundle\Entity\User $user
*
* @return Icon
*/
public function setUser(\Cadoles\CoreBundle\Entity\User $user = null)
{
$this->user = $user;
return $this;
}
/**
* Get user
*
* @return \Cadoles\CoreBundle\Entity\User
*/
public function getUser()
{
return $this->user;
}
/** /**
* Add item * Add item
* *

View File

@ -2,25 +2,43 @@
#== ICON ================================================================================================================================================= #== ICON =================================================================================================================================================
cadoles_portal_config_icon: cadoles_portal_config_icon:
path: /config/icon path: /config/icon
defaults: { _controller: CadolesPortalBundle:Icon:list } defaults: { _controller: CadolesPortalBundle:Icon:list, access: config }
cadoles_portal_config_icon_submit: cadoles_portal_config_icon_submit:
path: /config/icon/submit path: /config/icon/submit
defaults: { _controller: CadolesPortalBundle:Icon:submit } defaults: { _controller: CadolesPortalBundle:Icon:submit, access: config }
cadoles_portal_config_icon_update: cadoles_portal_config_icon_update:
path: /config/icon/update/{id} path: /config/icon/update/{id}
defaults: { _controller: CadolesPortalBundle:Icon:update } defaults: { _controller: CadolesPortalBundle:Icon:update, access: config }
cadoles_portal_config_icon_delete: cadoles_portal_config_icon_delete:
path: /config/icon/delete/{id} path: /config/icon/delete/{id}
defaults: { _controller: CadolesPortalBundle:Icon:delete } defaults: { _controller: CadolesPortalBundle:Icon:delete, access: config }
cadoles_portal_config_icon_icon: cadoles_portal_config_icon_icon:
path: /config/icon/icon path: /config/icon/icon
defaults: { _controller: CadolesPortalBundle:Icon:icon } defaults: { _controller: CadolesPortalBundle:Icon:icon, access: config }
cadoles_portal_user_icon:
path: /user/icon
defaults: { _controller: CadolesPortalBundle:Icon:list, access: user }
cadoles_portal_user_icon_submit:
path: /user/icon/submit
defaults: { _controller: CadolesPortalBundle:Icon:submit, access: user }
cadoles_portal_user_icon_update:
path: /user/icon/update/{id}
defaults: { _controller: CadolesPortalBundle:Icon:update, access: user }
cadoles_portal_user_icon_delete:
path: /user/icon/delete/{id}
defaults: { _controller: CadolesPortalBundle:Icon:delete, access: user }
cadoles_portal_user_icon_icon:
path: /user/icon/icon
defaults: { _controller: CadolesPortalBundle:Icon:icon, access: user }
#== ITEM ================================================================================================================================================= #== ITEM =================================================================================================================================================
@ -595,6 +613,10 @@ cadoles_portal_config_panelwidget_view_flux:
path: /config/pagewidget/view/flux/{id} path: /config/pagewidget/view/flux/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewflux, access: config } defaults: { _controller: CadolesPortalBundle:Pagewidget:viewflux, access: config }
cadoles_portal_config_panelwidget_view_rss:
path: /config/pagewidget/view/rss/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewrss, access: config }
cadoles_portal_config_panelwidget_view_bookmark: cadoles_portal_config_panelwidget_view_bookmark:
path: /pagewidget/view/bookmark/{id} path: /pagewidget/view/bookmark/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewbookmark, access: config } defaults: { _controller: CadolesPortalBundle:Pagewidget:viewbookmark, access: config }
@ -677,6 +699,10 @@ cadoles_portal_user_panelwidget_view_flux:
path: /pagewidget/view/flux/{id} path: /pagewidget/view/flux/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewflux, access: user } defaults: { _controller: CadolesPortalBundle:Pagewidget:viewflux, access: user }
cadoles_portal_user_panelwidget_view_rss:
path: /pagewidget/view/rss/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewrss, access: user }
cadoles_portal_user_panelwidget_view_bookmark: cadoles_portal_user_panelwidget_view_bookmark:
path: /pagewidget/view/bookmark/{id} path: /pagewidget/view/bookmark/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewbookmark, access: user } defaults: { _controller: CadolesPortalBundle:Pagewidget:viewbookmark, access: user }

View File

@ -59,7 +59,7 @@
{{ form_row(form.target) }} {{ form_row(form.target) }}
{{ form_row(form.color) }} {{ form_row(form.color) }}
<div id="diviconsel" class="col-md-12 text-left" style="height:140px; padding:20px; text-align:center; background-color: {{ entity.color ? entity.color : '#000000' }};"> <div id="diviconsel" class="col-md-12 text-left" style="height:140px; padding:20px; text-align:center; background-color: {{ entity.color ? "#"~entity.color : '#000000' }};">
{% if entity.icon %} {% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" height="100" /> <img src="/{{ alias }}/{{ entity.icon.label }}" height="100" />
{% endif %} {% endif %}
@ -85,11 +85,24 @@
<div class="form-group row clearfix"> <div class="form-group row clearfix">
<div class="col-md-12" style="margin-bottom:15px"> <div class="col-md-12" style="margin-bottom:15px">
<a onclick="$('#selicon').modal('hide');" class="btn btn-default">Annuler</a> <a onclick="$('#selicon').modal('hide');" class="btn btn-default">Annuler</a>
{% if access=="user" %}
<a href="{{ path('cadoles_portal_user_icon') }}" target="_parent" class="btn btn-default">Gérer mes Icônes</a>
{% endif %}
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
{% if iconsuser is not empty %}
<h3>Mes Icônes</h3>
{% for icon in iconsuser %}
<a style="cursor:pointer" onClick="selIcon({{ icon.id }})">
<img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px">
</a>
{% endfor %}
<h3>Icônes Communs</h3>
{% endif %}
{% for icon in icons %} {% for icon in icons %}
<a href="#" onClick="selIcon({{ icon.id }})"> <a style="cursor:pointer" onClick="selIcon({{ icon.id }})">
<img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px"> <img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px">
</a> </a>
{% endfor %} {% endfor %}

View File

@ -11,9 +11,9 @@
</h1> </h1>
{{ form_widget(form.submit) }} {{ form_widget(form.submit) }}
<a class="btn btn-default" href={{ path('cadoles_portal_config_icon') }}>Annuler</a> <a class="btn btn-default" href={{ path('cadoles_portal_'~access~'_icon') }}>Annuler</a>
{% if mode=="update" %} {% if mode=="update" %}
<a href={{ path('cadoles_portal_config_icon_delete',{'id':icon.id}) }} <a href={{ path('cadoles_portal_'~access~'_icon_delete',{'id':icon.id}) }}
class="btn btn-danger pull-right" class="btn btn-danger pull-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}" data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cet icône ?"> data-confirm="Êtes-vous sûr de vouloir supprimer cet icône ?">
@ -23,7 +23,6 @@
<br><br> <br><br>
{% if app.session.flashbag.has('error') %} {% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'> <div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br> <strong>Erreur</strong><br>

View File

@ -3,11 +3,13 @@
{% block pagewrapper %} {% block pagewrapper %}
<h1 class="page-header">Gestion des Icônes</h1> <h1 class="page-header">Gestion des Icônes</h1>
<p><a class="btn btn-success" href={{ path('cadoles_portal_config_icon_submit') }}>Ajouter</a></p> <p><a class="btn btn-success" href={{ path('cadoles_portal_'~access~'_icon_submit') }}>Ajouter</a></p>
<div class="row">
{% for icon in icons %} {% for icon in icons %}
<a href="{{ path('cadoles_portal_config_icon_update', {id : icon.id}) }}"><img class="icon" height="90" src="/{{ alias }}/{{ icon.label }}" style="padding:10px"></a> <a href="{{ path('cadoles_portal_'~access~'_icon_update', {id : icon.id}) }}"><img class="icon" height="90" src="/{{ alias }}/{{ icon.label }}" style="padding:10px"></a>
{% endfor %} {% endfor %}
</div>
{% endblock %} {% endblock %}

View File

@ -94,13 +94,24 @@
<div class="modal-body" style="height: 480px; overflow-y: scroll;"> <div class="modal-body" style="height: 480px; overflow-y: scroll;">
<div class="form-group row clearfix"> <div class="form-group row clearfix">
<div class="col-md-12" style="margin-bottom:15px"> <div class="col-md-12" style="margin-bottom:15px">
<a onclick="$('#selicon').modal('hide');" class="btn btn-info"> <a onclick="$('#selicon').modal('hide');" class="btn btn-default">Annuler</a>
<i class="fa fa-chevron-left"></i> {% if access=="user" %}
Annuler <a href="{{ path('cadoles_portal_user_icon') }}" target="_parent" class="btn btn-default">Gérer mes Icônes</a>
</a> {% endif %}
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
{% if iconsuser is not empty %}
<h3>Mes Icônes</h3>
{% for icon in iconsuser %}
<a style="cursor:pointer" onClick="selIcon({{ icon.id }})">
<img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px">
</a>
{% endfor %}
<h3>Icônes Communs</h3>
{% endif %}
{% for icon in icons %} {% for icon in icons %}
<a href="#" onClick="selIcon({{ icon.id }})"> <a href="#" onClick="selIcon({{ icon.id }})">
<img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px"> <img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px">

View File

@ -22,7 +22,11 @@
<div class="widgetheader" style="{{ stylewidgetheader }}"> <div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/> <img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>

View File

@ -47,7 +47,11 @@
</div> </div>
<div class="widgetheader" style="{{ stylewidgetheader }}"> <div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/> <img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>

View File

@ -39,7 +39,11 @@
<div class="widgetheader" style="{{ stylewidgetheader }}"> <div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/> <img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>

View File

@ -27,7 +27,11 @@
</div> </div>
<div class="widgetheader" style="{{ stylewidgetheader }}"> <div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/> <img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>

View File

@ -22,7 +22,11 @@
<div class="widgetheader" style="{{ stylewidgetheader }}"> <div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/> <img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>

View File

@ -40,7 +40,11 @@
<div class="widgetheader" style="{{ stylewidgetheader }}"> <div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/> <img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>

View File

@ -27,13 +27,18 @@
<div class="widgetheader" style="{{ stylewidgetheader }}"> <div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/> <img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>
{% set firstflux="" %} {% set firstflux="" %}
<div class="widgetbody" style="{{ stylewidgetbody }}"> <div class="widgetbody" style="{{ stylewidgetbody }}">
{% if fluxs is defined %}
{% for flux in fluxs %} {% for flux in fluxs %}
{% if loop.first %} {% if loop.first %}
{% set firstflux = flux.id %} {% set firstflux = flux.id %}
@ -48,10 +53,11 @@
<div class="cat-list-feed" onClick="showFlux({{ entity.id}},{{ flux.id }})" style="{{ stylefeed }}">{{ flux.title }}</div> <div class="cat-list-feed" onClick="showFlux({{ entity.id}},{{ flux.id }})" style="{{ stylefeed }}">{{ flux.title }}</div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %}
{% for feed in feeds %} {% for feed in feeds %}
{% set stylefeed = "background-color: #" ~ color['main'] ~ ";" %} {% set stylefeed = "background-color: #" ~ color['main'] ~ ";" %}
{% if feed.color is not null %} {% if feed.color is defined and feed.color is not null %}
{% set stylefeed = "background-color: #" ~ feed.color ~ ";" %} {% set stylefeed = "background-color: #" ~ feed.color ~ ";" %}
{% endif %} {% endif %}
{% if feed.image is not null and feed.image != ""%} {% if feed.image is not null and feed.image != ""%}

View File

@ -37,7 +37,11 @@
</div> </div>
{% else %} {% else %}
<div class="widgetheader" style="{{ stylewidgetheader }}"> <div class="widgetheader" style="{{ stylewidgetheader }}">
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo" /> {% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>

View File

@ -40,7 +40,11 @@
<div class="widgetheader" style="{{ stylewidgetheader }}"> <div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/> <img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>

View File

@ -39,7 +39,11 @@
<div class="widgetheader" style="{{ stylewidgetheader }}"> <div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/> <img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>

View File

@ -37,7 +37,13 @@
{% else %} {% else %}
<a style="{{ stylelink }}" href="{{ url }}" target="{{ target }}"> <a style="{{ stylelink }}" href="{{ url }}" target="{{ target }}">
{% endif %} {% endif %}
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" style="max-height: 100%; width: auto; display: block; margin: auto; padding-top: 10px;" /> <img src="/{{ alias }}/{{ entity.icon.label }}" style="max-height: 100%; width: auto; display: block; margin: auto; padding-top: 10px;" />
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" style="max-height: 100%; width: auto; display: block; margin: auto; padding-top: 10px;" />
{% endif %}
<div style="text-align: center;">{{ entity.name }}</div> <div style="text-align: center;">{{ entity.name }}</div>
</a> </a>
</div> </div>

View File

@ -28,7 +28,11 @@
<div class="widgetheader" style="{{ stylewidgetbodyimage }}"> <div class="widgetheader" style="{{ stylewidgetbodyimage }}">
{% if seeicon %} {% if seeicon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo" /> {% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
{% endif %} {% endif %}
{% if seetitle %} {% if seetitle %}

View File

@ -22,7 +22,11 @@
{% if imagemedia %} {% if imagemedia %}
{% if entity.autoajust %} {% if entity.autoajust %}
<div class="widgetheader" style="{{ stylewidgetheader }}"> <div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/> <img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>
<div class="widgetbody" style="{{ stylewidgetbodyframe }}"> <div class="widgetbody" style="{{ stylewidgetbodyframe }}">
@ -33,7 +37,11 @@
{% endif %} {% endif %}
{% else %} {% else %}
<div class="widgetheader" style="{{ stylewidgetheader }}"> <div class="widgetheader" style="{{ stylewidgetheader }}">
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo" /> {% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>