beta gestion projet (ref #19)

This commit is contained in:
afornerot 2020-04-14 08:56:42 +02:00
parent c052b1746e
commit 8feb7406b3
44 changed files with 3992 additions and 55 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

@ -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

@ -12,6 +12,7 @@ use Doctrine\DBAL\Connection as DBALConnection;
use Doctrine\ORM\EntityManager;
use Cadoles\CoreBundle\Entity\User;
use Cadoles\PortalBundle\Entity\Project;
global $bdd01;
global $config;
@ -52,6 +53,8 @@ class ScriptCommand extends Command
switch($scriptname) {
case "visibletrue": $this->visibletrue(); break;
case "setusersniveau": $this->setusersniveau(); break;
case "setfgcancreateproject": $this->setfgcancreateproject(); break;
case "createproject": $this->createproject(); break;
}
$this->writeln('');
@ -84,6 +87,32 @@ 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 writelnred($string) {
$this->output->writeln('<fg=red>'.$string.'</>');
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");

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, 'DRAAF', '130007107');
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}Ohb+BjJ5uHPUGP9Xpcl3j1woHkTgkbH0
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}wnWFq0jS8nKLol3OB8bjMJNmun1wqrl3
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');
@ -38,9 +38,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'),
@ -48,9 +49,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

@ -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,6 +704,7 @@ class GroupController extends Controller
$data->setFgcancreatepage(false);
$data->setFgcancreatecalendar(false);
$data->setFgcancreateblog(false);
$data->setFgcancreateproject(false);
if($access=="user") {
$data->setOwner($this->getUser());
if($this->getParameter("portal_activate")) {
@ -1112,6 +1118,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

@ -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

@ -269,6 +269,35 @@ class User implements UserInterface, \Serializable
*/
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 $icon
* @var Icon
@ -1589,4 +1618,140 @@ class User implements UserInterface, \Serializable
{
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;
}
}

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

@ -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',

File diff suppressed because one or more lines are too long

View File

@ -800,9 +800,6 @@ a.item-heart {
}
.blogarticle {
margin-bottom:150px;
}
@ -845,4 +842,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

@ -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

@ -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 Project
$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('Projet');
$entityWidget->setDescription("Gestion de projet");
$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());

View File

@ -1677,6 +1677,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);

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,352 @@
<?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\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();
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();
// 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();
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);
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
]);
}
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 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');
}
$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;
}
}

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,366 @@
<?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;
/**
* 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;
}
}

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

@ -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,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,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,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,7 @@ cadoles_portal_user_blogarticle_image:
path: /user/blogarticle/image
defaults: { _controller: CadolesPortalBundle:Blogarticle:image, access: user }
#== BLOGCOMMENT ==========================================================================================================================================
#-- Access config
@ -692,6 +693,129 @@ 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 }
#== FEED =================================================================================================================================================
@ -800,6 +924,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 }
@ -913,6 +1041,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 %}

View File

@ -11,7 +11,7 @@
</h1>
{{ form_widget(form.submit) }}
<a class="btn btn-default" href={{ path('cadoles_portal_'~access~'_blogarticle_view',{'id':entity.blogarticle.id}) }}'>Annuler</a>
<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}) }}

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

@ -0,0 +1,111 @@
{% 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: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>
{% 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,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,168 @@
{% 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>
</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 %}
<div data-toggle="modal" data-target="#mymodal" onclick="ModalLoad('mymodal','Fichiers','/ninegate/user/config/file/upload/projecttask-{{entity.id}}');" 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>
</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 %}
});
{% 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");
}
{% endblock %}

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