Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 32 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
32 jpm 1
<?php
2
 
27 jpm 3
class macroElement implements iMacroElement{
4
 
5
    protected $identifiantblockdedonnees;
6
    protected $connexion;
7
    protected $contexteRef;
8
    protected $blockdedonneesParent;
9
    protected $collectionblockdedonnees;
10
    protected $idRes;
11
 
36 jpm 12
    function __construct($une_connexion, $un_block_données_parent, $identifiant)
32 jpm 13
    {
36 jpm 14
        $this->connexion = $une_connexion;
15
        $this->blockdedonneesParent = $un_block_donn;
27 jpm 16
        $this->identifiantblockdedonnees = $identifiant;
17
        $this->contexteRef = $this->blockdedonneesParent->recupererDonnees();
32 jpm 18
    }
19
 
27 jpm 20
    function construire()
32 jpm 21
    {
36 jpm 22
        $sql = $this->getSQL();
23
        if(!is_null($sql)) {
27 jpm 24
            $this->openCursor($sql);
25
            while ($this->fetch());
26
            $this->closeCursor();
27
        }
28
    }
29
 
36 jpm 30
    function contruireParRecursivitePlate()
27 jpm 31
    {
32
        construire();
33
 
34
        $this->$contexteRef = $this->blockdedonnees;
35
 
36
        construire();
37
    }
38
 
36 jpm 39
    function contruireParRecursivite()
27 jpm 40
    {
32 jpm 41
 
27 jpm 42
    }
43
 
44
    function openCursor($sql)
45
    {
32 jpm 46
        $res = mysql_query($sql, $this->connexion);
47
        if (!$res) echo mysql_errno().': '.mysql_error()."\n";
48
        $this->idRes = $res;
27 jpm 49
        $this->collectionblockdedonnees = new collectionblockdedonnees($this->identifiantblockdedonnees);
50
        $this->blockdedonneesParent->ajouterCollectionBlockFils($this->collectionblockdedonnees);
51
    }
52
 
53
    function fetch()
32 jpm 54
    {
36 jpm 55
        $res = mysql_fetch_assoc($this->idRes);
32 jpm 56
        if (!$res) {
57
 
58
        } else {
27 jpm 59
            //$this->blockdedonnees = new blockdedonnees($this->identifiantblockdedonnees);
60
            //$this->blockdedonnees->affecterDonnees($res);
32 jpm 61
            $this->collectionblockdedonnees->ajouterDonnees($res);
27 jpm 62
        }
63
        return $res;
64
    }
65
 
66
    function closeCursor()
67
    {
68
        mysql_free_result($this->idRes);
69
    }
70
}
71
?>