Subversion Repositories eFlore/Archives.eflore-consultation-v2

Compare Revisions

Ignore whitespace Rev 86 → Rev 87

/trunk/serveur/bibliotheque/classes/eflore_block_de_donnees.class.php
File deleted
\ No newline at end of file
/trunk/serveur/bibliotheque/classes/eflore_collection_block_de_donnees.class.php
File deleted
\ No newline at end of file
/trunk/serveur/bibliotheque/classes/eflore_macro_element.class.php
File deleted
\ No newline at end of file
/trunk/serveur/bibliotheque/classes/eflore_groupe_macro_element.class.php
File deleted
\ No newline at end of file
/trunk/serveur/bibliotheque/classes/eribo_block.class.php
New file
0,0 → 1,142
<?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 recupererIdentifiant()
{
return $this->identifiant;
}
function affecterDonnees($donnees)
{
$this->donnees = $donnees;
}
function recupererDonnees($bool_descendance = FALSE)
{
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;
}
function recupererDonnee($clef)
{
return $this->donnees[$clef];
}
function recupererErreur()
{
return $this->erreur;
}
function ajouterCollectionBlockFils($collection_block)
{
array_push($this->collectionBlocksfils, $collection_block);
}
function recupererCollectionBlockFils()
{
return $this->collectionBlocksfils;
}
function afficherPattern($chemin, $nom_fonction, $recuperer_descendance = FALSE, $aso_parametres = array())
{
$retour = '';
if($chemin == $this->recupererIdentifiant()) {
$retour .= call_user_func($nom_fonction, $this->recupererDonnees($recuperer_descendance), $aso_parametres);
} else {
$etape_chemin = explode('>', $chemin);
if($this->identifiant == $etape_chemin[0]) {
$collection_block_fils = $this->recupererCollectionBlockFils();
for($i = 0; $i < count($collection_block_fils); $i++) {
$collection = $collection_block_fils[$i];
if ($collection->recupererIdentifiant() == $etape_chemin[1]) {
array_shift($etape_chemin);
$retour .= $collection->afficherPattern(implode('>', $etape_chemin), $nom_fonction, $recuperer_descendance, $aso_parametres);
}
}
}
}
return $retour;
}
function attribuerContexte($chemin, $cle_contexte, $cle_donnee)
{
if ($chemin == $this->recupererIdentifiant()) {
$donnees = $this->recupererDonnees();
return $donnees;
} else {
$etape_chemin = explode('>', $chemin);
if($this->identifiant == $etape_chemin[0]) {
$collection_block_fils = $this->recupererCollectionBlockFils();
for($i = 0; $i < count($collection_block_fils); $i++) {
$collection = $collection_block_fils[$i];
if ($collection->recupererIdentifiant() == $etape_chemin[1]) {
array_shift($etape_chemin);
$donnees = null;
$donnees = $collection->attribuerContexte(implode('>', $etape_chemin), $cle_contexte, $cle_donnee);
if (isset($donnees)) {
$i = count($collection_block_fils);
}
}
}
}
}
$this->ajouterDonnee($cle_contexte, $donnees[$cle_donnee]);
return null;
}
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>';
}
}
}
?>
/trunk/serveur/bibliotheque/classes/eribo_macro_element.class.php
New file
0,0 → 1,132
<?php
 
class macroElement implements iMacroElement{
protected $identifiantblockdedonnees;
protected $identifiant_parent;
protected $connexion;
protected $contexteRef;
protected $contexteRefTmp;
protected $contexteSQL;
protected $blockdedonneesParent;
protected $collectionblockdedonnees;
protected $idRes;
function __construct($une_connexion, $un_block_donnees_parent, $chemin_macro_element)
{
$this->connexion = $une_connexion;
$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()
{
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()
{
construire();
$this->$contexteRef = $this->blockdedonnees;
construire();
}
function contruireParRecursivite()
{
}
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);
if (is_null($this->identifiant_parent)) {
$this->blockdedonneesParent->ajouterCollectionBlockFils($this->collectionblockdedonnees);
} else {
$this->attribuerCollectionBlockFils($this->blockdedonneesParent, $id);
}
}
function fetch()
{
$res = mysql_fetch_assoc($this->idRes);
if (!$res) {
} else {
//$this->blockdedonnees = new blockdedonnees($this->identifiantblockdedonnees);
//$this->blockdedonnees->affecterDonnees($res);
$this->collectionblockdedonnees->ajouterDonnees($res);
}
return $res;
}
function closeCursor()
{
mysql_free_result($this->idRes);
}
}
?>
/trunk/serveur/bibliotheque/classes/eribo_groupe_macro_element.class.php
New file
0,0 → 1,36
<?php
 
require_once 'eflore_macro_element.class.php';
 
abstract class groupeMacroElement implements iModel{
protected $connexion;
protected $contexte;
protected $newContexte;
protected $dblock;
function __construct($une_connexion)
{
$this->connexion = $une_connexion;
}
function contruire()
{
}
function recupererBlockDeDonnees()
{
return $this->dblock;
}
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, $chemin_macro_element);
return $un_macro_element;
}
}
?>
/trunk/serveur/bibliotheque/classes/eribo_collection_block.class.php
New file
0,0 → 1,80
<?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($block_donnees)
{
array_push($this->collection,$block_donnees);
}
function recupererBlocksDeDonnees()
{
return $this->collection;
}
function recupererIdentifiant()
{
return $this->identifiant;
}
function recupererErreur()
{
return $this->erreur;
}
function afficherPattern($chemin, $nom_fonction, $recuperer_descendance = FALSE, $aso_parametres = array())
{
$retour = '';
$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;
}
function attribuerContexte($chemin, $cle_contexte, $cle_donnee)
{
for($i = 0; $i < count($this->collection); $i++) {
$block_donnees = $this->collection[$i];
$donnees = null;
$donnees = $block_donnees->attribuerContexte($chemin, $cle_contexte, $cle_donnee);
if (isset($donnees)) {
return $donnees;
}
}
return null;
}
function afficher()
{
echo '<li><b>'.$this->identifiant.'</b></li>';
for($i = 0; $i < count($this->collection); $i++) {
$une_collection = $this->collection[$i];
$une_collection->afficher();
}
}
}
?>
/trunk/serveur/bibliotheque/interfaces/eflore_model.interface.php
File deleted
\ No newline at end of file
/trunk/serveur/bibliotheque/interfaces/eflore_macro_element.interface.php
File deleted
\ No newline at end of file
/trunk/serveur/bibliotheque/interfaces/eribo_model.interface.php
New file
0,0 → 1,7
<?php
interface iModel {
function __construct($une_connexion);
function contruire();
function recupererBlockDeDonnees();
};
?>
/trunk/serveur/bibliotheque/interfaces/eribo_macro_element.interface.php
New file
0,0 → 1,6
<?
interface iMacroElement {
function __construct($aConn,$parentDataBlock);
function construire();
};
?>