diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/FileController.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/FileController.php
index aeb5b572..7add7ac1 100644
--- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/FileController.php
+++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/FileController.php
@@ -180,6 +180,18 @@ class FileController extends Controller
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
if(!$cansee) throw $this->createNotFoundException('Permission denied');
break;
+
+ case "taskproject":
+ // Récupération de la tache
+ $projecttask=$em->getRepository("CadolesPortalBundle:Projecttask")->find($id);
+ if (!$projecttask) throw $this->createNotFoundException('Unable to find entity.');
+
+ // On s'assure que l'utilisateur à la permission de voir
+ $project=$projecttask->getProject();
+ $user=$this->getUser();
+ $em->getRepository("CadolesPortalBundle:Project")->getPermission($user,$project,$cansee,$canupdate,$canadd);
+ if(!$cansee) throw $this->createNotFoundException('Permission denied');
+ break;
}
}
}
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/ProjecttaskController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/ProjecttaskController.php
index c64d9579..53b119f1 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/ProjecttaskController.php
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/ProjecttaskController.php
@@ -7,6 +7,8 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Filesystem\Filesystem;
+use Symfony\Component\Finder\Finder;
+use Symfony\Component\HttpFoundation\File\File;
use Cadoles\PortalBundle\Entity\Projecttask;
use Cadoles\PortalBundle\Form\ProjecttaskType;
@@ -206,6 +208,54 @@ class ProjecttaskController extends Controller
$em->getRepository("CadolesPortalBundle:Projecttask")->getProjectsTasks($projects,0,10,$count,$projecttasks);
+ // Récupérer les fichiers de la tache
+ $directory=$this->get('kernel')->getRootDir()."/../uploads/file/taskproject-".$id;
+ $files=[];
+ $fs = new Filesystem();
+
+ if($fs->exists($directory)) {
+ $finder = new Finder();
+ $finder->sortByName()->in($directory)->exclude('thumb')->exclude('thumbmini');
+
+ foreach ($finder as $file) {
+ $tmp=[];
+ $tmp["name"]=$file->getRelativePathname();
+ $tmp["extension"]=$file->getExtension();
+ $fileinfo = new file($file->getPathname());
+ $tmp["minetype"]=$fileinfo->getMimeType();
+ $tmp["minefamily"]=explode("/",$tmp["minetype"])[0];
+
+ $tmp["thumb"]="";
+ if($tmp["extension"]=="pdf") {
+ $tmp["thumb"]="/".$this->getParameter('alias')."/bundles/cadolescore/images/files/".$tmp["extension"].".png";
+
+ if($fs->exists($directory."/thumbmini/".$tmp["name"])) {
+ $data = file_get_contents($directory."/thumbmini/".$tmp["name"]);
+ $tmp["thumb"]="data:image/jpg;base64," . base64_encode($data);
+ }
+ elseif($fs->exists($directory."/thumb/".$tmp["name"])) {
+ $data = file_get_contents($directory."/thumb/".$tmp["name"]);
+ $tmp["thumb"]="data:image/jpg;base64," . base64_encode($data);
+ }
+
+
+ }
+ elseif($fs->exists($directory."/thumbmini/".$tmp["name"])) {
+ $data = file_get_contents($directory."/thumbmini/".$tmp["name"]);
+ $tmp["thumb"]="data:image/" . $tmp["extension"] . ";base64," . base64_encode($data);
+ }
+ elseif($fs->exists($directory."/thumb/".$tmp["name"])) {
+ $data = file_get_contents($directory."/thumb/".$tmp["name"]);
+ $tmp["thumb"]="data:image/" . $tmp["extension"] . ";base64," . base64_encode($data);
+ }
+ elseif($fs->exists($this->get('kernel')->getRootDir()."/../web/bundles/cadolescore/images/files/".$tmp["extension"].".png")) {
+ $tmp["thumb"]="/".$this->getParameter('alias')."/bundles/cadolescore/images/files/".$tmp["extension"].".png";
+ }
+
+ array_push($files,$tmp);
+ }
+ }
+
return $this->render($this->labelentity.':view.html.twig', [
'useheader' => ($access=="config"),
'usemenu' => false,
@@ -216,7 +266,8 @@ class ProjecttaskController extends Controller
'canupdate' => $canupdate,
'canadd' => $canadd,
'projects' => $projects,
- 'projecttasks' => $projecttasks
+ 'projecttasks' => $projecttasks,
+ 'files' => $files
]);
}
@@ -311,7 +362,7 @@ class ProjecttaskController extends Controller
$idproject=$entity->getProject()->getId();
$oldpercentage=$entity->getPercentage();
- // On s'assure que l'utilisateur à la permission de supprimer
+ // 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);
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Projecttask/view.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Projecttask/view.html.twig
index ed009490..dfb8aa5c 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Projecttask/view.html.twig
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Projecttask/view.html.twig
@@ -101,14 +101,53 @@
Réalisé à
{{ entity.percentage}}%
{% if canadd %}
-
-