option commentaire dans les articles de blog (ref #112)
This commit is contained in:
parent
6a19b43997
commit
c052b1746e
@ -323,7 +323,7 @@ class PurgeFileCommand extends Command
|
||||
if($result) $find=true;
|
||||
}
|
||||
|
||||
// Si pas trouvé on la cherche dans les blogs
|
||||
// Si pas trouvé on la cherche dans les blogarticle
|
||||
if(!$find) {
|
||||
$result = $this->em
|
||||
->getRepository("CadolesPortalBundle:Blogarticle")->createQueryBuilder('blogarticle')
|
||||
@ -333,6 +333,16 @@ class PurgeFileCommand extends Command
|
||||
if($result) $find=true;
|
||||
}
|
||||
|
||||
// Si pas trouvé on la cherche dans les blogcommentaire
|
||||
if(!$find) {
|
||||
$result = $this->em
|
||||
->getRepository("CadolesPortalBundle:Blogcommentaire")->createQueryBuilder('blogcommentaire')
|
||||
->where('blogarticle.description LIKE :tofind')
|
||||
->setParameter('tofind', '%'.$tofind.'%')
|
||||
->getQuery()->getResult();
|
||||
if($result) $find=true;
|
||||
}
|
||||
|
||||
// Si pas trouvé on supprime
|
||||
if(!$find) {
|
||||
$this->writeln($name);
|
||||
|
@ -261,6 +261,14 @@ class User implements UserInterface, \Serializable
|
||||
*/
|
||||
private $blogarticles;
|
||||
|
||||
/**
|
||||
* @var ArrayCollection $blogcomment
|
||||
* @var Blogcomment
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="Cadoles\PortalBundle\Entity\Blogcomment", mappedBy="user", cascade={"persist"}, orphanRemoval=true)
|
||||
*/
|
||||
private $blogcomments;
|
||||
|
||||
/**
|
||||
* @var ArrayCollection $icon
|
||||
* @var Icon
|
||||
@ -1547,4 +1555,38 @@ class User implements UserInterface, \Serializable
|
||||
{
|
||||
return $this->messagesees;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add blogcomment
|
||||
*
|
||||
* @param \Cadoles\PortalBundle\Entity\Blogcomment $blogcomment
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function addBlogcomment(\Cadoles\PortalBundle\Entity\Blogcomment $blogcomment)
|
||||
{
|
||||
$this->blogcomments[] = $blogcomment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove blogcomment
|
||||
*
|
||||
* @param \Cadoles\PortalBundle\Entity\Blogcomment $blogcomment
|
||||
*/
|
||||
public function removeBlogcomment(\Cadoles\PortalBundle\Entity\Blogcomment $blogcomment)
|
||||
{
|
||||
$this->blogcomments->removeElement($blogcomment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get blogcomments
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getBlogcomments()
|
||||
{
|
||||
return $this->blogcomments;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,191 @@
|
||||
<?php
|
||||
|
||||
namespace Cadoles\PortalBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
|
||||
use Cadoles\PortalBundle\Entity\Blogcomment;
|
||||
use Cadoles\PortalBundle\Form\BlogcommentType;
|
||||
use Cadoles\CoreBundle\Entity\Usergroup;
|
||||
|
||||
class BlogcommentController extends Controller
|
||||
{
|
||||
private $labelentity="CadolesPortalBundle:Blogcomment";
|
||||
private $routeprimary="cadoles_portal_config_blogcomment";
|
||||
|
||||
private function entityForm(Blogcomment $entity,$access="config")
|
||||
{
|
||||
$route=str_replace("_config_","_".$access."_",$this->routeprimary);
|
||||
|
||||
if ($this->getDoctrine()->getManager()->contains($entity)) {
|
||||
return $this->createForm(BlogcommentType::class, $entity, [
|
||||
"mode" => "update",
|
||||
"access" => $access,
|
||||
"user" => $this->getUser()
|
||||
]);
|
||||
}
|
||||
else {
|
||||
return $this->createForm(BlogcommentType::class, $entity, [
|
||||
"mode" => "submit",
|
||||
"access" => $access,
|
||||
"user" => $this->getUser()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function submitAction(Request $request,$idarticle,$access="config")
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$entity = new Blogcomment();
|
||||
$blogarticle=$em->getRepository("CadolesPortalBundle:Blogarticle")->find($idarticle);
|
||||
if($blogarticle) $entity->setBlogarticle($blogarticle);
|
||||
$entity->setName("Commentaire");
|
||||
|
||||
$form = $this->entityForm($entity,$access);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isValid()) {
|
||||
$entity->setUser($this->getUser());
|
||||
$entity->setSubmit(new \Datetime());
|
||||
|
||||
$em->persist($entity);
|
||||
$em->flush();
|
||||
|
||||
foreach($entity->getBlogarticle()->getBlog()->getGroups() as $group) {
|
||||
if($group->getFgcanshare()) {
|
||||
$url=$this->generateUrl('cadoles_portal_'.$access.'_blogarticle_view',["id"=>$entity->getBlogarticle()->getId()]);
|
||||
$message="Création commentaire article<br><a href='$url'>".$entity->getName()."</a>";
|
||||
$usergroup=$em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(["group"=>$group,"user"=>$this->getUser()]);
|
||||
if($usergroup) {
|
||||
$key=$usergroup->getKeyvalue();
|
||||
$websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key,$this->getUser()->getId(),$group->getId(),$message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_blogarticle_view',["id"=>$entity->getBlogarticle()->getId()]));
|
||||
}
|
||||
|
||||
return $this->render($this->labelentity.':edit.html.twig', [
|
||||
'useheader' => ($access=="config"),
|
||||
'usemenu' => false,
|
||||
'usesidebar' => ($access=="config"),
|
||||
'maxwidth' => ($access=="user"),
|
||||
'entity' => $entity,
|
||||
'mode' => "submit",
|
||||
'access' => $access,
|
||||
'form' => $form->createView()
|
||||
]);
|
||||
}
|
||||
|
||||
public function updateAction(Request $request, $id,$access="config")
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$entity = $em->getRepository($this->labelentity)->find($id);
|
||||
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
|
||||
|
||||
// On s'assure que l'utilisateur à la permission de modifier
|
||||
if($access=="user") {
|
||||
$em->getRepository("CadolesPortalBundle:Blog")->getPermission($this->getUser(),$entity->getBlogarticle()->getBlog(),$cansee,$canupdate,$canadd);
|
||||
if(!$canadd&&$this->getUser()!=$entity->getUser()) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
// Création du formulaire
|
||||
$form = $this->entityForm($entity,$access);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isValid()) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($entity);
|
||||
$em->flush();
|
||||
|
||||
foreach($entity->getBlogarticle()->getBlog()->getGroups() as $group) {
|
||||
if($group->getFgcanshare()) {
|
||||
$url=$this->generateUrl('cadoles_portal_'.$access.'_blogarticle_view',["id"=>$entity->getBlogarticle()->getId()]);
|
||||
$message="Modification commentaire article<br><a href='$url'>".$entity->getBlogarticle()->getName()."</a>";
|
||||
$usergroup=$em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(["group"=>$group,"user"=>$this->getUser()]);
|
||||
if($usergroup) {
|
||||
$key=$usergroup->getKeyvalue();
|
||||
$websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key,$this->getUser()->getId(),$group->getId(),$message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_blogarticle_view',["id"=>$entity->getBlogarticle()->getId()]));
|
||||
}
|
||||
|
||||
|
||||
return $this->render($this->labelentity.':edit.html.twig', [
|
||||
'useheader' => ($access=="config"),
|
||||
'usemenu' => false,
|
||||
'usesidebar' => ($access=="config"),
|
||||
'maxwidth' => ($access=="user"),
|
||||
'entity' => $entity,
|
||||
'access' => $access,
|
||||
'mode' => "update",
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function deleteAction(Request $request, $id,$access="config")
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$entity = $this->getDoctrine()->getRepository($this->labelentity)->find($id);
|
||||
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
|
||||
|
||||
$idarticle=$entity->getBlogarticle()->getId();
|
||||
|
||||
// On s'assure que l'utilisateur à la permission de supprimer
|
||||
if($access=="user") {
|
||||
$em->getRepository("CadolesPortalBundle:Blog")->getPermission($this->getUser(),$entity->getBlogarticle()->getBlog(),$cansee,$canupdate,$canadd);
|
||||
if(!$canadd&&$this->getUser()!=$entity->getUser()) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
// Suppression
|
||||
$em->remove($entity);
|
||||
$em->flush();
|
||||
|
||||
// Retour
|
||||
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_blogarticle_view',["id"=>$idarticle]));
|
||||
}
|
||||
|
||||
public function uploadAction(Request $request,$access=null) {
|
||||
// Fichier temporaire uploadé
|
||||
$tmpfile = $request->files->get('upload');
|
||||
$extention = $tmpfile->getClientOriginalExtension();
|
||||
|
||||
// Répertoire de Destination
|
||||
$fs = new Filesystem();
|
||||
$rootdir = $this->get('kernel')->getRootDir()."/../web";
|
||||
$fs->mkdir($rootdir."/uploads/ckeditor");
|
||||
|
||||
// Fichier cible
|
||||
$targetName = uniqid().".".$extention;
|
||||
$targetFile = $rootdir."/uploads/ckeditor/".$targetName;
|
||||
$targetUrl = "/".$this->getParameter('alias')."/uploads/ckeditor/".$targetName;
|
||||
$message = "";
|
||||
|
||||
move_uploaded_file($tmpfile,$targetFile);
|
||||
|
||||
$output["uploaded"]=1;
|
||||
$output["fileName"]=$targetName;
|
||||
$output["url"]=$targetUrl;
|
||||
|
||||
return new Response(json_encode($output));
|
||||
|
||||
}
|
||||
|
||||
public function imageAction($access="config")
|
||||
{
|
||||
return $this->render('CadolesPortalBundle:Blogarticle:image.html.twig',[
|
||||
'useheader' => false,
|
||||
'usemenu' => false,
|
||||
'usesidebar' => false,
|
||||
'access' => $access
|
||||
]);
|
||||
}
|
||||
}
|
@ -49,6 +49,11 @@ class Blogarticle
|
||||
*/
|
||||
private $fgdraft;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="fgcomment", type="boolean")
|
||||
*/
|
||||
private $fgcomment;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
@ -68,6 +73,13 @@ class Blogarticle
|
||||
*/
|
||||
private $blog;
|
||||
|
||||
/**
|
||||
* @var ArrayCollection $blogcomment
|
||||
* @var Blogcomment
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="Cadoles\PortalBundle\Entity\Blogcomment", mappedBy="blogarticle", cascade={"persist"}, orphanRemoval=true)
|
||||
*/
|
||||
private $blogcomments;
|
||||
|
||||
|
||||
|
||||
@ -248,4 +260,69 @@ class Blogarticle
|
||||
{
|
||||
return $this->blog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fgcomment
|
||||
*
|
||||
* @param boolean $fgcomment
|
||||
*
|
||||
* @return Blogarticle
|
||||
*/
|
||||
public function setFgcomment($fgcomment)
|
||||
{
|
||||
$this->fgcomment = $fgcomment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fgcomment
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getFgcomment()
|
||||
{
|
||||
return $this->fgcomment;
|
||||
}
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->blogcomments = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add blogcomment
|
||||
*
|
||||
* @param \Cadoles\PortalBundle\Entity\Blogcomment $blogcomment
|
||||
*
|
||||
* @return Blogarticle
|
||||
*/
|
||||
public function addBlogcomment(\Cadoles\PortalBundle\Entity\Blogcomment $blogcomment)
|
||||
{
|
||||
$this->blogcomments[] = $blogcomment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove blogcomment
|
||||
*
|
||||
* @param \Cadoles\PortalBundle\Entity\Blogcomment $blogcomment
|
||||
*/
|
||||
public function removeBlogcomment(\Cadoles\PortalBundle\Entity\Blogcomment $blogcomment)
|
||||
{
|
||||
$this->blogcomments->removeElement($blogcomment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get blogcomments
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getBlogcomments()
|
||||
{
|
||||
return $this->blogcomments;
|
||||
}
|
||||
}
|
||||
|
191
src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Blogcomment.php
Normal file
191
src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Blogcomment.php
Normal file
@ -0,0 +1,191 @@
|
||||
<?php
|
||||
|
||||
namespace Cadoles\PortalBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* Blogcomment
|
||||
*
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="blogcomment")
|
||||
* @ORM\Entity(repositoryClass="Cadoles\PortalBundle\Repository\BlogcommentRepository")
|
||||
* @ORM\HasLifecycleCallbacks
|
||||
*/
|
||||
class Blogcomment
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=100)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="description", type="text", nullable=true)
|
||||
*/
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="submit", type="datetime")
|
||||
*/
|
||||
private $submit;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Cadoles\CoreBundle\Entity\User", inversedBy="blogcomments")
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Cadoles\PortalBundle\Entity\Blogarticle", inversedBy="blogcomments")
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
private $blogarticle;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return Blogcomment
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description
|
||||
*
|
||||
* @return Blogcomment
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set submit
|
||||
*
|
||||
* @param \DateTime $submit
|
||||
*
|
||||
* @return Blogcomment
|
||||
*/
|
||||
public function setSubmit($submit)
|
||||
{
|
||||
$this->submit = $submit;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get submit
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getSubmit()
|
||||
{
|
||||
return $this->submit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set user
|
||||
*
|
||||
* @param \Cadoles\CoreBundle\Entity\User $user
|
||||
*
|
||||
* @return Blogcomment
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set blogarticle
|
||||
*
|
||||
* @param \Cadoles\PortalBundle\Entity\Blogarticle $blogarticle
|
||||
*
|
||||
* @return Blogcomment
|
||||
*/
|
||||
public function setBlogarticle(\Cadoles\PortalBundle\Entity\Blogarticle $blogarticle)
|
||||
{
|
||||
$this->blogarticle = $blogarticle;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get blogarticle
|
||||
*
|
||||
* @return \Cadoles\PortalBundle\Entity\Blogarticle
|
||||
*/
|
||||
public function getBlogarticle()
|
||||
{
|
||||
return $this->blogarticle;
|
||||
}
|
||||
}
|
@ -39,6 +39,11 @@ class BlogarticleType extends AbstractType
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
"config" => ["height" => "500px",'filebrowserUploadRoute' => 'cadoles_portal_'.$options["access"].'_blogarticle_upload']
|
||||
])
|
||||
|
||||
->add("fgcomment",ChoiceType::class,[
|
||||
"label" =>"Permettre les commentaires",
|
||||
"choices" => ["non"=>"0","oui"=>"1"]
|
||||
])
|
||||
|
||||
->add('image',HiddenType::class, [
|
||||
"label" =>"image",
|
||||
|
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Cadoles\PortalBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Ivory\CKEditorBundle\Form\Type\CKEditorType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
class BlogcommentType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$user=$options['user'];
|
||||
|
||||
$builder
|
||||
->add('submit', SubmitType::class, [
|
||||
"label" => ($options["mode"]=="delete"?"Confirmer la Suppression":"Valider"),
|
||||
"attr" => ($options["mode"]=="delete"?array("class" => "btn btn-danger"):array("class" => "btn btn-success"))
|
||||
])
|
||||
|
||||
->add('name', TextType::class, [
|
||||
'label' => 'Titre'
|
||||
])
|
||||
|
||||
->add("description",CKEditorType::class,[
|
||||
"config_name" => 'full_config',
|
||||
"label" => 'Description',
|
||||
"required" => false,
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
"config" => ["height" => "500px",'filebrowserUploadRoute' => 'cadoles_portal_'.$options["access"].'_blogcomment_upload']
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => 'Cadoles\PortalBundle\Entity\Blogcomment',
|
||||
'mode' => 'string',
|
||||
'access' => 'string',
|
||||
'user' => 'Cadoles\CoreBundle\Entity\User'
|
||||
]);
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Cadoles\PortalBundle\Repository;
|
||||
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Cadoles\PortalBundle\Entity\Blog;
|
||||
|
||||
class BlogcommentRepository extends EntityRepository
|
||||
{
|
||||
|
||||
}
|
@ -550,6 +550,43 @@ cadoles_portal_user_blogarticle_image:
|
||||
path: /user/blogarticle/image
|
||||
defaults: { _controller: CadolesPortalBundle:Blogarticle:image, access: user }
|
||||
|
||||
#== BLOGCOMMENT ==========================================================================================================================================
|
||||
|
||||
#-- Access config
|
||||
cadoles_portal_config_blogcomment_submit:
|
||||
path: /config/blogcomment/submit/{idarticle}
|
||||
defaults: { _controller: CadolesPortalBundle:Blogcomment:submit, access: config}
|
||||
|
||||
cadoles_portal_config_blogcomment_update:
|
||||
path: /config/blogcomment/update/{id}
|
||||
defaults: { _controller: CadolesPortalBundle:Blogcomment:update, access: config }
|
||||
|
||||
cadoles_portal_config_blogcomment_delete:
|
||||
path: /config/blogcomment/delete/{id}
|
||||
defaults: { _controller: CadolesPortalBundle:Blogcomment:delete, access: config }
|
||||
|
||||
cadoles_portal_config_blogcomment_upload:
|
||||
path: /config/blogcomment/upload
|
||||
defaults: { _controller: CadolesPortalBundle:Blogcomment:upload, access: config }
|
||||
|
||||
#-- Access user
|
||||
cadoles_portal_user_blogcomment_submit:
|
||||
path: /user/blogcomment/submit/{idarticle}
|
||||
defaults: { _controller: CadolesPortalBundle:Blogcomment:submit, access: user }
|
||||
|
||||
cadoles_portal_user_blogcomment_update:
|
||||
path: /user/blogcomment/update/{id}
|
||||
defaults: { _controller: CadolesPortalBundle:Blogcomment:update, access: user }
|
||||
|
||||
cadoles_portal_user_blogcomment_delete:
|
||||
path: /user/blogcomment/delete/{id}
|
||||
defaults: { _controller: CadolesPortalBundle:Blogcomment:delete, access: user }
|
||||
|
||||
cadoles_portal_user_blogcomment_upload:
|
||||
path: /user/blogcomment/upload
|
||||
defaults: { _controller: CadolesPortalBundle:Blogcomment:upload, access: user }
|
||||
|
||||
|
||||
#== CALENDAR =============================================================================================================================================
|
||||
|
||||
#-- Access config
|
||||
|
@ -56,7 +56,8 @@
|
||||
<div class="col-md-8">
|
||||
{{ form_row(form.name) }}
|
||||
{{ form_row(form.blog) }}
|
||||
{{ form_row(form.description) }}
|
||||
{{ form_row(form.fgcomment) }}
|
||||
{{ form_row(form.description) }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
|
@ -28,7 +28,7 @@
|
||||
{% block pagewrapper %}
|
||||
{% if access=="config" %}
|
||||
<div class="pagemenu">
|
||||
<a href="{{ path('cadoles_portal_config_blog_view', {id:entity.blog.id})}}">{{ entity.blog.name }}</a>>
|
||||
<a href="{{ path('cadoles_portal_config_blog_view', {id:entity.blog.id})}}">{{ entity.blog.name }}</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<br>
|
||||
@ -71,6 +71,25 @@
|
||||
<div class="blogbody">
|
||||
{{ entity.description | raw }}
|
||||
</div>
|
||||
|
||||
{% if entity.fgcomment %}
|
||||
<hr>
|
||||
<a href="{{path('cadoles_portal_'~access~'_blogcomment_submit',{"idarticle":entity.id}) }}" style="width:100%" class="btn btn-success">Ajouter un commentaire</a>
|
||||
{% endif %}
|
||||
{% if not entity.blogcomments is empty %}
|
||||
{% for comment in entity.blogcomments|reverse %}
|
||||
<div class="blogtitle">
|
||||
<legend><h2>{{comment.name}}</h2></legend>
|
||||
<small>publié par {{ comment.user.username }} le {{ comment.submit|date("d/m/Y à H:i") }}</small>
|
||||
{% if canadd or app.user==comment.user%}
|
||||
<a href="{{ path("cadoles_portal_"~access~"_blogcomment_update",{'id':comment.id}) }}"><i class="fa fa-file"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="blogbody">
|
||||
{{ comment.description | raw }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="blogsidebar col col-md-3">
|
||||
|
@ -0,0 +1,60 @@
|
||||
{% extends '@CadolesCore/base.html.twig' %}
|
||||
|
||||
{% block pagewrapper %}
|
||||
{{ form_start(form) }}
|
||||
<h1 class="page-header">
|
||||
{% if mode=="update" %}
|
||||
Modification Commentaire Article de Blog
|
||||
{% elseif mode=="submit" %}
|
||||
Création Commentaire Article de Blog
|
||||
{% endif %}
|
||||
</h1>
|
||||
|
||||
{{ form_widget(form.submit) }}
|
||||
<a class="btn btn-default" href={{ path('cadoles_portal_'~access~'_blogarticle_view',{'id':entity.blogarticle.id}) }}'>Annuler</a>
|
||||
|
||||
{% if mode=="update" %}
|
||||
<a href={{ path('cadoles_portal_'~access~'_blogcomment_delete',{'id':entity.id}) }}
|
||||
class="btn btn-danger pull-right"
|
||||
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
|
||||
data-confirm="Êtes-vous sûr de vouloir supprimer ce commentaire ?">
|
||||
Supprimer
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<br><br>
|
||||
|
||||
{% if app.session.flashbag.has('error') %}
|
||||
<div class='alert alert-danger' style='margin: 5px 0px'>
|
||||
<strong>Erreur</strong><br>
|
||||
{% for flashMessage in app.session.flashbag.get('error') %}
|
||||
{{ flashMessage }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if app.session.flashbag.has('notice') %}
|
||||
<div class='alert alert-info' style='margin: 5px 0px'>
|
||||
<strong>Information</strong><br>
|
||||
{% for flashMessage in app.session.flashbag.get('notice') %}
|
||||
{{ flashMessage }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<div class="form-group clearfix">
|
||||
{{ form_row(form.name) }}
|
||||
{{ form_row(form.description) }}
|
||||
</div>
|
||||
|
||||
|
||||
{{ form_end(form) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block localjavascript %}
|
||||
$('#mymodal').on('hidden.bs.modal', function () {
|
||||
var imgSrc = $("#blogcomment_image_img").attr('src');
|
||||
$("#blogcomment_image_img").attr('src',imgSrc);
|
||||
});
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user