Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 1303 → Rev 1304

/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.2 2007-02-13 10:38:14 alexandre_tb Exp $
// CVS : $Id: projetControleur.class.php,v 1.29.2.3 2007-04-11 12:28:44 alexandre_tb Exp $
 
/**
* Application projet
33,7 → 33,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.29.2.2 $
*@version $Revision: 1.29.2.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
48,16 → 48,6
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' ;
// +------------------------------------------------------------------------------------------------------+
370,36 → 360,11
function mesProjets( )
{
$res = '' ;
include_once PROJET_CHEMIN_CLASSES.'statut_liste.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$participant = new participe ($this->_db) ;
 
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
// 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
408,7 → 373,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
423,6 → 388,7
$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 ;
466,6 → 432,7
}
if ($this->_id_projet != '') {
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
// Participant
if (!$isEnAttente) {
610,6 → 577,7
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) {
616,8 → 584,10
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(),
648,10 → 618,11
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())) {
660,6 → 631,7
// 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()) ;
}
677,8 → 649,10
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()) {
687,7 → 661,7
return $formulaire_projet->toHTML() ;
}
unset ($projet) ;
} // end of member function nouveauFichierValidation
}
 
/**
* Renvoie le formulaire d'upload d'un fichier.
704,6 → 678,7
$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) {
761,10 → 736,15
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
779,6 → 759,7
{
$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() ;
785,7 → 766,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.
796,12 → 777,13
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') {
include_once PROJET_CHEMIN_APPLI.'actions/documents.php' ;
return $retour;
return include_once PROJET_CHEMIN_APPLI.'actions/documents.php' ;
}
$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()) {
823,6 → 805,9
 
 
$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 {
840,8 → 825,10
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()) {
865,9 → 852,11
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() ;
889,6 → 878,8
$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() ;
}
918,6 → 909,7
{
$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
940,6 → 932,7
$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) ;
993,6 → 986,7
$sortie_liste = '' ;
 
if ($projet->avoirListe()) {
include_once PROJET_CHEMIN_CLASSES_LISTES.'ezmlm.php' ;
foreach ($projet->_listes_associes as $info_liste) {
 
$liste = new ezmlm_php() ;
1129,6 → 1123,7
*/
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() ;
1136,7 → 1131,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.
1148,7 → 1143,7
function setIdDocument( $id_document )
{
$this->_id_document = $id_document ;
} // end of member function setIdDocument
}
 
 
/**
1167,10 → 1162,11
}
$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
1182,15 → 1178,16
{
// Vérifications
if (isset($_SESSION['formulaire_mail']) && $_SESSION['formulaire_mail'] == 'valide') {
include_once PROJET_CHEMIN_APPLI.'actions/forums.php' ;
return $retour;
return include_once PROJET_CHEMIN_APPLI.'actions/forums.php' ;
}
 
$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() ;
1228,6 → 1225,7
{
$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)) ;
1245,6 → 1243,7
{
// 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()) {
1258,6 → 1257,7
$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,21 → 1290,10
*/
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]) ;
1346,9 → 1335,11
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
1425,11 → 1416,12
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()) {
1494,8 → 1486,7
}
 
if ($this->_presentation != 'arbre') {
include_once PROJET_CHEMIN_APPLI.'actions/resume.php' ;
return $retour ;
return include_once PROJET_CHEMIN_APPLI.'actions/resume.php' ;
} else {
$this->_action = PROJET_ACTION_VOIR_RESUME;
}
1519,6 → 1510,7
*/
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' ;
1538,6 → 1530,7
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' ;
1563,6 → 1556,7
 
// 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()) {