Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 27 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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