Completed
Push — master ( 067f55...e1cb48 )
by Julito
09:39
created

CardGame::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
/**
5
 * Define the CardGame class as an extension of Plugin to
6
 * install/uninstall the plugin.
7
 *
8
 * @author Damien Renou
9
 *
10
 * @package chamilo.plugin.card_game
11
 */
12
class CardGame extends Plugin
13
{
14
    /**
15
     * CardGame constructor.
16
     */
17
    protected function __construct()
18
    {
19
        parent::__construct(
20
            '1.1',
21
            'Damien Renou'
22
        );
23
    }
24
25
    public static function create()
26
    {
27
        static $result = null;
28
29
        return $result ? $result : $result = new self();
30
    }
31
32
    public function install()
33
    {
34
        // 'pan' is the ID of the current background image/panel
35
        $sql = "CREATE TABLE IF NOT EXISTS plugin_card_game(
36
            id INT NOT NULL AUTO_INCREMENT,
37
            user_id INT NOT NULL,
38
            pan int NOT NULL,
39
            access_date DATE NOT NULL,
40
            parts VARCHAR(500) NOT NULL,
41
            PRIMARY KEY (id)
42
        )";
43
        Database::query($sql);
44
    }
45
46
    public function uninstall()
47
    {
48
        $sql = "DROP TABLE IF EXISTS plugin_card_game";
49
        Database::query($sql);
50
    }
51
}
52