Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

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

Rev Author Line No. Line
36 jpm 1
<?php
27 jpm 2
 
36 jpm 3
class blockdedonnees {
27 jpm 4
 
5
    protected $identifiant;
6
    protected $donnees;
7
    protected $collectionBlocksfils;
8
    protected $erreur;
9
 
36 jpm 10
    function __construct($identifiant)
11
    {
12
        $this->identifiant = $identifiant;
13
        $this->donnees = array();
14
        $this->collectionBlocksfils = array();
15
    }
27 jpm 16
 
36 jpm 17
    function affecterIdentifiant($identifiant)
18
    {
27 jpm 19
        $this->identifiant = $identifiant;
20
    }
21
 
36 jpm 22
    function affecterDonnees($donnees)
23
    {
27 jpm 24
        $this->donnees = $donnees;
25
    }
26
 
27
    function recupererDonnees()
28
    {
29
        return $this->donnees;
30
    }
31
 
36 jpm 32
    function ajouterDonnee($clef, $valeur)
27 jpm 33
    {
34
        $this->donnees["$clef"] = $valeur;
35
    }
36
 
37
    function recupererDonnee($clef)
38
    {
39
        return $this->donnees["$clef"];
40
    }
41
 
42
    function recupererErreur()
43
    {
44
        return $this->erreur;
45
    }
46
 
47
    function recupererBlockFils()
48
    {
49
        return $this->blocksfils;
50
    }
51
 
36 jpm 52
    function ajouterCollectionBlockFils($collection_block)
27 jpm 53
    {
36 jpm 54
        array_push($this->collectionBlocksfils, $collection_block);
27 jpm 55
    }
56
 
36 jpm 57
    function afficherPattern($chemin, $fonction)
27 jpm 58
    {
36 jpm 59
        if ($chemin == $this->identifiant) {
60
 
61
        } else {
62
            $etape_chemin = explode('>', $chemin);
63
            if($chemin == $etape_chemin[0]) {
64
                for($i = 0; $i < count($this->collectionBlocksfils); $i++) {
65
                    $collection = $this->collectionBlocksfils[$i];
66
                    if ($collection->recupererIdentifiant() == $etape_chemin[1]) {
27 jpm 67
                        array_shift($etape_chemin);
36 jpm 68
                        afficherPattern(implode('>', $etape_chemin), $fonction);
69
                    }
27 jpm 70
                }
71
            }
36 jpm 72
        }
27 jpm 73
    }
74
 
75
    function afficher()
76
    {
36 jpm 77
        echo '<ol>';
27 jpm 78
        foreach($this->donnees as $key => $value)
79
        {
36 jpm 80
            echo '<li>'.$key.' : '.$value;
27 jpm 81
        }
36 jpm 82
        echo '</ol>';
83
        for($i = 0; $i < count($this->collectionBlocksfils); $i++) {
84
            $collection = $this->collectionBlocksfils[$i];
85
            echo '<ol>';
27 jpm 86
            $collection->afficher();
36 jpm 87
            echo '</ol>';
27 jpm 88
        }
89
    }
90
}
91
?>