-
Notifications
You must be signed in to change notification settings - Fork 454
/
count_header.php
37 lines (31 loc) · 1.05 KB
/
count_header.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
namespace Concrete\Controller\Frontend\Conversations;
use Concrete\Core\Conversation\Conversation;
use Concrete\Core\Conversation\FrontendController;
use Concrete\Core\Error\UserMessageException;
use Concrete\Core\Utility\Service\Validation\Numbers;
use Symfony\Component\HttpFoundation\Response;
defined('C5_EXECUTE') or die('Access Denied.');
class CountHeader extends FrontendController
{
/**
* {@inheritdoc}
*
* @see \Concrete\Core\Controller\Controller::$viewPath
*/
protected $viewPath = '/frontend/conversations/count_header';
public function view(): ?Response
{
$conversation = null;
$cnvID = $this->request->request->get('cnvID');
if ($this->app->make(Numbers::class)->integer($cnvID, 1)) {
$cnvID = (int) $cnvID;
$conversation = Conversation::getByID($cnvID);
}
if ($conversation === null) {
throw new UserMessageException(t('Invalid Conversation.'));
}
$this->set('conversation', $conversation);
return null;
}
}