2022-09-26 23:06:12 +00:00
|
|
|
<?php
|
|
|
|
namespace Makai;
|
|
|
|
|
2023-10-12 18:45:11 +00:00
|
|
|
use Index\Environment;
|
2022-09-26 23:06:12 +00:00
|
|
|
use Index\Data\IDbConnection;
|
2023-10-12 18:45:11 +00:00
|
|
|
use Sasae\SasaeEnvironment;
|
2022-09-26 23:06:12 +00:00
|
|
|
|
|
|
|
final class MakaiContext {
|
2023-10-12 18:45:11 +00:00
|
|
|
private IDbConnection $dbConn;
|
|
|
|
private ?SasaeEnvironment $templating = null;
|
2022-09-26 23:06:12 +00:00
|
|
|
|
2023-10-12 18:45:11 +00:00
|
|
|
public function __construct(IDbConnection $dbConn) {
|
|
|
|
$this->dbConn = $dbConn;
|
2022-09-26 23:06:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getDatabase(): IDbConnection {
|
2023-10-12 18:45:11 +00:00
|
|
|
return $this->dbConn;
|
2022-09-26 23:06:12 +00:00
|
|
|
}
|
|
|
|
|
2023-10-12 18:45:11 +00:00
|
|
|
public function getTemplating(): SasaeEnvironment {
|
|
|
|
if($this->templating === null) {
|
|
|
|
$isDebug = Environment::isDebug();
|
|
|
|
|
|
|
|
$this->templating = new SasaeEnvironment(
|
|
|
|
MKI_DIR_TEMPLATES,
|
|
|
|
cache: $isDebug ? null : ['Makai', GitInfo::hash(true)],
|
|
|
|
debug: $isDebug,
|
|
|
|
);
|
|
|
|
$this->templating->addGlobal('header_nav', $this->getDefaultNavigation());
|
|
|
|
$this->templating->addGlobal('header_bgs', $this->getDefaultHeaders());
|
|
|
|
$this->templating->addGlobal('footer_quotes', $this->getFooterQuotes());
|
2022-09-26 23:06:12 +00:00
|
|
|
}
|
|
|
|
|
2023-10-12 18:45:11 +00:00
|
|
|
return $this->templating;
|
2022-09-26 23:06:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getDefaultNavigation(): array {
|
|
|
|
return [
|
|
|
|
['title' => 'Home', 'link' => '/'],
|
|
|
|
['title' => 'Projects', 'link' => '/projects'],
|
|
|
|
['title' => 'Contact', 'link' => '/contact'],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDefaultHeaders(): array {
|
|
|
|
return [
|
|
|
|
'/assets/headers/krk-000.jpg', '/assets/headers/krk-001.jpg', '/assets/headers/krk-002.jpg',
|
|
|
|
'/assets/headers/krk-003.jpg', '/assets/headers/krk-004.jpg', '/assets/headers/krk-005.jpg',
|
|
|
|
'/assets/headers/krk-006.jpg', '/assets/headers/krk-007.jpg', '/assets/headers/krk-008.jpg',
|
|
|
|
|
|
|
|
'/assets/headers/mkt-000.jpg', '/assets/headers/mkt-001.jpg', '/assets/headers/mkt-002.jpg',
|
|
|
|
'/assets/headers/mkt-003.jpg', '/assets/headers/mkt-004.jpg', '/assets/headers/mkt-005.jpg',
|
|
|
|
'/assets/headers/mkt-006.jpg', '/assets/headers/mkt-007.jpg', '/assets/headers/mkt-008.jpg',
|
|
|
|
'/assets/headers/mkt-009.jpg', '/assets/headers/mkt-010.jpg', '/assets/headers/mkt-011.jpg',
|
|
|
|
'/assets/headers/mkt-012.jpg', '/assets/headers/mkt-013.jpg', '/assets/headers/mkt-014.jpg',
|
|
|
|
'/assets/headers/mkt-015.jpg', '/assets/headers/mkt-016.jpg', '/assets/headers/mkt-017.jpg',
|
|
|
|
'/assets/headers/mkt-018.jpg', '/assets/headers/mkt-019.jpg', '/assets/headers/mkt-020.jpg',
|
|
|
|
'/assets/headers/mkt-021.jpg', '/assets/headers/mkt-022.jpg', '/assets/headers/mkt-023.jpg',
|
|
|
|
'/assets/headers/mkt-024.jpg', '/assets/headers/mkt-025.jpg', '/assets/headers/mkt-026.jpg',
|
|
|
|
'/assets/headers/mkt-027.jpg', '/assets/headers/mkt-028.jpg', '/assets/headers/mkt-029.jpg',
|
|
|
|
'/assets/headers/mkt-030.jpg', '/assets/headers/mkt-031.jpg', '/assets/headers/mkt-032.jpg',
|
|
|
|
'/assets/headers/mkt-033.jpg', '/assets/headers/mkt-034.jpg', '/assets/headers/mkt-035.jpg',
|
|
|
|
'/assets/headers/mkt-036.jpg', '/assets/headers/mkt-037.jpg', '/assets/headers/mkt-038.jpg',
|
|
|
|
'/assets/headers/mkt-039.jpg', '/assets/headers/mkt-040.jpg', '/assets/headers/mkt-041.jpg',
|
|
|
|
'/assets/headers/mkt-042.jpg', '/assets/headers/mkt-043.jpg', '/assets/headers/mkt-044.jpg',
|
|
|
|
'/assets/headers/mkt-045.jpg', '/assets/headers/mkt-046.jpg', '/assets/headers/mkt-047.jpg',
|
|
|
|
'/assets/headers/mkt-048.jpg', '/assets/headers/mkt-049.jpg', '/assets/headers/mkt-050.jpg',
|
|
|
|
'/assets/headers/mkt-051.jpg', '/assets/headers/mkt-052.jpg', '/assets/headers/mkt-053.jpg',
|
|
|
|
'/assets/headers/mkt-054.jpg', '/assets/headers/mkt-055.jpg', '/assets/headers/mkt-056.jpg',
|
|
|
|
'/assets/headers/mkt-057.jpg', '/assets/headers/mkt-058.jpg', '/assets/headers/mkt-059.jpg',
|
|
|
|
'/assets/headers/mkt-060.jpg', '/assets/headers/mkt-061.jpg', '/assets/headers/mkt-062.jpg',
|
|
|
|
'/assets/headers/mkt-063.jpg',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getFooterQuotes(): array {
|
|
|
|
return [
|
|
|
|
'if it ain\'t broke, i\'ll break it',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|