/
controller.php
76 lines (63 loc) · 2.12 KB
/
controller.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
namespace Concrete\Block\DesktopWaitingForMe;
use Concrete\Core\Block\BlockController;
use Concrete\Core\Block\View\BlockView;
use Concrete\Core\Notification\Alert\Filter\FilterListFactory;
use Concrete\Core\User\User;
use Concrete\Core\Workflow\Progress\Category;
use Core;
use Concrete\Core\Notification\Alert\AlertList;
defined('C5_EXECUTE') or die("Access Denied.");
class Controller extends BlockController
{
public $helpers = array('form');
protected $btInterfaceWidth = 450;
protected $btInterfaceHeight = 560;
public function getBlockTypeDescription()
{
return t("Displays workflow actions waiting for you.");
}
public function getBlockTypeName()
{
return t("Waiting for Me");
}
public function view()
{
$this->requireAsset('core/notification');
$filterValues = ['' => t('** Show All')];
$factory = $this->app->make(FilterListFactory::class);
$filterList = $factory->createList();
$filters = $filterList->getFilters();
foreach($filters as $filter) {
$filterValues[$filter->getKey()] = $filter->getName();
}
$u = $this->app->make(User::class);
$list = $this->app->make(AlertList::class, ['user' => $u]);
$filter = (string) $this->request->query->get('filter');
if ($filter !== '') {
$filterObject = $filterList->getFilterByKey($filter);
if ($filterObject) {
$filterObject->filterAlertList($list);
} else {
$filter = '';
}
}
$pagination = $list->getPagination();
$alerts = $pagination->getCurrentPageResults();
if (!$alerts) {
$alerts = [];
}
$this->set('items', $alerts);
$this->set('filterValues', $filterValues);
$this->set('token', $this->app->make('token'));
$this->set('pagination', $pagination);
$this->set('filter', $filter);
}
public function action_reload_results()
{
$b = $this->getBlockObject();
$bv = new BlockView($b);
$bv->render('view');
exit;
}
}