|  | @@ -1,37 +1,36 @@
 | 
	
		
			
			| 1 |  | -<?php
 | 
	
		
			
			| 2 |  | -
 | 
	
		
			
			| 3 |  | -require_once(dirname(__DIR__) . "/models/document.class.php");
 | 
	
		
			
			| 4 |  | -require_once(dirname(__DIR__) . "/models/promo.class.php");
 | 
	
		
			
			| 5 |  | -
 | 
	
		
			
			| 6 |  | -function document()
 | 
	
		
			
			| 7 |  | -{
 | 
	
		
			
			| 8 |  | -    set("title", "Titre");
 | 
	
		
			
			| 9 |  | -    set("data", Document::getAll());
 | 
	
		
			
			| 10 |  | -    set("promos", Promo::getAll());
 | 
	
		
			
			| 11 |  | -    
 | 
	
		
			
			| 12 |  | -    return html("list.html.php", "layout.html.php");
 | 
	
		
			
			| 13 |  | -}
 | 
	
		
			
			| 14 |  | -
 | 
	
		
			
			| 15 |  | -function add_document()
 | 
	
		
			
			| 16 |  | -{
 | 
	
		
			
			| 17 |  | -    File::addDocument($_FILES["document"], [
 | 
	
		
			
			| 18 |  | -        "rang" => $_POST["rang"],
 | 
	
		
			
			| 19 |  | -        "promo" => $_POST["promo"],
 | 
	
		
			
			| 20 |  | -        "libelle" => $_POST["libelle"]
 | 
	
		
			
			| 21 |  | -    ]);
 | 
	
		
			
			| 22 |  | -}
 | 
	
		
			
			| 23 |  | -
 | 
	
		
			
			| 24 |  | -function alter_document()
 | 
	
		
			
			| 25 |  | -{
 | 
	
		
			
			| 26 |  | -    $document = new Document($_POST["id"]);
 | 
	
		
			
			| 27 |  | -    
 | 
	
		
			
			| 28 |  | -    $document->setRang($_POST["rang"]);
 | 
	
		
			
			| 29 |  | -    $document->setPromo($_POST["promo"]);
 | 
	
		
			
			| 30 |  | -    $document->setLibelle($_POST["libelle"]);
 | 
	
		
			
			| 31 |  | -    $document->setFichier($_POST["fichier"]);
 | 
	
		
			
			| 32 |  | -}
 | 
	
		
			
			| 33 |  | -
 | 
	
		
			
			| 34 |  | -function delete_document()
 | 
	
		
			
			| 35 |  | -{
 | 
	
		
			
			| 36 |  | -    (new File($_POST["id"]))->erase();
 | 
	
		
			
			| 37 |  | -}
 | 
	
		
			
			|  | 1 | +<?php
 | 
	
		
			
			|  | 2 | +
 | 
	
		
			
			|  | 3 | +require_once(dirname(__DIR__) . "/models/document.class.php");
 | 
	
		
			
			|  | 4 | +require_once(dirname(__DIR__) . "/models/promo.class.php");
 | 
	
		
			
			|  | 5 | +
 | 
	
		
			
			|  | 6 | +function document()
 | 
	
		
			
			|  | 7 | +{
 | 
	
		
			
			|  | 8 | +    set("title", "Titre");
 | 
	
		
			
			|  | 9 | +    set("data", Document::getAll());
 | 
	
		
			
			|  | 10 | +
 | 
	
		
			
			|  | 11 | +    return html("list.html.php", "layout.html.php");
 | 
	
		
			
			|  | 12 | +}
 | 
	
		
			
			|  | 13 | +
 | 
	
		
			
			|  | 14 | +function add_document()
 | 
	
		
			
			|  | 15 | +{
 | 
	
		
			
			|  | 16 | +    File::addDocument($_FILES["document"], [
 | 
	
		
			
			|  | 17 | +        "rang" => $_POST["rang"],
 | 
	
		
			
			|  | 18 | +        "promo" => $_POST["promo"],
 | 
	
		
			
			|  | 19 | +        "libelle" => $_POST["libelle"]
 | 
	
		
			
			|  | 20 | +    ]);
 | 
	
		
			
			|  | 21 | +}
 | 
	
		
			
			|  | 22 | +
 | 
	
		
			
			|  | 23 | +function alter_document()
 | 
	
		
			
			|  | 24 | +{
 | 
	
		
			
			|  | 25 | +    $document = new Document($_POST["id"]);
 | 
	
		
			
			|  | 26 | +    
 | 
	
		
			
			|  | 27 | +    $document->setRang($_POST["rang"]);
 | 
	
		
			
			|  | 28 | +    $document->setPromo($_POST["promo"]);
 | 
	
		
			
			|  | 29 | +    $document->setLibelle($_POST["libelle"]);
 | 
	
		
			
			|  | 30 | +    $document->setFichier($_POST["fichier"]);
 | 
	
		
			
			|  | 31 | +}
 | 
	
		
			
			|  | 32 | +
 | 
	
		
			
			|  | 33 | +function delete_document()
 | 
	
		
			
			|  | 34 | +{
 | 
	
		
			
			|  | 35 | +    (new File($_POST["id"]))->erase();
 | 
	
		
			
			|  | 36 | +}
 |