silverstripe-webpack/app/src/Pages/PageController.php

37 lines
849 B
PHP
Raw Normal View History

2018-04-21 06:29:32 +02:00
<?php
// vendor/silverstripe/errorpage/src/ErrorPageController.php
// extends global PageController class
//namespace Site\Pages;
use SilverStripe\CMS\Controllers\ContentController;
use SilverStripe\ORM\FieldType\DBDatetime;
2018-04-21 06:29:32 +02:00
class PageController extends ContentController
{
2018-09-15 00:55:42 +02:00
public function setSiteWideMessage($message, $type)
2018-08-06 13:46:54 +02:00
{
2018-09-15 00:55:42 +02:00
$this->getRequest()->getSession()->set(
'SiteWideMessage',
[
'Message' => $message,
'Type' => $type,
]
);
2018-08-06 13:46:54 +02:00
}
2018-09-15 00:55:42 +02:00
public function getSiteWideMessage()
2018-08-06 13:46:54 +02:00
{
2018-09-15 00:55:42 +02:00
$session = $this->getRequest()->getSession();
2018-12-03 17:12:41 +01:00
$message = $session->get('SiteWideMessage');
2018-09-15 00:55:42 +02:00
$session->clear('SiteWideMessage');
2018-12-03 17:12:41 +01:00
return $message;
2018-08-06 13:46:54 +02:00
}
public function CurrentTime()
{
return DBDatetime::now();
}
2018-04-21 06:29:32 +02:00
}