Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 1304 → Rev 1303

/branches/livraison_menes/client/projet/classes/projetControleur.class.php
20,7 → 20,7
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
 
// CVS : $Id: projetControleur.class.php,v 1.29.2.3 2007-04-11 12:28:44 alexandre_tb Exp $
// CVS : $Id: projetControleur.class.php,v 1.29.2.2 2007-02-13 10:38:14 alexandre_tb Exp $
 
/**
* Application projet
33,7 → 33,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.29.2.3 $
*@version $Revision: 1.29.2.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
48,6 → 48,16
include_once 'client/projet/langues/pro_langue_'.PROJET_LANGUE_DEFAUT.'.inc.php' ;
}
 
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'HTML_listeProjet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'statut.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireListe.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'commande_serveur.class.php' ;
include_once PROJET_CHEMIN_CLASSES_LISTES.'ezmlm.php' ;
 
require_once GEN_CHEMIN_API.'html/HTML_TableFragmenteur.php' ;
// +------------------------------------------------------------------------------------------------------+
360,11 → 370,36
function mesProjets( )
{
$res = '' ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'statut_liste.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$participant = new participe ($this->_db) ;
 
// Les entêtes des tableaux
if (PROJET_UTILISE_TYPE && $this->_type != '') {
$projetListe = projet::getProjetDuType($this->_type, $this->_db) ;
if ($this->_presentation == 'arbre')array_push ($projetListe, projet::getProjetRacine($this->_db)) ;
} else {
// Un tableau de tous les projets dans $projetListe
$projetListe = projet::getTousLesProjets($this->_db) ;
}
// Si la liste est vide, on renvoie un texte
if (count($projetListe) == 0) {
// On inclue un fichier local
if (file_exists(PROJET_CHEMIN_APPLI.'langues/pro_langue_'.$GLOBALS['lang'].'.local.inc.php'))
include_once PROJET_CHEMIN_APPLI.'langues/pro_langue_'.$GLOBALS['lang'].'.local.inc.php' ;
return $res .= PROJET_PAS_DE_PROJET;
}
// Si certain projet sont à exclure, on les exclu
$projet_a_exclure = array() ;
if (count($this->_projet_exclu)) {
arsort($this->_projet_exclu) ;
foreach ($this->_projet_exclu as $valeur) {
for ($i = 0; $i < count($projetListe); $i++) {
if ($projetListe[$i]->getId() == $valeur) array_push ($projet_a_exclure, $i);}
}
}
foreach ($projet_a_exclure as $valeur) unset ($projetListe[$valeur]) ;
 
// Les entêtes des tableaux
$tableau_label_statut_action = array (PROJET_GERER, PROJET_GERER, PROJET_GERER_FICHIER, PROJET_VOIR_FICHIER, "---") ;
 
$auth = $this->_auth->getAuth() ; // Pour raccourcir le code
373,7 → 408,7
return include_once PROJET_CHEMIN_APPLI.'presentation/'.$this->_presentation.'.php' ;
}
} // end of member function mesProjets
 
/**
* Renvoie le menu général de l'application projet. Avec différents liens selon le
388,7 → 423,6
$auth = $this->_auth->getAuth() ;
if (!$auth) return ;
$res .= '<div class="menu_projet">'."\n";
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
if ($participant->isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID))) {
$isAdm = 1; $isCoord = 1 ; $isContri = 1 ;
432,7 → 466,6
}
if ($this->_id_projet != '') {
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
// Participant
if (!$isEnAttente) {
577,7 → 610,6
if (fileperms(PROJET_CHEMIN_FICHIER) & 0x0002) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
$formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post',str_replace ("&amp;", "&", $this->_url->getURL())) ;
$tableau_type = '' ;
if (PROJET_UTILISE_TYPE) {
584,10 → 616,8
include_once PROJET_CHEMIN_CLASSES.'projet_type.class.php' ;
$tableau_type = projet_type::getTousLesTypes($this->_db) ;
}
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db), $tableau_type) ;
if ($action == PROJET_MODIFIER_DESCRIPTION_V) {
$projet = new projet($this->_db, $this->_id_projet) ;
$valeurs_par_defaut = array ( 'projet_titre' => $projet->getTitre(),
'projet_description' => $projet->getDescription(),
618,11 → 648,10
function nouveauProjetValidation( )
{
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
$formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post', str_replace ('&amp;', '&', $this->_url->getURL())) ;
$formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db)) ;
if ($formulaire_projet->validate()) {
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
 
$projet = new projet ($this->_db) ;
$projet->setCheminRepertoire (PROJET_CHEMIN_FICHIER) ;
if (!$projet->enregistrerSQL($formulaire_projet->getSubmitValues())) {
631,7 → 660,6
// On inscrit le déposant du projet en tant que coordinateur
if (PROJET_UTILISATEURS_COORD) {
// Si le projet n'a pas de liste, on inscrit directement
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
$participant->setStatut(1, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $projet->getId()) ;
}
649,10 → 677,8
function modifierProjet( )
{
// création de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_MODIFIER_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
$formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post', str_replace ('&amp;', '&', $this->_url->getURL())) ;
$formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db)) ;
if ($formulaire_projet->validate()) {
661,7 → 687,7
return $formulaire_projet->toHTML() ;
}
unset ($projet) ;
}
} // end of member function nouveauFichierValidation
 
/**
* Renvoie le formulaire d'upload d'un fichier.
678,7 → 704,6
$action_future = $action == PROJET_NOUVEAU_FICHIER ? PROJET_NOUVEAU_FICHIER_V : PROJET_ACTION_MODIFIER_V ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $action_future) ;
if ($this->_id_repertoire != '') $this->_url->addQueryString (PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
$formulaire_document = new HTML_formulaireDocument('formulaire_document', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_document->construitFormulaire($action) ;
if ($action == PROJET_ACTION_MODIFIER) {
736,15 → 761,10
if ($this->_id_document == "") {
return $this->messageErreur(PROJETCONTROLEUR_PAS_DE_DOCUMENT_SELECTIONNE) ;
}
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$document = new document($this->_id_document, $this->_db, PROJET_CHEMIN_FICHIER) ;
$document->suppression() ;
$document->suppressionSQL() ;
// On verifie s il reste des documents associes au projet et si non on met
// a jour projet.p_avoir_document
if (count ($projet->getListesDocuments(PROJET_CHEMIN_FICHIER)) == 0) $projet->setAvoirDocument(false);
return ;
 
} // end of member function nouveauFichier
759,7 → 779,6
{
$res = '<h1>'.PROJET_REP_CREER.'</h1>'."\n" ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_REPERTOIRE_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
$formulaire_repertoire = new HTML_formulaireDocument('formulaire_repertoire', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_repertoire->setType ('repertoire') ;
$formulaire_repertoire->construitFormulaire() ;
766,7 → 785,7
$formulaire_repertoire->setDefaults (array ('document_visibilite'=> 'public')) ;
return $res.$formulaire_repertoire->toHTML() ;
 
}
} // end of member function nouveauFichier
 
/**
* Valide le formulaire et appelle la fonction d'insertion.
777,13 → 796,12
function nouveauFichierValidation( )
{
// création de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
if (isset($_SESSION['formulaire_document']) && $_SESSION['formulaire_document'] == 'valide') {
return include_once PROJET_CHEMIN_APPLI.'actions/documents.php' ;
include_once PROJET_CHEMIN_APPLI.'actions/documents.php' ;
return $retour;
}
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
$formulaire_document = new HTML_formulaireDocument('formulaire_document', 'post', preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_document->construitFormulaire() ;
if ($formulaire_document->validate()) {
805,9 → 823,6
 
 
$document->enregistrerSQL($formulaire_document->getSubmitValues(), $projet->getNomRepertoire().'/'.$chemin_upload) ;
// On place a 1 la colonne p_avoir_document
if (!$projet->avoirDocument()) $projet->setAvoirDocument(true);
// On ajoute une information de session
$_SESSION['formulaire_document'] = 'valide';
} else {
825,10 → 840,8
function modifierFichier( )
{
// création de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_MODIFIER_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
$formulaire_document = new HTML_formulaireDocument('formulaire_document', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_document->construitFormulaire(PROJET_ACTION_MODIFIER_V) ;
if ($formulaire_document->validate()) {
852,11 → 865,9
function nouveauRepertoireValidation( )
{
// création de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
$formulaire_repertoire = new HTML_formulaireDocument('formulaire_repertoire', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_repertoire->setType ('repertoire') ;
$formulaire_repertoire->construitFormulaire() ;
878,8 → 889,6
$document->suppressionSQL() ;
return $this->messageErreur(PROJETCONTROLEUR_ERREUR_CREATION_REPERTOIRE).'<br />'.PROJET_CHEMIN_FICHIER.$lien ;
}
// On place a 1 la colonne p_avoir_document
if (!$projet->avoirDocument()) $projet->setAvoirDocument(true);
} else {
return $formulaire_repertoire->toHTML() ;
}
909,7 → 918,6
{
$res = '' ;
// création de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
// récupération de la liste des documents associés
932,7 → 940,6
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_CREE_LE) ;
 
if ($this->_auth->getAuth()) {
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
$id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
$isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
986,7 → 993,6
$sortie_liste = '' ;
 
if ($projet->avoirListe()) {
include_once PROJET_CHEMIN_CLASSES_LISTES.'ezmlm.php' ;
foreach ($projet->_listes_associes as $info_liste) {
 
$liste = new ezmlm_php() ;
1123,7 → 1129,6
*/
function suppressionProjet( )
{
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$projet->setCheminRepertoire (PROJET_CHEMIN_FICHIER) ;
$projet->getListesAssociees() ;
1131,7 → 1136,7
$msg = $projet->suppressionSQL() ;
unset ($this->_id_projet) ; unset($_GET['id_projet']);
return $msg ;
}
} // end of member function suppressionProjet
 
/**
* Permet d'indiquer au controleur sur quel document on travaille.
1143,7 → 1148,7
function setIdDocument( $id_document )
{
$this->_id_document = $id_document ;
}
} // end of member function setIdDocument
 
 
/**
1162,11 → 1167,10
}
$res = '<h1>'.PROJET_ECRIRE_LISTE.'</h1>'."\n" ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.class.php' ;
$formulaire_mail = new HTML_formulaireMail('formulaire_mail', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_mail->construitFormulaire() ;
return $res.$formulaire_mail->toHTML() ;
}
} // end of member function envoyerUnMailFormulaire
 
/**
* Envoie le mail
1178,16 → 1182,15
{
// Vérifications
if (isset($_SESSION['formulaire_mail']) && $_SESSION['formulaire_mail'] == 'valide') {
return include_once PROJET_CHEMIN_APPLI.'actions/forums.php' ;
include_once PROJET_CHEMIN_APPLI.'actions/forums.php' ;
return $retour;
}
 
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL_V );
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.class.php' ;
$formulaire_mail = new HTML_formulaireMail('formulaire_mail', 'post', preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_mail->construitFormulaire() ;
if ($formulaire_mail->validate()) {
// création de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$info_liste = $projet->getListesAssociees() ;
$valeurs_mail = $formulaire_mail->getSubmitValues() ;
1225,7 → 1228,6
{
$res = '<h1>'.PROJET_CREATION_LISTE.'</h1>'."\n" ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_NOUVELLE_LISTE_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireListe.class.php' ;
$formulaire_liste = new HTML_formulaireListe('formulaire_liste', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_liste->construitFormulaire() ;
$formulaire_liste->setDefaults(array('domaine_liste' => PROJET_DOMAINE_LISTE)) ;
1243,7 → 1245,6
{
// Vérifications
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_NOUVELLE_LISTE_V );
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireListe.class.php' ;
$formulaire_liste = new HTML_formulaireListe('formulaire_liste', 'post', preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_liste->construitFormulaire() ;
if ($formulaire_liste->validate()) {
1257,7 → 1258,6
$liste->enregistrerSQL($formulaire_liste->getSubmitValues()) ;
 
// On la relie au projet
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$projet->ajouterListe($liste) ;
 
1290,10 → 1290,21
*/
function supprimerListe( )
{
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet($this->_db, $this->_id_projet) ;
$projet->getListesAssociees() ;
 
// ajouter un commande de suppression
 
$commande = new commande_serveur(PROJET_CHEMIN_APPLI.'script_cron/ezmlm.sh') ;
if (PEAR::isError($commande)) {
echo $commande->getMessage() ;
}
 
// Suppression des listes synchronisés
$commande_supression_3 = 'rm -rf '.PROJET_CHEMIN_LISTES.$projet->_listes_associes[0]->getDomaine().
'/'.$projet->_listes_associes[0]->getNom() ;
$commande->ajouterCommande($commande_supression_3) ;
 
$resultat_suppression = file_get_contents(PROJET_SERVEUR_VPOPMAIL.'/suppression_liste.php?domaine='.
$projet->_listes_associes[0]->getDomaine().'&liste='.$projet->_listes_associes[0]->getNom()) ;
$projet->supprimerListe($projet->_listes_associes[0]) ;
1335,11 → 1346,9
function voirParticipants( )
{
include_once PROJET_CHEMIN_CLASSES.'HTML_listeParticipants.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$titre = '<h1>'.$projet->getTitre().'</h1>'."\n" ;
$titre .= '<h2>'.PROJET_LISTE_PARTICIPANT.'</h2>'."\n" ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participants = new participe($this->_db) ;
 
// On teste ici s'il y a une mise à jour de statut
1416,12 → 1425,11
function inscriptionProjet( )
{
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireInscriptionProjet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
 
$projet = new projet ($this->_db, $this->_id_projet) ;
 
// Si le projet n'a pas de liste, on inscrit directement
if (isset ($this->_id_projet)) {
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
 
if (!$projet->avoirListe()) {
1486,7 → 1494,8
}
 
if ($this->_presentation != 'arbre') {
return include_once PROJET_CHEMIN_APPLI.'actions/resume.php' ;
include_once PROJET_CHEMIN_APPLI.'actions/resume.php' ;
return $retour ;
} else {
$this->_action = PROJET_ACTION_VOIR_RESUME;
}
1510,7 → 1519,6
*/
function inscriptionListe( )
{
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1530,7 → 1538,6
function desinscriptionListe( )
{
if (isset($_GET['inscription_liste']) || $this->_action = PROJET_ACTION_DESINSCRIPTION_LISTE) {
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1556,7 → 1563,6
 
// Le statut 4 désinscrit l'utilisateur, dans la méthode setStatut
$participant->setStatut(4, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$projet->getListesAssociees() ;
if ($projet->avoirListe()) {