aboutsummaryrefslogtreecommitdiff
path: root/classes/CinIsis.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/CinIsis.php')
-rw-r--r--classes/CinIsis.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/classes/CinIsis.php b/classes/CinIsis.php
new file mode 100644
index 0000000..300bd61
--- /dev/null
+++ b/classes/CinIsis.php
@@ -0,0 +1,40 @@
+<?php
+
+/**
+ * CinIsis main class.
+ */
+class CinIsis {
+ /**
+ * @var $db
+ * Database resource.
+ */
+ var $db;
+
+ /**
+ * @var $implementation
+ * Database implementation.
+ */
+ var $implementation;
+
+ /**
+ * Constructor.
+ *
+ * @param $config
+ * Alternative config file (defaults to 'config/config.yaml').
+ */
+ function __construct($config = NULL) {
+ if ($config == NULL) {
+ $config = 'config/config.yaml';
+ }
+
+ // Load configuration.
+ $config = Spyc::YAMLLoad($config);
+
+ // Load database schema.
+ $schema = Spyc::YAMLLoad('schemas/'. $config['database'] .'.yaml');
+
+ // Setup database connection.
+ $this->implementation = $config['implementation'] .'Db';
+ $this->db = new $this->implementation($schema);
+ }
+}