Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 72 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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