Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

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

Rev Author Line No. Line
42 fred 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
 
80 jpm 15
   function affecterIdentifiant($identifiant)
42 fred 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
 
80 jpm 27
    function affecterBlockDeDonnees($block_donnees)
42 fred 28
    {
80 jpm 29
        array_push($this->collection,$block_donnees);
42 fred 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
 
80 jpm 47
    function afficherPattern($chemin, $nom_fonction, $recuperer_descendance = FALSE, $aso_parametres = array())
44 jpm 48
    {
49
        $retour = '';
80 jpm 50
        $collection = $this->recupererBlocksDeDonnees();
51
        for($i = 0; $i < count($collection); $i++) {
52
            $block_donnees = $collection[$i];
53
            $retour .= $block_donnees->afficherPattern($chemin, $nom_fonction, $recuperer_descendance, $aso_parametres);
44 jpm 54
        }
55
        return $retour;
56
    }
42 fred 57
 
72 jpm 58
    function attribuerContexte($chemin, $cle_contexte, $cle_donnee)
59
    {
60
        for($i = 0; $i < count($this->collection); $i++) {
61
            $block_donnees = $this->collection[$i];
62
            $donnees = null;
63
            $donnees = $block_donnees->attribuerContexte($chemin, $cle_contexte, $cle_donnee);
64
            if (isset($donnees)) {
65
                return $donnees;
66
            }
67
        }
68
        return null;
69
    }
70
 
42 fred 71
    function afficher()
72
    {
73
        echo '<li><b>'.$this->identifiant.'</b></li>';
74
        for($i = 0; $i < count($this->collection); $i++) {
44 jpm 75
            $une_collection = $this->collection[$i];
76
            $une_collection->afficher();
42 fred 77
        }
78
    }
79
}
27 jpm 80
?>