Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 32 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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