Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 87 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
87 jpm 1
<?php
2
 
3
class collectionblockdedonnees{
4
 
5
    protected $identifiant;
6
    protected $collection;
7
    protected $erreur;
8
 
9
    function __construct($identifiant)
10
    {
11
        $this->identifiant = $identifiant;
12
        $this->collection = array();
13
    }
14
 
15
   function affecterIdentifiant($identifiant)
16
    {
17
        $this->identifiant = $identifiant;
18
    }
19
 
20
    function ajouterDonnees($donnees)
21
    {
22
        $block = new blockdedonnees($this->identifiant);
23
        $block->affecterDonnees($donnees);
24
        $this->affecterBlockDeDonnees($block);
25
    }
26
 
27
    function affecterBlockDeDonnees($block_donnees)
28
    {
29
        array_push($this->collection,$block_donnees);
30
    }
31
 
32
    function recupererBlocksDeDonnees()
33
    {
34
        return $this->collection;
35
    }
36
 
37
    function recupererIdentifiant()
38
    {
39
        return $this->identifiant;
40
    }
41
 
42
    function recupererErreur()
43
    {
44
        return $this->erreur;
45
    }
46
 
106 jpm 47
    function afficherPattern($chemin, $nom_fonction, $aso_parametres = array(), $recuperer_ascendance = FALSE, &$aso_donnees = array())
87 jpm 48
    {
49
        $retour = '';
50
        $collection = $this->recupererBlocksDeDonnees();
51
        for($i = 0; $i < count($collection); $i++) {
106 jpm 52
            $block = $collection[$i];
53
            if ($recuperer_ascendance == TRUE) {
54
                $retour .= $block->afficherPattern($chemin, $nom_fonction, $aso_parametres, $recuperer_ascendance, $aso_donnees);
55
            } else {
56
                $retour .= $block->afficherPattern($chemin, $nom_fonction, $aso_parametres);
57
            }
87 jpm 58
        }
59
        return $retour;
60
    }
61
 
106 jpm 62
    function attribuerContexteSql($chemin, $cle_contexte, $cle_donnee)
87 jpm 63
    {
64
        for($i = 0; $i < count($this->collection); $i++) {
65
            $block_donnees = $this->collection[$i];
66
            $donnees = null;
106 jpm 67
            $donnees = $block_donnees->attribuerContexteSql($chemin, $cle_contexte, $cle_donnee);
87 jpm 68
            if (isset($donnees)) {
69
                return $donnees;
70
            }
71
        }
72
        return null;
73
    }
74
 
106 jpm 75
    function attribuerContexteValeur($chemin, $cle_contexte, $valeur = null)
76
    {
77
        for($i = 0; $i < count($this->collection); $i++) {
78
            $block_donnees = $this->collection[$i];
79
            $donnees = null;
80
            $donnees = $block_donnees->attribuerContexteValeur($chemin, $cle_contexte, $valeur);
81
            if (isset($donnees)) {
82
                return $donnees;
83
            }
84
        }
85
        return null;
86
    }
87
 
87 jpm 88
    function afficher()
89
    {
90
        echo '<li><b>'.$this->identifiant.'</b></li>';
91
        for($i = 0; $i < count($this->collection); $i++) {
92
            $une_collection = $this->collection[$i];
93
            $une_collection->afficher();
94
        }
95
    }
96
}
97
?>