Преглед изворни кода

Fixed up what wasn't working

LaurentTreguier пре 10 година
родитељ
комит
68e5691b79
3 измењених фајлова са 12 додато и 6 уклоњено
  1. 5
    5
      controllers/document.php
  2. 1
    1
      index.php
  3. 6
    0
      models/document.class.php

+ 5
- 5
controllers/document.php Прегледај датотеку

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

+ 1
- 1
index.php Прегледај датотеку

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

+ 6
- 0
models/document.class.php Прегледај датотеку

33
         $this->fichier = $document["fichier"];
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
     public static function addDocument($document, $options)
42
     public static function addDocument($document, $options)
37
     {
43
     {
38
         $filename = $document["name"];
44
         $filename = $document["name"];