finalisation widget project (ref #19)
This commit is contained in:
parent
6ffa8a20bf
commit
dfdf3ff9f5
|
@ -181,7 +181,7 @@ class FileController extends Controller
|
||||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "taskproject":
|
case "projecttask":
|
||||||
// Récupération de la tache
|
// Récupération de la tache
|
||||||
$projecttask=$em->getRepository("CadolesPortalBundle:Projecttask")->find($id);
|
$projecttask=$em->getRepository("CadolesPortalBundle:Projecttask")->find($id);
|
||||||
if (!$projecttask) throw $this->createNotFoundException('Unable to find entity.');
|
if (!$projecttask) throw $this->createNotFoundException('Unable to find entity.');
|
||||||
|
|
|
@ -298,6 +298,14 @@ class User implements UserInterface, \Serializable
|
||||||
*/
|
*/
|
||||||
private $projectownertasks;
|
private $projectownertasks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ArrayCollection $projectcomment
|
||||||
|
* @var Projectcomment
|
||||||
|
*
|
||||||
|
* @ORM\OneToMany(targetEntity="Cadoles\PortalBundle\Entity\Projectcomment", mappedBy="user", cascade={"persist"}, orphanRemoval=true)
|
||||||
|
*/
|
||||||
|
private $projectcomments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ArrayCollection $icon
|
* @var ArrayCollection $icon
|
||||||
* @var Icon
|
* @var Icon
|
||||||
|
@ -1754,4 +1762,38 @@ class User implements UserInterface, \Serializable
|
||||||
{
|
{
|
||||||
return $this->projectownertasks;
|
return $this->projectownertasks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add projectcomment
|
||||||
|
*
|
||||||
|
* @param \Cadoles\PortalBundle\Entity\Projectcomment $projectcomment
|
||||||
|
*
|
||||||
|
* @return User
|
||||||
|
*/
|
||||||
|
public function addProjectcomment(\Cadoles\PortalBundle\Entity\Projectcomment $projectcomment)
|
||||||
|
{
|
||||||
|
$this->projectcomments[] = $projectcomment;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove projectcomment
|
||||||
|
*
|
||||||
|
* @param \Cadoles\PortalBundle\Entity\Projectcomment $projectcomment
|
||||||
|
*/
|
||||||
|
public function removeProjectcomment(\Cadoles\PortalBundle\Entity\Projectcomment $projectcomment)
|
||||||
|
{
|
||||||
|
$this->projectcomments->removeElement($projectcomment);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get projectcomments
|
||||||
|
*
|
||||||
|
* @return \Doctrine\Common\Collections\Collection
|
||||||
|
*/
|
||||||
|
public function getProjectcomments()
|
||||||
|
{
|
||||||
|
return $this->projectcomments;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,8 +128,7 @@ class uploadListener
|
||||||
$fs->rename($pathname."/".$directory."/thumb/".$filename.".jpg", $pathname."/".$directory."/thumb/".$filename);
|
$fs->rename($pathname."/".$directory."/thumb/".$filename.".jpg", $pathname."/".$directory."/thumb/".$filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
$fgexit=$fs->exists($pathname."/".$directory."/thumb/".$filename);
|
if($fs->exists($pathname."/".$directory."/thumb/".$filename)) {
|
||||||
if($fgexit) {
|
|
||||||
$fs->mkdir($pathname."/".$directory."/thumbmini");
|
$fs->mkdir($pathname."/".$directory."/thumbmini");
|
||||||
$fs->copy($pathname."/".$directory."/thumb/".$filename,$pathname."/".$directory."/thumbmini/".$filename);
|
$fs->copy($pathname."/".$directory."/thumb/".$filename,$pathname."/".$directory."/thumbmini/".$filename);
|
||||||
$max_width=60;
|
$max_width=60;
|
||||||
|
@ -159,6 +158,26 @@ class uploadListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strpos($directory, 'projecttask') === 0) {
|
||||||
|
$tmp=explode("-",$directory);
|
||||||
|
$projecttaskid=$tmp[1];
|
||||||
|
$projecttask=$this->em->getRepository("CadolesPortalBundle:Projecttask")->find($projecttaskid);
|
||||||
|
if($projecttask) {
|
||||||
|
foreach($projecttask->getProject()->getGroups() as $group) {
|
||||||
|
if($group->getFgcanshare()) {
|
||||||
|
if($fgexit) $message="Modification fichier dans la tâche ".$projecttask->getName()."<br>".$filename;
|
||||||
|
else $message="Création fichier dans la tâche ".$projecttask->getName()."<br>".$filename;
|
||||||
|
|
||||||
|
$usergroup=$this->em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(["group"=>$group,"user"=>$this->token->getToken()->getUser()]);
|
||||||
|
if($usergroup) {
|
||||||
|
$key=$usergroup->getKeyvalue();
|
||||||
|
$websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key,$this->token->getToken()->getUser()->getId(),$group->getId(),$message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$response = $event->getResponse();
|
$response = $event->getResponse();
|
||||||
$response['file'] = $filename;
|
$response['file'] = $filename;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -9,6 +9,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
use Symfony\Component\Finder\Finder;
|
use Symfony\Component\Finder\Finder;
|
||||||
use Symfony\Component\HttpFoundation\File\File;
|
use Symfony\Component\HttpFoundation\File\File;
|
||||||
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
|
|
||||||
use Cadoles\PortalBundle\Entity\Projecttask;
|
use Cadoles\PortalBundle\Entity\Projecttask;
|
||||||
use Cadoles\PortalBundle\Form\ProjecttaskType;
|
use Cadoles\PortalBundle\Form\ProjecttaskType;
|
||||||
|
@ -59,6 +60,10 @@ class ProjecttaskController extends Controller
|
||||||
$em->persist($entity);
|
$em->persist($entity);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
|
if($entity->getUser()&&$entity->getUser()!=$entity->getOwner()) {
|
||||||
|
$this->notifMail($entity);
|
||||||
|
}
|
||||||
|
|
||||||
foreach($entity->getProject()->getGroups() as $group) {
|
foreach($entity->getProject()->getGroups() as $group) {
|
||||||
if($group->getFgcanshare()) {
|
if($group->getFgcanshare()) {
|
||||||
$url=$this->generateUrl('cadoles_portal_'.$access.'_projecttask_view',["id"=>$entity->getId()]);
|
$url=$this->generateUrl('cadoles_portal_'.$access.'_projecttask_view',["id"=>$entity->getId()]);
|
||||||
|
@ -92,6 +97,7 @@ class ProjecttaskController extends Controller
|
||||||
$entity = $em->getRepository($this->labelentity)->find($id);
|
$entity = $em->getRepository($this->labelentity)->find($id);
|
||||||
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
|
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
|
||||||
$oldpercentage=$entity->getPercentage();
|
$oldpercentage=$entity->getPercentage();
|
||||||
|
$olduser=$entity->getUser();
|
||||||
|
|
||||||
// On s'assure que l'utilisateur à la permission de modifier
|
// On s'assure que l'utilisateur à la permission de modifier
|
||||||
if($access=="user") {
|
if($access=="user") {
|
||||||
|
@ -111,6 +117,11 @@ class ProjecttaskController extends Controller
|
||||||
$em->persist($entity);
|
$em->persist($entity);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
|
if($entity->getUser()&&$entity->getUser()!=$entity->getOwner()&&$entity->getUser()!=$olduser) {
|
||||||
|
$this->notifMail($entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach($entity->getProject()->getGroups() as $group) {
|
foreach($entity->getProject()->getGroups() as $group) {
|
||||||
if($group->getFgcanshare()) {
|
if($group->getFgcanshare()) {
|
||||||
$url=$this->generateUrl('cadoles_portal_'.$access.'_projecttask_view',["id"=>$entity->getId()]);
|
$url=$this->generateUrl('cadoles_portal_'.$access.'_projecttask_view',["id"=>$entity->getId()]);
|
||||||
|
@ -209,7 +220,7 @@ class ProjecttaskController extends Controller
|
||||||
$em->getRepository("CadolesPortalBundle:Projecttask")->getProjectsTasks($projects,0,10,$count,$projecttasks);
|
$em->getRepository("CadolesPortalBundle:Projecttask")->getProjectsTasks($projects,0,10,$count,$projecttasks);
|
||||||
|
|
||||||
// Récupérer les fichiers de la tache
|
// Récupérer les fichiers de la tache
|
||||||
$directory=$this->get('kernel')->getRootDir()."/../uploads/file/taskproject-".$id;
|
$directory=$this->get('kernel')->getRootDir()."/../uploads/file/projecttask-".$id;
|
||||||
$files=[];
|
$files=[];
|
||||||
$fs = new Filesystem();
|
$fs = new Filesystem();
|
||||||
|
|
||||||
|
@ -400,4 +411,23 @@ class ProjecttaskController extends Controller
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function notifMail($entity) {
|
||||||
|
$appname=$this->get('session')->get('appname');
|
||||||
|
|
||||||
|
$url=$this->generateUrl('cadoles_core_redirect', ['route'=>'cadoles_portal_user_projecttask_view','id'=>$entity->getId()], UrlGeneratorInterface::ABSOLUTE_URL);
|
||||||
|
$urltext=$url;
|
||||||
|
$urlhtml="<a href='".$url."'>".$url."</a>";
|
||||||
|
$bodytext="Une tâche vous a été affectée dans le groupe ".$entity->getProject()->getName()."\n".$entity->getName()."\n\nVous pouvez la consulter sur\n";
|
||||||
|
$bodyhtml=nl2br($bodytext);
|
||||||
|
|
||||||
|
$mail_params=array(
|
||||||
|
"subject" => $appname." : Affectation Tâche dans le groupe ".$entity->getProject()->getName(),
|
||||||
|
"body_html"=>$bodyhtml.$urlhtml,
|
||||||
|
"body_text"=>$bodytext.$urltext,
|
||||||
|
);
|
||||||
|
|
||||||
|
$message = $this->container->get('cadoles.core.service.mail');
|
||||||
|
$message->sendEmail("template", $mail_params, $entity->getUser()->getEmail(), $this->getParameter("noreply"), $appname);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,15 @@ class Projecttask
|
||||||
*/
|
*/
|
||||||
private $projecttaskstatus;
|
private $projecttaskstatus;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ArrayCollection $projectcomment
|
||||||
|
* @var Projectcomment
|
||||||
|
*
|
||||||
|
* @ORM\OneToMany(targetEntity="Cadoles\PortalBundle\Entity\Projectcomment", mappedBy="projecttask", cascade={"persist"}, orphanRemoval=true)
|
||||||
|
*/
|
||||||
|
private $projectcomments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get id
|
* Get id
|
||||||
*
|
*
|
||||||
|
@ -363,4 +372,45 @@ class Projecttask
|
||||||
{
|
{
|
||||||
return $this->percentage;
|
return $this->percentage;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->projectcomments = new \Doctrine\Common\Collections\ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add projectcomment
|
||||||
|
*
|
||||||
|
* @param \Cadoles\PortalBundle\Entity\Projectcomment $projectcomment
|
||||||
|
*
|
||||||
|
* @return Projecttask
|
||||||
|
*/
|
||||||
|
public function addProjectcomment(\Cadoles\PortalBundle\Entity\Projectcomment $projectcomment)
|
||||||
|
{
|
||||||
|
$this->projectcomments[] = $projectcomment;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove projectcomment
|
||||||
|
*
|
||||||
|
* @param \Cadoles\PortalBundle\Entity\Projectcomment $projectcomment
|
||||||
|
*/
|
||||||
|
public function removeProjectcomment(\Cadoles\PortalBundle\Entity\Projectcomment $projectcomment)
|
||||||
|
{
|
||||||
|
$this->projectcomments->removeElement($projectcomment);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get projectcomments
|
||||||
|
*
|
||||||
|
* @return \Doctrine\Common\Collections\Collection
|
||||||
|
*/
|
||||||
|
public function getProjectcomments()
|
||||||
|
{
|
||||||
|
return $this->projectcomments;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -817,6 +817,44 @@ cadoles_portal_user_projecttask_percentage:
|
||||||
path: /user/projecttask/percentage/{id}
|
path: /user/projecttask/percentage/{id}
|
||||||
defaults: { _controller: CadolesPortalBundle:Projecttask:percentage, access: user }
|
defaults: { _controller: CadolesPortalBundle:Projecttask:percentage, access: user }
|
||||||
|
|
||||||
|
|
||||||
|
#== PROJECT COMMENT ==========================================================================================================================================
|
||||||
|
|
||||||
|
#-- Access config
|
||||||
|
cadoles_portal_config_projectcomment_submit:
|
||||||
|
path: /config/projectcomment/submit/{idtask}
|
||||||
|
defaults: { _controller: CadolesPortalBundle:Projectcomment:submit, access: config}
|
||||||
|
|
||||||
|
cadoles_portal_config_projectcomment_update:
|
||||||
|
path: /config/projectcomment/update/{id}
|
||||||
|
defaults: { _controller: CadolesPortalBundle:Projectcomment:update, access: config }
|
||||||
|
|
||||||
|
cadoles_portal_config_projectcomment_delete:
|
||||||
|
path: /config/projectcomment/delete/{id}
|
||||||
|
defaults: { _controller: CadolesPortalBundle:Projectcomment:delete, access: config }
|
||||||
|
|
||||||
|
cadoles_portal_config_projectcomment_upload:
|
||||||
|
path: /config/projectcomment/upload
|
||||||
|
defaults: { _controller: CadolesPortalBundle:Projectcomment:upload, access: config }
|
||||||
|
|
||||||
|
#-- Access user
|
||||||
|
cadoles_portal_user_projectcomment_submit:
|
||||||
|
path: /user/projectcomment/submit/{idtask}
|
||||||
|
defaults: { _controller: CadolesPortalBundle:Projectcomment:submit, access: user }
|
||||||
|
|
||||||
|
cadoles_portal_user_projectcomment_update:
|
||||||
|
path: /user/projectcomment/update/{id}
|
||||||
|
defaults: { _controller: CadolesPortalBundle:Projectcomment:update, access: user }
|
||||||
|
|
||||||
|
cadoles_portal_user_projectcomment_delete:
|
||||||
|
path: /user/projectcomment/delete/{id}
|
||||||
|
defaults: { _controller: CadolesPortalBundle:Projectcomment:delete, access: user }
|
||||||
|
|
||||||
|
cadoles_portal_user_projectcomment_upload:
|
||||||
|
path: /user/projectcomment/upload
|
||||||
|
defaults: { _controller: CadolesPortalBundle:Projectcomment:upload, access: user }
|
||||||
|
|
||||||
|
|
||||||
#== FEED =================================================================================================================================================
|
#== FEED =================================================================================================================================================
|
||||||
|
|
||||||
cadoles_portal_user_feed_limesurvey:
|
cadoles_portal_user_feed_limesurvey:
|
||||||
|
|
|
@ -51,10 +51,3 @@
|
||||||
|
|
||||||
{{ form_end(form) }}
|
{{ form_end(form) }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block localjavascript %}
|
|
||||||
$('#mymodal').on('hidden.bs.modal', function () {
|
|
||||||
var imgSrc = $("#blogcomment_image_img").attr('src');
|
|
||||||
$("#blogcomment_image_img").attr('src',imgSrc);
|
|
||||||
});
|
|
||||||
{% endblock %}
|
|
||||||
|
|
|
@ -95,8 +95,28 @@
|
||||||
<div class="projectbody">
|
<div class="projectbody">
|
||||||
{{ entity.description | raw }}
|
{{ entity.description | raw }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<a href="{{path('cadoles_portal_'~access~'_projectcomment_submit',{"idtask":entity.id}) }}" style="width:100%" class="btn btn-success">Ajouter un commentaire</a>
|
||||||
|
|
||||||
|
{% if not entity.projectcomments is empty %}
|
||||||
|
{% for comment in entity.projectcomments|reverse %}
|
||||||
|
<div class="projecttitle">
|
||||||
|
<legend><h2>{{comment.name}}</h2></legend>
|
||||||
|
<small>publié par {{ comment.user.username }} le {{ comment.submit|date("d/m/Y à H:i") }}</small>
|
||||||
|
{% if canadd or app.user==comment.user%}
|
||||||
|
<a href="{{ path("cadoles_portal_"~access~"_projectcomment_update",{'id':comment.id}) }}"><i class="fa fa-file"></i></a>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="projectbody">
|
||||||
|
{{ comment.description | raw }}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="col col-md-3" style="margin-top:20px; text-align:center">
|
<div class="col col-md-3" style="margin-top:20px; text-align:center">
|
||||||
Réalisé à<br>
|
Réalisé à<br>
|
||||||
<span id="percentage" style="font-size:60px">{{ entity.percentage}}</span><small>%</small>
|
<span id="percentage" style="font-size:60px">{{ entity.percentage}}</span><small>%</small>
|
||||||
|
@ -115,12 +135,12 @@
|
||||||
<div class="grid-item grid-small">
|
<div class="grid-item grid-small">
|
||||||
<div class="grid-item-content" style="background-color: #{{ color["main"]}}">
|
<div class="grid-item-content" style="background-color: #{{ color["main"]}}">
|
||||||
{% if canadd %}
|
{% if canadd %}
|
||||||
<a style="cursor:pointer;color: #{{color['fontcolorhover']}}" onClick="delFile('taskproject-{{ entity.id}}','{{file.name|e('js')|raw }}')" class="item-delete">
|
<a style="cursor:pointer;color: #{{color['fontcolorhover']}}" onClick="delFile('projecttask-{{ entity.id}}','{{file.name|e('js')|raw }}')" class="item-delete">
|
||||||
<i class="fa fa-trash" title="Supprimer le fichier"></i>
|
<i class="fa fa-trash" title="Supprimer le fichier"></i>
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<a style="cursor:pointer" href="{{ path('cadoles_core_'~access~'_file_download',{'directory':'taskproject-'~entity.id,'filename':file.name }) }}">
|
<a style="cursor:pointer" href="{{ path('cadoles_core_'~access~'_file_download',{'directory':'projecttask-'~entity.id,'filename':file.name }) }}">
|
||||||
|
|
||||||
<div class="item-link clearfix">
|
<div class="item-link clearfix">
|
||||||
<div class="grid-item-logo">
|
<div class="grid-item-logo">
|
||||||
|
@ -143,7 +163,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if canadd %}
|
{% if canadd %}
|
||||||
<div data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Fichiers','{{ path('cadoles_core_'~access~'_file_upload',{'id': 'taskproject-'~entity.id,'type':'all'}) }}');" title="Ajouter des fichiers" class="grid-item-content" style="cursor:pointer;margin-top:20px;">
|
<div data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Fichiers','{{ path('cadoles_core_'~access~'_file_upload',{'id': 'projecttask-'~entity.id,'type':'all'}) }}');" title="Ajouter des fichiers" class="grid-item-content" style="cursor:pointer;margin-top:20px;">
|
||||||
<img class="grid-item-img imageshadow" height="60" src="/ninegate/uploads/icon/icon_add.png">
|
<img class="grid-item-img imageshadow" height="60" src="/ninegate/uploads/icon/icon_add.png">
|
||||||
<br>Ajouter un fichier
|
<br>Ajouter un fichier
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -116,7 +116,7 @@ class WebsocketTopic implements TopicInterface
|
||||||
$pages=$group->getPages();
|
$pages=$group->getPages();
|
||||||
$pageid=$pages[0]->getId();
|
$pageid=$pages[0]->getId();
|
||||||
$cplt="<br><br><b>Attention pour répondre à ce message : n’utilisez pas votre mail mais rendez vous dans ce groupe sur Transnum et utilisez le fil de conversation (chat)</b><br>";
|
$cplt="<br><br><b>Attention pour répondre à ce message : n’utilisez pas votre mail mais rendez vous dans ce groupe sur Transnum et utilisez le fil de conversation (chat)</b><br>";
|
||||||
$url=$url = "https://".$this->container->getParameter('weburl')."/".$this->container->getParameter('alias').$this->container->get('router')->generate('cadoles_core_redirect', ['route'=>'cadoles_core_home','id'=>$pageid]);
|
$url="https://".$this->container->getParameter('weburl')."/".$this->container->getParameter('alias').$this->container->get('router')->generate('cadoles_core_redirect', ['route'=>'cadoles_core_home','id'=>$pageid]);
|
||||||
$cplturl="<br><a href='".$url."'>".$url."</a>";
|
$cplturl="<br><a href='".$url."'>".$url."</a>";
|
||||||
$mail_params=array(
|
$mail_params=array(
|
||||||
"subject" => $event["subject"],
|
"subject" => $event["subject"],
|
||||||
|
|
Loading…
Reference in New Issue