Subversion Repositories eFlore/Archives.eflore-consultation-v2

Compare Revisions

Ignore whitespace Rev 41 → Rev 42

/trunk/serveur/bibliotheque/classes/eflore_collection_block_de_donnees.class.php
1,56 → 1,66
<?php
 
class collectionblockdedonnees{
protected $identifiant;
protected $collection;
protected $erreur;
function __construct($identifiant)
{
$this->identifiant = $identifiant;
$this->collection = array();
}
function affecterIdentifiant($identifiant)
{
$this->identifiant = $identifiant;
}
function ajouterDonnees($donnees)
{
$block = new blockdedonnees($this->identifiant);
$block->affecterDonnees($donnees);
$this->affecterBlockDeDonnees($block);
}
function affecterBlockDeDonnees($blockdonnees)
{
array_push($this->collection,$blockdonnees);
}
function recupererBlocksDeDonnees()
{
return $this->collection;
}
function recupererIdentifiant()
{
return $this->identifiant;
}
function recupererErreur()
{
return $this->erreur;
}
function afficher()
{
echo '<li><b>'.$this->identifiant.'</b></li>';
for($i = 0; $i < count($this->collection); $i++) {
$uneCollection = $this->collection[$i];
$uneCollection->afficher();
}
}
}
<?php
 
class collectionblockdedonnees{
protected $identifiant;
protected $collection;
protected $erreur;
function __construct($identifiant)
{
$this->identifiant = $identifiant;
$this->collection = array();
}
function affecterIdentifiant($identifiant)
{
$this->identifiant = $identifiant;
}
function ajouterDonnees($donnees)
{
$block = new blockdedonnees($this->identifiant);
$block->affecterDonnees($donnees);
$this->affecterBlockDeDonnees($block);
}
function affecterBlockDeDonnees($blockdonnees)
{
array_push($this->collection,$blockdonnees);
}
function recupererBlocksDeDonnees()
{
return $this->collection;
}
function recupererIdentifiant()
{
return $this->identifiant;
}
function recupererErreur()
{
return $this->erreur;
}
function afficherPattern($chemin,$nom_fonction)
{
//echo "boucle</br>";
for($i=0;$i<count($this->collection);$i++)
{
$blockdonnees =$this->collection[$i];
$blockdonnees->afficherPattern($chemin,$nom_fonction);
}
}
function afficher()
{
echo '<li><b>'.$this->identifiant.'</b></li>';
for($i = 0; $i < count($this->collection); $i++) {
$uneCollection = $this->collection[$i];
$uneCollection->afficher();
}
}
}
?>
/trunk/serveur/bibliotheque/classes/eflore_block_de_donnees.class.php
1,95 → 1,108
<?php
 
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($collection_block)
{
array_push($this->collectionBlocksfils, $collection_block);
}
<?php
 
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($collection_block)
{
array_push($this->collectionBlocksfils, $collection_block);
}
function recupererCollectionBlockFils()
{
return $this->collectionBlocksfils;
}
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>';
}
}
}
function afficherPattern($chemin,$nom_fonction)
{
/*echo "identifiant: $this->identifiant</br>";
echo "chemin: $chemin</br>";
echo "nom_fonction: $nom_fonction</br>";*/
if($chemin==$this->identifiant)
{
call_user_func($nom_fonction,$this->donnees);
}
else
{
$etape_chemin = explode('>',$chemin);
if($this->identifiant==$etape_chemin[0])
{ //echo "collection</br>";
for($i=0;$i<count($this->collectionBlocksfils);$i++)
{
$collection =$this->collectionBlocksfils[$i];
//echo "collection2</br>";
if ($collection->recupererIdentifiant()==$etape_chemin[1])
{
echo "collection3</br>";
array_shift($etape_chemin);
$collection->afficherPattern(implode('>',$etape_chemin),$nom_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>';
}
}
}
?>