Compare commits

...

21 Commits

Author SHA1 Message Date
Arnaud Fornerot 362047c295 Merge branch 'master' into dist/envole/6/master 2020-04-16 16:11:00 +02:00
afornerot 15ff441ca7 controle existance user avant inviation groupe (ref #107) 2020-04-16 16:06:35 +02:00
afornerot e341a30f7f plus d'apercu pour les fichiers pdf (ref #121) 2020-04-16 15:01:23 +02:00
afornerot 5f66580100 commentaire sur projecttask (ref #19) 2020-04-16 14:13:24 +02:00
afornerot dfdf3ff9f5 finalisation widget project (ref #19) 2020-04-16 11:51:48 +02:00
afornerot 6ffa8a20bf pj sur projecttask (ref #19) 2020-04-16 10:10:11 +02:00
afornerot a74fb27773 correction acces upload icon user (ref #120) 2020-04-16 09:08:04 +02:00
afornerot 6db40533f5 svg 2020-04-15 17:44:17 +02:00
afornerot c9cdc83cd4 svg 2020-04-15 17:41:57 +02:00
afornerot aee20f238a url redirect notif mail chat (ref #101) 2020-04-15 11:51:25 +02:00
afornerot 0105a44141 svg 2020-04-15 10:51:11 +02:00
afornerot 9f0915789b svg 2020-04-15 10:43:15 +02:00
afornerot 866536c457 correction du pb d'apostrophe (ref #116) 2020-04-14 09:07:30 +02:00
afornerot 8feb7406b3 beta gestion projet (ref #19) 2020-04-14 08:56:42 +02:00
afornerot c052b1746e option commentaire dans les articles de blog (ref #112) 2020-04-06 14:51:00 +02:00
afornerot 6a19b43997 ajout avertissement dans mail du chat (ref #101) 2020-04-06 10:44:31 +02:00
afornerot dca6f700e5 initialiser le template de page des groupes de travail (ref #106) 2020-04-06 10:23:27 +02:00
afornerot 8d03012ba1 return to page groupe after add member (ref #109) 2020-04-06 10:15:22 +02:00
afornerot ab3d712a93 siren nullable sur champs user.siren (ref #110) 2020-04-06 09:50:31 +02:00
afornerot 6c1648e184 correction sur validation du password (ref #111) 2020-04-06 09:39:30 +02:00
afornerot f9df134c46 rendre modifiable les inscriptions (ref #113) 2020-04-06 09:28:52 +02:00
82 changed files with 6166 additions and 175 deletions

View File

@ -113,6 +113,9 @@
<variable type="oui/non" name='ninegate_activate_blog' description='Activer le module blog' mandatory='True'>
<value>oui</value>
</variable>
<variable type="oui/non" name='ninegate_activate_project' description='Activer le module projet' mandatory='True'>
<value>oui</value>
</variable>
<variable type="oui/non" name='ninegate_activate_flux' description='Activer le module flux' mandatory='True'>
<value>oui</value>
</variable>
@ -395,6 +398,7 @@
<target type='variable'>ninegate_activate_alert</target>
<target type='variable'>ninegate_activate_calendar</target>
<target type='variable'>ninegate_activate_blog</target>
<target type='variable'>ninegate_activate_project</target>
<target type='variable'>ninegate_activate_flux</target>
<target type='variable'>ninegate_activate_notice</target>
<target type='variable'>ninegate_activate_syncenvole</target>
@ -517,6 +521,7 @@
<target type='variable'>ninegate_activate_alert</target>
<target type='variable'>ninegate_activate_calendar</target>
<target type='variable'>ninegate_activate_blog</target>
<target type='variable'>ninegate_activate_project</target>
<target type='variable'>ninegate_activate_flux</target>
<target type='variable'>ninegate_activate_notice</target>
</condition>

View File

@ -49,6 +49,9 @@ php bin/console Core:InitData --env=prod
php bin/console Cron:InitData --env=prod
php bin/console Portal:InitData --env=prod
# Passage des scripts
php bin/console Core:Script --env=prod
# Generation des assets
bin/console assetic:dump --env=prod

View File

@ -99,6 +99,7 @@ class InitDataCommand extends ContainerAwareCommand
$group->setFgcancreatepage(true);
$group->setFgcancreateblog(true);
$group->setFgcancreatecalendar(true);
$group->setFgcancreateproject(true);
$em->persist($group);
$em->flush();
}

View File

@ -21,6 +21,7 @@ use Cadoles\CoreBundle\Entity\Group;
use Cadoles\CoreBundle\Entity\UserGroup;
use Cadoles\PortalBundle\Entity\Calendar;
use Cadoles\PortalBundle\Entity\Blog;
use Cadoles\PortalBundle\Entity\Project;
use Unirest\Request;
@ -273,7 +274,8 @@ class OnlyCommand extends Command
$group->setFgcanshare(true);
$group->setFgcancreatepage(false);
$group->setFgcancreatecalendar(false);
$group->setFgcancreateblog(false);
$group->setFgcancreateblog(false);
$group->setFgcancreateproject(false);
$group->setFgall(false);
$group->setFgtemplate(false);
$group->setOwner($user);
@ -287,7 +289,7 @@ class OnlyCommand extends Command
// On ajoute le propriétaire en tant que membre du groupe
$this->addMember($group,$user,true);
// On controle que le groupe a bien page / calendrier / blog
// On controle que le groupe a bien page / calendrier / blog / project
$this->ctrlFgcanshare($group,$user,$pagetemplate);
@ -629,7 +631,19 @@ class OnlyCommand extends Command
$this->em->persist($blog);
$this->em->flush();
}
}
// On regarde s'il a au moins un project
if($group->getProjects()->isEmpty()) {
$project=new Project();
$project->setName($group->getLabel());
$project->addGroup($group);
$project->setUser($user);
$this->em->persist($project);
$this->em->flush();
}
}
}

View File

@ -59,7 +59,7 @@ class PurgeFileCommand extends Command
if($fs->exists($directory)) {
$finder = new Finder();
$finder->in($directory)->directories()->exclude("thumb");
$finder->in($directory)->directories()->exclude("thumb")->exclude("thumbmini");
foreach (iterator_to_array($finder) as $file) {
$name = $file->getRelativePathname();
@ -78,8 +78,6 @@ class PurgeFileCommand extends Command
}
break;
}
}
}
@ -323,7 +321,7 @@ class PurgeFileCommand extends Command
if($result) $find=true;
}
// Si pas trouvé on la cherche dans les blogs
// Si pas trouvé on la cherche dans les blogarticle
if(!$find) {
$result = $this->em
->getRepository("CadolesPortalBundle:Blogarticle")->createQueryBuilder('blogarticle')
@ -333,6 +331,16 @@ class PurgeFileCommand extends Command
if($result) $find=true;
}
// Si pas trouvé on la cherche dans les blogcomment
if(!$find) {
$result = $this->em
->getRepository("CadolesPortalBundle:Blogcomment")->createQueryBuilder('blogcomment')
->where('blogcomment.description LIKE :tofind')
->setParameter('tofind', '%'.$tofind.'%')
->getQuery()->getResult();
if($result) $find=true;
}
// Si pas trouvé on supprime
if(!$find) {
$this->writeln($name);

View File

@ -11,7 +11,13 @@ use Symfony\Component\HttpKernel\KernelInterface;
use Doctrine\DBAL\Connection as DBALConnection;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Id\AssignedGenerator;
use Cadoles\CoreBundle\Entity\Script;
use Cadoles\CoreBundle\Entity\User;
use Cadoles\PortalBundle\Entity\Project;
use Cadoles\PortalBundle\Entity\Pagewidget;
global $bdd01;
global $config;
@ -29,8 +35,6 @@ class ScriptCommand extends Command
$this
->setName('Core:Script')
->setDescription('Lauch Script')
->setHelp('Execeute some script : visibletrue / setusersniveau')
->addArgument('scriptname', InputArgument::OPTIONAL, 'scriptname')
;
}
@ -42,19 +46,78 @@ class ScriptCommand extends Command
$this->filesystem = new Filesystem();
$this->rootlog = $this->container->get('kernel')->getRootDir()."/../var/logs/";
$this->writelnred('');
$this->writelnred('== Core:Script');
$this->writelnred('==========================================================================================================');
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"visibletrue"]);
if(!$script) {
$this->writelnred("== SCRIPT = visibletrue");
$this->visibletrue();
$scriptname = $input->getArgument('scriptname');
$this->writeln($scriptname);
switch($scriptname) {
case "visibletrue": $this->visibletrue(); break;
case "setusersniveau": $this->setusersniveau(); break;
$script=new Script();
$script->setName("visibletrue");
$this->em->persist($script);
$this->em->flush();
$this->writeln("");
}
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"setusersniveau"]);
if(!$script) {
$this->writelnred("== SCRIPT = setusersniveau");
$this->setusersniveau();
$script=new Script();
$script->setName("setusersniveau");
$this->em->persist($script);
$this->em->flush();
$this->writeln("");
}
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"setfgcancreateproject"]);
if(!$script) {
$this->writelnred("== SCRIPT = setfgcancreateproject");
$this->setfgcancreateproject();
$script=new Script();
$script->setName("setfgcancreateproject");
$this->em->persist($script);
$this->em->flush();
$this->writeln("");
}
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"createproject"]);
if(!$script) {
$this->writelnred("== SCRIPT = createproject");
$this->createproject();
$script=new Script();
$script->setName("createproject");
$this->em->persist($script);
$this->em->flush();
$this->writeln("");
}
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"createthumbmini"]);
if(!$script) {
$this->writelnred("== SCRIPT = createthumbmini");
$this->createthumbmini();
$script=new Script();
$script->setName("createthumbmini");
$this->em->persist($script);
$this->em->flush();
$this->writeln("");
}
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"createwidgetproject"]);
if(!$script) {
$this->writelnred("== SCRIPT = createwidgetproject");
$this->createwidgetproject();
$script=new Script();
$script->setName("createwidgetproject");
$this->em->persist($script);
$this->em->flush();
$this->writeln("");
}
$this->writeln('');
return 1;
}
@ -84,6 +147,97 @@ class ScriptCommand extends Command
}
}
private function setfgcancreateproject() {
$group=$this->em->getRepository('CadolesCoreBundle:Group')->findOneBy(array('fgall'=>true));
if ($group) {
$group->setFgcancreateproject(true);
$this->em->persist($group);
$this->em->flush();
}
}
private function createproject() {
$groups=$this->em->getRepository('CadolesCoreBundle:Group')->findBy(array('fgcanshare'=>true));
foreach($groups as $group) {
// On regarde s'il a au moins un project
if($group->getProjects()->isEmpty()) {
$project=new Project();
$project->setName($group->getLabel());
$project->addGroup($group);
$project->setUser($group->getOwner());
$this->em->persist($project);
$this->em->flush();
}
}
}
private function createthumbmini() {
$directory=$this->container->get('kernel')->getRootDir()."/../uploads/file";
$files=[];
$fs = new Filesystem();
if($fs->exists($directory)) {
$finder = new Finder();
$finder->in($directory)->directories()->exclude("thumb")->exclude("thumbmini");
foreach (iterator_to_array($finder) as $rep) {
$finder2 = new Finder();
if($fs->exists($rep."/thumb")) {
$finder2->sortByName()->in($rep."/thumb");
foreach ($finder2 as $file) {
if(!$fs->exists($rep."/thumbmini/".$file->getRelativePathname())) {
$this->writeln($file->getRelativePathname());
$fs->mkdir($rep."/thumbmini");
$fs->copy($rep."/thumb/".$file->getRelativePathname(),$rep."/thumbmini/".$file->getRelativePathname());
$max_width=60;
$width = $this->getWidth($rep."/thumbmini/".$file->getRelativePathname());
$height = $this->getHeight($rep."/thumbmini/".$file->getRelativePathname());
$scale = $max_width/$width;
$this->resizeImage($rep."/thumbmini/".$file->getRelativePathname(),$width,$height,$scale);
$fs->chown($rep."/thumbmini/".$file->getRelativePathname(), 'www-data');
}
}
}
}
}
}
private function createwidgetproject(){
$entityPage = $this->em->getRepository('CadolesPortalBundle:Page')->find(-110);
if($entityPage) {
$fields=["fields"=>[]];
$metadata = $this->em->getClassMetaData('CadolesPortalBundle:Pagewidget');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO);
$pages=$this->em->getRepository('CadolesPortalBundle:Page')->findBy(["page"=>$entityPage]);
foreach($pages as $page) {
$this->addWidget2Page($page,-1800,"R1C1",1,"Taches du groupe",true,$fields);
}
$metadata = $this->em->getClassMetaData('CadolesPortalBundle:Pagewidget');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
$this->addWidget(-145,$entityPage,-1800,"R1C1",1,"Taches du groupe",true,$fields);
}
}
private function writelnred($string) {
$this->output->writeln('<fg=red>'.$string.'</>');
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
@ -93,6 +247,109 @@ class ScriptCommand extends Command
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
}
protected function getHeight($image) {
$size = getimagesize($image);
$height = $size[1];
return $height;
}
// Cacul de la largeur
protected function getWidth($image) {
$size = getimagesize($image);
$width = $size[0];
return $width;
}
protected function resizeImage($image,$width,$height,$scale) {
list($imagewidth, $imageheight, $imageType) = getimagesize($image);
$imageType = image_type_to_mime_type($imageType);
$newImageWidth = ceil($width * $scale);
$newImageHeight = ceil($height * $scale);
$newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);
switch($imageType) {
case "image/gif":
$source=imagecreatefromgif($image);
break;
case "image/pjpeg":
case "image/jpeg":
case "image/jpg":
$source=imagecreatefromjpeg($image);
break;
case "image/png":
case "image/x-png":
$source=imagecreatefrompng($image);
break;
}
$newImage = imagecreatetruecolor( $newImageWidth, $newImageHeight );
imagealphablending( $newImage, false );
imagesavealpha( $newImage, true );
imagecopyresampled($newImage,$source,0,0,0,0,$newImageWidth,$newImageHeight,$width,$height);
switch($imageType) {
case "image/gif":
imagegif($newImage,$image);
break;
case "image/pjpeg":
case "image/jpeg":
case "image/jpg":
imagejpeg($newImage,$image,90);
break;
case "image/png":
case "image/x-png":
imagepng($newImage,$image);
break;
}
chmod($image, 0640);
return $image;
}
private function addWidget($id,$entityPage,$widgetid,$loc,$order,$title,$border,$fields) {
$entityPagewidget = $this->em->getRepository('CadolesPortalBundle:Pagewidget')->find($id);
if(!$entityPagewidget) {
$entityWidget = $this->em->getRepository('CadolesPortalBundle:Widget')->find($widgetid);
if($entityWidget) {
$entityPagewidget = new Pagewidget();
$entityPagewidget->setId($id);
$entityPagewidget->setLoc($loc);
$entityPagewidget->setRoworder($order);
$entityPagewidget->setName($title);
$entityPagewidget->setHeight($entityWidget->getHeight());
$entityPagewidget->setAutoajust($entityWidget->getAutoajust());
$entityPagewidget->setBorder($border);
$entityPagewidget->setOpened($entityWidget->getOpened());
$entityPagewidget->setIcon($entityWidget->getIcon());
$entityPagewidget->setPage($entityPage);
$entityPagewidget->setWidget($entityWidget);
$entityPagewidget->setParameter($fields);
$this->em->persist($entityPagewidget);
$this->em->flush();
}
}
}
private function addWidget2Page($entityPage,$widgetid,$loc,$order,$title,$border,$fields) {
$entityWidget = $this->em->getRepository('CadolesPortalBundle:Widget')->find($widgetid);
if($entityWidget) {
$entityPagewidget = $this->em->getRepository('CadolesPortalBundle:Pagewidget')->findOneBy(["page"=>$entityPage,"widget"=>$entityWidget]);
if(!$entityPagewidget) {
$entityPagewidget = new Pagewidget();
$entityPagewidget->setLoc($loc);
$entityPagewidget->setRoworder($order);
$entityPagewidget->setName($title);
$entityPagewidget->setHeight($entityWidget->getHeight());
$entityPagewidget->setAutoajust($entityWidget->getAutoajust());
$entityPagewidget->setBorder($border);
$entityPagewidget->setOpened($entityWidget->getOpened());
$entityPagewidget->setIcon($entityWidget->getIcon());
$entityPagewidget->setPage($entityPage);
$entityPagewidget->setWidget($entityWidget);
$entityPagewidget->setParameter($fields);
$this->em->persist($entityPagewidget);
$this->em->flush();
}
}
}
}

View File

@ -18,6 +18,7 @@ use Cadoles\CoreBundle\Entity\Group;
use Cadoles\CoreBundle\Entity\UserGroup;
use Cadoles\PortalBundle\Entity\Calendar;
use Cadoles\PortalBundle\Entity\Blog;
use Cadoles\PortalBundle\Entity\Project;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
@ -697,7 +698,8 @@ class SynchroCommand extends Command
$group->setFgcanshare($fgcanshare);
$group->setFgcancreatepage(false);
$group->setFgcancreateblog(false);
$group->setFgcancreatecalendar(false);
$group->setFgcancreatecalendar(false);
$group->setFgcancreateproject(false);
}
$group->setLabel($label);
@ -750,7 +752,18 @@ class SynchroCommand extends Command
$this->em->persist($blog);
$this->em->flush();
}
}
// On regarde s'il a au moins un project
if($group->getProjects()->isEmpty()) {
$project=new Project();
$project->setName($group->getLabel());
$project->addGroup($group);
$this->em->persist($project);
$this->em->flush();
}
}
}

View File

@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
(-100, 'Interne', 'SIREN');
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}sh/qcK9rVlrIFTJVhcolNLa3Ww0g4ZzK
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}lfWLOzsWTTGkrbaPndkzPSiFKH078TmD
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');
@ -37,9 +37,10 @@ INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `f
(1540, 1500, 1540, 'Annonces', 'cadoles_portal_config_alert', 'fa-bell', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1550, 1500, 1550, 'Calendriers', 'cadoles_portal_config_calendar', 'fa-calendar', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1560, 1500, 1560, 'Blogs', 'cadoles_portal_config_blog', 'fa-paper-plane', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1570, 1500, 1570, 'Flux', 'cadoles_portal_config_flux', 'fa-rss', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1580, 1500, 1580, 'Chartes', 'cadoles_portal_config_notice', 'fa-info', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1590, 1500, 1590, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1570, 1500, 1570, 'Projets', 'cadoles_portal_config_project', 'fa-suitcase', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1580, 1500, 1580, 'Flux', 'cadoles_portal_config_flux', 'fa-rss', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1590, 1500, 1590, 'Chartes', 'cadoles_portal_config_notice', 'fa-info', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1600, 1500, 1600, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(2500, NULL, 2500, 'MODULES', NULL, 'fa-cubes', 'ROLE_ADMIN,ROLE_MODO', 'module_activate'),
(2510, 2500, 2510, 'Pages', 'cadoles_portal_config_page', 'fa-file', 'ROLE_ADMIN,ROLE_MODO', 'page_activate'),
@ -47,9 +48,10 @@ INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `f
(2530, 2500, 2530, 'Annonces', 'cadoles_portal_config_alert', 'fa-bell', 'ROLE_ADMIN,ROLE_MODO', 'alert_activate'),
(2540, 2500, 2540, 'Calendriers', 'cadoles_portal_config_calendar', 'fa-calendar', 'ROLE_ADMIN,ROLE_MODO', 'calendar_activate'),
(2550, 2500, 2550, 'Blogs', 'cadoles_portal_config_blog', 'fa-paper-plane', 'ROLE_ADMIN,ROLE_MODO', 'blog_activate'),
(2560, 2500, 2560, 'Flux', 'cadoles_portal_config_flux', 'fa-rss', 'ROLE_ADMIN,ROLE_MODO', 'flux_activate'),
(2570, 2500, 2570, 'Chartes', 'cadoles_portal_config_notice', 'fa-info', 'ROLE_ADMIN,ROLE_MODO', 'notice_activate'),
(2580, 2500, 2580, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'module_activate'),
(2560, 2500, 2560, 'Projects', 'cadoles_portal_config_project', 'fa-suitcase', 'ROLE_ADMIN,ROLE_MODO', 'project_activate'),
(2570, 2500, 2570, 'Flux', 'cadoles_portal_config_flux', 'fa-rss', 'ROLE_ADMIN,ROLE_MODO', 'flux_activate'),
(2580, 2500, 2580, 'Chartes', 'cadoles_portal_config_notice', 'fa-info', 'ROLE_ADMIN,ROLE_MODO', 'notice_activate'),
(2590, 2500, 2590, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'module_activate'),
(3000, NULL, 3000, 'SYNCHRONISATION', NULL, 'fa-exchange', 'ROLE_ADMIN,ROLE_MODO', 'syncenvole_activate'),
(3001, 3000, 3001, 'Délégation', 'cadoles_portal_config_syncdelegation', 'fa-balance-scale', 'ROLE_ADMIN,ROLE_MODO', 'syncenvole_activate'),

View File

@ -49,6 +49,10 @@ class CoreController extends Controller
// Récupération de la page encours
$id = $request->query->get('id');
// Récupération redirection potentielle
$gotoroute = $request->query->get('gotoroute');
$gotoid = $request->query->get('gotoid');
// L'utilisateur en cours
@ -116,7 +120,7 @@ class CoreController extends Controller
return $this->render('CadolesPortalBundle:Page:default.html.twig',[
'useheader' => true,
'usemenu' => false,
'usesidebar' => false
'usesidebar' => false
]);
}
@ -131,7 +135,9 @@ class CoreController extends Controller
'groupsshared' => $groupsshared,
'canadd' => $this->get('session')->get('cancreatepage'),
'widgetsuser' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess("user"),
'widgetsgroup' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess("group")
'widgetsgroup' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess("group"),
'gotoroute' => $gotoroute,
'gotoid' => $gotoid,
]);
}

View File

@ -78,7 +78,7 @@ class FileController extends Controller
if($fs->exists($dir)) {
$finder = new Finder();
$finder->sortByName()->in($dir)->exclude('thumb');
$finder->sortByName()->in($dir)->exclude('thumb')->exclude("thumbmini");
$i=-1;
@ -180,6 +180,18 @@ class FileController extends Controller
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
if(!$cansee) throw $this->createNotFoundException('Permission denied');
break;
case "projecttask":
// Récupération de la tache
$projecttask=$em->getRepository("CadolesPortalBundle:Projecttask")->find($id);
if (!$projecttask) throw $this->createNotFoundException('Unable to find entity.');
// On s'assure que l'utilisateur à la permission de voir
$project=$projecttask->getProject();
$user=$this->getUser();
$em->getRepository("CadolesPortalBundle:Project")->getPermission($user,$project,$cansee,$canupdate,$canadd);
if(!$cansee) throw $this->createNotFoundException('Permission denied');
break;
}
}
}

View File

@ -21,6 +21,7 @@ use Cadoles\CoreBundle\Entity\Usermodo;
use Cadoles\CoreBundle\Form\GroupType;
use Cadoles\PortalBundle\Entity\Calendar;
use Cadoles\PortalBundle\Entity\Blog;
use Cadoles\PortalBundle\Entity\Project;
use Cadoles\WebsocketBundle\Entity\Message;
use Symfony\Component\Security\Core\User\User;
@ -142,6 +143,9 @@ class GroupController extends Controller
case 8 :
$qb->orderBy('table.fgcancreateblog',$order[0]["dir"]);
break;
case 9 :
$qb->orderBy('table.fgcancreateproject',$order[0]["dir"]);
break;
}
$datas=$qb->setFirstResult($start)->setMaxResults($length)->getQuery()->getResult();
@ -207,6 +211,7 @@ class GroupController extends Controller
($data->getFgcancreatepage()?"oui":"non"),
($data->getFgcancreatecalendar()?"oui":"non"),
($data->getFgcancreateblog()?"oui":"non"),
($data->getFgcancreateproject()?"oui":"non"),
)
);
}
@ -699,8 +704,15 @@ class GroupController extends Controller
$data->setFgcancreatepage(false);
$data->setFgcancreatecalendar(false);
$data->setFgcancreateblog(false);
if($access=="user") $data->setOwner($this->getUser());
$data->setFgcancreateproject(false);
if($access=="user") {
$data->setOwner($this->getUser());
if($this->getParameter("portal_activate")) {
$template=$em->getRepository("CadolesPortalBundle:Page")->findoneby(["parentfor"=>"group"]);
$data->setPagetemplate($template);
}
}
// Création du formulaire
$form = $this->createForm(GroupType::class,$data,array(
"mode"=>"submit",
@ -898,7 +910,16 @@ class GroupController extends Controller
// si la page est lié qu'à un seul group on peut la supprimer
if($groups->count()==1)
$em->remove($blog);
}
}
// Sur l'ensemble des project liés
$projects=$data->getProjects();
foreach($projects as $project) {
$groups=$blog->getGroups();
// si la page est lié qu'à un seul group on peut la supprimer
if($groups->count()==1)
$em->remove($project);
}
}
$em->remove($data);
@ -931,13 +952,17 @@ class GroupController extends Controller
$data=$this->getData($id);
$this->canManager($data,$access);
// idreturn ?
$idreturn=$request->get("idreturn");
// Affichage du formulaire
return $this->render($this->labelentity.':users.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => ($access=="config"),
'access' => $access,
$this->labeldata => $data
$this->labeldata => $data,
'idreturn' => $idreturn,
]);
}
@ -1102,6 +1127,18 @@ class GroupController extends Controller
$em->persist($blog);
$em->flush();
}
// On regarde s'il a au moins un project
if($group->getProjects()->isEmpty()) {
$project=new Project();
$project->setName($group->getLabel());
$project->addGroup($group);
if($access=="user")$project->setUser($this->getUser());
$em->persist($project);
$em->flush();
}
}
}

View File

@ -50,7 +50,22 @@ class MailController extends Controller
$destinataires=$form->get("destinataire")->getData();
$to=explode(";",$destinataires);
$to=explode(";",$destinataires);
// On s'assure que les destinataires ne sont pas déjà inscrit dans le portail
$usersnotin=[];
$usersin=[];
foreach($to as $key => $mail) {
// Si le mail existe on l'enlève de la liste des utilisateurs à inviter
$user=$em->getRepository("CadolesCoreBundle:User")->findOneBy(["email"=>$mail]);
if($user) {
unset($to[$key]);
$usergroup=$em->getRepository("CadolesCoreBundle:UserGroup")->findOneBy(["user"=>$user,"group"=>$group]);
if($usergroup) array_push($usersin,$user);
else array_push($usersnotin,$user);
}
}
$text=$form->get("message")->getData();
$subject=$form->get("subject")->getData();
$template="template";
@ -65,15 +80,27 @@ class MailController extends Controller
$message->sendEmail($template, $mail_params, $to, $from, $fromName);
}
return $this->render('CadolesCoreBundle:Mail:mail.html.twig',[
'useheader' => false,
'usemenu' => false,
'usesidebar' => false,
'closed' => $closed,
'subject' => $subject,
'message' => $message,
'form' => $form->createView()
]);
if($closed && (!empty($usersin)||!empty($usersnotin))) {
return $this->render('CadolesCoreBundle:Mail:users.html.twig',[
'useheader' => false,
'usemenu' => false,
'usesidebar' => false,
'usersin' => $usersin,
'usersnotin' => $usersnotin,
'group' => $group
]);
}
else {
return $this->render('CadolesCoreBundle:Mail:mail.html.twig',[
'useheader' => false,
'usemenu' => false,
'usesidebar' => false,
'closed' => $closed,
'subject' => $subject,
'message' => $message,
'form' => $form->createView()
]);
}
}
}

View File

@ -387,6 +387,18 @@ class RegistrationController extends Controller
// Sur erreur
$this->getErrorForm($id,$form,$request,$data,"send");
// Sur validation
if ($form->get('save')->isClicked() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$data = $form->getData();
// Sauvegarde
$em->persist($data);
$em->flush();
return $this->redirectToRoute('cadoles_core_config_registration');
}
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
@ -717,7 +729,7 @@ class RegistrationController extends Controller
$password=$data["password"];
$message="";
if(!empty($password)) {
if (strlen($password) < '8') {
if (strlen($password) < $this->getParameter("keyterm")) {
$message = "Votre mot de passe doit contenir au minimum 8 caractères, constitué de chiffres, de lettres et caractères spéciaux";
}
elseif(!preg_match("#[0-9]+#",$password)) {

View File

@ -192,4 +192,11 @@ class SecurityController extends Controller
return new Response();
}
public function redirectAction($route,$id,Request $request) {
if($route=="cadoles_core_home")
return $this->redirectToRoute($route,["id"=>$id]);
else
return $this->redirectToRoute("cadoles_core_home",["gotoroute"=>$route,"gotoid"=>$id]);
}
}

View File

@ -68,6 +68,11 @@ class Group
*/
private $fgcancreatecalendar;
/**
* @ORM\Column(type="boolean", options={"default" : false})
*/
private $fgcancreateproject;
/**
* @ORM\Column(type="boolean", options={"default" : false})
*/
@ -157,6 +162,11 @@ class Group
* @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Blog", mappedBy="groups")
*/
protected $blogs;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Project", mappedBy="groups")
*/
protected $projects;
/**
* @var ArrayCollection $message
@ -197,6 +207,7 @@ class Group
$this->notices = new \Doctrine\Common\Collections\ArrayCollection();
$this->calendars = new \Doctrine\Common\Collections\ArrayCollection();
$this->blogs = new \Doctrine\Common\Collections\ArrayCollection();
$this->projects = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
@ -946,4 +957,65 @@ class Group
{
return $this->calendarevents;
}
/**
* Add project
*
* @param \Cadoles\PortalBundle\Entity\Project $project
*
* @return Group
*/
public function addProject(\Cadoles\PortalBundle\Entity\Project $project)
{
$project->addGroup($this);
$this->projects[] = $project;
return $this;
}
/**
* Remove project
*
* @param \Cadoles\PortalBundle\Entity\Project $project
*/
public function removeProject(\Cadoles\PortalBundle\Entity\Project $project)
{
$project->removeGroup($this);
$this->projects->removeElement($project);
}
/**
* Get projects
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProjects()
{
return $this->projects;
}
/**
* Set fgcancreateproject
*
* @param boolean $fgcancreateproject
*
* @return Group
*/
public function setFgcancreateproject($fgcancreateproject)
{
$this->fgcancreateproject = $fgcancreateproject;
return $this;
}
/**
* Get fgcancreateproject
*
* @return boolean
*/
public function getFgcancreateproject()
{
return $this->fgcancreateproject;
}
}

View File

@ -0,0 +1,57 @@
<?php
namespace Cadoles\CoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="script")
*/
class Script
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string")
*/
protected $name;
/**
* Get id
*
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return Script
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
}

View File

@ -83,7 +83,7 @@ class User implements UserInterface, \Serializable
private $authlevel;
/**
* @ORM\Column(type="string", length=9)
* @ORM\Column(type="string", length=9, nullable=true)
*/
private $siren;
@ -261,6 +261,51 @@ class User implements UserInterface, \Serializable
*/
private $blogarticles;
/**
* @var ArrayCollection $blogcomment
* @var Blogcomment
*
* @ORM\OneToMany(targetEntity="Cadoles\PortalBundle\Entity\Blogcomment", mappedBy="user", cascade={"persist"}, orphanRemoval=true)
*/
private $blogcomments;
/**
* @var ArrayCollection $project
* @var Project
*
* @ORM\OneToMany(targetEntity="Cadoles\PortalBundle\Entity\Project", mappedBy="user", cascade={"persist"}, orphanRemoval=true)
*/
private $projects;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Project", mappedBy="writers")
*/
private $projectwriters;
/**
* @var ArrayCollection $projecttask
* @var Projecttask
*
* @ORM\OneToMany(targetEntity="Cadoles\PortalBundle\Entity\Projecttask", mappedBy="user", cascade={"persist"}, orphanRemoval=true)
*/
private $projecttasks;
/**
* @var ArrayCollection $projecttask
* @var Projecttask
*
* @ORM\OneToMany(targetEntity="Cadoles\PortalBundle\Entity\Projecttask", mappedBy="owner", cascade={"persist"}, orphanRemoval=true)
*/
private $projectownertasks;
/**
* @var ArrayCollection $projectcomment
* @var Projectcomment
*
* @ORM\OneToMany(targetEntity="Cadoles\PortalBundle\Entity\Projectcomment", mappedBy="user", cascade={"persist"}, orphanRemoval=true)
*/
private $projectcomments;
/**
* @var ArrayCollection $icon
* @var Icon
@ -1547,4 +1592,208 @@ class User implements UserInterface, \Serializable
{
return $this->messagesees;
}
/**
* Add blogcomment
*
* @param \Cadoles\PortalBundle\Entity\Blogcomment $blogcomment
*
* @return User
*/
public function addBlogcomment(\Cadoles\PortalBundle\Entity\Blogcomment $blogcomment)
{
$this->blogcomments[] = $blogcomment;
return $this;
}
/**
* Remove blogcomment
*
* @param \Cadoles\PortalBundle\Entity\Blogcomment $blogcomment
*/
public function removeBlogcomment(\Cadoles\PortalBundle\Entity\Blogcomment $blogcomment)
{
$this->blogcomments->removeElement($blogcomment);
}
/**
* Get blogcomments
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getBlogcomments()
{
return $this->blogcomments;
}
/**
* Add project
*
* @param \Cadoles\PortalBundle\Entity\Project $project
*
* @return User
*/
public function addProject(\Cadoles\PortalBundle\Entity\Project $project)
{
$this->projects[] = $project;
return $this;
}
/**
* Remove project
*
* @param \Cadoles\PortalBundle\Entity\Project $project
*/
public function removeProject(\Cadoles\PortalBundle\Entity\Project $project)
{
$this->projects->removeElement($project);
}
/**
* Get projects
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProjects()
{
return $this->projects;
}
/**
* Add projectwriter
*
* @param \Cadoles\PortalBundle\Entity\Project $projectwriter
*
* @return User
*/
public function addProjectwriter(\Cadoles\PortalBundle\Entity\Project $projectwriter)
{
$this->projectwriters[] = $projectwriter;
return $this;
}
/**
* Remove projectwriter
*
* @param \Cadoles\PortalBundle\Entity\Project $projectwriter
*/
public function removeProjectwriter(\Cadoles\PortalBundle\Entity\Project $projectwriter)
{
$this->projectwriters->removeElement($projectwriter);
}
/**
* Get projectwriters
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProjectwriters()
{
return $this->projectwriters;
}
/**
* Add projecttask
*
* @param \Cadoles\PortalBundle\Entity\Projecttask $projecttask
*
* @return User
*/
public function addProjecttask(\Cadoles\PortalBundle\Entity\Projecttask $projecttask)
{
$this->projecttasks[] = $projecttask;
return $this;
}
/**
* Remove projecttask
*
* @param \Cadoles\PortalBundle\Entity\Projecttask $projecttask
*/
public function removeProjecttask(\Cadoles\PortalBundle\Entity\Projecttask $projecttask)
{
$this->projecttasks->removeElement($projecttask);
}
/**
* Get projecttasks
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProjecttasks()
{
return $this->projecttasks;
}
/**
* Add projectownertask
*
* @param \Cadoles\PortalBundle\Entity\Projecttask $projectownertask
*
* @return User
*/
public function addProjectownertask(\Cadoles\PortalBundle\Entity\Projecttask $projectownertask)
{
$this->projectownertasks[] = $projectownertask;
return $this;
}
/**
* Remove projectownertask
*
* @param \Cadoles\PortalBundle\Entity\Projecttask $projectownertask
*/
public function removeProjectownertask(\Cadoles\PortalBundle\Entity\Projecttask $projectownertask)
{
$this->projectownertasks->removeElement($projectownertask);
}
/**
* Get projectownertasks
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProjectownertasks()
{
return $this->projectownertasks;
}
/**
* Add projectcomment
*
* @param \Cadoles\PortalBundle\Entity\Projectcomment $projectcomment
*
* @return User
*/
public function addProjectcomment(\Cadoles\PortalBundle\Entity\Projectcomment $projectcomment)
{
$this->projectcomments[] = $projectcomment;
return $this;
}
/**
* Remove projectcomment
*
* @param \Cadoles\PortalBundle\Entity\Projectcomment $projectcomment
*/
public function removeProjectcomment(\Cadoles\PortalBundle\Entity\Projectcomment $projectcomment)
{
$this->projectcomments->removeElement($projectcomment);
}
/**
* Get projectcomments
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProjectcomments()
{
return $this->projectcomments;
}
}

View File

@ -261,6 +261,7 @@
$session->set('cancreatepage',false);
$session->set('cancreatecalendar',false);
$session->set('cancreateblog',false);
$session->set('cancreateproject',false);
$session->remove("sublogo");
if($curentuser!="anon.") {
@ -270,6 +271,7 @@
if($group->getFgcancreatepage()) $session->set('cancreatepage',true);
if($group->getFgcancreatecalendar()) $session->set('cancreatecalendar',true);
if($group->getFgcancreateblog()) $session->set('cancreateblog',true);
if($group->getFgcancreateproject()) $session->set('cancreateproject',true);
}
$niveau01=$curentuser->getNiveau01();

View File

@ -108,7 +108,7 @@ class uploadListener
if (in_array(strtolower($file->GetExtension()), array('jpg', 'jpeg', 'jpe', 'png', 'gif', 'bmp'))) {
$fs = new Filesystem();
$fs->copy($pathname."/".$directory."/".$filename,$pathname."/".$directory."/thumb/".$filename);
$max_width=350;
$max_width=300;
$width = $this->getWidth($pathname."/".$directory."/thumb/".$filename);
$height = $this->getHeight($pathname."/".$directory."/thumb/".$filename);
$scale = $max_width/$width;
@ -118,7 +118,7 @@ class uploadListener
if (in_array(strtolower($file->GetExtension()), array('pdf'))) {
$im = new \Imagick();
$im->setResolution(350, 350);
$im->setResolution(300, 300);
$im->readImage($pathname."/".$directory."/".$filename."[0]");
$im->setImageBackgroundColor('#ffffff');
$im = $im->flattenImages();
@ -128,6 +128,16 @@ class uploadListener
$fs->rename($pathname."/".$directory."/thumb/".$filename.".jpg", $pathname."/".$directory."/thumb/".$filename);
}
if($fs->exists($pathname."/".$directory."/thumb/".$filename)) {
$fs->mkdir($pathname."/".$directory."/thumbmini");
$fs->copy($pathname."/".$directory."/thumb/".$filename,$pathname."/".$directory."/thumbmini/".$filename);
$max_width=60;
$width = $this->getWidth($pathname."/".$directory."/thumbmini/".$filename);
$height = $this->getHeight($pathname."/".$directory."/thumbmini/".$filename);
$scale = $max_width/$width;
$this->resizeImage($pathname."/".$directory."/thumbmini/".$filename,$width,$height,$scale);
}
if (strpos($directory, 'widget') === 0) {
$tmp=explode("-",$directory);
$widgetid=$tmp[1];
@ -148,6 +158,26 @@ class uploadListener
}
}
if (strpos($directory, 'projecttask') === 0) {
$tmp=explode("-",$directory);
$projecttaskid=$tmp[1];
$projecttask=$this->em->getRepository("CadolesPortalBundle:Projecttask")->find($projecttaskid);
if($projecttask) {
foreach($projecttask->getProject()->getGroups() as $group) {
if($group->getFgcanshare()) {
if($fgexit) $message="Modification fichier dans la tâche ".$projecttask->getName()."<br>".$filename;
else $message="Création fichier dans la tâche ".$projecttask->getName()."<br>".$filename;
$usergroup=$this->em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(["group"=>$group,"user"=>$this->token->getToken()->getUser()]);
if($usergroup) {
$key=$usergroup->getKeyvalue();
$websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key,$this->token->getToken()->getUser()->getId(),$group->getId(),$message);
}
}
}
}
}
$response = $event->getResponse();
$response['file'] = $filename;
break;

View File

@ -110,6 +110,15 @@ class GroupType extends AbstractType
)
);
$builder->add("fgcancreateproject",
ChoiceType::class,array(
"label" =>"Permission de créer des Projets",
'disabled' => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"choices" => $choices
)
);
$builder->add('pages', Select2EntityType::class, [
'label' => 'Afficher les Pages',
'class' => 'CadolesPortalBundle:Page',
@ -195,6 +204,24 @@ class GroupType extends AbstractType
'placeholder' => 'Selectionner des blogs',
]);
$builder->add('projects', Select2EntityType::class, [
'label' => 'Afficher les Projets',
'class' => 'CadolesPortalBundle:Project',
'multiple' => true,
'remote_route' => 'cadoles_portal_config_ajax_project_seleclist',
'primary_key' => 'id',
'text_property' => 'name',
'minimum_input_length' => 0,
'page_limit' => 100,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000,
'language' => 'fr',
'placeholder' => 'Selectionner des projets',
]);
$builder->add('fluxs', Select2EntityType::class, [
'label' => 'Afficher les Flux',
'class' => 'CadolesPortalBundle:Flux',

View File

@ -33,11 +33,20 @@ class RegistrationType extends AbstractType
$builder->add('submit',
SubmitType::class, array(
"label" => ($options["mode"]=="delete"?"Confirmer la Suppression":"Valider"),
"label" => ($options["mode"]=="delete"?"Confirmer la Suppression":"Confirmer"),
"attr" => ($options["mode"]=="delete"?array("class" => "btn btn-danger"):array("class" => "btn btn-success"))
)
);
if($options["mode"]=="send") {
$builder->add('save',
SubmitType::class, array(
"label" => "Sauvegarder",
"attr" => array("class" => "btn btn-success")
)
);
}
# Obligatoire
$builder->add('username',
TextType::class, array(
@ -50,7 +59,7 @@ class RegistrationType extends AbstractType
$builder->add('lastname',
TextType::class, array(
"label" =>"Nom de Famille",
"disabled" => ($options["mode"]=="delete"||$options["mode"]=="send"?true:false),
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
@ -58,7 +67,7 @@ class RegistrationType extends AbstractType
$builder->add('email',
EmailType::class, array(
"label" =>"Mail",
"disabled" => ($options["mode"]=="delete"||$options["mode"]=="send"?true:false),
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
@ -68,8 +77,8 @@ class RegistrationType extends AbstractType
array("class" => "CadolesCoreBundle:Niveau01",
"label" => $session->get('labelniveau01'),
"choice_label" => "label",
"disabled" => ($options["mode"]=="delete"||$options["mode"]=="send"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px","readonly" => ($options["mode"]=="submit"?false:true))));
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px","readonly" => ($options["mode"]=="delete"?true:false))));
# Password
if($options["mode"]!="delete"&&$options["mode"]!="send") {
@ -98,7 +107,7 @@ class RegistrationType extends AbstractType
TextType::class, array(
"label" =>"Prénom",
"required" => (!array_key_exists("firstname",$fields)?false:($fields["firstname"]["perm"]==2)),
"disabled" => ($options["mode"]=="delete"||$options["mode"]=="send"?true:false),
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
@ -110,7 +119,7 @@ class RegistrationType extends AbstractType
ChoiceType::class,array(
"label" =>"Visible",
"required" => (!array_key_exists("visible",$fields)?false:($fields["visible"]["perm"]==2)),
'disabled' => ($options["mode"]=="submit"?false:true),
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"choices" => $choices
)
@ -122,7 +131,7 @@ class RegistrationType extends AbstractType
TextType::class, array(
"label" => "Nom d'Usage",
"required" => (!array_key_exists("usualname",$fields)?false:($fields["usualname"]["perm"]==2)),
"disabled" => ($options["mode"]=="submit"?false:true),
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
@ -133,7 +142,7 @@ class RegistrationType extends AbstractType
TextType::class, array(
"label" => "Autre Prénom",
"required" => (!array_key_exists("givensname",$fields)?false:($fields["givensname"]["perm"]==2)),
"disabled" => ($options["mode"]=="submit"?false:true),
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
@ -144,7 +153,7 @@ class RegistrationType extends AbstractType
TextType::class, array(
"label" => "Téléphone",
"required" => (!array_key_exists("telephonenumber",$fields)?false:($fields["telephonenumber"]["perm"]==2)),
"disabled" => ($options["mode"]=="submit"?false:true),
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
@ -155,7 +164,7 @@ class RegistrationType extends AbstractType
TextareaType::class, array(
"label" => "Adresse",
"required" => (!array_key_exists("postaladress",$fields)?false:($fields["postaladress"]["perm"]==2)),
"disabled" => ($options["mode"]=="submit"?false:true),
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px; height: 90px")
)
);
@ -166,7 +175,7 @@ class RegistrationType extends AbstractType
DateType::class, array(
"label" => "Date de Naissance",
"required" => (!array_key_exists("birthdate",$fields)?false:($fields["birthdate"]["perm"]==2)),
"disabled" => ($options["mode"]=="submit"?false:true),
"disabled" => ($options["mode"]=="delete"?true:false),
"widget" => 'single_text',
"format" => "dd/MM/yyyy",
"html5" => false,
@ -182,7 +191,7 @@ class RegistrationType extends AbstractType
ChoiceType::class,array(
"label" =>"Sexe",
"required" => (!array_key_exists("gender",$fields)?false:($fields["gender"]["perm"]==2)),
'disabled' => ($options["mode"]=="submit"?false:true),
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"choices" => $choices
)
@ -194,7 +203,7 @@ class RegistrationType extends AbstractType
TextType::class, array(
"label" => "Métier",
"required" => (!array_key_exists("job",$fields)?false:($fields["job"]["perm"]==2)),
"disabled" => ($options["mode"]=="submit"?false:true),
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
@ -205,7 +214,7 @@ class RegistrationType extends AbstractType
TextType::class, array(
"label" => "Fonction",
"required" => (!array_key_exists("position",$fields)?false:($fields["position"]["perm"]==2)),
"disabled" => ($options["mode"]=="submit"?false:true),
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
@ -216,7 +225,7 @@ class RegistrationType extends AbstractType
$builder->add('birthcountry',
Select2EntityType::class, array(
'label' => "Pays de Naissance",
'disabled' => ($options["mode"]=="delete"?true:false),
"disabled" => ($options["mode"]=="delete"?true:false),
"required" => (!array_key_exists("birthcountry",$fields)?false:($fields["birthcountry"]["perm"]==2)),
'multiple' => false,
'remote_route' => 'cadoles_core_ajax_country_list',
@ -240,8 +249,8 @@ class RegistrationType extends AbstractType
$builder->add('birthplace',
Select2EntityType::class, array(
'label' => "Ville de Naissance",
'disabled' => ($options["mode"]=="delete"?true:false),
"required" => false,
"disabled" => ($options["mode"]=="delete"?true:false),
"required" => false,
'multiple' => false,
'remote_route' => 'cadoles_core_ajax_city_list',
'class' => 'Cadoles\coreBundle\Entity\City',
@ -265,7 +274,7 @@ class RegistrationType extends AbstractType
$builder->add('niveau02',
Select2EntityType::class, array(
'label' => $session->get('labelniveau02'),
'disabled' => ($options["mode"]=="delete"?true:false),
"disabled" => ($options["mode"]=="delete"?true:false),
"required" => (!array_key_exists("niveau02",$fields)?false:($fields["niveau02"]["perm"]==2)),
'multiple' => false,
'remote_route' => 'cadoles_core_ajax_niveau02_list',

View File

@ -41,6 +41,9 @@ cadoles_core_ldap_login:
path: /ldaplogin
defaults: { _controller: CadolesCoreBundle:Security:login }
cadoles_core_redirect:
path: /user/redirect/{route}/{id}
defaults: { _controller: CadolesCoreBundle:Security:redirect }
#== Crop Image ===========================================================================================================
cadoles_core_crop01:
@ -76,7 +79,7 @@ cadoles_core_config_file_download:
#-- Access user
cadoles_core_user_file_upload:
path: /user/config/file/upload/{id}/{type}
path: /user/file/upload/{id}/{type}
defaults: { _controller: CadolesCoreBundle:File:upload, access: user }
cadoles_core_user_file_delete:

File diff suppressed because one or more lines are too long

View File

@ -452,7 +452,12 @@ a.item-heart {
text-align:center;
width: 100%;
}
.grid .grid-small .grid-item-title h2 { font-size:10px; border-bottom: none; }
.grid .grid-small .grid-item-title h2 {
font-size:10px;
border-bottom: none;
max-height: 55px;
overflow-y: hidden;
}
.grid .grid-small .grid-item-title span { display: none }
@ -691,6 +696,8 @@ a.item-heart {
margin-left:50px;
cursor: pointer;
font-size: 1.5vw;
height: 50px;
overflow-y: hidden;
}
.widgetheader iframe,
@ -800,9 +807,6 @@ a.item-heart {
}
.blogarticle {
margin-bottom:150px;
}
@ -845,4 +849,53 @@ a.item-heart {
}
/* Project */
.projectpreview .projectitle{
text-align:center;
text-transform: uppercase;
}
.projecttask {
margin-bottom:150px;
}
.projecttask .projecttitle h1{
text-align:left
}
.projecttask .projectimage {
width:100%;
height:450px;
background-size:cover;
background-position: center;
margin-top:20px;
}
.projecttask .projecttitle {
margin-bottom:20px;
}
.projecttask .projecttitle legend {
margin-bottom:0px;
}
.projecttask .projectbody img{
max-width: 100%;
}
.projecttask .projectbody {
font-size: 18px;
}
.projecttask .projectsidebar {
border-left: 1px solid #e5e5e5;
margin-top: 20px;
}
.projecttask .projectsidebartitle {
margin-bottom:0px;
}

File diff suppressed because one or more lines are too long

View File

@ -41,6 +41,8 @@
}
function closeModal() {
window.parent.$("#mymodal").removeClass("in");
window.parent.$(".modal-backdrop").remove();
window.parent.$("#mymodal").modal('hide');
}

View File

@ -118,6 +118,9 @@
{{ form_label(form.fgcancreateblog) }}
{{ form_widget(form.fgcancreateblog) }}
{{ form_label(form.fgcancreateproject) }}
{{ form_widget(form.fgcancreateproject) }}
</div>
</div>
@ -132,6 +135,7 @@
{{ form_row(form.alerts) }}
{{ form_row(form.calendars) }}
{{ form_row(form.blogs) }}
{{ form_row(form.projects) }}
{{ form_row(form.fluxs) }}
{{ form_row(form.notices) }}
</div>

View File

@ -42,6 +42,7 @@
<th>Création Pages</th>
<th>Création Calendriers</th>
<th>Création Blogs</th>
<th>Création Projets</th>
{% endif %}
{% endif %}
</tr>

View File

@ -3,7 +3,12 @@
{% block pagewrapper %}
<h1 class="page-header">Gestion des Utilisateurs</h1>
<h2>Groupe = {{ group.label }}</h2>
<a class="btn btn-default" href={{ path('cadoles_core_'~access~'_group') }}>Fermer</a>
{% if idreturn is empty %}
<a class="btn btn-default" href={{ path('cadoles_core_'~access~'_group') }}>Fermer</a>
{% else %}
<a class="btn btn-default" href={{ path('cadoles_core_home',{'id':idreturn}) }}>Fermer</a>
{% endif %}
{% 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>
{%endif%}

View File

@ -0,0 +1,93 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
<a class="btn btn-default" onClick="closeModal()">Fermer</a>
<br><br>
{% if not usersnotin is empty %}
<h3>Les utilisateurs suivants existent déjà dans {{ app.session.get('appname') }}</h3>
Vous pouvez les ajouter dès maintenant à votre groupe<br>
<div class="dataTable_wrapper">
<table class="table table-striped table-bordered table-hover" id="dataTablesnotin" style="width:100%">
<thead>
<tr>
<th width="70px" class="no-sort">Action</th>
<th width="70px" class="no-sort">Avatar</th>
<th width="200px">Login</th>
<th>Email</th>
</tr>
</thead>
<tbody>
{% for user in usersnotin %}
<tr id="user{{user.id}}">
<td><a style='cursor:pointer' onClick='addUsers({{user.id}})'><i class='fa fa-plus fa-fw'></i></a></td>
<td><img onClick='seeUser({{user.id}})' src='/{{alias}}/uploads/avatar/{{user.avatar}}' style='width:30px;background-color:#337ab7;margin:auto;display:block;cursor:pointer;'></td>
<td>{{user.username}}</td>
<td>{{user.email}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{% if not usersin is empty %}
<h3>Les utilisateurs suivants déjà rattachés à votre groupe</h3>
<div class="dataTable_wrapper">
<table class="table table-striped table-bordered table-hover" id="dataTablesin" style="width:100%">
<thead>
<tr>
<th width="70px" class="no-sort">Avatar</th>
<th width="200px">Login</th>
<th>Email</th>
</tr>
</thead>
<tbody>
{% for user in usersin %}
<tr>
<td><img onClick='seeUser({{user.id}})' src='/{{alias}}/uploads/avatar/{{user.avatar}}' style='width:30px;background-color:#337ab7;margin:auto;display:block;cursor:pointer;'></td>
<td>{{user.username}}</td>
<td>{{user.email}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
});
function addUsers(userid) {
$.ajax({
rowId: 2,
method: "POST",
url: "{{ path('cadoles_core_user_group_ajax_usergroup_add') }}",
data: "userid="+userid+"&groupid="+{{ group.id }},
success: function(data, dataType)
{
var row=$("#dataTablesnotin").DataTable().row("#user"+userid);
row.remove().draw();
},
error: function(XMLHttpRequest, textStatus, errorThrown)
{
}
});
}
function closeModal() {
window.parent.location.reload();
}
{% endblock %}

View File

@ -21,6 +21,7 @@
{% endif %}
{% if mode!="submit" %}
{{ form_widget(form.save) }}
<a class="btn btn-default" href={{ path('cadoles_core_config_registration') }}>Annuler</a>
{% endif %}
@ -67,7 +68,8 @@
<div class='alert alert-info' style='font-size: 80%;padding: 5px;margin-top: -10px;'>
Caractères interdits = accent, espace, caractères spéciaux sauf @ . - _<br>
Taille minimum = 5 caractères
Taille minimum = {{keyterm}} caractères
Doit être constitué de chiffres, de lettres et caractères spéciaux
</div>
{% if form.password is defined %}

View File

@ -75,7 +75,8 @@
<div class='alert alert-info' style='font-size: 80%;padding: 5px;margin-top: -10px;'>
Caractères interdits = accent, espace, caractères spéciaux sauf @ . - _<br>
Taille minimum = 5 caractères
Taille minimum = {{keyterm}} caractères
Doit être constitué de chiffres, de lettres et caractères spéciaux
</div>
{% if form.password is defined %}

View File

@ -9,7 +9,7 @@ class PasswordValidator extends ConstraintValidator
public function validate($value, Constraint $constraint)
{
if(!empty($value)) {
if (strlen($value) <= '8') {
if (strlen($value) < '8') {
$this->context->addViolation($constraint->message);
}
elseif(!preg_match("#[0-9]+#",$value)) {

View File

@ -19,6 +19,8 @@ use Cadoles\PortalBundle\Entity\PageWidget;
use Cadoles\PortalBundle\Entity\Widget;
use Cadoles\PortalBundle\Entity\Appexternal;
use Cadoles\PortalBundle\Entity\Flux;
use Cadoles\PortalBundle\Entity\Projecttasktag;
use Cadoles\PortalBundle\Entity\Projecttaskstatus;
use Cadoles\PortalBundle\Entity\Itemcategory;
use Cadoles\PortalBundle\Entity\Item;
@ -70,6 +72,14 @@ class InitDataCommand extends ContainerAwareCommand
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
$metadata = $em->getClassMetaData('CadolesPortalBundle:Projecttasktag');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
$metadata = $em->getClassMetaData('CadolesPortalBundle:Projecttaskstatus');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
$metadata = $em->getClassMetaData('CadolesPortalBundle:Pagecategory');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
@ -181,6 +191,88 @@ class InitDataCommand extends ContainerAwareCommand
$em->flush();
}
//== PROJECTTASKTAG ===============================================================================================================================================
$output->writeln(' > Creation Projecttasktag');
$entityTag = $em->getRepository('CadolesPortalBundle:Projecttasktag')->find(1);
if(!$entityTag) {
$entityTag = new Projecttasktag();
$entityTag->setId(1);
$entityTag->setName("Demande");
$entityTag->setColor("1e824c");
$em->persist($entityTag);
$em->flush();
}
$entityTag = $em->getRepository('CadolesPortalBundle:Projecttasktag')->find(2);
if(!$entityTag) {
$entityTag = new Projecttasktag();
$entityTag->setId(2);
$entityTag->setName("Evolution");
$entityTag->setColor("2574a9");
$em->persist($entityTag);
$em->flush();
}
$entityTag = $em->getRepository('CadolesPortalBundle:Projecttasktag')->find(3);
if(!$entityTag) {
$entityTag = new Projecttasktag();
$entityTag->setId(3);
$entityTag->setName("Anomalie");
$entityTag->setColor("cf000f");
$em->persist($entityTag);
$em->flush();
}
$entityTag = $em->getRepository('CadolesPortalBundle:Projecttasktag')->find(4);
if(!$entityTag) {
$entityTag = new Projecttasktag();
$entityTag->setId(4);
$entityTag->setName("Question");
$entityTag->setColor("f15a22");
$em->persist($entityTag);
$em->flush();
}
//== PROJECTTASKSTATUS ============================================================================================================================================
$output->writeln(' > Creation Projecttaskstatus');
$entityStatus = $em->getRepository('CadolesPortalBundle:Projecttaskstatus')->find(10);
if(!$entityStatus) {
$entityStatus = new Projecttaskstatus();
$entityStatus->setId(10);
$entityStatus->setName("En Attente");
$em->persist($entityStatus);
$em->flush();
}
$entityStatus = $em->getRepository('CadolesPortalBundle:Projecttaskstatus')->find(20);
if(!$entityStatus) {
$entityStatus = new Projecttaskstatus();
$entityStatus->setId(20);
$entityStatus->setName("A Faire");
$em->persist($entityStatus);
$em->flush();
}
$entityStatus = $em->getRepository('CadolesPortalBundle:Projecttaskstatus')->find(30);
if(!$entityStatus) {
$entityStatus = new Projecttaskstatus();
$entityStatus->setId(30);
$entityStatus->setName("Fait");
$em->persist($entityStatus);
$em->flush();
}
$entityStatus = $em->getRepository('CadolesPortalBundle:Projecttaskstatus')->find(40);
if(!$entityStatus) {
$entityStatus = new Projecttaskstatus();
$entityStatus->setId(40);
$entityStatus->setName("Livré");
$em->persist($entityStatus);
$em->flush();
}
//== PAGECATEGORY ========================================================================================================================================
$output->writeln(' > Creation Pagecategory');
@ -720,7 +812,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_ribbon.png"]);
$entityWidget->setId(-2000);
$entityWidget->setRoworder(1);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('URL');
$entityWidget->setDescription("Affiche le contenu d'une url");
@ -740,7 +832,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_computer.png"]);
$entityWidget->setId(-1990);
$entityWidget->setRoworder(2);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Bureau');
$entityWidget->setDescription("Affiche vos items de bureau");
@ -760,7 +852,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_megaphone.png"]);
$entityWidget->setId(-1980);
$entityWidget->setRoworder(3);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Annonces');
$entityWidget->setDescription("Affiche vos annonces");
@ -780,7 +872,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_rss.png"]);
$entityWidget->setId(-1970);
$entityWidget->setRoworder(4);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Flux');
$entityWidget->setDescription("Affiche vos flux RSS");
@ -800,7 +892,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_star.png"]);
$entityWidget->setId(-1960);
$entityWidget->setRoworder(5);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Favoris');
$entityWidget->setDescription("Création de Favoris");
@ -820,7 +912,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_bolt.png"]);
$entityWidget->setId(-1950);
$entityWidget->setRoworder(6);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Lien');
$entityWidget->setDescription("Création d'un Lien");
@ -840,7 +932,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_compose.png"]);
$entityWidget->setId(-1940);
$entityWidget->setRoworder(7);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Editeur');
$entityWidget->setDescription("Votre propre texte à éditer");
@ -860,7 +952,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_easel.png"]);
$entityWidget->setId(-1930);
$entityWidget->setRoworder(8);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Carrousel');
$entityWidget->setDescription("Carrousel d'images");
@ -880,7 +972,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_folder.png"]);
$entityWidget->setId(-1920);
$entityWidget->setRoworder(9);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Fichiers');
$entityWidget->setDescription("Répertoire de fichiers");
@ -900,7 +992,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_image.png"]);
$entityWidget->setId(-1910);
$entityWidget->setRoworder(10);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Galerie');
$entityWidget->setDescription("Galerie d'images");
@ -920,7 +1012,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_calendar.png"]);
$entityWidget->setId(-1900);
$entityWidget->setRoworder(11);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Calendrier');
$entityWidget->setDescription("Calendrier d'évènements");
@ -939,7 +1031,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_rocket.png"]);
$entityWidget->setId(-1890);
$entityWidget->setRoworder(12);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Blog');
$entityWidget->setDescription("Les derniers articles publiés sur vos blogs");
@ -959,7 +1051,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_rss.png"]);
$entityWidget->setId(-1880);
$entityWidget->setRoworder(13);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('RSS');
$entityWidget->setDescription("Afficher un flux RSS spécifique");
@ -990,7 +1082,7 @@ class InitDataCommand extends ContainerAwareCommand
if($entityWidget) {
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_frames.png"]);
$entityWidget->setId(-1870);
$entityWidget->setRoworder(14);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Mes Formulaires');
$entityWidget->setDescription("Afficher vos formulaires provenant de vos applications");
@ -1011,7 +1103,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_info.png"]);
$entityWidget->setId(-1860);
$entityWidget->setRoworder(13);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Information Page');
$entityWidget->setDescription("Afficher les informations associées à la page");
@ -1030,7 +1122,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_computer.png"]);
$entityWidget->setId(-1850);
$entityWidget->setRoworder(2);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Bureau Essentiel');
$entityWidget->setDescription("Affiche les items de bureau essentiel");
@ -1051,7 +1143,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_chat.png"]);
$entityWidget->setId(-1840);
$entityWidget->setRoworder(2);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Chat');
$entityWidget->setDescription("Conversation instantanée");
@ -1074,7 +1166,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_users.png"]);
$entityWidget->setId(-1830);
$entityWidget->setRoworder(2);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Mes Groupes de Travail');
$entityWidget->setDescription("Affiche la liste de vos groupes de travail");
@ -1093,7 +1185,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_megaphone2.png"]);
$entityWidget->setId(-1820);
$entityWidget->setRoworder(2);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Actualités de mes Groupes');
$entityWidget->setDescription("Affiche la liste actualités de vos groupes de travail");
@ -1113,7 +1205,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_onlyoffice.png"]);
$entityWidget->setId(-1810);
$entityWidget->setRoworder(2);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Onlyoffice');
$entityWidget->setDescription("Les documents associés à votre groupe");
@ -1131,12 +1223,32 @@ class InitDataCommand extends ContainerAwareCommand
$em->remove($entityWidget);
}
// Widget Tâche
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1800);
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_check.png"]);
$entityWidget->setId(-1800);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Tâche');
$entityWidget->setDescription("Gestion de projet par tâches");
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_project");
$entityWidget->setHeight("630");
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(false);
$entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": []}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget);
// Widget Séparateur
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1600);
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_roadblock.png"]);
$entityWidget->setId(-1600);
$entityWidget->setRoworder(100);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Séparateur');
$entityWidget->setDescription("Widget graphique pour séparer les autres widgets");
@ -1156,7 +1268,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_clock.png"]);
$entityWidget->setId(-1500);
$entityWidget->setRoworder(100);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Horloge');
$entityWidget->setDescription("Une simple horloge");
@ -1175,7 +1287,7 @@ class InitDataCommand extends ContainerAwareCommand
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_calculator.png"]);
$entityWidget->setId(-1490);
$entityWidget->setRoworder(110);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Calculatrice');
$entityWidget->setDescription("Une simple calculatrice");
@ -1222,7 +1334,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityPagewidget = new Pagewidget();
$entityPagewidget->setId(-110);
$entityPagewidget->setLoc("R1C1");
$entityPagewidget->setRoworder(1);
$entityPagewidget->setRoworder(0);
$entityPagewidget->setName("Applications");
$entityPagewidget->setHeight($entityWidget->getHeight());
$entityPagewidget->setAutoajust($entityWidget->getAutoajust());
@ -1268,6 +1380,10 @@ class InitDataCommand extends ContainerAwareCommand
$fields=["fields"=>[]];
$this->addWidget(-140,$entityPage,-1860,"R1C1",0,"Information Page",true,$fields);
// Widget Tâche
$fields=["fields"=>[]];
$this->addWidget(-145,$entityPage,-1800,"R1C1",1,"Taches du groupe",true,$fields);
// Widget Notre Blog
$fields=["fields"=>[["id"=>"nbarticle","value"=>5]]];
$this->addWidget(-150,$entityPage,-1890,"R1C2",0,"Notre Blog",false,$fields);

View File

@ -0,0 +1,191 @@
<?php
namespace Cadoles\PortalBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Filesystem\Filesystem;
use Cadoles\PortalBundle\Entity\Blogcomment;
use Cadoles\PortalBundle\Form\BlogcommentType;
use Cadoles\CoreBundle\Entity\Usergroup;
class BlogcommentController extends Controller
{
private $labelentity="CadolesPortalBundle:Blogcomment";
private $routeprimary="cadoles_portal_config_blogcomment";
private function entityForm(Blogcomment $entity,$access="config")
{
$route=str_replace("_config_","_".$access."_",$this->routeprimary);
if ($this->getDoctrine()->getManager()->contains($entity)) {
return $this->createForm(BlogcommentType::class, $entity, [
"mode" => "update",
"access" => $access,
"user" => $this->getUser()
]);
}
else {
return $this->createForm(BlogcommentType::class, $entity, [
"mode" => "submit",
"access" => $access,
"user" => $this->getUser()
]);
}
}
public function submitAction(Request $request,$idarticle,$access="config")
{
$em = $this->getDoctrine()->getManager();
$entity = new Blogcomment();
$blogarticle=$em->getRepository("CadolesPortalBundle:Blogarticle")->find($idarticle);
if($blogarticle) $entity->setBlogarticle($blogarticle);
$entity->setName("Commentaire");
$form = $this->entityForm($entity,$access);
$form->handleRequest($request);
if ($form->isValid()) {
$entity->setUser($this->getUser());
$entity->setSubmit(new \Datetime());
$em->persist($entity);
$em->flush();
foreach($entity->getBlogarticle()->getBlog()->getGroups() as $group) {
if($group->getFgcanshare()) {
$url=$this->generateUrl('cadoles_portal_'.$access.'_blogarticle_view',["id"=>$entity->getBlogarticle()->getId()]);
$message="Création commentaire article<br><a href='$url'>".$entity->getName()."</a>";
$usergroup=$em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(["group"=>$group,"user"=>$this->getUser()]);
if($usergroup) {
$key=$usergroup->getKeyvalue();
$websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key,$this->getUser()->getId(),$group->getId(),$message);
}
}
}
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_blogarticle_view',["id"=>$entity->getBlogarticle()->getId()]));
}
return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => ($access=="config"),
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'mode' => "submit",
'access' => $access,
'form' => $form->createView()
]);
}
public function updateAction(Request $request, $id,$access="config")
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
// On s'assure que l'utilisateur à la permission de modifier
if($access=="user") {
$em->getRepository("CadolesPortalBundle:Blog")->getPermission($this->getUser(),$entity->getBlogarticle()->getBlog(),$cansee,$canupdate,$canadd);
if(!$canadd&&$this->getUser()!=$entity->getUser()) throw $this->createNotFoundException('Permission denied');
}
// Création du formulaire
$form = $this->entityForm($entity,$access);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
foreach($entity->getBlogarticle()->getBlog()->getGroups() as $group) {
if($group->getFgcanshare()) {
$url=$this->generateUrl('cadoles_portal_'.$access.'_blogarticle_view',["id"=>$entity->getBlogarticle()->getId()]);
$message="Modification commentaire article<br><a href='$url'>".$entity->getBlogarticle()->getName()."</a>";
$usergroup=$em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(["group"=>$group,"user"=>$this->getUser()]);
if($usergroup) {
$key=$usergroup->getKeyvalue();
$websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key,$this->getUser()->getId(),$group->getId(),$message);
}
}
}
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_blogarticle_view',["id"=>$entity->getBlogarticle()->getId()]));
}
return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => ($access=="config"),
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'access' => $access,
'mode' => "update",
'form' => $form->createView(),
]);
}
public function deleteAction(Request $request, $id,$access="config")
{
$em = $this->getDoctrine()->getManager();
$entity = $this->getDoctrine()->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
$idarticle=$entity->getBlogarticle()->getId();
// On s'assure que l'utilisateur à la permission de supprimer
if($access=="user") {
$em->getRepository("CadolesPortalBundle:Blog")->getPermission($this->getUser(),$entity->getBlogarticle()->getBlog(),$cansee,$canupdate,$canadd);
if(!$canadd&&$this->getUser()!=$entity->getUser()) throw $this->createNotFoundException('Permission denied');
}
// Suppression
$em->remove($entity);
$em->flush();
// Retour
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_blogarticle_view',["id"=>$idarticle]));
}
public function uploadAction(Request $request,$access=null) {
// Fichier temporaire uploadé
$tmpfile = $request->files->get('upload');
$extention = $tmpfile->getClientOriginalExtension();
// Répertoire de Destination
$fs = new Filesystem();
$rootdir = $this->get('kernel')->getRootDir()."/../web";
$fs->mkdir($rootdir."/uploads/ckeditor");
// Fichier cible
$targetName = uniqid().".".$extention;
$targetFile = $rootdir."/uploads/ckeditor/".$targetName;
$targetUrl = "/".$this->getParameter('alias')."/uploads/ckeditor/".$targetName;
$message = "";
move_uploaded_file($tmpfile,$targetFile);
$output["uploaded"]=1;
$output["fileName"]=$targetName;
$output["url"]=$targetUrl;
return new Response(json_encode($output));
}
public function imageAction($access="config")
{
return $this->render('CadolesPortalBundle:Blogarticle:image.html.twig',[
'useheader' => false,
'usemenu' => false,
'usesidebar' => false,
'access' => $access
]);
}
}

View File

@ -559,6 +559,7 @@ class PageController extends Controller
'group' => $groupid
]);
}
// Type Widgets
if($entity->getPageCategory()->getId()==2) {
return $this->render($this->labelentity.':viewwidget.html.twig', [

View File

@ -1449,18 +1449,36 @@ class PagewidgetController extends Controller
if($fs->exists($directory)) {
$finder = new Finder();
$finder->sortByName()->in($directory)->exclude('thumb');
$finder->sortByName()->in($directory)->exclude('thumb')->exclude('thumbmini');
foreach ($finder as $file) {
$tmp=[];
$tmp["name"]=$file->getRelativePathname();
$tmp["extension"]=$file->getExtension();
$tmp["extension"]=strtolower($file->getExtension());
$fileinfo = new file($file->getPathname());
$tmp["minetype"]=$fileinfo->getMimeType();
$tmp["minefamily"]=explode("/",$tmp["minetype"])[0];
$tmp["thumb"]="";
if($fs->exists($directory."/thumb/".$tmp["name"])) {
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"]);
$tmp["thumb"]="data:image/" . $tmp["extension"] . ";base64," . base64_encode($data);
}
elseif($fs->exists($directory."/thumb/".$tmp["name"])) {
$data = file_get_contents($directory."/thumb/".$tmp["name"]);
$tmp["thumb"]="data:image/" . $tmp["extension"] . ";base64," . base64_encode($data);
}
@ -1504,7 +1522,7 @@ class PagewidgetController extends Controller
if($fs->exists($directory)) {
$finder = new Finder();
$finder->sortByName()->in($directory)->exclude('thumb');
$finder->sortByName()->in($directory)->exclude('thumb')->exclude('thumbmini');
foreach ($finder as $file) {
$tmp=[];
@ -1677,6 +1695,77 @@ class PagewidgetController extends Controller
]);
}
public function viewprojectAction(Request $request,$id,$access="config") {
$usage=$request->query->get('usage');
$group=$request->query->get('group');
$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($entity->getParameter()["fields"] as $parameter) {
switch($parameter["id"]) {
case "nbarticle":
$nbarticle=$parameter["value"];
break;
}
}
// On récupère soit les projects du group en cours soit l'ensemble des projects de l'utilisateur
$user=$this->getUser();
if($usage=="group") {
$projects=$em->getRepository("CadolesPortalBundle:Project")->getProjectsGroup($this->getUser(),$group);
if($projects) $firstproject=$projects[0]->getId();
}
else {
$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
$em->getRepository("CadolesPortalBundle:Projecttask")->getProjectsTasks($projects,0,$nbarticle,$count,$projecttasks);
foreach($projecttasks as $key => $projecttask) {
if($projecttask->getPercentage()==100) unset($projecttasks[$key]);
}
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->getOwner() && $projecttask->getOwner()!=$user) unset($projecttasks[$key]);
}
}
}
// Render
return $this->render($this->labelentity.':viewproject.html.twig', [
'entity' => $entity,
'canadd' => $canupdate,
'canupdate' => $canupdate,
'projecttasks' => $projecttasks,
'nbarticle' => $nbarticle,
'access' => $access,
'firstproject' => $firstproject,
'usage' => $usage
]);
}
public function viewseparatorAction($id,$access="config") {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id);
@ -1889,6 +1978,7 @@ class PagewidgetController extends Controller
$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") {
@ -1896,7 +1986,6 @@ class PagewidgetController extends Controller
}
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');
}
@ -1942,6 +2031,7 @@ class PagewidgetController extends Controller
'description' => $description,
'members' => $members,
'id' => $id,
'idpage' => $page->getId(),
]);
}
@ -2024,7 +2114,7 @@ class PagewidgetController extends Controller
'canadd' => ($user),
'canupdate' => $canupdate,
'usage' => $usage,
'groups' => $mygroups,
'groups' => $mygroups,
]);
}
@ -2132,9 +2222,12 @@ class PagewidgetController extends Controller
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
if(!$cansee) throw $this->createNotFoundException('Permission denied');
}
$onlyservice = $this->container->get('cadoles.portal.service.only');
$files=$onlyservice->getDocument($group, $folders, $firstfolder, $tasks);
$grp=$em->getRepository("CadolesCoreBundle:Group")->find($group);
$grp=null;
if($group) $grp=$em->getRepository("CadolesCoreBundle:Group")->find($group);
if($grp) $idonly= $grp->getIdOnlyoffice();
else $idonly=0;

View File

@ -0,0 +1,422 @@
<?php
namespace Cadoles\PortalBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Doctrine\Common\Collections\ArrayCollection;
use Ramsey\Uuid\Uuid;
use Cadoles\PortalBundle\Entity\Project;
use Cadoles\PortalBundle\Form\ProjectType;
use Cadoles\PortalBundle\Form\ProjectShareType;
use Cadoles\PortalBundle\Form\ProjectWriterType;
class ProjectController extends Controller
{
private $labelentity="CadolesPortalBundle:Project";
private $routeprimary="cadoles_portal_config_project";
public function listAction()
{
return $this->render($this->labelentity.':list.html.twig',[
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
]);
}
public function ajaxlistAction(Request $request,$access="config")
{
// S'assurer que c'est un appel ajax
/*
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(array('message' => 'Interdit'), 400);
}
*/
$em = $this->getDoctrine()->getManager();
$start=$request->query->get('start');
$length= $request->query->get('length');
$search= $request->query->get('search');
$draw= $request->query->get('draw');
$order= $request->query->get('order');
$alluser= $request->query->get('alluser');
// On sauvegarde en session le flag alluser
$this->get("session")->set("alluserproject",$alluser);
// Query de base
$qbase=$em->createQueryBuilder()->from($this->labelentity,'table');
$qsearch=$em->createQueryBuilder()->from($this->labelentity,'table');
if($alluser=="false") {
$qbase->where("table.user is null");
$qsearch->where("table.user is null");
}
else {
$qbase->from('CadolesCoreBundle:User','user')
->where("table.user=user");
$qsearch->from('CadolesCoreBundle:User','user')
->where("table.user=user");
}
if($alluser=="false")
$qsearch->andwhere('table.id LIKE :value OR table.name LIKE :value');
else
$qsearch->andWhere('table.id LIKE :value OR table.name LIKE :value OR user.username LIKE :value') ;
$qsearch->setParameter("value", "%".$search["value"]."%");
// Nombre total d'enregistrement
$total = $qbase->select('COUNT(table)')->getQuery()->getSingleScalarResult();
// Nombre d'enregistrement filtré
if($search["value"]=="")
$totalf = $total;
else {
$totalf= $qsearch->select('COUNT(table)')->getQuery()->getSingleScalarResult();
}
// Parcours des Enregistrement
if($search["value"]=="")
$qb = $qbase->select('table');
else
$qb = $qsearch->select('table');
// Order
switch($order[0]["column"]) {
case 1 :
$qb->orderBy('table.name',$order[0]["dir"]);
break;
case 2 :
if($alluser=="true") $qb->orderBy('user.username',$order[0]["dir"]);
break;
}
// Execution de la requete d'affichage
$datas=$qb->setFirstResult($start)->setMaxResults($length)->getQuery()->getResult();
//dump($qsearch->getQuery()->getSql());
// Construction du tableau de retour
$output = array(
'draw' => $draw,
'recordsFiltered' => $totalf,
'recordsTotal' => $total,
'data' => array(),
);
foreach($datas as $data) {
$route=str_replace("_config_","_".$access."_",$this->routeprimary);
$action = "";
$action.="<a href='".$this->generateUrl($route.'_delete', array('id'=>$data->getId()))."' data-method='delete'><i class='fa fa-trash fa-fw fa-2x'></i></a>";
$action.="<a href='".$this->generateUrl($route.'_view', array('id'=>$data->getId()))."'><i class='fa fa-eye fa-2x'></i></a>";
$user="";
if($data->getUser()) {
$user.="<img src='/".$this->container->getParameter('alias')."/uploads/avatar/".$data->getUser()->getAvatar()."' class='avatar' style='margin:0px 5px 0px 0px;display:inline-block;'>";
$user.=$data->getUser()->getUsername();
}
array_push($output["data"],array($action,$data->getName(),$user));
}
// Retour
return new Response(json_encode($output), 200);
}
public function ajaxseleclistAction(Request $request)
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(array('message' => 'Interdit'), 400);
}
$output=array();
$em = $this->getDoctrine()->getManager();
$page_limit=$request->query->get('page_limit');
$q=$request->query->get('q');
$qb = $em->createQueryBuilder();
$qb->select('table')->from("CadolesPortalBundle:Project",'table')
->where('table.name LIKE :value')
->setParameter("value", "%".$q."%")
->orderBy('table.name');
$datas=$qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
foreach($datas as $data) {
array_push($output,array("id"=>$data->getId(),"text"=>$data->getName()));
}
$response = new Response(json_encode($output));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
private function entityForm(Project $entity,$access="config")
{
$route=str_replace("_config_","_".$access."_",$this->routeprimary);
if ($this->getDoctrine()->getManager()->contains($entity)) {
return $this->createForm(ProjectType::class, $entity, [
"mode" => "update",
"access" => $access
]);
}
else {
return $this->createForm(ProjectType::class, $entity, [
"mode" => "submit",
"access" => $access
]);
}
}
public function submitAction(Request $request,$access="config")
{
if($access=="user"&&!$this->get('session')->get('cancreateproject'))
throw $this->createNotFoundException('Permission denied');
$entity = new Project();
$form = $this->entityForm($entity,$access);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
if($access=="user") $entity->setUser($this->getUser());
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_project_view',["id"=>$entity->getId()]));
}
return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => ($access=="config"),
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'mode' => "submit",
'access' => $access,
'form' => $form->createView()
]);
}
public function updateAction(Request $request, $id,$access="config")
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
// On s'assure que l'utilisateur à la permission de modifier
if($access=="user") {
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate,$canadd);
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
}
// Création du formulaire
$form = $this->entityForm($entity,$access);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_project_view',["id"=>$entity->getId()]));
}
return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => ($access=="config"),
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'access' => $access,
'mode' => "update",
'form' => $form->createView(),
]);
}
public function shareAction(Request $request, $id,$access="config")
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
// On s'assure que l'utilisateur à la permission de modifier
if($access=="user") {
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate,$canadd);
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
}
// Création du formulaire
$form = $this->createForm(ProjectShareType::class, $entity, ["access" => $access, "user" => $this->getUser()]);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_project_view',["id"=>$id]));
}
return $this->render($this->labelentity.':share.html.twig', [
'useheader' => ($access=="config"),
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'access' => $access,
'form' => $form->createView(),
]);
}
public function writerAction(Request $request, $id,$access="config")
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
// On s'assure que l'utilisateur à la permission de modifier
if($access=="user") {
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate,$canadd);
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
}
// Création du formulaire
$form = $this->createForm(ProjectWriterType::class, $entity, ["id"=>$entity->getId(),"access" => $access, "user" => $this->getUser()]);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_project_view',["id"=>$id]));
}
return $this->render($this->labelentity.':writer.html.twig', [
'useheader' => ($access=="config"),
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'access' => $access,
'form' => $form->createView(),
]);
}
public function deleteAction(Request $request, $id,$access="config")
{
$em = $this->getDoctrine()->getManager();
$entity = $this->getDoctrine()->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
// On s'assure que l'utilisateur à la permission de supprimer
if($access=="user") {
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate,$canadd);
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
}
// Suppression
$em->remove($entity);
$em->flush();
// Retour
if($access=="config")
return $this->redirect($this->generateUrl($this->routeprimary));
else
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_project_view'));
}
public function viewAction(Request $request, $id, $access="config") {
$page=$request->query->get("page");
if(is_null($page)) $page=1;
$em = $this->getDoctrine()->getManager();
$entity=[];
if($id!=0) {
$entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
}
// Permissions
$user=$this->getUser();
if($access=="config") {
$canupdate = true;
$canadd=true;
$cansee=true;
$projects=$em->getRepository($this->labelentity)->findBy(["id"=>$id]);
$entity->setCanupdate(true);
$entity->setCanadd(true);
}
else {
// On récupère l'ensemble des projects de l'utilisateur
$em->getRepository($this->labelentity)->getProjectsUser($user,$projectsuser,$projectsadmin,$projectsshared);
$projects=array_merge($projectsuser,$projectsadmin->toArray(),$projectsshared);
// Utilisateur sans project = creation d'un project par défaut
if(empty($projectsuser)&&$user) {
$project=new Project();
$project->setName("Mon Project");
$project->setUser($user);
$project->setCanupdate(true);
$em->persist($project);
$em->flush();
$projectsuser=[$project];
}
// permission
if($id==0) {
$cansee=true;
$canadd=($this->getUser());
}
else {
$em->getRepository($this->labelentity)->getPermission($user,$entity,$cansee,$canupdate,$canadd);
}
if(!$cansee) throw $this->createNotFoundException('Permission denied');
$canupdate=$this->get('session')->get('cancreateproject');
}
$pagination=15;
if($entity)
$em->getRepository("CadolesPortalBundle:Projecttask")->getProjectsTasks($entity,($page-1)*$pagination,$pagination,$count,$projecttasks);
else
$em->getRepository("CadolesPortalBundle:Projecttask")->getProjectsTasks($projects,($page-1)*$pagination,$pagination,$count,$projecttasks);
return $this->render($this->labelentity.':view.html.twig', [
'useheader' => ($access=="config"),
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'access' => $access,
'canupdate' => $canupdate,
'canadd' => $cansee,
'projecttasks' => $projecttasks,
'projects' => $projects,
'countarticles' => $count,
'pagination' => $pagination,
'page' => $page
]);
}
}

View File

@ -0,0 +1,191 @@
<?php
namespace Cadoles\PortalBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Filesystem\Filesystem;
use Cadoles\PortalBundle\Entity\Projectcomment;
use Cadoles\PortalBundle\Form\ProjectcommentType;
use Cadoles\CoreBundle\Entity\Usergroup;
class ProjectcommentController extends Controller
{
private $labelentity="CadolesPortalBundle:Projectcomment";
private $routeprimary="cadoles_portal_config_projectcomment";
private function entityForm(Projectcomment $entity,$access="config")
{
$route=str_replace("_config_","_".$access."_",$this->routeprimary);
if ($this->getDoctrine()->getManager()->contains($entity)) {
return $this->createForm(ProjectcommentType::class, $entity, [
"mode" => "update",
"access" => $access,
"user" => $this->getUser()
]);
}
else {
return $this->createForm(ProjectcommentType::class, $entity, [
"mode" => "submit",
"access" => $access,
"user" => $this->getUser()
]);
}
}
public function submitAction(Request $request,$idtask,$access="config")
{
$em = $this->getDoctrine()->getManager();
$entity = new Projectcomment();
$projecttask=$em->getRepository("CadolesPortalBundle:Projecttask")->find($idtask);
if($projecttask) $entity->setProjecttask($projecttask);
$entity->setName("Commentaire");
$form = $this->entityForm($entity,$access);
$form->handleRequest($request);
if ($form->isValid()) {
$entity->setUser($this->getUser());
$entity->setSubmit(new \Datetime());
$em->persist($entity);
$em->flush();
foreach($entity->getProjecttask()->getProject()->getGroups() as $group) {
if($group->getFgcanshare()) {
$url=$this->generateUrl('cadoles_portal_'.$access.'_projecttask_view',["id"=>$entity->getProjecttask()->getId()]);
$message="Création commentaire tâche<br><a href='$url'>".$entity->getName()."</a>";
$usergroup=$em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(["group"=>$group,"user"=>$this->getUser()]);
if($usergroup) {
$key=$usergroup->getKeyvalue();
$websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key,$this->getUser()->getId(),$group->getId(),$message);
}
}
}
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_projecttask_view',["id"=>$entity->getProjecttask()->getId()]));
}
return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => ($access=="config"),
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'mode' => "submit",
'access' => $access,
'form' => $form->createView()
]);
}
public function updateAction(Request $request, $id,$access="config")
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
// On s'assure que l'utilisateur à la permission de modifier
if($access=="user") {
$em->getRepository("CadolesPortalBundle:Project")->getPermission($this->getUser(),$entity->getProjecttask()->getProject(),$cansee,$canupdate,$canadd);
if(!$canadd&&$this->getUser()!=$entity->getUser()) throw $this->createNotFoundException('Permission denied');
}
// Création du formulaire
$form = $this->entityForm($entity,$access);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
foreach($entity->getProjecttask()->getProject()->getGroups() as $group) {
if($group->getFgcanshare()) {
$url=$this->generateUrl('cadoles_portal_'.$access.'_projecttask_view',["id"=>$entity->getProjecttask()->getId()]);
$message="Modification commentaire tâche<br><a href='$url'>".$entity->getProjecttask()->getName()."</a>";
$usergroup=$em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(["group"=>$group,"user"=>$this->getUser()]);
if($usergroup) {
$key=$usergroup->getKeyvalue();
$websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key,$this->getUser()->getId(),$group->getId(),$message);
}
}
}
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_projecttask_view',["id"=>$entity->getProjecttask()->getId()]));
}
return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => ($access=="config"),
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'access' => $access,
'mode' => "update",
'form' => $form->createView(),
]);
}
public function deleteAction(Request $request, $id,$access="config")
{
$em = $this->getDoctrine()->getManager();
$entity = $this->getDoctrine()->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
$idtask=$entity->getProjecttask()->getId();
// On s'assure que l'utilisateur à la permission de supprimer
if($access=="user") {
$em->getRepository("CadolesPortalBundle:Project")->getPermission($this->getUser(),$entity->getProjecttask()->getProject(),$cansee,$canupdate,$canadd);
if(!$canadd&&$this->getUser()!=$entity->getUser()) throw $this->createNotFoundException('Permission denied');
}
// Suppression
$em->remove($entity);
$em->flush();
// Retour
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_projecttask_view',["id"=>$idtask]));
}
public function uploadAction(Request $request,$access=null) {
// Fichier temporaire uploadé
$tmpfile = $request->files->get('upload');
$extention = $tmpfile->getClientOriginalExtension();
// Répertoire de Destination
$fs = new Filesystem();
$rootdir = $this->get('kernel')->getRootDir()."/../web";
$fs->mkdir($rootdir."/uploads/ckeditor");
// Fichier cible
$targetName = uniqid().".".$extention;
$targetFile = $rootdir."/uploads/ckeditor/".$targetName;
$targetUrl = "/".$this->getParameter('alias')."/uploads/ckeditor/".$targetName;
$message = "";
move_uploaded_file($tmpfile,$targetFile);
$output["uploaded"]=1;
$output["fileName"]=$targetName;
$output["url"]=$targetUrl;
return new Response(json_encode($output));
}
public function imageAction($access="config")
{
return $this->render('CadolesPortalBundle:Projecttask:image.html.twig',[
'useheader' => false,
'usemenu' => false,
'usesidebar' => false,
'access' => $access
]);
}
}

View File

@ -0,0 +1,433 @@
<?php
namespace Cadoles\PortalBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Cadoles\PortalBundle\Entity\Projecttask;
use Cadoles\PortalBundle\Form\ProjecttaskType;
use Cadoles\CoreBundle\Entity\Usergroup;
class ProjecttaskController extends Controller
{
private $labelentity="CadolesPortalBundle:Projecttask";
private $routeprimary="cadoles_portal_config_projecttask";
private function entityForm(Projecttask $entity,$access="config")
{
$route=str_replace("_config_","_".$access."_",$this->routeprimary);
if ($this->getDoctrine()->getManager()->contains($entity)) {
return $this->createForm(ProjecttaskType::class, $entity, [
"mode" => "update",
"access" => $access,
"user" => $this->getUser()
]);
}
else {
return $this->createForm(ProjecttaskType::class, $entity, [
"mode" => "submit",
"access" => $access,
"user" => $this->getUser()
]);
}
}
public function submitAction(Request $request,$idproject,$access="config")
{
$em = $this->getDoctrine()->getManager();
$entity = new Projecttask();
$project=$em->getRepository("CadolesPortalBundle:Project")->find($idproject);
if($project) $entity->setProject($project);
$entity->setPriority(0);
$entity->setPercentage(0);
$form = $this->entityForm($entity,$access);
$form->handleRequest($request);
if ($form->isValid()) {
if($entity->getPercentage()>100) $entity->setPercentage(100);
$entity->setOwner($this->getUser());
$entity->setSubmit(new \Datetime());
$em->persist($entity);
$em->flush();
if($entity->getUser()&&$entity->getUser()!=$entity->getOwner()) {
$this->notifMail($entity);
}
foreach($entity->getProject()->getGroups() as $group) {
if($group->getFgcanshare()) {
$url=$this->generateUrl('cadoles_portal_'.$access.'_projecttask_view',["id"=>$entity->getId()]);
$message="Création tâche<br><a href='$url'>".$entity->getName()."</a>";
$usergroup=$em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(["group"=>$group,"user"=>$this->getUser()]);
if($usergroup) {
$key=$usergroup->getKeyvalue();
$websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key,$this->getUser()->getId(),$group->getId(),$message);
}
}
}
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_projecttask_view',["id"=>$entity->getId()]));
}
return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => ($access=="config"),
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'mode' => "submit",
'access' => $access,
'form' => $form->createView()
]);
}
public function updateAction(Request $request, $id,$access="config")
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
$oldpercentage=$entity->getPercentage();
$olduser=$entity->getUser();
// 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;
if(!$canadd) throw $this->createNotFoundException('Permission denied');
}
// Création du formulaire
$form = $this->entityForm($entity,$access);
$form->handleRequest($request);
if ($form->isValid()) {
if($entity->getPercentage()>100) $entity->setPercentage(100);
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
if($entity->getUser()&&$entity->getUser()!=$entity->getOwner()&&$entity->getUser()!=$olduser) {
$this->notifMail($entity);
}
foreach($entity->getProject()->getGroups() as $group) {
if($group->getFgcanshare()) {
$url=$this->generateUrl('cadoles_portal_'.$access.'_projecttask_view',["id"=>$entity->getId()]);
if($oldpercentage<100&$entity->getPercentage()==100)
$message="Tâche terminée<br><a href='$url'>".$entity->getName()."</a>";
elseif($oldpercentage==100&$entity->getPercentage()<100)
$message="Tâche réouverte<br><a href='$url'>".$entity->getName()."</a>";
else
$message="Modification tâche<br><a href='$url'>".$entity->getName()."</a>";
$usergroup=$em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(["group"=>$group,"user"=>$this->getUser()]);
if($usergroup) {
$key=$usergroup->getKeyvalue();
$websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key,$this->getUser()->getId(),$group->getId(),$message);
}
}
}
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_projecttask_view',["id"=>$entity->getId()]));
}
return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => ($access=="config"),
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'access' => $access,
'mode' => "update",
'form' => $form->createView(),
]);
}
public function deleteAction(Request $request, $id,$access="config")
{
$em = $this->getDoctrine()->getManager();
$entity = $this->getDoctrine()->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
$idproject=$entity->getProject()->getId();
// On s'assure que l'utilisateur à la permission de supprimer
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;
if(!$canadd) throw $this->createNotFoundException('Permission denied');
}
// Suppression
$em->remove($entity);
$em->flush();
// Retour
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_project_view',["id"=>$idproject]));
}
public function viewAction($id, Request $request, $access="config")
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
// Permissions
$user=$this->getUser();
if($access=="config") {
$canupdate = true;
$canadd=true;
$projects=$em->getRepository("CadolesPortalBundle:Project")->findBy(["id"=>$entity->getProject()->getId()]);
}
else {
// On récupère l'ensemble des projects de l'utilisateur
$em->getRepository("CadolesPortalBundle:Project")->getProjectsUser($user,$projectsuser,$projectsadmin,$projectsshared);
$projects=array_merge($projectsuser,$projectsadmin->toArray(),$projectsshared);
// permission
if($id==0) {
$cansee=true;
$canadd=true;
}
else {
$em->getRepository("CadolesPortalBundle:Project")->getPermission($user,$entity->getProject(),$cansee,$canupdate,$canadd);
}
if(!$cansee) throw $this->createNotFoundException('Permission denied');
$canupdate=false;
if($user) {
$canupdate=true;
if((is_null($entity->getUser()) && $user==$entity->getOwner()) || $user==$entity->getUser()) $canadd=true;
}
}
$em->getRepository("CadolesPortalBundle:Projecttask")->getProjectsTasks($projects,0,10,$count,$projecttasks);
// Récupérer les fichiers de la tache
$directory=$this->get('kernel')->getRootDir()."/../uploads/file/projecttask-".$id;
$files=[];
$fs = new Filesystem();
if($fs->exists($directory)) {
$finder = new Finder();
$finder->sortByName()->in($directory)->exclude('thumb')->exclude('thumbmini');
foreach ($finder as $file) {
$tmp=[];
$tmp["name"]=$file->getRelativePathname();
$tmp["extension"]=strtolower($file->getExtension());
$fileinfo = new file($file->getPathname());
$tmp["minetype"]=$fileinfo->getMimeType();
$tmp["minefamily"]=explode("/",$tmp["minetype"])[0];
$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"]);
$tmp["thumb"]="data:image/" . $tmp["extension"] . ";base64," . base64_encode($data);
}
elseif($fs->exists($directory."/thumb/".$tmp["name"])) {
$data = file_get_contents($directory."/thumb/".$tmp["name"]);
$tmp["thumb"]="data:image/" . $tmp["extension"] . ";base64," . base64_encode($data);
}
elseif($fs->exists($this->get('kernel')->getRootDir()."/../web/bundles/cadolescore/images/files/".$tmp["extension"].".png")) {
$tmp["thumb"]="/".$this->getParameter('alias')."/bundles/cadolescore/images/files/".$tmp["extension"].".png";
}
array_push($files,$tmp);
}
}
return $this->render($this->labelentity.':view.html.twig', [
'useheader' => ($access=="config"),
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'access' => $access,
'canupdate' => $canupdate,
'canadd' => $canadd,
'projects' => $projects,
'projecttasks' => $projecttasks,
'files' => $files
]);
}
public function uploadAction(Request $request,$access=null) {
// Fichier temporaire uploadé
$tmpfile = $request->files->get('upload');
$extention = $tmpfile->getClientOriginalExtension();
// Répertoire de Destination
$fs = new Filesystem();
$rootdir = $this->get('kernel')->getRootDir()."/../web";
$fs->mkdir($rootdir."/uploads/ckeditor");
// Fichier cible
$targetName = uniqid().".".$extention;
$targetFile = $rootdir."/uploads/ckeditor/".$targetName;
$targetUrl = "/".$this->getParameter('alias')."/uploads/ckeditor/".$targetName;
$message = "";
move_uploaded_file($tmpfile,$targetFile);
$output["uploaded"]=1;
$output["fileName"]=$targetName;
$output["url"]=$targetUrl;
return new Response(json_encode($output));
}
public function usersAction(Request $request, $access="config") {
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(array('message' => 'Interdit'), 400);
}
$output=array();
$em = $this->getDoctrine()->getManager();
$page_limit=$request->query->get('page_limit');
$q=$request->query->get('q');
$projectid=$request->query->get('project');
$project=$em->getRepository("CadolesPortalBundle:Project")->find($projectid);
if($project) {
$user=$this->getUser();
$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") {
$qb= $em->createQueryBuilder()
->select('user')
->from('CadolesPortalBundle:Project','project')
->andwhere('project.id=:project')
->from('CadolesCoreBundle:UserGroup','usergroup')
->andwhere("usergroup.group MEMBER OF project.groups")
->from('CadolesCoreBundle:User','user')
->andwhere("usergroup.user=user")
->setParameter('project',$projectid);
$datas=$qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
foreach($datas as $data) {
array_push($output,array("id"=>$data->getId(),"text"=>$data->getUsername()));
}
}
// Sinon il ne peut que s'affecter lui
else {
array_push($output,array("id"=>$user->getId(),"text"=>$user->getUsername()));
}
}
$response = new Response(json_encode($output));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
public function percentageAction($id,Request $request, $access="config") {
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(array('message' => 'Interdit'), 400);
}
$output=array();
$em = $this->getDoctrine()->getManager();
$percentage=$request->get('percentage');
$entity = $this->getDoctrine()->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
$idproject=$entity->getProject()->getId();
$oldpercentage=$entity->getPercentage();
// 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;
if(!$canadd) throw $this->createNotFoundException('Permission denied');
}
$entity->setPercentage($percentage);
$em->persist($entity);
$em->flush();
foreach($entity->getProject()->getGroups() as $group) {
if($group->getFgcanshare()) {
$url=$this->generateUrl('cadoles_portal_'.$access.'_projecttask_view',["id"=>$entity->getId()]);
$message="";
if($oldpercentage<100&$entity->getPercentage()==100)
$message="Tâche terminée<br><a href='$url'>".$entity->getName()."</a>";
elseif($oldpercentage==100&$entity->getPercentage()<100)
$message="Tâche réouverte<br><a href='$url'>".$entity->getName()."</a>";
if($message!="") {
$usergroup=$em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(["group"=>$group,"user"=>$this->getUser()]);
if($usergroup) {
$key=$usergroup->getKeyvalue();
$websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key,$this->getUser()->getId(),$group->getId(),$message);
}
}
}
}
$response = new Response(json_encode($output));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
private function notifMail($entity) {
$appname=$this->get('session')->get('appname');
$url=$this->generateUrl('cadoles_core_redirect', ['route'=>'cadoles_portal_user_projecttask_view','id'=>$entity->getId()], UrlGeneratorInterface::ABSOLUTE_URL);
$urltext=$url;
$urlhtml="<a href='".$url."'>".$url."</a>";
$bodytext="Une tâche vous a été affectée dans le groupe ".$entity->getProject()->getName()."\n".$entity->getName()."\n\nVous pouvez la consulter sur\n";
$bodyhtml=nl2br($bodytext);
$mail_params=array(
"subject" => $appname." : Affectation Tâche dans le groupe ".$entity->getProject()->getName(),
"body_html"=>$bodyhtml.$urlhtml,
"body_text"=>$bodytext.$urltext,
);
$message = $this->container->get('cadoles.core.service.mail');
$message->sendEmail("template", $mail_params, $entity->getUser()->getEmail(), $this->getParameter("noreply"), $appname);
}
}

View File

@ -49,6 +49,11 @@ class Blogarticle
*/
private $fgdraft;
/**
* @ORM\Column(name="fgcomment", type="boolean")
*/
private $fgcomment;
/**
* @var string
*
@ -68,6 +73,13 @@ class Blogarticle
*/
private $blog;
/**
* @var ArrayCollection $blogcomment
* @var Blogcomment
*
* @ORM\OneToMany(targetEntity="Cadoles\PortalBundle\Entity\Blogcomment", mappedBy="blogarticle", cascade={"persist"}, orphanRemoval=true)
*/
private $blogcomments;
@ -248,4 +260,69 @@ class Blogarticle
{
return $this->blog;
}
/**
* Set fgcomment
*
* @param boolean $fgcomment
*
* @return Blogarticle
*/
public function setFgcomment($fgcomment)
{
$this->fgcomment = $fgcomment;
return $this;
}
/**
* Get fgcomment
*
* @return boolean
*/
public function getFgcomment()
{
return $this->fgcomment;
}
/**
* Constructor
*/
public function __construct()
{
$this->blogcomments = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add blogcomment
*
* @param \Cadoles\PortalBundle\Entity\Blogcomment $blogcomment
*
* @return Blogarticle
*/
public function addBlogcomment(\Cadoles\PortalBundle\Entity\Blogcomment $blogcomment)
{
$this->blogcomments[] = $blogcomment;
return $this;
}
/**
* Remove blogcomment
*
* @param \Cadoles\PortalBundle\Entity\Blogcomment $blogcomment
*/
public function removeBlogcomment(\Cadoles\PortalBundle\Entity\Blogcomment $blogcomment)
{
$this->blogcomments->removeElement($blogcomment);
}
/**
* Get blogcomments
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getBlogcomments()
{
return $this->blogcomments;
}
}

View File

@ -0,0 +1,191 @@
<?php
namespace Cadoles\PortalBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Blogcomment
*
* @ORM\Entity
* @ORM\Table(name="blogcomment")
* @ORM\Entity(repositoryClass="Cadoles\PortalBundle\Repository\BlogcommentRepository")
* @ORM\HasLifecycleCallbacks
*/
class Blogcomment
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=100)
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="description", type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(name="submit", type="datetime")
*/
private $submit;
/**
* @ORM\ManyToOne(targetEntity="Cadoles\CoreBundle\Entity\User", inversedBy="blogcomments")
* @ORM\JoinColumn(nullable=true)
*/
private $user;
/**
* @ORM\ManyToOne(targetEntity="Cadoles\PortalBundle\Entity\Blogarticle", inversedBy="blogcomments")
* @ORM\JoinColumn(nullable=false)
*/
private $blogarticle;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return Blogcomment
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set description
*
* @param string $description
*
* @return Blogcomment
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set submit
*
* @param \DateTime $submit
*
* @return Blogcomment
*/
public function setSubmit($submit)
{
$this->submit = $submit;
return $this;
}
/**
* Get submit
*
* @return \DateTime
*/
public function getSubmit()
{
return $this->submit;
}
/**
* Set user
*
* @param \Cadoles\CoreBundle\Entity\User $user
*
* @return Blogcomment
*/
public function setUser(\Cadoles\CoreBundle\Entity\User $user = null)
{
$this->user = $user;
return $this;
}
/**
* Get user
*
* @return \Cadoles\CoreBundle\Entity\User
*/
public function getUser()
{
return $this->user;
}
/**
* Set blogarticle
*
* @param \Cadoles\PortalBundle\Entity\Blogarticle $blogarticle
*
* @return Blogcomment
*/
public function setBlogarticle(\Cadoles\PortalBundle\Entity\Blogarticle $blogarticle)
{
$this->blogarticle = $blogarticle;
return $this;
}
/**
* Get blogarticle
*
* @return \Cadoles\PortalBundle\Entity\Blogarticle
*/
public function getBlogarticle()
{
return $this->blogarticle;
}
}

View File

@ -0,0 +1,292 @@
<?php
namespace Cadoles\PortalBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Project
*
* @ORM\Entity
* @ORM\Table(name="project")
* @ORM\Entity(repositoryClass="Cadoles\PortalBundle\Repository\ProjectRepository")
* @ORM\HasLifecycleCallbacks
*/
class Project
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=100)
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="roles", type="array", nullable=true)
*/
private $roles;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\CoreBundle\Entity\Group", inversedBy="projects", cascade={"persist"})
* @ORM\JoinTable(name="projectgroupe",
* joinColumns={@ORM\JoinColumn(name="project", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="groupe", referencedColumnName="id")}
* )
*/
protected $groups;
/**
* @ORM\ManyToOne(targetEntity="Cadoles\CoreBundle\Entity\User", inversedBy="projects")
* @ORM\JoinColumn(nullable=true)
*/
private $user;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\CoreBundle\Entity\User", inversedBy="projectwriters", cascade={"persist"})
* @ORM\JoinTable(name="projectwriter",
* joinColumns={@ORM\JoinColumn(name="project", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="user", referencedColumnName="id")}
* )
*/
protected $writers;
/**
* @var ArrayCollection $projecttask
* @var Blogarticle
*
* @ORM\OneToMany(targetEntity="Cadoles\PortalBundle\Entity\Projecttask", mappedBy="project", cascade={"persist"}, orphanRemoval=true)
*/
private $projecttasks;
/* champs calculé non stocké en base */
private $canupdate;
public function getCanupdate()
{
return $this->canupdate;
}
public function setCanupdate($canupdate)
{
$this->canupdate = $canupdate;
return $this;
}
/* champs calculé non stocké en base */
private $canadd;
public function getCanadd()
{
return $this->canadd;
}
public function setCanadd($canadd)
{
$this->canadd = $canadd;
return $this;
}
/**
* Constructor
*/
public function __construct()
{
$this->groups = new \Doctrine\Common\Collections\ArrayCollection();
$this->writers = new \Doctrine\Common\Collections\ArrayCollection();
$this->projecttasks = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return Project
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set roles
*
* @param array $roles
*
* @return Project
*/
public function setRoles($roles)
{
$this->roles = $roles;
return $this;
}
/**
* Get roles
*
* @return array
*/
public function getRoles()
{
return $this->roles;
}
/**
* Add group
*
* @param \Cadoles\CoreBundle\Entity\Group $group
*
* @return Project
*/
public function addGroup(\Cadoles\CoreBundle\Entity\Group $group)
{
$this->groups[] = $group;
return $this;
}
/**
* Remove group
*
* @param \Cadoles\CoreBundle\Entity\Group $group
*/
public function removeGroup(\Cadoles\CoreBundle\Entity\Group $group)
{
$this->groups->removeElement($group);
}
/**
* Get groups
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getGroups()
{
return $this->groups;
}
/**
* Set user
*
* @param \Cadoles\CoreBundle\Entity\User $user
*
* @return Project
*/
public function setUser(\Cadoles\CoreBundle\Entity\User $user = null)
{
$this->user = $user;
return $this;
}
/**
* Get user
*
* @return \Cadoles\CoreBundle\Entity\User
*/
public function getUser()
{
return $this->user;
}
/**
* Add writer
*
* @param \Cadoles\CoreBundle\Entity\User $writer
*
* @return Project
*/
public function addWriter(\Cadoles\CoreBundle\Entity\User $writer)
{
$this->writers[] = $writer;
return $this;
}
/**
* Remove writer
*
* @param \Cadoles\CoreBundle\Entity\User $writer
*/
public function removeWriter(\Cadoles\CoreBundle\Entity\User $writer)
{
$this->writers->removeElement($writer);
}
/**
* Get writers
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getWriters()
{
return $this->writers;
}
/**
* Add projecttask
*
* @param \Cadoles\PortalBundle\Entity\Projecttask $projecttask
*
* @return Project
*/
public function addProjecttask(\Cadoles\PortalBundle\Entity\Projecttask $projecttask)
{
$this->projecttasks[] = $projecttask;
return $this;
}
/**
* Remove projecttask
*
* @param \Cadoles\PortalBundle\Entity\Projecttask $projecttask
*/
public function removeProjecttask(\Cadoles\PortalBundle\Entity\Projecttask $projecttask)
{
$this->projecttasks->removeElement($projecttask);
}
/**
* Get projecttasks
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProjecttasks()
{
return $this->projecttasks;
}
}

View File

@ -0,0 +1,190 @@
<?php
namespace Cadoles\PortalBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Projectcomment
*
* @ORM\Entity
* @ORM\Table(name="projectcomment")
* @ORM\Entity(repositoryClass="Cadoles\PortalBundle\Repository\ProjectcommentRepository")
* @ORM\HasLifecycleCallbacks
*/
class Projectcomment
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=100)
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="description", type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(name="submit", type="datetime")
*/
private $submit;
/**
* @ORM\ManyToOne(targetEntity="Cadoles\CoreBundle\Entity\User", inversedBy="Projectcomments")
* @ORM\JoinColumn(nullable=true)
*/
private $user;
/**
* @ORM\ManyToOne(targetEntity="Cadoles\PortalBundle\Entity\Projecttask", inversedBy="projectcomments")
* @ORM\JoinColumn(nullable=false)
*/
private $projecttask;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return Projectcomment
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set description
*
* @param string $description
*
* @return Projectcomment
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set submit
*
* @param \DateTime $submit
*
* @return Projectcomment
*/
public function setSubmit($submit)
{
$this->submit = $submit;
return $this;
}
/**
* Get submit
*
* @return \DateTime
*/
public function getSubmit()
{
return $this->submit;
}
/**
* Set user
*
* @param \Cadoles\CoreBundle\Entity\User $user
*
* @return Projectcomment
*/
public function setUser(\Cadoles\CoreBundle\Entity\User $user = null)
{
$this->user = $user;
return $this;
}
/**
* Get user
*
* @return \Cadoles\CoreBundle\Entity\User
*/
public function getUser()
{
return $this->user;
}
/**
* Set projecttask
*
* @param \Cadoles\PortalBundle\Entity\Projecttask $projecttask
*
* @return Projectcomment
*/
public function setProjecttask(\Cadoles\PortalBundle\Entity\Projecttask $projecttask)
{
$this->projecttask = $projecttask;
return $this;
}
/**
* Get projecttask
*
* @return \Cadoles\PortalBundle\Entity\Projecttask
*/
public function getProjecttask()
{
return $this->projecttask;
}
}

View File

@ -0,0 +1,416 @@
<?php
namespace Cadoles\PortalBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Projecttask
*
* @ORM\Entity
* @ORM\Table(name="projecttask")
* @ORM\Entity(repositoryClass="Cadoles\PortalBundle\Repository\ProjecttaskRepository")
* @ORM\HasLifecycleCallbacks
*/
class Projecttask
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=100)
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="description", type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(name="submit", type="datetime")
*/
private $submit;
/**
* @ORM\Column(name="priority", type="integer")
*/
private $priority;
/**
* @ORM\Column(name="end", type="datetime", nullable=true)
*/
private $end;
/**
* @ORM\Column(name="percentage", type="integer")
*/
private $percentage;
/**
* @ORM\ManyToOne(targetEntity="Cadoles\CoreBundle\Entity\User", inversedBy="projecttasks")
* @ORM\JoinColumn(nullable=true)
*/
private $user;
/**
* @ORM\ManyToOne(targetEntity="Cadoles\CoreBundle\Entity\User", inversedBy="projectownertasks")
* @ORM\JoinColumn(nullable=false)
*/
private $owner;
/**
* @ORM\ManyToOne(targetEntity="Cadoles\PortalBundle\Entity\Project", inversedBy="projecttasks")
* @ORM\JoinColumn(nullable=false)
*/
private $project;
/**
* @ORM\ManyToOne(targetEntity="Cadoles\PortalBundle\Entity\Projecttasktag", inversedBy="projecttasks")
* @ORM\JoinColumn(nullable=true)
*/
private $projecttasktag;
/**
* @ORM\ManyToOne(targetEntity="Cadoles\PortalBundle\Entity\Projecttaskstatus", inversedBy="projecttasks")
* @ORM\JoinColumn(nullable=true)
*/
private $projecttaskstatus;
/**
* @var ArrayCollection $projectcomment
* @var Projectcomment
*
* @ORM\OneToMany(targetEntity="Cadoles\PortalBundle\Entity\Projectcomment", mappedBy="projecttask", cascade={"persist"}, orphanRemoval=true)
*/
private $projectcomments;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return Projecttask
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set description
*
* @param string $description
*
* @return Projecttask
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set submit
*
* @param \DateTime $submit
*
* @return Projecttask
*/
public function setSubmit($submit)
{
$this->submit = $submit;
return $this;
}
/**
* Get submit
*
* @return \DateTime
*/
public function getSubmit()
{
return $this->submit;
}
/**
* Set user
*
* @param \Cadoles\CoreBundle\Entity\User $user
*
* @return Projecttask
*/
public function setUser(\Cadoles\CoreBundle\Entity\User $user = null)
{
$this->user = $user;
return $this;
}
/**
* Get user
*
* @return \Cadoles\CoreBundle\Entity\User
*/
public function getUser()
{
return $this->user;
}
/**
* Set project
*
* @param \Cadoles\PortalBundle\Entity\Project $project
*
* @return Projecttask
*/
public function setProject(\Cadoles\PortalBundle\Entity\Project $project)
{
$this->project = $project;
return $this;
}
/**
* Get project
*
* @return \Cadoles\PortalBundle\Entity\Project
*/
public function getProject()
{
return $this->project;
}
/**
* Set owner
*
* @param \Cadoles\CoreBundle\Entity\User $owner
*
* @return Projecttask
*/
public function setOwner(\Cadoles\CoreBundle\Entity\User $owner)
{
$this->owner = $owner;
return $this;
}
/**
* Get owner
*
* @return \Cadoles\CoreBundle\Entity\User
*/
public function getOwner()
{
return $this->owner;
}
/**
* Set projecttasktag
*
* @param \Cadoles\PortalBundle\Entity\Projecttasktag $projecttasktag
*
* @return Projecttask
*/
public function setProjecttasktag(\Cadoles\PortalBundle\Entity\Projecttasktag $projecttasktag = null)
{
$this->projecttasktag = $projecttasktag;
return $this;
}
/**
* Get projecttasktag
*
* @return \Cadoles\PortalBundle\Entity\Projecttasktag
*/
public function getProjecttasktag()
{
return $this->projecttasktag;
}
/**
* Set projecttaskstatus
*
* @param \Cadoles\PortalBundle\Entity\Projecttaskstatus $projecttaskstatus
*
* @return Projecttask
*/
public function setProjecttaskstatus(\Cadoles\PortalBundle\Entity\Projecttaskstatus $projecttaskstatus = null)
{
$this->projecttaskstatus = $projecttaskstatus;
return $this;
}
/**
* Get projecttaskstatus
*
* @return \Cadoles\PortalBundle\Entity\Projecttaskstatus
*/
public function getProjecttaskstatus()
{
return $this->projecttaskstatus;
}
/**
* Set priority
*
* @param integer $priority
*
* @return Projecttask
*/
public function setPriority($priority)
{
$this->priority = $priority;
return $this;
}
/**
* Get priority
*
* @return integer
*/
public function getPriority()
{
return $this->priority;
}
/**
* Set end
*
* @param \DateTime $end
*
* @return Projecttask
*/
public function setEnd($end)
{
$this->end = $end;
return $this;
}
/**
* Get end
*
* @return \DateTime
*/
public function getEnd()
{
return $this->end;
}
/**
* Set percentage
*
* @param integer $percentage
*
* @return Projecttask
*/
public function setPercentage($percentage)
{
$this->percentage = $percentage;
return $this;
}
/**
* Get percentage
*
* @return integer
*/
public function getPercentage()
{
return $this->percentage;
}
/**
* Constructor
*/
public function __construct()
{
$this->projectcomments = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add projectcomment
*
* @param \Cadoles\PortalBundle\Entity\Projectcomment $projectcomment
*
* @return Projecttask
*/
public function addProjectcomment(\Cadoles\PortalBundle\Entity\Projectcomment $projectcomment)
{
$this->projectcomments[] = $projectcomment;
return $this;
}
/**
* Remove projectcomment
*
* @param \Cadoles\PortalBundle\Entity\Projectcomment $projectcomment
*/
public function removeProjectcomment(\Cadoles\PortalBundle\Entity\Projectcomment $projectcomment)
{
$this->projectcomments->removeElement($projectcomment);
}
/**
* Get projectcomments
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProjectcomments()
{
return $this->projectcomments;
}
}

View File

@ -0,0 +1,119 @@
<?php
namespace Cadoles\PortalBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Projecttaskstatus
*
* @ORM\Entity
* @ORM\Table(name="projecttaskstatus")
*/
class Projecttaskstatus
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(name="name", type="string", length=100)
*/
private $name;
/**
* @ORM\OneToMany(targetEntity="Cadoles\PortalBundle\Entity\Projecttask", mappedBy="projecttaskstatus")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $projecttasks;
// A garder pour forcer l'id en init
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* Constructor
*/
public function __construct()
{
$this->projecttasks = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return Projecttaskstatus
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Add projecttask
*
* @param \Cadoles\PortalBundle\Entity\Projecttask $projecttask
*
* @return Projecttaskstatus
*/
public function addProjecttask(\Cadoles\PortalBundle\Entity\Projecttask $projecttask)
{
$this->projecttasks[] = $projecttask;
return $this;
}
/**
* Remove projecttask
*
* @param \Cadoles\PortalBundle\Entity\Projecttask $projecttask
*/
public function removeProjecttask(\Cadoles\PortalBundle\Entity\Projecttask $projecttask)
{
$this->projecttasks->removeElement($projecttask);
}
/**
* Get projecttasks
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProjecttasks()
{
return $this->projecttasks;
}
}

View File

@ -0,0 +1,148 @@
<?php
namespace Cadoles\PortalBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Projecttasktag
*
* @ORM\Entity
* @ORM\Table(name="projecttasktag")
*/
class Projecttasktag
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(name="name", type="string", length=100)
*/
private $name;
/**
* @ORM\Column(name="color", type="string", nullable=false)
*/
private $color;
/**
* @ORM\OneToMany(targetEntity="Cadoles\PortalBundle\Entity\Projecttask", mappedBy="projecttasktag")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $projecttasks;
// A garder pour forcer l'id en init
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* Constructor
*/
public function __construct()
{
$this->projecttasks = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return Projecttasktag
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set color
*
* @param string $color
*
* @return Projecttasktag
*/
public function setColor($color)
{
$this->color = $color;
return $this;
}
/**
* Get color
*
* @return string
*/
public function getColor()
{
return $this->color;
}
/**
* Add projecttask
*
* @param \Cadoles\PortalBundle\Entity\Projecttask $projecttask
*
* @return Projecttasktag
*/
public function addProjecttask(\Cadoles\PortalBundle\Entity\Projecttask $projecttask)
{
$this->projecttasks[] = $projecttask;
return $this;
}
/**
* Remove projecttask
*
* @param \Cadoles\PortalBundle\Entity\Projecttask $projecttask
*/
public function removeProjecttask(\Cadoles\PortalBundle\Entity\Projecttask $projecttask)
{
$this->projecttasks->removeElement($projecttask);
}
/**
* Get projecttasks
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProjecttasks()
{
return $this->projecttasks;
}
}

View File

@ -39,6 +39,11 @@ class BlogarticleType extends AbstractType
"disabled" => ($options["mode"]=="delete"?true:false),
"config" => ["height" => "500px",'filebrowserUploadRoute' => 'cadoles_portal_'.$options["access"].'_blogarticle_upload']
])
->add("fgcomment",ChoiceType::class,[
"label" =>"Permettre les commentaires",
"choices" => ["non"=>"0","oui"=>"1"]
])
->add('image',HiddenType::class, [
"label" =>"image",

View File

@ -0,0 +1,54 @@
<?php
namespace Cadoles\PortalBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Ivory\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\EntityManager;
class BlogcommentType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$user=$options['user'];
$builder
->add('submit', SubmitType::class, [
"label" => ($options["mode"]=="delete"?"Confirmer la Suppression":"Valider"),
"attr" => ($options["mode"]=="delete"?array("class" => "btn btn-danger"):array("class" => "btn btn-success"))
])
->add('name', TextType::class, [
'label' => 'Titre'
])
->add("description",CKEditorType::class,[
"config_name" => 'full_config',
"label" => 'Description',
"required" => false,
"disabled" => ($options["mode"]=="delete"?true:false),
"config" => ["height" => "500px",'filebrowserUploadRoute' => 'cadoles_portal_'.$options["access"].'_blogcomment_upload']
]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Cadoles\PortalBundle\Entity\Blogcomment',
'mode' => 'string',
'access' => 'string',
'user' => 'Cadoles\CoreBundle\Entity\User'
]);
}
}

View File

@ -0,0 +1,60 @@
<?php
namespace Cadoles\PortalBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\EntityManager;
class ProjectShareType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$user=$options['user'];
$builder
->add('submit', SubmitType::class, [
"label" => ($options["mode"]=="delete"?"Confirmer la Suppression":"Valider"),
"attr" => ($options["mode"]=="delete"?array("class" => "btn btn-danger"):array("class" => "btn btn-success"))
])
->add('groups', EntityType::class, [
'label' => 'Partager avec les Groupes',
'class' => 'CadolesCoreBundle:Group',
'query_builder' => function(EntityRepository $er) use ($user) {
return $er->createQueryBuilder('g')
->select('g')
->From('CadolesCoreBundle:UserGroup','ug')
->where('g.fgcanshare=:fgcanshare')
->andWhere('g=ug.group')
->andWhere('ug.user=:user')
->andWhere('ug.fgmanager=:fgcanshare')
->setParameter('fgcanshare',true)
->setParameter('user',$user);
},
'choice_label' => 'label',
'multiple' => true,
'expanded' => true
]);
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Cadoles\PortalBundle\Entity\Project',
'mode' => 'string',
'access' => 'string',
'user' => 'Cadoles\CoreBundle\Entity\User'
]);
}
}

View File

@ -0,0 +1,94 @@
<?php
namespace Cadoles\PortalBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType;
use Symfony\Component\OptionsResolver\OptionsResolver;
class ProjectType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('submit', SubmitType::class, [
"label" => ($options["mode"]=="delete"?"Confirmer la Suppression":"Valider"),
"attr" => ($options["mode"]=="delete"?array("class" => "btn btn-danger"):array("class" => "btn btn-success"))
])
->add('name', TextType::class, [
'label' => 'Nom'
]);
if($options["access"]=="config") {
$builder
->add('roles', ChoiceType::class, [
"label" => 'Visible pour les Rôles',
"choices" => [
"Visiteur" => 'ROLE_ANONYME',
"Utilisateur" => 'ROLE_USER',
"Animateur de Groupe" => 'ROLE_ANIM',
"Modérateur" => 'ROLE_MODO',
"Administateur" => 'ROLE_ADMIN',
],
"multiple" => true,
"expanded" => true,
"disabled" => ($options["mode"]=="delete"?true:false),
])
->add('groups', Select2EntityType::class, [
'label' => 'Visible pour les Groupes',
'class' => 'CadolesCoreBundle:Group',
'text_property' => 'label',
'multiple' => true,
'remote_route' => 'cadoles_core_ajax_group_list',
'primary_key' => 'id',
'text_property' => 'label',
'minimum_input_length' => 0,
'page_limit' => 100,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000,
'language' => 'fr',
'placeholder' => 'Selectionner un groupe',
])
->add('user', Select2EntityType::class, [
'label' => "Propriétaire",
'disabled' => ($options["mode"]=="delete"?true:false),
"required" => false,
'multiple' => false,
'remote_route' => 'cadoles_core_config_user_ajax_selectlist',
'class' => 'Cadoles\coreBundle\Entity\User',
'primary_key' => 'id',
'text_property' => 'username',
'minimum_input_length' => 2,
'page_limit' => 10,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000, // if 'cache' is true
'language' => 'fr',
'placeholder' => 'Selectionner un propriétaire',
'attr' => array("class" => "form-control", "style" => "margin-bottom:15px")
]);
}
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Cadoles\PortalBundle\Entity\Project',
'mode' => 'string',
'access' => 'string'
]);
}
}

View File

@ -0,0 +1,64 @@
<?php
namespace Cadoles\PortalBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\EntityManager;
class ProjectWriterType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$id=$options['id'];
$access=$options['access'];
$builder
->add('submit', SubmitType::class, [
"label" => ($options["mode"]=="delete"?"Confirmer la Suppression":"Valider"),
"attr" => ($options["mode"]=="delete"?array("class" => "btn btn-danger"):array("class" => "btn btn-success"))
])
->add('writers', EntityType::class, [
'label' => 'Donner permissions en écritures à',
'class' => 'CadolesCoreBundle:User',
'query_builder' => function(EntityRepository $er) use ($id,$access) {
$qb= $er->createQueryBuilder('user');
return $qb->select('user')
->from('CadolesPortalBundle:Project','project')
->andwhere('project.id=:project')
->from('CadolesCoreBundle:UserGroup','usergroup')
->andwhere("usergroup.group MEMBER OF project.groups")
->andwhere("usergroup.user=user")
->setParameter('project',$id);
},
'choice_label' => 'username',
'multiple' => true,
'expanded' => true
]);
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Cadoles\PortalBundle\Entity\Project',
'id' => 'integer',
'mode' => 'string',
'access' => 'string',
'user' => 'Cadoles\CoreBundle\Entity\User'
]);
}
}

View File

@ -0,0 +1,54 @@
<?php
namespace Cadoles\PortalBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Ivory\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\EntityManager;
class ProjectcommentType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$user=$options['user'];
$builder
->add('submit', SubmitType::class, [
"label" => ($options["mode"]=="delete"?"Confirmer la Suppression":"Valider"),
"attr" => ($options["mode"]=="delete"?array("class" => "btn btn-danger"):array("class" => "btn btn-success"))
])
->add('name', TextType::class, [
'label' => 'Titre'
])
->add("description",CKEditorType::class,[
"config_name" => 'full_config',
"label" => 'Description',
"required" => false,
"disabled" => ($options["mode"]=="delete"?true:false),
"config" => ["height" => "500px",'filebrowserUploadRoute' => 'cadoles_portal_'.$options["access"].'_projectcomment_upload']
]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Cadoles\PortalBundle\Entity\Projectcomment',
'mode' => 'string',
'access' => 'string',
'user' => 'Cadoles\CoreBundle\Entity\User'
]);
}
}

View File

@ -0,0 +1,138 @@
<?php
namespace Cadoles\PortalBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Ivory\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\EntityManager;
class ProjecttaskType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$user=$options['user'];
$builder
->add('submit', SubmitType::class, [
"label" => ($options["mode"]=="delete"?"Confirmer la Suppression":"Valider"),
"attr" => ($options["mode"]=="delete"?array("class" => "btn btn-danger"):array("class" => "btn btn-success"))
])
->add('name', TextType::class, [
'label' => 'Titre'
])
->add("description",CKEditorType::class,[
"config_name" => 'full_config',
"label" => 'Description',
"required" => false,
"config" => ["height" => "500px",'filebrowserUploadRoute' => 'cadoles_portal_'.$options["access"].'_projecttask_upload']
])
->add('priority', IntegerType::class, [
"label" => 'Priorité',
"required" => true,
])
->add('end', DateType::class, [
"label" => 'A Réaliser avant le',
"required" => false,
])
->add('percentage', IntegerType::class, [
"label" => "Pourcentage d'avancement",
"required" => true,
])
->add('projecttasktag', EntityType::class, [
"label" => 'Type',
"class" => 'CadolesPortalBundle:Projecttasktag',
"choice_label" => 'name',
"required" => false,
])
->add('projecttaskstatus', EntityType::class, [
"label" => 'Statut',
"class" => 'CadolesPortalBundle:Projecttaskstatus',
"choice_label" => 'name',
"required" => false,
]);
if($options["access"]=="config") {
$builder
->add('project', EntityType::class, [
"label" => 'Projet associé',
"class" => 'CadolesPortalBundle:Project',
"choice_label" => 'name',
]);
}
else {
$builder
->add('project', EntityType::class, [
'label' => 'Projet associé',
'class' => 'CadolesPortalBundle:Project',
'choice_label' => 'name',
"disabled" => ($options["mode"]=="update"?true:false),
'placeholder' => '-- Sélectionnez un Projet --',
'query_builder' => function(EntityRepository $er) use ($user) {
$qb=$er->createQueryBuilder('project');
return $qb->select('project')
->where('project.user=:user')
->orwhere(':user MEMBER OF project.writers')
->from('CadolesCoreBundle:UserGroup','usergroup')
->orwhere('usergroup.group MEMBER OF project.groups AND usergroup.user=:user')
->from('CadolesCoreBundle:User','user')
->andwhere("user=:user")
->setparameter('user',$user);
},
]);
}
$builder->add('user',
Select2EntityType::class, array(
'label' => "Intervenant",
"required" => false,
'multiple' => false,
'remote_route' => 'cadoles_portal_'.$options["access"].'_projecttask_users',
'class' => 'Cadoles\coreBundle\Entity\User',
'req_params' => ['project' => 'parent.children[project]'],
'primary_key' => 'id',
'text_property' => 'username',
'minimum_input_length' => 0,
'page_limit' => 10,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000, // if 'cache' is true
'language' => 'fr',
'placeholder' => 'Selectionner un intervenant',
'attr' => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Cadoles\PortalBundle\Entity\Projecttask',
'mode' => 'string',
'access' => 'string',
'user' => 'Cadoles\CoreBundle\Entity\User'
]);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Cadoles\PortalBundle\Repository;
use Doctrine\ORM\EntityRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Cadoles\PortalBundle\Entity\Blog;
class BlogcommentRepository extends EntityRepository
{
}

View File

@ -0,0 +1,260 @@
<?php
namespace Cadoles\PortalBundle\Repository;
use Doctrine\ORM\EntityRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Cadoles\PortalBundle\Entity\Page;
use Cadoles\PortalBundle\Entity\Pagecategory;
class ProjectRepository extends EntityRepository
{
// getProjectsGroup
// $user = l'utilisateur en cours
// $groupid = id du group
public function getProjectsGroup($user,$groupid)
{
$projectsshared=$this->createQueryBuilder('project')
->from('CadolesCoreBundle:Group','g')
->andWhere('g MEMBER OF project.groups')
->andWhere('g.id=:id')
->setParameter('id',$groupid)
->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));
}
}
return $projectsshared;
}
// getProjectsUser
// $user = l'utilisateur en cours
// &$projectsuser = les projects de l'utilisateur
// &$projects = les projects système de l'utilistauer
// &$projectsshared = les projects partagées pour l'utilisateur
public function getProjectsUser($user,&$projectsuser,&$projectsadmin,&$projectsshared)
{
// Profilage
$roles=($user?$user->getRoles():["ROLE_ANONYME"]);
$groups=($user?$user->getGroups():[]);
// Récupération des projects de l'utilisateur
$projectsuser=[];
if($user) {
$qb = $this->createQueryBuilder('project');
$qb ->where("project.user=:user")
->setParameter("user",$user)
->addOrderBy('project.name', 'ASC');
$projectsuser=$qb->getQuery()->getResult();
}
// Permission sur les projects
if($projectsuser) {
foreach($projectsuser as $projectuser) {
$projectuser->setCanupdate(true);
$projectuser->setCanadd(true);
}
}
// 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();
// Récupération des projects par rôles
foreach($roles as $role) {
$qb = $this->createQueryBuilder("project");
$qb ->where($qb->expr()->like('project.roles', $qb->expr()->literal("%$role%")))
->andWhere("project.user != :user or project.user is null")
->setParameter('user',$user);
$projectsroles=$qb->getQuery()->getResult();
foreach($projectsroles as $projectrole) {
if(!$projectsadmin->contains($projectrole)) $projectsadmin->add($projectrole);
}
}
// Récupération des projects par group
foreach($groups as $group) {
$qb = $this->createQueryBuilder("project");
$qb ->where(":group MEMBER OF project.groups")
->andWhere("project.user != :user or project.user is null")
->setParameter('user',$user)
->setParameter("group",$group->getGroup());
$projectsgroups=$qb->getQuery()->getResult();
foreach($projectsgroups as $projectgroup) {
if(!$projectsadmin->contains($projectgroup)) $projectsadmin->add($projectgroup);
}
}
// Permission sur les projects
foreach($projectsadmin as $projectadmin) {
$projectadmin->setCanupdate(false);
$projectadmin->setCanadd($this->getInwriter($user,$projectadmin));
}
}
public function getPermission($user,$project,&$cansee,&$canupdate,&$canadd) {
// si project de l'utilisateur
if($project->getUser()==$user&&!is_null($user)) {
$cansee=true;
$canupdate=true;
$canadd=true;
}
else {
$canupdate=false;
$cansee=false;
$canadd=false;
// Profilage
$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");
$qb ->where($qb->expr()->like('project.roles', $qb->expr()->literal("%$role%")))
->andWhere("project.id=:id")
->andWhere("project.user is null")
->setParameter("id",$project->getId());
$inprojectrole=$qb->getQuery()->getResult();
if($inprojectrole) $cansee=true;
}
// Le project est-il dans les projects associés aux groupes de l'utilisateur ?
foreach($groups as $group) {
$qb = $this->createQueryBuilder("project");
$qb ->where(":group MEMBER OF project.groups")
->andWhere("project.id=:id")
->setParameter("id",$project->getId())
->setParameter("group",$group->getGroup());
$inprojectgroup=$qb->getQuery()->getResult();
if($inprojectgroup) {
$cansee=true;
// Est-il manager du groupe
if($group->getGroup()->getFgcanshare()) {
if($group->getFgmanager()) $canadd=true;
}
}
}
// utilisateur a-t-il la permission d'écriture
$canadd=$this->getInwriter($user,$project);
}
}
public function getInwriter($user,$project) {
$canadd=false;
if($user) {
// Peut ecrire ceux qui sont déclaré comme écrivain
$qb = $this->createQueryBuilder("project");
$qb ->andWhere("project.id=:id")
->andwhere(':user MEMBER OF project.writers')
->from('CadolesCoreBundle:User','user')
->andwhere("user=:user")
->from('CadolesCoreBundle:UserGroup','usergroup')
->andwhere('usergroup.group MEMBER OF project.groups')
->andwhere('usergroup.user=:user')
->setParameter("id",$project->getId())
->setparameter('user',$user);
$inprojectwriters=$qb->getQuery()->getResult();
if($inprojectwriters) $canadd=true;
// 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.fgmanager=:flag')
->from('CadolesCoreBundle:Group','groupe')
->andwhere('groupe=usergroup.group')
->andwhere('groupe.fgcanshare=:flag')
->setParameter("id",$project->getId())
->setparameter('user',$user)
->setparameter('flag',true);
$inprojectwriters=$qb->getQuery()->getResult();
if($inprojectwriters) $canadd=true;
}
return $canadd;
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Cadoles\PortalBundle\Repository;
use Doctrine\ORM\EntityRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Cadoles\PortalBundle\Entity\Blog;
class ProjectcommentRepository extends EntityRepository
{
}

View File

@ -0,0 +1,28 @@
<?php
namespace Cadoles\PortalBundle\Repository;
use Doctrine\ORM\EntityRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Cadoles\PortalBundle\Entity\Project;
class ProjecttaskRepository extends EntityRepository
{
public function getProjectsTasks($projects,$start,$length=10,&$count,&$articles)
{
$count=$this->createQueryBuilder('projecttask')
->select('COUNT(projecttask)')
->andwhere('projecttask.project IN(:project)')
->setParameter('project',$projects)
->getQuery()->getSingleScalarResult();
$articles=$this->createQueryBuilder('projecttask')
->andwhere('projecttask.project IN(:project)')
->setParameter('project',$projects)
->orderBy('projecttask.submit', 'DESC')
->addOrderBy('projecttask.name', 'ASC')
->setFirstResult($start)->setMaxResults($length)
->getQuery()->getResult();
}
}

View File

@ -550,6 +550,44 @@ cadoles_portal_user_blogarticle_image:
path: /user/blogarticle/image
defaults: { _controller: CadolesPortalBundle:Blogarticle:image, access: user }
#== BLOGCOMMENT ==========================================================================================================================================
#-- Access config
cadoles_portal_config_blogcomment_submit:
path: /config/blogcomment/submit/{idarticle}
defaults: { _controller: CadolesPortalBundle:Blogcomment:submit, access: config}
cadoles_portal_config_blogcomment_update:
path: /config/blogcomment/update/{id}
defaults: { _controller: CadolesPortalBundle:Blogcomment:update, access: config }
cadoles_portal_config_blogcomment_delete:
path: /config/blogcomment/delete/{id}
defaults: { _controller: CadolesPortalBundle:Blogcomment:delete, access: config }
cadoles_portal_config_blogcomment_upload:
path: /config/blogcomment/upload
defaults: { _controller: CadolesPortalBundle:Blogcomment:upload, access: config }
#-- Access user
cadoles_portal_user_blogcomment_submit:
path: /user/blogcomment/submit/{idarticle}
defaults: { _controller: CadolesPortalBundle:Blogcomment:submit, access: user }
cadoles_portal_user_blogcomment_update:
path: /user/blogcomment/update/{id}
defaults: { _controller: CadolesPortalBundle:Blogcomment:update, access: user }
cadoles_portal_user_blogcomment_delete:
path: /user/blogcomment/delete/{id}
defaults: { _controller: CadolesPortalBundle:Blogcomment:delete, access: user }
cadoles_portal_user_blogcomment_upload:
path: /user/blogcomment/upload
defaults: { _controller: CadolesPortalBundle:Blogcomment:upload, access: user }
#== CALENDAR =============================================================================================================================================
#-- Access config
@ -655,6 +693,167 @@ cadoles_portal_user_calendarevent_share:
defaults: { _controller: CadolesPortalBundle:Calendarevent:share, access: user }
#== PROJECT =================================================================================================================================================
#-- Access config
cadoles_portal_config_project:
path: /config/project
defaults: { _controller: CadolesPortalBundle:Project:list }
cadoles_portal_config_project_ajax_list:
path: /config/project/ajax/list
defaults: { _controller: CadolesPortalBundle:Project:ajaxlist, access: config }
cadoles_portal_config_project_view:
path: /config/project/view/{id}
defaults: { _controller: CadolesPortalBundle:Project:view, access: config, id: 0 }
cadoles_portal_config_project_submit:
path: /config/project/submit
defaults: { _controller: CadolesPortalBundle:Project:submit, access: config }
cadoles_portal_config_project_update:
path: /config/project/update/{id}
defaults: { _controller: CadolesPortalBundle:Project:update, access: config }
cadoles_portal_config_project_delete:
path: /config/project/delete/{id}
defaults: { _controller: CadolesPortalBundle:Project:delete, access: config }
cadoles_portal_config_project_share:
path: /config/project/share/{id}
defaults: { _controller: CadolesPortalBundle:Project:share, access: config }
cadoles_portal_config_project_writer:
path: /config/project/writer/{id}
defaults: { _controller: CadolesPortalBundle:Project:writer, access: config }
cadoles_portal_config_ajax_project_seleclist:
path: /config/project/ajax/selectlist
defaults: { _controller: CadolesPortalBundle:Project:ajaxseleclist }
#-- Access user
cadoles_portal_user_project_view:
path: /project/{id}
defaults: { _controller: CadolesPortalBundle:Project:view, access: user, id: 0 }
cadoles_portal_user_project_submit:
path: /user/project/submit
defaults: { _controller: CadolesPortalBundle:Project:submit, access: user }
cadoles_portal_user_project_update:
path: /user/project/update/{id}
defaults: { _controller: CadolesPortalBundle:Project:update, access: user }
cadoles_portal_user_project_delete:
path: /user/project/delete/{id}
defaults: { _controller: CadolesPortalBundle:Project:delete, access: user }
cadoles_portal_user_project_share:
path: /user/project/share/{id}
defaults: { _controller: CadolesPortalBundle:Project:share, access: user }
cadoles_portal_user_project_writer:
path: /user/project/writer/{id}
defaults: { _controller: CadolesPortalBundle:Project:writer, access: user }
#== PROJECTTASK ==========================================================================================================================================
#-- Access config
cadoles_portal_config_projecttask_view:
path: /config/projecttask/view/{id}
defaults: { _controller: CadolesPortalBundle:Projecttask:view, access: config }
cadoles_portal_config_projecttask_submit:
path: /config/projecttask/submit/{idproject}
defaults: { _controller: CadolesPortalBundle:Projecttask:submit, access: config}
cadoles_portal_config_projecttask_update:
path: /config/projecttask/update/{id}
defaults: { _controller: CadolesPortalBundle:Projecttask:update, access: config }
cadoles_portal_config_projecttask_delete:
path: /config/projecttask/delete/{id}
defaults: { _controller: CadolesPortalBundle:Projecttask:delete, access: config }
cadoles_portal_config_projecttask_upload:
path: /config/projecttask/upload
defaults: { _controller: CadolesPortalBundle:Projecttask:upload, access: config }
cadoles_portal_config_projecttask_users:
path: /config/projecttask/users
defaults: { _controller: CadolesPortalBundle:Projecttask:users, access: config }
cadoles_portal_config_projecttask_percentage:
path: /config/projecttask/percentage/{id}
defaults: { _controller: CadolesPortalBundle:Projecttask:percentage, access: config }
#-- Access user
cadoles_portal_user_projecttask_view:
path: /projecttask/{id}
defaults: { _controller: CadolesPortalBundle:Projecttask:view, access: user }
cadoles_portal_user_projecttask_submit:
path: /user/projecttask/submit/{idproject}
defaults: { _controller: CadolesPortalBundle:Projecttask:submit, access: user, idproject: 0 }
cadoles_portal_user_projecttask_update:
path: /user/projecttask/update/{id}
defaults: { _controller: CadolesPortalBundle:Projecttask:update, access: user }
cadoles_portal_user_projecttask_delete:
path: /user/projecttask/delete/{id}
defaults: { _controller: CadolesPortalBundle:Projecttask:delete, access: user }
cadoles_portal_user_projecttask_upload:
path: /user/projecttask/upload
defaults: { _controller: CadolesPortalBundle:Projecttask:upload, access: user }
cadoles_portal_user_projecttask_users:
path: /user/projecttask/users
defaults: { _controller: CadolesPortalBundle:Projecttask:users, access: user }
cadoles_portal_user_projecttask_percentage:
path: /user/projecttask/percentage/{id}
defaults: { _controller: CadolesPortalBundle:Projecttask:percentage, access: user }
#== PROJECT COMMENT ==========================================================================================================================================
#-- Access config
cadoles_portal_config_projectcomment_submit:
path: /config/projectcomment/submit/{idtask}
defaults: { _controller: CadolesPortalBundle:Projectcomment:submit, access: config}
cadoles_portal_config_projectcomment_update:
path: /config/projectcomment/update/{id}
defaults: { _controller: CadolesPortalBundle:Projectcomment:update, access: config }
cadoles_portal_config_projectcomment_delete:
path: /config/projectcomment/delete/{id}
defaults: { _controller: CadolesPortalBundle:Projectcomment:delete, access: config }
cadoles_portal_config_projectcomment_upload:
path: /config/projectcomment/upload
defaults: { _controller: CadolesPortalBundle:Projectcomment:upload, access: config }
#-- Access user
cadoles_portal_user_projectcomment_submit:
path: /user/projectcomment/submit/{idtask}
defaults: { _controller: CadolesPortalBundle:Projectcomment:submit, access: user }
cadoles_portal_user_projectcomment_update:
path: /user/projectcomment/update/{id}
defaults: { _controller: CadolesPortalBundle:Projectcomment:update, access: user }
cadoles_portal_user_projectcomment_delete:
path: /user/projectcomment/delete/{id}
defaults: { _controller: CadolesPortalBundle:Projectcomment:delete, access: user }
cadoles_portal_user_projectcomment_upload:
path: /user/projectcomment/upload
defaults: { _controller: CadolesPortalBundle:Projectcomment:upload, access: user }
#== FEED =================================================================================================================================================
@ -763,6 +962,10 @@ cadoles_portal_config_panelwidget_view_blog:
path: /config/pagewidget/view/blog/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewblog, access: config }
cadoles_portal_config_panelwidget_view_project:
path: /config/pagewidget/view/project/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewproject, access: config }
cadoles_portal_config_panelwidget_view_separator:
path: /config/pagewidget/view/separator/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewseparator, access: config }
@ -876,6 +1079,10 @@ cadoles_portal_user_panelwidget_view_blog:
path: /pagewidget/view/blog/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewblog, access: user }
cadoles_portal_user_panelwidget_view_project:
path: /pagewidget/view/project/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewproject, access: user }
cadoles_portal_user_panelwidget_view_separator:
path: /pagewidget/view/separator/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewseparator, access: user }

View File

@ -12,7 +12,7 @@
{{ form_widget(form.submit) }}
{% if mode=="update" %}
<a class="btn btn-default" href={{ path('cadoles_portal_'~access~'_blogarticle_view',{'id':entity.id}) }}'>Annuler</a>
<a class="btn btn-default" href='{{ path('cadoles_portal_'~access~'_blogarticle_view',{'id':entity.id}) }}'>Annuler</a>
{% elseif mode=="submit" %}
{% set blogid=0 %}
{%if entity.blog.id is defined %}
@ -56,7 +56,8 @@
<div class="col-md-8">
{{ form_row(form.name) }}
{{ form_row(form.blog) }}
{{ form_row(form.description) }}
{{ form_row(form.fgcomment) }}
{{ form_row(form.description) }}
</div>
<div class="col-md-4">

View File

@ -28,7 +28,7 @@
{% block pagewrapper %}
{% if access=="config" %}
<div class="pagemenu">
<a href="{{ path('cadoles_portal_config_blog_view', {id:entity.blog.id})}}">{{ entity.blog.name }}</a>>
<a href="{{ path('cadoles_portal_config_blog_view', {id:entity.blog.id})}}">{{ entity.blog.name }}</a>
</div>
{% else %}
<br>
@ -71,6 +71,25 @@
<div class="blogbody">
{{ entity.description | raw }}
</div>
{% if entity.fgcomment %}
<hr>
<a href="{{path('cadoles_portal_'~access~'_blogcomment_submit',{"idarticle":entity.id}) }}" style="width:100%" class="btn btn-success">Ajouter un commentaire</a>
{% endif %}
{% if not entity.blogcomments is empty %}
{% for comment in entity.blogcomments|reverse %}
<div class="blogtitle">
<legend><h2>{{comment.name}}</h2></legend>
<small>publié par {{ comment.user.username }} le {{ comment.submit|date("d/m/Y à H:i") }}</small>
{% if canadd or app.user==comment.user%}
<a href="{{ path("cadoles_portal_"~access~"_blogcomment_update",{'id':comment.id}) }}"><i class="fa fa-file"></i></a>
{% endif %}
</div>
<div class="blogbody">
{{ comment.description | raw }}
</div>
{% endfor %}
{% endif %}
</div>
<div class="blogsidebar col col-md-3">

View File

@ -0,0 +1,53 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
Modification Commentaire Article de Blog
{% elseif mode=="submit" %}
Création Commentaire Article de Blog
{% endif %}
</h1>
{{ form_widget(form.submit) }}
<a class="btn btn-default" href='{{ path('cadoles_portal_'~access~'_blogarticle_view',{'id':entity.blogarticle.id}) }}'>Annuler</a>
{% if mode=="update" %}
<a href={{ path('cadoles_portal_'~access~'_blogcomment_delete',{'id':entity.id}) }}
class="btn btn-danger pull-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer ce commentaire ?">
Supprimer
</a>
{% endif %}
<br><br>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="form-group clearfix">
{{ form_row(form.name) }}
{{ form_row(form.description) }}
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -49,7 +49,7 @@
<div style="width:90px; margin:10px auto;">
<img id="icon_label_img" src="/{{ alias }}/{{ icon.label }}" style="width:90px;height:auto;margin:auto;display:block;margin-bottom:5px;background-color: #{{color["main"]}}">
{{ form_widget(form.label) }}
<a class="btn btn-info" style="width:90px" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Icône','{{ path('cadoles_portal_config_icon_icon') }}');" title='Ajouter un Logo'>Modifier</a>
<a class="btn btn-info" style="width:90px" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Icône','{{ path('cadoles_portal_'~access~'_icon_icon') }}');" title='Ajouter un Logo'>Modifier</a>
</div>
</div>
</div>

View File

@ -244,26 +244,30 @@
{% block localjavascript %}
var idpage;
$('document').ready(function(){
{% for page in pagesadmin %}
{% if page.id==entity.id %}
showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','portal');
{% endif %}
{% endfor %}
{% for page in pagesuser %}
{% if page.id==entity.id %}
showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','user');
{% endif %}
{% endfor %}
{% for groupshared in groupsshared %}
{% for page in groupshared.pagesshared %}
{% if gotoroute is empty %}
{% for page in pagesadmin %}
{% if page.id==entity.id %}
showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','group',true,{{groupshared.id}});
showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','portal');
{% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
{% for page in pagesuser %}
{% if page.id==entity.id %}
showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','user');
{% endif %}
{% endfor %}
{% for groupshared in groupsshared %}
{% for page in groupshared.pagesshared %}
{% if page.id==entity.id %}
showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','group',true,{{groupshared.id}});
{% endif %}
{% endfor %}
{% endfor %}
{% else %}
var url="{{ path(gotoroute,{id:gotoid}) }}";
showGoto(url);
{% endif %}
// Rendre les pages user déplacable
$("#pagesuser").sortable({
@ -391,9 +395,7 @@
// Affichages des pages
function showPage(id,catid,canupdate,usage,forcereload,groupid) {
// Sauvegarder la page en cours
idpage=id;
idpage=id;
// Cacher toutes les pages
$(".pageframereload").remove();
@ -455,11 +457,19 @@
}
// On resize les frame
resizeFrame();
}
// Affichages des pages
function showGoto(url) {
$("#pagecontainer").append("<iframe id='goto' class='pageframe pageframereload' src='"+url+"' style='border:none; width:100%'></iframe>");
// On resize les frame
resizeFrame();
}
function submitPage() {
var url="{{ path('cadoles_portal_'~access~'_page_submit') }}";
$(location).attr('href',url);

View File

@ -24,6 +24,8 @@
{% endif %}
{% if app.user %}
<style>.msgtopic a { color: #{{colorbodyfont}}; font-weight: bold; }</style>
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-chat" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate %}
<div class="widgetmenu">

View File

@ -65,7 +65,7 @@
<div class="grid-item grid-small">
<div class="grid-item-content">
{% if canadd %}
<a style="color:#{{colorbodyfont}}; cursor:pointer" onClick="delFile('widget-{{ entity.id}}','{{file.name }}')" class="item-delete">
<a style="color:#{{colorbodyfont}}; cursor:pointer" onClick="delFile('widget-{{ entity.id}}','{{file.name|e('js')|raw }}')" class="item-delete">
<i style="color:#{{colorbodyfont}}" class="fa fa-trash" title="Supprimer le fichier"></i>
</a>
{% endif %}

View File

@ -65,7 +65,7 @@
<div class="grid-item grid-image">
<div class="grid-item-content">
{% if canadd %}
<a style="cursor:pointer" onClick="delFile('widget-{{ entity.id}}','{{file.name }}')" class="item-delete"><i style="color: #FFF" class="fa fa-trash" title="Supprimer le fichier"></i></a>
<a style="cursor:pointer" onClick="delFile('widget-{{ entity.id}}','{{file.name|e('js')|raw}}')" class="item-delete"><i style="color: #FFF" class="fa fa-trash" title="Supprimer le fichier"></i></a>
{% endif %}
<a style="cursor:pointer" onClick="showFrameitem('file-{{entity.id}}-{{loop.index}}','{{ path('cadoles_core_'~access~'_file_view',{'directory':'widget-'~entity.id,'filename':file.name,'navigation':true }) }}',true)">

View File

@ -54,7 +54,7 @@
{% if canadd==true %}
<div class="grid-item grid-verysmall" style="{{ stylewidgetbodyreverse }};">
<div class="grid-item-content">
<a href="{{path('cadoles_core_user_group_users',{'id':id})}}" target="_top" style="{{ stylewidgetbodyreverse }};">
<a href="{{path('cadoles_core_user_group_users',{'id':id,'idreturn':idpage})}}" target="_top" style="{{ stylewidgetbodyreverse }};">
<div class="item-link clearfix">
<div class="grid-item-logo">
<img class="grid-item-img imageshadow" height="110" src="/{{ alias }}/uploads/icon/icon_add.png" />

View File

@ -0,0 +1,117 @@
{% set theme = app.session.get('theme') %}
{% if theme is not empty %}
{{ include('@Theme/'~theme~'/function.html.twig') }}
{% endif %}
{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %}
{% set stylewidget = constants.mystylewidget(entity) %}
{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %}
{% set stylewidgetheader = constants.mystylewidgetheader(entity) %}
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %}
{% set color = app.session.get('color') %}
<style>
</style>
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-project" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if access=="config" %}
<a href='{{ path('cadoles_portal_config_project') }}' style="{{ stylewidgetmenu }}"><i class="fa fa-plus fa-fw"></i></a>
{% else %}
{% set idproject = "" %}
{% set url= path('cadoles_portal_user_project_view') %}
{% if usage=="group" and firstproject is defined %}
{% set url= path('cadoles_portal_user_project_view',{id:firstproject}) %}
{% endif %}
<a onClick="showFrameitem('project','{{ url }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-plus fa-fw"></i></a>
{% endif %}
</div>
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
{% if projecttasks|length >= 1 %}
<div class="widgetbody" style="{{ stylewidgetbody }}">
<div class="grid clearfix">
{% for projecttask in projecttasks %}
{% if loop.index==1 %}
<div class="grid-sizer grid-list"></div>
<div class="grid-gutter-sizer"></div>
{% endif %}
<div class="grid-item grid-list">
{% set colortask = color['main'] %}
{% if projecttask.projecttasktag %}
{% set colortask = projecttask.projecttasktag.color %}
{% endif %}
<div class="grid-item-content" style="background-color:#{{ colortask }}">
<a href="{{ path('cadoles_portal_'~access~'_projecttask_view',{'id':projecttask.id}) }}">
<div class="item-link clearfix">
<div class="grid-item-logo" style="height:55px;width:10%; text-align: center;">
{% if projecttask.user is empty %}
<img class='grid-item-img avatar' src="/{{ alias }}/uploads/avatar/{{ projecttask.owner.avatar }}" style="width:55px; height:auto">
{% else %}
<img class='grid-item-img avatar' src="/{{ alias }}/uploads/avatar/{{ projecttask.user.avatar }}" style="width:55px; height:auto">
{% endif %}
</div>
<div class="grid-item-title" style="width:90%">
<h2 style="max-height: 40px; overflow-y: hidden;line-height:18px;">{{projecttask.name}}</h2>
<div class="pull-left" style="font-size:9px;">Affectée à
{% if projecttask.user is empty %}
{{ projecttask.owner.username }}
{% else %}
{{ projecttask.user.username }}
{% endif %}
<br>Crée le {{ projecttask.submit|date("d/m/Y à H:i") }}
<br>Dans le project {{projecttask.project.name }}
</div>
<div class="pull-right" style="margin-top:-5px; width:80px; text-align: center;">
<div style="font-size:35px; line-height:30px">
{{ projecttask.percentage }}<i style="font-size:12px">%</i>
</div>
</div>
<div class="pull-right" style="text-align: right; font-size:9px;">
Priorité = {{ projecttask.priority }}</br>
Avant le = {{ projecttask.end|date("d/m/Y") }}</br>
{% if projecttask.projecttasktag %}
Type = {{ projecttask.projecttasktag.name }}<br>
{% endif %}
{% if projecttask.projecttaskstatus %}
Statut = {{ projecttask.projecttaskstatus.name }}<br>
{% endif %}
</div>
</div>
</div>
</a>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>

View File

@ -0,0 +1,75 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
Modification Project
{% elseif mode=="submit" %}
Création Project
{% endif %}
</h1>
{{ form_widget(form.submit) }}
{% if access=="config" and mode=="submit" %}
<a class="btn btn-default" href={{ path('cadoles_portal_config_project') }}>Annuler</a>
{% else %}
<a class="btn btn-default" href={{ path('cadoles_portal_'~access~'_project_view',{'id':entity.id}) }}>Annuler</a>
{% endif %}
{% if mode=="update" %}
<a href={{ path('cadoles_portal_config_project_delete',{'id':entity.id}) }}
class="btn btn-danger pull-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cette annonce ?">
Supprimer
</a>
{% endif %}
<br><br>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="form-group row clearfix">
{% if form.roles is defined %}
<div class="col-md-8">
{% else %}
<div class="col-md-12">
{% endif %}
{{ form_row(form.name) }}
</div>
{% if form.roles is defined %}
<div class="col-md-4">
{{ form_row(form.user) }}
{{ form_row(form.roles) }}
{{ form_row(form.groups) }}
</div>
{% endif %}
</div>
{{ form_end(form) }}
{% endblock %}
{% block localjavascript %}
{% endblock %}

View File

@ -0,0 +1,79 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
<h1>
Gestion des Projets
</h1>
<p>
<a href="{{ path('cadoles_portal_config_project_submit') }}" class="btn btn-success">Ajouter un Projet</a>
<span class="pull-right">
<label for="alluser" class="control-label">Afficher les utilisateurs</label>
<input id="alluser" name="alluser" type="checkbox" class="switch" onChange="switchalluser();">
</span>
</p>
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-table fa-fw"></i> Liste des Projets
</div>
<div class="panel-body">
<div class="dataTable_wrapper">
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
<thead>
<tr>
<th width="100px" class="no-sort">Action</th>
<th>Nom</th>
<th>Propriétaire</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
$(".switch").bootstrapSwitch();
{% if not app.session.get('alluserproject') is empty %}
var state={{ app.session.get('alluserproject') }};
$("#alluser").bootstrapSwitch('state',state);
{% endif %}
table=$('#dataTables').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false } ],
responsive: true,
iDisplayLength: 100,
order: [[ 1, "asc" ]],
processing: true,
serverSide: true,
ajax: {
"url": "{{ path('cadoles_portal_config_project_ajax_list') }}",
"data": function ( d ) {
return $.extend( {}, d, {
"alluser": $('#alluser').bootstrapSwitch('state')
});
}
},
drawCallback: function(settings) {
$("a[data-method='delete']").click(function(){
if( !confirm('Êtes-vous sûr de vouloir supprimer ce calendrier ?')) {
return false;
}
});
}
});
});
function switchalluser() {
if (typeof table !== 'undefined') {
table.ajax.reload();
}
}
{% endblock %}

View File

@ -0,0 +1,42 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1>
Partage Projet
</h1>
<p>
{{ form_widget(form.submit) }}
<a class="btn btn-default" href={{ path('cadoles_portal_'~access~'_project_view',{'id':entity.id}) }}>Annuler</a>
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Informations
</div>
<div class="panel-body">
{{ form_row(form.groups) }}
</div>
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -0,0 +1,276 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{% if access=="config" %}
<div class="pagemenu">
<a href="{{ path('cadoles_portal_config_project_view', {id:entity.id})}}">{{ entity.name }}</a>
<a href='{{ path('cadoles_portal_config_project_update', {id:entity.id}) }}' title='Modifier'><i class='fa fa-file fa-fw'></i></a>
<a href='{{ path('cadoles_portal_config_project_writer', {id:entity.id}) }}' title='Permission'><i class='fa fa-users fa-fw'></i></a>
<a href='{{ path('cadoles_portal_config_project_delete', { id: entity.id }) }}' data-method='delete' data-confirm='Êtes-vous sûr de vouloir supprimer ?' title='Supprimer'><i class='fa fa-trash fa-fw'></i></a>
</div>
{% endif %}
<div style="margin:10px 0px 10px 0px; text-align:right;">
<label for="alltask" class="control-label">Afficher les tâches fermées</label>
<input id="alltask" name="alltask" type="checkbox" class="switch" style="margin-right:20px">
<label for="allmytask" class="control-label" style="margin-left:20px">Afficher que mes tâches</label>
<input id="allmytask" name="allmytask" type="checkbox" class="switch">
</div>
{% if access!="config" %}
<ul class="nav navbar-default nav-pills">
<li id="menuproject-0" class="{% if entity.id is not defined %}active{%endif%}" style="cursor:pointer">
<a href="{{ path("cadoles_portal_user_project_view") }}">
Tout
</a>
</li>
{% for project in projects %}
<li id="menuproject-{{project.id}}" data-open="{% if project.canupdate %}true{%endif%}" class="{% if entity.id is defined and entity.id==project.id%}active{%endif%}" style="cursor:pointer">
<a href="{{ path("cadoles_portal_user_project_view",{'id':project.id}) }}">
{% if not project.groups is empty %}
<i class="fa fa-users fa-fw"></i>
{% elseif app.user==project.user %}
<i class="fa fa-user fa-fw"></i>
{%endif%}
{{ project.name }}
{% if project.canadd %}
<i class="fa fa-pencil"></i>
{% else %}
<i class="fa fa-lock"></i>
{% endif %}
</a>
</li>
{% endfor %}
{% if canupdate %}
<li><a id="menusubmit" style="cursor:pointer" onclick="submitProject()" title='Ajouter un projet'><i class='fa fa-plus fa-fw'></i></a></li>
{% endif %}
<li><a id="menuupdate" style="cursor:pointer;display:none" onclick="updateProject()" title='Modifier un projet'><i class='fa fa-file fa-fw'></i></a></li>
<li><a id="menushare" style="cursor:pointer;display:none" onclick="shareProject()" title='Partager un projet'><i class='fa fa-share-alt fa-fw'></i></a></li>
<li><a id="menuwriter" style="cursor:pointer;display:none" onclick="writerProject()" title='Permission du projet'><i class='fa fa-users fa-fw'></i></a></li>
<li><a id="menudelete" style="cursor:pointer;display:none" onclick="deleteProject()" title='Supprimer un projet'><i class='fa fa-trash fa-fw'></i></a></li>
</ul>
{% endif %}
<div class="projectpreview">
<h1 class="projecttitle">
{% if entity.id is not defined %}
Projet
{% set idproject=0 %}
{% else %}
{{ entity.name }}
{% set idproject=entity.id %}
{% endif %}
</h1>
{% if canadd %}
<a class="btn btn-primary" href='{{ path('cadoles_portal_'~access~'_projecttask_submit',{'idproject':idproject}) }}' style="width:100%; font-size:20px" title='Ajouter un article'><i class='fa fa-suitcase fa-fw'></i> Ajouter une Tâche</a>
{% endif %}
<div class="grid clearfix">
{% for projecttask in projecttasks %}
{% if loop.index==1 %}
<div class="grid-sizer grid-list"></div>
<div class="grid-gutter-sizer"></div>
{% endif %}
{% set classmytask="tasknotmy" %}
{%if app.user%}
{% if projecttask.user %}
{% if projecttask.user==app.user %}
{% set classmytask="taskmy" %}
{%endif%}
{%elseif projecttask.owner %}
{% if projecttask.owner==app.user %}
{% set classmytask="taskmy" %}
{%endif%}
{%endif%}
{%endif%}
{% if projecttask.percentage==100%}
{% set classstatus="taskclose" %}
{% else %}
{% set classstatus="taskopen" %}
{%endif%}
<div class="grid-item grid-list {{classmytask}} {{classstatus}}">
{% set colortask = color['main'] %}
{% if projecttask.projecttasktag %}
{% set colortask = projecttask.projecttasktag.color %}
{% endif %}
<div class="grid-item-content" style="background-color:#{{ colortask }}">
<a href="{{ path('cadoles_portal_'~access~'_projecttask_view',{'id':projecttask.id}) }}">
<div class="item-link clearfix">
<div class="grid-item-logo" style="height:55px;width:55px;">
{% if projecttask.user is empty %}
<img class='grid-item-img avatar' src="/{{ alias }}/uploads/avatar/{{ projecttask.owner.avatar }}" style="width:55px; height:55px">
{% else %}
<img class='grid-item-img avatar' src="/{{ alias }}/uploads/avatar/{{ projecttask.user.avatar }}" style="width:55px; height:55px">
{% endif %}
</div>
<div class="grid-item-title">
<h2 style="height:auto;line-height:18px;">{{projecttask.name }}</h2>
<small>Affectée à
{% if projecttask.user is empty %}
{{ projecttask.owner.username }}
{% else %}
{{ projecttask.user.username }}
{% endif %}
<br>Crée le {{ projecttask.submit|date("d/m/Y à H:i") }}
<br>Dans le project {{projecttask.project.name }}</small>
</div>
<div class="pull-right" style="width:80px; margin:5px 5px 0px 0px; text-align: center;">
<span style="font-size:10px;">Réalisé à</span><br>
<span style="font-size:35px; line-height:30px">{{ projecttask.percentage }}<span style="font-size:12px">%</span></span>
</div>
<div class="pull-right" style="margin:5px 5px 0px 0px; text-align: right; font-size:11px;">
Priorité = {{ projecttask.priority }}</br>
Avant le = {{ projecttask.end|date("d/m/Y") }}</br>
{% if projecttask.projecttasktag %}
Type = {{ projecttask.projecttasktag.name }}<br>
{% endif %}
{% if projecttask.projecttaskstatus %}
Statut = {{ projecttask.projecttaskstatus.name }}<br>
{% endif %}
</div>
</div>
</a>
</div>
</div>
{% endfor %}
</div>
</div>
{% endblock %}
{% block localjavascript %}
var idproject;
$('document').ready(function(){
$(".switch").bootstrapSwitch();
{% if entity.id is defined %}
{% for project in projects %}
{% if project.id==entity.id %}
showProject({{ project.id }}, {{ project.canupdate }});
{% endif %}
{% endfor %}
{% else %}
showProject(0, {{ canupdate }});
{% endif %}
// Swith task
switchtask();
});
function submitProject() {
var url="{{ path('cadoles_portal_'~access~'_project_submit') }}";
$(location).attr('href',url);
}
function updateProject() {
var url="{{ path('cadoles_portal_'~access~'_project_update',{id:'xx'}) }}";
url=url.replace('xx',idproject);
$(location).attr('href',url);
}
function shareProject() {
var url="{{ path('cadoles_portal_'~access~'_project_share',{id:'xx'}) }}";
url=url.replace('xx',idproject);
$(location).attr('href',url);
}
function writerProject() {
var url="{{ path('cadoles_portal_'~access~'_project_writer',{id:'xx'}) }}";
url=url.replace('xx',idproject);
$(location).attr('href',url);
}
function deleteProject() {
if (confirm('Êtes-vous sûr de vouloir supprimer ?')) {
var url="{{ path('cadoles_portal_'~access~'_project_delete',{id:'xx'}) }}";
url=url.replace('xx',idproject);
$(location).attr('href',url);
}
}
// Affichages des projects
function showProject(id,canupdate) {
idproject=id;
// Rendre actif le page en cours dans le menu
$(".navbar-top-links li").removeClass("active");
$("#menuproject-"+id).addClass("active");
// Cacher les actions possibles sur la page
$("#menuupdate").hide();
$("#menushare").hide();
$("#menuwriter").hide();
$("#menudelete").hide();
if($("#menuproject-"+id).data("open")) {
$("#menuupdate").show();
$("#menushare").show();
$("#menuwriter").show();
$("#menudelete").show();
}
}
taskmy=false;
taskclosed=false;
$('#allmytask').on('switchChange.bootstrapSwitch', function (event, state) {
taskmy=state;
switchtask();
});
$('#alltask').on('switchChange.bootstrapSwitch', function (event, state) {
taskclosed=state;
switchtask();
});
// Masquer les taches en fonction des flags
function switchtask() {
$(".grid-item").show();
$(".grid-item").each(function() {
tohide=false;
if(taskmy&&$(this).hasClass("tasknotmy"))
tohide=true;
if(!taskclosed&&$(this).hasClass("taskclose"))
tohide=true;
if(tohide) $( this ).hide();
});
if(taskmy) {
$(".tasknotmy").hide();
}
console.log("taskmy = "+taskmy);
console.log("taskclosed = "+taskclosed);
if(!taskclosed) {
$(".taskclose").hide();
}
// Création des grilles d'items
var optiongrid={columnWidth: '.grid-sizer', itemSelector: '.grid-item', gutter: '.grid-gutter-sizer'};
var grid = $('.grid').masonry(optiongrid);
}
{% endblock %}

View File

@ -0,0 +1,42 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1>
Permissions Projet
</h1>
<p>
{{ form_widget(form.submit) }}
<a class="btn btn-default" href={{ path('cadoles_portal_'~access~'_project_view',{'id':entity.id}) }}>Annuler</a>
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Informations
</div>
<div class="panel-body">
{{ form_row(form.writers) }}
</div>
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -0,0 +1,53 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
Modification Commentaire Tache
{% elseif mode=="submit" %}
Création Commentaire Tache
{% endif %}
</h1>
{{ form_widget(form.submit) }}
<a class="btn btn-default" href='{{ path('cadoles_portal_'~access~'_projecttask_view',{'id':entity.projecttask.id}) }}'>Annuler</a>
{% if mode=="update" %}
<a href={{ path('cadoles_portal_'~access~'_projectcomment_delete',{'id':entity.id}) }}
class="btn btn-danger pull-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer ce commentaire ?">
Supprimer
</a>
{% endif %}
<br><br>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="form-group clearfix">
{{ form_row(form.name) }}
{{ form_row(form.description) }}
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -0,0 +1,70 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
Modification Tâche
{% elseif mode=="submit" %}
Création Tâche
{% endif %}
</h1>
{{ form_widget(form.submit) }}
{% if mode=="update" %}
<a class="btn btn-default" href='{{ path('cadoles_portal_'~access~'_projecttask_view',{'id':entity.id}) }}'>Annuler</a>
{% elseif mode=="submit" %}
{% set projectid=0 %}
{%if entity.project.id is defined %}
{% set projectid=entity.project.id %}
{%endif%}
<a class="btn btn-default" href='{{ path('cadoles_portal_'~access~'_project_view',{'id':projectid})}}'>Annuler</a>
{% endif %}
{% if mode=="update" %}
<a href={{ path('cadoles_portal_'~access~'_projecttask_delete',{'id':entity.id}) }}
class="btn btn-danger pull-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cette tâche ?">
Supprimer
</a>
{% endif %}
<br><br>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="form-group clearfix">
{{ form_row(form.name) }}
{{ form_row(form.project) }}
{{ form_row(form.user) }}
{{ form_row(form.priority) }}
{{ form_row(form.end) }}
{{ form_row(form.percentage) }}
{{ form_row(form.projecttasktag) }}
{{ form_row(form.projecttaskstatus) }}
{{ form_row(form.description) }}
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -0,0 +1,248 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block localstyle %}
.slider-volume {
width:100%
}
{% endblock %}
{% block appmenu %}
<ul class="nav navbar-top-links navbar-left">
<li id="menuproject-0" class="{% if entity.id is not defined %}active{%endif%}" style="cursor:pointer">
<a href="{{ path("cadoles_portal_user_project_view") }}">
Tout
</a>
</li>
{% for project in projects %}
<li id="menuproject-{{project.id}}" data-open="{% if project.canupdate %}true{%endif%}" class="{% if entity.id is defined and entity.id==project.id%}active{%endif%}" style="cursor:pointer">
<a href="{{ path("cadoles_portal_user_project_view",{'id':project.id}) }}">
{{ project.name }}
{% if project.canadd %}
<i class="fa fa-pencil"></i>
{% else %}
<i class="fa fa-lock"></i>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
{% endblock %}
{% block pagewrapper %}
{% if access=="config" %}
<div class="pagemenu">
<a href="{{ path('cadoles_portal_config_project_view', {id:entity.project.id})}}">{{ entity.project.name }}</a>
</div>
{% else %}
<br>
<ul class="nav navbar-default nav-pills">
<li id="menuproject-0" class="{% if entity.id is not defined %}active{%endif%}" style="cursor:pointer">
<a href="{{ path("cadoles_portal_user_project_view") }}">
Tout
</a>
</li>
{% for project in projects %}
<li id="menuproject-{{project.id}}" data-open="{% if project.canupdate %}true{%endif%}" class="{% if entity.id is defined and entity.id==project.id%}active{%endif%}" style="cursor:pointer">
<a href="{{ path("cadoles_portal_user_project_view",{'id':project.id}) }}">
{{ project.name }}
{% if project.canadd %}
<i class="fa fa-pencil"></i>
{% else %}
<i class="fa fa-lock"></i>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
<div class="projecttask">
<div class="row">
<div class="col col-md-9">
<div class="projecttitle">
<legend>
<h1 >{{entity.name}}</h1>
</legend>
{% if canadd %}
<br><a class="pull-right btn btn-primary" href="{{ path("cadoles_portal_"~access~"_projecttask_update",{'id':entity.id}) }}">Modifier</a>
{% endif %}
<small>Affectée à =
{% if entity.user is empty %}
{{ entity.owner.username }}
{% else %}
{{ entity.user.username }}
{%endif%}
<br>Crée le = {{ entity.submit|date("d/m/Y à H:i") }}
<br>Dans le projet = {{entity.project.name }}</small>
<br><small>Priorité = {{ entity.priority }}</small>
{% if entity.end %}
<br><small>A Réaliser avant le = {{ entity.end|date("d/m/Y") }}</small>
{%endif%}
{% if entity.projecttasktag %}
<br><small>Type = {{ entity.projecttasktag.name }}</small>
{% endif %}
{% if entity.projecttaskstatus %}
<br><small>Statut = {{ entity.projecttaskstatus.name }}</small>
{% endif %}
</div>
<div class="projectbody">
{{ entity.description | raw }}
</div>
<hr>
<a href="{{path('cadoles_portal_'~access~'_projectcomment_submit',{"idtask":entity.id}) }}" style="width:100%" class="btn btn-success">Ajouter un commentaire</a>
{% if not entity.projectcomments is empty %}
{% for comment in entity.projectcomments|reverse %}
<div class="projecttitle">
<legend><h2>{{comment.name}}</h2></legend>
<small>publié par {{ comment.user.username }} le {{ comment.submit|date("d/m/Y à H:i") }}</small>
{% if canadd or app.user==comment.user%}
<a href="{{ path("cadoles_portal_"~access~"_projectcomment_update",{'id':comment.id}) }}"><i class="fa fa-file"></i></a>
{% endif %}
</div>
<div class="projectbody">
{{ comment.description | raw }}
</div>
{% endfor %}
{% endif %}
</div>
<div class="col col-md-3" style="margin-top:20px; text-align:center">
Réalisé à<br>
<span id="percentage" style="font-size:60px">{{ entity.percentage}}</span><small>%</small>
{% if canadd %}
<br>
<div id="slider"></div>
{% endif %}
{% if files|length >= 1 %}
<br>
<div class="grid clearfix">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
{% for file in files|sort %}
<div class="grid-item grid-small">
<div class="grid-item-content" style="background-color: #{{ color["main"]}}">
{% if canadd %}
<a style="cursor:pointer;color: #{{color['fontcolorhover']}}" onClick="delFile('projecttask-{{ entity.id}}','{{file.name|e('js')|raw }}')" class="item-delete">
<i class="fa fa-trash" title="Supprimer le fichier"></i>
</a>
{% endif %}
<a style="cursor:pointer" href="{{ path('cadoles_core_'~access~'_file_download',{'directory':'projecttask-'~entity.id,'filename':file.name }) }}">
<div class="item-link clearfix">
<div class="grid-item-logo">
{% if file.thumb is not empty %}
<img class="grid-item-img" height="110" src="{{ file.thumb }}">
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/bundles/cadolescore/images/files/_blank.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ file.name }}</h2>
</div>
</div>
</a>
</div>
</div>
{% endfor %}
</div>
{% endif %}
{% if canadd %}
<div data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Fichiers','{{ path('cadoles_core_'~access~'_file_upload',{'id': 'projecttask-'~entity.id,'type':'all'}) }}');" title="Ajouter des fichiers" class="grid-item-content" style="cursor:pointer;margin-top:20px;">
<img class="grid-item-img imageshadow" height="60" src="/ninegate/uploads/icon/icon_add.png">
<br>Ajouter un fichier
</div>
{% endif %}
</div>
</div>
</div>
{% endblock %}
{% block localjavascript %}
var idproject;
$('document').ready(function(){
{% if canadd %}
$( "#slider" ).slider({
min: 0,
max: 100,
step: 10,
value: {{ entity.percentage }}
});
{% endif %}
{% if entity.id is defined %}
{% for project in projects %}
{% if project.id==entity.project.id %}
showProject({{ project.id }}, {{ project.canupdate }});
{% endif %}
{% endfor %}
{% else %}
showProject(0, {{ canupdate }});
{% endif %}
var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item', gutter: '.grid-gutter-sizer'};
// Création des grilles d'items
$('body').imagesLoaded(function() {
var grid = $('.grid').masonry(optiongrid);
});
});
{% if canadd %}
$( "#slider" ).on( "slidestop", function( event, ui ) {
$.ajax({
method: "POST",
url: "{{ path('cadoles_portal_'~access~'_projecttask_percentage',{'id':entity.id}) }}",
data: {
percentage:ui.value,
},
success: function() {
$("#percentage").html(ui.value);
}
});
} );
{% endif %}
// Affichages des projects
function showProject(id,canupdate) {
// Rendre actif le page en cours dans le menu
$(".navbar-top-links li").removeClass("active");
$(".nav-pills li").removeClass("active");
$("#menuproject-"+id).addClass("active");
}
// Supprimer un fichier
function delFile(directory,filename) {
var r = confirm("Confirmez-vous la suppression de ce fichier ?");
if (r == true) {
$.ajax({
method: "POST",
url: "{{ path('cadoles_core_'~access~'_file_delete') }}",
data: {
directory:directory,
filename:filename
},
success: function() {
location.reload();
}
});
}
}
{% endblock %}

View File

@ -41,30 +41,31 @@ class onlyService
$folders=[];
$tasks=[];
$group=$this->em->getRepository("CadolesCoreBundle:Group")->find($idgroup);
if($group&&$group->getIdonlyoffice()) {
if($this->only_activate) {
if($this->authOnly()) {
$response = \Unirest\Request::get($this->only_url.'/project/'.$group->getIdonlyoffice(),$this->headers);
if(!$this->koresponse($response)) {
$firstfolder=$response->body->response->projectFolder;;
$response = \Unirest\Request::get($this->only_url.'/project/'.$group->getIdonlyoffice().'/files',$this->headers);
if(!is_null($idgroup)) {
$group=$this->em->getRepository("CadolesCoreBundle:Group")->find($idgroup);
if($group&&$group->getIdonlyoffice()) {
if($this->only_activate) {
if($this->authOnly()) {
$response = \Unirest\Request::get($this->only_url.'/project/'.$group->getIdonlyoffice(),$this->headers);
if(!$this->koresponse($response)) {
foreach($response->body->response->files as $fileonly) {
array_push($files,$fileonly);
}
foreach($response->body->response->folders as $folderonly) {
$folders[$folderonly->id]=$folderonly;
$subfolder=$this->scanfolder($folderonly->id,$folders,$this->headers);
foreach($subfolder as $file) {
array_push($files,$file);
}
}
$firstfolder=$response->body->response->projectFolder;;
$response = \Unirest\Request::get($this->only_url.'/project/'.$group->getIdonlyoffice().'/files',$this->headers);
if(!$this->koresponse($response)) {
foreach($response->body->response->files as $fileonly) {
array_push($files,$fileonly);
}
foreach($response->body->response->folders as $folderonly) {
$folders[$folderonly->id]=$folderonly;
$subfolder=$this->scanfolder($folderonly->id,$folders,$this->headers);
foreach($subfolder as $file) {
array_push($files,$file);
}
}
$response = \Unirest\Request::get($this->only_url.'/project/'.$group->getIdonlyoffice().'/task/open',$this->headers);
error_log($this->only_url.'/project/'.$group->getIdonlyoffice().'/tasks/open');
if(!$this->koresponse($response)) $tasks=$response->body->response;
$response = \Unirest\Request::get($this->only_url.'/project/'.$group->getIdonlyoffice().'/task/open',$this->headers);
if(!$this->koresponse($response)) $tasks=$response->body->response;
}
}
}
}

View File

@ -56,7 +56,7 @@ class ChatController extends Controller
// Récupération des message du groupe
$messages=$em->getRepository("CadolesWebsocketBundle:Message")->findBy(["group"=>$group],["submitdate"=>"DESC"],100);
$messages=$em->getRepository("CadolesWebsocketBundle:Message")->findBy(["group"=>$group],["submitdate"=>"DESC"],30);
foreach($messages as $message) {
$haveread = ($message->getReaders()->contains($user));
$message->setHaveread($haveread);

View File

@ -10,6 +10,7 @@ use Gos\Bundle\WebSocketBundle\Router\WampRequest;
use Doctrine\ORM\EntityManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Gos\Bundle\WebSocketBundle\Client\ClientManipulatorInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Cadoles\WebsocketBundle\Entity\Message;
@ -112,10 +113,15 @@ class WebsocketTopic implements TopicInterface
if(array_key_exists("mail",$event)) {
$mail = $this->container->get('cadoles.core.service.mail');
if($mail) {
$pages=$group->getPages();
$pageid=$pages[0]->getId();
$cplt="<br><br><b>Attention pour répondre à ce message : nutilisez pas votre mail mais rendez vous dans ce groupe sur Transnum et utilisez le fil de conversation (chat)</b><br>";
$url="https://".$this->container->getParameter('weburl')."/".$this->container->getParameter('alias').$this->container->get('router')->generate('cadoles_core_redirect', ['route'=>'cadoles_core_home','id'=>$pageid]);
$cplturl="<br><a href='".$url."'>".$url."</a>";
$mail_params=array(
"subject" => $event["subject"],
"body_html"=>$event["message"],
"body_text"=>strip_tags($event["message"])
"body_html"=>$event["message"].$cplt.$cplturl,
"body_text"=>strip_tags($event["message"].$cplt.$url)
);
// Transformer la liste des destinataires en tableau : [0] tjr vide on l'unset

View File

@ -49,9 +49,10 @@ INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `f
(1540, 1500, 1540, 'Annonces', 'cadoles_portal_config_alert', 'fa-bell', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1550, 1500, 1550, 'Calendriers', 'cadoles_portal_config_calendar', 'fa-calendar', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1560, 1500, 1560, 'Blogs', 'cadoles_portal_config_blog', 'fa-paper-plane', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1570, 1500, 1570, 'Flux', 'cadoles_portal_config_flux', 'fa-rss', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1580, 1500, 1580, 'Chartes', 'cadoles_portal_config_notice', 'fa-info', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1590, 1500, 1590, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1570, 1500, 1570, 'Projets', 'cadoles_portal_config_project', 'fa-suitcase', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1580, 1500, 1580, 'Flux', 'cadoles_portal_config_flux', 'fa-rss', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1590, 1500, 1590, 'Chartes', 'cadoles_portal_config_notice', 'fa-info', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1600, 1500, 1600, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(2500, NULL, 2500, 'MODULES', NULL, 'fa-cubes', 'ROLE_ADMIN,ROLE_MODO', 'module_activate'),
(2510, 2500, 2510, 'Pages', 'cadoles_portal_config_page', 'fa-file', 'ROLE_ADMIN,ROLE_MODO', 'page_activate'),
@ -59,9 +60,10 @@ INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `f
(2530, 2500, 2530, 'Annonces', 'cadoles_portal_config_alert', 'fa-bell', 'ROLE_ADMIN,ROLE_MODO', 'alert_activate'),
(2540, 2500, 2540, 'Calendriers', 'cadoles_portal_config_calendar', 'fa-calendar', 'ROLE_ADMIN,ROLE_MODO', 'calendar_activate'),
(2550, 2500, 2550, 'Blogs', 'cadoles_portal_config_blog', 'fa-paper-plane', 'ROLE_ADMIN,ROLE_MODO', 'blog_activate'),
(2560, 2500, 2560, 'Flux', 'cadoles_portal_config_flux', 'fa-rss', 'ROLE_ADMIN,ROLE_MODO', 'flux_activate'),
(2570, 2500, 2570, 'Chartes', 'cadoles_portal_config_notice', 'fa-info', 'ROLE_ADMIN,ROLE_MODO', 'notice_activate'),
(2580, 2500, 2580, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'module_activate'),
(2560, 2500, 2560, 'Projects', 'cadoles_portal_config_project', 'fa-suitcase', 'ROLE_ADMIN,ROLE_MODO', 'project_activate'),
(2570, 2500, 2570, 'Flux', 'cadoles_portal_config_flux', 'fa-rss', 'ROLE_ADMIN,ROLE_MODO', 'flux_activate'),
(2580, 2500, 2580, 'Chartes', 'cadoles_portal_config_notice', 'fa-info', 'ROLE_ADMIN,ROLE_MODO', 'notice_activate'),
(2590, 2500, 2590, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'module_activate'),
(3000, NULL, 3000, 'SYNCHRONISATION', NULL, 'fa-exchange', 'ROLE_ADMIN,ROLE_MODO', 'syncenvole_activate'),
(3001, 3000, 3001, 'Délégation', 'cadoles_portal_config_syncdelegation', 'fa-balance-scale', 'ROLE_ADMIN,ROLE_MODO', 'syncenvole_activate'),

View File

@ -57,6 +57,7 @@ parameters:
alert_activate: false
calendar_activate: false
blog_activate: false
project_activate: false
flux_activate: false
notice_activate: false
%else
@ -91,6 +92,12 @@ parameters:
%else
blog_activate: false
%end if
%if %%getVar("ninegate_activate_project", 'non') == "oui"
module_activate: true
project_activate: true
%else
project_activate: false
%end if
%if %%getVar("ninegate_activate_flux", 'non') == "oui"
module_activate: true
flux_activate: true