Subversion Repositories Applications.gtt

Rev

Rev 102 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 102 Rev 103
Line 3... Line 3...
3
 
3
 
4
	public function __construct(Registre $Registre)
4
	public function __construct(Registre $Registre)
5
	{
5
	{
6
		$Registre->ajouterEspace('AdminCategorie', 'admin_categorie');
6
		$Registre->ajouterEspace('AdminCategorie', 'admin_categorie');
7
		$Registre->ajouterSquelette('admin_categorie', 'admin_categorie.tpl.html');
7
		$Registre->ajouterSquelette('admin_categorie', 'admin_categorie.tpl.html');
8
		$Registre->setTitre('Administrer les catégories des projets');
8
		$Registre->setTitre('Administrer les catégories des projets');
Line 9... Line 9...
9
	}
9
	}
10
 
10
 
11
	public function executer()
11
	public function executer()
Line 12... Line 12...
12
    {
12
    {
13
    	$aso_admin_categ = array();
13
    	$aso_admin_categ = array();
Line 14... Line 14...
14
 
14
 
15
		// Récupération des catégories
15
		// Récupération des catégories
Line 16... Line 16...
16
		$ProjetCategorie = new ProjetCategorie();
16
		$ProjetCategorie = new ProjetCategorie();
17
 
17
 
18
		// Ajout de la catégorie par défaut
18
		// Ajout de la catégorie par défaut
19
		$aso_admin_categ['ProjetCategorie'] = $ProjetCategorie;
19
		$aso_admin_categ['ProjetCategorie'] = $ProjetCategorie;
20
		
20
		
21
		// Récupération des infos sur les categories existantes 
21
		// Récupération des infos sur les categories existantes 
Line 29... Line 29...
29
	    			$aso_categ['libelle'] = $pc->getLibelle();
29
	    			$aso_categ['libelle'] = $pc->getLibelle();
30
	    			$aso_admin_categ['categories'][] = $aso_categ;
30
	    			$aso_admin_categ['categories'][] = $aso_categ;
31
	    		}
31
	    		}
32
	    	}
32
	    	}
33
    	}
33
    	}
34
		// Modification des titres, légendes et bouton
34
		// Modification des titres, légendes et bouton
35
		$aso_admin_categ['form_legend'] = 'Ajouter une categorie';
35
		$aso_admin_categ['form_legend'] = 'Ajouter une categorie';
36
		$aso_admin_categ['form_bouton_value'] = 'Ajouter';
36
		$aso_admin_categ['form_bouton_value'] = 'Ajouter';
37
		$aso_admin_categ['form_bouton_id'] = 'btn_categorie_ajouter';
37
		$aso_admin_categ['form_bouton_id'] = 'btn_categorie_ajouter';
38
		$aso_admin_categ['form_url'] = 'index.php?action=admin-categorie_valider-ajouter';
38
		$aso_admin_categ['form_url'] = 'index.php?action=admin-categorie_valider-ajouter';
Line 43... Line 43...
43
 
43
 
44
	public function executerEditer()
44
	public function executerEditer()
45
    {
45
    {
46
		// Ajout du statut d'utilisateur
46
		// Ajout du statut d'utilisateur
47
		if (isset($_POST['btn_categorie_modifier'])) {
47
		if (isset($_POST['btn_categorie_modifier'])) {
48
			// Récupération des données de la categorie à modifier
48
			// Récupération des données de la categorie à modifier
49
			$ProjetCategorie = new ProjetCategorie();
49
			$ProjetCategorie = new ProjetCategorie();
50
			$ProjetCategorie->consulter(ProjetCategorie::GPC_ID, $_POST['casu_id'], true);
50
			$ProjetCategorie->consulter(ProjetCategorie::GPC_ID, $_POST['casu_id'], true);
Line 51... Line 51...
51
			$aso_admin_categ['ProjetCategorie'] = $ProjetCategorie;
51
			$aso_admin_categ['ProjetCategorie'] = $ProjetCategorie;
52
 
52
 
53
			// Modification des titres, légendes et bouton
53
			// Modification des titres, légendes et bouton
54
			$aso_admin_categ['form_legend'] = 'Modifier une categorie';
54
			$aso_admin_categ['form_legend'] = 'Modifier une categorie';
55
			$aso_admin_categ['form_bouton_value'] = 'Modifier';
55
			$aso_admin_categ['form_bouton_value'] = 'Modifier';
Line 77... Line 77...
77
		}
77
		}
78
	}
78
	}
Line 79... Line 79...
79
	
79
	
80
    public function executerValiderAjouter()
80
    public function executerValiderAjouter()
81
    {
81
    {
82
		// Ajout de la catégorie
82
		// Ajout de la catégorie
83
		$ProjetCategorie = new ProjetCategorie();
83
		$ProjetCategorie = new ProjetCategorie();
84
		$bool_existe = $ProjetCategorie->consulter(ProjetCategorie::GPC_LIBELLE, array($_POST['caaj_libelle']));
84
		$bool_existe = $ProjetCategorie->consulter(ProjetCategorie::GPC_LIBELLE, array($_POST['caaj_libelle']));
85
		if ($bool_existe == false) {
85
		if ($bool_existe == false) {
86
			$ProjetCategorie->setLibelle($_POST['caaj_libelle']);
86
			$ProjetCategorie->setLibelle($_POST['caaj_libelle']);
87
			$ProjetCategorie->setAbreviation($_POST['caaj_abreviation']);
87
			$ProjetCategorie->setAbreviation($_POST['caaj_abreviation']);
88
    		$ProjetCategorie->ajouter();
88
    		$ProjetCategorie->ajouter();
89
		} else {
89
		} else {
90
			$aso_admin_categ['message'] = 'Cette catégorie existe déjà !';
90
			$aso_admin_categ['message'] = 'Cette catégorie existe déjà !';
91
			$this->getRegistre()->ajouterDonnee('admin_categorie', $aso_admin_categ);
91
			$this->getRegistre()->ajouterDonnee('admin_categorie', $aso_admin_categ);
Line 92... Line 92...
92
		}
92
		}
93
 
93
 
94
		// Action suivante
94
		// Action suivante
Line 95... Line 95...
95
    	$this->setSuivant('__defaut__');
95
    	$this->setSuivant('__defaut__');
96
    }
96
    }
97
 
97
 
98
    public function executerValiderSupprimer()
98
    public function executerValiderSupprimer()
99
    {
99
    {
100
		// Suppression de la catégorie
100
		// Suppression de la catégorie
Line 101... Line 101...
101
		$ProjetCategorie = new ProjetCategorie();
101
		$ProjetCategorie = new ProjetCategorie();
102
		$ProjetCategorie->setIdCategorie($_POST['casu_id']);
102
		$ProjetCategorie->setIdCategorie($_POST['casu_id']);
103
    	$ProjetCategorie->supprimer();
103
    	$ProjetCategorie->supprimer();
104
 
104
 
105
		// Mise à jour des projets appartenant à la catégorie
105
		// Mise à jour des projets appartenant à la catégorie
106
		$Projet = new Projet();
106
		$Projet = new Projet();