New file |
0,0 → 1,100 |
<? |
|
class blockdedonnees{ |
|
protected $identifiant; |
protected $donnees; |
protected $collectionBlocksfils; |
protected $erreur; |
|
function __construct($identifiant) |
{ |
$this->identifiant = $identifiant; |
$this->donnees = array(); |
$this->collectionBlocksfils = array(); |
} |
|
function affecterIdentifiant($identifiant) |
{ |
$this->identifiant = $identifiant; |
} |
|
function affecterDonnees($donnees) |
{ |
$this->donnees = $donnees; |
} |
|
function recupererDonnees() |
{ |
return $this->donnees; |
} |
|
function ajouterDonnee($clef,$valeur) |
{ |
$this->donnees["$clef"] = $valeur; |
} |
|
function recupererDonnee($clef) |
{ |
return $this->donnees["$clef"]; |
} |
|
function recupererErreur() |
{ |
return $this->erreur; |
} |
|
function recupererBlockFils() |
{ |
return $this->blocksfils; |
} |
|
function ajouterCollectionBlockFils($collectionBlock) |
{ |
array_push($this->collectionBlocksfils,$collectionBlock); |
} |
|
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]) |
{ |
array_shift($etape_chemin); |
afficherPattern(implode('>',$etape_chemin),$fonction); |
} |
} |
} |
} |
} |
|
function afficher() |
{ |
echo "<OL>"; |
foreach($this->donnees as $key => $value) |
{ |
echo "<li>$key:$value "; |
} |
echo "</OL>"; |
for($i=0;$i<count($this->collectionBlocksfils);$i++) |
{ |
$collection =$this->collectionBlocksfils[$i]; |
echo "<OL>"; |
$collection->afficher(); |
echo "</OL>"; |
|
} |
} |
|
} |
|
?> |