summaryrefslogtreecommitdiff
path: root/web/core/_model.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--web/core/_model.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/web/core/_model.php b/web/core/_model.php
new file mode 100644
index 0000000..936fab4
--- /dev/null
+++ b/web/core/_model.php
@@ -0,0 +1,44 @@
+<?php /* Copyright (c) 2024 Freya Murphy */
+abstract class Model {
+ // the main model
+ // shared by all controllers and models
+ public $main;
+ public $load;
+
+ // the database
+ public $db;
+
+ private $config;
+
+ /**
+ * Creates a model
+ * @param Loader $load - the main loader object
+ */
+ function __construct($load) {
+ $this->load = $load;
+ $this->main = $this->load->model('main');
+ $this->db = $this->main->db;
+ $this->config = new Aesthetic();
+ }
+
+ /**
+ * @returns the base model data
+ */
+ public function get_data(): array {
+ $data = array();
+ $data['self'] = $this->main->user();
+
+ $info = $this->main->info;
+ $app = $info['app'];
+
+ if ($app) {
+ $files = $this->config->get_files($app);
+ $data = array_merge($data, $files);
+ } else {
+ $files = $this->config->get_files();
+ $data = array_merge($data, $files);
+ }
+
+ return $data;
+ }
+}