Explorar el Código

Fixed up what wasn't working

LaurentTreguier hace 9 años
padre
commit
68e5691b79
Se han modificado 3 ficheros con 12 adiciones y 6 borrados
  1. 5
    5
      controllers/document.php
  2. 1
    1
      index.php
  3. 6
    0
      models/document.class.php

+ 5
- 5
controllers/document.php Ver fichero

@@ -2,15 +2,15 @@
2 2
 
3 3
 require_once(dirname(__DIR__) . "/models/document.class.php");
4 4
 
5
-function files()
5
+function document()
6 6
 {
7 7
     set("title", "Titre");
8
-    set("data", File::getAll());
8
+    set("data", Document::getAll());
9 9
     
10 10
     return html("list.html.php", "layout.html.php");
11 11
 }
12 12
 
13
-function add_file()
13
+function add_document()
14 14
 {
15 15
     $options = [];
16 16
     
@@ -20,12 +20,12 @@ function add_file()
20 20
     File::addDocument($_FILES["document"], $options);
21 21
 }
22 22
 
23
-function alter_file()
23
+function alter_document()
24 24
 {
25 25
     // TODO
26 26
 }
27 27
 
28
-function delete_file()
28
+function delete_document()
29 29
 {
30 30
     (new File($_POST["id"]))->erase();
31 31
 }

+ 1
- 1
index.php Ver fichero

@@ -5,7 +5,7 @@ require_once("lib/limonade.php");
5 5
 dispatch_get("/",                  "login");
6 6
 dispatch_get("/data",              "data");
7 7
 dispatch_get("/data/extract",      "data_extract");
8
-dispatch_get("/files",             "files");
8
+dispatch_get("/document",          "document");
9 9
 dispatch_get("/promo",             "promo");
10 10
 
11 11
 dispatch_post("/",                 "check_login");

+ 6
- 0
models/document.class.php Ver fichero

@@ -33,6 +33,12 @@ class Document
33 33
         $this->fichier = $document["fichier"];
34 34
     }
35 35
 
36
+    public static function getAll()
37
+    {
38
+        $bdd = new Connector();
39
+        return $bdd->Select("*", "document");
40
+    }
41
+
36 42
     public static function addDocument($document, $options)
37 43
     {
38 44
         $filename = $document["name"];