1: <?php
2:
3: namespace api;
4:
5: include_once "../../global.inc.php";
6: include_once PATH_DATABASE . "/SQLManager.php";
7: require_once PATH_3PARTY . "/Slim/Slim.php";
8: \Slim\Slim::registerAutoloader();
9:
10: /**
11: * This class provides some general API methods
12: * @author stubbfel
13: * @since 20.06.2013
14: */
15: abstract class Api extends \Slim\Slim {
16:
17: /**
18: * Variable for the sql manager of the api
19: * @var <T>:SqlManager
20: */
21: protected $sqlManager;
22:
23: /**
24: * Default-Constructor
25: */
26: public function __construct() {
27: if (!$this->sqlManager) {
28: $this->sqlManager = new \database\SQLManager();
29: }
30: $this->connect();
31: parent::__construct();
32: }
33:
34: /**
35: * Default-DeConstructor
36: */
37: public function __destruct() {
38: $this->sqlManager = null;
39: }
40:
41: /**
42: * Method start a connection to the database
43: */
44: public function connect() {
45: $this->sqlManager->connect();
46: }
47:
48: }
49:
50: ?>
51: