Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

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

Rev 27 Rev 36
Line 1... Line 1...
1
<?
1
<?php
Line 2... Line 2...
2
 
2
 
Line 3... Line 3...
3
class blockdedonnees{
3
class blockdedonnees {
4
    
4
    
5
    protected $identifiant;
5
    protected $identifiant;
6
    protected $donnees;
6
    protected $donnees;
Line 7... Line 7...
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;
Line 13... Line 13...
13
       $this->donnees = array();
13
        $this->donnees = array();
14
       $this->collectionBlocksfils = array();
14
        $this->collectionBlocksfils = array();
15
   }
15
    }
16
   
16
   
Line 17... Line 17...
17
   function affecterIdentifiant($identifiant) 
17
    function affecterIdentifiant($identifiant)
18
    { 
18
    {
19
        $this->identifiant = $identifiant;
19
        $this->identifiant = $identifiant;
20
    }
20
    }
Line 21... Line 21...
21
   
21
   
22
    function affecterDonnees($donnees) 
22
    function affecterDonnees($donnees)
23
    { 
23
    {
24
        $this->donnees = $donnees;
24
        $this->donnees = $donnees;
Line 25... Line 25...
25
    }
25
    }
26
    
26
    
27
    function recupererDonnees()
27
    function recupererDonnees()
28
    {
28
    {
Line 29... Line 29...
29
        return $this->donnees;
29
        return $this->donnees;
Line 47... Line 47...
47
    function recupererBlockFils()
47
    function recupererBlockFils()
48
    {
48
    {
49
        return $this->blocksfils;
49
        return $this->blocksfils;
50
    }
50
    }
Line 51... Line 51...
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);
Line 55... Line 55...
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
            }
Line 77... Line 72...
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
        }
-
 
87
        echo "</OL>";
81
        }
88
        for($i=0;$i<count($this->collectionBlocksfils);$i++)
82
        echo '</ol>';
89
        {
83
        for($i = 0; $i < count($this->collectionBlocksfils); $i++) {
90
            $collection =$this->collectionBlocksfils[$i];
84
            $collection = $this->collectionBlocksfils[$i];
91
            echo "<OL>";
-
 
92
            $collection->afficher();
85
            echo '<ol>';
93
            echo "</OL>";
86
            $collection->afficher();
94
            
-
 
95
        }
87
            echo '</ol>';
96
    }
-
 
97
 
88
        }
98
}
89
    }