Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 27 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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