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: $this->connect();
28: parent::__construct();
29:
30: // set content type td xml
31: $this->contentType("Content-type: application/xml;charset=utf-8");
32: }
33:
34: /**
35: * Default-DeConstructor
36: */
37: public function __destruct() {
38:
39: // destroy the sqlManager
40: $this->sqlManager->closeConnection();
41: unset($this->sqlManager);
42: $this->sqlManager = null;
43: }
44:
45: /**
46: * Method start a connection to the database
47: */
48: public function connect() {
49: $this->sqlManager->connect();
50: }
51:
52: }
53:
54: ?>
55: