Compare commits
No commits in common. "75925d4969cfafde455f89a11c877ce4f98c6936" and "74c0a44f56151561703116e29403b7e8163aedbf" have entirely different histories.
75925d4969
...
74c0a44f56
|
@ -2,7 +2,6 @@
|
|||
/app/config/parameters.yml
|
||||
/app/config/template.yml
|
||||
/src/Cadoles/CoreBundle/Command/data/core-init-01.sql
|
||||
/src/Cadoles/CoreBundle/Command/LocalCommand.php
|
||||
/build/
|
||||
/phpunit.xml
|
||||
/var/*
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
<?php
|
||||
namespace Cadoles\CoreBundle\Command;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
|
||||
class LocalCommand extends Command
|
||||
{
|
||||
private $container;
|
||||
private $em;
|
||||
private $output;
|
||||
private $filesystem;
|
||||
private $rootlog;
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('Core:Local')
|
||||
->setDescription('Lauch Local Script')
|
||||
;
|
||||
}
|
||||
|
||||
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/";
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
|
@ -49,11 +49,6 @@ rm -f /var/www/html/ninegate/var/logs/dev.log
|
|||
# Copie des polices du projet dans le rep web
|
||||
cp -rf src/Cadoles/CoreBundle/Resources/public/fonts web/
|
||||
|
||||
# Copie de la commande local de base si elle la commande n'existe pas
|
||||
if [ ! -f src/Cadoles/CoreBundle/Command/LocalCommand.php ]; then
|
||||
cp -rf scripts/LocalCommand.php src/Cadoles/CoreBundle/Command/LocalCommand.php
|
||||
fi
|
||||
|
||||
# Nettoyage du cache
|
||||
echo
|
||||
echo CACHE = Refresh
|
||||
|
@ -71,9 +66,6 @@ php bin/console Portal:InitData --env=prod
|
|||
# Passage des scripts
|
||||
php bin/console Core:Script --env=prod
|
||||
|
||||
# Passage des scripts locaux
|
||||
php bin/console Core:Local --env=prod
|
||||
|
||||
# Generation des assets
|
||||
echo ASSET = Dump
|
||||
bin/console assetic:dump --env=prod --quiet
|
||||
|
|
|
@ -138,7 +138,6 @@ class InitDataCommand extends ContainerAwareCommand
|
|||
$usergroup->setUser($user);
|
||||
$usergroup->setGroup($group);
|
||||
$usergroup->setKeyvalue($key);
|
||||
$usergroup->setRolegroup(0);
|
||||
$em->persist($usergroup);
|
||||
$em->flush();
|
||||
$em->clear();
|
||||
|
|
|
@ -287,7 +287,7 @@ class OnlyCommand extends Command
|
|||
$this->em->flush();
|
||||
|
||||
// On ajoute le propriétaire en tant que membre du groupe
|
||||
$this->addMember($group,$user,100);
|
||||
$this->addMember($group,$user,true);
|
||||
|
||||
// On controle que le groupe a bien page / calendrier / blog / project
|
||||
$this->ctrlFgcanshare($group,$user,$pagetemplate);
|
||||
|
@ -318,7 +318,7 @@ class OnlyCommand extends Command
|
|||
// On s'assure qu'il n'es pas déjà rattaché
|
||||
$usergroup=$this->em->getRepository("CadolesCoreBundle:UserGroup")->findOneBy(["user"=>$user,"group"=>$group]);
|
||||
if(!$usergroup) {
|
||||
$this->addMember($group,$user,0);
|
||||
$this->addMember($group,$user,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -578,12 +578,12 @@ class OnlyCommand extends Command
|
|||
}
|
||||
|
||||
|
||||
private function addMember($group,$user,$role) {
|
||||
private function addMember($group,$user,$fgmanager) {
|
||||
$key = Uuid::uuid4();
|
||||
$usergroup=new UserGroup();
|
||||
$usergroup=new Usergroup;
|
||||
$usergroup->setUser($user);
|
||||
$usergroup->setGroup($group);
|
||||
$usergroup->setRolegroup($role);
|
||||
$usergroup->setFgmanager($fgmanager);
|
||||
$usergroup->setKeyvalue($key);
|
||||
$this->em->persist($usergroup);
|
||||
$this->em->flush();
|
||||
|
|
|
@ -239,7 +239,6 @@ class ScribeToNinegateCommand extends Command
|
|||
$member= new UserGroup();
|
||||
$member->setGroup($group);
|
||||
$member->setUser($user);
|
||||
$member->setRolegroup(0);
|
||||
|
||||
$this->em->persist($member);
|
||||
$this->em->flush();
|
||||
|
|
|
@ -132,18 +132,6 @@ class ScriptCommand extends Command
|
|||
}
|
||||
|
||||
|
||||
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"rolegroup"]);
|
||||
if(!$script) {
|
||||
$this->writelnred("== SCRIPT = rolegroup");
|
||||
$this->rolegroup();
|
||||
|
||||
$script=new Script();
|
||||
$script->setName("rolegroup");
|
||||
$this->em->persist($script);
|
||||
$this->em->flush();
|
||||
$this->writeln("");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -301,23 +289,7 @@ class ScriptCommand extends Command
|
|||
}
|
||||
}
|
||||
|
||||
private function rolegroup(){
|
||||
|
||||
$usergroups = $this->em->getRepository('CadolesCoreBundle:UserGroup')->findAll();
|
||||
foreach($usergroups as $usergroup) {
|
||||
if(!$usergroup->getRolegroup()) {
|
||||
$role=0;
|
||||
if($usergroup->getFgmanager()) {
|
||||
$role=50;
|
||||
if($usergroup->getUser()==$usergroup->getGroup()->getOwner()) $role=100;
|
||||
}
|
||||
|
||||
$usergroup->setRolegroup($role);
|
||||
$this->em->persist($usergroup);
|
||||
$this->em->flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -899,7 +899,6 @@ class SynchroCommand extends Command
|
|||
$member= new UserGroup();
|
||||
$member->setGroup($group);
|
||||
$member->setUser($user);
|
||||
$member->setRolegroup(0);
|
||||
}
|
||||
|
||||
// Si modèle scribe
|
||||
|
@ -908,7 +907,7 @@ class SynchroCommand extends Command
|
|||
if($ldap_template=="scribe"&&$scribe_master) {
|
||||
$ldapfilter="(|(&(uid=".$user->getUsername().")(ENTPersonProfils=enseignant))(&(uid=".$user->getUsername().")(typeadmin=0))(&(uid=".$user->getUsername().")(typeadmin=2)))";
|
||||
$results = $this->ldap->search($ldapfilter, ['uid'], $this->ldap_basedn);
|
||||
if($results) $member->setRolegroup(50);
|
||||
if($results) $member->setFgmanager(true);
|
||||
}
|
||||
|
||||
$this->em->persist($member);
|
||||
|
|
|
@ -720,9 +720,8 @@ class FileController extends Controller
|
|||
|
||||
// On s'assure que l'utilisateur à la permission de voir
|
||||
$page=$widget->getPage();
|
||||
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate,$canadd);
|
||||
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
|
||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
return $canadd;
|
||||
break;
|
||||
|
||||
case "projecttask":
|
||||
|
@ -735,7 +734,6 @@ class FileController extends Controller
|
|||
$user=$this->getUser();
|
||||
$em->getRepository("CadolesPortalBundle:Project")->getPermission($user,$project,$cansee,$canupdate,$canadd);
|
||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
return $canupdate;
|
||||
break;
|
||||
|
||||
case "calendarevent":
|
||||
|
@ -746,12 +744,13 @@ class FileController extends Controller
|
|||
// On s'assure que l'utilisateur à la permission de voir
|
||||
$calendar=$calendarevent->getCalendar();
|
||||
$user=$this->getUser();
|
||||
$em->getRepository("CadolesPortalBundle:Calendar")->getPermission($user,$calendar,$cansee,$canupdate,$canadd);
|
||||
$em->getRepository("CadolesPortalBundle:Calendar")->getPermission($user,$calendar,$cansee,$canupdate);
|
||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
return $canadd;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else $canupdate=true;
|
||||
|
||||
return $canupdate;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,19 +178,19 @@ class GroupController extends Controller
|
|||
$action.="<a href='".$this->generateUrl('cadoles_core_'.$access.'_group_statistic', array('id'=>$data->getId()))."'><i class='fa fa-chart-area fa-fw fa-2x'></i></a>";
|
||||
}
|
||||
else {
|
||||
$fgcanupdate=($user==$data->getOwner());
|
||||
$fgcanmanage=false;
|
||||
$fgproprio=($user==$data->getOwner());
|
||||
$fgmanager=false;
|
||||
$usergroup=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findOneBy(["user"=>$this->getUser(),"group"=>$data]);
|
||||
if($usergroup) $fgcanmanage=($usergroup->getRolegroup()>=90);
|
||||
if($usergroup) $fgmanager=$usergroup->getFgmanager();
|
||||
|
||||
// Modification possible uniquement si l'utilisateur est propriétaire du groupe
|
||||
if($fgcanupdate) {
|
||||
if($fgproprio) {
|
||||
$action .="<a href='".$this->generateUrl('cadoles_core_'.$access.'_group_update', array('id'=>$data->getId()))."'><i class='fa fa-file fa-2x fa-fw'></i></a>";
|
||||
$action .="<a href='".$this->generateUrl('cadoles_core_'.$access.'_group_delete', array('id'=>$data->getId()))."'><i class='fa fa-trash fa-2x fa-fw'></i></a>";
|
||||
}
|
||||
|
||||
// Gestion des utilisateurs du groupe uniquement pour le proprio ou les managers
|
||||
if($fgcanupdate||$fgcanmanage) {
|
||||
if($fgproprio||$fgmanager) {
|
||||
$action .="<a href='".$this->generateUrl('cadoles_core_'.$access.'_group_users', array('id'=>$data->getId()))."'><i class='fa fa-users fa-2x fa-fw'></i></a>";
|
||||
}
|
||||
else {
|
||||
|
@ -370,10 +370,12 @@ class GroupController extends Controller
|
|||
if($group->getLdapfilter()==""&&$group->getAttributes()=="")
|
||||
$action.="<a style='cursor:pointer' onClick='addUsers(".$data->getId().")'><i class='fa fa-plus fa-fw'></i></a>";
|
||||
|
||||
$fgmanager="<input type='checkbox' class='switch' onChange='switchManager(".$data->getId().");'>";
|
||||
|
||||
// Avatar
|
||||
$avatar="<img onClick='seeUser(".$data->getId().")' src='/".$this->container->getParameter('alias')."/uploads/avatar/".$data->getAvatar()."' style='width:30px;background-color:#337ab7;margin:auto;display:block;cursor:pointer;'>";
|
||||
|
||||
array_push($output["data"],array("DT_RowId"=>"user".$data->getId(),$action,$avatar,$data->getUsername(),$data->getEmail(),"",""));
|
||||
array_push($output["data"],array("DT_RowId"=>"user".$data->getId(),$action,$avatar,$data->getUsername(),$data->getEmail(),"",$fgmanager));
|
||||
}
|
||||
|
||||
// Retour
|
||||
|
@ -492,7 +494,6 @@ class GroupController extends Controller
|
|||
}
|
||||
|
||||
$datas=$qb->setFirstResult($start)->setMaxResults($length)->getQuery()->getResult();
|
||||
$user=$this->getUser();
|
||||
|
||||
foreach($datas as $data) {
|
||||
// Propriétaire
|
||||
|
@ -508,17 +509,13 @@ class GroupController extends Controller
|
|||
$avatar="<img onClick='seeUser(".$data->getId().")' src='/".$this->container->getParameter('alias')."/uploads/avatar/".$data->getAvatar()."' style='width:30px;background-color:#337ab7;margin:auto;display:block;cursor:pointer'>";
|
||||
|
||||
// Flag manager
|
||||
$rolegroup="";
|
||||
$fgmanager="";
|
||||
if($fgcanshare) {
|
||||
if($fgproprio) $rolegroup="Propriétaire du groupe";
|
||||
elseif($user==$usergroup->getUser()) $rolegroup="Gestionnaire";
|
||||
else {
|
||||
$selectuser=($usergroup->getRolegroup()==0?"selected='selected'":"");
|
||||
$selectwritter=($usergroup->getRolegroup()==50?"selected='selected'":"");
|
||||
$selectmanager=($usergroup->getRolegroup()==90?"selected='selected'":"");
|
||||
|
||||
$rolegroup='<select id="roleuser-'.$data->getId().'" name="user[visible]" onChange="changeRole('.$data->getId().');"><option value="0" '.$selectuser.'>Utilisateur</option><option value="50" '.$selectwritter.'>Collaborateur</option><option value="90" '.$selectmanager.'>Gestionnaire</option></select>';
|
||||
}
|
||||
|
||||
$checked=($usergroup->getFgmanager()?"checked":"");
|
||||
$fgmanager="<input type='checkbox' class='switch' onChange='switchManager(".$data->getId().");' $checked>";
|
||||
if($fgproprio) $fgmanager="Propriétaire du groupe";
|
||||
|
||||
}
|
||||
|
||||
// Visite
|
||||
|
@ -527,7 +524,7 @@ class GroupController extends Controller
|
|||
$visite=$usergroup->getVisitedate()->format("d/m/Y H:i")."<br>nb = ".$usergroup->getVisitecpt();
|
||||
}
|
||||
|
||||
array_push($output["data"],array("DT_RowId"=>"user".$data->getId(),$action,$avatar,$data->getUsername(),$data->getEmail(),$visite,$rolegroup));
|
||||
array_push($output["data"],array("DT_RowId"=>"user".$data->getId(),$action,$avatar,$data->getUsername(),$data->getEmail(),$visite,$fgmanager));
|
||||
}
|
||||
|
||||
// Retour
|
||||
|
@ -560,12 +557,11 @@ class GroupController extends Controller
|
|||
}
|
||||
|
||||
$key = Uuid::uuid4();
|
||||
$usergroup=new UserGroup();
|
||||
$usergroup=new Usergroup;
|
||||
$user=$em->getRepository("CadolesCoreBundle:User")->find($userid);
|
||||
$usergroup->setUser($user);
|
||||
$usergroup->setGroup($group);
|
||||
$usergroup->setKeyvalue($key);
|
||||
$usergroup->setRolegroup(0);
|
||||
$em->persist($usergroup);
|
||||
$em->flush();
|
||||
|
||||
|
@ -637,11 +633,10 @@ class GroupController extends Controller
|
|||
"body_html"=>nl2br($text),
|
||||
"body_text"=>$text
|
||||
);
|
||||
$usergroups=$em->getRepository("CadolesCoreBundle:Usergroup")->findBy(array("group"=>$groupid));
|
||||
$managers=$em->getRepository("CadolesCoreBundle:Usergroup")->findBy(array("group"=>$groupid,"fgmanager"=>true));
|
||||
$to=array();
|
||||
foreach($usergroups as $usergroup) {
|
||||
if($usergroup->getRolegroup()>=90)
|
||||
array_push($to,$usergroup->getUser()->getEmail());
|
||||
foreach($managers as $manager) {
|
||||
array_push($to,$manager->getUser()->getEmail());
|
||||
}
|
||||
|
||||
$from = $this->getParameter('noreply');;
|
||||
|
@ -683,11 +678,10 @@ class GroupController extends Controller
|
|||
"body_html"=>nl2br($text),
|
||||
"body_text"=>$text
|
||||
);
|
||||
$usergroups=$em->getRepository("CadolesCoreBundle:Usergroup")->findBy(array("group"=>$group));
|
||||
$managers=$em->getRepository("CadolesCoreBundle:Usergroup")->findBy(array("group"=>$group,"fgmanager"=>true));
|
||||
$to=array();
|
||||
foreach($usergroups as $usergroup) {
|
||||
if($usergroup->getRolegroup()>=90)
|
||||
array_push($to,$usergroup->getUser()->getEmail());
|
||||
foreach($managers as $manager) {
|
||||
array_push($to,$manager->getUser()->getEmail());
|
||||
}
|
||||
|
||||
$from = $this->getParameter('noreply');;
|
||||
|
@ -701,7 +695,7 @@ class GroupController extends Controller
|
|||
return $this->redirect($this->generateUrl("cadoles_core_user_group"));
|
||||
}
|
||||
|
||||
public function changeroleAction(Request $request,$access="config")
|
||||
public function switchmanagerAction(Request $request,$access="config")
|
||||
{
|
||||
// S'assurer que c'est un appel ajax
|
||||
if (!$request->isXmlHttpRequest()) {
|
||||
|
@ -713,13 +707,12 @@ class GroupController extends Controller
|
|||
$output=array();
|
||||
$userid=$request->request->get('user');
|
||||
$groupid=$request->request->get('group');
|
||||
$role=$request->request->get('role');
|
||||
|
||||
$group=$em->getRepository("CadolesCoreBundle:Group")->find($groupid);
|
||||
$this->canManager($group,$access);
|
||||
|
||||
$data = $em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(array("user"=>$userid,"group"=>$groupid));
|
||||
if($data) $data->setRolegroup($role);
|
||||
if($data) $data->setFgmanager(!$data->getFgmanager());
|
||||
|
||||
$em->persist($data);
|
||||
$em->flush();
|
||||
|
@ -1248,8 +1241,8 @@ class GroupController extends Controller
|
|||
protected function canManager($group,$access) {
|
||||
if($access!="config") {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$user=$em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(["group"=>$group,"user"=>$this->getUser()]);
|
||||
if(!$user||$user->getRolegroup()<90)
|
||||
$ismanager=$em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(["group"=>$group,"user"=>$this->getUser(),"fgmanager"=>true]);
|
||||
if(!$ismanager)
|
||||
throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
}
|
||||
|
@ -1265,27 +1258,19 @@ class GroupController extends Controller
|
|||
|
||||
protected function ctrlOwner($group) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
// Le propriétaire passe manager
|
||||
$usergroups=$em->getRepository("CadolesCoreBundle:Usergroup")->findBy(["group"=>$group,"rolegroup"=>"100"]);
|
||||
foreach($usergroups as $usergroup) {
|
||||
$usergroup->setRolegroup(90);
|
||||
$em->persist($usergroup);
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
// Le propriétaire prend son role dans le groupe
|
||||
if($group->getOwner()) {
|
||||
$usergroup=$em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(["group"=>$group,"user"=>$group->getOwner()]);
|
||||
if(!$usergroup) {
|
||||
$key = Uuid::uuid4();
|
||||
$usergroup=new UserGroup();
|
||||
$usergroup=new Usergroup;
|
||||
$usergroup->setUser($group->getOwner());
|
||||
$usergroup->setGroup($group);
|
||||
$usergroup->setKeyvalue($key);
|
||||
}
|
||||
$usergroup->setRolegroup(100);
|
||||
$usergroup->setFgmanager(true);
|
||||
$em->persist($usergroup);
|
||||
$em->flush();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -544,12 +544,11 @@ class RegistrationController extends Controller
|
|||
$group=$em->getRepository("CadolesCoreBundle:Group")->find($groupid);
|
||||
if($group) {
|
||||
$key = Uuid::uuid4();
|
||||
$usergroup=new UserGroup();
|
||||
$usergroup=new Usergroup;
|
||||
$user=$em->getRepository("CadolesCoreBundle:User")->find($userid);
|
||||
$usergroup->setUser($user);
|
||||
$usergroup->setGroup($group);
|
||||
$usergroup->setKeyvalue($key);
|
||||
$usergroup->setRolegroup(0);
|
||||
$em->persist($usergroup);
|
||||
$em->flush();
|
||||
|
||||
|
|
|
@ -419,7 +419,6 @@ class UserController extends Controller
|
|||
$datagroup = $group;
|
||||
$usergroup->setGroup($datagroup);
|
||||
$usergroup->setKeyvalue($key);
|
||||
$usergroup->setRolegroup(0);
|
||||
$em->persist($usergroup);
|
||||
$em->flush();
|
||||
}
|
||||
|
@ -570,7 +569,6 @@ class UserController extends Controller
|
|||
$datagroup = $group;
|
||||
$usergroup->setGroup($datagroup);
|
||||
$usergroup->setKeyvalue($key);
|
||||
$usergroup->setRolegroup(0);
|
||||
$em->persist($usergroup);
|
||||
$em->flush();
|
||||
}
|
||||
|
@ -631,14 +629,12 @@ class UserController extends Controller
|
|||
"body_html"=>nl2br($text),
|
||||
"body_text"=>$text
|
||||
);
|
||||
$usergroups=$em->getRepository("CadolesCoreBundle:Usergroup")->findBy(array("group"=>$group));
|
||||
$managers=$em->getRepository("CadolesCoreBundle:Usergroup")->findBy(array("group"=>$group,"fgmanager"=>true));
|
||||
$to=array();
|
||||
foreach($usergroups as $usergroup) {
|
||||
if($usergroup->getRolegroup()>=90)
|
||||
array_push($to,$usergroup->getUser()->getEmail());
|
||||
foreach($managers as $manager) {
|
||||
array_push($to,$manager->getUser()->getEmail());
|
||||
}
|
||||
|
||||
|
||||
$from = $this->getParameter('noreply');;
|
||||
$fromName = $this->get('session')->get('appname');
|
||||
$message = $this->container->get('cadoles.core.service.mail');
|
||||
|
|
|
@ -37,15 +37,9 @@ class UserGroup
|
|||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", options={"default" : false})
|
||||
* CE CHAMP N'EST PLUS UTILSE
|
||||
*/
|
||||
private $fgmanager = false;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer", length=60, nullable=true)
|
||||
*/
|
||||
private $rolegroup;
|
||||
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=60, nullable=true)
|
||||
*/
|
||||
|
@ -214,28 +208,4 @@ class UserGroup
|
|||
{
|
||||
return $this->visitecpt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set rolegroup
|
||||
*
|
||||
* @param integer $rolegroup
|
||||
*
|
||||
* @return UserGroup
|
||||
*/
|
||||
public function setRolegroup($rolegroup)
|
||||
{
|
||||
$this->rolegroup = $rolegroup;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get rolegroup
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getRolegroup()
|
||||
{
|
||||
return $this->rolegroup;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -181,7 +181,6 @@ class syncUser implements EventSubscriber
|
|||
$data->setUser($user);
|
||||
$data->setGroup($fgall[0]);
|
||||
$data->setKeyvalue($key);
|
||||
$data->setRolegroup(0);
|
||||
$this->em->persist($data);
|
||||
$this->em->flush();
|
||||
}
|
||||
|
|
|
@ -63,7 +63,6 @@ class GroupRepository extends \Doctrine\ORM\EntityRepository
|
|||
$usergroup->setUser($user);
|
||||
$usergroup->setGroup($retgroup);
|
||||
$usergroup->setKeyvalue($key);
|
||||
$usergroup->setRolegroup(0);
|
||||
|
||||
$this->_em->persist($usergroup);
|
||||
$this->_em->flush();
|
||||
|
|
|
@ -494,9 +494,9 @@ cadoles_core_config_group_ajax_usergroup_del:
|
|||
path: /config/group/ajax/usergroupdel
|
||||
defaults: { _controller: CadolesCoreBundle:Group:usergroupdel, access: config }
|
||||
|
||||
cadoles_core_config_group_ajax_changerole:
|
||||
path: /config/group/ajax/changerole
|
||||
defaults: { _controller: CadolesCoreBundle:Group:changerole, access: config }
|
||||
cadoles_core_config_group_ajax_switchmanager:
|
||||
path: /config/group/ajax/switchmanager
|
||||
defaults: { _controller: CadolesCoreBundle:Group:switchmanager, access: config }
|
||||
|
||||
cadoles_core_config_group_export:
|
||||
path: /config/group/export
|
||||
|
@ -559,9 +559,9 @@ cadoles_core_user_group_ajax_usergroup_del:
|
|||
path: /user/group/ajax/usergroupdel
|
||||
defaults: { _controller: CadolesCoreBundle:Group:usergroupdel, access: user }
|
||||
|
||||
cadoles_core_user_group_ajax_changerole:
|
||||
path: /user/group/ajax/changerole
|
||||
defaults: { _controller: CadolesCoreBundle:Group:changerole, access: user }
|
||||
cadoles_core_user_group_ajax_switchmanager:
|
||||
path: /user/group/ajax/switchmanager
|
||||
defaults: { _controller: CadolesCoreBundle:Group:switchmanager, access: user }
|
||||
|
||||
cadoles_core_user_group_usergroup_export:
|
||||
path: /user/group/users/export/{id}
|
||||
|
|
|
@ -9,15 +9,10 @@
|
|||
<a class="btn btn-default" href={{ path('cadoles_core_home',{'id':idreturn}) }}>Fermer</a>
|
||||
{% endif %}
|
||||
|
||||
{% if moderegistration!="none" and masteridentity=="SQL" and group.fgcanshare %}
|
||||
{% if moderegistration!="none" and masteridentity=="SQL"%}
|
||||
<a class="btn btn-primary" style="cursor:pointer" onClick="showMail();">Inviter des personnes non listées ci-dessous</a>
|
||||
<a class="btn btn-primary" style="cursor:pointer" onClick="showInvitations();">Suivi des Invitations</a>
|
||||
{%endif%}
|
||||
|
||||
{% if group.fgcanshare %}
|
||||
<button class="btn btn-default pull-right" style="margin-left:10px" data-toggle="modal" data-target="#modalperm">Matrice des permissions</button>
|
||||
{%endif%}
|
||||
|
||||
<a class="btn btn-default pull-right" href={{ path('cadoles_core_'~access~'_group_usergroup_export',{'id':group.id}) }}>Exporter CSV</a>
|
||||
<br><br>
|
||||
|
||||
|
@ -75,333 +70,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="modalperm" class="modal fade bs-item-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">MATRICE DES PERMISSIONS</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<div class="dataTable_wrapper">
|
||||
<table class="table table-striped table-bordered table-hover" id="dataTablesnotin" style="width:100%; text-align:center; zoom:80%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Permissions</th>
|
||||
<th>Propriétaire</th>
|
||||
<th>Gestionnaire</th>
|
||||
<th>Collaborateur</th>
|
||||
<th>Utilisateur</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="5" style="font-weight: bold;">GROUPE</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Modifier le groupe</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Supprimer le groupe</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Changer le propriétaire du groupe</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Affecter des utilisateurs au groupe</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Désaffecter des utilisateurs au groupe</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Inviter des utilisateurs dans le groupe</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Visualiser les statistiques du groupe</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">S’inscrire par soit même sur les groupes ouverts</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Se désinscrire par soit même </td>
|
||||
<td></td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5" style="font-weight: bold;">PAGE</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Créer / Modifier / Supprimer / Partager des Pages sur le groupe</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Placer en favoris une page du groupe</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5" style="font-weight: bold;">WIDGET</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Widget Favoris = Ajouter / Modifier / Supprimer Lien</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Widget Fichier = Ajouter / Modifier / Supprimer Fichiers</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Widget Lien = Modifier Lien</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Widget Editeur = Modifier Texte</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Widget Carrousel = Créer / Modifier / Supprimer Image</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Widget Gallerie Images = Créer / Modifier / Supprimer Image</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Widget Chat = Ajouter commentaires</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Widget Chat = Modifier / Supprimer Commentaires des membres du groupe</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Widget Chat = Masquer Commentaires des membres du groupe</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5" style="font-weight: bold;">BLOG</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Créer / Modifier / Supprimer / Partager un blog sur le groupe</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Créer des articles sur les blogs du groupe</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Modifier / Supprimer ses articles sur les blogs du groupe</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Modifier / Supprimer des articles de blog des autres membres du groupe</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Ajouter des commentaires sur les articles du blog</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Modifier / Supprimer ses propres commentaires</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Modifier / Supprimer les commentaires des autres membre du groupe de ses articles</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Modifier / Supprimer les commentaires des autres membre du groupe sur l'ensemble du blog</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5" style="font-weight: bold;">PROJET</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Créer / Modifier / Supprimer / Partager des projets sur le groupe</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Créer des taches sur les projets du groupe</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Modifier / Supprimer ses propres tâches</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Affecter des tâches aux autres membres du groupe</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Modifier / Supprimer des Tâches à des autres membres du groupe</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Ajouter des commentaires sur les tâches</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Modifier / Supprimer ses propres commentaires de tâches</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Modifier / Supprimer les commentaires des autres membre du groupe de ses taches</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Modifier / Supprimer les commentaires des taches sur l'ensemble du projet</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5" style="font-weight: bold;">CALENDRIER</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Créer / Modifier / Supprimer / Partager un calendrier sur le groupe</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Créer des évènements sur les calendriers du groupe</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Créer / Modifier / Supprimer / Partager des évènements sur les calendriers du groupe</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td>x</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block localjavascript %}
|
||||
|
@ -484,17 +152,15 @@
|
|||
});
|
||||
}
|
||||
|
||||
function changeRole(id) {
|
||||
function switchManager(id) {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "{{ path('cadoles_core_'~access~'_group_ajax_changerole') }}",
|
||||
url: "{{ path('cadoles_core_'~access~'_group_ajax_switchmanager') }}",
|
||||
data: {
|
||||
"group": {{ group.id }},
|
||||
"user": id,
|
||||
"role": $("#roleuser-"+id).val(),
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function showMail() {
|
||||
|
|
|
@ -106,7 +106,6 @@ class BlogarticleController extends Controller
|
|||
if($access=="user") {
|
||||
$em->getRepository("CadolesPortalBundle:Blog")->getPermission($this->getUser(),$entity->getBlog(),$cansee,$canupdate,$canadd);
|
||||
if(!$canadd) throw $this->createNotFoundException('Permission denied');
|
||||
elseif(!$canupdate&&$this->getUser()!=$entity->getUser()) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
// Création du formulaire
|
||||
|
@ -158,7 +157,6 @@ class BlogarticleController extends Controller
|
|||
if($access=="user") {
|
||||
$em->getRepository("CadolesPortalBundle:Blog")->getPermission($this->getUser(),$entity->getBlog(),$cansee,$canupdate,$canadd);
|
||||
if(!$canadd) throw $this->createNotFoundException('Permission denied');
|
||||
elseif(!$canupdate&&$this->getUser()!=$entity->getUser()) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
// Suppression
|
||||
|
@ -210,10 +208,12 @@ class BlogarticleController extends Controller
|
|||
}
|
||||
else {
|
||||
$em->getRepository("CadolesPortalBundle:Blog")->getPermission($user,$entity->getBlog(),$cansee,$canupdate,$canadd);
|
||||
if(!$canupdate&&$this->getUser()==$entity->getUser()) $canupdate=true;
|
||||
}
|
||||
|
||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
|
||||
$canupdate=false;
|
||||
if($user) $canupdate=true;
|
||||
}
|
||||
|
||||
$em->getRepository("CadolesPortalBundle:Blogarticle")->getBlogsArticles($blogs,0,10,$count,$blogarticles);
|
||||
|
|
|
@ -145,8 +145,7 @@ class BlogcommentController extends Controller
|
|||
// On s'assure que l'utilisateur à la permission de modifier
|
||||
if($access=="user") {
|
||||
$em->getRepository("CadolesPortalBundle:Blog")->getPermission($this->getUser(),$entity->getBlogarticle()->getBlog(),$cansee,$canupdate,$canadd);
|
||||
if(!$canupdate&&$this->getUser()==$entity->getBlogarticle()->getUser()) $canupdate=true;
|
||||
if(!$canupdate&&$this->getUser()!=$entity->getUser()) throw $this->createNotFoundException('Permission denied');
|
||||
if(!$canadd&&$this->getUser()!=$entity->getUser()) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
// Création du formulaire
|
||||
|
@ -197,7 +196,7 @@ class BlogcommentController extends Controller
|
|||
// On s'assure que l'utilisateur à la permission de supprimer
|
||||
if($access=="user") {
|
||||
$em->getRepository("CadolesPortalBundle:Blog")->getPermission($this->getUser(),$entity->getBlogarticle()->getBlog(),$cansee,$canupdate,$canadd);
|
||||
if(!$canupdate&&$this->getUser()!=$entity->getUser()) throw $this->createNotFoundException('Permission denied');
|
||||
if(!$canadd&&$this->getUser()!=$entity->getUser()) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
// Suppression
|
||||
|
|
|
@ -35,19 +35,6 @@ class BookmarkController extends Controller
|
|||
if (!$pagewidget) throw $this->createNotFoundException('Unable to find entity.');
|
||||
}
|
||||
|
||||
// Vérifier que cet enregistrement est modifiable
|
||||
if($access=="user") {
|
||||
if($usage=="user") {
|
||||
$user=$pagewidget->getPage()->getUser();
|
||||
if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
else {
|
||||
$groupentity=$this->getDoctrine()->getRepository("CadolesCoreBundle:Group")->find($group);
|
||||
$usergroup=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["user"=>$this->getUser(),"group"=>$groupentity]);
|
||||
if(!$usergroup or $usergroup->getRolegroup()<50) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
}
|
||||
|
||||
// Création du formulaire
|
||||
$form = $this->createForm(BookmarkType::class,$data,array("mode"=>"submit"));
|
||||
|
||||
|
@ -136,8 +123,8 @@ class BookmarkController extends Controller
|
|||
}
|
||||
else {
|
||||
$groupentity=$this->getDoctrine()->getRepository("CadolesCoreBundle:Group")->find($group);
|
||||
$usergroup=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["user"=>$this->getUser(),"group"=>$groupentity]);
|
||||
if(!$usergroup or $usergroup->getRolegroup()<50) throw $this->createNotFoundException('Permission denied');
|
||||
$fgmanager=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["user"=>$this->getUser(),"group"=>$groupentity,"fgmanager"=>true]);
|
||||
if(!$fgmanager) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,8 +214,8 @@ class BookmarkController extends Controller
|
|||
}
|
||||
else {
|
||||
$groupentity=$this->getDoctrine()->getRepository("CadolesCoreBundle:Group")->find($group);
|
||||
$usergroup=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["user"=>$this->getUser(),"group"=>$groupentity]);
|
||||
if(!$usergroup or $usergroup->getRolegroup()<50) throw $this->createNotFoundException('Permission denied');
|
||||
$fgmanager=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["user"=>$this->getUser(),"group"=>$groupentity,"fgmanager"=>true]);
|
||||
if(!$fgmanager) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ class CalendarController extends Controller
|
|||
|
||||
// On s'assure que l'utilisateur à la permission de modifier
|
||||
if($access=="user") {
|
||||
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate,$canadd);
|
||||
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate);
|
||||
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
$oldpassword=$entity->getPasswordDecrypt();
|
||||
|
@ -272,7 +272,7 @@ class CalendarController extends Controller
|
|||
|
||||
// On s'assure que l'utilisateur à la permission de modifier
|
||||
if($access=="user") {
|
||||
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate,$canadd);
|
||||
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate);
|
||||
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,7 @@ class CalendarController extends Controller
|
|||
|
||||
// On s'assure que l'utilisateur à la permission de supprimer
|
||||
if($access=="user") {
|
||||
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate,$canadd);
|
||||
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate);
|
||||
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
|
@ -369,7 +369,6 @@ class CalendarController extends Controller
|
|||
$calendar->setType(0);
|
||||
$calendar->setUser($user);
|
||||
$calendar->setCanupdate(true);
|
||||
$calendar->setCanadd(true);
|
||||
$key = Uuid::uuid4();
|
||||
$calendar->setKeyvalue($key);
|
||||
$em->persist($calendar);
|
||||
|
|
|
@ -40,10 +40,9 @@ class CalendareventController extends Controller
|
|||
if($access=="config")
|
||||
$calendar->setCanupdate(true);
|
||||
else {
|
||||
$this->getDoctrine()->getRepository("CadolesPortalBundle:Calendar")->getPermission($this->getUser(),$calendar,$cansee,$canupdate,$canadd);
|
||||
$this->getDoctrine()->getRepository("CadolesPortalBundle:Calendar")->getPermission($this->getUser(),$calendar,$cansee,$canupdate);
|
||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
$calendar->setCanupdate($canupdate);
|
||||
$calendar->setCanadd($canadd);
|
||||
}
|
||||
|
||||
$calendars=[$calendar];
|
||||
|
@ -68,7 +67,7 @@ class CalendareventController extends Controller
|
|||
$tmp['color'] = "#".(is_null($calendar->getColor())?$this->get('session')->get('color')["main"]:$calendar->getColor());
|
||||
$tmp['allDay'] = $calendarevent->getAllday();
|
||||
$tmp['calendar'] = $calendar->getId();
|
||||
$tmp['editable'] = $calendarevent->getCalendar()->getCanadd();
|
||||
$tmp['editable'] = $calendarevent->getCalendar()->getCanupdate();
|
||||
$tmp['files'] = $this->loadpj($tmp['id'] );
|
||||
|
||||
array_push($events,$tmp);
|
||||
|
@ -155,8 +154,8 @@ class CalendareventController extends Controller
|
|||
|
||||
// On s'assure que l'utilisateur à la permission de supprimer
|
||||
if($access=="user") {
|
||||
$em->getRepository("CadolesPortalBundle:Calendar")->getPermission($this->getUser(),$calendar,$cansee,$canupdate,$canadd);
|
||||
if(!$canadd) throw $this->createNotFoundException('Permission denied');
|
||||
$em->getRepository("CadolesPortalBundle:Calendar")->getPermission($this->getUser(),$calendar,$cansee,$canupdate);
|
||||
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
$calendarevent=new Calendarevent();
|
||||
|
@ -209,8 +208,8 @@ class CalendareventController extends Controller
|
|||
|
||||
// On s'assure que l'utilisateur à la permission
|
||||
if($access=="user") {
|
||||
$em->getRepository("CadolesPortalBundle:Calendar")->getPermission($this->getUser(),$calendar,$cansee,$canupdate,$canadd);
|
||||
if(!$canadd) throw $this->createNotFoundException('Permission denied');
|
||||
$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);
|
||||
|
@ -267,8 +266,8 @@ class CalendareventController extends Controller
|
|||
|
||||
// On s'assure que l'utilisateur à la permission
|
||||
if($access=="user") {
|
||||
$em->getRepository("CadolesPortalBundle:Calendar")->getPermission($this->getUser(),$calendar,$cansee,$canupdate,$canadd);
|
||||
if(!$canadd) throw $this->createNotFoundException('Permission denied');
|
||||
$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);
|
||||
|
@ -292,8 +291,8 @@ class CalendareventController extends Controller
|
|||
|
||||
// On s'assure que l'utilisateur à la permission de modifier
|
||||
if($access=="user") {
|
||||
$em->getRepository("CadolesPortalBundle:Calendar")->getPermission($this->getUser(),$calendar,$cansee,$canupdate,$canadd);
|
||||
if(!$canadd) throw $this->createNotFoundException('Permission denied');
|
||||
$em->getRepository("CadolesPortalBundle:Calendar")->getPermission($this->getUser(),$calendar,$cansee,$canupdate);
|
||||
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
// Création du formulaire
|
||||
|
@ -330,8 +329,8 @@ class CalendareventController extends Controller
|
|||
|
||||
// On s'assure que l'utilisateur à la permission
|
||||
if($access=="user") {
|
||||
$em->getRepository("CadolesPortalBundle:Calendar")->getPermission($this->getUser(),$calendar,$cansee,$canupdate,$canadd);
|
||||
if(!$canadd) throw $this->createNotFoundException('Permission denied');
|
||||
$em->getRepository("CadolesPortalBundle:Calendar")->getPermission($this->getUser(),$calendar,$cansee,$canupdate);
|
||||
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
$files = $this->loadpj($id);
|
||||
|
|
|
@ -286,7 +286,7 @@ class PageController extends Controller
|
|||
|
||||
// On s'assure que l'utilisateur à la permission de modifier
|
||||
if($access=="user") {
|
||||
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate,$canadd);
|
||||
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate);
|
||||
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
|
@ -369,7 +369,7 @@ class PageController extends Controller
|
|||
|
||||
// On s'assure que l'utilisateur à la permission de modifier
|
||||
if($access=="user") {
|
||||
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate,$canadd);
|
||||
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate);
|
||||
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
|
@ -408,7 +408,7 @@ class PageController extends Controller
|
|||
|
||||
// On s'assure que l'utilisateur à la permission de supprimer
|
||||
if($access=="user") {
|
||||
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate,$canadd);
|
||||
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate);
|
||||
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
|
@ -438,7 +438,7 @@ class PageController extends Controller
|
|||
|
||||
// On s'assure que l'utilisateur à la permission
|
||||
if($access=="user") {
|
||||
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate,$canadd);
|
||||
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate);
|
||||
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
|
@ -474,7 +474,7 @@ class PageController extends Controller
|
|||
}
|
||||
else {
|
||||
// On s'assure que l'utilisateur à la permission de voir
|
||||
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate,$canadd);
|
||||
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate);
|
||||
if(!$cansee) {
|
||||
return $this->render('CadolesCoreBundle:Core:reconnect.html.twig', [
|
||||
'useheader' => false,
|
||||
|
|
|
@ -30,15 +30,14 @@ class PagewidgetController extends Controller
|
|||
private $access;
|
||||
private $look;
|
||||
private $mini;
|
||||
private $selwidget;
|
||||
private $usage;
|
||||
private $group;
|
||||
private $selwidget;
|
||||
|
||||
private $cansee;
|
||||
private $canupdate;
|
||||
private $canudate;
|
||||
private $canadd;
|
||||
|
||||
private function searchArray($array, $key, $value) {
|
||||
private function searchArray($array, $key, $value)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
if (is_array($array))
|
||||
|
@ -53,7 +52,8 @@ class PagewidgetController extends Controller
|
|||
return $results;
|
||||
}
|
||||
|
||||
private function entityForm(Pagewidget $entity,$idpage,$id,$access="config",$by="view") {
|
||||
private function entityForm(Pagewidget $entity,$idpage,$id,$access="config",$by="view")
|
||||
{
|
||||
if ($this->getDoctrine()->getManager()->contains($entity)) {
|
||||
$widgettype= $this->getDoctrine()->getManager()->getRepository("CadolesPortalBundle:Pagewidget")->find($id)->getWidget();
|
||||
$params = $widgettype->getParameter();
|
||||
|
@ -97,7 +97,8 @@ class PagewidgetController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
public function submitAction(Request $request,$idpage,$idwidgettype,$access="config") {
|
||||
public function submitAction(Request $request,$idpage,$idwidgettype,$access="config")
|
||||
{
|
||||
$by=$request->query->get('by');
|
||||
$entity = new Pagewidget();
|
||||
$form = $this->entityForm($entity,$idpage,$idwidgettype,$access,$by);
|
||||
|
@ -189,7 +190,8 @@ class PagewidgetController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
public function updateAction(Request $request,$idpage,$idwidget,$access="config") {
|
||||
public function updateAction(Request $request,$idpage,$idwidget,$access="config")
|
||||
{
|
||||
$by=$request->query->get('by');
|
||||
$usage=$request->query->get('usage');
|
||||
$group=$request->query->get('group');
|
||||
|
@ -201,7 +203,7 @@ class PagewidgetController extends Controller
|
|||
|
||||
// On s'assure que l'utilisateur à la permission de modifier
|
||||
if($access=="user") {
|
||||
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$entity->getPage(),$cansee,$canupdate,$canadd);
|
||||
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$entity->getPage(),$cansee,$canupdate);
|
||||
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
|
@ -271,7 +273,8 @@ class PagewidgetController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
public function deleteAction(Request $request,$access="config") {
|
||||
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);
|
||||
|
||||
|
@ -286,7 +289,7 @@ class PagewidgetController extends Controller
|
|||
|
||||
// On s'assure que l'utilisateur à la permission de supprimer
|
||||
if($access=="user") {
|
||||
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$entity->getPage(),$cansee,$canupdate,$canadd);
|
||||
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$entity->getPage(),$cansee,$canupdate);
|
||||
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
|
@ -312,7 +315,8 @@ class PagewidgetController extends Controller
|
|||
return $response;
|
||||
}
|
||||
|
||||
public function orderAction(Request $request) {
|
||||
public function orderAction(Request $request)
|
||||
{
|
||||
// S'assurer que c'est un appel ajax
|
||||
if (!$request->isXmlHttpRequest()) return new JsonResponse(array('message' => 'Interdit'), 400);
|
||||
|
||||
|
@ -363,6 +367,7 @@ class PagewidgetController extends Controller
|
|||
|
||||
}
|
||||
|
||||
|
||||
protected function getErrorForm($id,$form,$request,$idwidgettype,$page,$data,$mode) {
|
||||
if ($form->get('submit')->isClicked()&&$mode=="delete") {
|
||||
|
||||
|
@ -400,9 +405,7 @@ class PagewidgetController extends Controller
|
|||
$this->access = $access;
|
||||
$this->look = $request->query->get('look');
|
||||
$this->selwidget = $request->query->get('selwidget');
|
||||
$this->usage = $request->query->get('usage');
|
||||
$this->group = $request->query->get('group');
|
||||
|
||||
|
||||
// Le widget existe-t-il ?
|
||||
$this->entity = $this->em->getRepository($this->labelentity)->find($this->id);
|
||||
if (!$this->entity) throw $this->createNotFoundException('Unable to find entity.');
|
||||
|
@ -414,7 +417,7 @@ class PagewidgetController extends Controller
|
|||
else {
|
||||
// On s'assure que l'utilisateur à la permission de voir
|
||||
$this->page=$this->entity->getPage();
|
||||
$this->em->getRepository("CadolesPortalBundle:Page")->getPermission($this->user,$this->page,$this->cansee,$this->canupdate,$this->canadd);
|
||||
$this->em->getRepository("CadolesPortalBundle:Page")->getPermission($this->user,$this->page,$this->cansee,$this->canupdate);
|
||||
if(!$this->cansee) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
|
@ -684,6 +687,7 @@ class PagewidgetController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
|
||||
public function viewfluxAction(Request $request,$id,$access="config") {
|
||||
// Récupération de la requete
|
||||
$this->setRequest($request,$id,$access);
|
||||
|
@ -890,6 +894,7 @@ class PagewidgetController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
|
||||
public function viewrssAction(Request $request,$id,$access="config") {
|
||||
// Récupération de la requete
|
||||
$this->setRequest($request,$id,$access);
|
||||
|
@ -1110,20 +1115,34 @@ class PagewidgetController extends Controller
|
|||
|
||||
// Render
|
||||
return $this->getRender('viewbookmark.html.twig', [
|
||||
'canadd' => $this->canadd,
|
||||
'modedesktop' => $modedesktop,
|
||||
'bookmarks' => $bookmarks,
|
||||
]);
|
||||
}
|
||||
|
||||
public function viewlinkAction(Request $request,$id,$access="config") {
|
||||
// Récupération de la requete
|
||||
$this->setRequest($request,$id,$access);
|
||||
$look=$request->query->get('look');
|
||||
$selwidget=$request->query->get('selwidget');
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$entity = $em->getRepository($this->labelentity)->find($id);
|
||||
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
|
||||
|
||||
// Permissions
|
||||
if($access=="config") {
|
||||
$canupdate = true;
|
||||
}
|
||||
else {
|
||||
// On s'assure que l'utilisateur à la permission de voir
|
||||
$page=$entity->getPage();
|
||||
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
|
||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
// Récupération des paramétres du widget
|
||||
$url="";
|
||||
$target="_blank";
|
||||
foreach($this->entity->getParameter()["fields"] as $parameter) {
|
||||
foreach($entity->getParameter()["fields"] as $parameter) {
|
||||
switch($parameter["id"]) {
|
||||
case "url":
|
||||
$url=$parameter["value"];
|
||||
|
@ -1134,21 +1153,44 @@ class PagewidgetController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
// Préference utilisateur
|
||||
$this->getPreference($entity);
|
||||
|
||||
// Render
|
||||
return $this->getRender('viewlink.html.twig', [
|
||||
return $this->render($this->labelentity.':viewlink.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => false,
|
||||
'canupdate' => $canupdate,
|
||||
'url' => $url,
|
||||
'target' => $target,
|
||||
'access' => $access,
|
||||
'look' => $look,
|
||||
'mini' => ($look=="list"&&$entity->getId()!=$selwidget),
|
||||
]);
|
||||
}
|
||||
|
||||
public function vieweditorAction(Request $request,$id,$access="config") {
|
||||
// Récupération de la requete
|
||||
$this->setRequest($request,$id,$access);
|
||||
$look=$request->query->get('look');
|
||||
$selwidget=$request->query->get('selwidget');
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$entity = $em->getRepository($this->labelentity)->find($id);
|
||||
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
|
||||
|
||||
// Permissions
|
||||
if($access=="config") {
|
||||
$canupdate = true;
|
||||
}
|
||||
else {
|
||||
// On s'assure que l'utilisateur à la permission de voir
|
||||
$page=$entity->getPage();
|
||||
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
|
||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
// Récupération des paramétres du widget
|
||||
$html="";
|
||||
foreach($this->entity->getParameter()["fields"] as $parameter) {
|
||||
foreach($entity->getParameter()["fields"] as $parameter) {
|
||||
switch($parameter["id"]) {
|
||||
case "html":
|
||||
$html=$parameter["value"];
|
||||
|
@ -1157,45 +1199,91 @@ class PagewidgetController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
// Préference utilisateur
|
||||
$this->getPreference($entity);
|
||||
|
||||
// Render
|
||||
return $this->getRender('vieweditor.html.twig', [
|
||||
return $this->render($this->labelentity.':vieweditor.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => false,
|
||||
'canupdate' => $canupdate,
|
||||
'html' => $html,
|
||||
'access' => $access,
|
||||
'look' => $look,
|
||||
'mini' => ($look=="list"&&$entity->getId()!=$selwidget),
|
||||
]);
|
||||
}
|
||||
|
||||
public function viewslideAction(Request $request,$id,$access="config") {
|
||||
// Récupération de la requete
|
||||
$this->setRequest($request,$id,$access);
|
||||
$look=$request->query->get('look');
|
||||
$selwidget=$request->query->get('selwidget');
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$entity = $em->getRepository($this->labelentity)->find($id);
|
||||
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
|
||||
|
||||
// Permissions
|
||||
if($access=="config") {
|
||||
$canupdate = true;
|
||||
}
|
||||
else {
|
||||
// On s'assure que l'utilisateur à la permission de voir
|
||||
$page=$entity->getPage();
|
||||
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
|
||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
// Récupération des paramétres du widget
|
||||
$interval="2";
|
||||
foreach($this->entity->getParameter()["fields"] as $parameter) {
|
||||
foreach($entity->getParameter()["fields"] as $parameter) {
|
||||
switch($parameter["id"]) {
|
||||
case "interval":
|
||||
$interval=$parameter["value"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Préference utilisateur
|
||||
$this->getPreference($entity);
|
||||
|
||||
// Récupération des slides
|
||||
$slides=$this->em->getRepository("CadolesPortalBundle:Slide")->findBy(["pagewidget"=>$this->entity],['roworder'=>'ASC','title'=>'ASC']);
|
||||
$slides=$em->getRepository("CadolesPortalBundle:Slide")->findBy(["pagewidget"=>$entity],['roworder'=>'ASC','title'=>'ASC']);
|
||||
|
||||
// Render
|
||||
return $this->getRender('viewslide.html.twig', [
|
||||
'canadd' => $this->canadd,
|
||||
return $this->render($this->labelentity.':viewslide.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => $canupdate,
|
||||
'canupdate' => $canupdate,
|
||||
'slides' => $slides,
|
||||
'interval' => $interval,
|
||||
'access' => $access,
|
||||
'look' => $look,
|
||||
'mini' => ($look=="list"&&$entity->getId()!=$selwidget),
|
||||
]);
|
||||
}
|
||||
|
||||
public function viewfileAction(Request $request,$id,$access="config") {
|
||||
// Récupération de la requete
|
||||
$this->setRequest($request,$id,$access);
|
||||
$look=$request->query->get('look');
|
||||
$selwidget=$request->query->get('selwidget');
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$entity = $em->getRepository($this->labelentity)->find($id);
|
||||
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
|
||||
|
||||
// Permissions
|
||||
if($access=="config") {
|
||||
$canupdate = true;
|
||||
}
|
||||
else {
|
||||
// On s'assure que l'utilisateur à la permission de voir
|
||||
$page=$entity->getPage();
|
||||
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
|
||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
// Récupération des paramétres du widget
|
||||
$view="small";
|
||||
foreach($this->entity->getParameter()["fields"] as $parameter) {
|
||||
foreach($entity->getParameter()["fields"] as $parameter) {
|
||||
switch($parameter["id"]) {
|
||||
case "modelist":
|
||||
$view=($parameter["value"]==0?"small":"list");
|
||||
|
@ -1203,17 +1291,45 @@ class PagewidgetController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
// Render
|
||||
return $this->getRender('viewfile.html.twig', [
|
||||
'canadd' => $this->canadd,
|
||||
// Préference utilisateur
|
||||
$this->getPreference($entity);
|
||||
|
||||
return $this->render($this->labelentity.':viewfile.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => $canupdate,
|
||||
'canupdate' => $canupdate,
|
||||
'access' => $access,
|
||||
'directory' => "widget-".$id,
|
||||
'view' => $view,
|
||||
'look' => $look,
|
||||
'mini' => ($look=="list"&&$entity->getId()!=$selwidget),
|
||||
]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function viewgaleryAction(Request $request,$id,$access="config") {
|
||||
// Récupération de la requete
|
||||
$this->setRequest($request,$id,$access);
|
||||
$look=$request->query->get('look');
|
||||
$selwidget=$request->query->get('selwidget');
|
||||
|
||||
$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');
|
||||
}
|
||||
|
||||
// Préference utilisateur
|
||||
$this->getPreference($entity);
|
||||
|
||||
$directory=$this->get('kernel')->getRootDir()."/../uploads/file/widget-".$id;
|
||||
$files=[];
|
||||
|
@ -1243,47 +1359,96 @@ class PagewidgetController extends Controller
|
|||
|
||||
|
||||
// Render
|
||||
return $this->getRender('viewgalery.html.twig', [
|
||||
'canadd' => $this->canadd,
|
||||
return $this->render($this->labelentity.':viewgalery.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => $canupdate,
|
||||
'canupdate' => $canupdate,
|
||||
'files' => $files,
|
||||
'access' => $access,
|
||||
'look' => $look,
|
||||
'mini' => ($look=="list"&&$entity->getId()!=$selwidget),
|
||||
]);
|
||||
}
|
||||
|
||||
public function viewcalendarAction(Request $request,$id,$access="config") {
|
||||
// Récupération de la requete
|
||||
$this->setRequest($request,$id,$access);
|
||||
$usage=$request->query->get('usage');
|
||||
$group=$request->query->get('group');
|
||||
$look=$request->query->get('look');
|
||||
$selwidget=$request->query->get('selwidget');
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$entity = $em->getRepository($this->labelentity)->find($id);
|
||||
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
|
||||
|
||||
if($group) $groupentity=$em->getRepository("CadolesCoreBundle:Group")->find($group);
|
||||
|
||||
// Permissions
|
||||
if($access=="config") {
|
||||
$canupdate = true;
|
||||
}
|
||||
else {
|
||||
// On s'assure que l'utilisateur à la permission de voir
|
||||
$page=$entity->getPage();
|
||||
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
|
||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
// Récupération des paramétres du widget
|
||||
$nbday="0";
|
||||
foreach($this->entity->getParameter()["fields"] as $parameter) {
|
||||
foreach($entity->getParameter()["fields"] as $parameter) {
|
||||
switch($parameter["id"]) {
|
||||
case "nbday":
|
||||
$nbday=$parameter["value"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Préference utilisateur
|
||||
$this->getPreference($entity);
|
||||
|
||||
// Récupérer les events de l'utilisateur
|
||||
$user=$this->getUser();
|
||||
$events=$this->em->getRepository("CadolesPortalBundle:Calendarevent")->getUserCalendarevents($user,$this->get('session')->get('color')["main"],$this->usage,$this->group,$firstcalendar);
|
||||
$events=$em->getRepository("CadolesPortalBundle:Calendarevent")->getUserCalendarevents($user,$this->get('session')->get('color')["main"],$usage,$group,$firstcalendar);
|
||||
|
||||
// Render
|
||||
return $this->getRender('viewcalendar.html.twig', [
|
||||
'canadd' => $this->canadd,
|
||||
return $this->render($this->labelentity.':viewcalendar.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => $canupdate,
|
||||
'canupdate' => $canupdate,
|
||||
'events' => $events,
|
||||
'nbday' => $nbday,
|
||||
'access' => $access,
|
||||
'firstcalendar' => $firstcalendar,
|
||||
'usage' => $this->usage,
|
||||
'usage' => $usage,
|
||||
'look' => $look,
|
||||
'mini' => ($look=="list"&&$entity->getId()!=$selwidget),
|
||||
]);
|
||||
}
|
||||
|
||||
public function viewblogAction(Request $request,$id,$access="config") {
|
||||
// Récupération de la requete
|
||||
$this->setRequest($request,$id,$access);
|
||||
$usage=$request->query->get('usage');
|
||||
$group=$request->query->get('group');
|
||||
$look=$request->query->get('look');
|
||||
$selwidget=$request->query->get('selwidget');
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$entity = $em->getRepository($this->labelentity)->find($id);
|
||||
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
|
||||
|
||||
// Permissions
|
||||
if($access=="config") {
|
||||
$canupdate = true;
|
||||
}
|
||||
else {
|
||||
// On s'assure que l'utilisateur à la permission de voir
|
||||
$page=$entity->getPage();
|
||||
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
|
||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
// Récupération des paramétres du widget
|
||||
$nbarticle=10;
|
||||
foreach($this->entity->getParameter()["fields"] as $parameter) {
|
||||
foreach($entity->getParameter()["fields"] as $parameter) {
|
||||
switch($parameter["id"]) {
|
||||
case "nbarticle":
|
||||
$nbarticle=$parameter["value"];
|
||||
|
@ -1291,38 +1456,64 @@ class PagewidgetController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
// Préference utilisateur
|
||||
$this->getPreference($entity);
|
||||
|
||||
// On récupère soit les blogs du group en cours soit l'ensemble des blogs de l'utilisateur
|
||||
if($this->usage=="group") {
|
||||
$blogs=$this->em->getRepository("CadolesPortalBundle:Blog")->getBlogsGroup($this->getUser(),$this->group);
|
||||
if($usage=="group") {
|
||||
$blogs=$em->getRepository("CadolesPortalBundle:Blog")->getBlogsGroup($this->getUser(),$group);
|
||||
if($blogs) $firstblog=$blogs[0]->getId();
|
||||
}
|
||||
else {
|
||||
$this->em->getRepository("CadolesPortalBundle:Blog")->getBlogsUser($this->getUser(),$blogsuser,$blogsadmin,$blogsshared);
|
||||
$em->getRepository("CadolesPortalBundle:Blog")->getBlogsUser($this->getUser(),$blogsuser,$blogsadmin,$blogsshared);
|
||||
$blogs=array_merge($blogsuser,$blogsadmin->toArray(),$blogsshared);
|
||||
$firstblog="all";
|
||||
}
|
||||
|
||||
// On récupère les nbarticle de ses blogs
|
||||
$this->em->getRepository("CadolesPortalBundle:Blogarticle")->getBlogsArticles($blogs,0,$nbarticle,$count,$blogarticles);
|
||||
$em->getRepository("CadolesPortalBundle:Blogarticle")->getBlogsArticles($blogs,0,$nbarticle,$count,$blogarticles);
|
||||
|
||||
|
||||
|
||||
// Render
|
||||
return $this->getRender('viewblog.html.twig', [
|
||||
'canadd' => $this->canadd,
|
||||
return $this->render($this->labelentity.':viewblog.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => $canupdate,
|
||||
'canupdate' => $canupdate,
|
||||
'blogarticles' => $blogarticles,
|
||||
'nbarticle' => $nbarticle,
|
||||
'access' => $access,
|
||||
'firstblog' => $firstblog,
|
||||
'usage' => $this->usage,
|
||||
'usage' => $usage,
|
||||
'look' => $look,
|
||||
'mini' => ($look=="list"&&$entity->getId()!=$selwidget),
|
||||
]);
|
||||
}
|
||||
|
||||
public function viewprojectAction(Request $request,$id,$access="config") {
|
||||
// Récupération de la requete
|
||||
$this->setRequest($request,$id,$access);
|
||||
$usage=$request->query->get('usage');
|
||||
$group=$request->query->get('group');
|
||||
$look=$request->query->get('look');
|
||||
$selwidget=$request->query->get('selwidget');
|
||||
|
||||
$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
|
||||
$nbarticle=10;
|
||||
foreach($this->entity->getParameter()["fields"] as $parameter) {
|
||||
foreach($entity->getParameter()["fields"] as $parameter) {
|
||||
switch($parameter["id"]) {
|
||||
case "nbarticle":
|
||||
$nbarticle=$parameter["value"];
|
||||
|
@ -1330,56 +1521,76 @@ class PagewidgetController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
// Préference utilisateur
|
||||
$this->getPreference($entity);
|
||||
|
||||
// On récupère soit les projects du group en cours soit l'ensemble des projects de l'utilisateur
|
||||
$user=$this->getUser();
|
||||
if($this->usage=="group") {
|
||||
$projects=$this->em->getRepository("CadolesPortalBundle:Project")->getProjectsGroup($this->getUser(),$this->group);
|
||||
if($usage=="group") {
|
||||
$projects=$em->getRepository("CadolesPortalBundle:Project")->getProjectsGroup($this->getUser(),$group);
|
||||
if($projects) $firstproject=$projects[0]->getId();
|
||||
}
|
||||
else {
|
||||
$this->em->getRepository("CadolesPortalBundle:Project")->getProjectsUser($user,$projectsuser,$projectsadmin,$projectsshared);
|
||||
$em->getRepository("CadolesPortalBundle:Project")->getProjectsUser($user,$projectsuser,$projectsadmin,$projectsshared);
|
||||
$projects=array_merge($projectsuser,$projectsadmin->toArray(),$projectsshared);
|
||||
$firstproject="all";
|
||||
}
|
||||
|
||||
|
||||
// On récupère les nbarticle de ses projects
|
||||
$this->em->getRepository("CadolesPortalBundle:Projecttask")->getProjectsTasks($projects,0,$nbarticle,$count,$projecttasks);
|
||||
$em->getRepository("CadolesPortalBundle:Projecttask")->getProjectsTasks($projects,0,$nbarticle,$count,$projecttasks);
|
||||
|
||||
foreach($projecttasks as $key => $projecttask) {
|
||||
if($projecttask->getPercentage()==100) unset($projecttasks[$key]);
|
||||
}
|
||||
|
||||
if($this->usage!="group") {
|
||||
if($usage!="group") {
|
||||
foreach($projecttasks as $key => $projecttask) {
|
||||
if(!$user) unset($projecttasks[$key]);
|
||||
else {
|
||||
if($projecttask->getUser() && $projecttask->getUser()!=$user)
|
||||
unset($projecttasks[$key]);
|
||||
elseif(!$projecttask->getUser() && $projecttask->getOwner() && $projecttask->getOwner()!=$user)
|
||||
unset($projecttasks[$key]);
|
||||
|
||||
if($projecttask->getUser() && $projecttask->getUser()!=$user) unset($projecttasks[$key]);
|
||||
elseif($projecttask->getOwner() && $projecttask->getOwner()!=$user) unset($projecttasks[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Render
|
||||
return $this->getRender('viewproject.html.twig', [
|
||||
'canadd' => $this->canupdate,
|
||||
return $this->render($this->labelentity.':viewproject.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => $canupdate,
|
||||
'canupdate' => $canupdate,
|
||||
'projecttasks' => $projecttasks,
|
||||
'nbarticle' => $nbarticle,
|
||||
'access' => $access,
|
||||
'firstproject' => $firstproject,
|
||||
'usage' => $this->usage,
|
||||
'usage' => $usage,
|
||||
'look' => $look,
|
||||
'mini' => ($look=="list"&&$entity->getId()!=$selwidget),
|
||||
]);
|
||||
}
|
||||
|
||||
public function viewseparatorAction(Request $request,$id,$access="config") {
|
||||
// Récupération de la requete
|
||||
$this->setRequest($request,$id,$access);
|
||||
$look=$request->query->get('look');
|
||||
$selwidget=$request->query->get('selwidget');
|
||||
|
||||
$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
|
||||
$seetitle=false;
|
||||
$seeicon=false;
|
||||
foreach($this->entity->getParameter()["fields"] as $parameter) {
|
||||
foreach($entity->getParameter()["fields"] as $parameter) {
|
||||
switch($parameter["id"]) {
|
||||
case "seetitle":
|
||||
$seetitle=boolval($parameter["value"]);
|
||||
|
@ -1390,21 +1601,44 @@ class PagewidgetController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
// Préference utilisateur
|
||||
$this->getPreference($entity);
|
||||
|
||||
// Render
|
||||
return $this->getRender('viewseparator.html.twig', [
|
||||
'canadd' => $this->canupdate,
|
||||
return $this->render($this->labelentity.':viewseparator.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => $canupdate,
|
||||
'canupdate' => $canupdate,
|
||||
'seetitle' => $seetitle,
|
||||
'seeicon' => $seeicon,
|
||||
'access' => $access,
|
||||
'look' => $look,
|
||||
'mini' => ($look=="list"&&$entity->getId()!=$selwidget),
|
||||
]);
|
||||
}
|
||||
|
||||
public function viewclockAction(Request $request,$id,$access="config") {
|
||||
// Récupération de la requete
|
||||
$this->setRequest($request,$id,$access);
|
||||
$look=$request->query->get('look');
|
||||
$selwidget=$request->query->get('selwidget');
|
||||
|
||||
$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
|
||||
$clock="0";
|
||||
foreach($this->entity->getParameter()["fields"] as $parameter) {
|
||||
foreach($entity->getParameter()["fields"] as $parameter) {
|
||||
switch($parameter["id"]) {
|
||||
case "clock":
|
||||
$clock=$parameter["value"];
|
||||
|
@ -1412,33 +1646,79 @@ class PagewidgetController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
// Préference utilisateur
|
||||
$this->getPreference($entity);
|
||||
|
||||
// Render
|
||||
return $this->getRender('viewframe.html.twig', [
|
||||
'canadd' => $this->canupdate,
|
||||
return $this->render($this->labelentity.':viewframe.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => $canupdate,
|
||||
'canupdate' => $canupdate,
|
||||
'onheader' => true,
|
||||
'tool' => ($clock==0?"cadoles_portal_user_tool_clockanalogique":"cadoles_portal_user_tool_clocknumerique"),
|
||||
'access' => $access,
|
||||
'look' => $look,
|
||||
'mini' => ($look=="list"&&$entity->getId()!=$selwidget),
|
||||
]);
|
||||
}
|
||||
|
||||
public function viewcalculatorAction(Request $request,$id,$access="config") {
|
||||
// Récupération de la requete
|
||||
$this->setRequest($request,$id,$access);
|
||||
$look=$request->query->get('look');
|
||||
$selwidget=$request->query->get('selwidget');
|
||||
|
||||
$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');
|
||||
}
|
||||
|
||||
// Préference utilisateur
|
||||
$this->getPreference($entity);
|
||||
|
||||
// Render
|
||||
return $this->getRender('viewframe.html.twig', [
|
||||
'canadd' => $this->canupdate,
|
||||
return $this->render($this->labelentity.':viewframe.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => $canupdate,
|
||||
'canupdate' => $canupdate,
|
||||
'onheader' => true,
|
||||
'tool' => "cadoles_portal_user_tool_calculator",
|
||||
'tool' => "cadoles_portal_user_tool_calculator",
|
||||
'access' => $access,
|
||||
'look' => $look,
|
||||
'mini' => ($look=="list"&&$entity->getId()!=$selwidget),
|
||||
]);
|
||||
}
|
||||
|
||||
public function viewappexternalAction(Request $request,$id,$access="config") {
|
||||
// Récupération de la requete
|
||||
$this->setRequest($request,$id,$access);
|
||||
$look=$request->query->get('look');
|
||||
$selwidget=$request->query->get('selwidget');
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$entity = $em->getRepository($this->labelentity)->find($id);
|
||||
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
|
||||
|
||||
// Permissions
|
||||
if($access=="config") {
|
||||
$canupdate = true;
|
||||
}
|
||||
else {
|
||||
// On s'assure que l'utilisateur à la permission de voir
|
||||
$page=$entity->getPage();
|
||||
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
|
||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
// Récupération des paramétres du widget
|
||||
$idappexternal=null;
|
||||
foreach($this->entity->getParameter()["fields"] as $parameter) {
|
||||
foreach($entity->getParameter()["fields"] as $parameter) {
|
||||
switch($parameter["id"]) {
|
||||
case "appexternal":
|
||||
$idappexternal=$parameter["value"];
|
||||
|
@ -1449,12 +1729,15 @@ class PagewidgetController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
// Préference utilisateur
|
||||
$this->getPreference($entity);
|
||||
|
||||
$user=$this->getUser();
|
||||
$items=[];
|
||||
$itemcategorys=[];
|
||||
if($user) {
|
||||
if($idappexternal) $appextenals=$this->em->getRepository("CadolesPortalBundle:Appexternal")->findBy(["id"=>$idappexternal]);
|
||||
else $appextenals=$this->em->getRepository("CadolesPortalBundle:Appexternal")->findAll();
|
||||
if($idappexternal) $appextenals=$em->getRepository("CadolesPortalBundle:Appexternal")->findBy(["id"=>$idappexternal]);
|
||||
else $appextenals=$em->getRepository("CadolesPortalBundle:Appexternal")->findAll();
|
||||
foreach($appextenals as $appexternal) {
|
||||
switch($appexternal->getName()) {
|
||||
case "Limesurvey":
|
||||
|
@ -1507,86 +1790,161 @@ class PagewidgetController extends Controller
|
|||
array_multisort($title, SORT_ASC, $items);
|
||||
|
||||
// Render
|
||||
return $this->getRender('viewappexternal.html.twig', [
|
||||
return $this->render($this->labelentity.':viewappexternal.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => ($user),
|
||||
'canupdate' => $canupdate,
|
||||
'modedesktop' => $modedesktop,
|
||||
'items' => $items,
|
||||
'itemcategorys' => $itemcategorys,
|
||||
'itemcategorys' => $itemcategorys,
|
||||
'access' => $access,
|
||||
'look' => $look,
|
||||
'mini' => ($look=="list"&&$entity->getId()!=$selwidget),
|
||||
]);
|
||||
}
|
||||
|
||||
public function viewinfoAction(Request $request,$id,$access="config") {
|
||||
// Récupération de la requete
|
||||
$this->setRequest($request,$id,$access);
|
||||
$usage=$request->query->get('usage');
|
||||
$group=$request->query->get('group');
|
||||
$look=$request->query->get('look');
|
||||
$selwidget=$request->query->get('selwidget');
|
||||
$user=$this->getUser();
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$entity = $em->getRepository($this->labelentity)->find($id);
|
||||
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
|
||||
$page=$entity->getPage();
|
||||
|
||||
// Permissions
|
||||
if($access=="config") {
|
||||
$canupdate = true;
|
||||
}
|
||||
else {
|
||||
// On s'assure que l'utilisateur à la permission de voir
|
||||
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
|
||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
// Préference utilisateur
|
||||
$this->getPreference($entity);
|
||||
|
||||
$icon=null;
|
||||
$title=null;
|
||||
$description=null;
|
||||
$members=[];
|
||||
if($this->usage=="group") {
|
||||
$groupentity=$this->em->getRepository("CadolesCoreBundle:Group")->find($this->group);
|
||||
if($groupentity) {
|
||||
$title=$groupentity->getLabel();
|
||||
$id=$groupentity->getId();
|
||||
if($groupentity->getDescription())
|
||||
$description="<strong>Description</strong><br>".$groupentity->getDescription();
|
||||
if($groupentity->getIcon())
|
||||
$icon="/".$groupentity->getIcon()->getLabel();
|
||||
if($usage=="group") {
|
||||
$group=$em->getRepository("CadolesCoreBundle:Group")->find($group);
|
||||
if($group) {
|
||||
$title=$group->getLabel();
|
||||
$id=$group->getId();
|
||||
if($group->getDescription())
|
||||
$description="<strong>Description</strong><br>".$group->getDescription();
|
||||
if($group->getIcon())
|
||||
$icon="/".$group->getIcon()->getLabel();
|
||||
|
||||
|
||||
foreach($groupentity->getUsers() as $usergroup) {
|
||||
foreach($group->getUsers() as $usergroup) {
|
||||
|
||||
array_push($members,$usergroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$title=$this->entity->getPage()->getName();
|
||||
$proprio=$this->entity->getPage()->getUser();
|
||||
$title=$entity->getPage()->getName();
|
||||
$proprio=$entity->getPage()->getUser();
|
||||
$id=0;
|
||||
if($proprio) {
|
||||
$description="Propriétaire de la page<br>".$proprio->getLastname()." ".$proprio->getLastname();
|
||||
$icon="/uploads/avatar/".$proprio->getAvatar();
|
||||
}
|
||||
}
|
||||
|
||||
// Render
|
||||
return $this->getRender('viewinfo.html.twig', [
|
||||
'canadd' => $this->canupdate,
|
||||
'usage' => $this->usage,
|
||||
return $this->render($this->labelentity.':viewinfo.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => $canupdate,
|
||||
'canupdate' => $canupdate,
|
||||
'usage' => $usage,
|
||||
'icon' => $icon,
|
||||
'title' => $title,
|
||||
'description' => $description,
|
||||
'members' => $members,
|
||||
'id' => $id,
|
||||
'idpage' => $this->entity->getPage()->getId(),
|
||||
'idpage' => $page->getId(),
|
||||
'look' => $look,
|
||||
'mini' => ($look=="list"&&$entity->getId()!=$selwidget),
|
||||
]);
|
||||
}
|
||||
|
||||
public function viewchatAction(Request $request,$id,$access="config") {
|
||||
// Récupération de la requete
|
||||
$this->setRequest($request,$id,$access);
|
||||
$usage=$request->query->get('usage');
|
||||
$group=$request->query->get('group');
|
||||
$look=$request->query->get('look');
|
||||
$selwidget=$request->query->get('selwidget');
|
||||
|
||||
$group=$this->group;
|
||||
if($this->usage!="group"||!$group) {
|
||||
$group=$this->em->getRepository("CadolesCoreBundle:Group")->findOneBy(["fgall"=>true])->getId();
|
||||
$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');
|
||||
}
|
||||
|
||||
// Préference utilisateur
|
||||
$this->getPreference($entity);
|
||||
|
||||
if($usage!="group"||!$group) {
|
||||
$group=$em->getRepository("CadolesCoreBundle:Group")->findOneBy(["fgall"=>true])->getId();
|
||||
}
|
||||
|
||||
// Render
|
||||
return $this->getRender('viewchat.html.twig', [
|
||||
'canadd' => $this->canupdate,
|
||||
return $this->render($this->labelentity.':viewchat.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => $canupdate,
|
||||
'canupdate' => $canupdate,
|
||||
'onheader' => false,
|
||||
'tool' => "cadoles_websocket_chat",
|
||||
'usage' => $this->usage,
|
||||
'access' => $access,
|
||||
'usage' => $usage,
|
||||
'group' => $group,
|
||||
'look' => $look,
|
||||
'mini' => ($look=="list"&&$entity->getId()!=$selwidget),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function viewgroupAction(Request $request,$id,$access="config") {
|
||||
// Récupération de la requete
|
||||
$this->setRequest($request,$id,$access);
|
||||
$usage=$request->query->get('usage');
|
||||
$group=$request->query->get('group');
|
||||
$look=$request->query->get('look');
|
||||
$selwidget=$request->query->get('selwidget');
|
||||
|
||||
$user=$this->getUser();
|
||||
|
||||
$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');
|
||||
}
|
||||
|
||||
// Préference utilisateur
|
||||
$this->getPreference($entity);
|
||||
|
||||
$mygroups=[];
|
||||
$this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->getPagesUser($user,null,$default,$pagesuser,$pagesadmin,$groupsshared);
|
||||
if(is_array($groupsshared)) {
|
||||
|
@ -1604,21 +1962,47 @@ class PagewidgetController extends Controller
|
|||
}
|
||||
|
||||
// Render
|
||||
return $this->getRender('viewgroup.html.twig', [
|
||||
return $this->render($this->labelentity.':viewgroup.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => ($user),
|
||||
'usage' => $this->usage,
|
||||
'canupdate' => $canupdate,
|
||||
'usage' => $usage,
|
||||
'groups' => $mygroups,
|
||||
'look' => $look,
|
||||
'mini' => ($look=="list"&&$entity->getId()!=$selwidget),
|
||||
]);
|
||||
}
|
||||
|
||||
public function viewgroupmessageAction(Request $request,$id,$access="config") {
|
||||
// Récupération de la requete
|
||||
$this->setRequest($request,$id,$access);
|
||||
|
||||
$usage=$request->query->get('usage');
|
||||
$group=$request->query->get('group');
|
||||
$look=$request->query->get('look');
|
||||
$selwidget=$request->query->get('selwidget');
|
||||
|
||||
$user=$this->getUser();
|
||||
|
||||
$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');
|
||||
}
|
||||
|
||||
// Préference utilisateur
|
||||
$this->getPreference($entity);
|
||||
|
||||
// Récupération des paramétres du widget
|
||||
$modelist=1;
|
||||
$nbarticle=5;
|
||||
foreach($this->entity->getParameter()["fields"] as $parameter) {
|
||||
foreach($entity->getParameter()["fields"] as $parameter) {
|
||||
switch($parameter["id"]) {
|
||||
case "modelist":
|
||||
$modelist=$parameter["value"];
|
||||
|
@ -1629,8 +2013,8 @@ class PagewidgetController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
$mygroups=[];
|
||||
$mymsg= [];
|
||||
$user=$this->getUser();
|
||||
$this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->getPagesUser($user,null,$default,$pagesuser,$pagesadmin,$groupsshared);
|
||||
if(is_array($groupsshared)) {
|
||||
foreach($groupsshared as $groupshared) {
|
||||
|
@ -1666,23 +2050,48 @@ class PagewidgetController extends Controller
|
|||
|
||||
|
||||
// Render
|
||||
return $this->getRender('viewgroupmessage.html.twig', [
|
||||
return $this->render($this->labelentity.':viewgroupmessage.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => ($user),
|
||||
'usage' => $this->usage,
|
||||
'canupdate' => $canupdate,
|
||||
'usage' => $usage,
|
||||
'modelist' => $modelist,
|
||||
'messages' => $mymsg,
|
||||
'nbarticle' => $nbarticle,
|
||||
'look' => $look,
|
||||
'mini' => ($look=="list"&&$entity->getId()!=$selwidget),
|
||||
]);
|
||||
}
|
||||
|
||||
public function viewOnlydocAction(Request $request,$id,$access="config") {
|
||||
// Récupération de la requete
|
||||
$this->setRequest($request,$id,$access);
|
||||
$usage=$request->query->get('usage');
|
||||
$group=$request->query->get('group');
|
||||
$look=$request->query->get('look');
|
||||
$selwidget=$request->query->get('selwidget');
|
||||
|
||||
$user=$this->getUser();
|
||||
|
||||
$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;
|
||||
$cansee = true;
|
||||
}
|
||||
else {
|
||||
// On s'assure que l'utilisateur à la permission de voir
|
||||
$page=$entity->getPage();
|
||||
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
|
||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
|
||||
// Récupération des paramétres du widget
|
||||
$apponly=0;
|
||||
$view="small";
|
||||
foreach($this->entity->getParameter()["fields"] as $parameter) {
|
||||
foreach($entity->getParameter()["fields"] as $parameter) {
|
||||
switch($parameter["id"]) {
|
||||
case "apponly":
|
||||
$apponly=$parameter["value"];
|
||||
|
@ -1692,11 +2101,19 @@ class PagewidgetController extends Controller
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->getRender('viewonlydoc.html.twig', [
|
||||
'canadd' => $this->canupdate,
|
||||
|
||||
// Préference utilisateur
|
||||
$this->getPreference($entity);
|
||||
|
||||
return $this->render($this->labelentity.':viewonlydoc.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => $canupdate,
|
||||
'canupdate' => $canupdate,
|
||||
'access' => $access,
|
||||
'directory' => $id,
|
||||
'view' => $view,
|
||||
'look' => $look,
|
||||
'mini' => ($look=="list"&&$entity->getId()!=$selwidget),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -410,6 +410,7 @@ class ProjectController extends Controller
|
|||
}
|
||||
|
||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
|
||||
$canupdate=$this->get('session')->get('cancreateproject');
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,6 @@ class ProjecttaskController extends Controller
|
|||
$user=$this->getUser();
|
||||
$em->getRepository("CadolesPortalBundle:Project")->getPermission($user,$entity->getProject(),$cansee,$canupdate,$canadd);
|
||||
if($user && ((is_null($entity->getUser()) && $user==$entity->getOwner()) || $user==$entity->getUser())) $canadd=true;
|
||||
else $canadd = $em->getRepository("CadolesPortalBundle:Project")->getInvalideur($user,$entity->getProject());
|
||||
if(!$canadd) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
|
@ -181,7 +180,6 @@ class ProjecttaskController extends Controller
|
|||
$user=$this->getUser();
|
||||
$em->getRepository("CadolesPortalBundle:Project")->getPermission($user,$entity->getProject(),$cansee,$canupdate,$canadd);
|
||||
if($user && ((is_null($entity->getUser()) && $user==$entity->getOwner()) || $user==$entity->getUser())) $canadd=true;
|
||||
else $canadd = $em->getRepository("CadolesPortalBundle:Project")->getInvalideur($user,$entity->getProject());
|
||||
|
||||
if(!$canadd) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
@ -235,7 +233,6 @@ class ProjecttaskController extends Controller
|
|||
}
|
||||
else {
|
||||
$em->getRepository("CadolesPortalBundle:Project")->getPermission($user,$entity->getProject(),$cansee,$canupdate,$canadd);
|
||||
$canadd = $em->getRepository("CadolesPortalBundle:Project")->getInvalideur($user,$entity->getProject());
|
||||
}
|
||||
|
||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
|
@ -269,6 +266,17 @@ class ProjecttaskController extends Controller
|
|||
$tmp["thumb"]="";
|
||||
if($tmp["extension"]=="pdf") {
|
||||
$tmp["thumb"]="/".$this->getParameter('alias')."/bundles/cadolescore/images/files/".$tmp["extension"].".png";
|
||||
|
||||
/* ne plus afficher l'apercu du pdf
|
||||
if($fs->exists($directory."/thumbmini/".$tmp["name"])) {
|
||||
$data = file_get_contents($directory."/thumbmini/".$tmp["name"]);
|
||||
$tmp["thumb"]="data:image/jpg;base64," . base64_encode($data);
|
||||
}
|
||||
elseif($fs->exists($directory."/thumb/".$tmp["name"])) {
|
||||
$data = file_get_contents($directory."/thumb/".$tmp["name"]);
|
||||
$tmp["thumb"]="data:image/jpg;base64," . base64_encode($data);
|
||||
}
|
||||
*/
|
||||
}
|
||||
elseif($fs->exists($directory."/thumbmini/".$tmp["name"])) {
|
||||
$data = file_get_contents($directory."/thumbmini/".$tmp["name"]);
|
||||
|
@ -345,7 +353,7 @@ class ProjecttaskController extends Controller
|
|||
$project=$em->getRepository("CadolesPortalBundle:Project")->find($projectid);
|
||||
if($project) {
|
||||
$user=$this->getUser();
|
||||
$canadd = $em->getRepository("CadolesPortalBundle:Project")->getInvalideur($user,$project);
|
||||
$em->getRepository("CadolesPortalBundle:Project")->getPermission($user,$project,$cansee,$canupdate,$canadd);
|
||||
|
||||
// Si permission alors il peut affecter tt les personnes du groupe
|
||||
if($canadd||$access=="config") {
|
||||
|
@ -397,8 +405,9 @@ class ProjecttaskController extends Controller
|
|||
// On s'assure que l'utilisateur à la permission de modifier
|
||||
if($access=="user") {
|
||||
$user=$this->getUser();
|
||||
$em->getRepository("CadolesPortalBundle:Project")->getPermission($user,$entity->getProject(),$cansee,$canupdate,$canadd);
|
||||
if($user && ((is_null($entity->getUser()) && $user==$entity->getOwner()) || $user==$entity->getUser())) $canadd=true;
|
||||
else $canadd = $em->getRepository("CadolesPortalBundle:Project")->getInvalideur($user,$entity->getProject());
|
||||
|
||||
if(!$canadd) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ class SlideController extends Controller
|
|||
}
|
||||
else {
|
||||
$groupentity=$this->getDoctrine()->getRepository("CadolesCoreBundle:Group")->find($group);
|
||||
$usergroup=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["user"=>$this->getUser(),"group"=>$groupentity]);
|
||||
if(!$usergroup||$usergroup->getRolegroup()<50) throw $this->createNotFoundException('Permission denied');
|
||||
$fgmanager=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["user"=>$this->getUser(),"group"=>$groupentity,"fgmanager"=>true]);
|
||||
if(!$fgmanager) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,8 +81,8 @@ class SlideController extends Controller
|
|||
}
|
||||
else {
|
||||
$groupentity=$this->getDoctrine()->getRepository("CadolesCoreBundle:Group")->find($group);
|
||||
$usergroup=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["user"=>$this->getUser(),"group"=>$groupentity]);
|
||||
if(!$usergroup||$usergroup->getRolegroup()<50) throw $this->createNotFoundException('Permission denied');
|
||||
$fgmanager=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["user"=>$this->getUser(),"group"=>$groupentity,"fgmanager"=>true]);
|
||||
if(!$fgmanager) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,8 +142,8 @@ class SlideController extends Controller
|
|||
}
|
||||
else {
|
||||
$groupentity=$this->getDoctrine()->getRepository("CadolesCoreBundle:Group")->find($group);
|
||||
$usergroup=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["user"=>$this->getUser(),"group"=>$groupentity]);
|
||||
if(!$usergroup||$usergroup->getRolegroup()<50) throw $this->createNotFoundException('Permission denied');
|
||||
$fgmanager=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["user"=>$this->getUser(),"group"=>$groupentity,"fgmanager"=>true]);
|
||||
if(!$fgmanager) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,8 +206,8 @@ class SlideController extends Controller
|
|||
}
|
||||
else {
|
||||
$groupentity=$this->getDoctrine()->getRepository("CadolesCoreBundle:Group")->find($group);
|
||||
$usergroup=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["user"=>$this->getUser(),"group"=>$groupentity]);
|
||||
if(!$usergroup||$usergroup->getRolegroup()<50) throw $this->createNotFoundException('Permission denied');
|
||||
$fgmanager=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["user"=>$this->getUser(),"group"=>$groupentity,"fgmanager"=>true]);
|
||||
if(!$fgmanager) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -132,17 +132,6 @@ class Calendar
|
|||
return $this;
|
||||
}
|
||||
|
||||
private $canadd;
|
||||
public function getCanadd()
|
||||
{
|
||||
return $this->canadd;
|
||||
}
|
||||
public function setCanadd($canadd)
|
||||
{
|
||||
$this->canadd = $canadd;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/* Password User */
|
||||
public function setPassword($password)
|
||||
{
|
||||
|
|
|
@ -35,9 +35,8 @@ class BlogShareType extends AbstractType
|
|||
->where('g.fgcanshare=:fgcanshare')
|
||||
->andWhere('g=ug.group')
|
||||
->andWhere('ug.user=:user')
|
||||
->andWhere('ug.rolegroup>=:role')
|
||||
->andWhere('ug.fgmanager=:fgcanshare')
|
||||
->setParameter('fgcanshare',true)
|
||||
->setParameter('role',90)
|
||||
->setParameter('user',$user);
|
||||
},
|
||||
'choice_label' => 'label',
|
||||
|
|
|
@ -75,13 +75,13 @@ class BlogarticleType extends AbstractType
|
|||
->orwhere(':user MEMBER OF blog.writers')
|
||||
|
||||
->from('CadolesCoreBundle:UserGroup','usergroup')
|
||||
->orwhere('usergroup.group MEMBER OF blog.groups AND usergroup.user=:user AND usergroup.rolegroup>=:role')
|
||||
->orwhere('usergroup.group MEMBER OF blog.groups AND usergroup.user=:user AND usergroup.fgmanager=:flag')
|
||||
|
||||
->from('CadolesCoreBundle:User','user')
|
||||
->andwhere("user=:user")
|
||||
|
||||
->setparameter('user',$user)
|
||||
->setparameter('role',50);
|
||||
->setparameter('flag',true);
|
||||
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -35,9 +35,8 @@ class CalendarShareType extends AbstractType
|
|||
->where('g.fgcanshare=:fgcanshare')
|
||||
->andWhere('g=ug.group')
|
||||
->andWhere('ug.user=:user')
|
||||
->andWhere('ug.rolegroup>=:role')
|
||||
->andWhere('ug.fgmanager=:fgcanshare')
|
||||
->setParameter('fgcanshare',true)
|
||||
->setParameter('role',90)
|
||||
->setParameter('user',$user);
|
||||
},
|
||||
'choice_label' => 'label',
|
||||
|
|
|
@ -35,9 +35,8 @@ class PageShareType extends AbstractType
|
|||
->where('g.fgcanshare=:fgcanshare')
|
||||
->andWhere('g=ug.group')
|
||||
->andWhere('ug.user=:user')
|
||||
->andWhere('ug.rolegroup>=:role')
|
||||
->andWhere('ug.fgmanager=:fgcanshare')
|
||||
->setParameter('fgcanshare',true)
|
||||
->setParameter('role',90)
|
||||
->setParameter('user',$user);
|
||||
},
|
||||
'choice_label' => 'label',
|
||||
|
|
|
@ -100,9 +100,8 @@ class PageSubmitType extends AbstractType
|
|||
->where('g.fgcanshare=:fgcanshare')
|
||||
->andWhere('g=ug.group')
|
||||
->andWhere('ug.user=:user')
|
||||
->andWhere('ug.rolegroup>=:role')
|
||||
->andWhere('ug.fgmanager=:fgcanshare')
|
||||
->setParameter('fgcanshare',true)
|
||||
->setParameter('role',90)
|
||||
->setParameter('user',$user);
|
||||
},
|
||||
])
|
||||
|
|
|
@ -35,9 +35,8 @@ class ProjectShareType extends AbstractType
|
|||
->where('g.fgcanshare=:fgcanshare')
|
||||
->andWhere('g=ug.group')
|
||||
->andWhere('ug.user=:user')
|
||||
->andWhere('ug.rolegroup>=:role')
|
||||
->andWhere('ug.fgmanager=:fgcanshare')
|
||||
->setParameter('fgcanshare',true)
|
||||
->setParameter('role',90)
|
||||
->setParameter('user',$user);
|
||||
},
|
||||
'choice_label' => 'label',
|
||||
|
|
|
@ -129,7 +129,7 @@ class BlogRepository extends EntityRepository
|
|||
|
||||
// Permission sur les blogs
|
||||
foreach($blogsadmin as $blogadmin) {
|
||||
$blogadmin->setCanupdate($this->getInmanager($user,$blogadmin));
|
||||
$blogadmin->setCanupdate(false);
|
||||
$blogadmin->setCanadd($this->getInwriter($user,$blogadmin));
|
||||
}
|
||||
}
|
||||
|
@ -150,6 +150,28 @@ class BlogRepository extends EntityRepository
|
|||
$roles=($user?$user->getRoles():["ROLE_ANONYME"]);
|
||||
$groups=($user?$user->getGroups():[]);
|
||||
|
||||
// La blog est-elle dans les blogs associées à un partage de group ?
|
||||
/*
|
||||
$inblogsshared=$this->createQueryBuilder('blog')
|
||||
->from('CadolesCoreBundle:Group','g')
|
||||
->from('CadolesCoreBundle:UserGroup','ug')
|
||||
->from('CadolesCoreBundle:UserGroup','proprio')
|
||||
->where('g.fgcanshare=:fgcanshare')
|
||||
->andWhere('blog.id = :id')
|
||||
->andWhere('g=ug.group')
|
||||
->andWhere('ug.user=:user')
|
||||
->andWhere('g MEMBER OF blog.groups')
|
||||
->andWhere('blog.user != :user')
|
||||
->andWhere('blog.user is not null')
|
||||
->andWhere('proprio.user=blog.user')
|
||||
->andWhere('proprio.group=g')
|
||||
->setParameter("id",$blog->getId())
|
||||
->setParameter('fgcanshare',true)
|
||||
->setParameter('user',$user)
|
||||
->getQuery()->getResult();
|
||||
if($inblogsshared) $cansee=true;
|
||||
*/
|
||||
|
||||
// La blog est-elle dans les blogs associées au role de l'utilisateur ?
|
||||
foreach($roles as $role) {
|
||||
$qb = $this->createQueryBuilder("blog");
|
||||
|
@ -174,12 +196,9 @@ class BlogRepository extends EntityRepository
|
|||
if($inbloggroup) {
|
||||
$cansee=true;
|
||||
|
||||
// Est-il manager du groupe
|
||||
if($group->getGroup()->getFgcanshare()) {
|
||||
// Est-il collaborateur du groupe
|
||||
if($group->getRolegroup()>=50) $canadd=true;
|
||||
|
||||
// Est-il gestionnaire du groupe
|
||||
if($group->getRolegroup()>=90) $canupdate=true;
|
||||
if($group->getFgmanager()) $canadd=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -191,7 +210,7 @@ class BlogRepository extends EntityRepository
|
|||
}
|
||||
|
||||
public function getInwriter($user,$blog) {
|
||||
$can=false;
|
||||
$canadd=false;
|
||||
|
||||
if($user) {
|
||||
// Peut ecrire ceux qui sont déclaré comme écrivain
|
||||
|
@ -210,9 +229,9 @@ class BlogRepository extends EntityRepository
|
|||
->setparameter('user',$user);
|
||||
|
||||
$inblogwriters=$qb->getQuery()->getResult();
|
||||
if($inblogwriters) $can=true;
|
||||
if($inblogwriters) $canadd=true;
|
||||
|
||||
// Peut ecrire ceux qui sont collaborateur du groupe auquel est rattaché le blog
|
||||
// Peut ecrire ceux qui sont manager du groupe auquel est rattaché le blog
|
||||
$qb = $this->createQueryBuilder("blog");
|
||||
$qb ->andWhere("blog.id=:id")
|
||||
->from('CadolesCoreBundle:User','user')
|
||||
|
@ -221,7 +240,7 @@ class BlogRepository extends EntityRepository
|
|||
->from('CadolesCoreBundle:UserGroup','usergroup')
|
||||
->andwhere('usergroup.group MEMBER OF blog.groups')
|
||||
->andwhere('usergroup.user=:user')
|
||||
->andwhere('usergroup.rolegroup>=:role')
|
||||
->andwhere('usergroup.fgmanager=:flag')
|
||||
|
||||
->from('CadolesCoreBundle:Group','groupe')
|
||||
->andwhere('groupe=usergroup.group')
|
||||
|
@ -229,47 +248,13 @@ class BlogRepository extends EntityRepository
|
|||
|
||||
->setParameter("id",$blog->getId())
|
||||
->setparameter('user',$user)
|
||||
->setparameter('flag',true)
|
||||
->setparameter('role',50);
|
||||
->setparameter('flag',true);
|
||||
|
||||
|
||||
$inblogwriters=$qb->getQuery()->getResult();
|
||||
if($inblogwriters) $can=true;
|
||||
if($inblogwriters) $canadd=true;
|
||||
}
|
||||
|
||||
return $can;
|
||||
return $canadd;
|
||||
}
|
||||
|
||||
|
||||
public function getInmanager($user,$blog) {
|
||||
$can=false;
|
||||
|
||||
if($user) {
|
||||
// Peut ecrire ceux qui sont manager du groupe auquel est rattaché le calendar
|
||||
$qb = $this->createQueryBuilder("blog");
|
||||
$qb ->andWhere("blog.id=:id")
|
||||
->from('CadolesCoreBundle:User','user')
|
||||
->andwhere("user=:user")
|
||||
|
||||
->from('CadolesCoreBundle:UserGroup','usergroup')
|
||||
->andwhere('usergroup.group MEMBER OF blog.groups')
|
||||
->andwhere('usergroup.user=:user')
|
||||
->andwhere('usergroup.rolegroup>=:role')
|
||||
|
||||
->from('CadolesCoreBundle:Group','groupe')
|
||||
->andwhere('groupe=usergroup.group')
|
||||
->andwhere('groupe.fgcanshare=:flag')
|
||||
|
||||
->setParameter("id",$blog->getId())
|
||||
->setparameter('user',$user)
|
||||
->setparameter('flag',true)
|
||||
->setparameter('role',90);
|
||||
|
||||
|
||||
$inblogwriters=$qb->getQuery()->getResult();
|
||||
|
||||
if($inblogwriters) $can=true;
|
||||
}
|
||||
|
||||
return $can;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@ class CalendarRepository extends EntityRepository
|
|||
if($calendarsuser) {
|
||||
foreach($calendarsuser as $calendaruser) {
|
||||
$calendaruser->setCanupdate(true);
|
||||
$calendaruser->setCanadd(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,21 +109,18 @@ class CalendarRepository extends EntityRepository
|
|||
|
||||
// Permission sur les calendars
|
||||
foreach($calendarsadmin as $calendaradmin) {
|
||||
$calendaradmin->setCanupdate($this->getInmanager($user,$calendaradmin));
|
||||
$calendaradmin->setCanadd($this->getInwriter($user,$calendaradmin));
|
||||
$calendaradmin->setCanupdate($this->getInwriter($user,$calendaradmin));
|
||||
}
|
||||
}
|
||||
|
||||
public function getPermission($user,$calendar,&$cansee,&$canupdate,&$canadd) {
|
||||
public function getPermission($user,$calendar,&$cansee,&$canupdate) {
|
||||
// si calendar de l'utilisateur
|
||||
if($calendar->getUser()==$user&&!is_null($user)) {
|
||||
$cansee=true;
|
||||
$canupdate=true;
|
||||
$canadd=true;
|
||||
}
|
||||
else {
|
||||
$canupdate=false;
|
||||
$canadd=false;
|
||||
$cansee=false;
|
||||
|
||||
// Profilage
|
||||
|
@ -157,8 +153,7 @@ class CalendarRepository extends EntityRepository
|
|||
|
||||
// Est-il manager du groupe
|
||||
if($group->getGroup()->getFgcanshare()) {
|
||||
if($group->getRolegroup()>=90) $canupdate=true;
|
||||
if($group->getRolegroup()>=50) $canadd=true;
|
||||
if($group->getFgmanager()) $canupdate=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +161,7 @@ class CalendarRepository extends EntityRepository
|
|||
}
|
||||
|
||||
public function getInwriter($user,$calendar) {
|
||||
$can=false;
|
||||
$canadd=false;
|
||||
|
||||
if($user) {
|
||||
// Peut ecrire ceux qui sont manager du groupe auquel est rattaché le calendar
|
||||
|
@ -178,56 +173,22 @@ class CalendarRepository extends EntityRepository
|
|||
->from('CadolesCoreBundle:UserGroup','usergroup')
|
||||
->andwhere('usergroup.group MEMBER OF calendar.groups')
|
||||
->andwhere('usergroup.user=user')
|
||||
->andwhere('usergroup.rolegroup>=:role')
|
||||
->andwhere('usergroup.fgmanager=:flag')
|
||||
|
||||
->from('CadolesCoreBundle:Group','groupe')
|
||||
->andwhere('groupe=usergroup.group')
|
||||
->andwhere('groupe.fgcanshare=:flag')
|
||||
|
||||
->setParameter("id",$calendar->getId())
|
||||
->setParameter("role",50)
|
||||
->setparameter('user',$user)
|
||||
->setparameter('flag',true);
|
||||
|
||||
|
||||
$inblogwriters=$qb->getQuery()->getResult();
|
||||
|
||||
if($inblogwriters) $can=true;
|
||||
if($inblogwriters) $canadd=true;
|
||||
}
|
||||
|
||||
return $can;
|
||||
}
|
||||
|
||||
public function getInmanager($user,$calendar) {
|
||||
$can=false;
|
||||
|
||||
if($user) {
|
||||
// Peut ecrire ceux qui sont manager du groupe auquel est rattaché le calendar
|
||||
$qb = $this->createQueryBuilder("calendar");
|
||||
$qb ->andWhere("calendar.id=:id")
|
||||
->from('CadolesCoreBundle:User','user')
|
||||
->andwhere("user=:user")
|
||||
|
||||
->from('CadolesCoreBundle:UserGroup','usergroup')
|
||||
->andwhere('usergroup.group MEMBER OF calendar.groups')
|
||||
->andwhere('usergroup.user=user')
|
||||
->andwhere('usergroup.rolegroup>=:role')
|
||||
|
||||
->from('CadolesCoreBundle:Group','groupe')
|
||||
->andwhere('groupe=usergroup.group')
|
||||
->andwhere('groupe.fgcanshare=:flag')
|
||||
|
||||
->setParameter("id",$calendar->getId())
|
||||
->setParameter("role",90)
|
||||
->setparameter('user',$user)
|
||||
->setparameter('flag',true);
|
||||
|
||||
|
||||
$inblogwriters=$qb->getQuery()->getResult();
|
||||
|
||||
if($inblogwriters) $can=true;
|
||||
}
|
||||
|
||||
return $can;
|
||||
return $canadd;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,12 +100,10 @@ class CalendareventRepository extends EntityRepository
|
|||
// On récupère soit les calendriers du group en cours soit l'ensemble des calendriers de l'utilisateur
|
||||
if($usage=="group") {
|
||||
$calendars=$em->getRepository("CadolesPortalBundle:Calendar")->getCalendarsGroup($user,$group);
|
||||
if($calendars) $firstcalendar=$calendars[0]->getId();
|
||||
}
|
||||
else {
|
||||
$em->getRepository("CadolesPortalBundle:Calendar")->getCalendarsUser($user,$calendarssuser,$calendarsadmin,$calendarsshared);
|
||||
$calendars=array_merge($calendarssuser,$calendarsadmin->toArray(),$calendarsshared);
|
||||
$firstcalendar="all";
|
||||
}
|
||||
|
||||
// Début & fin
|
||||
|
@ -186,6 +184,7 @@ class CalendareventRepository extends EntityRepository
|
|||
else {
|
||||
$em->getRepository("CadolesPortalBundle:Project")->getProjectsUser($user,$projectssuser,$projectsadmin,$projectsshared);
|
||||
$projects=array_merge($projectssuser,$projectsadmin->toArray(),$projectsshared);
|
||||
$firstcalendar="all";
|
||||
}
|
||||
|
||||
foreach($projects as $project) {
|
||||
|
|
|
@ -128,7 +128,7 @@ class PageRepository extends EntityRepository
|
|||
else {
|
||||
// Si l'utilisateur est manager du group il aura les permissions de modification sur la page
|
||||
$usergroup=$this->getEntityManager()->getRepository("CadolesCoreBundle:UserGroup")->findOneBy(["user"=>$user,"group"=>$groupshared]);
|
||||
if($usergroup&&$usergroup->getRolegroup()>=90) {
|
||||
if($usergroup&&$usergroup->getFgmanager()) {
|
||||
foreach($pagesshared as $key2 => $pageshared) {
|
||||
$pagesshared[$key2]->setCanupdate(true);
|
||||
}
|
||||
|
@ -298,12 +298,11 @@ class PageRepository extends EntityRepository
|
|||
}
|
||||
}
|
||||
|
||||
public function getPermission($user,$page,&$cansee,&$canupdate,&$canadd) {
|
||||
public function getPermission($user,$page,&$cansee,&$canupdate) {
|
||||
// si page de l'utilisateur
|
||||
if($page->getUser()==$user&&!is_null($user)) {
|
||||
$cansee=true;
|
||||
$canupdate=true;
|
||||
$canadd=true;
|
||||
}
|
||||
else {
|
||||
$canupdate=false;
|
||||
|
@ -362,8 +361,7 @@ class PageRepository extends EntityRepository
|
|||
$cansee=true;
|
||||
// Est-il manager du groupe
|
||||
if($group->getGroup()->getFgcanshare()) {
|
||||
if($group->getRolegroup()>=90) $canupdate=true;
|
||||
if($group->getRolegroup()>=50) $canadd=true;
|
||||
if($group->getFgmanager()) $canupdate=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,6 +68,34 @@ class ProjectRepository extends EntityRepository
|
|||
|
||||
// projects partagées
|
||||
$projectsshared=[];
|
||||
/*
|
||||
if($user) {
|
||||
$projectsshared=$this->createQueryBuilder('project')
|
||||
->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 project.groups')
|
||||
->andWhere('project.user != :user')
|
||||
->andWhere('project.user is not null')
|
||||
->andWhere('proprio.user=project.user')
|
||||
->andWhere('proprio.group=g')
|
||||
->setParameter('fgcanshare',true)
|
||||
->setParameter('user',$user)
|
||||
->addOrderBy('project.name', 'ASC')
|
||||
->getQuery()->getResult();
|
||||
}
|
||||
|
||||
// Permission sur les projects
|
||||
if($projectsshared) {
|
||||
foreach($projectsshared as $projectshared) {
|
||||
$projectshared->setCanupdate(false);
|
||||
$projectshared->setCanadd($this->getInwriter($user,$projectshared));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Initialisation du calcul des projects
|
||||
$projectsadmin=new ArrayCollection();
|
||||
|
@ -101,7 +129,7 @@ class ProjectRepository extends EntityRepository
|
|||
|
||||
// Permission sur les projects
|
||||
foreach($projectsadmin as $projectadmin) {
|
||||
$projectadmin->setCanupdate($this->getInmanager($user,$projectadmin));
|
||||
$projectadmin->setCanupdate(false);
|
||||
$projectadmin->setCanadd($this->getInwriter($user,$projectadmin));
|
||||
}
|
||||
}
|
||||
|
@ -122,6 +150,28 @@ class ProjectRepository extends EntityRepository
|
|||
$roles=($user?$user->getRoles():["ROLE_ANONYME"]);
|
||||
$groups=($user?$user->getGroups():[]);
|
||||
|
||||
// Le project est-il dans les projects associés à un partage de group ?
|
||||
/*
|
||||
$inprojectsshared=$this->createQueryBuilder('project')
|
||||
->from('CadolesCoreBundle:Group','g')
|
||||
->from('CadolesCoreBundle:UserGroup','ug')
|
||||
->from('CadolesCoreBundle:UserGroup','proprio')
|
||||
->where('g.fgcanshare=:fgcanshare')
|
||||
->andWhere('project.id = :id')
|
||||
->andWhere('g=ug.group')
|
||||
->andWhere('ug.user=:user')
|
||||
->andWhere('g MEMBER OF project.groups')
|
||||
->andWhere('project.user != :user')
|
||||
->andWhere('project.user is not null')
|
||||
->andWhere('proprio.user=project.user')
|
||||
->andWhere('proprio.group=g')
|
||||
->setParameter("id",$project->getId())
|
||||
->setParameter('fgcanshare',true)
|
||||
->setParameter('user',$user)
|
||||
->getQuery()->getResult();
|
||||
if($inprojectsshared) $cansee=true;
|
||||
*/
|
||||
|
||||
// Le project est-il dans les projects associés au role de l'utilisateur ?
|
||||
foreach($roles as $role) {
|
||||
$qb = $this->createQueryBuilder("project");
|
||||
|
@ -148,8 +198,7 @@ class ProjectRepository extends EntityRepository
|
|||
|
||||
// Est-il manager du groupe
|
||||
if($group->getGroup()->getFgcanshare()) {
|
||||
if($group->getRolegroup()>=90) $canupdate=true;
|
||||
if($group->getRolegroup()>=0) $canadd=true;
|
||||
if($group->getFgmanager()) $canadd=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +210,7 @@ class ProjectRepository extends EntityRepository
|
|||
}
|
||||
|
||||
public function getInwriter($user,$project) {
|
||||
$can=false;
|
||||
$canadd=false;
|
||||
|
||||
if($user) {
|
||||
// Peut ecrire ceux qui sont déclaré comme écrivain
|
||||
|
@ -180,7 +229,7 @@ class ProjectRepository extends EntityRepository
|
|||
->setparameter('user',$user);
|
||||
|
||||
$inprojectwriters=$qb->getQuery()->getResult();
|
||||
if($inprojectwriters) $can=true;
|
||||
if($inprojectwriters) $canadd=true;
|
||||
|
||||
// Peut ecrire ceux qui sont manager du groupe auquel est rattaché le project
|
||||
$qb = $this->createQueryBuilder("project");
|
||||
|
@ -191,7 +240,7 @@ class ProjectRepository extends EntityRepository
|
|||
->from('CadolesCoreBundle:UserGroup','usergroup')
|
||||
->andwhere('usergroup.group MEMBER OF project.groups')
|
||||
->andwhere('usergroup.user=:user')
|
||||
->andwhere('usergroup.rolegroup>=:role')
|
||||
->andwhere('usergroup.fgmanager=:flag')
|
||||
|
||||
->from('CadolesCoreBundle:Group','groupe')
|
||||
->andwhere('groupe=usergroup.group')
|
||||
|
@ -199,80 +248,13 @@ class ProjectRepository extends EntityRepository
|
|||
|
||||
->setParameter("id",$project->getId())
|
||||
->setparameter('user',$user)
|
||||
->setparameter('flag',true)
|
||||
->setparameter('role',0);
|
||||
->setparameter('flag',true);
|
||||
|
||||
|
||||
$inprojectwriters=$qb->getQuery()->getResult();
|
||||
if($inprojectwriters) $can=true;
|
||||
if($inprojectwriters) $canadd=true;
|
||||
}
|
||||
|
||||
return $can;
|
||||
return $canadd;
|
||||
}
|
||||
|
||||
public function getInmanager($user,$project) {
|
||||
$can=false;
|
||||
|
||||
if($user) {
|
||||
// Peut ecrire ceux qui sont manager du groupe auquel est rattaché le project
|
||||
$qb = $this->createQueryBuilder("project");
|
||||
$qb ->andWhere("project.id=:id")
|
||||
->from('CadolesCoreBundle:User','user')
|
||||
->andwhere("user=:user")
|
||||
|
||||
->from('CadolesCoreBundle:UserGroup','usergroup')
|
||||
->andwhere('usergroup.group MEMBER OF project.groups')
|
||||
->andwhere('usergroup.user=user')
|
||||
->andwhere('usergroup.rolegroup>=:role')
|
||||
|
||||
->from('CadolesCoreBundle:Group','groupe')
|
||||
->andwhere('groupe=usergroup.group')
|
||||
->andwhere('groupe.fgcanshare=:flag')
|
||||
|
||||
->setParameter("id",$project->getId())
|
||||
->setParameter("role",90)
|
||||
->setparameter('user',$user)
|
||||
->setparameter('flag',true);
|
||||
|
||||
|
||||
$inblogwriters=$qb->getQuery()->getResult();
|
||||
|
||||
if($inblogwriters) $can=true;
|
||||
}
|
||||
|
||||
return $can;
|
||||
}
|
||||
|
||||
public function getInvalideur($user,$project) {
|
||||
$can=false;
|
||||
|
||||
if($user) {
|
||||
// Peut ecrire ceux qui sont manager du groupe auquel est rattaché le project
|
||||
$qb = $this->createQueryBuilder("project");
|
||||
$qb ->andWhere("project.id=:id")
|
||||
->from('CadolesCoreBundle:User','user')
|
||||
->andwhere("user=:user")
|
||||
|
||||
->from('CadolesCoreBundle:UserGroup','usergroup')
|
||||
->andwhere('usergroup.group MEMBER OF project.groups')
|
||||
->andwhere('usergroup.user=user')
|
||||
->andwhere('usergroup.rolegroup>=:role')
|
||||
|
||||
->from('CadolesCoreBundle:Group','groupe')
|
||||
->andwhere('groupe=usergroup.group')
|
||||
->andwhere('groupe.fgcanshare=:flag')
|
||||
|
||||
->setParameter("id",$project->getId())
|
||||
->setParameter("role",50)
|
||||
->setparameter('user',$user)
|
||||
->setparameter('flag',true);
|
||||
|
||||
|
||||
$inblogwriters=$qb->getQuery()->getResult();
|
||||
|
||||
if($inblogwriters) $can=true;
|
||||
}
|
||||
|
||||
return $can;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
<div class="blogtitle">
|
||||
<legend><h1>{{entity.name}}</h1></legend>
|
||||
<small>publié par {{ entity.user.username }} le {{ entity.submit|date("d/m/Y à H:i") }} dans le blog {{entity.blog.name }}</small>
|
||||
{% if canupdate %}
|
||||
{% if canadd %}
|
||||
<a href="{{ path("cadoles_portal_"~access~"_blogarticle_update",{'id':entity.id}) }}"><i class="fa fa-file"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
@ -87,7 +87,7 @@
|
|||
<div class="blogtitle">
|
||||
<legend><h2>{{comment.name}}</h2></legend>
|
||||
<small>publié par {{ comment.user.username }} le {{ comment.submit|date("d/m/Y à H:i") }}</small>
|
||||
{% if canupdate or app.user==comment.user%}
|
||||
{% if canadd or app.user==comment.user%}
|
||||
<a href="{{ path("cadoles_portal_"~access~"_blogcomment_update",{'id':comment.id}) }}"><i class="fa fa-file"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
@ -100,7 +100,7 @@
|
|||
<div class="blogtitle">
|
||||
<legend><h2 style="font-size:85%">{{reply.name}}</h2></legend>
|
||||
<small>publié par {{ reply.user.username }} le {{ reply.submit|date("d/m/Y à H:i") }}</small>
|
||||
{% if canupdate or app.user==reply.user%}
|
||||
{% if canadd or app.user==reply.user%}
|
||||
<a href="{{ path("cadoles_portal_"~access~"_blogcomment_update",{'id':reply.id}) }}"><i class="fa fa-file"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
{% 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 href="{{ path("cadoles_portal_user_calendar_view",{'id':calendar.id}) }}">
|
||||
{% if not calendar.groups is empty %}
|
||||
<i class="fa fa-users fa-fw"></i>
|
||||
|
@ -31,7 +33,7 @@
|
|||
<i class="fa fa-user fa-fw"></i>
|
||||
{%endif%}
|
||||
{{ calendar.name }}
|
||||
{% if calendar.canadd %}
|
||||
{% if calendar.canupdate %}
|
||||
<i class="fa fa-pencil"></i>
|
||||
{% else %}
|
||||
<i class="fa fa-lock"></i>
|
||||
|
@ -79,7 +81,7 @@
|
|||
{% endfor %}
|
||||
{% else %}
|
||||
{% for calendar in calendars %}
|
||||
{% if calendar.canadd %}
|
||||
{% if calendar.canupdate %}
|
||||
<option value='{{ calendar.id}}'>{{ calendar.name}}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
@ -160,7 +162,7 @@
|
|||
{% endfor %}
|
||||
{% else %}
|
||||
{% for calendar in calendars %}
|
||||
{% if calendar.canadd %}
|
||||
{% if calendar.canupdate %}
|
||||
<option value='{{ calendar.id}}'>{{ calendar.name}}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
@ -288,13 +290,13 @@
|
|||
{% if entity.id is defined %}
|
||||
{% for calendar in calendars %}
|
||||
{% if calendar.id==entity.id %}
|
||||
showCalendar({{ calendar.id }}, {{ calendar.canadd }});
|
||||
showCalendar({{ calendar.id }}, {{ calendar.canupdate }});
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% set onecalendarcanupdate = false %}
|
||||
{% for calendar in calendars %}
|
||||
{% if calendar.canadd %}
|
||||
{% if calendar.canupdate %}
|
||||
{% set onecalendarcanupdate = true %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
@ -332,7 +334,7 @@
|
|||
}
|
||||
|
||||
// Affichages des calendars
|
||||
function showCalendar(id,canadd) {
|
||||
function showCalendar(id,canupdate) {
|
||||
|
||||
|
||||
idcalendar=id;
|
||||
|
@ -357,9 +359,9 @@
|
|||
$('#calendar').fullCalendar( 'destroy' );
|
||||
$('#calendar').fullCalendar({
|
||||
lang: 'fr',
|
||||
selectable: canadd,
|
||||
selectable: canupdate,
|
||||
selectHelper: true,
|
||||
editable: canadd,
|
||||
editable: canupdate,
|
||||
eventLimit: true,
|
||||
defaultView: defautView,
|
||||
|
||||
|
|
|
@ -33,26 +33,18 @@
|
|||
{% endif %}
|
||||
|
||||
{% if access=="config" %}
|
||||
<a title="Gérer mes Blogs" href='{{ path('cadoles_portal_config_blog') }}' style="{{ stylewidgetmenu }}"><i class="fa fa-th fa-fw"></i></a>
|
||||
<a title="Gérer mes Blogs" href='{{ path('cadoles_portal_config_blog') }}' style="{{ stylewidgetmenu }}"><i class="fa fa-plus fa-fw"></i></a>
|
||||
{% else %}
|
||||
{% if canadd %}
|
||||
{% set idblog = "" %}
|
||||
{% set url= path('cadoles_portal_user_blogarticle_submit') %}
|
||||
{% if usage=="group" and firstblog is defined %}
|
||||
{% set url= path('cadoles_portal_user_blogarticle_submit',{idblog:firstblog,page:entity.page.id}) %}
|
||||
{% endif %}
|
||||
|
||||
<a title="Créer un Article" onClick="showFrameitem('blog','{{ url }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-plus fa-fw"></i></a>
|
||||
{% endif %}
|
||||
|
||||
{% set url= path('cadoles_portal_user_blog_view') %}
|
||||
{% if usage=="group" and firstblog is defined %}
|
||||
{% set url= path('cadoles_portal_user_blog_view',{id:firstblog}) %}
|
||||
{% endif %}
|
||||
|
||||
<a title="Voir mes Blogs" onClick="showFrameitem('blog','{{ url }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-th fa-fw"></i></a>
|
||||
{% set idblog = "" %}
|
||||
{% set url= path('cadoles_portal_user_blogarticle_submit') %}
|
||||
{% if usage=="group" and firstblog is defined %}
|
||||
{% set url= path('cadoles_portal_user_blogarticle_submit',{idblog:firstblog,page:entity.page.id}) %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
<a title="Créer un Article" onClick="showFrameitem('blog','{{ url }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-plus fa-fw"></i></a>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if look=="list" %}
|
||||
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
|
||||
{% else %}
|
||||
|
|
|
@ -51,10 +51,7 @@
|
|||
{% if canupdate %}
|
||||
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
|
||||
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
|
||||
{% endif %}
|
||||
|
||||
{% if canadd %}
|
||||
<i class="fa fa-plus fa-fw" title="Ajouter un Favori" onClick="addBookmark({{ entity.id }},false)" style="{{ stylewidgetmenu }}"></i>
|
||||
<i class="fa fa-plus fa-fw" title="Ajouter un Favori" onClick="addBookmark({{ entity.id }},false)" style="{{ stylewidgetmenu }}"></i>
|
||||
{% endif %}
|
||||
|
||||
{% if look=="list" %}
|
||||
|
@ -73,7 +70,7 @@
|
|||
<span class="title">{{ entity.name }}</span>
|
||||
</div>
|
||||
|
||||
{% if bookmarks is not empty or canadd %}
|
||||
{% if bookmarks is not empty or canupdate %}
|
||||
<div class="widgetbody" style="{{ stylewidgetbody }}">
|
||||
<div class="bookmark-container">
|
||||
<div class="grid clearfix">
|
||||
|
@ -82,7 +79,7 @@
|
|||
{% for bookmark in bookmarks %}
|
||||
<div class="grid-item {{ stylegrid }}">
|
||||
<div class="grid-item-content" style="background-color: {{ bookmark.color ? "#"~bookmark.color : "#"~color['main'] }};">
|
||||
{% if canadd %}
|
||||
{% if canupdate %}
|
||||
<a style="cursor:pointer" onClick="modBookmark({{ bookmark.id }})" class="item-update"><i style="color: #FFF" class="fa fa-file" title="Modifier le favori"></i></a>
|
||||
{% endif %}
|
||||
|
||||
|
@ -113,7 +110,7 @@
|
|||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% if canadd %}
|
||||
{% if canupdate %}
|
||||
<div class="grid-item {{ stylegrid }}">
|
||||
<div title="Ajouter un Favori" onClick="addBookmark({{ entity.id }},false)" class="grid-item-content" style="background-color: #{{color['main']}};cursor:pointer;">
|
||||
<div class="item-link clearfix">
|
||||
|
|
|
@ -64,16 +64,16 @@
|
|||
<span class="title">{{ entity.name }}</span>
|
||||
</div>
|
||||
|
||||
{% if files|length>0 or canadd %}
|
||||
{% if files|length>0 or canupdate %}
|
||||
<div class="widgetbody" style="{{ stylewidgetbody }}">
|
||||
<div class="grid clearfix">
|
||||
{% if canadd %}
|
||||
{% if canupdate %}
|
||||
<div class="grid-sizer grid-image"></div>
|
||||
<div class="grid-gutter-sizer"></div>
|
||||
{% endif %}
|
||||
|
||||
{% for file in files|sort %}
|
||||
{% if loop.index==1 and not canadd %}
|
||||
{% if loop.index==1 and not canupdate %}
|
||||
<div class="grid-sizer grid-image"></div>
|
||||
<div class="grid-gutter-sizer grid-gutter-sizer-image"></div>
|
||||
{% endif %}
|
||||
|
|
|
@ -99,11 +99,7 @@
|
|||
<div class="grid-item-title">
|
||||
<h2 style="{{ stylewidgetbodyreverse }};">
|
||||
{{ member.user.lastname }} {{ member.user.firstname }}
|
||||
{% if member.rolegroup==100 %}
|
||||
<br><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i>
|
||||
{% elseif member.rolegroup==90 %}
|
||||
<br><i class="fa fa-star"></i><i class="fa fa-star"></i>
|
||||
{% elseif member.rolegroup==50 %}
|
||||
{% if member.fgmanager %}
|
||||
<br><i class="fa fa-star"></i>
|
||||
{% endif %}
|
||||
</h2>
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
|
||||
{% if (bookmarks is not empty or (canadd and access!="config")) and withbookmark==0 %}
|
||||
<div class="bookmark-container">
|
||||
<h3 class="grid-title bookmark-container" data-idcategory="bookmark" style="{{ colorbodyfont }}">{{app.session.get('labelbookmarkuser')}}</h3>
|
||||
<h3 class="grid-title bookmark-container" data-idcategory="bookmark" style="{{ colorbodyfont }}">Favoris</h3>
|
||||
<div class="grid clearfix">
|
||||
<div class="grid-sizer {{ stylegrid }}" data-idcategory="bookmark"></div>
|
||||
<div class="grid-gutter-sizer {{ stylegrid }}-gutter-sizer"></div>
|
||||
|
@ -169,7 +169,7 @@
|
|||
{% for bookmark in bookmarks if bookmark.item %}
|
||||
{% if loop.first %}
|
||||
{% set haveressource=true %}
|
||||
<h3 class="grid-title bookmark-container" data-idcategory="bookmark" style="{{ colorbodyfont }}">{{app.session.get('labelbookmarkitem')}}</h3>
|
||||
<h3 class="grid-title bookmark-container" data-idcategory="bookmark" style="{{ colorbodyfont }}">Mes Ressources</h3>
|
||||
<div class="grid clearfix">
|
||||
<div class="grid-sizer {{ stylegrid }}" data-idcategory="bookmark"></div>
|
||||
<div class="grid-gutter-sizer {{ stylegrid }}-gutter-sizer"></div>
|
||||
|
|
|
@ -40,16 +40,13 @@
|
|||
|
||||
{% if access=="config" %}
|
||||
<a href='{{ path('cadoles_portal_config_project') }}' style="{{ stylewidgetmenu }}"><i class="fa fa-plus fa-fw"></i></a>
|
||||
{% elseif app.user %}
|
||||
{% else %}
|
||||
{% set idproject = "" %}
|
||||
{% set urladd= path('cadoles_portal_user_projecttask_submit') %}
|
||||
{% set urlview= path('cadoles_portal_user_project_view') %}
|
||||
{% set url= path('cadoles_portal_user_projecttask_submit') %}
|
||||
{% if usage=="group" and firstproject is defined %}
|
||||
{% set urladd= path('cadoles_portal_user_projecttask_submit',{idproject:firstproject,page:entity.page.id}) %}
|
||||
{% set urlview= path('cadoles_portal_user_project_view',{id:firstproject}) %}
|
||||
{% set url= path('cadoles_portal_user_projecttask_submit',{idproject:firstproject,page:entity.page.id}) %}
|
||||
{% endif %}
|
||||
<a onClick="showFrameitem('project','{{ urladd }}',true)" style="{{ stylewidgetmenu }}" title="Ajouter une Tâche"><i class="fa fa-plus fa-fw"></i></a>
|
||||
<a onClick="showFrameitem('project','{{ urlview }}',true)" style="{{ stylewidgetmenu }}" title="Gérer mes Tâches"><i class="fa fa-th fa-fw"></i></a>
|
||||
<a onClick="showFrameitem('project','{{ url }}',true)" style="{{ stylewidgetmenu }}" title="Ajouter une Tâche"><i class="fa fa-plus fa-fw"></i></a>
|
||||
{% endif %}
|
||||
|
||||
{% if look=="list" %}
|
||||
|
|
|
@ -170,7 +170,7 @@
|
|||
{% if entity.id is defined %}
|
||||
{% for project in projects %}
|
||||
{% if project.id==entity.id %}
|
||||
showProject({{ project.id }}, {{ project.canadd }});
|
||||
showProject({{ project.id }}, {{ project.canupdate }});
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
|
|
|
@ -61,7 +61,7 @@ class ChatController extends Controller
|
|||
|
||||
|
||||
// Récupération des message parent du groupe
|
||||
$messages=$em->getRepository("CadolesWebsocketBundle:Message")->findBy(["group"=>$group,"parent"=>null],["submitdate"=>"DESC"]);
|
||||
$messages=$em->getRepository("CadolesWebsocketBundle:Message")->findBy(["group"=>$group,"parent"=>null],["submitdate"=>"DESC"],30);
|
||||
foreach($messages as $message) {
|
||||
$haveread = ($message->getReaders()->contains($user));
|
||||
$havesee = ($message->getSees()->contains($user));
|
||||
|
@ -109,7 +109,7 @@ class ChatController extends Controller
|
|||
'colorbody' => $colorbody,
|
||||
'colormain' => $colormain,
|
||||
'ingroup' => ($usergroup),
|
||||
'canmanage' => ($usergroup&&($usergroup->getRolegroup()>=90||$user->getRole()=="ROLE_ADMIN"||$user->getRole()=="ROLE_MODO")),
|
||||
'fgmanager' => ($usergroup&&($usergroup->getFgmanager()||$user->getRole()=="ROLE_ADMIN"||$user->getRole()=="ROLE_MODO")),
|
||||
'form' => $form->createView()
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,6 @@
|
|||
width:100%;
|
||||
margin:20px 0px 5px 0px;
|
||||
height:150px;
|
||||
color:#000000;
|
||||
}
|
||||
.sendreply { width:100%}
|
||||
|
||||
|
@ -128,7 +127,7 @@
|
|||
<div id='message-{{message.id}}' class='message row {{classread}} {{classsee}}'>
|
||||
<div class='msgavatar'>
|
||||
<img style='cursor:pointer' onclick='seeUser({{message.user.id}})' id='user_avatar_img' src='/{{ alias }}/uploads/avatar/{{message.user.avatar}}' class='avatar'><br>
|
||||
{% if canmanage or message.user == app.user %}
|
||||
{% if fgmanager or message.user == app.user %}
|
||||
<i class='delmessage fa fa-trash fa-fw' data-id='{{message.id}}' title='Supprimer' style='cursor: pointer;'></i>
|
||||
{% endif %}
|
||||
{% if not message.havesee %}
|
||||
|
@ -159,7 +158,7 @@
|
|||
|
||||
<div style='cursor:pointer' onclick='seeUser({{child.user.id}})'><small>{{ child.user.lastname }} {{ child.user.firstname }}</small></div>
|
||||
<small>{{child.submitdate|date('d/m/Y H:i')}}</small>
|
||||
{% if canmanage or child.user == app.user %}
|
||||
{% if fgmanager or child.user == app.user %}
|
||||
<i class='delmessage fa fa-trash fa-fw' data-id='{{child.id}}' title='Supprimer' style='cursor: pointer;'></i>
|
||||
{% endif %}
|
||||
{% if not child.havesee %}
|
||||
|
@ -391,7 +390,7 @@
|
|||
html ="<div id='message-"+payload.msg.id+"' class='message row message-toread'>";
|
||||
html+="<div class='msgavatar'>";
|
||||
html+="<img style='pointer:cursor' onclick='seeUser("+payload.msg.userid+")' id='user_avatar_img' src='/{{ alias }}/uploads/avatar/"+payload.msg.avatar+"' class='avatar'><br>";
|
||||
if(payload.msg.userid=={{app.user.id}} || '{{ canmanage }}'=='1') {
|
||||
if(payload.msg.userid=={{app.user.id}} || '{{ fgmanager }}'=='1') {
|
||||
html+="<i class='delmessage fa fa-trash fa-fw' data-id='"+payload.msg.id+"' title='Supprimer' style='cursor: pointer;'></i>";
|
||||
}
|
||||
html+="<i id='hidemessage-"+payload.msg.id+"' class='hidemessage fa fa-eye-slash fa-fw' data-id='"+payload.msg.id+"' title='Ne plus afficher' style='cursor: pointer;'></i>";
|
||||
|
@ -423,7 +422,7 @@
|
|||
html+=nl2br(payload.msgreply.message);
|
||||
html+="<div style='cursor:pointer' onclick='seeUser("+payload.msgreply.userid+")'><small>"+payload.msgreply.lastname+"</small></div>";
|
||||
html+="<small>"+new Date(payload.msgreply.submitdate.date).toLocaleDateString("fr-FR", dateoptions)+"</small>";
|
||||
if(payload.msgreply.userid=={{app.user.id}} || '{{ canmanage }}'=='1') {
|
||||
if(payload.msgreply.userid=={{app.user.id}} || '{{ fgmanager }}'=='1') {
|
||||
html+="<i class='delmessage fa fa-trash fa-fw' data-id='"+payload.msgreply.id+"' title='Supprimer' style='cursor: pointer;'></i>";
|
||||
}
|
||||
html+="<i id='hidemessage-"+payload.msgreply.id+"' class='hidemessage fa fa-eye-slash fa-fw' data-id='"+payload.msgreply.id+"' title='Ne plus afficher' style='cursor: pointer;'></i>";
|
||||
|
@ -792,7 +791,7 @@
|
|||
html ="<div id='message-"+data.id+"' class='message row message-toread'>";
|
||||
html+="<div class='msgavatar'>";
|
||||
html+="<img style='cursor:pointer' onclick='seeUser("+data.userid+")' id='user_avatar_img' src='/{{ alias }}/uploads/avatar/"+data.useravatar+"' class='avatar'><br>";
|
||||
if(data.userid=={{app.user.id}} || '{{ canmanage }}'=='1') {
|
||||
if(data.userid=={{app.user.id}} || '{{ fgmanager }}'=='1') {
|
||||
html+="<i class='delmessage fa fa-trash fa-fw' data-id='"+data.id+"' style='cursor: pointer;'></i>";
|
||||
}
|
||||
if (!data.havesee) {
|
||||
|
@ -822,7 +821,7 @@
|
|||
html+=nl2br(child.message);
|
||||
html+="<div style='cursor:pointer' onclick='seeUser("+child.userid+")'><small>"+child.userlastname+"</small></div>";
|
||||
html+="<small>"+new Date(child.submitdate.date).toLocaleDateString("fr-FR", dateoptions)+"</small>";
|
||||
if(child.userid=={{app.user.id}} || '{{ canmanage }}'=='1') {
|
||||
if(child.userid=={{app.user.id}} || '{{ fgmanager }}'=='1') {
|
||||
html+="<i class='delmessage fa fa-trash fa-fw' data-id='"+child.id+"' title='Supprimer' style='cursor: pointer;'></i>";
|
||||
}
|
||||
html+="<i id='hidemessage-"+child.id+"' class='hidemessage fa fa-eye-slash fa-fw' data-id='"+child.id+"' title='Ne plus afficher' style='cursor: pointer;'></i>";
|
||||
|
|
|
@ -210,7 +210,7 @@ class WebsocketTopic implements TopicInterface
|
|||
|
||||
if($event["type"]=="del") {
|
||||
$message=$this->em->getRepository("CadolesWebsocketBundle:Message")->find($event["id"]);
|
||||
if($message&&($usergroup->getRolegroup()>=90||$message->getUser()==$user||$user->getRole()=="ROLE_ADMIN"||$user->getRole()=="ROLE_MODO" )) {
|
||||
if($message&&($usergroup->getFgmanager()||$message->getUser()==$user||$user->getRole()=="ROLE_ADMIN"||$user->getRole()=="ROLE_MODO" )) {
|
||||
$id=$message->getId();
|
||||
$this->em->remove($message);
|
||||
$this->em->flush();
|
||||
|
|
|
@ -121,9 +121,6 @@ INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type
|
|||
|
||||
('500', 1, 1, 1, 'permgroup', 'permgroup', 'ROLE_ANIM', '', 'Determine quel rôle aura la permission de créer des groupes de travail'),
|
||||
('501', 1, 1, 1, 'permgroup', 'permannu', 'ROLE_USER', '', 'Determine quel rôle aura la permission de voir l\'annuaire'),
|
||||
('502', 1, 1, 1, 'boolean', 'permunsubscribe', '0', '', 'Permettre aux utilisateurs de se désinscrire par eux-mêmes des groupes de travail'),
|
||||
|
||||
('600', 1, 1, 1, 'string', 'labelbookmarkuser','Favoris', '', 'Titre sur la section des bookmark ajoutés par l\'utilisateur sur le bureau'),
|
||||
('601', 1, 1, 1, 'string', 'labelbookmarkitem','Mes Ressources', '', 'Titre sur la section des items ajoutés en favoris par l\'utilisateur sur le bureau');
|
||||
('502', 1, 1, 1, 'boolean', 'permunsubscribe', '0', '', 'Permettre aux utilisateurs de se désinscrire par eux-mêmes des groupes de travail');
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue