Subversion Repositories eFlore/Archives.eflore-consultation-v2

Compare Revisions

Ignore whitespace Rev 79 → Rev 80

/trunk/serveur/bibliotheque/classes/eflore_collection_block_de_donnees.class.php
12,7 → 12,7
$this->collection = array();
}
function affecterIdentifiant($identifiant)
function affecterIdentifiant($identifiant)
{
$this->identifiant = $identifiant;
}
24,9 → 24,9
$this->affecterBlockDeDonnees($block);
}
function affecterBlockDeDonnees($blockdonnees)
function affecterBlockDeDonnees($block_donnees)
{
array_push($this->collection,$blockdonnees);
array_push($this->collection,$block_donnees);
}
function recupererBlocksDeDonnees()
44,12 → 44,13
return $this->erreur;
}
function afficherPattern($chemin, $nom_fonction)
function afficherPattern($chemin, $nom_fonction, $recuperer_descendance = FALSE, $aso_parametres = array())
{
$retour = '';
for($i = 0; $i < count($this->collection); $i++) {
$block_donnees = $this->collection[$i];
$retour .= $block_donnees->afficherPattern($chemin, $nom_fonction);
$collection = $this->recupererBlocksDeDonnees();
for($i = 0; $i < count($collection); $i++) {
$block_donnees = $collection[$i];
$retour .= $block_donnees->afficherPattern($chemin, $nom_fonction, $recuperer_descendance, $aso_parametres);
}
return $retour;
}
/trunk/serveur/bibliotheque/classes/eflore_macro_element.class.php
2,29 → 2,86
 
class macroElement implements iMacroElement{
protected $identifiantblockdedonnees;
protected $identifiantblockdedonnees;
protected $identifiant_parent;
protected $connexion;
protected $contexteRef;
protected $contexteRef;
protected $contexteRefTmp;
protected $contexteSQL;
protected $blockdedonneesParent;
protected $collectionblockdedonnees;
protected $idRes;
function __construct($une_connexion, $un_block_données_parent, $identifiant)
function __construct($une_connexion, $un_block_donnees_parent, $chemin_macro_element)
{
$this->connexion = $une_connexion;
$this->blockdedonneesParent = $un_block_donn;
$this->identifiantblockdedonnees = $identifiant;
$this->contexteRef = $this->blockdedonneesParent->recupererDonnees();
$this->blockdedonneesParent = $un_block_donnees_parent;
$tab_etape_chemin = array_reverse(explode('>', $chemin_macro_element));
$identifiant = $tab_etape_chemin[0];
$this->identifiantblockdedonnees = $identifiant;
if (count($tab_etape_chemin) > 1) {
$this->identifiant_parent = $tab_etape_chemin[1];
$this->contexteRef = $this->attribuerContexteRef($this->blockdedonneesParent);
} else {
$this->identifiant_parent = NULL;
$this->contexteRef = $this->blockdedonneesParent->recupererDonnees();
}
}
function attribuerContexteRef($un_block_donnees)
{
$collection_block_fils = $un_block_donnees->recupererCollectionBlockFils();
for($i = 0; $i < count($collection_block_fils); $i++) {
$collection = $collection_block_fils[$i];
if ($collection->recupererIdentifiant() == $this->identifiant_parent) {
return $collection->recupererBlocksDeDonnees();
} else if (is_object($un_block_donnees->recupererCollectionBlockFils())) {
return $this->attribuerContexteRef($un_block_donnees->recupererCollectionBlockFils());
}
}
}
function attribuerCollectionBlockFils($un_block_donnees, $id)
{
$collection_block_fils = $un_block_donnees->recupererCollectionBlockFils();
for($i = 0; $i < count($collection_block_fils); $i++) {
$collection = $collection_block_fils[$i];
if ($collection->recupererIdentifiant() == $this->identifiant_parent) {
$blocks_de_donnees = $collection->recupererBlocksDeDonnees();
foreach ($blocks_de_donnees as $cle => $val) {
if ($cle == $id) {
return $blocks_de_donnees[$cle]->ajouterCollectionBlockFils($this->collectionblockdedonnees);
}
}
} else if (is_object($this->blockdedonneesParent->recupererCollectionBlockFils())) {
return $this->attribuerCollectionBlockFils($un_block_donnees->recupererCollectionBlockFils());
}
}
}
function construire()
{
$sql = $this->getSQL();
if(!is_null($sql)) {
$this->openCursor($sql);
while ($this->fetch());
$this->closeCursor();
}
function construire()
{
if (is_null($this->identifiant_parent)) {
$sql = $this->getSQL();
if(!is_null($sql)) {
$this->openCursor($sql);
while ($this->fetch());
$this->closeCursor();
}
} else {
$this->contexteRefTmp = $this->contexteRef;
for($i = 0; $i < count($this->contexteRefTmp); $i++) {
$this->contexteRef = $this->contexteRefTmp[$i]->recupererDonnees();
$sql = $this->getSQL();
if(!is_null($sql)) {
$this->openCursor($sql, $i);
while ($this->fetch());
$this->closeCursor();
}
}
//$this->contexteRef = $this->contexteRefTmp;
}
//echo '<pre>'.print_r($this->contexteRef, true).'</pre>';
}
function contruireParRecursivitePlate()
41,13 → 98,17
}
function openCursor($sql)
function openCursor($sql, $id = null)
{
$res = mysql_query($sql, $this->connexion);
if (!$res) echo mysql_errno().': '.mysql_error()."\n";
$this->idRes = $res;
$this->collectionblockdedonnees = new collectionblockdedonnees($this->identifiantblockdedonnees);
$this->blockdedonneesParent->ajouterCollectionBlockFils($this->collectionblockdedonnees);
$this->collectionblockdedonnees = new collectionblockdedonnees($this->identifiantblockdedonnees);
if (is_null($this->identifiant_parent)) {
$this->blockdedonneesParent->ajouterCollectionBlockFils($this->collectionblockdedonnees);
} else {
$this->attribuerCollectionBlockFils($this->blockdedonneesParent, $id);
}
}
function fetch()
/trunk/serveur/bibliotheque/classes/eflore_groupe_macro_element.class.php
24,10 → 24,12
return $this->dblock;
}
function macroElementFactory($macro_element_nom, $block_donnees_parent)
{
function macroElementFactory($chemin_macro_element, $block_donnees_parent)
{
$etape_chemin = array_reverse(explode('>', $chemin_macro_element));
$macro_element_nom = $etape_chemin[0];
require_once EFSE_CHEMIN_MV_MACRO.$macro_element_nom.'.php';
$un_macro_element = new $macro_element_nom($this->connexion, $block_donnees_parent, $macro_element_nom);
$un_macro_element = new $macro_element_nom($this->connexion, $block_donnees_parent, $chemin_macro_element);
return $un_macro_element;
}
}
/trunk/serveur/bibliotheque/classes/eflore_block_de_donnees.class.php
29,19 → 29,37
$this->donnees = $donnees;
}
function recupererDonnees()
function recupererDonnees($bool_descendance = FALSE)
{
return $this->donnees;
if ($bool_descendance == TRUE) {
$aso_donnees = array();
$aso_donnees[$this->recupererIdentifiant()] = $this->donnees;
$collections_blocks_fils = $this->recupererCollectionBlockFils();
if (is_array($collections_blocks_fils)) {
for($i = 0; $i < count($collections_blocks_fils); $i++) {
$collection = $collections_blocks_fils[$i];
$blocks_de_donnees = $collection->recupererBlocksDeDonnees();
for($j = 0; $j < count($blocks_de_donnees); $j++) {
$block = $blocks_de_donnees[$j];
$donnees = $block->recupererDonnees();
$aso_donnees[$this->recupererIdentifiant()][$block->recupererIdentifiant()] = $donnees;
}
}
}
return $aso_donnees;
} else {
return $this->donnees;
}
}
function ajouterDonnee($clef, $valeur)
{
$this->donnees["$clef"] = $valeur;
$this->donnees[$clef] = $valeur;
}
function recupererDonnee($clef)
{
return $this->donnees["$clef"];
return $this->donnees[$clef];
}
function recupererErreur()
49,11 → 67,6
return $this->erreur;
}
function recupererBlockFils()
{
return $this->blocksfils;
}
function ajouterCollectionBlockFils($collection_block)
{
array_push($this->collectionBlocksfils, $collection_block);
64,11 → 77,11
return $this->collectionBlocksfils;
}
function afficherPattern($chemin, $nom_fonction)
function afficherPattern($chemin, $nom_fonction, $recuperer_descendance = FALSE, $aso_parametres = array())
{
$retour = '';
if($chemin == $this->recupererIdentifiant()) {
$retour .= call_user_func($nom_fonction, $this->recupererDonnees());
$retour .= call_user_func($nom_fonction, $this->recupererDonnees($recuperer_descendance), $aso_parametres);
} else {
$etape_chemin = explode('>', $chemin);
if($this->identifiant == $etape_chemin[0]) {
77,7 → 90,7
$collection = $collection_block_fils[$i];
if ($collection->recupererIdentifiant() == $etape_chemin[1]) {
array_shift($etape_chemin);
$retour .= $collection->afficherPattern(implode('>', $etape_chemin), $nom_fonction);
$retour .= $collection->afficherPattern(implode('>', $etape_chemin), $nom_fonction, $recuperer_descendance, $aso_parametres);
}
}
}