diff options
author | Freya Murphy <freya@freyacat.org> | 2024-05-24 09:05:42 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-05-24 09:05:42 -0400 |
commit | c5f39ea2cd7cf02246705ea8872d3b350526165c (patch) | |
tree | 2694f9fdc5d83b529a01f2997c1d89c271c86592 /src/web/core/_model.php | |
download | website-c5f39ea2cd7cf02246705ea8872d3b350526165c.tar.gz website-c5f39ea2cd7cf02246705ea8872d3b350526165c.tar.bz2 website-c5f39ea2cd7cf02246705ea8872d3b350526165c.zip |
initial
Diffstat (limited to 'src/web/core/_model.php')
-rw-r--r-- | src/web/core/_model.php | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/web/core/_model.php b/src/web/core/_model.php new file mode 100644 index 0000000..4c27b1b --- /dev/null +++ b/src/web/core/_model.php @@ -0,0 +1,50 @@ +<?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, $main = FALSE) { + $this->load = $load; + if ($main) { + $this->main = $this; + } else { + $this->main = $this->load->model('main'); + } + $this->db = $this->load->db(); + } + + /** + * @returns the base model data + */ + public function get_data(): ?array { + $data = array(); + + $info = $this->main->info; + $app = $info['app']; + + $data['title'] = lang('first_name'); + $data['desc'] = lang('default_short_desc'); + $data['css'] = array(); + + $style = $GLOBALS['style']; + if (isset($style[$app])) { + $css = $style[$app]; + if (!is_array($css)) + $css = array($css); + $data['css'] = $css; + } + + return $data; + } +} |