Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 39 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 39 Rev 42
Line 1... Line 1...
1
<?php
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($collection_block)
52
    function ajouterCollectionBlockFils($collection_block)
53
    {
53
    {
54
        array_push($this->collectionBlocksfils, $collection_block);
54
        array_push($this->collectionBlocksfils, $collection_block);
55
    }
55
    }
Line 56... Line 56...
56
    
56
    
57
    function recupererCollectionBlockFils()
57
    function recupererCollectionBlockFils()
58
    {
58
    {
59
        return $this->collectionBlocksfils;
59
        return $this->collectionBlocksfils;
60
    }
60
    }
61
    
61
    
62
    function afficherPattern($chemin, $fonction)
62
	function afficherPattern($chemin,$nom_fonction)
63
    {
63
	{
-
 
64
		/*echo "identifiant: $this->identifiant</br>";
-
 
65
		echo "chemin: $chemin</br>";
64
        if ($chemin == $this->identifiant) {
66
		echo "nom_fonction: $nom_fonction</br>";*/
-
 
67
		
-
 
68
		if($chemin==$this->identifiant)
-
 
69
		{
-
 
70
			call_user_func($nom_fonction,$this->donnees);
65
        
71
		}
-
 
72
		else
-
 
73
		{
66
        } else {
74
			
67
            $etape_chemin = explode('>', $chemin);
75
			$etape_chemin = explode('>',$chemin);
-
 
76
			if($this->identifiant==$etape_chemin[0])
68
            if($chemin == $etape_chemin[0]) {
77
			{	//echo "collection</br>";
-
 
78
				for($i=0;$i<count($this->collectionBlocksfils);$i++)
69
                for ($i = 0; $i < count($this->collectionBlocksfils); $i++) {
79
				{
-
 
80
					$collection =$this->collectionBlocksfils[$i];
70
                    $collection = $this->collectionBlocksfils[$i];
81
					//echo "collection2</br>";
-
 
82
					if ($collection->recupererIdentifiant()==$etape_chemin[1])
-
 
83
					{
71
                    if ($collection->recupererIdentifiant() == $etape_chemin[1]) {
84
						echo "collection3</br>";
72
                        array_shift($etape_chemin);
85
						array_shift($etape_chemin);
73
                        afficherPattern(implode('>', $etape_chemin), $fonction);
86
						$collection->afficherPattern(implode('>',$etape_chemin),$nom_fonction);
74
                    }
87
					}			
75
                }
88
				}
76
            }
89
			}
77
        }
90
		}	
78
    }
91
	}
79
    
92
    
80
    function afficher()
93
    function afficher()
81
    {
94
    {
82
        echo '<ol>';
95
        echo '<ol>';
83
        foreach ($this->donnees as $key => $value) {
96
        foreach ($this->donnees as $key => $value) {
84
            echo '<li>'.$key.' : '.$value;
97
            echo '<li>'.$key.' : '.$value;
85
        }
98
        }
86
        echo '</ol>';
99
        echo '</ol>';
87
        for ($i = 0; $i < count($this->collectionBlocksfils); $i++) {
100
        for ($i = 0; $i < count($this->collectionBlocksfils); $i++) {
88
            $collection = $this->collectionBlocksfils[$i];
101
            $collection = $this->collectionBlocksfils[$i];
89
            echo '<ol>';
102
            echo '<ol>';
90
            $collection->afficher();
103
            $collection->afficher();
91
            echo '</ol>';
104
            echo '</ol>';
92
        }
105
        }
93
    }
106
    }
94
}
107
}
95
?>
108
?>