-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase.php
More file actions
46 lines (39 loc) · 1005 Bytes
/
base.php
File metadata and controls
46 lines (39 loc) · 1005 Bytes
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
45
46
<?php
/**
* Planning Poker for the backlog
* @package Poker
* @author Alan Hardman <alan@phpizza.com>
* @version 0.0.1
*/
namespace Plugin\Poker;
class Base extends \Plugin {
/**
* Initialize the plugin
*/
public function _load() {
$f3 = \Base::instance();
// Set up routes
$f3->route("GET /backlog/poker", "Plugin\Poker\Controller->index");
$f3->route("GET /backlog/poker/results", "Plugin\Poker\Controller->results");
$f3->route("POST /backlog/poker", "Plugin\Poker\Controller->post");
}
/**
* Install plugin (add database tables)
*/
public function _install() {
$f3 = \Base::instance();
$db = $f3->get("db.instance");
$install_db = file_get_contents(__DIR__ . "/db/database.sql");
$db->exec(explode(";", $install_db));
}
/**
* Check if plugin is installed
* @return bool
*/
public function _installed() {
$f3 = \Base::instance();
$db = $f3->get("db.instance");
$q = $db->exec("SHOW TABLES LIKE 'poker_vote'");
return !!$db->count();
}
}