Subversion Repositories Applications.projet

Rev

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

Rev 121 Rev 208
Line 17... Line 17...
17
// |                                                                                                      |
17
// |                                                                                                      |
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
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: projet.class.php,v 1.7 2006-07-04 09:28:53 alexandre_tb Exp $
22
// CVS : $Id: projet.class.php,v 1.8 2007-04-19 15:34:35 neiluj Exp $
23
/**
23
/**
24
* Application projet
24
* Application projet
25
*
25
*
26
* La classe projet
26
* La classe projet
27
*
27
*
Line 29... Line 29...
29
//Auteur original :
29
//Auteur original :
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
//Autres auteurs :
31
//Autres auteurs :
32
*@author        Aucun
32
*@author        Aucun
33
*@copyright     Tela-Botanica 2000-2004
33
*@copyright     Tela-Botanica 2000-2004
34
*@version       $Revision: 1.7 $
34
*@version       $Revision: 1.8 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
Line 37... Line 37...
37
 
37
 
Line 143... Line 143...
143
     * @access private
143
     * @access private
144
     */
144
     */
145
    var $_type;
145
    var $_type;
Line 146... Line 146...
146
 
146
 
147
	/**
147
	/**
148
     * Indique si l'inscription au projet est modérés
148
     * Indique si l'inscription au projet est moderes
149
     * @access private
149
     * @access private
150
     */
150
     */
151
    var $_isModere;
151
    var $_isModere;
-
 
152
 
-
 
153
	/**
-
 
154
     * Indique si le projet a des documents
-
 
155
     * @access private
-
 
156
     */
-
 
157
    var $_avoirDocument;
152
    
158
       
153
    /**
159
    /**
154
     *
160
     *
155
     * PHP5
161
     * PHP5
156
     * @return projet
162
     * @return projet
Line 192... Line 198...
192
            $this->_resume = $ligne->p_resume;
198
            $this->_resume = $ligne->p_resume;
193
            $this->_type = $ligne->p_type ;
199
            $this->_type = $ligne->p_type ;
194
            // On récupère le nom du répertoire
200
            // On récupère le nom du répertoire
195
            $this->_nom_repertoire = $ligne->p_nom_repertoire ;
201
            $this->_nom_repertoire = $ligne->p_nom_repertoire ;
196
            $this->_isModere = $ligne->p_modere;
202
            $this->_isModere = $ligne->p_modere;
197
 
-
 
-
 
203
			$this->_avoirDocument = $ligne->p_avoir_document;
198
            // on regarde si on a à faire au projet racine
204
            // on regarde si on a à faire au projet racine
199
            if (PROJET_UTILISE_HIERARCHIE) {
205
            if (PROJET_UTILISE_HIERARCHIE) {
200
	            $requete = 'select  ph_id_projet_pere, ph_id_projet_fils from projet_hierarchie where ph_id_projet_fils='.$this->_id_projet ;
206
	            $requete = 'select  ph_id_projet_pere, ph_id_projet_fils from projet_hierarchie where ph_id_projet_fils='.$this->_id_projet ;
201
	            $resultat = $this->_db->query ($requete) ;
207
	            $resultat = $this->_db->query ($requete) ;
202
	            if (DB::isError ($resultat)) {
208
	            if (DB::isError ($resultat)) {
Line 326... Line 332...
326
        $this->getListesAssociees() ;
332
        $this->getListesAssociees() ;
327
        if (count($this->_listes_associes)) {
333
        if (count($this->_listes_associes)) {
328
            return true ;
334
            return true ;
329
        }
335
        }
330
        return false ;
336
        return false ;
331
    } // end of member function isListeExiste
337
    }
Line -... Line 338...
-
 
338
 
-
 
339
    /**
-
 
340
     * Renvoie vrai si le projet a au moins un document, fichier ou repertoire
-
 
341
     *
-
 
342
     * Mis en place pour des raisons de performances avant la methode getListesDocuments etait utilisee
-
 
343
     * 
-
 
344
     * @return bool
-
 
345
     * @access public
-
 
346
     */
-
 
347
    function avoirDocument( )
-
 
348
    {
-
 
349
        return $this->_avoirDocument;
-
 
350
    }
-
 
351
 
-
 
352
    /**
-
 
353
     * Permet de fixer la colonne p_avoir_document à 1 
-
 
354
     *
-
 
355
     * Mis en place pour des raisons de performances avant la methode getListesDocuments etait utilisee
-
 
356
     * 
-
 
357
     * @param bool 
-
 
358
     * @return mixed true si la requete fonctionne
-
 
359
     * @access public
-
 
360
     */
-
 
361
    function setAvoirDocument($bool)
-
 
362
    {
-
 
363
        $val = 0 ;
-
 
364
        if ($bool) $val = 1;
-
 
365
        $requete = 'update projet set p_avoir_document='.$val.' where p_id='.$this->_id_projet;
-
 
366
        $resultat = $this->_db->query ($requete) ;
-
 
367
        if (DB::isError($resultat)) {
-
 
368
            echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
-
 
369
        }
-
 
370
        return true;
Line 332... Line 371...
332
 
371
    }
333
 
372
 
334
    /**
373
    /**
335
     * Renvoie la liste des documents associés sous forme d'un tableau, avec les
374
     * Renvoie la liste des documents associés sous forme d'un tableau, avec les
336
     * informations afférentes. 0 => "nom (cliquable)"
375
     * informations afférentes. 0 => "nom (cliquable)"
337
     "Taille"
376
     "Taille"
338
     "Date
377
     "Date
339
     * de création"          "Proriétaire"          "Visibilité"          "Action
378
     * de création"          "Proriàtaire"          "Visibilità"          "Action
340
     * (cliquable)"
379
     * (cliquable)"
341
     *
380
     *
342
     * @param visibilite visibilite Si visibilite est à prive, tous les fichiers sont renvoyés ainsi qu'une entrée
381
     * @param visibilite visibilite Si visibilite est à prive, tous les fichiers sont renvoyés ainsi qu'une entrée
Line 396... Line 435...
396
     *
435
     *
397
     * @return Array
436
     * @return Array
398
     * @static
437
     * @static
399
     * @access public
438
     * @access public
400
     */
439
     */
401
    function getTousLesProjets(&$objetDB)
440
    function getTousLesProjets(&$objetDB, $exclu = '')
402
    {
441
    {
-
 
442
    	$sql = '';
-
 
443
        if (count($this->_projet_exclu)) {
-
 
444
        	$sql = 'where p_id not in (';
-
 
445
            foreach ($this->_projet_exclu as $valeur) {
-
 
446
            	$sql .= $valeur.',' ;
-
 
447
            }
-
 
448
            $sql[count($sql)-1] = ')';
-
 
449
        }
403
        $requete = "select p_id from projet order by p_titre" ;
450
        $requete = 'select p_id from projet '.$sql.' order by p_titre' ;
404
        $resultat = $objetDB->query ($requete) ;
451
        $resultat = $objetDB->query ($requete) ;
405
        if (DB::isError($resultat)) {
452
        if (DB::isError($resultat)) {
406
            die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
453
            echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
407
        }
454
        }
408
        $tableau_resultat = array() ;
455
        $tableau_resultat = array() ;
409
        while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
456
        while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
410
            array_push ($tableau_resultat, new projet ($objetDB, $ligne->p_id)) ;
457
            array_push ($tableau_resultat, new projet ($objetDB, $ligne->p_id)) ;
411
        }
458
        }
Line 516... Line 563...
516
        }
563
        }
Line 517... Line 564...
517
 
564
 
518
        // On affecte à l'objet projet son identifiant
565
        // On affecte à l'objet projet son identifiant
Line 519... Line 566...
519
        $this->_id_projet = $id ;
566
        $this->_id_projet = $id ;
520
 
567
 
521
        //insertion dans projet_hiérarchie
568
        //insertion dans projet_hierarchie
522
		if (PROJET_UTILISE_HIERARCHIE) {
569
		if (PROJET_UTILISE_HIERARCHIE) {
523
	        $requete = 'insert into projet_hierarchie set ph_id_projet_pere='.$tableau_de_valeur['projet_asso'].
570
	        $requete = 'insert into projet_hierarchie set ph_id_projet_pere='.$tableau_de_valeur['projet_asso'].
524
	                    ', ph_id_projet_fils='.$id ;
571
	                    ', ph_id_projet_fils='.$id ;
Line 556... Line 603...
556
	        // suppression dans projet_hierarchie
603
	        // suppression dans projet_hierarchie
Line 557... Line 604...
557
 
604
 
558
	        $requete = 'delete from projet_hierarchie where ph_id_projet_fils='.$this->_id_projet ;
605
	        $requete = 'delete from projet_hierarchie where ph_id_projet_fils='.$this->_id_projet ;
Line 559... Line 606...
559
	        $resultat = $this->_db->query ($requete) ;
606
	        $resultat = $this->_db->query ($requete) ;
Line 560... Line 607...
560
 
607
 
561
	        //insertion dans projet_hiérarchie
608
	        //insertion dans projet_hierarchie
562
 
609
 
563
	        $requete = 'insert into projet_hierarchie set ph_id_projet_pere='.$tableau_de_valeur['projet_asso'].
610
	        $requete = 'insert into projet_hierarchie set ph_id_projet_pere='.$tableau_de_valeur['projet_asso'].
Line 595... Line 642...
595
    function suppressionSQL()
642
    function suppressionSQL()
596
    {
643
    {
597
        $msg = '' ;
644
        $msg = '' ;
598
        // Supression du répertoire du projet
645
        // Supression du répertoire du projet
599
        if (!$this->_suppression_repertoire()) {
646
        if (!$this->_suppression_repertoire()) {
600
            $msg = 'La suppression du répertoire n\'a pas fonctionné' ;
647
            $msg = 'La suppression du répertoire n\'a pas fonctionn°' ;
601
        }
648
        }
602
        // A ajouter la suppression des documents associés
649
        // A ajouter la suppression des documents associés
Line 603... Line 650...
603
 
650