Sfoglia il codice sorgente

Make /data and /data/exract work

LaurentTreguier 9 anni fa
parent
commit
2d30c4a4be
1 ha cambiato i file con 4 aggiunte e 2 eliminazioni
  1. 4
    2
      controllers/data.php

+ 4
- 2
controllers/data.php Vedi File

1
 <?php
1
 <?php
2
 
2
 
3
-include_once(dirname(__DIR__)."../models/data.class.php");
3
+require_once(dirname(__DIR__)."/models/data.class.php");
4
 
4
 
5
 function data()
5
 function data()
6
 {
6
 {
7
     set("title", "Titre");
7
     set("title", "Titre");
8
+    set("data", Data::getAll());
8
     
9
     
9
     return html("data.html.php", "layout.html.php");
10
     return html("data.html.php", "layout.html.php");
10
 }
11
 }
12
 function data_extract()
13
 function data_extract()
13
 {
14
 {
14
     header("Content-Type: text/csv");
15
     header("Content-Type: text/csv");
16
+    header("Content-Disposition: filename=\"data.csv\"");
15
     
17
     
16
-    echo Data::extract();
18
+    return Data::extract();
17
 }
19
 }
18
 
20
 
19
 function alter_data()
21
 function alter_data()