Subversion Repositories Applications.projet

Compare Revisions

Ignore whitespace Rev 10 → Rev 11

/trunk/classes/projetControleur.class.php
19,7 → 19,9
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projetControleur.class.php,v 1.4 2005-09-27 15:52:26 ddelon Exp $
 
// CVS : $Id: projetControleur.class.php,v 1.5 2005-09-27 16:34:44 alexandre_tb Exp $
 
/**
* Application projet
*
31,7 → 33,9
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.4 $
*@version $Revision: 1.5 $
=======
*@version $Revision: 1.5 $
// +------------------------------------------------------------------------------------------------------+
*/
 
174,7 → 178,18
*/
var $_presentation;
 
/**
* Le type du projets, par défaut 0, signifie en pas de type particumier.
* Valeurs possibles: 0, 1, 2, 3 ...
* @access private
*/
var $_projet_exclu = array();
 
/**
* Le tableau des projets à ne pas affiché, ni dans l'arbre, ni dans les listes
* @access private
*/
/**
* Méthode principale de la classe. Elle permet d'appeler les méthodes du modules
* projet en fonction de l'action.
189,20 → 204,20
return $this->messageErreur(PROJETCONTROLEUR_ACTION_INVALIDE) ;
}
// Si il n'y a pas d'action mais un projet, on transmet par défaut l'action PROJET_VOIR
if ($this->_id_projet != "" && $this->_action == PROJET_DEFAUT) {
$this->_action = PROJET_ACTION_VOIR_RESUME ;
$this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
}
if ($this->_id_document != "") {
$this->_url->addQueryString (PROJET_VARIABLE_ID_DOCUMENT, $this->_id_document) ;
}
if ($this->_id_repertoire != '') {
$this->_url->addQueryString (PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ;
}
$retour = '' ;
if (!defined('PROJET_MENU_AFFICHER_CONTENU_CORPS')) $retour = $this->menuGeneral() ;
switch ($this->_action) {
case PROJET_DEFAUT :
$retour .= $this->mesProjets() ;
241,7 → 256,8
$retour .= $this->nouveauRepertoire() ;
break ;
case PROJET_NOUVEAU_REPERTOIRE_V :
$retour .= $this->nouveauRepertoireValidation().$this->accueilProjet() ;
$retour .= $this->nouveauRepertoireValidation() ;
$this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
break ;
case PROJET_SUPPRESSION_FICHIER :
$retour .=$this->suppressionFichier() ;
274,9 → 290,11
break ;
case PROJET_ACTION_CREER_WIKI : $retour .= $this->formulaireWiki() ;
break ;
case PROJET_ACTION_CREER_WIKI_V : $retour .= $this->creationWiki().$this->accueilProjet() ;
case PROJET_ACTION_CREER_WIKI_V : $retour .= $this->creationWiki() ;
$this->_action = PROJET_ACTION_VOIR_RESUME ;
break ;
case PROJET_ACTION_SUPPRIMER_WIKI : $retour .= $this->supprimerWiki().$this->accueilProjet() ;
case PROJET_ACTION_SUPPRIMER_WIKI : $retour .= $this->supprimerWiki();
$this->_action = PROJET_ACTION_VOIR_RESUME ;
break ;
case PROJET_ACTION_INSCRIPTION_LISTE : $retour .= $this->inscriptionListe() ;
$this->_action = PROJET_ACTION_VOIR_RESUME ;
286,7 → 304,8
break ;
case PROJET_ACTION_REFERENCER_LISTE : $retour .= $this->referencerListeExterne() ;
break ;
case PROJET_ACTION_REFERENCER_LISTE_V : $retour .= $this->referencerListeExterneValidation().$this->accueilProjet() ;
case PROJET_ACTION_REFERENCER_LISTE_V : $retour .= $this->referencerListeExterneValidation() ;
$this->_action = PROJET_ACTION_VOIR_RESUME ;
break ;
}
322,6 → 341,7
$this->_db = $dbObjet ;
$this->_auth = $authObjet ;
$this->_id_repertoire = 0 ;
$this->_type = '' ;
if (is_object ($urlObjet)) {
$this->_url = $urlObjet ;
}
339,9 → 359,22
include_once PROJET_CHEMIN_CLASSES.'statut_liste.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$participant = new participe ($this->_db) ;
// Un tableau de tous les projets dans $projetListe
$projetListe = projet::getTousLesProjets($this->_db) ;
if (PROJET_UTILISE_TYPE && $this->_type != '') {
$projetListe = projet::getProjetDuType($this->_type, $this->_db) ;
array_push ($projetListe, projet::getProjetRacine($this->_db)) ;
} else {
// Un tableau de tous les projets dans $projetListe
$projetListe = projet::getTousLesProjets($this->_db) ;
}
// Si certain projet sont à exclure, on les exclu
if (count($this->_projet_exclu)) {
foreach ($this->_projet_exclu as $valeur) {
for ($i = 0; $i < count ($projetListe); $i++) {
if ($projetListe[$i]->getId() == $valeur) unset ($projetListe[$i]) ;
}
}
}
$tableau_label_statut_action = array (PROJET_GERER, PROJET_GERER, PROJET_GERER_FICHIER, PROJET_VOIR_FICHIER, "---") ;
$auth = $this->_auth->getAuth() ; // Pour raccourcir le code
357,8 → 390,6
$arbre = new arbre() ;
// recherche du projet principal
$cime='';
foreach ($projetListe as $projet) {
$this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
369,7 → 400,8
$cime = $arbre->cime($projet->getTitre(), $this->_url->getURL(), $projet->getNombreInscrits(), $lien_feuille, '') ;
} else {
$arbre->addBranche($projet->getTitre(), $this->_url->getURL(), $projet->getNombreInscrits(), $lien_feuille, $lien_feuille, $intensite_feuille, $longueur_branche) ;
$arbre->addBranche($projet->getTitre(), $this->_url->getURL(), $projet->getNombreInscrits(),
$lien_feuille, $lien_feuille, $intensite_feuille, $longueur_branche) ;
}
}
return $titre.'<table>'.$cime.$arbre->affBranche().$arbre->affRacine().'</table>';
413,13 → 445,13
if ($auth) {
if ($projet->avoirListe()) {
$projet->getListesAssociees() ;
$statut = $utilisateur_liste->getStatutInscrit($projet->_listes_associes[0]->getId(), $id_u) ;
if ($statut == '') $statut = 0 ;
$statut = $utilisateur_liste->getStatutInscrit($projet->_listes_associes[0]->getId(), $this->_auth) ;
//if ($statut == '') $statut = 0 ;
}
}
$this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
$ligne_tableau = array ($projet->getId(), $statut, '<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>') ;
$ligne_tableau = array ($projet->getId(), '<a href="'.PROJET_CHEMIN_ATELIERS.$projet->getId().'">'.$projet->getTitre().'</a>') ;
if ($auth) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET) ;
array_push ($ligne_tableau, '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.
427,7 → 459,7
if ($projet->avoirListe()) {
array_push ($ligne_tableau, $statut) ;
} else {
array_push($ligne_tableau, PROJET_PAS_DE_LISTE) ;
array_push($ligne_tableau, '') ;
}
array_push ($tableau_resultat, $ligne_tableau) ;
$this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
465,7 → 497,7
foreach ($projetNonParticipantListe as $projet) {
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
$ligne_projet = array (
'<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>' // le nom du projet
'<a href="'.PROJET_CHEMIN_ATELIERS.$projet->getId().'">'.$projet->getTitre().'</a>' // le nom du projet
) ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE) ;
if ($auth) array_push ($ligne_projet, '<a href="'.$this->_url->getURL().'">'.PROJET_S_INSCRIRE.'</a>') ;
634,7 → 666,7
foreach ($projet->_listes_associes as $info_liste) {
$inscription_liste = new inscription_liste($this->_db) ;
if ($inscription_liste->getStatutInscrit($info_liste->getId(), $this->_auth->getAuthData(PROJET_CHAMPS_ID)) == 0) {
if ($inscription_liste->getStatutInscrit($info_liste->getId(), $this->_auth) == 0) {
$action_inscription = PROJET_ACTION_INSCRIPTION_LISTE ;
$label_inscription = PROJET_RECEVOIR_MESSAGES ;
} else {
672,7 → 704,12
{
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action) ;
$formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post',str_replace ("&amp;", "&", $this->_url->getURL())) ;
$formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db)) ;
$tableau_type = '' ;
if (PROJET_UTILISE_TYPE) {
include_once PROJET_CHEMIN_CLASSES.'projet_type.class.php' ;
$tableau_type = projet_type::getTousLesTypes($this->_db) ;
}
$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(),
680,7 → 717,8
'projet_asso' => $projet->getIdPere(),
'projet_wikini' => $projet->getWikini(),
'projet_resume' => $projet->getResume(),
'projet_espace_internet' => $projet->getEspaceInternet()
'projet_espace_internet' => $projet->getEspaceInternet(),
'projet_type'=> $projet->getType()
) ;
$formulaire_projet->setDefaults($valeurs_par_defaut) ;
}
699,6 → 737,7
$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()) {
$projet = new projet ($this->_db) ;
$projet->setCheminRepertoire (PROJET_CHEMIN_FICHIER) ;
if (!$projet->enregistrerSQL($formulaire_projet->getSubmitValues())) {
1060,7 → 1099,7
if ($this->_auth->getAuth()) {
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php';
$inscription_liste = new inscription_liste($this->_db) ;
if ($inscription_liste->getStatutInscrit( $info_liste->getId(), $this->_auth->getAuthData(PROJET_CHAMPS_ID)) == '') {
if ($inscription_liste->getStatutInscrit( $info_liste->getId(), $this->_auth) == '') {
$action_inscription = PROJET_ACTION_INSCRIPTION_LISTE ;
$label_inscription = PROJET_S_INSCRIRE ;
} else {
1353,7 → 1392,19
$this->_presentation = $presentation ;
} // end of member function setPresentation
 
/**
*
*
* @param string type Pour affecter un type au projet
* @return void
* @access public
*/
function setType( $type)
{
$this->_type = $type ;
} // end of member function setPresentation
 
 
/**
* Fonction affichant les particpants à un projet
*
1656,8 → 1707,19
$liste_externe->enregistrerSQL($HTML_formulaireListeExterne->getSubmitValues(), $this->_id_projet) ;
} // end of member function referencerListeExterneValidation
 
/**
* permet d'exclure un projet de l'affichage
*
* @return void
* @access public
*/
function exclure($id_projet)
{
array_push ($this->_projet_exclu, $id_projet) ;
} // end of member function exclure
 
 
 
/**
* Renvoie un message d'erreur, en fonction du code de l'erreur.
*