Subversion Repositories Applications.gtt

Rev

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

Rev 48 Rev 68
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
-
 
16
		$ProjetCategorie = new ProjetCategorie();
-
 
17
 
-
 
18
		// Ajout de l'utilisateur vide par défaut
-
 
19
		$aso_admin_categ['ProjetCategorie'] = $ProjetCategorie;
-
 
20
		
16
		$ProjetCategorie = new ProjetCategorie();
21
		// Récupération des infos sur les categories existantes 
17
    	$tab_pc = $ProjetCategorie->consulter(ProjetCategorie::GPC_TOUS);
22
    	$tab_pc = $ProjetCategorie->consulter(ProjetCategorie::GPC_TOUS);
18
    	foreach ($tab_pc as $pc) {
23
    	foreach ($tab_pc as $pc) {
19
    		if ($pc->getIdCategorie() != 0) {
24
    		if ($pc->getIdCategorie() != 0) {
20
    			$aso_categ['id'] = $pc->getIdCategorie();
25
    			$aso_categ['id'] = $pc->getIdCategorie();
21
    			$aso_categ['libelle'] = $pc->getLibelle();
26
    			$aso_categ['libelle'] = $pc->getLibelle();
22
    			$aso_admin_categ['categories'][] = $aso_categ;
27
    			$aso_admin_categ['categories'][] = $aso_categ;
23
    		}
28
    		}
-
 
29
    	}
-
 
30
		// Modification des titres, légendes et bouton
-
 
31
		$aso_admin_categ['form_legend'] = 'Ajouter une categorie';
-
 
32
		$aso_admin_categ['form_bouton_value'] = 'Ajouter';
-
 
33
		$aso_admin_categ['form_bouton_id'] = 'btn_categorie_ajouter';
24
    	}
34
		$aso_admin_categ['form_url'] = 'index.php?action=admin-categorie_valider-ajouter';
25
 
35
		
26
    	//echo '<pre>'.print_r($aso_admin_categ, true).'</pre>';
36
    	//echo '<pre>'.print_r($aso_admin_categ, true).'</pre>';
27
		$this->getRegistre()->ajouterDonnee('admin_categorie', $aso_admin_categ);
37
		$this->getRegistre()->ajouterDonnee('admin_categorie', $aso_admin_categ);
Line -... Line 38...
-
 
38
    }
-
 
39
 
-
 
40
	public function executerEditer()
-
 
41
    {
-
 
42
		// Ajout du statut d'utilisateur
-
 
43
		if (isset($_POST['btn_categorie_modifier'])) {
-
 
44
			// Récupération des données de la categorie à modifier
-
 
45
			$ProjetCategorie = new ProjetCategorie();
-
 
46
			$ProjetCategorie->consulter(ProjetCategorie::GPC_ID, $_POST['casu_id'], true);
-
 
47
			$aso_admin_categ['ProjetCategorie'] = $ProjetCategorie;
-
 
48
 
-
 
49
			// Modification des titres, légendes et bouton
-
 
50
			$aso_admin_categ['form_legend'] = 'Modifier une categorie';
-
 
51
			$aso_admin_categ['form_bouton_value'] = 'Modifier';
-
 
52
			$aso_admin_categ['form_bouton_id'] = 'btn_categorie_modifier';
-
 
53
			$aso_admin_categ['form_url'] = 'index.php?action=admin-categorie_valider-modifier';
-
 
54
 
-
 
55
			$this->getRegistre()->ajouterDonnee('admin_categorie', $aso_admin_categ);
-
 
56
		} else if (isset($_POST['btn_utilisateur_supprimer'])) {
-
 
57
			// Action suivante
-
 
58
    		$this->setSuivant('supprimer');
-
 
59
		}
-
 
60
    }
-
 
61
 
-
 
62
	public function executerValiderModifier()
-
 
63
	{
-
 
64
		if (isset($_POST['btn_categorie_annuler'])) {
-
 
65
			// Action suivante
-
 
66
    		$this->setSuivant('__defaut__');
-
 
67
    	} else if (isset($_POST['btn_categorie_modifier'])) {
-
 
68
			$ProjetCategorie = new ProjetCategorie();
-
 
69
			$ProjetCategorie->setIdCategorie($_POST['caaj_id_categorie']);
-
 
70
			$ProjetCategorie->setLibelle($_POST['caaj_libelle']);
-
 
71
			$ProjetCategorie->setAbreviation($_POST['caaj_abreviation']);
-
 
72
	    	$ProjetCategorie->modifier();
-
 
73
		}
28
    }
74
	}
29
 
75
	
30
    public function executerValiderAjouter()
76
    public function executerValiderAjouter()
31
    {
77
    {
32
		// Ajout de la catégorie
78
		// Ajout de la catégorie
33
		$ProjetCategorie = new ProjetCategorie();
79
		$ProjetCategorie = new ProjetCategorie();
34
		$bool_existe = $ProjetCategorie->consulter(ProjetCategorie::GPC_LIBELLE, array($_POST['caaj_libelle']));
80
		$bool_existe = $ProjetCategorie->consulter(ProjetCategorie::GPC_LIBELLE, array($_POST['caaj_libelle']));
35
		if ($bool_existe == false) {
81
		if ($bool_existe == false) {
36
			$ProjetCategorieMax = $ProjetCategorie->consulter(ProjetCategorie::GPC_ID_MAX);
82
			$ProjetCategorieMax = $ProjetCategorie->consulter(ProjetCategorie::GPC_ID_MAX);
37
			$id_max = $ProjetCategorieMax->getIdCategorie();
83
			$id_max = $ProjetCategorieMax->getIdCategorie();
-
 
84
			$ProjetCategorie->setIdCategorie(++$id_max);
38
			$ProjetCategorie->setIdCategorie(++$id_max);
85
			$ProjetCategorie->setLibelle($_POST['caaj_libelle']);
39
			$ProjetCategorie->setLibelle($_POST['caaj_libelle']);
86
			$ProjetCategorie->setAbreviation($_POST['caaj_abreviation']);
40
    		$ProjetCategorie->ajouter();
87
    		$ProjetCategorie->ajouter();
41
		} else {
88
		} else {
42
			$aso_admin_categ['message'] = 'Cette catégorie existe déjà !';
89
			$aso_admin_categ['message'] = 'Cette catégorie existe déjà !';