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.11 2005-10-07 08:28:05 alexandre_tb Exp $
|
23 |
// CVS : $Id: projetControleur.class.php,v 1.12 2005-10-14 08:49:32 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.11 $
|
36 |
*@version $Revision: 1.12 $
|
37 |
// +------------------------------------------------------------------------------------------------------+
|
37 |
// +------------------------------------------------------------------------------------------------------+
|
38 |
*/
|
38 |
*/
|
Line 39... |
Line 39... |
39 |
|
39 |
|
40 |
// +------------------------------------------------------------------------------------------------------+
|
40 |
// +------------------------------------------------------------------------------------------------------+
|
Line 359... |
Line 359... |
359 |
* @return string
|
359 |
* @return string
|
360 |
* @access public
|
360 |
* @access public
|
361 |
*/
|
361 |
*/
|
362 |
function mesProjets( )
|
362 |
function mesProjets( )
|
363 |
{
|
363 |
{
|
- |
|
364 |
$res = '' ;
|
364 |
include_once PROJET_CHEMIN_CLASSES.'statut_liste.class.php' ;
|
365 |
include_once PROJET_CHEMIN_CLASSES.'statut_liste.class.php' ;
|
365 |
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
|
366 |
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
|
366 |
$participant = new participe ($this->_db) ;
|
367 |
$participant = new participe ($this->_db) ;
|
Line 367... |
Line 368... |
367 |
|
368 |
|
368 |
if (PROJET_UTILISE_TYPE && $this->_type != '') {
|
- |
|
369 |
|
369 |
if (PROJET_UTILISE_TYPE && $this->_type != '') {
|
370 |
$projetListe = projet::getProjetDuType($this->_type, $this->_db) ;
|
370 |
$projetListe = projet::getProjetDuType($this->_type, $this->_db) ;
|
371 |
if ($this->_presentation == 'arbre')array_push ($projetListe, projet::getProjetRacine($this->_db)) ;
|
371 |
if ($this->_presentation == 'arbre')array_push ($projetListe, projet::getProjetRacine($this->_db)) ;
|
372 |
} else {
|
372 |
} else {
|
373 |
// Un tableau de tous les projets dans $projetListe
|
373 |
// Un tableau de tous les projets dans $projetListe
|
374 |
$projetListe = projet::getTousLesProjets($this->_db) ;
|
374 |
$projetListe = projet::getTousLesProjets($this->_db) ;
|
375 |
}
|
375 |
}
|
376 |
// Si la liste est vide, on renvoie un texte
|
376 |
// Si la liste est vide, on renvoie un texte
|
- |
|
377 |
if (count($projetListe) == 0) {
|
- |
|
378 |
// On inclue un fichier local
|
- |
|
379 |
if (file_exists(PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php'))
|
377 |
if (count($projetListe) == 0) {
|
380 |
include_once PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php' ;
|
378 |
return PROJET_PAS_DE_LISTE;
|
381 |
return $res .= PROJET_PAS_DE_LISTE;
|
379 |
}
|
382 |
}
|
- |
|
383 |
// Si certain projet sont à exclure, on les exclu
|
380 |
// Si certain projet sont à exclure, on les exclu
|
384 |
$projet_a_exclure = array() ;
|
- |
|
385 |
if (count($this->_projet_exclu)) {
|
381 |
if (count($this->_projet_exclu)) {
|
386 |
arsort($this->_projet_exclu) ;
|
382 |
foreach ($this->_projet_exclu as $valeur) {
|
387 |
foreach ($this->_projet_exclu as $valeur) {
|
383 |
for ($i = 0; $i < count ($projetListe); $i++) {
|
388 |
for ($i = 0; $i < count($projetListe); $i++) {
|
384 |
if ($projetListe[$i]->getId() == $valeur) unset ($projetListe[$i]) ;
|
- |
|
385 |
}
|
389 |
if ($projetListe[$i]->getId() == $valeur) array_push ($projet_a_exclure, $i);}
|
386 |
}
|
390 |
}
|
- |
|
391 |
}
|
- |
|
392 |
foreach ($projet_a_exclure as $valeur) unset ($projetListe[$valeur]) ;
|
- |
|
393 |
|
387 |
}
|
394 |
// Les entêtes des tableaux
|
Line 388... |
Line 395... |
388 |
$tableau_label_statut_action = array (PROJET_GERER, PROJET_GERER, PROJET_GERER_FICHIER, PROJET_VOIR_FICHIER, "---") ;
|
395 |
$tableau_label_statut_action = array (PROJET_GERER, PROJET_GERER, PROJET_GERER_FICHIER, PROJET_VOIR_FICHIER, "---") ;
|
389 |
|
396 |
|
390 |
$auth = $this->_auth->getAuth() ; // Pour raccourcir le code
|
- |
|
Line -... |
Line 397... |
- |
|
397 |
$auth = $this->_auth->getAuth() ; // Pour raccourcir le code
|
- |
|
398 |
$id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ; // --------------
|
- |
|
399 |
|
- |
|
400 |
|
391 |
$id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ; // --------------
|
401 |
// Si la présentation est par arbre
|
392 |
$res = '' ;
|
- |
|
393 |
|
402 |
// TODO : Organiser différemment les présentations
|
394 |
if ($this->_presentation == 'arbre') {
|
403 |
// En utilisant des templates
|
395 |
|
404 |
if ($this->_presentation == 'arbre') {
|
396 |
$titre = '<h1>Arbre des Projets</h1>'."\n" ;
|
405 |
$titre = '<h1>Arbre des Projets</h1>'."\n" ;
|
397 |
include_once PROJET_CHEMIN_API_ARBRE.'arbre.class.php' ;
|
406 |
include_once PROJET_CHEMIN_API_ARBRE.'arbre.class.php' ;
|
Line 416... |
Line 425... |
416 |
$lien_feuille, $lien_feuille, $intensite_feuille, $longueur_branche) ;
|
425 |
$lien_feuille, $lien_feuille, $intensite_feuille, $longueur_branche) ;
|
417 |
}
|
426 |
}
|
418 |
}
|
427 |
}
|
419 |
return $titre.'<table>'.$cime.$arbre->affBranche().$arbre->affRacine().'</table>';
|
428 |
return $titre.'<table>'.$cime.$arbre->affBranche().$arbre->affRacine().'</table>';
|
420 |
}
|
429 |
}
|
- |
|
430 |
|
- |
|
431 |
// Présentation par liste
|
- |
|
432 |
|
421 |
$titre = '<h1>'.PROJET_LISTE.'</h1>'."\n" ;
|
433 |
$titre = '<h1>'.PROJET_LISTE.'</h1>'."\n" ;
|
- |
|
434 |
|
- |
|
435 |
// On inclue un fichier local
|
- |
|
436 |
if (file_exists(PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php'))
|
- |
|
437 |
include_once PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php' ;
|
422 |
// On vérifie si l'utilisateur participe à des projets
|
438 |
// On vérifie si l'utilisateur participe à des projets
|
423 |
if ($auth) {
|
439 |
if ($auth) {
|
424 |
$res .= '<p>'.PROJET_PARTICIPER.'</p>';
|
- |
|
- |
|
440 |
|
425 |
$utilisateur_liste = new inscription_liste($this->_db) ;
|
441 |
$utilisateur_liste = new inscription_liste($this->_db) ;
|
426 |
// On teste ici s'il y a une mise à jour de statut
|
442 |
// On teste ici s'il y a une mise à jour de statut
|
427 |
if (isset($_POST['statut'])) {
|
443 |
if (isset($_POST['statut'])) {
|
428 |
// $_POST['statut'] et $_GET['identifiant_projet'] proviennent du formulaire voir HTML_listeProjet
|
444 |
// $_POST['statut'] et $_GET['identifiant_projet'] proviennent du formulaire voir HTML_listeProjet
|
429 |
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
|
445 |
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
|
Line 461... |
Line 477... |
461 |
//if ($statut == '') $statut = 0 ;
|
477 |
//if ($statut == '') $statut = 0 ;
|
462 |
}
|
478 |
}
|
463 |
}
|
479 |
}
|
Line 464... |
Line 480... |
464 |
|
480 |
|
465 |
$this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
|
481 |
$this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
|
- |
|
482 |
$ligne_tableau = array ($projet->getId(), $projet->getResume(),
|
- |
|
483 |
'<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>'
|
466 |
$ligne_tableau = array ($projet->getId(), '<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>') ;
|
484 |
) ;
|
467 |
if ($auth) {
|
485 |
if ($auth) {
|
468 |
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET) ;
|
486 |
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET) ;
|
469 |
array_push ($ligne_tableau, '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.
|
487 |
array_push ($ligne_tableau, '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.
|
470 |
PROJET_SE_DESINSCRIRE_CONFIRMATION.'\');">'.PROJET_SE_DESINSCRIRE.'</a>') ;
|
488 |
PROJET_SE_DESINSCRIRE_CONFIRMATION.'\');">'.PROJET_SE_DESINSCRIRE.'</a>') ;
|
Line 479... |
Line 497... |
479 |
$statut = '' ;
|
497 |
$statut = '' ;
|
480 |
}
|
498 |
}
|
481 |
$HTML_projetListe->construitListe ($tableau_resultat, $tableau_statut) ;
|
499 |
$HTML_projetListe->construitListe ($tableau_resultat, $tableau_statut) ;
|
Line 482... |
Line 500... |
482 |
|
500 |
|
483 |
|
501 |
|
- |
|
502 |
if ($HTML_projetListe->getRowCount() > 1) {
|
- |
|
503 |
$res .= '<p>'.PROJET_PARTICIPER.'</p>';
|
484 |
$res .= $HTML_projetListe->toHTML() ;
|
504 |
$res .= $HTML_projetListe->toHTML() ;
|
485 |
$res .= '<p>'.PROJET_TOUS_LES_PROJETS.'</p>' ;
|
505 |
}
|
486 |
} else {
|
506 |
} else {
|
487 |
$res .= '<p>'.PROJET_INSCRIT_AUCUN_PROJET.'</p>' ;
|
507 |
$res .= '<p>'.PROJET_INSCRIT_AUCUN_PROJET.'</p>' ;
|
Line 496... |
Line 516... |
496 |
// Maintenant la liste des projets où l'utilisateur ne participe pas.
|
516 |
// Maintenant la liste des projets où l'utilisateur ne participe pas.
|
497 |
// Et si pas loggué tous les projets
|
517 |
// Et si pas loggué tous les projets
|
498 |
if ($auth) {
|
518 |
if ($auth) {
|
499 |
$projetNonParticipantListe = $participant -> getProjetsNonParticipant($id_u) ;
|
519 |
$projetNonParticipantListe = $participant -> getProjetsNonParticipant($id_u) ;
|
500 |
// Si certain projet sont à exclure, on les exclu
|
520 |
// Si certain projet sont à exclure, on les exclu
|
- |
|
521 |
// Si certain projet sont à exclure, on les exclu
|
- |
|
522 |
$projet_a_exclure = array() ;
|
501 |
if (count($this->_projet_exclu)) {
|
523 |
if (count($this->_projet_exclu)) {
|
- |
|
524 |
arsort($this->_projet_exclu) ;
|
502 |
foreach ($this->_projet_exclu as $valeur) {
|
525 |
foreach ($this->_projet_exclu as $valeur) {
|
503 |
for ($i = 0; $i < count ($projetNonParticipantListe); $i++) {
|
526 |
for ($i = 0; $i < count($projetNonParticipantListe); $i++) {
|
504 |
if ($projetNonParticipantListe[$i]->getId() == $valeur) unset ($projetNonParticipantListe[$i]) ;
|
527 |
if ($projetNonParticipantListe[$i]->getId() == $valeur) array_push ($projet_a_exclure, $i);}
|
505 |
}
|
- |
|
506 |
}
|
528 |
}
|
507 |
}
|
529 |
}
|
- |
|
530 |
foreach ($projet_a_exclure as $valeur) unset ($projetNonParticipantListe[$valeur]) ;
|
- |
|
531 |
|
- |
|
532 |
|
508 |
$HTML_projetNonParticipantListe = new HTML_listeProjet(true) ;
|
533 |
$HTML_projetNonParticipantListe = new HTML_listeProjet(true) ;
|
509 |
$entete_liste = array (PROJET_LISTE) ;
|
534 |
$entete_liste = array (PROJET_LISTE) ;
|
510 |
if ($auth) array_push ($entete_liste, PROJET_S_INSCRIRE) ;
|
535 |
array_push ($entete_liste, PROJET_S_INSCRIRE) ;
|
Line 511... |
Line 536... |
511 |
|
536 |
|
Line 512... |
Line 537... |
512 |
$HTML_projetNonParticipantListe->construitEntete($entete_liste) ;
|
537 |
$HTML_projetNonParticipantListe->construitEntete($entete_liste) ;
|
513 |
|
538 |
|
Line 514... |
Line 539... |
514 |
$liste_projet = array() ;
|
539 |
$liste_projet = array() ;
|
515 |
// La liste
|
540 |
// La liste
|
516 |
|
541 |
|
517 |
foreach ($projetNonParticipantListe as $projet) {
|
542 |
foreach ($projetNonParticipantListe as $projet) {
|
518 |
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
|
543 |
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
|
519 |
$ligne_projet = array (
|
544 |
$ligne_projet = array ($projet->getResume(),
|
520 |
'<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>' // le nom du projet
|
545 |
'<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>' // le nom du projet
|
Line 521... |
Line 546... |
521 |
) ;
|
546 |
) ;
|
522 |
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE) ;
|
547 |
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE) ;
|
523 |
if ($auth) array_push ($ligne_projet, '<a href="'.$this->_url->getURL().'">'.PROJET_S_INSCRIRE.'</a>') ;
|
548 |
array_push ($ligne_projet, '<a href="'.$this->_url->getURL().'">'.PROJET_S_INSCRIRE.'</a>') ;
|
524 |
|
549 |
|
Line 532... |
Line 557... |
532 |
*/
|
557 |
*/
|
533 |
array_push ($liste_projet, $ligne_projet) ;
|
558 |
array_push ($liste_projet, $ligne_projet) ;
|
534 |
}
|
559 |
}
|
535 |
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
|
560 |
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
|
536 |
$HTML_projetNonParticipantListe->construitListe($liste_projet) ;
|
561 |
$HTML_projetNonParticipantListe->construitListe($liste_projet) ;
|
537 |
$res .= $HTML_projetNonParticipantListe->toHTML() ;
|
562 |
if ($HTML_projetNonParticipantListe->getRowCount() > 1) $res .= $HTML_projetNonParticipantListe->toHTML() ;
|
538 |
} else {
|
563 |
} else {
|
539 |
$projetNonParticipantListe = & $projetListe ;
|
564 |
$projetNonParticipantListe = & $projetListe ;
|
540 |
$HTML_projetNonParticipantListe = new HTML_listeProjet(true) ;
|
565 |
$HTML_projetNonParticipantListe = new HTML_listeProjet(true) ;
|
541 |
$entete_liste = array (PROJET_LISTE) ;
|
566 |
$entete_liste = array (PROJET_LISTE) ;
|
542 |
$HTML_projetNonParticipantListe->construitEntete($entete_liste) ;
|
567 |
$HTML_projetNonParticipantListe->construitEntete($entete_liste) ;
|
Line 543... |
Line 568... |
543 |
|
568 |
|
544 |
$liste_projet = array() ;
|
569 |
$liste_projet = array() ;
|
545 |
// La liste
|
570 |
// La liste
|
546 |
foreach ($projetNonParticipantListe as $projet) {
|
571 |
foreach ($projetNonParticipantListe as $projet) {
|
547 |
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
|
572 |
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
|
548 |
$ligne_projet = array (
|
573 |
$ligne_projet = array ( $projet->getResume(),
|
549 |
'<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>' // le nom du projet
|
574 |
'<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>', // le nom du projet
|
Line 550... |
Line 575... |
550 |
) ;
|
575 |
) ;
|
551 |
|
576 |
|
552 |
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
|
577 |
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
|
553 |
array_push ($liste_projet, $ligne_projet) ;
|
578 |
array_push ($liste_projet, $ligne_projet) ;
|
554 |
}
|
579 |
}
|
- |
|
580 |
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
|
- |
|
581 |
$HTML_projetNonParticipantListe->construitListe($liste_projet) ;
|
555 |
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
|
582 |
if ($HTML_projetNonParticipantListe->getRowCount() > 1) {
|
556 |
$HTML_projetNonParticipantListe->construitListe($liste_projet) ;
|
583 |
$res .= '<p>'.PROJET_TOUS_LES_PROJETS.'</p>' ;
|
557 |
$res .= $HTML_projetNonParticipantListe->toHTML() ;
|
584 |
$res .= $HTML_projetNonParticipantListe->toHTML() ;
|
558 |
|
- |
|
559 |
}
|
- |
|
560 |
|
585 |
}
|
561 |
|
586 |
}
|
Line 562... |
Line 587... |
562 |
return $titre.$res ;
|
587 |
return $titre.$res ;
|
563 |
} // end of member function mesProjets
|
588 |
} // end of member function mesProjets
|
Line 725... |
Line 750... |
725 |
* @return string
|
750 |
* @return string
|
726 |
* @access public
|
751 |
* @access public
|
727 |
*/
|
752 |
*/
|
728 |
function formulaireProjet($action)
|
753 |
function formulaireProjet($action)
|
729 |
{
|
754 |
{
|
- |
|
755 |
if (!$this->_auth->getAuth()) {
|
- |
|
756 |
return PROJET_TEXTE_NON_IDENTIFIE;
|
- |
|
757 |
}
|
730 |
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action) ;
|
758 |
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action) ;
|
731 |
$formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post',str_replace ("&", "&", $this->_url->getURL())) ;
|
759 |
$formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post',str_replace ("&", "&", $this->_url->getURL())) ;
|
732 |
$tableau_type = '' ;
|
760 |
$tableau_type = '' ;
|
733 |
if (PROJET_UTILISE_TYPE) {
|
761 |
if (PROJET_UTILISE_TYPE) {
|
734 |
include_once PROJET_CHEMIN_CLASSES.'projet_type.class.php' ;
|
762 |
include_once PROJET_CHEMIN_CLASSES.'projet_type.class.php' ;
|
Line 766... |
Line 794... |
766 |
$projet = new projet ($this->_db) ;
|
794 |
$projet = new projet ($this->_db) ;
|
767 |
$projet->setCheminRepertoire (PROJET_CHEMIN_FICHIER) ;
|
795 |
$projet->setCheminRepertoire (PROJET_CHEMIN_FICHIER) ;
|
768 |
if (!$projet->enregistrerSQL($formulaire_projet->getSubmitValues())) {
|
796 |
if (!$projet->enregistrerSQL($formulaire_projet->getSubmitValues())) {
|
769 |
return 'erreur' ;
|
797 |
return 'erreur' ;
|
770 |
}
|
798 |
}
|
- |
|
799 |
// On inscrit le déposant du projet en tant que coordinateur
|
- |
|
800 |
if (PROJET_UTILISATEURS_COORD) {
|
- |
|
801 |
// Si le projet n'a pas de liste, on inscrit directement
|
- |
|
802 |
$participant = new participe($this->_db) ;
|
- |
|
803 |
$participant->setStatut(1, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $projet->getId()) ;
|
- |
|
804 |
}
|
771 |
} else {
|
805 |
} else {
|
772 |
return $formulaire_projet->toHTML() ;
|
806 |
return $formulaire_projet->toHTML() ;
|
773 |
}
|
807 |
}
|
774 |
} // end of member function nouveauProjetValidation
|
808 |
} // end of member function nouveauProjetValidation
|