Config.php 1.16 KB
Newer Older
jlopez's avatar
Fix #7  
jlopez committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php 

require_once(__DIR__.'/../dao/DBquery.php');

class Config
{
    var $ID          = 0;
    var $type        = "";
    var $description = "";
    var $value       = "";
    var $active      = 0;

    public function __construct($ID, $type, $description, $value, $active)
    {
        $this->ID          = $ID;
        $this->description = $description;
        $this->value       = $value;
        $this->type        = $type;
        $this->active      = $active;
    }

    public function escape(DBquery $db) {
        $this->description = utf8_decode($db->escape($this->description));
        $this->value = utf8_decode($db->escape($this->value));
    }

    public function getInsert() {
        return "INSERT INTO Config (type, description, value, active)
        VALUES ('$this->type', '$this->description', '$this->value', '$this->active');";
    }

    public function getUpdate() {
        return "UPDATE Config
        SET type='$this->type', description='$this->description', value='$this->value', active='$this->active'
        WHERE ID = '$this->ID';";
    }

    public function getDelete() {
        return "DELETE FROM Config WHERE ID = '$this->ID';";
    }



}