Subversion Repositories Applications.gtt

Rev

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

Rev 75 Rev 95
Line 18... Line 18...
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;
Line 20... Line 20...
20
		
20
		
21
		// Récupération des infos sur les categories existantes 
21
		// Récupération des infos sur les categories existantes 
-
 
22
    	$tab_pc = $ProjetCategorie->consulter(ProjetCategorie::GPC_TOUS);
-
 
23
    	if (false == $tab_pc) {
-
 
24
    		$aso_admin_categ['categories'] = false;
22
    	$tab_pc = $ProjetCategorie->consulter(ProjetCategorie::GPC_TOUS);
25
    	} else {
23
    	foreach ($tab_pc as $pc) {
26
	    	foreach ($tab_pc as $pc) {
24
    		if ($pc->getIdCategorie() != 0) {
27
	    		if ($pc->getIdCategorie() != 0) {
25
    			$aso_categ['id'] = $pc->getIdCategorie();
28
	    			$aso_categ['id'] = $pc->getIdCategorie();
26
    			$aso_categ['libelle'] = $pc->getLibelle();
29
	    			$aso_categ['libelle'] = $pc->getLibelle();
27
    			$aso_admin_categ['categories'][] = $aso_categ;
30
	    			$aso_admin_categ['categories'][] = $aso_categ;
-
 
31
	    		}
28
    		}
32
	    	}
29
    	}
33
    	}
30
		// Modification des titres, légendes et bouton
34
		// Modification des titres, légendes et bouton
31
		$aso_admin_categ['form_legend'] = 'Ajouter une categorie';
35
		$aso_admin_categ['form_legend'] = 'Ajouter une categorie';
32
		$aso_admin_categ['form_bouton_value'] = 'Ajouter';
36
		$aso_admin_categ['form_bouton_value'] = 'Ajouter';
Line 77... Line 81...
77
    {
81
    {
78
		// Ajout de la catégorie
82
		// Ajout de la catégorie
79
		$ProjetCategorie = new ProjetCategorie();
83
		$ProjetCategorie = new ProjetCategorie();
80
		$bool_existe = $ProjetCategorie->consulter(ProjetCategorie::GPC_LIBELLE, array($_POST['caaj_libelle']));
84
		$bool_existe = $ProjetCategorie->consulter(ProjetCategorie::GPC_LIBELLE, array($_POST['caaj_libelle']));
81
		if ($bool_existe == false) {
85
		if ($bool_existe == false) {
82
			$ProjetCategorieMax = $ProjetCategorie->consulter(ProjetCategorie::GPC_ID_MAX);
-
 
83
			$id_max = $ProjetCategorieMax->getIdCategorie();
-
 
84
			$ProjetCategorie->setIdCategorie(++$id_max);
-
 
85
			$ProjetCategorie->setLibelle($_POST['caaj_libelle']);
86
			$ProjetCategorie->setLibelle($_POST['caaj_libelle']);
86
			$ProjetCategorie->setAbreviation($_POST['caaj_abreviation']);
87
			$ProjetCategorie->setAbreviation($_POST['caaj_abreviation']);
87
    		$ProjetCategorie->ajouter();
88
    		$ProjetCategorie->ajouter();
88
		} else {
89
		} else {
89
			$aso_admin_categ['message'] = 'Cette catégorie existe déjà !';
90
			$aso_admin_categ['message'] = 'Cette catégorie existe déjà !';