Subversion Repositories Applications.gtt

Rev

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

Rev 95 Rev 103
Line 8... Line 8...
8
    }
8
    }
Line 9... Line 9...
9
 
9
 
10
    public function executer()
10
    public function executer()
11
    {
11
    {
12
    	$aso_preferences = array();
12
    	$aso_preferences = array();
13
    	$this->getRegistre()->setTitre('Modifier mes préférences');
13
    	$this->getRegistre()->setTitre('Modifier mes préférences');
14
    	$Projet = new Projet();
14
    	$Projet = new Projet();
Line 15... Line 15...
15
    	$tab_projets = $Projet->consulter(Projet::GP_TOUS);
15
    	$tab_projets = $Projet->consulter(Projet::GP_TOUS);
16
 
16
 
17
		if (false == $tab_projets) {
17
		if (false == $tab_projets) {
18
			$aso_preferences['messages'][] = "Veuillez commencer par ajouter des catégories de projet et des projets !";
18
			$aso_preferences['messages'][] = "Veuillez commencer par ajouter des catégories de projet et des projets !";
19
			$aso_preferences['preferences'] = false;
19
			$aso_preferences['preferences'] = false;
20
		} else {
20
		} else {
21
    		$aso_preferences['nbre_projets'] = count($tab_projets);
21
    		$aso_preferences['nbre_projets'] = count($tab_projets);
22
			// Parcourt du tableau de projets
22
			// Parcourt du tableau de projets
23
	    	foreach ($tab_projets as $Projet) {
23
	    	foreach ($tab_projets as $Projet) {
24
				// Vérification de la présence du projet dans les préférences de l'utilisateur
24
				// Vérification de la présence du projet dans les préférences de l'utilisateur
25
				$UtilisateurAProjet = new UtilisateurAProjet();
25
				$UtilisateurAProjet = new UtilisateurAProjet();
26
				$cmd = UtilisateurAProjet::GUAP_ID;
26
				$cmd = UtilisateurAProjet::GUAP_ID;
27
				$param = array($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur(), $Projet->getIdProjet());
27
				$param = array($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur(), $Projet->getIdProjet());
28
				$coche = false;
28
				$coche = false;
29
				if ($present = $UtilisateurAProjet->consulter($cmd, $param)) {
29
				if ($present = $UtilisateurAProjet->consulter($cmd, $param)) {
Line 30... Line 30...
30
					$coche = true;
30
					$coche = true;
31
				}
31
				}
32
	
32
	
Line 33... Line 33...
33
				// Récupération de la catégorie du projet
33
				// Récupération de la catégorie du projet
34
				$ProjetCategorie = new ProjetCategorie();
34
				$ProjetCategorie = new ProjetCategorie();
35
				$Categorie = current($ProjetCategorie->consulter(ProjetCategorie::GPC_ID, $Projet->getCeCategorie()));
35
				$Categorie = current($ProjetCategorie->consulter(ProjetCategorie::GPC_ID, $Projet->getCeCategorie()));
36
	
36
	
37
				// Récupération de toutes les infos
37
				// Récupération de toutes les infos
38
				$aso_preferences['preferences'][$Categorie->getLibelle()][] = array(
38
				$aso_preferences['preferences'][$Categorie->getLibelle()][] = array(
Line 48... Line 48...
48
		$this->getRegistre()->ajouterDonnee('preferences', $aso_preferences);
48
		$this->getRegistre()->ajouterDonnee('preferences', $aso_preferences);
49
    }
49
    }
Line 50... Line 50...
50
 
50
 
51
    public function executerValider()
51
    public function executerValider()
52
    {
52
    {
53
    	// Mise à jour des Préférences
53
    	// Mise à jour des Préférences
54
    	$UtilisateurAProjet = new UtilisateurAProjet();
54
    	$UtilisateurAProjet = new UtilisateurAProjet();
55
    	$UtilisateurAProjet->setIdUtilisateur($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur());
55
    	$UtilisateurAProjet->setIdUtilisateur($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur());
56
    	$UtilisateurAProjet->supprimer();
56
    	$UtilisateurAProjet->supprimer();
57
    	//echo '<pre>'.print_r($_POST, true).'</pre>';
57
    	//echo '<pre>'.print_r($_POST, true).'</pre>';