2022-04-09 10:01:42 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2022-04-12 19:41:51 +00:00
|
|
|
* @package Octoleo CMS
|
2022-04-09 10:01:42 +00:00
|
|
|
*
|
2022-04-12 19:41:51 +00:00
|
|
|
* @created 9th April 2022
|
|
|
|
* @author Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
|
|
|
* @git WEBD-325-45 <https://git.vdm.dev/Llewellyn/WEBD-325-45>
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
2022-04-09 10:01:42 +00:00
|
|
|
*/
|
|
|
|
|
2022-04-12 19:41:51 +00:00
|
|
|
namespace Octoleo\CMS\View\Page;
|
2022-04-09 10:01:42 +00:00
|
|
|
|
2022-04-12 19:41:51 +00:00
|
|
|
use Octoleo\CMS\Model\PageModel;
|
2022-04-09 10:01:42 +00:00
|
|
|
use Joomla\Renderer\RendererInterface;
|
|
|
|
use Joomla\View\HtmlView;
|
|
|
|
|
|
|
|
/**
|
2022-04-12 19:41:51 +00:00
|
|
|
* Page HTML view class for the application
|
2022-04-09 10:01:42 +00:00
|
|
|
*/
|
2022-04-12 19:41:51 +00:00
|
|
|
class PageHtmlView extends HtmlView
|
2022-04-09 10:01:42 +00:00
|
|
|
{
|
|
|
|
/**
|
2022-04-12 19:41:51 +00:00
|
|
|
* The active page
|
2022-04-09 10:01:42 +00:00
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2022-04-12 19:41:51 +00:00
|
|
|
private $page = '';
|
2022-04-09 10:01:42 +00:00
|
|
|
|
|
|
|
/**
|
2022-04-12 19:41:51 +00:00
|
|
|
* The active page details
|
2022-04-09 10:01:42 +00:00
|
|
|
*
|
2022-04-12 19:41:51 +00:00
|
|
|
* @var string
|
2022-04-09 10:01:42 +00:00
|
|
|
*/
|
2022-04-12 19:41:51 +00:00
|
|
|
private $details;
|
2022-04-09 10:01:42 +00:00
|
|
|
|
|
|
|
/**
|
2022-04-12 19:41:51 +00:00
|
|
|
* The page model object.
|
2022-04-09 10:01:42 +00:00
|
|
|
*
|
2022-04-12 19:41:51 +00:00
|
|
|
* @var PageModel
|
2022-04-09 10:01:42 +00:00
|
|
|
*/
|
2022-04-12 19:41:51 +00:00
|
|
|
private $pageModel;
|
2022-04-09 10:01:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Instantiate the view.
|
|
|
|
*
|
2022-04-12 19:41:51 +00:00
|
|
|
* @param PageModel $pageModel The page model object.
|
2022-04-09 10:01:42 +00:00
|
|
|
* @param RendererInterface $renderer The renderer object.
|
|
|
|
*/
|
2022-04-12 19:41:51 +00:00
|
|
|
public function __construct(PageModel $pageModel, RendererInterface $renderer)
|
2022-04-09 10:01:42 +00:00
|
|
|
{
|
|
|
|
parent::__construct($renderer);
|
|
|
|
|
2022-04-12 19:41:51 +00:00
|
|
|
$this->pageModel = $pageModel;
|
2022-04-09 10:01:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to render the view
|
|
|
|
*
|
|
|
|
* @return string The rendered view
|
|
|
|
*/
|
|
|
|
public function render()
|
|
|
|
{
|
|
|
|
$this->setData(
|
|
|
|
[
|
2022-04-12 19:41:51 +00:00
|
|
|
'page' => $this->pageModel->getPage($this->page),
|
|
|
|
'details' => $this->pageModel->getDetails($this->details)
|
2022-04-09 10:01:42 +00:00
|
|
|
]
|
|
|
|
);
|
|
|
|
|
|
|
|
return parent::render();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-04-12 19:41:51 +00:00
|
|
|
* Set the active page
|
|
|
|
*
|
|
|
|
* @param string $page The active page name
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function setPage(string $page): void
|
|
|
|
{
|
|
|
|
$this->page = $page;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the active page details
|
2022-04-09 10:01:42 +00:00
|
|
|
*
|
2022-04-12 19:41:51 +00:00
|
|
|
* @param string $page The active page name
|
2022-04-09 10:01:42 +00:00
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2022-04-12 19:41:51 +00:00
|
|
|
public function setDetails(string $details): void
|
2022-04-09 10:01:42 +00:00
|
|
|
{
|
2022-04-12 19:41:51 +00:00
|
|
|
$this->details = $details;
|
2022-04-09 10:01:42 +00:00
|
|
|
}
|
|
|
|
}
|