Subversion Repositories Applications.projet

Rev

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

Rev 98 Rev 122
Line 18... Line 18...
18
// | You should have received a copy of the GNU General Public                                            |
18
// | You should have received a copy of the GNU General Public                                            |
19
// | License along with this library; if not, write to the Free Software                                  |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
Line 22... Line 22...
22
 
22
 
Line 23... Line 23...
23
// CVS : $Id: projetControleur.class.php,v 1.27 2006-01-23 17:20:43 alexandre_tb Exp $
23
// CVS : $Id: projetControleur.class.php,v 1.28 2006-07-04 09:29:49 alexandre_tb Exp $
24
 
24
 
25
/**
25
/**
26
* Application projet
26
* Application projet
Line 31... Line 31...
31
//Auteur original :
31
//Auteur original :
32
*@author        Alexandre Granier <alexandre@tela-botanica.org>
32
*@author        Alexandre Granier <alexandre@tela-botanica.org>
33
//Autres auteurs :
33
//Autres auteurs :
34
*@author        Aucun
34
*@author        Aucun
35
*@copyright     Tela-Botanica 2000-2004
35
*@copyright     Tela-Botanica 2000-2004
36
*@version       $Revision: 1.27 $
36
*@version       $Revision: 1.28 $
37
// +------------------------------------------------------------------------------------------------------+
37
// +------------------------------------------------------------------------------------------------------+
38
*/
38
*/
Line 39... Line 39...
39
 
39
 
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
Line 117... Line 117...
117
define ('PROJET_DROIT_ADMINISTRATEUR', 1) ;
117
define ('PROJET_DROIT_ADMINISTRATEUR', 1) ;
118
define ('PROJET_DROIT_COORDINATEUR', 2) ;
118
define ('PROJET_DROIT_COORDINATEUR', 2) ;
119
define ('PROJET_DROIT_PROPRIETAIRE', 4) ;
119
define ('PROJET_DROIT_PROPRIETAIRE', 4) ;
120
define ('PROJET_DROIT_CONTRIBUTEUR', 8) ;
120
define ('PROJET_DROIT_CONTRIBUTEUR', 8) ;
121
define ('PROJET_DROIT_AUCUN', 16) ;
121
define ('PROJET_DROIT_AUCUN', 16) ;
-
 
122
define ('PROJET_DROIT_EN_ATTENTE', 32);
122
/**
123
/**
123
 * class projetControleur
124
 * class projetControleur
124
 * Cette classe sert à lancer les diverses applications du module projet, en
125
 * Cette classe sert à lancer les diverses applications du module projet, en
125
 * fonction des paramêtre de l'URL GET ou POST. La méthode principale est run()
126
 * fonction des paramêtre de l'URL GET ou POST. La méthode principale est run()
126
 */
127
 */
Line 445... Line 446...
445
                    $label_statut = PROJET_VOUS_PARTICIPEZ ;
446
                    $label_statut = PROJET_VOUS_PARTICIPEZ ;
446
                } else {
447
                } else {
447
                    $label_statut = PROJET_VOUS_N_ETES_PAS_INSCRIT ;
448
                    $label_statut = PROJET_VOUS_N_ETES_PAS_INSCRIT ;
448
                }
449
                }
449
            }
450
            }
-
 
451
            if ($participant->isEnAttente($this->_auth->getAuthData(PROJET_CHAMPS_ID),$this->_id_projet,$this->_db)) {
-
 
452
            	$isEnAttente = true ;
-
 
453
            	$label_statut = PROJET_EN_ATTENTE ;
-
 
454
            } else {
-
 
455
            	$isEnAttente = false ;
-
 
456
            }
450
        }
457
        }
Line 451... Line 458...
451
 
458
 
452
        if ($isContri || $isAdm) {
459
        if ($isContri || $isAdm) {
453
            $res .= '<h2>' ;
460
            $res .= '<h2>' ;
Line 459... Line 466...
459
        }
466
        }
Line 460... Line 467...
460
        
467
        
461
        if ($this->_id_projet != '') {
468
        if ($this->_id_projet != '') {
462
        	$projet = new projet ($this->_db, $this->_id_projet) ;
469
        	$projet = new projet ($this->_db, $this->_id_projet) ;
-
 
470
			// Participant
463
			// Participant
471
			if (!$isEnAttente) {
464
			$res .= '<ul id ="projet_groupe_niv1"><li class="projet_niv1">'.PROJET_CONTRIBUTEUR ;
472
				$res .= '<ul id ="projet_groupe_niv1"><li class="projet_niv1">'.PROJET_CONTRIBUTEUR ;
-
 
473
				$res .= '<ul id="projet_groupe_niv2_con">' ;
465
			$res .= '<ul id="projet_groupe_niv2_con">' ;		
474
			}		
466
	        if ($isCoord || $isContri) {
475
	        if ($isCoord || $isContri) {
467
	        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET) ;
476
	        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET) ;
468
	        	$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_SE_DESINSCRIRE."</a></li>\n" ;
477
	        	$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_SE_DESINSCRIRE."</a></li>\n" ;
469
	        } else {
478
	        } else {
-
 
479
	        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE) ;
470
	        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE) ;
480
	        	if (!$isEnAttente) $res .= '<li class="projet_niv2"><a href="'.
471
	        	$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_S_INSCRIRE_AU_PROJET."</a></li>\n" ;
481
	        						$this->_url->getURL().'">'.PROJET_S_INSCRIRE_AU_PROJET."</a></li>\n" ;
472
	        }
482
	        }
473
	        // L'action gérer les utilisateurs
483
	        // L'action gérer les utilisateurs
474
	        if ($isCoord || $isAdm) {
484
	        if ($isCoord || $isAdm) {
475
	            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
485
	            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
Line 611... Line 621...
611
                                            'projet_description' => $projet->getDescription(),
621
                                            'projet_description' => $projet->getDescription(),
612
                                            'projet_asso' => $projet->getIdPere(),
622
                                            'projet_asso' => $projet->getIdPere(),
613
                                            'projet_wikini' => $projet->getWikini(),
623
                                            'projet_wikini' => $projet->getWikini(),
614
                                            'projet_resume' => $projet->getResume(),
624
                                            'projet_resume' => $projet->getResume(),
615
                                            'projet_espace_internet' => $projet->getEspaceInternet(),
625
                                            'projet_espace_internet' => $projet->getEspaceInternet(),
616
                                            'projet_type'=> $projet->getType()
626
                                            'projet_type'=> $projet->getType(),
-
 
627
                                            'projet_moderation' => $projet->isModere()
617
                                        ) ;
628
                                        ) ;
618
            $formulaire_projet->setDefaults($valeurs_par_defaut) ;
629
            $formulaire_projet->setDefaults($valeurs_par_defaut) ;
-
 
630
        } else {
-
 
631
        	$formulaire_projet->setDefaults (array ('projet_moderation'=> '0')) ;	
619
        }
632
        }
620
        $res = PROJET_PROPOSER_PROJET ;
633
        $res = PROJET_PROPOSER_PROJET ;
621
        return $res . $formulaire_projet->toHTML() ;
634
        return $res . $formulaire_projet->toHTML() ;
622
    } // end of member function nouveauProjet
635
    } // end of member function nouveauProjet
Line 1165... Line 1178...
1165
        // Vérifications
1178
        // Vérifications
1166
        if (isset($_SESSION['formulaire_mail']) && $_SESSION['formulaire_mail'] == 'valide') {
1179
        if (isset($_SESSION['formulaire_mail']) && $_SESSION['formulaire_mail'] == 'valide') {
1167
            include_once PROJET_CHEMIN_APPLI.'actions/forums.php' ;
1180
            include_once PROJET_CHEMIN_APPLI.'actions/forums.php' ;
1168
            return $retour;
1181
            return $retour;
1169
        }
1182
        }
-
 
1183
        
1170
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL_V );
1184
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL_V );
1171
        $formulaire_mail = new HTML_formulaireMail('formulaire_mail', 'post', preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
1185
        $formulaire_mail = new HTML_formulaireMail('formulaire_mail', 'post', preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
1172
        $formulaire_mail->construitFormulaire() ;
1186
        $formulaire_mail->construitFormulaire() ;
1173
        if ($formulaire_mail->validate()) {
1187
        if ($formulaire_mail->validate()) {
1174
            // création de l'objet projet courant
1188
            // création de l'objet projet courant
Line 1412... Line 1426...
1412
        // Si le projet n'a pas de liste, on inscrit directement
1426
        // Si le projet n'a pas de liste, on inscrit directement
1413
        if (isset ($this->_id_projet)) {
1427
        if (isset ($this->_id_projet)) {
1414
            $participant = new participe($this->_db) ;
1428
            $participant = new participe($this->_db) ;
Line 1415... Line 1429...
1415
 
1429
 
-
 
1430
            if (!$projet->avoirListe()) {
1416
            if (!$projet->avoirListe()) {
1431
            	if ($projet->isModere()) {
-
 
1432
                	$participant->setStatut(3, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
-
 
1433
            	} else {
-
 
1434
            		$participant->setStatut(2, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1417
                $participant->setStatut(2, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1435
            	}
1418
                return $this->mesProjets() ;
1436
                return $this->mesProjets() ;
1419
            }
1437
            }
1420
        }
1438
        }
1421
        if (isset($_POST['valider_inscription_projet'])) {
1439
        if (isset($_POST['valider_inscription_projet'])) {
-
 
1440
            if (isset($_POST['radio_inscription_liste'])) {
1422
            if (isset($_POST['radio_inscription_liste'])) {
1441
            	include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
1423
                $participant->setStatut(2, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1442
            	$utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 
-
 
1443
								'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE,
1424
                include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
1444
								'nom'=> PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
-
 
1445
	            $utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
1425
                include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1446
            
1426
                $projet->getListesAssociees() ;
1447
            	if (!$projet->isModere()) {
-
 
1448
	                $participant->setStatut(2, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1427
                $utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
1449
	                
-
 
1450
	                include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1428
                $utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
1451
	                $projet->getListesAssociees() ;
1429
                $inscription_liste = new inscription_liste($this->_db) ;
1452
	                $inscription_liste = new inscription_liste($this->_db) ;
1430
                $inscription_liste->inscrireUtilisateur( $utilisateur,
1453
	                $inscription_liste->inscrireUtilisateur( $utilisateur,
1431
                                                        $projet->_listes_associes[0],
1454
                                                        $projet->_listes_associes[0],
-
 
1455
                                                        $_POST['radio_inscription_liste']) ;
-
 
1456
            	} else {
-
 
1457
            		$participant->setStatut(3, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
-
 
1458
            		$tableau_coordinateur = $participant->getCoordinateurs($this->_id_projet) ;
-
 
1459
            		#include_once PROJET_CHEMIN_API.'pear/Mail.php';
-
 
1460
            		$entetes['From'] = $this->_auth->getUserName();
-
 
1461
		            $entetes['To'] = '';
-
 
1462
		            $entetes['Subject'] = PROJET_DEMANDE_INSCRIPTION ;
-
 
1463
		            $entetes['Date'] = date ('D, M j G:i:s \C\E\S\T Y') ;
-
 
1464
		            $entetes['Message-ID'] = md5(time()) ;
-
 
1465
		            $entetes['reply-to'] = '' ;
-
 
1466
		            $entetes['Content-Type'] = 'text/plain' ;
-
 
1467
		            
-
 
1468
		            $objet_mail =& Mail::factory('smtp');
-
 
1469
		            require_once PROJET_CHEMIN_BIBLIOTHEQUE_API.'pear/HTML/Template/IT.php';
-
 
1470
				    $tpl = new HTML_Template_IT() ;
-
 
1471
				    // Le gabarit du mail est dans un template
-
 
1472
				    // template 1
-
 
1473
				    $requete = 'select pt_template from projet_template where pt_id_template=1'.
-
 
1474
				    			' and pt_i18n like "%'.PROJET_LANGUE_DEFAUT.'"' ;
-
 
1475
				    
-
 
1476
				    if (!$tpl -> setTemplate($this->_db->getOne ($requete))) {
-
 
1477
				    	echo 'erreur' ;	
-
 
1478
				    }
-
 
1479
					$tpl->setVariable('nom', $utilisateur->getInfo( 'nom')) ;
-
 
1480
					$tpl->setVariable('prenom', $utilisateur->getInfo( 'prenom')) ;
-
 
1481
					$tpl->setVariable('nom_projet', $projet->getTitre()) ;
-
 
1482
					$tpl->setVariable('lien', str_replace ('&amp;', '&', $this->_url->getURL())) ;
-
 
1483
				
-
 
1484
            		foreach ($tableau_coordinateur as $coordinateur) {
-
 
1485
            			$entetes['To'] .= $coordinateur[3];	// Le champs 3 est le mail
-
 
1486
            		}
-
 
1487
            		$objet_mail->send($entetes['To'], $entetes, $tpl->get());
1432
                                                        $_POST['radio_inscription_liste']) ;
1488
            	}
Line 1433... Line 1489...
1433
            }
1489
            }
-
 
1490
 
1434
 
1491
            if ($this->_presentation != 'arbre') {
1435
            if ($this->_presentation != 'arbre') {
1492
                include_once PROJET_CHEMIN_APPLI.'actions/resume.php' ;
1436
                return $this->mesProjets() ;
1493
                return $retour ;
1437
            } else {
1494
            } else {
1438
                $this->_action = PROJET_ACTION_VOIR_RESUME;
1495
                $this->_action = PROJET_ACTION_VOIR_RESUME;
1439
            }
1496
            }
Line 1510... Line 1567...
1510
            include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1567
            include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1511
            $desinscription= new inscription_liste($this->_db) ;
1568
            $desinscription= new inscription_liste($this->_db) ;
1512
            $desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
1569
            $desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
1513
        }
1570
        }
1514
        if ($this->_presentation != 'arbre') {
1571
        if ($this->_presentation != 'arbre') {
-
 
1572
            include_once PROJET_CHEMIN_APPLI.'actions/resume.php' ;
1515
            return $this->mesProjets() ;
1573
            return $retour ;
1516
        } else {
1574
        } else {
1517
            $this->_action = PROJET_ACTION_VOIR_RESUME;
1575
            $this->_action = PROJET_ACTION_VOIR_RESUME;
1518
        }
1576
        }
1519
    } // end of member function inscriptionProjet
1577
    } // end of member function inscriptionProjet