diff options
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; + } +} |