1,6 → 1,6 |
<? |
<?php |
|
class blockdedonnees{ |
class blockdedonnees { |
|
protected $identifiant; |
protected $donnees; |
7,20 → 7,20 |
protected $collectionBlocksfils; |
protected $erreur; |
|
function __construct($identifiant) |
{ |
$this->identifiant = $identifiant; |
$this->donnees = array(); |
$this->collectionBlocksfils = array(); |
} |
function __construct($identifiant) |
{ |
$this->identifiant = $identifiant; |
$this->donnees = array(); |
$this->collectionBlocksfils = array(); |
} |
|
function affecterIdentifiant($identifiant) |
{ |
function affecterIdentifiant($identifiant) |
{ |
$this->identifiant = $identifiant; |
} |
|
function affecterDonnees($donnees) |
{ |
function affecterDonnees($donnees) |
{ |
$this->donnees = $donnees; |
} |
|
29,7 → 29,7 |
return $this->donnees; |
} |
|
function ajouterDonnee($clef,$valeur) |
function ajouterDonnee($clef, $valeur) |
{ |
$this->donnees["$clef"] = $valeur; |
} |
49,52 → 49,43 |
return $this->blocksfils; |
} |
|
function ajouterCollectionBlockFils($collectionBlock) |
function ajouterCollectionBlockFils($collection_block) |
{ |
array_push($this->collectionBlocksfils,$collectionBlock); |
array_push($this->collectionBlocksfils, $collection_block); |
} |
|
function afficherPattern($chemin,$fonction) |
function afficherPattern($chemin, $fonction) |
{ |
if($chemin==$this->identifiant) |
{ |
} |
else |
{ |
$etape_chemin = explode('>',$chemin); |
if($chemin==$etape_chemin[0]) |
{ |
for($i=0;$i<count($this->collectionBlocksfils);$i++) |
{ |
$collection =$this->collectionBlocksfils[$i]; |
if ($collection->recupererIdentifiant()==$etape_chemin[1]) |
{ |
if ($chemin == $this->identifiant) { |
|
} else { |
$etape_chemin = explode('>', $chemin); |
if($chemin == $etape_chemin[0]) { |
for($i = 0; $i < count($this->collectionBlocksfils); $i++) { |
$collection = $this->collectionBlocksfils[$i]; |
if ($collection->recupererIdentifiant() == $etape_chemin[1]) { |
array_shift($etape_chemin); |
afficherPattern(implode('>',$etape_chemin),$fonction); |
} |
afficherPattern(implode('>', $etape_chemin), $fonction); |
} |
} |
} |
} |
} |
} |
|
function afficher() |
{ |
echo "<OL>"; |
echo '<ol>'; |
foreach($this->donnees as $key => $value) |
{ |
echo "<li>$key:$value "; |
echo '<li>'.$key.' : '.$value; |
} |
echo "</OL>"; |
for($i=0;$i<count($this->collectionBlocksfils);$i++) |
{ |
$collection =$this->collectionBlocksfils[$i]; |
echo "<OL>"; |
echo '</ol>'; |
for($i = 0; $i < count($this->collectionBlocksfils); $i++) { |
$collection = $this->collectionBlocksfils[$i]; |
echo '<ol>'; |
$collection->afficher(); |
echo "</OL>"; |
|
echo '</ol>'; |
} |
} |
|
} |
|
?> |