Subversion Repositories Applications.framework

Rev

Rev 78 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5 aurelien 1
<?php
2
/**
80 jpm 3
* @category PHP
4
* @package Framework
5
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
6
* @copyright Tela-Botanica 2009
7
* @link /doc/framework/
8
* Ceci est un exemple d'application qui permet d'illustrer  le fonctionnement du framework, il montre comment
9
* une application peut être dans papyrus, ou bien utilisée en stand alone.
10
*/
11
 
12
// La fonction autolad doit être appelée avant tout autre chose dans l'application.
13
// Sinon, rien ne sera chargé.
14
require_once '../framework/autoload.inc.php';
15
 
16
 /**
17
  * Fonction d'affichage de Papyrus, pour le corps de page
18
  */
19
function afficherContenuCorps() {
20
	// Si l'utilisateur est authentifié
21
	if (!Config::get('identification')) {
22
		// on renvoie la vue principale de l'application
23
		$methode = '' ;
24
		if (isset($_GET['m'])) {
25
			$methode = $_GET['m'];
26
		}
27
		$controlleur = new AdminAdministrateur();
28
 
29
		switch ($methode) {
30
			case 'ajout_admin':
31
				return $controlleur->ajoutAdmin();
32
				break;
33
			case 'ajout_admin_va':
34
				$nom = $_POST['admin_nom'];
35
				$prenom = $_POST['admin_prenom'];
36
				$mail = $_POST['admin_mail'];
37
				$lang = $_POST['admin_lang'];
38
				$pass = $_POST['admin_pass'];
39
				$pass_conf = $_POST['admin_pass_confirm'];
40
				return $controlleur->ajoutAdminVa($nom, $prenom, $mail, $lang, $pass, $pass_conf);
41
			 	break;
42
			case 'modif_admin':
43
				$id = $_GET['id_admin'];
44
				return $controlleur->modifAdmin($id);
45
				break;
46
			case 'modif_admin_va':
47
				$id = $_GET['id_admin'];
48
				$nom = $_POST['admin_nom'];
49
				$prenom = $_POST['admin_prenom'];
50
				$mail = $_POST['admin_mail'];
51
				$lang = $_POST['admin_lang'];
52
				$pass = $_POST['admin_pass'];
53
				$pass_conf = $_POST['admin_pass_confirm'];
54
				return $controlleur->modifAdminVa($id, $nom, $prenom, $mail, $lang, $pass, $pass_conf);
55
			 	break;
56
			case 'suppr_admin':
57
				$id = $_GET['id_admin'];
58
				return $controlleur->supprAdmin($id);
59
				break;
60
			default:
61
				return $controlleur->chargerAdmin();
62
				break;
63
		}
64
	} else {
65
		// sinon on lui demande de s'identifier
66
		$controlleur = new AdminAdministrateur();
67
		return $controlleur->demanderIdent();
68
	}
69
}
70
 
71
function afficherContenuTete() {
72
	$controlleur = new AdminAdministrateur();
73
	return $controlleur->adminTete();
74
}
75
 
76
function afficherContenuPied() {
77
	$controlleur = new AdminAdministrateur();
78
	return $controlleur->adminPied();
79
}
80
 
81
if(!defined('PAP_VERSION')) {
82
	echo afficherContenuTete();
83
	echo afficherContenuCorps();
84
	echo afficherContenuPied();
85
}
86
 /*
87
  * afficherContenuNavigation()
88
  * afficherContenuMenu()
89
  */
90
?>