This commit is contained in:
afornerot 2019-04-05 11:52:31 +02:00
parent f2d86288d9
commit 77ca334c16
62 changed files with 5868 additions and 145 deletions

View File

@ -24,7 +24,7 @@ parameters:
portal_activate: true
# Information de base de l'annuaire
ldap_host: 127.0.0.1
ldap_host: 172.27.7.61
ldap_port: 389
ldap_user: cn=admin,o=gouv,c=fr
ldap_password: eole

View File

@ -28,6 +28,7 @@ class SecurityController extends Controller
\phpCAS::setDebug(false);
\phpCAS::client(CAS_VERSION_2_0, $this->getParameter('cas_host'), $this->getParameter('cas_port'), is_null($this->getParameter('cas_path')) ? '' : $this->getParameter('cas_path'), true);
\phpCAS::setNoCasServerValidation();
// Authentification
\phpCAS::forceAuthentication();
@ -162,6 +163,7 @@ class SecurityController extends Controller
\phpCAS::client(CAS_VERSION_2_0, $this->getParameter('cas_host'), $this->getParameter('cas_port'), is_null($this->getParameter('cas_path')) ? '' : $this->getParameter('cas_path'), true);
\phpCAS::setNoCasServerValidation();
// Logout
$url=$this->generateUrl('cadoles_core_home', array(), UrlGeneratorInterface::ABSOLUTE_URL);
\phpCAS::logout(array("service"=>$url));

View File

@ -0,0 +1,230 @@
<?php
namespace Cadoles\CoreBundle\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpKernel\KernelInterface;
use Doctrine\DBAL\Connection as DBALConnection;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Validator\Constraints\DateTime;
use Cadoles\CoreBundle\Entity\Registration;
class PurgeFileCommand extends Command
{
private $container;
private $em;
private $output;
private $filesystem;
private $rootlog;
protected function configure()
{
$this
->setName('Core:PurgeFile')
->setDescription('Purge Files')
->setHelp('This command Purge the obsolete Files')
->addArgument('cronid', InputArgument::OPTIONAL, 'ID Cron Job')
->addArgument('lastchance', InputArgument::OPTIONAL, 'Lastchance to run the cron')
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->container = $this->getApplication()->getKernel()->getContainer();
$this->em = $this->container->get('doctrine')->getEntityManager();
$this->output = $output;
$this->filesystem = new Filesystem();
$this->rootlog = $this->container->get('kernel')->getRootDir()."/../var/logs/";
$this->writelnred('');
$this->writelnred('== Core:PurgeFile');
$this->writelnred('==========================================================================================================');
$now=new \DateTime('now');
// /uploads/file
$this->writelnred('');
$this->writelnred('== Directory = File');
$directory=$this->container->get('kernel')->getRootDir()."/../uploads/file";
$files=[];
$fs = new Filesystem();
if($fs->exists($directory)) {
$finder = new Finder();
$finder->in($directory)->directories()->exclude("thumb");
foreach (iterator_to_array($finder) as $file) {
$name = $file->getRelativePathname();
$type = explode("-",$name)[0];
$id = explode("-",$name)[1];
switch($type) {
case "widget":
$entity=$this->em->getRepository("CadolesPortalBundle:Pagewidget")->find($id);
if(!$entity) {
$this->writeln($name);
$url=$directory."/".$name;
if($fs->exists($url)) {
$fs->remove($url);
}
}
break;
}
}
}
// /web/uploads/avatar
$this->writelnred('');
$this->writelnred('== Directory = Avatar');
$directory=$this->container->get('kernel')->getRootDir()."/../web/uploads/avatar";
$files=[];
$fs = new Filesystem();
if($fs->exists($directory)) {
$finder = new Finder();
$finder->in($directory)->files();
foreach (iterator_to_array($finder) as $file) {
$name = $file->getRelativePathname();
if($name!="admin.jpg"&&$name!="noavatar.png"&&$name!="system.jpg") {
$entity=$this->em->getRepository("CadolesCoreBundle:User")->findBy(["avatar"=>$name]);
if(!$entity) {
$this->writeln($name);
$url=$directory."/".$name;
if($fs->exists($url)) {
$fs->remove($url);
}
}
}
}
}
// /web/uploads/header
$this->writelnred('');
$this->writelnred('== Directory = Header');
$directory=$this->container->get('kernel')->getRootDir()."/../web/uploads/header";
$files=[];
$fs = new Filesystem();
if($fs->exists($directory)) {
$finder = new Finder();
$finder->in($directory)->files();
foreach (iterator_to_array($finder) as $file) {
$name = $file->getRelativePathname();
if($name!="header.png") {
$entity=$this->em->getRepository("CadolesCoreBundle:Config")->findBy(["id"=>"header","value"=>"uploads/header/".$name]);
if(!$entity) {
$this->writeln($name);
$url=$directory."/".$name;
if($fs->exists($url)) {
$fs->remove($url);
}
}
}
}
}
// /web/uploads/header
$this->writelnred('');
$this->writelnred('== Directory = Logo');
$directory=$this->container->get('kernel')->getRootDir()."/../web/uploads/logo";
$files=[];
$fs = new Filesystem();
if($fs->exists($directory)) {
$finder = new Finder();
$finder->in($directory)->files();
foreach (iterator_to_array($finder) as $file) {
$name = $file->getRelativePathname();
if($name!="logo.png") {
$entity=$this->em->getRepository("CadolesCoreBundle:Config")->findBy(["id"=>"logo","value"=>"uploads/logo/".$name]);
if(!$entity) {
$this->writeln($name);
$url=$directory."/".$name;
if($fs->exists($url)) {
$fs->remove($url);
}
}
}
}
}
// /web/uploads/slide
$this->writelnred('');
$this->writelnred('== Directory = Slide');
$directory=$this->container->get('kernel')->getRootDir()."/../web/uploads/slide";
$files=[];
$fs = new Filesystem();
if($fs->exists($directory)) {
$finder = new Finder();
$finder->in($directory)->files();
foreach (iterator_to_array($finder) as $file) {
$name = $file->getRelativePathname();
$entity=$this->em->getRepository("CadolesPortalBundle:Slide")->findBy(["image"=>"uploads/slide/".$name]);
if(!$entity) {
$this->writeln($name);
$url=$directory."/".$name;
if($fs->exists($url)) {
$fs->remove($url);
}
}
}
}
// /web/uploads/icon
$this->writelnred('');
$this->writelnred('== Directory = Icon');
$directory=$this->container->get('kernel')->getRootDir()."/../web/uploads/icon";
$files=[];
$fs = new Filesystem();
if($fs->exists($directory)) {
$finder = new Finder();
$finder->in($directory)->files();
foreach (iterator_to_array($finder) as $file) {
$name = $file->getRelativePathname();
if(!stripos($name,"icon_")) {
$entity=$this->em->getRepository("CadolesPortalBundle:Icon")->findBy(["label"=>"uploads/icon/".$name]);
if(!$entity) {
$this->writeln($name);
$url=$directory."/".$name;
if($fs->exists($url)) {
$fs->remove($url);
}
}
}
}
}
$this->writeln('');
return 1;
}
private function writelnred($string) {
$this->output->writeln('<fg=red>'.$string.'</>');
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
}
private function writeln($string) {
$this->output->writeln($string);
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
}
}

View File

@ -102,25 +102,25 @@ class SynchroCommand extends Command
$ldapfilter="(&(uid=*)(ENTPersonProfils=eleve))";
$label="PROFIL = Elèves";
$this->writeln(" - $label");
if(!$simulate) $this->addmodGroup($label,$ldapfilter);
if(!$simulate) $this->addmodGroup($label,$ldapfilter,false);
// Enseignants
$ldapfilter="(|(&(uid=*)(ENTPersonProfils=enseignant))(&(uid=*)(typeadmin=0))(&(uid=*)(typeadmin=2)))";
$label="PROFIL = Enseignants";
$this->writeln(" - $label");
if(!$simulate) $this->addmodGroup($label,$ldapfilter);
if(!$simulate) $this->addmodGroup($label,$ldapfilter,true);
// Responsables
$ldapfilter="(&(uid=*)(ENTPersonProfils=responsable))";
$label="PROFIL = Responsables";
$this->writeln(" - $label");
if(!$simulate) $this->addmodGroup($label,$ldapfilter);
if(!$simulate) $this->addmodGroup($label,$ldapfilter,false);
// Administratifs
$ldapfilter="(&(uid=*)(ENTPersonProfils=administratif))";
$label="PROFIL = Administratifs";
$this->writeln(" - $label");
if(!$simulate) $this->addmodGroup($label,$ldapfilter);
if(!$simulate) $this->addmodGroup($label,$ldapfilter,true);
$this->writeln('');
$this->writeln('== CLASSES ==========================================');
@ -131,7 +131,7 @@ class SynchroCommand extends Command
$label="CLASSE = ".$result["cn"];
$this->writeln(" - $label");
if(!$simulate) $this->addmodGroup($label,$ldapfilter);
if(!$simulate) $this->addmodGroup($label,$ldapfilter,true);
}
}
@ -623,11 +623,12 @@ class SynchroCommand extends Command
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
}
protected function addmodGroup($label,$ldapfilter) {
protected function addmodGroup($label,$ldapfilter,$fgcanshare) {
$group=$this->em->getRepository('CadolesCoreBundle:Group')->findOneBy(array('fgtemplate' => true, 'label' => $label));
if(!$group) {
$group=new Group();
$group->setFgcanshare($fgcanshare);
}
$group->setLabel($label);

View File

@ -14,7 +14,7 @@ INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastna
TRUNCATE TABLE sidebar;
INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `fonticon`, `permission`, `appactivate`) VALUES
(1000, NULL, 1000, 'CONFIGIRATION', '', 'fa-gear', 'ROLE_ADMIN,ROLE_MODO', ''),
(1000, NULL, 1000, 'CONFIGURATION', '', 'fa-gear', 'ROLE_ADMIN,ROLE_MODO', ''),
(1010, 1000, 1010, 'Générale', 'cadoles_core_config_commun', 'fa-table', 'ROLE_ADMIN', ''),
(1200, NULL, 1200, 'ORGANISATION', NULL, 'fa-sitemap', 'ROLE_ADMIN,ROLE_MODO', ''),
(1210, 1200, 1210, 'Listes Blanche', 'cadoles_core_config_whitelist', 'fa-tasks', 'ROLE_ADMIN', ''),
@ -24,10 +24,13 @@ INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `f
(1260, 1200, 1260, 'Utilisateurs', 'cadoles_core_config_user', 'fa-child', 'ROLE_ADMIN,ROLE_MODO', ''),
(1500, NULL, 1500, 'PORTAIL', NULL, 'fa-cubes', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1510, 1500, 1510, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1510, 1500, 1510, 'Pages', 'cadoles_portal_config_page', 'fa-file', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1520, 1500, 1520, 'Items', 'cadoles_portal_config_item', 'fa-desktop', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1530, 1500, 1530, 'Annonces', 'cadoles_portal_config_alert', 'fa-bell', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1540, 1500, 1540, 'Pages', 'cadoles_portal_config_page', 'fa-file', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1540, 1500, 1540, 'Calendriers', 'cadoles_portal_config_calendar', 'fa-calendar', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1550, 1500, 1550, 'Chartes', 'cadoles_portal_config_notice', 'fa-info', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1560, 1500, 1560, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(7000, NULL, 7000, 'CRON', NULL, 'fa-bolt', 'ROLE_ADMIN', 'cron_activate'),
(7010, 7000, 7010, 'Jobs', 'cadoles_cron_config', 'fa-bullseye', 'ROLE_ADMIN', 'cron_activate'),

View File

@ -29,6 +29,22 @@ class CoreController extends Controller
// L'utilisateur en cours
$user=$this->getUser();
// Chargement des chartes à signer
if($user) {
$notices=$em->getRepository("CadolesPortalBundle:Notice")->getNoticeToRead($user);
if(! $notices->isEmpty()) {
return $this->render('CadolesPortalBundle:Notice:mustread.html.twig',[
'useheader' => true,
'usemenu' => false,
'usesidebar' => false,
'maxwidth' => true,
'mustread' => true,
'notices' => $notices
]);
}
}
// Calcul des pages de l'utilisateur
$this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->getPagesUser($user,$id,$entity,$pagesuser,$pagesadmin,$pagesshared);
@ -37,7 +53,7 @@ class CoreController extends Controller
return $this->render('CadolesPortalBundle:Page:default.html.twig',[
'useheader' => true,
'usemenu' => false,
'usesidebar' => false,
'usesidebar' => false
]);
}
@ -49,6 +65,7 @@ class CoreController extends Controller
'access' => "user",
'pagesadmin' => $pagesadmin,
'pagesuser' => $pagesuser,
'pagesshared' => $pagesshared,
'canadd' => ($user),
'widgets' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->findAll()
]);

View File

@ -82,18 +82,22 @@ class GroupController extends Controller
break;
case 2 :
$qb->orderBy('table.fgopen',$order[0]["dir"]);
break;
break;
case 3 :
$qb->orderBy('table.fgcanshare',$order[0]["dir"]);
break;
}
$datas=$qb->setFirstResult($start)->setMaxResults($length)->getQuery()->getResult();
foreach($datas as $data) {
$action = "";
if(!$data->getFgall()&&!$data->getFgTemplate()) $action .="<a href='".$this->generateUrl('cadoles_core_config_group_update', array('id'=>$data->getId()))."'><i class='fa fa-file fa-fw'></i></a>";
//if(!$data->getFgall()&&!$data->getFgTemplate())
$action .="<a href='".$this->generateUrl('cadoles_core_config_group_update', array('id'=>$data->getId()))."'><i class='fa fa-file fa-fw'></i></a>";
if($data->getId()>0&&!$data->getFgall()&&!$data->getFgTemplate()&&$this->isGranted('ROLE_ADMIN')) $action.="<a href='".$this->generateUrl('cadoles_core_config_group_delete', array('id'=>$data->getId()))."'><i class='fa fa-trash fa-fw'></i></a>";
if(!$data->getFgall()) $action .="<a href='".$this->generateUrl('cadoles_core_config_group_users', array('id'=>$data->getId()))."'><i class='fa fa-users fa-fw'></i></a>";
array_push($output["data"],array($action,$data->getLabel(),($data->getFgopen()?"oui":"non")));
array_push($output["data"],array($action,$data->getLabel(),($data->getFgopen()?"oui":"non"),($data->getFgcanshare()?"oui":"non")));
}
// Retour
@ -415,7 +419,7 @@ class GroupController extends Controller
$data = new Group();
// Création du formulaire
$form = $this->createForm(GroupType::class,$data,array("mode"=>"submit","masteridentity"=> $this->GetParameter("masteridentity")));
$form = $this->createForm(GroupType::class,$data,array("mode"=>"submit","updatelimite"=>false,"masteridentity"=> $this->GetParameter("masteridentity")));
// Récupération des data du formulaire
$form->handleRequest($request);
@ -457,12 +461,9 @@ class GroupController extends Controller
// Récupération de l'enregistrement courant
$data=$this->getData($id);
// Vérifier que cet enregistrement est modifiable
if($data->getFgAll()||$data->getFgTemplate())
throw $this->createNotFoundException('Permission denied');
// Création du formulaire
$form = $this->createForm(GroupType::class,$data,array("mode"=>"update","masteridentity"=> $this->GetParameter("masteridentity")));
$form = $this->createForm(GroupType::class,$data,array("mode"=>"update","updatelimite"=>($data->getFgAll()||$data->getFgTemplate()),"masteridentity"=> $this->GetParameter("masteridentity")));
// Récupération des data du formulaire
$form->handleRequest($request);

View File

@ -13,6 +13,7 @@ use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use Symfony\Component\HttpFoundation\Response;
use Cadoles\CoreBundle\Entity\User;
use Cadoles\CoreBundle\Form\LoginType;
@ -64,4 +65,35 @@ class SecurityController extends Controller
else
return $this->redirectToRoute("myapp_webzine_home");
}
public function checkuserAction(Request $request)
{
// Mode d'authentification
$modeauth=$this->getParameter('mode_auth');
switch($modeauth) {
case "CAS":
// Init Client CAS
\phpCAS::setDebug(false);
\phpCAS::client(CAS_VERSION_2_0, $this->container->getParameter('cas_host'), $this->container->getParameter('cas_port'), is_null($this->container->getParameter('cas_path')) ? '' : $this->container->getParameter('cas_path'), false);
\phpCAS::setNoCasServerValidation();
if(\phpCAS::checkAuthentication()) {
$usercas = \phpCAS::getUser();
$userapp = $this->getUser();
// si on a un usercas mais pas de userapp c'est qu'il faut s'autoconnect
if(!$userapp) {
$url=$this->generateUrl('cas_sp.login');
return new Response(
'<script>document.location.replace("'.$url.'");</script>'
);
}
}
break;
}
return new Response();
}
}

View File

@ -476,7 +476,8 @@ class UserController extends Controller
return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => ($access=="config"),
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
$this->labeldata => $data,
'mode' => 'update',
'access' => $access,

View File

@ -34,6 +34,11 @@ class Group
*/
private $fgopen;
/**
* @ORM\Column(type="boolean")
*/
private $fgcanshare;
/**
* @ORM\Column(type="boolean")
*/
@ -62,11 +67,6 @@ class Group
*/
private $users;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Page", mappedBy="groups")
*/
protected $pages;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Item", mappedBy="groups")
*/
@ -77,12 +77,27 @@ class Group
*/
protected $alerts;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Page", mappedBy="groups")
*/
protected $pages;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Flux", mappedBy="groups")
*/
protected $fluxs;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Notice", mappedBy="groups")
*/
protected $notices;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Calendar", mappedBy="groups")
*/
protected $calendars;
/**
* Constructor
@ -90,10 +105,12 @@ class Group
public function __construct()
{
$this->users = new \Doctrine\Common\Collections\ArrayCollection();
$this->pages = new \Doctrine\Common\Collections\ArrayCollection();
$this->items = new \Doctrine\Common\Collections\ArrayCollection();
$this->alerts = new \Doctrine\Common\Collections\ArrayCollection();
$this->pages = new \Doctrine\Common\Collections\ArrayCollection();
$this->fluxs = new \Doctrine\Common\Collections\ArrayCollection();
$this->notices = new \Doctrine\Common\Collections\ArrayCollection();
$this->calendars = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
@ -154,6 +171,30 @@ class Group
return $this->fgopen;
}
/**
* Set fgcanshare
*
* @param boolean $fgcanshare
*
* @return Group
*/
public function setFgcanshare($fgcanshare)
{
$this->fgcanshare = $fgcanshare;
return $this;
}
/**
* Get fgcanshare
*
* @return boolean
*/
public function getFgcanshare()
{
return $this->fgcanshare;
}
/**
* Set fgall
*
@ -284,40 +325,6 @@ class Group
return $this->users;
}
/**
* Add page
*
* @param \Cadoles\PortalBundle\Entity\Alert $page
*
* @return Group
*/
public function addPage(\Cadoles\PortalBundle\Entity\Alert $page)
{
$this->pages[] = $page;
return $this;
}
/**
* Remove page
*
* @param \Cadoles\PortalBundle\Entity\Alert $page
*/
public function removePage(\Cadoles\PortalBundle\Entity\Alert $page)
{
$this->pages->removeElement($page);
}
/**
* Get pages
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getPages()
{
return $this->pages;
}
/**
* Add item
*
@ -386,6 +393,40 @@ class Group
return $this->alerts;
}
/**
* Add page
*
* @param \Cadoles\PortalBundle\Entity\Page $page
*
* @return Group
*/
public function addPage(\Cadoles\PortalBundle\Entity\Page $page)
{
$this->pages[] = $page;
return $this;
}
/**
* Remove page
*
* @param \Cadoles\PortalBundle\Entity\Page $page
*/
public function removePage(\Cadoles\PortalBundle\Entity\Page $page)
{
$this->pages->removeElement($page);
}
/**
* Get pages
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getPages()
{
return $this->pages;
}
/**
* Add flux
*
@ -419,4 +460,72 @@ class Group
{
return $this->fluxs;
}
/**
* Add notice
*
* @param \Cadoles\PortalBundle\Entity\Notice $notice
*
* @return Group
*/
public function addNotice(\Cadoles\PortalBundle\Entity\Notice $notice)
{
$this->notices[] = $notice;
return $this;
}
/**
* Remove notice
*
* @param \Cadoles\PortalBundle\Entity\Notice $notice
*/
public function removeNotice(\Cadoles\PortalBundle\Entity\Notice $notice)
{
$this->notices->removeElement($notice);
}
/**
* Get notices
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getNotices()
{
return $this->notices;
}
/**
* Add calendar
*
* @param \Cadoles\PortalBundle\Entity\Calendar $calendar
*
* @return Group
*/
public function addCalendar(\Cadoles\PortalBundle\Entity\Calendar $calendar)
{
$this->calendars[] = $calendar;
return $this;
}
/**
* Remove calendar
*
* @param \Cadoles\PortalBundle\Entity\Calendar $calendar
*/
public function removeCalendar(\Cadoles\PortalBundle\Entity\Calendar $calendar)
{
$this->calendars->removeElement($calendar);
}
/**
* Get calendars
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getCalendars()
{
return $this->calendars;
}
}

View File

@ -203,6 +203,20 @@ class User implements UserInterface, \Serializable
*/
private $bookmarks;
/**
* @var ArrayCollection $calendar
* @var Calendar
*
* @ORM\OneToMany(targetEntity="Cadoles\PortalBundle\Entity\Calendar", mappedBy="user", cascade={"persist"}, orphanRemoval=true)
*/
private $calendars;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Notice", mappedBy="users")
*/
protected $notices;
//== CODE A NE PAS REGENERER
/**
* @ORM\PostLoad
@ -290,6 +304,7 @@ class User implements UserInterface, \Serializable
/**
* Get id
*
@ -1039,4 +1054,72 @@ class User implements UserInterface, \Serializable
{
return $this->bookmarks;
}
/**
* Add calendar
*
* @param \Cadoles\PortalBundle\Entity\Calendar $calendar
*
* @return User
*/
public function addCalendar(\Cadoles\PortalBundle\Entity\Calendar $calendar)
{
$this->calendars[] = $calendar;
return $this;
}
/**
* Remove calendar
*
* @param \Cadoles\PortalBundle\Entity\Calendar $calendar
*/
public function removeCalendar(\Cadoles\PortalBundle\Entity\Calendar $calendar)
{
$this->calendars->removeElement($calendar);
}
/**
* Get calendars
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getCalendars()
{
return $this->calendars;
}
/**
* Add notice
*
* @param \Cadoles\PortalBundle\Entity\Notice $notice
*
* @return User
*/
public function addNotice(\Cadoles\PortalBundle\Entity\Notice $notice)
{
$this->notices[] = $notice;
return $this;
}
/**
* Remove notice
*
* @param \Cadoles\PortalBundle\Entity\Notice $notice
*/
public function removeNotice(\Cadoles\PortalBundle\Entity\Notice $notice)
{
$this->notices->removeElement($notice);
}
/**
* Get notices
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getNotices()
{
return $this->notices;
}
}

View File

@ -65,6 +65,10 @@
$masteridentity =$this->container->getParameter('masteridentity');
$session->set('masteridentity',$masteridentity);
// mode_auth
$mode_auth =$this->container->getParameter('mode_auth');
$session->set('mode_auth',$mode_auth);
// Chargement de la sidebar
$iconniveau01 =$this->container->getParameter('iconniveau01');
$labelsniveau01 =$this->container->getParameter('labelsniveau01');

View File

@ -30,72 +30,84 @@ class GroupType extends AbstractType
)
);
$builder->add('label',
TextType::class, array(
"label" =>"Label",
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
$choices=array("oui" => "1","non" => "0");
$builder->add("fgopen",
$builder->add("fgcanshare",
ChoiceType::class,array(
"label" =>"Groupe Ouvert (inscription possible par les utilisateurs)",
"label" =>"Partage dans le groupe activé",
'disabled' => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"choices" => $choices
)
);
// Si masteridentity = LDAP alors on demande le filtre des utilisateurs qui appartiennent à ce groupe
if($options["masteridentity"]=="LDAP")
{
$choices=array("oui" => "1","non" => "0");
$builder->add("fgassoc",
ChoiceType::class,array(
"mapped" => false,
"label" => "Groupe associé à l'annuaire ?",
'disabled' => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"choices" => $choices
)
);
$builder->add('ldapfilter',
if(!$options["updatelimite"]) {
$builder->add('label',
TextType::class, array(
"label" => "Filtre LDAP des utilisateurs",
"label_attr" => array("id" => "label_group_ldapfilter"),
"label" =>"Label",
"disabled" => ($options["mode"]=="delete"?true:false),
"required" => false,
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
}
if($options["masteridentity"]=="SSO")
{
$choices=array("oui" => "1","non" => "0");
$builder->add("fgassoc",
$builder->add("fgopen",
ChoiceType::class,array(
"mapped" => false,
"label" => "Groupe associé à des attributs SSO ?",
"label" =>"Groupe Ouvert (inscription possible par les utilisateurs)",
'disabled' => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"choices" => $choices
)
);
$builder->add('attributes',
TextareaType::class, array(
"label" => "Attributs SSO des utilisateurs",
"label_attr" => array("id" => "label_group_attributes"),
"disabled" => ($options["mode"]=="delete"?true:false),
"required" => false,
"attr" => array("rows" => 10, "class" => "form-control", "style" => "margin-bottom:15px")
)
);
}
// Si masteridentity = LDAP alors on demande le filtre des utilisateurs qui appartiennent à ce groupe
if($options["masteridentity"]=="LDAP")
{
$choices=array("oui" => "1","non" => "0");
$builder->add("fgassoc",
ChoiceType::class,array(
"mapped" => false,
"label" => "Groupe associé à l'annuaire ?",
'disabled' => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"choices" => $choices
)
);
$builder->add('ldapfilter',
TextType::class, array(
"label" => "Filtre LDAP des utilisateurs",
"label_attr" => array("id" => "label_group_ldapfilter"),
"disabled" => ($options["mode"]=="delete"?true:false),
"required" => false,
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
}
if($options["masteridentity"]=="SSO")
{
$choices=array("oui" => "1","non" => "0");
$builder->add("fgassoc",
ChoiceType::class,array(
"mapped" => false,
"label" => "Groupe associé à des attributs SSO ?",
'disabled' => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"choices" => $choices
)
);
$builder->add('attributes',
TextareaType::class, array(
"label" => "Attributs SSO des utilisateurs",
"label_attr" => array("id" => "label_group_attributes"),
"disabled" => ($options["mode"]=="delete"?true:false),
"required" => false,
"attr" => array("rows" => 10, "class" => "form-control", "style" => "margin-bottom:15px")
)
);
}
}
}
public function configureOptions(OptionsResolver $resolver)
@ -103,7 +115,8 @@ class GroupType extends AbstractType
$resolver->setDefaults(array(
'data_class' => 'Cadoles\CoreBundle\Entity\Group',
'mode' => "string",
'masteridentity' => "string"
'masteridentity' => "string",
'updatelimite' => "boolean"
));
}
}

View File

@ -12,6 +12,10 @@ cadoles_core_logout:
path: /logout
defaults: { _controller: CadolesCoreBundle:Security:logout }
cadoles_core_checkuser:
path: /checkuser
defaults: { _controller: CadolesCoreBundle:Security:checkuser }
cadoles_core_kill:
path: /kill
defaults: { _controller: CadolesCoreBundle:Security:kill }

View File

@ -0,0 +1,1124 @@
/*!
* FullCalendar v2.6.1 Stylesheet
* Docs & License: http://fullcalendar.io/
* (c) 2015 Adam Shaw
*/
.fc {
direction: ltr;
text-align: left;
}
.fc-rtl {
text-align: right;
}
body .fc { /* extra precedence to overcome jqui */
font-size: 1em;
}
/* Colors
--------------------------------------------------------------------------------------------------*/
.fc-unthemed th,
.fc-unthemed td,
.fc-unthemed thead,
.fc-unthemed tbody,
.fc-unthemed .fc-divider,
.fc-unthemed .fc-row,
.fc-unthemed .fc-popover {
border-color: #ddd;
}
.fc-unthemed .fc-popover {
background-color: #fff;
}
.fc-unthemed .fc-divider,
.fc-unthemed .fc-popover .fc-header {
background: #eee;
}
.fc-unthemed .fc-popover .fc-header .fc-close {
color: #666;
}
.fc-unthemed .fc-today {
background: #fcf8e3;
}
.fc-highlight { /* when user is selecting cells */
background: #bce8f1;
opacity: .3;
filter: alpha(opacity=30); /* for IE */
}
.fc-bgevent { /* default look for background events */
background: rgb(143, 223, 130);
opacity: .3;
filter: alpha(opacity=30); /* for IE */
}
.fc-nonbusiness { /* default look for non-business-hours areas */
/* will inherit .fc-bgevent's styles */
background: #d7d7d7;
}
/* Icons (inline elements with styled text that mock arrow icons)
--------------------------------------------------------------------------------------------------*/
.fc-icon {
display: inline-block;
width: 1em;
height: 1em;
line-height: 1em;
font-size: 1em;
text-align: center;
overflow: hidden;
font-family: "Courier New", Courier, monospace;
/* don't allow browser text-selection */
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/*
Acceptable font-family overrides for individual icons:
"Arial", sans-serif
"Times New Roman", serif
NOTE: use percentage font sizes or else old IE chokes
*/
.fc-icon:after {
position: relative;
margin: 0 -1em; /* ensures character will be centered, regardless of width */
}
.fc-icon-left-single-arrow:after {
content: "\02039";
font-weight: bold;
font-size: 200%;
top: -7%;
left: 3%;
}
.fc-icon-right-single-arrow:after {
content: "\0203A";
font-weight: bold;
font-size: 200%;
top: -7%;
left: -3%;
}
.fc-icon-left-double-arrow:after {
content: "\000AB";
font-size: 160%;
top: -7%;
}
.fc-icon-right-double-arrow:after {
content: "\000BB";
font-size: 160%;
top: -7%;
}
.fc-icon-left-triangle:after {
content: "\25C4";
font-size: 125%;
top: 3%;
left: -2%;
}
.fc-icon-right-triangle:after {
content: "\25BA";
font-size: 125%;
top: 3%;
left: 2%;
}
.fc-icon-down-triangle:after {
content: "\25BC";
font-size: 125%;
top: 2%;
}
.fc-icon-x:after {
content: "\000D7";
font-size: 200%;
top: 6%;
}
/* Buttons (styled <button> tags, normalized to work cross-browser)
--------------------------------------------------------------------------------------------------*/
.fc button {
/* force height to include the border and padding */
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
/* dimensions */
margin: 0;
height: 2.1em;
padding: 0 .6em;
/* text & cursor */
font-size: 1em; /* normalize */
white-space: nowrap;
cursor: pointer;
}
/* Firefox has an annoying inner border */
.fc button::-moz-focus-inner { margin: 0; padding: 0; }
.fc-state-default { /* non-theme */
border: 1px solid;
}
.fc-state-default.fc-corner-left { /* non-theme */
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
.fc-state-default.fc-corner-right { /* non-theme */
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
/* icons in buttons */
.fc button .fc-icon { /* non-theme */
position: relative;
top: -0.05em; /* seems to be a good adjustment across browsers */
margin: 0 .2em;
vertical-align: middle;
}
/*
button states
borrowed from twitter bootstrap (http://twitter.github.com/bootstrap/)
*/
.fc-state-default {
background-color: #f5f5f5;
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
background-repeat: repeat-x;
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
color: #333;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.fc-state-hover,
.fc-state-down,
.fc-state-active,
.fc-state-disabled {
color: #333333;
background-color: #e6e6e6;
}
.fc-state-hover {
color: #333333;
text-decoration: none;
background-position: 0 -15px;
-webkit-transition: background-position 0.1s linear;
-moz-transition: background-position 0.1s linear;
-o-transition: background-position 0.1s linear;
transition: background-position 0.1s linear;
}
.fc-state-down,
.fc-state-active {
background-color: #cccccc;
background-image: none;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.fc-state-disabled {
cursor: default;
background-image: none;
opacity: 0.65;
filter: alpha(opacity=65);
box-shadow: none;
}
/* Buttons Groups
--------------------------------------------------------------------------------------------------*/
.fc-button-group {
display: inline-block;
}
/*
every button that is not first in a button group should scootch over one pixel and cover the
previous button's border...
*/
.fc .fc-button-group > * { /* extra precedence b/c buttons have margin set to zero */
float: left;
margin: 0 0 0 -1px;
}
.fc .fc-button-group > :first-child { /* same */
margin-left: 0;
}
/* Popover
--------------------------------------------------------------------------------------------------*/
.fc-popover {
position: absolute;
box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.fc-popover .fc-header { /* TODO: be more consistent with fc-head/fc-body */
padding: 2px 4px;
}
.fc-popover .fc-header .fc-title {
margin: 0 2px;
}
.fc-popover .fc-header .fc-close {
cursor: pointer;
}
.fc-ltr .fc-popover .fc-header .fc-title,
.fc-rtl .fc-popover .fc-header .fc-close {
float: left;
}
.fc-rtl .fc-popover .fc-header .fc-title,
.fc-ltr .fc-popover .fc-header .fc-close {
float: right;
}
/* unthemed */
.fc-unthemed .fc-popover {
border-width: 1px;
border-style: solid;
}
.fc-unthemed .fc-popover .fc-header .fc-close {
font-size: .9em;
margin-top: 2px;
}
/* jqui themed */
.fc-popover > .ui-widget-header + .ui-widget-content {
border-top: 0; /* where they meet, let the header have the border */
}
/* Misc Reusable Components
--------------------------------------------------------------------------------------------------*/
.fc-divider {
border-style: solid;
border-width: 1px;
}
hr.fc-divider {
height: 0;
margin: 0;
padding: 0 0 2px; /* height is unreliable across browsers, so use padding */
border-width: 1px 0;
}
.fc-clear {
clear: both;
}
.fc-bg,
.fc-bgevent-skeleton,
.fc-highlight-skeleton,
.fc-helper-skeleton {
/* these element should always cling to top-left/right corners */
position: absolute;
top: 0;
left: 0;
right: 0;
}
.fc-bg {
bottom: 0; /* strech bg to bottom edge */
}
.fc-bg table {
height: 100%; /* strech bg to bottom edge */
}
/* Tables
--------------------------------------------------------------------------------------------------*/
.fc table {
width: 100%;
table-layout: fixed;
border-collapse: collapse;
border-spacing: 0;
font-size: 1em; /* normalize cross-browser */
}
.fc th {
text-align: center;
}
.fc th,
.fc td {
border-style: solid;
border-width: 1px;
padding: 0;
vertical-align: top;
}
.fc td.fc-today {
border-style: double; /* overcome neighboring borders */
}
/* Fake Table Rows
--------------------------------------------------------------------------------------------------*/
.fc .fc-row { /* extra precedence to overcome themes w/ .ui-widget-content forcing a 1px border */
/* no visible border by default. but make available if need be (scrollbar width compensation) */
border-style: solid;
border-width: 0;
}
.fc-row table {
/* don't put left/right border on anything within a fake row.
the outer tbody will worry about this */
border-left: 0 hidden transparent;
border-right: 0 hidden transparent;
/* no bottom borders on rows */
border-bottom: 0 hidden transparent;
}
.fc-row:first-child table {
border-top: 0 hidden transparent; /* no top border on first row */
}
/* Day Row (used within the header and the DayGrid)
--------------------------------------------------------------------------------------------------*/
.fc-row {
position: relative;
}
.fc-row .fc-bg {
z-index: 1;
}
/* highlighting cells & background event skeleton */
.fc-row .fc-bgevent-skeleton,
.fc-row .fc-highlight-skeleton {
bottom: 0; /* stretch skeleton to bottom of row */
}
.fc-row .fc-bgevent-skeleton table,
.fc-row .fc-highlight-skeleton table {
height: 100%; /* stretch skeleton to bottom of row */
}
.fc-row .fc-highlight-skeleton td,
.fc-row .fc-bgevent-skeleton td {
border-color: transparent;
}
.fc-row .fc-bgevent-skeleton {
z-index: 2;
}
.fc-row .fc-highlight-skeleton {
z-index: 3;
}
/*
row content (which contains day/week numbers and events) as well as "helper" (which contains
temporary rendered events).
*/
.fc-row .fc-content-skeleton {
position: relative;
z-index: 4;
padding-bottom: 2px; /* matches the space above the events */
}
.fc-row .fc-helper-skeleton {
z-index: 5;
}
.fc-row .fc-content-skeleton td,
.fc-row .fc-helper-skeleton td {
/* see-through to the background below */
background: none; /* in case <td>s are globally styled */
border-color: transparent;
/* don't put a border between events and/or the day number */
border-bottom: 0;
}
.fc-row .fc-content-skeleton tbody td, /* cells with events inside (so NOT the day number cell) */
.fc-row .fc-helper-skeleton tbody td {
/* don't put a border between event cells */
border-top: 0;
}
/* Scrolling Container
--------------------------------------------------------------------------------------------------*/
.fc-scroller { /* this class goes on elements for guaranteed vertical scrollbars */
overflow-y: scroll;
overflow-x: hidden;
}
.fc-scroller > * { /* we expect an immediate inner element */
position: relative; /* re-scope all positions */
width: 100%; /* hack to force re-sizing this inner element when scrollbars appear/disappear */
overflow: hidden; /* don't let negative margins or absolute positioning create further scroll */
}
/* Global Event Styles
--------------------------------------------------------------------------------------------------*/
.fc-event {
position: relative; /* for resize handle and other inner positioning */
display: block; /* make the <a> tag block */
font-size: .85em;
line-height: 1.3;
border-radius: 3px;
border: 1px solid #3a87ad; /* default BORDER color */
background-color: #3a87ad; /* default BACKGROUND color */
font-weight: normal; /* undo jqui's ui-widget-header bold */
}
/* overpower some of bootstrap's and jqui's styles on <a> tags */
.fc-event,
.fc-event:hover,
.ui-widget .fc-event {
color: #fff; /* default TEXT color */
text-decoration: none; /* if <a> has an href */
}
.fc-event[href],
.fc-event.fc-draggable {
cursor: pointer; /* give events with links and draggable events a hand mouse pointer */
}
.fc-not-allowed, /* causes a "warning" cursor. applied on body */
.fc-not-allowed .fc-event { /* to override an event's custom cursor */
cursor: not-allowed;
}
.fc-event .fc-bg { /* the generic .fc-bg already does position */
z-index: 1;
background: #fff;
opacity: .25;
filter: alpha(opacity=25); /* for IE */
}
.fc-event .fc-content {
position: relative;
z-index: 2;
}
.fc-event .fc-resizer {
position: absolute;
z-index: 3;
}
/* Horizontal Events
--------------------------------------------------------------------------------------------------*/
/* events that are continuing to/from another week. kill rounded corners and butt up against edge */
.fc-ltr .fc-h-event.fc-not-start,
.fc-rtl .fc-h-event.fc-not-end {
margin-left: 0;
border-left-width: 0;
padding-left: 1px; /* replace the border with padding */
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.fc-ltr .fc-h-event.fc-not-end,
.fc-rtl .fc-h-event.fc-not-start {
margin-right: 0;
border-right-width: 0;
padding-right: 1px; /* replace the border with padding */
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
/* resizer */
.fc-h-event .fc-resizer { /* positioned it to overcome the event's borders */
top: -1px;
bottom: -1px;
left: -1px;
right: -1px;
width: 5px;
}
/* left resizer */
.fc-ltr .fc-h-event .fc-start-resizer,
.fc-ltr .fc-h-event .fc-start-resizer:before,
.fc-ltr .fc-h-event .fc-start-resizer:after,
.fc-rtl .fc-h-event .fc-end-resizer,
.fc-rtl .fc-h-event .fc-end-resizer:before,
.fc-rtl .fc-h-event .fc-end-resizer:after {
right: auto; /* ignore the right and only use the left */
cursor: w-resize;
}
/* right resizer */
.fc-ltr .fc-h-event .fc-end-resizer,
.fc-ltr .fc-h-event .fc-end-resizer:before,
.fc-ltr .fc-h-event .fc-end-resizer:after,
.fc-rtl .fc-h-event .fc-start-resizer,
.fc-rtl .fc-h-event .fc-start-resizer:before,
.fc-rtl .fc-h-event .fc-start-resizer:after {
left: auto; /* ignore the left and only use the right */
cursor: e-resize;
}
/* DayGrid events
----------------------------------------------------------------------------------------------------
We use the full "fc-day-grid-event" class instead of using descendants because the event won't
be a descendant of the grid when it is being dragged.
*/
.fc-day-grid-event {
margin: 1px 2px 0; /* spacing between events and edges */
padding: 0 1px;
}
.fc-day-grid-event .fc-content { /* force events to be one-line tall */
white-space: nowrap;
overflow: hidden;
}
.fc-day-grid-event .fc-time {
font-weight: bold;
}
.fc-day-grid-event .fc-resizer { /* enlarge the default hit area */
left: -3px;
right: -3px;
width: 7px;
}
/* Event Limiting
--------------------------------------------------------------------------------------------------*/
/* "more" link that represents hidden events */
a.fc-more {
margin: 1px 3px;
font-size: .85em;
cursor: pointer;
text-decoration: none;
}
a.fc-more:hover {
text-decoration: underline;
}
.fc-limited { /* rows and cells that are hidden because of a "more" link */
display: none;
}
/* popover that appears when "more" link is clicked */
.fc-day-grid .fc-row {
z-index: 1; /* make the "more" popover one higher than this */
}
.fc-more-popover {
z-index: 2;
width: 220px;
}
.fc-more-popover .fc-event-container {
padding: 10px;
}
/* Now Indicator
--------------------------------------------------------------------------------------------------*/
.fc-now-indicator {
position: absolute;
border: 0 solid red;
}
/* Toolbar
--------------------------------------------------------------------------------------------------*/
.fc-toolbar {
text-align: center;
margin-bottom: 1em;
}
.fc-toolbar .fc-left {
float: left;
}
.fc-toolbar .fc-right {
float: right;
}
.fc-toolbar .fc-center {
display: inline-block;
}
/* the things within each left/right/center section */
.fc .fc-toolbar > * > * { /* extra precedence to override button border margins */
float: left;
margin-left: .75em;
}
/* the first thing within each left/center/right section */
.fc .fc-toolbar > * > :first-child { /* extra precedence to override button border margins */
margin-left: 0;
}
/* title text */
.fc-toolbar h2 {
margin: 0;
}
/* button layering (for border precedence) */
.fc-toolbar button {
position: relative;
}
.fc-toolbar .fc-state-hover,
.fc-toolbar .ui-state-hover {
z-index: 2;
}
.fc-toolbar .fc-state-down {
z-index: 3;
}
.fc-toolbar .fc-state-active,
.fc-toolbar .ui-state-active {
z-index: 4;
}
.fc-toolbar button:focus {
z-index: 5;
}
/* View Structure
--------------------------------------------------------------------------------------------------*/
/* undo twitter bootstrap's box-sizing rules. normalizes positioning techniques */
/* don't do this for the toolbar because we'll want bootstrap to style those buttons as some pt */
.fc-view-container *,
.fc-view-container *:before,
.fc-view-container *:after {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
.fc-view, /* scope positioning and z-index's for everything within the view */
.fc-view > table { /* so dragged elements can be above the view's main element */
position: relative;
z-index: 1;
}
/* BasicView
--------------------------------------------------------------------------------------------------*/
/* day row structure */
.fc-basicWeek-view .fc-content-skeleton,
.fc-basicDay-view .fc-content-skeleton {
/* we are sure there are no day numbers in these views, so... */
padding-top: 1px; /* add a pixel to make sure there are 2px padding above events */
padding-bottom: 1em; /* ensure a space at bottom of cell for user selecting/clicking */
}
.fc-basic-view .fc-body .fc-row {
min-height: 4em; /* ensure that all rows are at least this tall */
}
/* a "rigid" row will take up a constant amount of height because content-skeleton is absolute */
.fc-row.fc-rigid {
overflow: hidden;
}
.fc-row.fc-rigid .fc-content-skeleton {
position: absolute;
top: 0;
left: 0;
right: 0;
}
/* week and day number styling */
.fc-basic-view .fc-week-number,
.fc-basic-view .fc-day-number {
padding: 0 2px;
}
.fc-basic-view td.fc-week-number span,
.fc-basic-view td.fc-day-number {
padding-top: 2px;
padding-bottom: 2px;
}
.fc-basic-view .fc-week-number {
text-align: center;
}
.fc-basic-view .fc-week-number span {
/* work around the way we do column resizing and ensure a minimum width */
display: inline-block;
min-width: 1.25em;
}
.fc-ltr .fc-basic-view .fc-day-number {
text-align: right;
}
.fc-rtl .fc-basic-view .fc-day-number {
text-align: left;
}
.fc-day-number.fc-other-month {
opacity: 0.3;
filter: alpha(opacity=30); /* for IE */
/* opacity with small font can sometimes look too faded
might want to set the 'color' property instead
making day-numbers bold also fixes the problem */
}
/* AgendaView all-day area
--------------------------------------------------------------------------------------------------*/
.fc-agenda-view .fc-day-grid {
position: relative;
z-index: 2; /* so the "more.." popover will be over the time grid */
}
.fc-agenda-view .fc-day-grid .fc-row {
min-height: 3em; /* all-day section will never get shorter than this */
}
.fc-agenda-view .fc-day-grid .fc-row .fc-content-skeleton {
padding-top: 1px; /* add a pixel to make sure there are 2px padding above events */
padding-bottom: 1em; /* give space underneath events for clicking/selecting days */
}
/* TimeGrid axis running down the side (for both the all-day area and the slot area)
--------------------------------------------------------------------------------------------------*/
.fc .fc-axis { /* .fc to overcome default cell styles */
vertical-align: middle;
padding: 0 4px;
white-space: nowrap;
}
.fc-ltr .fc-axis {
text-align: right;
}
.fc-rtl .fc-axis {
text-align: left;
}
.ui-widget td.fc-axis {
font-weight: normal; /* overcome jqui theme making it bold */
}
/* TimeGrid Structure
--------------------------------------------------------------------------------------------------*/
.fc-time-grid-container, /* so scroll container's z-index is below all-day */
.fc-time-grid { /* so slats/bg/content/etc positions get scoped within here */
position: relative;
z-index: 1;
}
.fc-time-grid {
min-height: 100%; /* so if height setting is 'auto', .fc-bg stretches to fill height */
}
.fc-time-grid table { /* don't put outer borders on slats/bg/content/etc */
border: 0 hidden transparent;
}
.fc-time-grid > .fc-bg {
z-index: 1;
}
.fc-time-grid .fc-slats,
.fc-time-grid > hr { /* the <hr> AgendaView injects when grid is shorter than scroller */
position: relative;
z-index: 2;
}
.fc-time-grid .fc-content-col {
position: relative; /* because now-indicator lives directly inside */
}
.fc-time-grid .fc-content-skeleton {
position: absolute;
z-index: 3;
top: 0;
left: 0;
right: 0;
}
/* divs within a cell within the fc-content-skeleton */
.fc-time-grid .fc-business-container {
position: relative;
z-index: 1;
}
.fc-time-grid .fc-bgevent-container {
position: relative;
z-index: 2;
}
.fc-time-grid .fc-highlight-container {
position: relative;
z-index: 3;
}
.fc-time-grid .fc-event-container {
position: relative;
z-index: 4;
}
.fc-time-grid .fc-now-indicator-line {
z-index: 5;
}
.fc-time-grid .fc-helper-container { /* also is fc-event-container */
position: relative;
z-index: 6;
}
/* TimeGrid Slats (lines that run horizontally)
--------------------------------------------------------------------------------------------------*/
.fc-time-grid .fc-slats td {
height: 1.5em;
border-bottom: 0; /* each cell is responsible for its top border */
}
.fc-time-grid .fc-slats .fc-minor td {
border-top-style: dotted;
}
.fc-time-grid .fc-slats .ui-widget-content { /* for jqui theme */
background: none; /* see through to fc-bg */
}
/* TimeGrid Highlighting Slots
--------------------------------------------------------------------------------------------------*/
.fc-time-grid .fc-highlight-container { /* a div within a cell within the fc-highlight-skeleton */
position: relative; /* scopes the left/right of the fc-highlight to be in the column */
}
.fc-time-grid .fc-highlight {
position: absolute;
left: 0;
right: 0;
/* top and bottom will be in by JS */
}
/* TimeGrid Event Containment
--------------------------------------------------------------------------------------------------*/
.fc-ltr .fc-time-grid .fc-event-container { /* space on the sides of events for LTR (default) */
margin: 0 2.5% 0 2px;
}
.fc-rtl .fc-time-grid .fc-event-container { /* space on the sides of events for RTL */
margin: 0 2px 0 2.5%;
}
.fc-time-grid .fc-event,
.fc-time-grid .fc-bgevent {
position: absolute;
z-index: 1; /* scope inner z-index's */
}
.fc-time-grid .fc-bgevent {
/* background events always span full width */
left: 0;
right: 0;
}
/* Generic Vertical Event
--------------------------------------------------------------------------------------------------*/
.fc-v-event.fc-not-start { /* events that are continuing from another day */
/* replace space made by the top border with padding */
border-top-width: 0;
padding-top: 1px;
/* remove top rounded corners */
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.fc-v-event.fc-not-end {
/* replace space made by the top border with padding */
border-bottom-width: 0;
padding-bottom: 1px;
/* remove bottom rounded corners */
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
/* TimeGrid Event Styling
----------------------------------------------------------------------------------------------------
We use the full "fc-time-grid-event" class instead of using descendants because the event won't
be a descendant of the grid when it is being dragged.
*/
.fc-time-grid-event {
overflow: hidden; /* don't let the bg flow over rounded corners */
}
.fc-time-grid-event .fc-time,
.fc-time-grid-event .fc-title {
padding: 0 1px;
}
.fc-time-grid-event .fc-time {
font-size: .85em;
white-space: nowrap;
}
/* short mode, where time and title are on the same line */
.fc-time-grid-event.fc-short .fc-content {
/* don't wrap to second line (now that contents will be inline) */
white-space: nowrap;
}
.fc-time-grid-event.fc-short .fc-time,
.fc-time-grid-event.fc-short .fc-title {
/* put the time and title on the same line */
display: inline-block;
vertical-align: top;
}
.fc-time-grid-event.fc-short .fc-time span {
display: none; /* don't display the full time text... */
}
.fc-time-grid-event.fc-short .fc-time:before {
content: attr(data-start); /* ...instead, display only the start time */
}
.fc-time-grid-event.fc-short .fc-time:after {
content: "\000A0-\000A0"; /* seperate with a dash, wrapped in nbsp's */
}
.fc-time-grid-event.fc-short .fc-title {
font-size: .85em; /* make the title text the same size as the time */
padding: 0; /* undo padding from above */
}
/* resizer */
.fc-time-grid-event .fc-resizer {
left: 0;
right: 0;
bottom: 0;
height: 8px;
overflow: hidden;
line-height: 8px;
font-size: 11px;
font-family: monospace;
text-align: center;
cursor: s-resize;
}
.fc-time-grid-event .fc-resizer:after {
content: "=";
}
/* Now Indicator
--------------------------------------------------------------------------------------------------*/
.fc-time-grid .fc-now-indicator-line {
border-top-width: 1px;
left: 0;
right: 0;
}
/* arrow on axis */
.fc-time-grid .fc-now-indicator-arrow {
margin-top: -5px; /* vertically center on top coordinate */
}
.fc-ltr .fc-time-grid .fc-now-indicator-arrow {
left: 0;
/* triangle pointing right... */
border-width: 5px 0 5px 6px;
border-top-color: transparent;
border-bottom-color: transparent;
}
.fc-rtl .fc-time-grid .fc-now-indicator-arrow {
right: 0;
/* triangle pointing left... */
border-width: 5px 6px 5px 0;
border-top-color: transparent;
border-bottom-color: transparent;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -39,21 +39,30 @@
</div>
<div class="panel-body">
{{ form_label(form.label) }}
{{ form_widget(form.label) }}
{{ form_label(form.fgopen) }}
{{ form_widget(form.fgopen) }}
{% if form.label is defined %}
{{ form_label(form.label) }}
{{ form_widget(form.label) }}
{% endif %}
{% if masteridentity=="LDAP" %}
{{ form_row(form.fgassoc) }}
{{ form_row(form.ldapfilter) }}
{% endif %}
{{ form_label(form.fgcanshare) }}
{{ form_widget(form.fgcanshare) }}
{% if masteridentity=="SSO" %}
{{ form_row(form.fgassoc) }}
{{ form_row(form.attributes) }}
{% endif %}
{% if form.label is defined %}
{{ form_label(form.fgopen) }}
{{ form_widget(form.fgopen) }}
{% endif %}
{% if form.fgassoc is defined %}
{% if masteridentity=="LDAP" %}
{{ form_row(form.fgassoc) }}
{{ form_row(form.ldapfilter) }}
{% endif %}
{% if masteridentity=="SSO" %}
{{ form_row(form.fgassoc) }}
{{ form_row(form.attributes) }}
{% endif %}
{% endif %}
</div>
</div>
{{ form_end(form) }}

View File

@ -18,6 +18,7 @@
<th width="70px" class="no-sort">Action</th>
<th>Label</th>
<th>Ouvert</th>
<th>Partage</th>
</tr>
</thead>
</table>

View File

@ -68,6 +68,10 @@
'@CadolesCoreBundle/Resources/public/js/select2-fr.js'
'@CadolesCoreBundle/Resources/public/js/slick.js'
'@CadolesCoreBundle/Resources/public/js/jsRapClock.js'
'@CadolesCoreBundle/Resources/public/js/moment.min.js'
'@CadolesCoreBundle/Resources/public/js/fullcalendar.min.js'
'@CadolesCoreBundle/Resources/public/js/fullcalendar.lang.js'
'@Tetranz\Select2EntityBundle//Resources/public/js/select2entity.js'
'@CadolesCoreBundle/Resources/public/js/local.js'

View File

@ -32,6 +32,7 @@
'@CadolesCoreBundle/Resources/public/css/slick.css'
'@CadolesCoreBundle/Resources/public/css/slick-theme.css'
'@CadolesCoreBundle/Resources/public/css/jsRapClock.css'
'@CadolesCoreBundle/Resources/public/css/fullcalendar.css'
'@CadolesCoreBundle/Resources/public/css/font.css'
'@CadolesCoreBundle/Resources/public/css/style.css'
@ -77,6 +78,11 @@
min-height: 40px;
}
.li-placeholder {
border: 2px dotted #3498db;
}
@media (max-width: 767px) {
.header { display: none }
.navbarheader { display: none }
@ -420,7 +426,6 @@
height: 50px;
line-height: 50px;
text-transform: uppercase;
cursor: move;
}
.widgetheader .logo {

View File

@ -3,6 +3,8 @@
<li><a href="{{ path('cadoles_core_config') }}" title="Configuration"><i class="fa fa-gear fa-fw"></i></a>
{% endif %}
<li><a href="{{ path('cadoles_core_profil_users') }}" title="Annuaire"><i class="fa fa-users fa-fw"></i></a>
<li><a href="{{ path('cadoles_portal_user_calendar_view') }}" title="Calendrier"><i class="fa fa-calendar fa-fw"></i></a>
<li><a href="{{ path('cadoles_portal_user_notice_view') }}" title="Charte"><i class="fa fa-info fa-fw"></i></a>
<li><a href="{{ path('cadoles_core_profil') }}" title="Profil"><img class='avatar' src="/{{ alias }}/uploads/avatar/{{ app.user.avatar }}"></a></li>
@ -18,6 +20,7 @@
{% else %}
<li><a href="{{ path('cadoles_portal_user_notice_view') }}" title="Charte"><i class="fa fa-info fa-fw"></i></a>
{% if moderegistration!="none" and masteridentity=="SQL"%}
<li><a href="{{ path('cadoles_core_registration') }}" title="Inscription"><i class="fa fa-user-plus fa-fw"></i></a>
{% endif %}

View File

@ -11,12 +11,23 @@
{% endblock %}
</style>
<body class="{% if useheader %}body{% else %}simple{% endif %}">
{% if maxwidth is defined and maxwidth %}
{% set bodystyle="simple" %}
{% elseif useheader %}
{% set bodystyle="body" %}
{% else %}
{% set bodystyle="simple" %}
{% endif %}
<body class="{{ bodystyle }}">
<div id="wrapper">
{% if useheader %}
{{ render(url("cadoles_core_checkuser")) }}
{% endif %}
{% if app.session.get('fgheader') %}
{% if useheader %}
<div class="header" style="height:{{ app.session.get('heightheader') }}px; background-image: linear-gradient(90deg,rgba({{ color['mainrgb']['r'] }},{{ color['mainrgb']['g'] }},{{ color['mainrgb']['b'] }},1),rgba({{ color['mainrgb']['r'] }},{{ color['mainrgb']['g'] }},{{ color['mainrgb']['b'] }},0.1)),url(/{{ alias }}/{{ app.session.get('header') }});">
<a class="title" style="cursor: pointer" onClick="showHome()"">
<a class="title" style="cursor: pointer" href="{{ path("cadoles_core_home") }}">
<img id="logo" src="/{{ alias }}/{{ app.session.get('logo') }}" style="height:{{ app.session.get('heightheader')-20 }}px;">
<span style="height:{{ app.session.get('heightheader')}}px; line-height:{{ app.session.get('heightheader')}}px;">{{ app.session.get('appname') }}</span>
</a>
@ -31,7 +42,9 @@
</div>
<ul class="nav navbar-top-links navbar-right">
{{ include('@CadolesCore/Include/menu.html.twig') }}
{% if mustread is not defined %}
{{ include('@CadolesCore/Include/menu.html.twig') }}
{% endif %}
</ul>
</div>
{% endif %}
@ -53,15 +66,17 @@
{{ app.session.get('appname') }}
</a>
</div>
<ul class="nav navbar-top-links navbar-right">
{{ include('@CadolesCore/Include/menu.html.twig') }}
{% if mustread is not defined %}
{{ include('@CadolesCore/Include/menu.html.twig') }}
{% endif %}
</ul>
</nav>
{% endif %}
{% if usemenu %}
<nav id="appmenu" class="navbarheader navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
<nav id="appmenu" class="navbarheader navbar navbar-default navbar-static-top navbar-collapse" role="navigation" style="margin-bottom: 0">
{% block appmenu %}
{% endblock %}
@ -88,7 +103,7 @@
<div id="page-wrapper" style="min-height:1200px; {% if not usesidebar %} margin:0px; {% endif %}">
<div id="page-wrapper" style="min-height:1200px; {% if not usesidebar %} margin:0px; {% endif %} {% if maxwidth is defined and maxwidth %} max-width:1200px; margin:auto;{% endif %}">
<div class="container-fluid">
<div class="row">

View File

@ -94,6 +94,24 @@ class InitDataCommand extends ContainerAwareCommand
$this->entityManager->persist($entity);
}
// Job de purge des fichiers obsolète
// Toute les 24h à 3h00
$entity = $this->entityManager->getRepository('CadolesCronBundle:Cron')->find(200);
if(!$entity) {
$entity = new Cron;
$nextdate=$entity->getSubmitdate();
$nextdate->setTime(3,0);
$entity->setCommand("Core:PurgeFile");
$entity->setDescription("Suppression des fichiers obsolètes");
$entity->setId(200);
$entity->setStatut(2);
$entity->setRepeatcall(0);
$entity->setRepeatexec(0);
$entity->setRepeatinterval(86400);
$entity->setNextexecdate($nextdate);
$this->entityManager->persist($entity);
}
// afin de forcer les ID sur certaines entités
$metadata = $this->entityManager->getClassMetaData(get_class($entity));
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);

View File

@ -207,7 +207,7 @@ class InitDataCommand extends ContainerAwareCommand
$em->persist($entityWidget);
}
// Widget Liens
// Widget Editor
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1940);
if(!$entityWidget) {
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_compose.png"]);
@ -283,7 +283,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setRoworder(10);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Galerie');
$entityWidget->setDescription("Galerie d'images'");
$entityWidget->setDescription("Galerie d'images");
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_galery");
$entityWidget->setHeight("630");
$entityWidget->setAutoajust(true);
@ -295,6 +295,27 @@ class InitDataCommand extends ContainerAwareCommand
$em->persist($entityWidget);
}
// Widget Calendrier
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1900);
if(!$entityWidget) {
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_calendar.png"]);
$entityWidget = new Widget();
$entityWidget->setId(-1900);
$entityWidget->setRoworder(11);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Calendrier');
$entityWidget->setDescription("Calendrier d'évènements");
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_calendar");
$entityWidget->setHeight("630");
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$parameter = json_decode('{"fields": [{"id": "nbday", "loc": "col1", "type": "integer", "label": "Nombre de jours affichés", "value": "15", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget);
}
// Widget Horloge
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1500);
@ -306,7 +327,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setRoworder(100);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Horloge');
$entityWidget->setDescription("Une simple horloge'");
$entityWidget->setDescription("Une simple horloge");
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_clock");
$entityWidget->setHeight("300");
$entityWidget->setAutoajust(false);
@ -328,7 +349,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setRoworder(110);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Calculatrice');
$entityWidget->setDescription("Une simple calculatrice'");
$entityWidget->setDescription("Une simple calculatrice");
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_calculator");
$entityWidget->setHeight("400");
$entityWidget->setAutoajust(false);

View File

@ -0,0 +1,298 @@
<?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 Ramsey\Uuid\Uuid;
use Cadoles\PortalBundle\Entity\Calendar;
use Cadoles\PortalBundle\Form\CalendarType;
use Cadoles\PortalBundle\Form\CalendarShareType;
class CalendarController extends Controller
{
private $labelentity="CadolesPortalBundle:Calendar";
private $routeprimary="cadoles_portal_config_calendar";
public function listAction()
{
return $this->render($this->labelentity.':list.html.twig',[
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
]);
}
public function ajaxlistAction(Request $request,$access="config")
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(array('message' => 'Interdit'), 400);
}
$em = $this->getDoctrine()->getManager();
$start=$request->query->get('start');
$length= $request->query->get('length');
$search= $request->query->get('search');
$draw= $request->query->get('draw');
$order= $request->query->get('order');
// Query de base
$qbase=$em->createQueryBuilder()->from($this->labelentity,'table');
$qsearch=$qbase->where('table.id LIKE :value')
->orWhere('table.name LIKE :value')
->setParameter("value", "%".$search["value"]."%");
// Nombre total d'enregistrement
$total = $qbase->select('COUNT(table)')->getQuery()->getSingleScalarResult();
// Nombre d'enregistrement filtré
if($search["value"]=="")
$totalf = $total;
else {
$totalf= $qsearch->select('COUNT(table)')->getQuery()->getSingleScalarResult();
}
// Parcours des Enregistrement
if($search["value"]=="")
$qb = $qbase->select('table');
else
$qb = $qsearch->select('table');
// Order
switch($order[0]["column"]) {
case 1 :
$qb->orderBy('table.name',$order[0]["dir"]);
break;
}
// Execution de la requete d'affichage
$datas=$qb->setFirstResult($start)->setMaxResults($length)->getQuery()->getResult();
// Construction du tableau de retour
$output = array(
'draw' => $draw,
'recordsFiltered' => $totalf,
'recordsTotal' => $total,
'data' => array(),
);
foreach($datas as $data) {
$route=str_replace("_config_","_".$access."_",$this->routeprimary);
$action = "";
//$action.="<a href='".$this->generateUrl($route.'_update', array('id'=>$data->getId()))."'><i class='fa fa-file fa-fw'></i></a>";
$action.="<a href='".$this->generateUrl($route.'_delete', array('id'=>$data->getId()))."' data-method='delete'><i class='fa fa-trash fa-fw'></i></a>";
$action.="<a href='".$this->generateUrl($route.'_view', array('id'=>$data->getId()))."'><i class='fa fa-eye'></i></a>";
array_push($output["data"],array($action,$data->getName()));
}
// Retour
return new Response(json_encode($output), 200);
}
private function entityForm(Calendar $entity,$access="config")
{
$route=str_replace("_config_","_".$access."_",$this->routeprimary);
if ($this->getDoctrine()->getManager()->contains($entity)) {
return $this->createForm(CalendarType::class, $entity, [
"mode" => "update",
"access" => $access
]);
}
else {
return $this->createForm(CalendarType::class, $entity, [
"mode" => "submit",
"access" => $access
]);
}
}
public function submitAction(Request $request,$access="config")
{
$entity = new Calendar();
$form = $this->entityForm($entity,$access);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
if($access=="user") $entity->setUser($this->getUser());
$key = Uuid::uuid4();
$entity->setKeyvalue($key);
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_calendar_view',["id"=>$entity->getId()]));
}
return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => true,
'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($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate);
if(!$canupdate) 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();
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_calendar_view',["id"=>$entity->getId()]));
}
return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'access' => $access,
'mode' => "update",
'form' => $form->createView(),
]);
}
public function shareAction(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($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate);
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
}
// Création du formulaire
$form = $this->createForm(CalendarShareType::class, $entity, ["access" => $access, "user" => $this->getUser()]);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_calendar_view',["id"=>$id]));
}
return $this->render($this->labelentity.':share.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'access' => $access,
'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.');
// On s'assure que l'utilisateur à la permission de supprimer
if($access=="user") {
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate);
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
}
// Suppression
$em->remove($entity);
$em->flush();
// Retour
if($access=="config")
return $this->redirect($this->generateUrl($this->routeprimary));
else
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_calendar_view'));
}
public function viewAction(Request $request, $access="config") {
$em = $this->getDoctrine()->getManager();
$id = $request->query->get('id');
$entity=[];
if($id!="") {
$entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
}
// Permissions
if($access=="config") {
$canupdate = true;
$calendars=$em->getRepository($this->labelentity)->findBy(["id"=>$id]);
$entity->setCanupdate(true);
}
else {
// On récupère l'ensemble des calendriers de l'utilisateur
$user=$this->getUser();
$em->getRepository($this->labelentity)->getCalendarsUser($user,$calendarsuser,$calendarsadmin,$calendarsshared);
// Utilisateur sans calendrier = creation d'un calendrier par défaut
if(empty($calendarsuser)&&$user) {
$calendar=new Calendar();
$calendar->setName("Mon Calendrier");
$calendar->setType(0);
$calendar->setUser($user);
$calendar->setCanupdate(true);
$key = Uuid::uuid4();
$calendar->setKeyvalue($key);
$em->persist($calendar);
$em->flush();
$calendarsuser=[$calendar];
}
$calendars=array_merge($calendarsuser,$calendarsadmin->toArray(),$calendarsshared);
$canupdate=false;
if($user) $canupdate=true;
}
return $this->render($this->labelentity.':view.html.twig', [
'useheader' => true,
'usemenu' => ($access=="user"),
'usesidebar' => ($access=="config"),
'entity' => $entity,
'access' => $access,
'canupdate' => $canupdate,
'calendars' => $calendars
]);
}
}

View File

@ -0,0 +1,255 @@
<?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 Ramsey\Uuid\Uuid;
use Cadoles\PortalBundle\Entity\Calendarevent;
use Cadoles\PortalBundle\Form\CalendareventShareType;
class CalendareventController extends Controller
{
private $labelentity="CadolesPortalBundle:Calendarevent";
private $routeprimary="cadoles_portal_config_calendarevent";
public function loadAction(Request $request,$access="config")
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) return new JsonResponse(array('message' => 'Interdit'), 400);
$output=array();
$idcalendar = $request->query->get('idcalendar');
$start = $request->query->get('start');
$end = $request->query->get('end');
// On charge un et un seul calendrier
if($idcalendar>0) {
$em = $this->getDoctrine()->getManager();
$calendar = $this->getDoctrine()->getRepository("CadolesPortalBundle:Calendar")->find($idcalendar);
if (!$calendar) throw $this->createNotFoundException('Unable to find entity.');
if($access=="config")
$calendar->setCanupdate(true);
else {
$this->getDoctrine()->getRepository("CadolesPortalBundle:Calendar")->getPermission($this->getUser(),$calendar,$cansee,$canupdate);
if(!$cansee) throw $this->createNotFoundException('Permission denied');
$calendar->setCanupdate($canupdate);
}
$calendars=[$calendar];
}
// Sinon on charge l'ensemble des calendriers associé au profil
else {
$this->getDoctrine()->getRepository("CadolesPortalBundle:Calendar")->getCalendarsUser($this->getUser(),$calendarssuser,$calendarsadmin,$calendarsshared);
$calendars=array_merge($calendarssuser,$calendarsadmin->toArray(),$calendarsshared);
}
// On recherche des event partagés
foreach($calendars as $calendar) {
$calendarevents = $this->getDoctrine()->getRepository("CadolesPortalBundle:Calendarevent")->getCalendareventByDate($calendar,$start,$end);
foreach($calendarevents as $calendarevent) {
$tmp=[];
$tmp['id'] = strval($calendarevent->getId());
$tmp['title'] = $calendarevent->getName();
$tmp['description'] = $calendarevent->getDescription();
$tmp['start'] = $calendarevent->getStart()->format("Y-m-d\TH:i:s");
$tmp['end'] = $calendarevent->getEnd()->format("Y-m-d\TH:i:s");
$tmp['color'] = "#".(is_null($calendar->getColor())?$this->get('session')->get('color')["main"]:$calendar->getColor());
$tmp['allDay'] = $calendarevent->getAllday();
$tmp['calendar'] = $calendar->getId();
$tmp['editable'] = $calendar->getCanupdate();
array_push($output,$tmp);
}
}
if($idcalendar==0) {
$calendareventsshared = $this->getDoctrine()->getRepository("CadolesPortalBundle:Calendarevent")->getCalendareventShareByDate($this->getUser(),$start,$end);
foreach($calendareventsshared as $calendarevent) {
$tmp=[];
$tmp['id'] = strval($calendarevent->getId());
$tmp['title'] = $calendarevent->getName();
$tmp['description'] = $calendarevent->getDescription();
$tmp['start'] = $calendarevent->getStart()->format("Y-m-d\TH:i:s");
$tmp['end'] = $calendarevent->getEnd()->format("Y-m-d\TH:i:s");
$tmp['color'] = "#".(is_null($calendar->getColor())?$this->get('session')->get('color')["main"]:$calendar->getColor());
$tmp['allDay'] = $calendarevent->getAllday();
$tmp['calendar'] = $calendar->getId();
$tmp['editable'] = $calendar->getCanupdate();
array_push($output,$tmp);
}
}
$response = new Response(json_encode($output));
$response->headers->set('Content-Type', 'application/text');
return $response;
}
public function submitAction(Request $request,$access="config")
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) return new JsonResponse(array('message' => 'Interdit'), 400);
$output=array();
$idcalendar = $request->request->get('idcalendar');
$title = $request->request->get('title');
$description = $request->request->get('description');
$start = new \DateTime($request->request->get('start'));
$end = new \DateTime($request->request->get('end'));
$allday = ($request->request->get('allday')=="true");
$em = $this->getDoctrine()->getManager();
$calendar = $this->getDoctrine()->getRepository("CadolesPortalBundle:Calendar")->find($idcalendar);
if (!$calendar) throw $this->createNotFoundException('Unable to find entity.');
// On s'assure que l'utilisateur à la permission de supprimer
if($access=="user") {
$em->getRepository("CadolesPortalBundle:Calendar")->getPermission($this->getUser(),$calendar,$cansee,$canupdate);
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
}
$calendarevent=new Calendarevent();
$calendarevent->setCalendar($calendar);
$calendarevent->setName($title);
$calendarevent->setDescription($description);
$calendarevent->setStart($start);
$calendarevent->setEnd($end);
$calendarevent->setAllday($allday);
$em->persist($calendarevent);
$em->flush();
$output["id"]=$calendarevent->getId();
$output["color"]="#".(is_null($calendar->getColor())?$this->get('session')->get('color')["main"]:$calendar->getColor());
$response = new Response(json_encode($output));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
public function updateAction(Request $request, $access="config")
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) return new JsonResponse(array('message' => 'Interdit'), 400);
$output=array();
$id = $request->request->get('id');
$idcalendar = $request->request->get('idcalendar');
$title = $request->request->get('title');
$description = $request->request->get('description');
$start = new \DateTime($request->request->get('start'));
$end = new \DateTime($request->request->get('end'));
$allday = ($request->request->get('allday')=="true");
$em = $this->getDoctrine()->getManager();
$calendar = $this->getDoctrine()->getRepository("CadolesPortalBundle:Calendar")->find($idcalendar);
if (!$calendar) throw $this->createNotFoundException('Unable to find entity.');
// On s'assure que l'utilisateur à la permission
if($access=="user") {
$em->getRepository("CadolesPortalBundle:Calendar")->getPermission($this->getUser(),$calendar,$cansee,$canupdate);
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
}
$calendarevent = $this->getDoctrine()->getRepository("CadolesPortalBundle:Calendarevent")->find($id);
if (!$calendarevent) throw $this->createNotFoundException('Unable to find entity.');
$calendarevent->setCalendar($calendar);
$calendarevent->setName($title);
$calendarevent->setDescription($description);
$calendarevent->setStart($start);
$calendarevent->setEnd($end);
$calendarevent->setAllday($allday);
$em->persist($calendarevent);
$em->flush();
$output["id"]=$calendarevent->getId();
$output["color"]="#".(is_null($calendar->getColor())?$this->get('session')->get('color')["main"]:$calendar->getColor());
$response = new Response(json_encode($output));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
public function deleteAction(Request $request, $access="config")
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) return new JsonResponse(array('message' => 'Interdit'), 400);
$output=array();
$id = $request->request->get('id');
$idcalendar = $request->request->get('idcalendar');
$title = $request->request->get('title');
$description = $request->request->get('description');
$start = new \DateTime($request->request->get('start'));
$end = new \DateTime($request->request->get('end'));
$allday = ($request->request->get('allday')=="true");
$em = $this->getDoctrine()->getManager();
$calendar = $this->getDoctrine()->getRepository("CadolesPortalBundle:Calendar")->find($idcalendar);
if (!$calendar) throw $this->createNotFoundException('Unable to find entity.');
// On s'assure que l'utilisateur à la permission
if($access=="user") {
$em->getRepository("CadolesPortalBundle:Calendar")->getPermission($this->getUser(),$calendar,$cansee,$canupdate);
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
}
$calendarevent = $this->getDoctrine()->getRepository("CadolesPortalBundle:Calendarevent")->find($id);
if (!$calendarevent) throw $this->createNotFoundException('Unable to find entity.');
// Suppression
$em->remove($calendarevent);
$em->flush();
$response = new Response(json_encode($output));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
public function shareAction(Request $request, $id,$access="config")
{
$em = $this->getDoctrine()->getManager();
$calendarevent = $em->getRepository($this->labelentity)->find($id);
if (!$calendarevent) throw $this->createNotFoundException('Unable to find entity.');
$calendar=$calendarevent->getCalendar();
// On s'assure que l'utilisateur à la permission de modifier
if($access=="user") {
$em->getRepository("CadolesPortalBundle:Calendar")->getPermission($this->getUser(),$calendar,$cansee,$canupdate);
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
}
// Création du formulaire
$form = $this->createForm(CalendareventShareType::class, $calendarevent, ["access" => $access, "user" => $this->getUser()]);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($calendarevent);
$em->flush();
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_calendar_view',["id"=>$calendar->getId()]));
}
return $this->render($this->labelentity.':share.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $calendarevent,
'access' => $access,
'form' => $form->createView(),
]);
}
}

View File

@ -0,0 +1,212 @@
<?php
namespace Cadoles\PortalBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Form\FormError;
use Doctrine\Common\Collections\Criteria;
use Cadoles\PortalBundle\Entity\Notice;
use Cadoles\PortalBundle\Form\NoticeType;
class NoticeController extends Controller
{
private $labelroute = 'cadoles_portal_config_notice';
private $labelentity = 'CadolesPortalBundle:Notice';
private $labeldata = 'notice';
private $labeldatas = 'notices';
public function listAction()
{
$notices = $this->getDoctrine()->getRepository($this->labelentity)->findAll();
$groups = $this->getDoctrine()->getRepository('CadolesCoreBundle:Group')->findBy([], ['label' => 'asc']);
return $this->render($this->labelentity.':list.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'notices' => $notices,
'groups' => $groups
]);
}
public function submitAction(Request $request)
{
// Initialisation de l'enregistrement
$data = new Notice();
// Création du formulaire
$form = $this->createForm(NoticeType::class,$data,array("mode"=>"submit"));
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null,$form,$request,$data,"submit");
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$em = $this->getDoctrine()->getManager();
// Sauvegarde
$em->persist($data);
$em->flush();
// Retour à la liste
return $this->redirectToRoute($this->labelroute);
}
// Affichage du formulaire
return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
$this->labeldata => $data,
'mode' => 'submit',
'icons' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findAll(),
'form' => $form->createView()
]);
}
public function updateAction($id,Request $request)
{
// Récupération de l'enregistrement courant
$data=$this->getData($id);
// Vérifier que cet enregistrement est modifiable
// Création du formulaire
$form = $this->createForm(NoticeType::class,$data,array(
"mode" => "update"
));
// 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()) {
$em = $this->getDoctrine()->getManager();
$data = $form->getData();
// Sauvegarde
$em->persist($data);
$em->flush();
// Retour à la liste
return $this->redirectToRoute($this->labelroute);
}
// Affichage du formulaire
return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
$this->labeldata => $data,
'mode' => 'update',
'form' => $form->createView()
]);
}
public function deleteAction($id,Request $request)
{
// Récupération de l'enregistrement courant
$data=$this->getData($id);
// Vérifier que cet enregistrement est supprimable
// Supprimer la donnée
$em = $this->getDoctrine()->getManager();
$em->remove($data);
$em->flush();
return $this->redirectToRoute($this->labelroute);
}
public function havereadAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
$user=$this->getUser();
$notices=$em->getRepository("CadolesPortalBundle:Notice")->getNoticeToRead($user);
foreach($notices as $notice) {
$users=$notice->getUsers();
$userCriteria = Criteria::create()->where(Criteria::expr()->eq('id', $user->getId()));
$userCollection = $notice->getUsers()->matching($userCriteria);
if($userCollection->isEmpty()) {
$notice->addUser($user);
$em->persist($notice);
$em->flush();
}
}
return $this->redirectToRoute("cadoles_core_home");
}
public function viewAction(Request $request) {
$em = $this->getDoctrine()->getManager();
$user=$this->getUser();
$notices=$em->getRepository("CadolesPortalBundle:Notice")->getNoticeUser($user,false);
return $this->render('CadolesPortalBundle:Notice:view.html.twig',[
'useheader' => true,
'usemenu' => false,
'usesidebar' => false,
'maxwidth' => true,
'notices' => $notices,
]);
}
protected function getDatas()
{
$em = $this->getDoctrine()->getManager();
$datas = $em->getRepository($this->labelentity)->findAll();
return $datas;
}
protected function getData($id)
{
$em = $this->getDoctrine()->getManager();
$data = $em->getRepository($this->labelentity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find '.$this->labeldata);
}
return $data;
}
protected function getErrorForm($id,$form,$request,$data,$mode) {
if ($form->get('submit')->isClicked()&&$mode=="delete") {
}
if ($form->get('submit')->isClicked() && $mode!="delete") {
if(is_null($data->getDescription())) {
$form->addError(new FormError('Description obligatoire'));
}
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {
$this->get('session')->getFlashBag()->clear();
$validator = $this->get('validator');
$errors = $validator->validate($data);
foreach( $errors as $error ) {
$request->getSession()->getFlashBag()->add("error", $error->getMessage());
}
$errors = $form->getErrors();
foreach( $errors as $error ) {
$request->getSession()->getFlashBag()->add("error", $error->getMessage());
}
}
}
}

View File

@ -12,6 +12,7 @@ use Cadoles\PortalBundle\Form\PageSubmitType;
use Cadoles\PortalBundle\Form\PageUpdateURLType;
use Cadoles\PortalBundle\Form\PageUpdateWidgetType;
use Cadoles\PortalBundle\Form\PageUpdateEditorType;
use Cadoles\PortalBundle\Form\PageShareType;
class PageController extends Controller
{
@ -230,6 +231,45 @@ class PageController extends Controller
}
}
public function shareAction(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($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate);
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
}
// Création du formulaire
$form = $this->createForm(PageShareType::class, $entity, ["access" => $access, "user" => $this->getUser()]);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
if($access=="config")
return $this->redirect($this->generateUrl($this->routeprimary.'_view',["id"=>$id]));
else
return $this->redirect($this->generateUrl('cadoles_core_home',["id"=>$id]));
}
return $this->render($this->labelentity.':share.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'access' => $access,
'form' => $form->createView(),
]);
}
public function deleteAction(Request $request, $id,$access="config")
{
$em = $this->getDoctrine()->getManager();
@ -253,6 +293,34 @@ class PageController extends Controller
return $this->redirect($this->generateUrl("cadoles_core_home"));
}
public function orderAction(Request $request,$access="config")
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) return new JsonResponse(array('message' => 'Interdit'), 400);
$output=array();
$id=$request->request->get('id');
$order=$request->request->get('order');
$em = $this->getDoctrine()->getManager();
$entity = $this->getDoctrine()->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
// On s'assure que l'utilisateur à la permission
if($access=="user") {
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate);
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
}
$entity->setRoworder($order);
$em->persist($entity);
$em->flush();
$response = new Response(json_encode($output));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
public function viewAction($id,$access=null) {
$em = $this->getDoctrine()->getManager();
@ -306,4 +374,14 @@ class PageController extends Controller
}
}
public function uploadAction(Request $request,$access=null) {
//dump($request);
$file = $request->files->get('files');
$tmpfile=$request->files->get('upload');
//$tmpfile->move
return new Response($tmpfile);
}
}

View File

@ -470,7 +470,13 @@ class PagewidgetController extends Controller
$qb = $em->createQueryBuilder();
$qb->select('alert')
->from("CadolesPortalBundle:Alert", 'alert')
->where($qb->expr()->like('alert.roles', $qb->expr()->literal("%$role%")));
->where($qb->expr()->like('alert.roles', $qb->expr()->literal("%$role%")))
->andWhere('alert.publishedat <= :today')
->andWhere($qb->expr()->orX(
$qb->expr()->gt('alert.unpublishedat', ':today'),
$qb->expr()->isNull('alert.unpublishedat')
))
->setParameter('today', date('Y-m-d'));
if($idalertcategory && $alertcategoryfilter) {
$qb->andWhere("alert.alertcategory=:alertcategory")
@ -488,7 +494,13 @@ class PagewidgetController extends Controller
$qb->select('alert')
->from("CadolesPortalBundle:Alert", 'alert')
->where(":group MEMBER OF alert.groups")
->setParameter("group",$group->getGroup());
->andWhere('alert.publishedat <= :today')
->andWhere($qb->expr()->orX(
$qb->expr()->gt('alert.unpublishedat', ':today'),
$qb->expr()->isNull('alert.unpublishedat')
))
->setParameter("group",$group->getGroup())
->setParameter('today', date('Y-m-d'));
if($idalertcategory && $alertcategoryfilter) {
$qb->andWhere("alert.alertcategory=:alertcategory")
@ -946,6 +958,75 @@ class PagewidgetController extends Controller
]);
}
public function viewcalendarAction($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');
}
// Parametres
$nbday="0";
foreach($entity->getParameter()["fields"] as $parameter) {
switch($parameter["id"]) {
case "nbday":
$nbday=$parameter["value"];
break;
}
}
// On charge le calendrier de l'utilisateur
$this->getDoctrine()->getRepository("CadolesPortalBundle:Calendar")->getCalendarsUser($this->getUser(),$calendarssuser,$calendarsadmin,$calendarsshared);
$calendars=array_merge($calendarssuser,$calendarsadmin->toArray(),$calendarsshared);
// Début & fin
$start=new \DateTime();
$start->setTime(0,0);
$end=new \DateTime();
$end->setTime(0,0);
$end->add(new \DateInterval('P3M'));
$end->modify('last day of this month');
$events=[];
foreach($calendars as $calendar) {
$calendarevents = $this->getDoctrine()->getRepository("CadolesPortalBundle:Calendarevent")->getCalendareventByDate($calendar,$start,$end);
foreach($calendarevents as $calendarevent) {
$tmp=[];
$tmp['id'] = strval($calendarevent->getId());
$tmp['title'] = $calendarevent->getName();
$tmp['description'] = $calendarevent->getDescription();
$tmp['start'] = $calendarevent->getStart();
$tmp['end'] = $calendarevent->getEnd();
$tmp['color'] = "#".(is_null($calendar->getColor())?$this->get('session')->get('color')["main"]:$calendar->getColor());
$tmp['allDay'] = $calendarevent->getAllday();
$tmp['calendar'] = $calendar->getId();
$tmp['editable'] = $calendar->getCanupdate();
array_push($events,$tmp);
}
}
// Render
return $this->render($this->labelentity.':viewcalendar.html.twig', [
'entity' => $entity,
'canadd' => $canupdate,
'canupdate' => $canupdate,
'events' => $events,
'nbday' => $nbday,
'access' => $access,
]);
}
public function viewclockAction($id,$access="config") {
$em = $this->getDoctrine()->getManager();

View File

@ -0,0 +1,360 @@
<?php
namespace Cadoles\PortalBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Calendar
*
* @ORM\Entity
* @ORM\Table(name="calendar")
* @ORM\Entity(repositoryClass="Cadoles\PortalBundle\Repository\CalendarRepository")
* @ORM\HasLifecycleCallbacks
*/
class Calendar
{
/**
* @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="color", type="string", nullable=true)
*/
private $color;
/**
* @var integer
*
* @ORM\Column(name="type", type="integer")
*/
private $type;
/**
* @var string
*
* @ORM\Column(name="keyvalue", type="string")
*/
private $keyvalue;
/**
* @var string
*
* @ORM\Column(name="url", type="string", nullable=true)
*/
private $url;
/**
* @var string
*
* @ORM\Column(name="roles", type="array", nullable=true)
*/
private $roles;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\CoreBundle\Entity\Group", inversedBy="calendars", cascade={"persist"})
* @ORM\JoinTable(name="calendargroupe",
* joinColumns={@ORM\JoinColumn(name="calendar", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="groupe", referencedColumnName="id")}
* )
*/
protected $groups;
/**
* @ORM\ManyToOne(targetEntity="Cadoles\CoreBundle\Entity\User", inversedBy="calendars")
* @ORM\JoinColumn(nullable=true)
*/
private $user;
/**
* @var ArrayCollection $calendarevent
* @var Calendarevent
*
* @ORM\OneToMany(targetEntity="Cadoles\PortalBundle\Entity\Calendarevent", mappedBy="calendar", cascade={"persist"}, orphanRemoval=true)
*/
private $calendarevents;
/* champs calculé non stocké en base */
private $canupdate;
public function getCanupdate()
{
return $this->canupdate;
}
public function setCanupdate($canupdate)
{
$this->canupdate = $canupdate;
return $this;
}
/**
* Constructor
*/
public function __construct()
{
$this->groups = new \Doctrine\Common\Collections\ArrayCollection();
$this->calendarevents = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return Calendar
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set color
*
* @param string $color
*
* @return Calendar
*/
public function setColor($color)
{
$this->color = $color;
return $this;
}
/**
* Get color
*
* @return string
*/
public function getColor()
{
return $this->color;
}
/**
* Set type
*
* @param integer $type
*
* @return Calendar
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* Get type
*
* @return integer
*/
public function getType()
{
return $this->type;
}
/**
* Set keyvalue
*
* @param string $keyvalue
*
* @return Calendar
*/
public function setKeyvalue($keyvalue)
{
$this->keyvalue = $keyvalue;
return $this;
}
/**
* Get keyvalue
*
* @return string
*/
public function getKeyvalue()
{
return $this->keyvalue;
}
/**
* Set url
*
* @param string $url
*
* @return Calendar
*/
public function setUrl($url)
{
$this->url = $url;
return $this;
}
/**
* Get url
*
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set roles
*
* @param array $roles
*
* @return Calendar
*/
public function setRoles($roles)
{
$this->roles = $roles;
return $this;
}
/**
* Get roles
*
* @return array
*/
public function getRoles()
{
return $this->roles;
}
/**
* Add group
*
* @param \Cadoles\CoreBundle\Entity\Group $group
*
* @return Calendar
*/
public function addGroup(\Cadoles\CoreBundle\Entity\Group $group)
{
$this->groups[] = $group;
return $this;
}
/**
* Remove group
*
* @param \Cadoles\CoreBundle\Entity\Group $group
*/
public function removeGroup(\Cadoles\CoreBundle\Entity\Group $group)
{
$this->groups->removeElement($group);
}
/**
* Get groups
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getGroups()
{
return $this->groups;
}
/**
* Set user
*
* @param \Cadoles\CoreBundle\Entity\User $user
*
* @return Calendar
*/
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 calendarevent
*
* @param \Cadoles\PortalBundle\Entity\Calendarevent $calendarevent
*
* @return Calendar
*/
public function addCalendarevent(\Cadoles\PortalBundle\Entity\Calendarevent $calendarevent)
{
$this->calendarevents[] = $calendarevent;
return $this;
}
/**
* Remove calendarevent
*
* @param \Cadoles\PortalBundle\Entity\Calendarevent $calendarevent
*/
public function removeCalendarevent(\Cadoles\PortalBundle\Entity\Calendarevent $calendarevent)
{
$this->calendarevents->removeElement($calendarevent);
}
/**
* Get calendarevents
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getCalendarevents()
{
return $this->calendarevents;
}
}

View File

@ -0,0 +1,328 @@
<?php
namespace Cadoles\PortalBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Calendar
*
* @ORM\Entity
* @ORM\Table(name="calendarevent")
* @ORM\Entity(repositoryClass="Cadoles\PortalBundle\Repository\CalendareventRepository")
* @ORM\HasLifecycleCallbacks
*/
class Calendarevent
{
/**
* @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")
*/
private $description;
/**
* @ORM\Column(name="start", type="datetime")
*/
private $start;
/**
* @ORM\Column(name="end", type="datetime")
*/
private $end;
/**
* @ORM\Column(name="allday", type="boolean")
*/
private $allday;
/**
* @ORM\Column(name="uid", type="string", nullable=true)
*/
private $uid;
/**
* @var string
*
* @ORM\Column(name="roles", type="array", nullable=true)
*/
private $roles;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\CoreBundle\Entity\Group", inversedBy="calendars", cascade={"persist"})
* @ORM\JoinTable(name="calendareventgroupe",
* joinColumns={@ORM\JoinColumn(name="calendarevent", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="groupe", referencedColumnName="id")}
* )
*/
protected $groups;
/**
* @ORM\ManyToOne(targetEntity="Cadoles\PortalBundle\Entity\Calendar", inversedBy="calendarevents")
*/
private $calendar;
/**
* Constructor
*/
public function __construct()
{
$this->groups = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return Calendarevent
*/
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 Calendarevent
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set start
*
* @param \DateTime $start
*
* @return Calendarevent
*/
public function setStart($start)
{
$this->start = $start;
return $this;
}
/**
* Get start
*
* @return \DateTime
*/
public function getStart()
{
return $this->start;
}
/**
* Set end
*
* @param \DateTime $end
*
* @return Calendarevent
*/
public function setEnd($end)
{
$this->end = $end;
return $this;
}
/**
* Get end
*
* @return \DateTime
*/
public function getEnd()
{
return $this->end;
}
/**
* Set allday
*
* @param boolean $allday
*
* @return Calendarevent
*/
public function setAllday($allday)
{
$this->allday = $allday;
return $this;
}
/**
* Get allday
*
* @return boolean
*/
public function getAllday()
{
return $this->allday;
}
/**
* Set uid
*
* @param string $uid
*
* @return Calendarevent
*/
public function setUid($uid)
{
$this->uid = $uid;
return $this;
}
/**
* Get uid
*
* @return string
*/
public function getUid()
{
return $this->uid;
}
/**
* Set roles
*
* @param array $roles
*
* @return Calendarevent
*/
public function setRoles($roles)
{
$this->roles = $roles;
return $this;
}
/**
* Get roles
*
* @return array
*/
public function getRoles()
{
return $this->roles;
}
/**
* Add group
*
* @param \Cadoles\CoreBundle\Entity\Group $group
*
* @return Calendarevent
*/
public function addGroup(\Cadoles\CoreBundle\Entity\Group $group)
{
$this->groups[] = $group;
return $this;
}
/**
* Remove group
*
* @param \Cadoles\CoreBundle\Entity\Group $group
*/
public function removeGroup(\Cadoles\CoreBundle\Entity\Group $group)
{
$this->groups->removeElement($group);
}
/**
* Get groups
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getGroups()
{
return $this->groups;
}
/**
* Set calendar
*
* @param \Cadoles\PortalBundle\Entity\Calendar $calendar
*
* @return Calendarevent
*/
public function setCalendar(\Cadoles\PortalBundle\Entity\Calendar $calendar = null)
{
$this->calendar = $calendar;
return $this;
}
/**
* Get calendar
*
* @return \Cadoles\PortalBundle\Entity\Calendar
*/
public function getCalendar()
{
return $this->calendar;
}
}

View File

@ -0,0 +1,260 @@
<?php
namespace Cadoles\PortalBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\Table(name="notice")
* @ORM\Entity(repositoryClass="Cadoles\PortalBundle\Repository\NoticeRepository")
* @ORM\HasLifecycleCallbacks
*/
class Notice
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=100)
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="description", type="text")
*/
private $description;
/**
* @var boolean
*
* @ORM\Column(name="mustread", type="boolean")
*/
private $mustread;
/**
* @var string
*
* @ORM\Column(name="roles", type="array", nullable=true)
*/
private $roles;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\CoreBundle\Entity\Group", inversedBy="notices", cascade={"persist"})
* @ORM\JoinTable(name="noticegroupe",
* joinColumns={@ORM\JoinColumn(name="notice", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="groupe", referencedColumnName="id")}
* )
*/
protected $groups;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\CoreBundle\Entity\User", inversedBy="notices", cascade={"persist"})
* @ORM\JoinTable(name="noticeuser",
* joinColumns={@ORM\JoinColumn(name="notice", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="user", referencedColumnName="id")}
* )
*/
protected $users;
/**
* Constructor
*/
public function __construct()
{
$this->groups = new \Doctrine\Common\Collections\ArrayCollection();
$this->users = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set title
*
* @param string $title
*
* @return Notice
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set description
*
* @param string $description
*
* @return Notice
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set mustread
*
* @param boolean $mustread
*
* @return Notice
*/
public function setMustread($mustread)
{
$this->mustread = $mustread;
return $this;
}
/**
* Get mustread
*
* @return boolean
*/
public function getMustread()
{
return $this->mustread;
}
/**
* Set roles
*
* @param array $roles
*
* @return Notice
*/
public function setRoles($roles)
{
$this->roles = $roles;
return $this;
}
/**
* Get roles
*
* @return array
*/
public function getRoles()
{
return $this->roles;
}
/**
* Add group
*
* @param \Cadoles\CoreBundle\Entity\Group $group
*
* @return Notice
*/
public function addGroup(\Cadoles\CoreBundle\Entity\Group $group)
{
$this->groups[] = $group;
return $this;
}
/**
* Remove group
*
* @param \Cadoles\CoreBundle\Entity\Group $group
*/
public function removeGroup(\Cadoles\CoreBundle\Entity\Group $group)
{
$this->groups->removeElement($group);
}
/**
* Get groups
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getGroups()
{
return $this->groups;
}
/**
* Add user
*
* @param \Cadoles\CoreBundle\Entity\User $user
*
* @return Notice
*/
public function addUser(\Cadoles\CoreBundle\Entity\User $user)
{
$this->users[] = $user;
return $this;
}
/**
* Remove user
*
* @param \Cadoles\CoreBundle\Entity\User $user
*/
public function removeUser(\Cadoles\CoreBundle\Entity\User $user)
{
$this->users->removeElement($user);
}
/**
* Get users
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getUsers()
{
return $this->users;
}
}

View File

@ -0,0 +1,59 @@
<?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\OptionsResolver\OptionsResolver;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\EntityManager;
class CalendarShareType 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('groups', EntityType::class, [
'label' => 'Partager avec les Groupes',
'class' => 'CadolesCoreBundle:Group',
'query_builder' => function(EntityRepository $er) use ($user) {
return $er->createQueryBuilder('g')
->select('g')
->From('CadolesCoreBundle:UserGroup','ug')
->where('g.fgcanshare=:fgcanshare')
->andWhere('g=ug.group')
->andWhere('ug.user=:user')
->setParameter('fgcanshare',true)
->setParameter('user',$user);
},
'choice_label' => 'label',
'multiple' => true,
'expanded' => true
]);
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Cadoles\PortalBundle\Entity\Calendar',
'mode' => 'string',
'access' => 'string',
'user' => 'Cadoles\CoreBundle\Entity\User'
]);
}
}

View File

@ -0,0 +1,79 @@
<?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 Symfony\Component\OptionsResolver\OptionsResolver;
class CalendarType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$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' => 'Nom'
])
->add('color', TextType::class, [
'label' => "Couleur",
'required' => false,
'attr' => array("class" => "pick-a-color")
])
->add('type', ChoiceType::class, [
"label" => 'Type de calendrier',
"disabled" => ($options["mode"]=="update"),
"choices" => [
"Interne" => '0',
"iCalendar (ICS)" => '1',
],
"disabled" => ($options["mode"]=="delete"?true:false),
]);
if($options["access"]=="config") {
$builder
->add('roles', ChoiceType::class, [
"label" => 'Visible pour les Rôles',
"choices" => [
"Visiteur" => 'ROLE_ANONYME',
"Utilisateur" => 'ROLE_USER',
"Modérateur" => 'ROLE_MODO',
"Administateur" => 'ROLE_ADMIN',
],
"multiple" => true,
"expanded" => true,
"disabled" => ($options["mode"]=="delete"?true:false),
])
->add('groups', EntityType::class, [
"label" => 'Visible pour les Groupes',
"class" => 'CadolesCoreBundle:Group',
"choice_label" => 'label',
"multiple" => true,
"expanded" => true,
"disabled" => ($options["mode"]=="delete"?true:false),
]);
}
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Cadoles\PortalBundle\Entity\Calendar',
'mode' => 'string',
'access' => 'string'
]);
}
}

View File

@ -0,0 +1,59 @@
<?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\OptionsResolver\OptionsResolver;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\EntityManager;
class CalendareventShareType 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('groups', EntityType::class, [
'label' => 'Partager avec les Groupes',
'class' => 'CadolesCoreBundle:Group',
'query_builder' => function(EntityRepository $er) use ($user) {
return $er->createQueryBuilder('g')
->select('g')
->From('CadolesCoreBundle:UserGroup','ug')
->where('g.fgcanshare=:fgcanshare')
->andWhere('g=ug.group')
->andWhere('ug.user=:user')
->setParameter('fgcanshare',true)
->setParameter('user',$user);
},
'choice_label' => 'label',
'multiple' => true,
'expanded' => true
]);
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Cadoles\PortalBundle\Entity\Calendarevent',
'mode' => 'string',
'access' => 'string',
'user' => 'Cadoles\CoreBundle\Entity\User'
]);
}
}

View File

@ -0,0 +1,83 @@
<?php
namespace Cadoles\PortalBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Ivory\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
class NoticeType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$choices=array("oui" => "1","non" => "0");
$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('title', TextType::class, [
'label' => 'Titre'
])
->add("description",CKEditorType::class,[
"config_name" => 'full_config',
"label" => 'Description',
"required" => true,
"disabled" => ($options["mode"]=="delete"?true:false),
"config" => array("height" => "500px")
])
->add("mustread",
ChoiceType::class,array(
"label" => "Doit-être lu et approuvé ?",
'disabled' => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"choices" => $choices
)
)
->add('roles', ChoiceType::class, [
"label" => 'Visible pour les Rôles',
"choices" => [
"Visiteur" => 'ROLE_ANONYME',
"Utilisateur" => 'ROLE_USER',
"Modérateur" => 'ROLE_MODO',
"Administateur" => 'ROLE_ADMIN',
],
"multiple" => true,
"expanded" => true,
"disabled" => ($options["mode"]=="delete"?true:false),
])
->add('groups', EntityType::class, [
"label" => 'Visible pour les Groupes',
"class" => 'CadolesCoreBundle:Group',
"choice_label" => 'label',
"multiple" => true,
"expanded" => true,
"disabled" => ($options["mode"]=="delete"?true:false),
]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Cadoles\PortalBundle\Entity\Notice',
'mode' => "string",
]);
}
}

View File

@ -0,0 +1,59 @@
<?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\OptionsResolver\OptionsResolver;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\EntityManager;
class PageShareType 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('groups', EntityType::class, [
'label' => 'Partager avec les Groupes',
'class' => 'CadolesCoreBundle:Group',
'query_builder' => function(EntityRepository $er) use ($user) {
return $er->createQueryBuilder('g')
->select('g')
->From('CadolesCoreBundle:UserGroup','ug')
->where('g.fgcanshare=:fgcanshare')
->andWhere('g=ug.group')
->andWhere('ug.user=:user')
->setParameter('fgcanshare',true)
->setParameter('user',$user);
},
'choice_label' => 'label',
'multiple' => true,
'expanded' => true
]);
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Cadoles\PortalBundle\Entity\Page',
'mode' => 'string',
'access' => 'string',
'user' => 'Cadoles\CoreBundle\Entity\User'
]);
}
}

View File

@ -39,7 +39,7 @@ class PageUpdateEditorType extends AbstractType
"label" => 'Description',
"required" => false,
"disabled" => ($options["mode"]=="delete"?true:false),
"config" => array("height" => "500px")
"config" => array("height" => "500px",'filebrowserUploadRoute' => 'cadoles_portal_'.$options["access"].'_page_upload')
]);
if($options["access"]=="config") {

View File

@ -26,10 +26,10 @@ class AlertRepository extends EntityRepository
$qb->andWhere($qb->expr()->in('r.id', $ids));
}
$qb->andWhere('a.publishedAt <= :today')
$qb->andWhere('a.publishedat <= :today')
->andWhere($qb->expr()->orX(
$qb->expr()->gt('a.unpublishedAt', ':today'),
$qb->expr()->isNull('a.unpublishedAt')
$qb->expr()->gt('a.unpublishedat', ':today'),
$qb->expr()->isNull('a.unpublishedat')
))
->orderBy('a.rowOrder', $order);

View File

@ -0,0 +1,158 @@
<?php
namespace Cadoles\PortalBundle\Repository;
use Doctrine\ORM\EntityRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Cadoles\PortalBundle\Entity\Page;
use Cadoles\PortalBundle\Entity\Pagecategory;
class CalendarRepository extends EntityRepository
{
// getCalendarsUser
// $user = l'utilisateur en cours
// &$calendarsuser = les calendars de l'utilisateur
// &$calendars = les calendars système de l'utilistauer
// &$calendarsshared = les calendars partagées pour l'utilisateur
public function getCalendarsUser($user,&$calendarsuser,&$calendarsadmin,&$calendarsshared)
{
// Profilage
$roles=($user?$user->getRoles():["ROLE_ANONYME"]);
$groups=($user?$user->getGroups():[]);
// Récupération des calendars de l'utilisateur
$calendarsuser=[];
if($user) {
$qb = $this->createQueryBuilder('calendar');
$qb ->where("calendar.user=:user")
->setParameter("user",$user)
->addOrderBy('calendar.name', 'ASC');
$calendarsuser=$qb->getQuery()->getResult();
}
// Permission sur les calendars
if($calendarsuser) {
foreach($calendarsuser as $calendaruser) {
$calendaruser->setCanupdate(true);
}
}
// Pages partagées
$calendarsshared=[];
if($user) {
$calendarsshared=$this->createQueryBuilder('calendar')
->from('CadolesCoreBundle:Group','g')
->from('CadolesCoreBundle:UserGroup','ug')
->from('CadolesCoreBundle:UserGroup','proprio')
->where('g.fgcanshare=:fgcanshare')
->andWhere('g=ug.group')
->andWhere('ug.user=:user')
->andWhere('g MEMBER OF calendar.groups')
->andWhere('calendar.user != :user')
->andWhere('calendar.user is not null')
->andWhere('proprio.user=calendar.user')
->andWhere('proprio.group=g')
->setParameter('fgcanshare',true)
->setParameter('user',$user)
->addOrderBy('calendar.name', 'ASC')
->getQuery()->getResult();
}
// Initialisation du calcul des calendars
$calendarsadmin=new ArrayCollection();
// Récupération des calendars par rôles
foreach($roles as $role) {
$qb = $this->createQueryBuilder("calendar");
$qb ->where($qb->expr()->like('calendar.roles', $qb->expr()->literal("%$role%")))
->andWhere("calendar.user is null");
$calendarsroles=$qb->getQuery()->getResult();
foreach($calendarsroles as $calendarrole) {
if(!$calendarsadmin->contains($calendarrole)) $calendarsadmin->add($calendarrole);
}
}
// Récupération des calendars par group
foreach($groups as $group) {
$qb = $this->createQueryBuilder("calendar");
$qb ->where(":group MEMBER OF calendar.groups")
->andWhere("calendar.user is null")
->setParameter("group",$group->getGroup());
$calendarsgroups=$qb->getQuery()->getResult();
foreach($calendarsgroups as $calendargroup) {
if(!$calendarsadmin->contains($calendargroup)) $calendarsadmin->add($calendargroup);
}
}
// Permission sur les calendars
foreach($calendarsadmin as $calendaradmin) {
$calendaradmin->setCanupdate(false);
}
}
public function getPermission($user,$calendar,&$cansee,&$canupdate) {
// si calendar de l'utilisateur
if($calendar->getUser()==$user&&!is_null($user)) {
$cansee=true;
$canupdate=true;
}
else {
$canupdate=false;
$cansee=false;
// Profilage
$roles=($user?$user->getRoles():["ROLE_ANONYME"]);
$groups=($user?$user->getGroups():[]);
// La calendar est-elle dans les calendars associées à un partage de group ?
$incalendarsshared=$this->createQueryBuilder('calendar')
->from('CadolesCoreBundle:Group','g')
->from('CadolesCoreBundle:UserGroup','ug')
->from('CadolesCoreBundle:UserGroup','proprio')
->where('g.fgcanshare=:fgcanshare')
->andWhere('calendar.id = :id')
->andWhere('g=ug.group')
->andWhere('ug.user=:user')
->andWhere('g MEMBER OF calendar.groups')
->andWhere('calendar.user != :user')
->andWhere('calendar.user is not null')
->andWhere('proprio.user=calendar.user')
->andWhere('proprio.group=g')
->setParameter("id",$calendar->getId())
->setParameter('fgcanshare',true)
->setParameter('user',$user)
->getQuery()->getResult();
if($incalendarsshared) $cansee=true;
// La calendar est-elle dans les calendars associées au role de l'utilisateur ?
foreach($roles as $role) {
$qb = $this->createQueryBuilder("calendar");
$qb ->where($qb->expr()->like('calendar.roles', $qb->expr()->literal("%$role%")))
->andWhere("calendar.id=:id")
->andWhere("calendar.user is null")
->setParameter("id",$calendar->getId());
$incalendarrole=$qb->getQuery()->getResult();
if($incalendarrole) $cansee=true;
}
// La calendar est-elle dans les calendars associées aux groupes de l'utilisateur ?
foreach($groups as $group) {
$qb = $this->createQueryBuilder("calendar");
$qb ->where(":group MEMBER OF calendar.groups")
->andWhere("calendar.id=:id")
->andWhere("calendar.user is null")
->andWhere("calendar.id=:id")
->setParameter("id",$calendar->getId())
->setParameter("group",$group->getGroup());
$incalendargroup=$qb->getQuery()->getResult();
if($incalendargroup) $cansee=true;
}
}
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace Cadoles\PortalBundle\Repository;
use Doctrine\ORM\EntityRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Cadoles\PortalBundle\Entity\Page;
use Cadoles\PortalBundle\Entity\Pagecategory;
class CalendareventRepository extends EntityRepository
{
public function getCalendareventByDate($calendar,$start,$end)
{
$calendarevents=$this->createQueryBuilder('calendarevent')
->where('calendarevent.calendar=:calendar')
->andWhere('calendarevent.start>=:start')
->andWhere('calendarevent.end<=:end')
->setParameter('calendar',$calendar)
->setParameter('start',$start)
->setParameter('end',$end)
->OrderBy('calendarevent.start', 'ASC')
->getQuery()->getResult();
return $calendarevents;
}
public function getCalendareventShareByDate($user,$start,$end)
{
// Profilage
$roles=($user?$user->getRoles():["ROLE_ANONYME"]);
$groups=($user?$user->getGroups():[]);
// Event partagées
$calendareventshared=[];
if($user) {
$calendareventshared=$this->createQueryBuilder('calendarevent')
->andWhere('calendarevent.start>=:start')
->andWhere('calendarevent.end<=:end')
->from('CadolesPortalBundle:Calendar','calendar')
->andWhere('calendarevent.calendar=calendar')
->andWhere('calendar.user != :user')
->andWhere('calendar.user is not null')
->from('CadolesCoreBundle:Group','groupe')
->andWhere('groupe.fgcanshare=:fgcanshare')
->andWhere('groupe MEMBER OF calendarevent.groups')
->from('CadolesCoreBundle:UserGroup','usergroupe')
->andWhere('groupe=usergroupe.group')
->andWhere('usergroupe.user=:user')
->from('CadolesCoreBundle:UserGroup','proprio')
->andWhere('proprio.group=groupe')
->andWhere('proprio.user=calendar.user')
->setParameter('fgcanshare',true)
->setParameter('user',$user)
->setParameter('start',$start)
->setParameter('end',$end)
->orderBy('calendarevent.start', 'ASC')
->getQuery()->getResult();
}
return $calendareventshared;
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace Cadoles\PortalBundle\Repository;
use Doctrine\ORM\EntityRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Cadoles\PortalBundle\Entity\Notice;
class NoticeRepository extends EntityRepository
{
// getNoticeToRead
public function getNoticeUser($user,$mustread=false)
{
// Profilage
$roles=($user?$user->getRoles():["ROLE_ANONYME"]);
$groups=($user?$user->getGroups():[]);
// Initialisation du calcul des chartes
$noticesnotorder=new ArrayCollection();
// Récupération des chartes par rôles
foreach($roles as $role) {
$qb = $this->createQueryBuilder("notice");
$qb ->where($qb->expr()->like('notice.roles', $qb->expr()->literal("%$role%")));
if($mustread)
$qb ->andWhere(':user NOT MEMBER OF notice.users')
->andWhere('notice.mustread=true')
->setParameter('user',$user);
$noticesroles=$qb->getQuery()->getResult();
foreach($noticesroles as $noticerole) {
if(!$noticesnotorder->contains($noticerole)) $noticesnotorder->add($noticerole);
}
}
// Récupération des pages par group
foreach($groups as $group) {
$qb = $this->createQueryBuilder("notice");
$qb ->where(":group MEMBER OF notice.groups")
->setParameter("group",$group->getGroup());
if($mustread)
$qb ->andWhere(':user NOT MEMBER OF notice.users')
->andWhere('notice.mustread=true')
->setParameter('user',$user);
$noticesgroups=$qb->getQuery()->getResult();
foreach($noticesgroups as $noticegroup) {
if(!$noticesnotorder->contains($noticegroup)) $noticesnotorder->add($noticegroup);
}
}
return $noticesnotorder;
}
// getNoticeToRead
public function getNoticeToRead($user)
{
return $this->getNoticeUser($user,true);
}
}

View File

@ -29,7 +29,8 @@ class PageRepository extends EntityRepository
$qb = $this->createQueryBuilder('page');
$qb ->where("page.user=:user")
->setParameter("user",$user)
->orderBy('page.roworder', 'ASC');
->orderBy('page.roworder', 'ASC')
->addOrderBy('page.name', 'ASC');
$pagesuser=$qb->getQuery()->getResult();
}
@ -40,6 +41,29 @@ class PageRepository extends EntityRepository
}
}
// Pages partagées
$pagesshared=false;
if($user) {
$pagesshared=$this->createQueryBuilder('page')
->from('CadolesCoreBundle:Group','g')
->from('CadolesCoreBundle:UserGroup','ug')
->from('CadolesCoreBundle:UserGroup','proprio')
->where('g.fgcanshare=:fgcanshare')
->andWhere('g=ug.group')
->andWhere('ug.user=:user')
->andWhere('g MEMBER OF page.groups')
->andWhere('page.user != :user')
->andWhere('page.user is not null')
->andWhere('proprio.user=page.user')
->andWhere('proprio.group=g')
->setParameter('fgcanshare',true)
->setParameter('user',$user)
->orderBy('page.roworder', 'ASC')
->addOrderBy('page.name', 'ASC')
->getQuery()->getResult();
}
// Initialisation du calcul des pages
$pagesnotorder=new ArrayCollection();
@ -96,7 +120,13 @@ class PageRepository extends EntityRepository
$have=true;
}
}
if($pagesshared) {
foreach($pagesshared as $v) {
if($v == $entity)
$have=true;
}
}
if(!$have) $entity=false;
}
@ -113,11 +143,16 @@ class PageRepository extends EntityRepository
if(!$entity) {
$entity=$pagesuser[0];
}
// ou On récupère la premiere page partagées
if(!$entity) {
$entity=$pagesshared[0];
}
}
public function getPermission($user,$page,&$cansee,&$canupdate) {
// si page de l'utilisateur
if($page->getUser()==$user) {
if($page->getUser()==$user&&!is_null($user)) {
$cansee=true;
$canupdate=true;
}
@ -129,6 +164,26 @@ class PageRepository extends EntityRepository
$roles=($user?$user->getRoles():["ROLE_ANONYME"]);
$groups=($user?$user->getGroups():[]);
// La page est-elle dans les pages associées à un partage de group ?
$inpagesshared=$this->createQueryBuilder('page')
->from('CadolesCoreBundle:Group','g')
->from('CadolesCoreBundle:UserGroup','ug')
->from('CadolesCoreBundle:UserGroup','proprio')
->where('g.fgcanshare=:fgcanshare')
->andWhere('page.id = :id')
->andWhere('g=ug.group')
->andWhere('ug.user=:user')
->andWhere('g MEMBER OF page.groups')
->andWhere('page.user != :user')
->andWhere('page.user is not null')
->andWhere('proprio.user=page.user')
->andWhere('proprio.group=g')
->setParameter("id",$page->getId())
->setParameter('fgcanshare',true)
->setParameter('user',$user)
->getQuery()->getResult();
if($inpagesshared) $cansee=true;
// La page est-elle dans les pages associées au role de l'utilisateur ?
foreach($roles as $role) {
$qb = $this->createQueryBuilder("page");
@ -140,6 +195,7 @@ class PageRepository extends EntityRepository
if($inpagerole) $cansee=true;
}
// La page est-elle dans les pages associées aux groupes de l'utilisateur ?
foreach($groups as $group) {
$qb = $this->createQueryBuilder("page");

View File

@ -112,6 +112,31 @@ cadoles_portal_config_flux_order:
path: /config/flux/order
defaults: { _controller: CadolesPortalBundle:Flux:order }
#== Config Notice
cadoles_portal_config_notice:
path: /config/notice
defaults: { _controller: CadolesPortalBundle:Notice:list }
cadoles_portal_config_notice_submit:
path: /config/notice/submit
defaults: { _controller: CadolesPortalBundle:Notice:submit }
cadoles_portal_config_notice_update:
path: /config/notice/update/{id}
defaults: { _controller: CadolesPortalBundle:Notice:update }
cadoles_portal_config_notice_delete:
path: /config/notice/delete/{id}
defaults: { _controller: CadolesPortalBundle:Notice:delete }
cadoles_portal_user_notice_haveread:
path: /user/notice/haveread
defaults: { _controller: CadolesPortalBundle:Notice:haveread }
cadoles_portal_user_notice_view:
path: /notice/view
defaults: { _controller: CadolesPortalBundle:Notice:view }
#== Page
#-- Access config
cadoles_portal_config_page:
@ -138,6 +163,14 @@ cadoles_portal_config_page_view:
path: /config/page/view/{id}
defaults: { _controller: CadolesPortalBundle:Page:view, access: config }
cadoles_portal_config_page_order:
path: /config/page/order
defaults: { _controller: CadolesPortalBundle:Page:order, access: config }
cadoles_portal_config_page_upload:
path: /config/page/upload
defaults: { _controller: CadolesPortalBundle:Page:upload, access: config }
#-- Access user
cadoles_portal_user_page_submit:
path: /user/page/submit
@ -151,10 +184,23 @@ cadoles_portal_user_page_delete:
path: /user/page/delete/{id}
defaults: { _controller: CadolesPortalBundle:Page:delete, access: user }
cadoles_portal_user_page_share:
path: /user/page/share/{id}
defaults: { _controller: CadolesPortalBundle:Page:share, access: user }
cadoles_portal_user_page_view:
path: /page/view/{id}
defaults: { _controller: CadolesPortalBundle:Page:view, access: user }
cadoles_portal_user_page_order:
path: /user/page/order
defaults: { _controller: CadolesPortalBundle:Page:order, access: user }
cadoles_portal_user_page_upload:
path: /user/page/upload
defaults: { _controller: CadolesPortalBundle:Page:upload, access: user }
#== Bookmark
#-- Access config
cadoles_portal_config_bookmark_submit:
@ -230,6 +276,105 @@ cadoles_portal_user_slide_upload:
path: /user/slide/upload
defaults: { _controller: CadolesPortalBundle:Slide:upload, access: user }
#== Calendar
#-- Access config
cadoles_portal_config_calendar:
path: /config/calendar
defaults: { _controller: CadolesPortalBundle:Calendar:list }
cadoles_portal_config_calendar_ajax_list:
path: /config/calendar/ajax/list
defaults: { _controller: CadolesPortalBundle:Calendar:ajaxlist, access: config }
cadoles_portal_config_calendar_submit:
path: /config/calendar/submit
defaults: { _controller: CadolesPortalBundle:Calendar:submit, access: config }
cadoles_portal_config_calendar_update:
path: /config/calendar/update/{id}
defaults: { _controller: CadolesPortalBundle:Calendar:update, access: config }
cadoles_portal_config_calendar_delete:
path: /config/calendar/delete/{id}
defaults: { _controller: CadolesPortalBundle:Calendar:delete, access: config }
cadoles_portal_config_calendar_share:
path: /config/calendar/share/{id}
defaults: { _controller: CadolesPortalBundle:Calendar:share, access: config }
cadoles_portal_config_calendar_view:
path: /config/calendar/view
defaults: { _controller: CadolesPortalBundle:Calendar:view, access: config }
#-- Access user
cadoles_portal_user_calendar_view:
path: /calendar
defaults: { _controller: CadolesPortalBundle:Calendar:view, access: user }
cadoles_portal_user_calendar_submit:
path: /user/calendar/submit
defaults: { _controller: CadolesPortalBundle:Calendar:submit, access: user }
cadoles_portal_user_calendar_update:
path: /user/calendar/update/{id}
defaults: { _controller: CadolesPortalBundle:Calendar:update, access: user }
cadoles_portal_user_calendar_delete:
path: /user/calendar/delete/{id}
defaults: { _controller: CadolesPortalBundle:Calendar:delete, access: user }
cadoles_portal_user_calendar_share:
path: /user/calendar/share/{id}
defaults: { _controller: CadolesPortalBundle:Calendar:share, access: user }
#== Calendarevent
#-- Access config
cadoles_portal_config_calendarevent_load:
path: /config/calendarevent/load
defaults: { _controller: CadolesPortalBundle:Calendarevent:load, access: config }
cadoles_portal_config_calendarevent_submit:
path: /config/calendarevent/submit
defaults: { _controller: CadolesPortalBundle:Calendarevent:submit, access: config }
cadoles_portal_config_calendarevent_update:
path: /config/calendarevent/update
defaults: { _controller: CadolesPortalBundle:Calendarevent:update, access: config }
cadoles_portal_config_calendarevent_delete:
path: /config/calendarevent/delete
defaults: { _controller: CadolesPortalBundle:Calendarevent:delete, access: config }
cadoles_portal_config_calendarevent_share:
path: /config/calendarevent/share/{id}
defaults: { _controller: CadolesPortalBundle:Calendarevent:share, access: config }
#-- Access user
cadoles_portal_user_calendarevent_load:
path: /calendarevent/load
defaults: { _controller: CadolesPortalBundle:Calendarevent:load, access: user }
cadoles_portal_user_calendarevent_submit:
path: /user/calendarevent/submit
defaults: { _controller: CadolesPortalBundle:Calendarevent:submit, access: user }
cadoles_portal_user_calendarevent_update:
path: /user/calendarevent/update
defaults: { _controller: CadolesPortalBundle:Calendarevent:update, access: user }
cadoles_portal_user_calendarevent_delete:
path: /user/calendarevent/delete
defaults: { _controller: CadolesPortalBundle:Calendarevent:delete, access: user }
cadoles_portal_user_calendarevent_share:
path: /user/calendarevent/share/{id}
defaults: { _controller: CadolesPortalBundle:Calendarevent:share, access: user }
#== Tool
cadoles_portal_user_tool_clockanalogique:
path: /tool/clockanalogique
@ -301,6 +446,10 @@ cadoles_portal_config_panelwidget_view_galery:
path: /config/pagewidget/view/galery/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewgalery, access: config }
cadoles_portal_config_panelwidget_view_calendar:
path: /config/pagewidget/view/calendar/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewcalendar, access: config }
cadoles_portal_config_panelwidget_view_clock:
path: /config/pagewidget/view/clock/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewclock, access: config }
@ -366,6 +515,10 @@ cadoles_portal_user_panelwidget_view_galery:
path: /pagewidget/view/galery/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewgalery, access: user }
cadoles_portal_user_panelwidget_view_calendar:
path: /pagewidget/view/calendar/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewcalendar, access: user }
cadoles_portal_user_panelwidget_view_clock:
path: /pagewidget/view/clock/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewclock, access: user }

View File

@ -0,0 +1,71 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
Modification Calendrier
{% elseif mode=="submit" %}
Création Calendrier
{% endif %}
</h1>
{{ form_widget(form.submit) }}
<a class="btn btn-default" href={{ path('cadoles_portal_'~access~'_calendar_view',{'id':entity.id}) }}>Annuler</a>
{% if mode=="update" %}
<a href={{ path('cadoles_portal_config_calendar_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 cette annonce ?">
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 row clearfix">
{% if form.roles is defined %}
<div class="col-md-8">
{% else %}
<div class="col-md-12">
{% endif %}
{{ form_row(form.name) }}
{{ form_row(form.type) }}
{{ form_row(form.color) }}
</div>
{% if form.roles is defined %}
<div class="col-md-4">
{{ form_row(form.roles) }}
{{ form_row(form.groups) }}
</div>
{% endif %}
</div>
{{ form_end(form) }}
{% endblock %}
{% block localjavascript %}
{% endblock %}

View File

@ -0,0 +1,55 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
<h1>
Gestion des Calendriers
</h1>
<p>
<a href="{{ path('cadoles_portal_config_calendar_submit') }}" class="btn btn-success">Ajouter un Calendrier</a>
</p>
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-table fa-fw"></i> Liste des Calendriers
</div>
<div class="panel-body">
<div class="dataTable_wrapper">
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
<thead>
<tr>
<th width="100px" class="no-sort">Action</th>
<th>Nom</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
$('#dataTables').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false } ],
responsive: true,
iDisplayLength: 100,
order: [[ 1, "asc" ]],
processing: true,
serverSide: true,
ajax: "{{ path('cadoles_portal_config_calendar_ajax_list') }}",
drawCallback: function(settings) {
$("a[data-method='delete']").click(function(){
if( !confirm('Êtes-vous sûr de vouloir supprimer ce calendrier ?')) {
return false;
}
});
}
});
});
{% endblock %}

View File

@ -0,0 +1,42 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1>
Partage Page
</h1>
<p>
{{ form_widget(form.submit) }}
<a class="btn btn-default" href={{ path('cadoles_portal_'~access~'_calendar_view',{'id':entity.id}) }}>Annuler</a>
</p>
{% 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="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Informations
</div>
<div class="panel-body">
{{ form_row(form.groups) }}
</div>
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -0,0 +1,555 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block appmenu %}
<ul class="nav navbar-top-links navbar-left">
<li id="menucalendar-0" class="{% if entity.id is not defined %}active{%endif%}" style="cursor:pointer"><a onClick="showCalendar(0,{{ canupdate }})">Tout</a></li>
{% for calendar in calendars %}
<li id="menucalendar-{{calendar.id}}" data-open="{% if calendar.canupdate %}true{%endif%}" class="{% if entity.id is defined and entity.id==calendar.id%}active{%endif%}" style="cursor:pointer">
<a onClick="showCalendar({{ calendar.id }},{{ calendar.canupdate }})">
{{ calendar.name }}
{% if not calendar.canupdate %}
<i class="fa fa-lock"></i>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
<div id="menupageaction">
{% if canupdate %}
<a id="menusubmit" style="cursor:pointer" onclick="submitCalendar()" title='Ajouter une calendar'><i class='fa fa-plus fa-fw'></i></a>
{% endif %}
<a id="menuupdate" style="cursor:pointer;display:none" onclick="updateCalendar()" title='Modifier une calendar'><i class='fa fa-file fa-fw'></i></a>
<a id="menushare" style="cursor:pointer;display:none" onclick="shareCalendar()" title='Partager une calendar'><i class='fa fa-share-alt fa-fw'></i></a>
<a id="menudelete" style="cursor:pointer;display:none" onclick="deleteCalendar()" title='Supprimer une calendar'><i class='fa fa-trash fa-fw'></i></a>
</div>
{% endblock %}
{% block pagewrapper %}
{% if access=="config" %}
<div class="pagemenu">
<a href="{{ path('cadoles_portal_config_calendar_view', {id:entity.id})}}">{{ entity.name }}</a>>
<a href='{{ path('cadoles_portal_config_calendar_update', {id:entity.id}) }}' title='Modifier le panel'><i class='fa fa-file fa-fw'></i></a>
<a href='{{ path('cadoles_portal_config_calendar_delete', { id: entity.id }) }}' data-method='delete' data-confirm='Êtes-vous sûr de vouloir supprimer ?' title='Supprimer le panel'><i class='fa fa-trash fa-fw'></i></a>
</div>
{% endif %}
<div id="calendar"></div>
<!-- CREATION EVENEMENT -->
<div id="mymodal-event-add" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">Evénement</h4>
</div>
<div class="modal-body">
<input id='vladd' name='vladd' class='btn btn-success' type='submit' onClick='submitEvent();' value='Valider' />
&nbsp;
<input class='btn btn-default' type='submit' value='Annuler' onClick='$("#mymodal-event-add").modal("hide");'>
<input name="calendar_id" id="calendar_id" type="hidden" class="form-control" placeholder="Nom">
<input name="envent_id" id="envent_id" type="hidden" class="form-control" placeholder="Nom">
<fieldset class="fieldset form-horizontal" style="clear:both; margin-top:30px;">
<div class="form-group">
<label for="event_calendar" class="col-sm-5 control-label">Calendrier*</label>
<div class="col-sm-7">
<select name="event_calendar" id="event_calendar" class="form-control">
{% if access=="config" %}
{% for calendar in calendars %}
<option value='{{ calendar.id}}'>{{ calendar.name}}</option>
{% endfor %}
{% else %}
{% for calendar in calendars %}
{% if calendar.canupdate %}
<option value='{{ calendar.id}}'>{{ calendar.name}}</option>
{% endif %}
{% endfor %}
{% endif %}
</select>
</div>
</div>
<div class="form-group">
<label for="event_title" class="col-sm-5 control-label">Titre*</label>
<div class="col-sm-7"><input name="event_title" id="event_title" type="titre" class="form-control focus" placeholder="Titre"></div>
</div>
<div class="form-group">
<label for="event_description" class="col-sm-5 control-label">Description</label>
<div class="col-sm-7"><textarea style="height:150px" name="event_description" id="event_description" type="titre" class="form-control focus" placeholder="Description"></textarea></div>
</div>
<div class="form-group">
<label for="event_allday" class="col-sm-5 control-label">Evènement sur la journée*</label>
<div class="col-sm-7"><input id="event_allday" name="event_allday" type="checkbox" class="switch" onChange="switchallDay('SUBMIT');"></div>
</div>
<div class="form-group" id="form_event_start_time">
<label for="date" class="col-sm-5 control-label">Date Début*</label>
<div class="col-sm-7"><input name="event_start_time" id="event_start_time" type="titre" class="form-control" placeholder="Date Début" value=""></div>
</div>
<div class="form-group" id="form_event_end_time">
<label for="date" class="col-sm-5 control-label">Date Fin*</label>
<div class="col-sm-7"><input name="event_end_time" id="event_end_time" type="titre" class="form-control" placeholder="Date Fin" value=""></div>
</div>
<div class="form-group" id="form_event_start">
<label for="date" class="col-sm-5 control-label">Date Début*</label>
<div class="col-sm-7"><input name="event_start" id="event_start" type="titre" class="form-control" placeholder="Date Début" value=""></div>
</div>
<div class="form-group" id="form_event_end">
<label for="date" class="col-sm-5 control-label">Date Fin*</label>
<div class="col-sm-7"><input name="event_end" id="event_end" type="titre" class="form-control" placeholder="Date Fin" value=""></div>
</div>
</fieldset>
</div>
</div>
</div>
</div>
<!-- UPDATE / DELETE EVENEMENT -->
<div id="mymodal-event-mod" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">Evénement</h4>
</div>
<div class="modal-body">
<input id='vladd' name='vladd' class='btn btn-success' type='submit' onClick='updateEvent();' value='Valider' />
&nbsp;
<input class="btn btn-primary" type='submit' value='Partager' onClick='shareEvent();' />
&nbsp;
<input class='btn btn-default' type='submit' value='Annuler' onClick='$("#mymodal-event-mod").modal("hide");'>
<input name="calendar_id" id="calendar_id" type="hidden" class="form-control" placeholder="Nom">
<input name="event_id" id="event_id" type="hidden" class="form-control" placeholder="Nom">
<fieldset class="fieldset form-horizontal" style="clear:both; margin-top:30px;">
<div class="form-group">
<label for="event_calendar" class="col-sm-5 control-label">Calendrier*</label>
<div class="col-sm-7">
<select name="event_calendar" id="event_calendar" class="form-control">
{% if access=="config" %}
{% for calendar in calendars %}
<option value='{{ calendar.id}}'>{{ calendar.name}}</option>
{% endfor %}
{% else %}
{% for calendar in calendars %}
{% if calendar.canupdate %}
<option value='{{ calendar.id}}'>{{ calendar.name}}</option>
{% endif %}
{% endfor %}
{% endif %}
</select>
</div>
</div>
<div class="form-group">
<label for="event_title" class="col-sm-5 control-label">Titre*</label>
<div class="col-sm-7"><input name="event_title" id="event_title" type="titre" class="form-control focus" placeholder="Titre"></div>
</div>
<div class="form-group">
<label for="event_description" class="col-sm-5 control-label">Description</label>
<div class="col-sm-7"><textarea style="height:150px" name="event_description" id="event_description" type="titre" class="form-control focus" placeholder="Description"></textarea></div>
</div>
<div class="form-group">
<label for="event_allday" class="col-sm-5 control-label">Evènement sur la journée*</label>
<div class="col-sm-7"><input id="event_allday" name="event_allday" type="checkbox" class="switch" onChange="switchallDay('UPDATE');"></div>
</div>
<div class="form-group" id="form_event_start_time">
<label for="date" class="col-sm-5 control-label">Date Début*</label>
<div class="col-sm-7"><input name="event_start_time" id="event_start_timem" type="titre" class="form-control" placeholder="Date Début" value=""></div>
</div>
<div class="form-group" id="form_event_end_time">
<label for="date" class="col-sm-5 control-label">Date Fin*</label>
<div class="col-sm-7"><input name="event_end_time" id="event_end_timem" type="titre" class="form-control" placeholder="Date Fin" value=""></div>
</div>
<div class="form-group" id="form_event_start">
<label for="date" class="col-sm-5 control-label">Date Début*</label>
<div class="col-sm-7"><input name="event_start" id="event_startm" type="titre" class="form-control" placeholder="Date Début" value=""></div>
</div>
<div class="form-group" id="form_event_end">
<label for="date" class="col-sm-5 control-label">Date Fin*</label>
<div class="col-sm-7"><input name="event_end" id="event_endm" type="titre" class="form-control" placeholder="Date Fin" value=""></div>
</div>
</fieldset>
<input id='vldel' name='vldel' class='btn btn-danger' type='submit' onClick='deleteEvent();' value='Suppression' />
</div>
</div>
</div>
</div>
{% endblock %}
{% block localjavascript %}
var idcalendar;
$('document').ready(function(){
{% if entity.id is defined %}
{% for calendar in calendars %}
{% if calendar.id==entity.id %}
showCalendar({{ calendar.id }}, {{ calendar.canupdate }});
{% endif %}
{% endfor %}
{% else %}
showCalendar(0, {{ canupdate }});
{% endif %}
});
function submitCalendar() {
var url="{{ path('cadoles_portal_'~access~'_calendar_submit') }}";
$(location).attr('href',url);
}
function updateCalendar() {
var url="{{ path('cadoles_portal_'~access~'_calendar_update',{id:'xx'}) }}";
url=url.replace('xx',idcalendar);
$(location).attr('href',url);
}
function shareCalendar() {
var url="{{ path('cadoles_portal_'~access~'_calendar_share',{id:'xx'}) }}";
url=url.replace('xx',idcalendar);
$(location).attr('href',url);
}
function deleteCalendar() {
if (confirm('Êtes-vous sûr de vouloir supprimer ?')) {
var url="{{ path('cadoles_portal_'~access~'_calendar_delete',{id:'xx'}) }}";
url=url.replace('xx',idcalendar);
$(location).attr('href',url);
}
}
// Affichages des calendars
function showCalendar(id,canupdate) {
idcalendar=id;
urltoload="{{ path('cadoles_portal_'~access~'_calendarevent_load',{'idcalendar':'xx'}) }}";
urltoload=urltoload.replace('xx',idcalendar);
// Rendre actif le page en cours dans le menu
$(".navbar-top-links li").removeClass("active");
$("#menucalendar-"+id).addClass("active");
// Cacher les actions possibles sur la page
$("#menuupdate").hide();
$("#menushare").hide();
$("#menudelete").hide();
if($("#menucalendar-"+id).data("open")) {
console.log($("#menucalendar-"+id).data("open"));
$("#menuupdate").show();
$("#menushare").show();
$("#menudelete").show();
}
$('#calendar').fullCalendar( 'destroy' );
$('#calendar').fullCalendar({
lang: 'fr',
selectable: canupdate,
selectHelper: true,
editable: canupdate,
eventLimit: true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
// Creation Evenement
select: function(start, end) {
{% if app.user %}
var allDay = !start.hasTime() && !end.hasTime();
$("#mymodal-event-add #event_title").val("");
$("#mymodal-event-add #event_description").val("");
$("#mymodal-event-add #event_start_time").val(moment(start).format("DD/MM/YYYY HH:mm"));
$("#mymodal-event-add #event_end_time").val(moment(end).format("DD/MM/YYYY HH:mm"));
$("#mymodal-event-add #event_start").val(moment(start).format("DD/MM/YYYY"));
$("#mymodal-event-add #event_end").val(moment(end).subtract("1","s").format("DD/MM/YYYY"));
if(allDay) $("#mymodal-event-add #event_end_time").val(moment(end).subtract("1","s").format("DD/MM/YYYY HH:mm"));
$("#mymodal-event-add #event_calendar option[value='"+idcalendar+"']").prop('selected', true);
$("#mymodal-event-add #event_allday").bootstrapSwitch('state', allDay);
switchallDay("SUBMIT");
$('#mymodal-event-add').modal('show');
{% endif %}
},
// Modification Evenement
eventClick: function(event, jsEvent, view) {
if(event.editable) {
$("#mymodal-event-mod #event_id").val(event.id);
$("#mymodal-event-mod #event_title").val(event.title);
$("#mymodal-event-mod #event_description").val(event.description);
$("#mymodal-event-mod #event_start_timem").val(event.start.format("DD/MM/YYYY HH:mm"));
$("#mymodal-event-mod #event_end_timem").val(event.end.format("DD/MM/YYYY HH:mm"));
$("#mymodal-event-mod #event_startm").val(event.start.format("DD/MM/YYYY"));
$("#mymodal-event-mod #event_endm").val(event.end.subtract("1","s").format("DD/MM/YYYY"));
$("#mymodal-event-mod #event_allday").bootstrapSwitch('state', event.allDay);
$("#mymodal-event-mod #event_calendar option[value='"+event.calendar+"']").prop('selected', true);
switchallDay("UPDATE");
$('#mymodal-event-mod').modal('show');
}
},
// Deplacement Evenement
eventDrop: function(event, delta, revertFunc) {
$.ajax({
method: "POST",
url: "{{ path('cadoles_portal_'~access~'_calendarevent_update') }}",
data: {
"id": event.id,
"title": event.title,
"description":event.description,
"start": event.start.format("YYYY-MM-DD HH:mm"),
"end": event.end.format("YYYY-MM-DD HH:mm"),
"allday": event.allDay,
"idcalendar": event.calendar
}
});
},
// Resize Evenement
eventResize: function(event, delta, revertFunc) {
$.ajax({
method: "POST",
url: "{{ path('cadoles_portal_'~access~'_calendarevent_update') }}",
data: {
"id": event.id,
"title": event.title,
"description":event.description,
"start": event.start.format("YYYY-MM-DD HH:mm"),
"end": event.end.format("YYYY-MM-DD HH:mm"),
"allday": event.allDay,
"idcalendar": event.calendar
}
});
},
eventRender: function(event, element) {
element.attr('title', event.description);
},
events:urltoload
});
}
function switchallDay(form) {
if(form=="SUBMIT") {
if($("#mymodal-event-add #event_allday").bootstrapSwitch('state')) {
$("#mymodal-event-add #form_event_start_time").hide();
$("#mymodal-event-add #form_event_end_time").hide();
$("#mymodal-event-add #form_event_start").show();
$("#mymodal-event-add #form_event_end").show();
}
else {
$("#mymodal-event-add #form_event_start_time").show();
$("#mymodal-event-add #form_event_end_time").show();
$("#mymodal-event-add #form_event_start").hide();
$("#mymodal-event-add #form_event_end").hide();
}
}
else if(form=="UPDATE") {
if($("#mymodal-event-mod #event_allday").bootstrapSwitch('state')) {
$("#mymodal-event-mod #form_event_start_time").hide();
$("#mymodal-event-mod #form_event_end_time").hide();
$("#mymodal-event-mod #form_event_start").show();
$("#mymodal-event-mod #form_event_end").show();
}
else {
$("#mymodal-event-mod #form_event_start_time").show();
$("#mymodal-event-mod #form_event_end_time").show();
$("#mymodal-event-mod #form_event_start").hide();
$("#mymodal-event-mod #form_event_end").hide();
}
}
}
function submitEvent() {
$("#mymodal-event-add .alert").remove();
if($("#mymodal-event-add #event_title").val()=="") {
$("#mymodal-event-add fieldset").append("<div class='alert alert-danger' style='margin: 5px 0px'>Titre obligatoire</div>");
return;
}
// Allday
if($("#mymodal-event-add #event_allday").bootstrapSwitch('state')) {
var start=moment($("#mymodal-event-add #event_start").val(),"DD/MM/YYYY");
var end=moment($("#mymodal-event-add #event_end").val(),"DD/MM/YYYY").add("1","d");
if( start.isAfter(end) ) {
$("#mymodal-event-add fieldset").append("<div class='alert alert-danger' style='margin: 5px 0px'>Date de début supérieure à date de fin</div>");
return;
}
var dstart=moment($("#mymodal-event-add #event_start").val(),"DD/MM/YYYY").format("YYYY-MM-DD 00:00");
var dend=moment($("#mymodal-event-add #event_end").val(),"DD/MM/YYYY").add("1","d").format("YYYY-MM-DD 00:00");
}
else {
var start=moment($("#mymodal-event-add #event_start_time").val(),"DD/MM/YYYY HH:mm");
var end=moment($("#mymodal-event-add #event_end_time").val(),"DD/MM/YYYY HH:mm");
if( start.isAfter(end) ) {
$("#mymodal-event-add fieldset").append("<div class='alert alert-danger' style='margin: 5px 0px'>Date de début supérieure à date de fin</div>");
return;
}
var dstart=moment($("#mymodal-event-add #event_start_time").val(),"DD/MM/YYYY HH:mm").format("YYYY-MM-DD HH:mm");
var dend=moment($("#mymodal-event-add #event_end_time").val(),"DD/MM/YYYY HH:mm").format("YYYY-MM-DD HH:mm");
}
$.ajax({
method: "POST",
url: "{{ path('cadoles_portal_'~access~'_calendarevent_submit') }}",
data: {
"title":$("#mymodal-event-add #event_title").val(),
"description":$("#mymodal-event-add #event_description").val(),
"start": dstart,
"end": dend,
"allday": $("#mymodal-event-add #event_allday").bootstrapSwitch('state'),
"idcalendar": $("#mymodal-event-add #event_calendar").val()
},
success: function(data) {
console.log(data.id);
// Ajout de l'event dans fullcalendar
$('#calendar').fullCalendar('renderEvent',
{
id: data.id,
title: $("#mymodal-event-add #event_title").val(),
description: $("#mymodal-event-add #event_description").val(),
start: start,
end: end,
editable: true,
color: data.color,
allDay: $("#mymodal-event-add #event_allday").bootstrapSwitch('state'),
calendar: $("#mymodal-event-add #event_calendar").val()
},
false // make the event "stick"
);
$("#mymodal-event-add").modal("hide");
}
});
}
function updateEvent() {
$("#mymodal-event-mod .alert").remove();
if($("#mymodal-event-mod #event_title").val()=="") {
$("#mymodal-event-mod fieldset").append("<div class='alert alert-danger' style='margin: 5px 0px'>Titre obligatoire</div>");
return;
}
// Allday
if($("#mymodal-event-mod #event_allday").bootstrapSwitch('state')) {
var start=moment($("#mymodal-event-mod #event_startm").val(),"DD/MM/YYYY");
var end=moment($("#mymodal-event-mod #event_endm").val(),"DD/MM/YYYY").add("1","d");
if( start.isAfter(end) ) {
$("#mymodal-event-mod fieldset").append("<div class='alert alert-danger' style='margin: 5px 0px'>Date de début supérieure à date de fin</div>");
return;
}
var dstart=moment($("#mymodal-event-mod #event_startm").val(),"DD/MM/YYYY").format("YYYY-MM-DD 00:00");
var dend=moment($("#mymodal-event-mod #event_endm").val(),"DD/MM/YYYY").add("1","d").format("YYYY-MM-DD 00:00");
}
else {
var start=moment($("#mymodal-event-mod #event_start_timem").val(),"DD/MM/YYYY HH:mm");
var end=moment($("#mymodal-event-mod #event_end_timem").val(),"DD/MM/YYYY HH:mm");
if( start.isAfter(end) ) {
$("#mymodal-event-mod fieldset").append("<div class='alert alert-danger' style='margin: 5px 0px'>Date de début supérieure à date de fin</div>");
return;
}
var dstart=moment($("#mymodal-event-mod #event_start_timem").val(),"DD/MM/YYYY HH:mm").format("YYYY-MM-DD HH:mm");
var dend=moment($("#mymodal-event-mod #event_end_timem").val(),"DD/MM/YYYY HH:mm").format("YYYY-MM-DD HH:mm");
}
$.ajax({
method: "POST",
url: "{{ path('cadoles_portal_'~access~'_calendarevent_update') }}",
data: {
"id": $("#mymodal-event-mod #event_id").val(),
"title":$("#mymodal-event-mod #event_title").val(),
"description":$("#mymodal-event-mod #event_description").val(),
"start": dstart,
"end": dend,
"allday": $("#mymodal-event-mod #event_allday").bootstrapSwitch('state'),
"idcalendar": $("#mymodal-event-mod #event_calendar").val()
},
success: function(data) {
var idevent=$("#mymodal-event-mod #event_id").val();
// Modifification de l'event dans fullcalendar
$('#calendar').fullCalendar( 'removeEvents', idevent );
$('#calendar').fullCalendar('renderEvent',
{
id: idevent,
title: $("#mymodal-event-mod #event_title").val(),
description: $("#mymodal-event-mod #event_description").val(),
start: start,
end: end,
editable: true,
color: data.color,
allDay: $("#mymodal-event-mod #event_allday").bootstrapSwitch('state'),
calendar: $("#mymodal-event-mod #event_calendar").val()
},
false // make the event "stick"
);
$("#mymodal-event-mod").modal("hide");
}
});
}
function shareEvent() {
var id=$("#mymodal-event-mod #event_id").val();
var url="{{ path('cadoles_portal_'~access~'_calendarevent_share',{id:'xx'}) }}";
url=url.replace('xx',id);
$(location).attr('href',url);
}
function deleteEvent() {
$.ajax({
method: "POST",
url: "{{ path('cadoles_portal_'~access~'_calendarevent_delete') }}",
data: {
"id": $("#mymodal-event-mod #event_id").val(),
"idcalendar": $("#mymodal-event-mod #event_calendar").val()
},
success: function(data) {
var idevent=$("#mymodal-event-mod #event_id").val();
// Supression de l'event dans fullcalendar
$('#calendar').fullCalendar( 'removeEvents', idevent );
$("#mymodal-event-mod").modal("hide");
}
});
}
{% endblock %}

View File

@ -0,0 +1,42 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1>
Partage Page
</h1>
<p>
{{ form_widget(form.submit) }}
<a class="btn btn-default" href={{ path('cadoles_portal_'~access~'_calendar_view',{'id':entity.calendar.id}) }}>Annuler</a>
</p>
{% 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="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Informations
</div>
<div class="panel-body">
{{ form_row(form.groups) }}
</div>
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -0,0 +1,64 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
Modification Charte
{% elseif mode=="submit" %}
Création Charte
{% endif %}
</h1>
{{ form_widget(form.submit) }}
<a class="btn btn-default" href={{ path('cadoles_portal_config_notice') }}>Annuler</a>
{% if mode=="update" %}
<a href={{ path('cadoles_portal_config_notice_delete',{'id':notice.id}) }}
class="btn btn-danger pull-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cette annonce ?">
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 row clearfix">
<div class="col-md-8">
{{ form_row(form.title) }}
{{ form_row(form.mustread) }}
{{ form_row(form.description) }}
</div>
<div class="col-md-4">
{{ form_row(form.roles) }}
{{ form_row(form.groups) }}
</div>
</div>
{{ form_end(form) }}
{% endblock %}
{% block localjavascript %}
{% endblock %}

View File

@ -0,0 +1,166 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{% set color = app.session.get('color') %}
<h1>
Gestion des Chartes
</h1>
<div class="row">
<div class="col-md-9">
<p>
<a href="{{ path('cadoles_portal_config_notice_submit') }}" class="btn btn-success">Ajouter une Charte</a>
</p>
<div id="list" class="panel-group">
{% for notice in notices %}
{% set colorbody = "background-color: #" ~ color['main'] %}
<div
class="panel
list-item
{% for group in notice.groups %}{{ ' group-' ~ group.id }}{% endfor %}
{% for role in notice.roles %}{{ ' role-' ~ role }}{% endfor %}
"
data-notice-id="{{ notice.id }}"
style="{{ colorbody }};"
>
<div class="panel-heading" role="tab">
<a href="{{ path('cadoles_portal_config_notice_update', { id: notice.id }) }}">
{{ notice.title }}
</a>
</div>
<input type="hidden" name="notice_item[id][]" value="{{ notice.id }}" />
</div>
{% endfor %}
</div>
</div>
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-filter"></i>
Afficher par Rôle
</div>
<div class="panel-body">
<ul id="role-filter" class="list-group">
<a class="active list-group-item filterfgall" id="allrole" style="cursor:pointer">
<i class="fa fa-users"></i>
Toutes les Rôles
<span class="badge">{{ notices|length }}</span>
</a>
<a class="list-group-item" data-role="ROLE_ANONYME" style="cursor:pointer">
<i class="fa fa-user"></i>
Visiteur
<span class="badge"></span>
</a>
<a class="list-group-item" data-role="ROLE_USER" style="cursor:pointer">
<i class="fa fa-user"></i>
Utilisateur
<span class="badge"></span>
</a>
<a class="list-group-item" data-role="ROLE_MODO" style="cursor:pointer">
<i class="fa fa-user"></i>
Modérateur
<span class="badge"></span>
</a>
<a class="list-group-item" data-role="ROLE_ADMIN" style="cursor:pointer">
<i class="fa fa-user"></i>
Administrateur
<span class="badge"></span>
</a>
</ul>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-filter"></i>
Afficher par Groupes
</div>
<div class="panel-body">
<div id="group-filter" class="list-group">
<a href="#" class="active list-group-item filterfgall">
<i class="fa fa-users"></i>
Tout les groupes
<span class="badge">{{ notices|length }}</span>
</a>
{% for group in groups %}
<a class="list-group-item" href="#" data-role="{{ group.id }}">
<i class="fa fa-user"></i>
{{ group.label }}
<span class="badge">{{ group.notices|length }}</span>
</a>
{% endfor %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block localjavascript %}
$( function() {
$("a[data-role='ROLE_ANONYME']").children("span").html($('.role-ROLE_ANONYME').length);
$("a[data-role='ROLE_USER']").children("span").html($('.role-ROLE_USER').length);
$("a[data-role='ROLE_MODO']").children("span").html($('.role-ROLE_MODO').length);
$("a[data-role='ROLE_ADMIN']").children("span").html($('.role-ROLE_ADMIN').length);
$('#role-filter a').click(function(){
// On réactive les auters filtres à tout
$('#group-filter a').removeClass('active');
$(".filterfgall").addClass('active');
// On rend actif la zone cliquée
$('#role-filter a').removeClass('active');
$(this).addClass('active');
// On cache l'ensemble des elements
$(".list-item").hide();
// On affiche les elements filtrés
if($(this).hasClass('filterfgall'))
var $notices = $('.list-item');
else
var $notices = $('.role-'+$(this).data('role'));
$notices.show();
return false;
});
$('#group-filter a').click(function(){
// On réactive les auters filtres à tout
$('#role-filter a').removeClass('active');
$(".filterfgall").addClass('active');
// On rend actif la zone cliquée
$('#group-filter a').removeClass('active');
$(this).addClass('active');
// On cache l'ensemble des elements
$(".list-item").hide();
// On affiche les elements filtrés
if($(this).hasClass('filterfgall'))
var $notices = $('.list-item');
else
var $notices = $('.group-'+$(this).data('role'));
$notices.show();
return false;
});
} );
{% endblock %}

View File

@ -0,0 +1,43 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{% set color = app.session.get('color') %}
<br>
<p>
{% for notice in notices %}
<div class="panel panel-primary">
<div class="panel-heading" style="font-size:20px">
<i class="fa fa-info fa-fw"></i> {{ notice.title }}
</div>
<div class="panel-body">
{{ notice.description | raw }}
</div>
</div>
{% endfor %}
<form name="toread" method="post">
<input style="float:left; zoom:1.7;margin:5px 0px 0px 0px;" type="checkbox" id="readcharte" name="readcharte" value="0">
<span style="float:left; zoom: 1.7;margin-top: 3px;">Accepter la charte d'utilisation</span>
</form>
<br>
<a onClick="haveRead()" style="cursor:pointer; zoom:1.7; float: left;clear:both" class="btn btn-success">Valider</a>
</p>
{% endblock %}
{% block localjavascript %}
$('#readcharte').change(function(){
if($(this).val()=="0")
$(this).val(1);
else
$(this).val(0);
});
function haveRead() {
if($("#readcharte").val()=="1") {
document.location.href ="{{ path("cadoles_portal_user_notice_haveread") }}";
}
}
{% endblock %}

View File

@ -0,0 +1,31 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{% set color = app.session.get('color') %}
<br>
<p>
{% for notice in notices %}
<div class="panel panel-primary">
<div class="panel-heading" style="font-size:20px">
<i class="fa fa-info fa-fw"></i> {{ notice.title }}
</div>
<div class="panel-body">
{{ notice.description | raw }}
</div>
</div>
{% endfor %}
<div class="panel panel-primary">
<div class="panel-heading" style="font-size:20px">
<i class="fa fa-info fa-fw"></i> A propos
</div>
<div class="panel-body">
{% set version = app.session.get('version') %}
<b>version</b> = {{ version }}
</div>
</div>
</p>
{% endblock %}

View File

@ -14,8 +14,10 @@
<li id="menupage-{{page.id}}"><a style="cursor:pointer" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},{{ page.canupdate }})">{{ page.name }}</a></li>
{% endif %}
{% endfor %}
</ul>
{% for page in pagesuser %}
<ul id="pagesuser" class="nav navbar-top-links navbar-left">
{% for page in pagesuser %}
{% if entity.id is defined and page.id==entity.id %}
<li id="menupage-{{page.id}}" class="active" style="cursor:pointer"><a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},{{ page.canupdate }})">{{ page.name }}</a></li>
{% else %}
@ -24,11 +26,29 @@
{% endfor %}
</ul>
{% if pagesshared is not empty %}
<ul id="pagesshared" class="nav navbar-top-links navbar-left">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Partagés <span class="caret"></span></a>
<ul class="dropdown-menu">
{% for page in pagesshared %}
{% if entity.id is defined and page.id==entity.id %}
<li id="menupage-{{page.id}}" class="active" style="cursor:pointer"><a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},{{ page.canupdate }})">{{ page.name }}</a></li>
{% else %}
<li id="menupage-{{page.id}}"><a style="cursor:pointer" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},{{ page.canupdate }})">{{ page.name }}</a></li>
{% endif %}
{% endfor %}
</ul>
</li>
</ul>
{% endif %}
<div id="menupageaction">
{% if canadd %}
<a id="menusubmit" style="cursor:pointer" onclick="submitPage()" title='Ajouter une page'><i class='fa fa-plus fa-fw'></i></a>
{% endif %}
<a id="menuupdate" style="cursor:pointer;display:none" onclick="updatePage()" title='Modifier une page'><i class='fa fa-file fa-fw'></i></a>
<a id="menushare" style="cursor:pointer;display:none" onclick="sharePage()" title='Partager une page'><i class='fa fa-share-alt fa-fw'></i></a>
<a id="menudelete" style="cursor:pointer;display:none" onclick="deletePage()" title='Supprimer une page'><i class='fa fa-trash fa-fw'></i></a>
<a id="menuwidget" style='cursor:pointer;display:none' data-toggle='modal' data-target='#selwidget' title='Ajouter un widget'><i class='fa fa-cubes fa-fw'></i></a>
</div>
@ -101,7 +121,35 @@
{% if page.id==entity.id %}
showPage({{ page.id }}, {{ page.pagecategory.id }},{{ page.canupdate }});
{% endif %}
{% endfor %}
{% endfor %}
// Rendre les pages user déplacable
$("#pagesuser").sortable({
axis: "x",
forcePlaceholderSize: true,
placeholder: "li-placeholder",
update: function( event, ui ) {
$('#pagesuser li').each(function(order) {
var idpage=$(this).attr('id').replace("menupage-","");
$.ajax({
method: "POST",
url: "{{ path('cadoles_portal_'~access~'_page_order') }}",
data: {
id:idpage,
order:order
}
});
});
}
});
// Initialisation du tableau des widgets selectionnable à la création
$('#dataTables').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false }, { "targets": 0, "className": "text-center" } ],
responsive: true,
iDisplayLength: 10,
order: [[ 1, "asc" ]],
});
});
$(window).resize(function() {
@ -168,11 +216,13 @@
// Cacher les actions possibles sur la page
$("#menuupdate").hide();
$("#menushare").hide();
$("#menudelete").hide();
$("#menuwidget").hide();
if(canupdate) {
$("#menuupdate").show();
$("#menushare").show();
$("#menudelete").show();
}
@ -198,6 +248,15 @@
}
}
function sharePage() {
if($("#page-"+idpage).length) {
var url="{{ path('cadoles_portal_'~access~'_page_share',{id:'xx'}) }}";
url=url.replace('xx',idpage);
$(location).attr('href',url);
}
}
function deletePage() {
if($("#page-"+idpage).length) {
if (confirm('Êtes-vous sûr de vouloir supprimer ?')) {

View File

@ -0,0 +1,46 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1>
Partage Page
</h1>
<p>
{{ form_widget(form.submit) }}
{% if access=="config" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:entity.id}) }}">Annuler</a>
{% else %}
<a class="btn btn-default" href="{{ path('cadoles_core_home',{id:entity.id}) }}">Annuler</a>
{% endif %}
</p>
{% 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="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Informations
</div>
<div class="panel-body">
{{ form_row(form.groups) }}
</div>
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -162,6 +162,9 @@
// Mettre une taille mini de colonne sinon on ne pourra pas déplacer le widget dans la colonne
$(".colcontainer .col").css("min-height","100px");
// Cursor move sur les widgets header
$(".widgetheader").css("cursor","move");
// Rendre les widgets déplacable
$("#gridtemplate .col").sortable({
connectWith: "#gridtemplate .col",

View File

@ -1,3 +1,30 @@
{% macro libmonth(month) %}
{% if month==1 %} Janvier
{% elseif month==2 %} Février
{% elseif month==3 %} Mars
{% elseif month==4 %} Avril
{% elseif month==5 %} Mai
{% elseif month==6 %} Juin
{% elseif month==7 %} Juillet
{% elseif month==8 %} Août
{% elseif month==9 %} Septembre
{% elseif month==10 %} Octobre
{% elseif month==11 %} Novembre
{% elseif month==12 %} Décembre
{%endif%}
{% endmacro %}
{% macro libday(day) %}
{% if day==1 %} Lundi
{% elseif day==2 %} Mardi
{% elseif day==3 %} Mercredi
{% elseif day==4 %} Jeudi
{% elseif day==5 %} Vendredi
{% elseif day==6 %} Samedi
{% elseif day==7 %} Dimanche
{%endif%}
{% endmacro %}
{% macro mystylewidget(entity) %}
{% set color = app.session.get('color') %}

View File

@ -0,0 +1,68 @@
{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %}
{% set stylewidget = constants.mystylewidget(entity) %}
{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %}
{% set stylewidgetheader = constants.mystylewidgetheader(entity) %}
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
{% set color = app.session.get('color') %}
<style>
</style>
<div class="widget" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
<a href="{{ path("cadoles_portal_"~access~"_calendar_view") }}" style="{{ stylewidgetmenu }}" target="_top"><i class="fa fa-calendar fa-fw"></i></a>
</div>
<div class="widgetheader" style="{{ stylewidgetheader }}">
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
<span class="title">{{ entity.name }}</span>
</div>
{% set firstflux="" %}
<div class="widgetbody" style="{{ stylewidgetbody }}">
{% set monthsel = "" %}
{% for i in 0..(nbday-1) %}
{% set dateeventstart = 'now'|date_modify("+"~i~" day midnight") %}
{% set dateeventend = 'now'|date_modify("+"~(i+1)~" day midnight") %}
{% set fgaffday=false %}
{% for event in events %}
{% if event.start< dateeventend and event.end>=dateeventstart %}
{% if monthsel == "" or dateeventstart|date("Y-m")!=monthsel %}
{% set monthsel = dateeventstart|date("Y-m") %}
{% set libmonth = constants.libmonth(dateeventstart|date("m")) %}
<h3>{{ libmonth ~ " " ~ dateeventstart|date("Y") }}</h3>
{% endif %}
{% if not fgaffday %}
{% set fgaffday=true %}
{% set libday = constants.libday(dateeventstart|date("N")) %}
<div style="margin-top:15px; font-weight:bold; font-size:18px;">{{ libday ~ " " ~ dateeventstart|date("d/m/Y") }}</div>
{% endif %}
<div style="background-color:{{ event.color }}; color: #FFF; padding:2px;">
{% if not event.allDay %}
{{ event.start | date("H:i") }} -
{%endif%}
{{ event.title }}
</div>
{% endif %}
{% endfor %}
{% endfor %}
</div>
</div>

View File

@ -0,0 +1,22 @@
> Rendre l'alias paramétrage par genconfig
> Ne pas supprimer/modifier les icons système
> Annonces pouvant $etre masquées par les utilisateurs
> Cron à horaire fixe
> Pages admin : gérer la notion de propriétaire de la page
> Calendrier admin : gérer la notion de propriétaire de la page
> Pages duplicable
> Icone utilisateur
> Calendrier output / input
> Déplacement de widget vers une autre page du meme user
> Annonces dans pages spécifique
> upload image sur ckeditor
> widget ToDo
> widget Titre - Séparateur
> widget rss
> widget opened/closed
> Parametre canshare
> Parametre opentovisitor
> Theme

View File

@ -24,7 +24,7 @@ INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastna
TRUNCATE TABLE sidebar;
INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `fonticon`, `permission`, `appactivate`) VALUES
(1000, NULL, 1000, 'CONFIGIRATION', '', 'fa-gear', 'ROLE_ADMIN,ROLE_MODO', ''),
(1000, NULL, 1000, 'CONFIGURATION', '', 'fa-gear', 'ROLE_ADMIN', ''),
(1010, 1000, 1010, 'Générale', 'cadoles_core_config_commun', 'fa-table', 'ROLE_ADMIN', ''),
(1200, NULL, 1200, 'ORGANISATION', NULL, 'fa-sitemap', 'ROLE_ADMIN,ROLE_MODO', ''),
(1210, 1200, 1210, 'Listes Blanche', 'cadoles_core_config_whitelist', 'fa-tasks', 'ROLE_ADMIN', ''),
@ -40,7 +40,9 @@ INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `f
(1510, 1500, 1510, 'Pages', 'cadoles_portal_config_page', 'fa-file', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1520, 1500, 1520, 'Items', 'cadoles_portal_config_item', 'fa-desktop', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1530, 1500, 1530, 'Annonces', 'cadoles_portal_config_alert', 'fa-bell', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1540, 1500, 1540, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1540, 1500, 1540, 'Calendriers', 'cadoles_portal_config_calendar', 'fa-calendar', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1550, 1500, 1550, 'Chartes', 'cadoles_portal_config_notice', 'fa-info', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1560, 1500, 1560, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(7000, NULL, 7000, 'CRON', NULL, 'fa-bolt', 'ROLE_ADMIN', 'cron_activate'),