Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 5aceeb68

Přidáno uživatelem Tomáš Pašek před téměř 4 roky(ů)

Feature #8637 Návrh změn záznamů

Zobrazit rozdíly:

application/model/DB.php
48 48
            if (array_key_exists("tag", $params)) {
49 49
                $this->stmt->bindParam(':tag',$params['tag'], PDO::PARAM_STR);
50 50
            }
51
            if (array_key_exists("finished", $params)) {
52
                $this->stmt->bindParam(':finished',$params['finished']);
53
            }
54 51
            if (array_key_exists("description2", $params)) {
55 52
                $this->stmt->bindParam(':description2',$params['description2']);
56 53
            }
......
85 82
        return $this->stmt->fetchAll();
86 83
    }
87 84

  
85
    function createChangeRequest($request) {
86
        $this->stmt = $this->pdo->prepare('INSERT INTO changes (wordform_id, message) VALUES (:wordform_id, :message)');
87
        $this->stmt->bindParam(':wordform_id', $request['wordform_id']);
88
        $this->stmt->bindParam(':message',$request['message']);
89
        $this->stmt->execute();
90
        return $this->stmt->fetchAll();
91
    }
92

  
93
    function removeChangeRequest($requestId) {
94
        $this->stmt = $this->pdo->prepare('DELETE FROM changes WHERE id = :requestId');
95
        $this->stmt->bindParam(':requestId', $requestId);
96
        $this->stmt->execute();
97
        return $this->stmt->fetchAll();
98
    }
99

  
100
    function getChangeRequests() {
101
        $this->stmt = $this->pdo->prepare('SELECT c.id as changeId, c.message, w.id as wordformId, w.word, l.lemma FROM changes as c left join dd_wordform as w on c.wordform_id = w.id left join dd_lemma as l on w.lemma_id = l.id');
102
        $this->stmt->execute();
103
        return $this->stmt->fetchAll();
104
    }
105

  
88 106
    function updateUserRole($userId, $role) {
89 107
        $this->stmt = $this->pdo->prepare("UPDATE users SET role = :role WHERE id = :userId");
90 108
        $this->stmt->bindParam(':role', $role);
......
730 748

  
731 749
// (D) DATABASE SETTINGS - CHANGE TO YOUR OWN!
732 750
define('DB_HOST', 'localhost');
733
define('DB_NAME', 'dalim2');
751
define('DB_NAME', 'dalimil2');
734 752
define('DB_CHARSET', 'utf8');
735 753
define('DB_USER', 'postgres');
736 754
define('DB_PASSWORD', 'a');

Také k dispozici: Unified diff