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 7db90415..b2af0bdc 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/FileController.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/FileController.php @@ -25,6 +25,7 @@ class FileController extends Controller $subdirectory=$request->get("subdirectory"); $clear=$request->get("clear"); $view=$request->get("view"); + $sort=$request->get("sort"); $defaultview=$request->get("defaultview"); // Récupérer en session le dernier subdirectory visité @@ -53,6 +54,14 @@ class FileController extends Controller $sessionviewdirectory[$directory] = $view; $this->get('session')->set('sessionviewdirectory',$sessionviewdirectory); + // Récupérer en session le trie + $sessionviewsort = $this->get('session')->get('sessionviewsort'); + if(!is_array($sessionviewsort)) $sessionviewsort=[$sort=>"name"]; + if(!array_key_exists($directory,$sessionviewsort)) $sessionviewsort[$directory]="name"; + if($sort) + $sessionviewsort[$directory] = $sort; + $this->get('session')->set('sessionviewsort',$sessionviewsort); + // Construire le chemin réel $iddirectory=explode("-",$directory)[1]; @@ -79,6 +88,7 @@ class FileController extends Controller if(is_dir($file)) { $tmp=[]; $tmp["name"]=$file->getRelativePathname(); + $tmp["date"]=date ("d/m/Y H:i", filemtime($file)); array_push($dirs,$tmp); } else { @@ -88,6 +98,7 @@ class FileController extends Controller $fileinfo = new file($file->getPathname()); $tmp["minetype"]=$fileinfo->getMimeType(); $tmp["minefamily"]=explode("/",$tmp["minetype"])[0]; + $tmp["date"] = date ("d/m/Y H:i", filemtime($file)); $tmp["thumb"]=""; if($tmp["extension"]=="pdf") { @@ -110,6 +121,13 @@ class FileController extends Controller } } + // Trie du tableu + $sort = array_column($files, $sessionviewsort[$directory]); + array_multisort($sort, SORT_ASC, $files); + + $sort = array_column($dirs, $sessionviewsort[$directory]); + array_multisort($sort, SORT_ASC, $dirs); + return $this->render('CadolesCoreBundle:File:list.html.twig',[ 'useheader' => false, 'usemenu' => false, @@ -125,6 +143,7 @@ class FileController extends Controller 'canupdate' => $canupdate, 'canadd' => $canupdate, 'view' => $sessionviewdirectory[$directory], + 'sort' => $sessionviewsort[$directory], ]); } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/File/list.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/File/list.html.twig index 7492d6d1..6daa5c81 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/File/list.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/File/list.html.twig @@ -11,14 +11,21 @@ .grid .grid-list .grid-item-title h2 { font-size: 14px; - line-height: 22px; - height: 22px; + line-height: 18px; + height: 18px } + .grid .grid-list .grid-item-title { + padding:0px 0px 0px 5px; + line-height: 10px; + } + .grid-item-title h2 { text-transform: initial !important; } + + {% endblock %} {% block pagewrapper %} @@ -43,19 +50,34 @@ {% else %} {%set action="small" %} {% endif %} - {% if not subdirectory is empty %} {% else %} {% endif %} - {% if view=="small" %} {% else %} {% endif %} + + {% if sort=="name" %} + {%set action="date" %} + {% else %} + {%set action="name" %} + {% endif %} + {% if not subdirectory is empty %} + + {% else %} + + {% endif %} + {% if sort=="name" %} + + {% else %} + + {% endif %} + @@ -87,7 +109,7 @@ - {% for dir in dirs|sort %} + {% for dir in dirs %}