45 lines
860 B
PHP
45 lines
860 B
PHP
|
<?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;
|
||
|
}
|
||
|
}
|