]> Raphaƫl G. Git Repositories - treebundle/blobdiff - Controller/TreeController.php
Add directory and document methods
[treebundle] / Controller / TreeController.php
index 267cffae27d3cf33c153d3d17fb772fd97c02103..a6e2ac1a119e661c49777c610724233839b3ebdd 100644 (file)
@@ -156,12 +156,15 @@ class TreeController extends AbstractController {
        /**
         * The index page
         *
        /**
         * The index page
         *
-        * Display file tree
+        * Display index
         *
         * @param Request $request The request instance
         * @return Response The rendered view
         */
         *
         * @param Request $request The request instance
         * @return Response The rendered view
         */
-       public function index(Request $request, string $path): Response {
+       public function index(Request $request): Response {
+               //Get roots
+               $this->context['roots'] = $this->config['roots'];
+
                //Render template
                $response = $this->render('@RapsysTree/index.html.twig', $this->context);
 
                //Render template
                $response = $this->render('@RapsysTree/index.html.twig', $this->context);
 
@@ -173,6 +176,52 @@ class TreeController extends AbstractController {
                return $response;
        }
 
                return $response;
        }
 
+       /**
+        * The directory page
+        *
+        * Display directory
+        *
+        * @param Request $request The request instance
+        * @param string $path The directory path
+        * @return Response The rendered view
+        */
+       public function directory(Request $request, string $path): Response {
+               header('Content-Type: text/plain');
+               var_dump($path);
+               exit;
+
+               //Render template
+               $response = $this->render('@RapsysTree/directory.html.twig', $this->context);
+
+               $response->setEtag(md5($response->getContent()));
+               $response->setPublic();
+               $response->isNotModified($request);
+
+               //Return response
+               return $response;
+       }
+
+       /**
+        * The document page
+        *
+        * Display document
+        *
+        * @param Request $request The request instance
+        * @param string $path The directory path
+        * @return Response The rendered view
+        */
+       public function document(Request $request, string $path): Response {
+               //Render template
+               $response = $this->render('@RapsysTree/document.html.twig', $this->context);
+
+               $response->setEtag(md5($response->getContent()));
+               $response->setPublic();
+               $response->isNotModified($request);
+
+               //Return response
+               return $response;
+       }
+
        /**
         * Renders a view
         *
        /**
         * Renders a view
         *
@@ -227,9 +276,9 @@ class TreeController extends AbstractController {
                }
 
                //With empty facebook title and title
                }
 
                //With empty facebook title and title
-               if (empty($parameters['facebook']['og:title']) && !empty($parameters['title'])) {
+               if (empty($parameters['facebook']['og:title']) && !empty($parameters['title']['page'])) {
                        //Set facebook title
                        //Set facebook title
-                       $parameters['facebook']['og:title'] = $parameters['title'];
+                       $parameters['facebook']['og:title'] = $parameters['title']['page'];
                }
 
                //With empty facebook description and description
                }
 
                //With empty facebook description and description