23
23
use Xibo\Exception\AccessDeniedException;
24
24
use Xibo\Factory\HelpFactory;
25
use Xibo\Service\ConfigServiceInterface;
26
use Xibo\Service\DateServiceInterface;
27
use Xibo\Service\LogServiceInterface;
28
use Xibo\Service\SanitizerServiceInterface;
32
* @package Xibo\Controller
25
use Xibo\Helper\Sanitize;
34
28
class Help extends Base
42
* Set common dependencies.
43
* @param LogServiceInterface $log
44
* @param SanitizerServiceInterface $sanitizerService
45
* @param \Xibo\Helper\ApplicationState $state
46
* @param \Xibo\Entity\User $user
47
* @param \Xibo\Service\HelpServiceInterface $help
48
* @param DateServiceInterface $date
49
* @param ConfigServiceInterface $config
50
* @param HelpFactory $helpFactory
52
public function __construct($log, $sanitizerService, $state, $user, $help, $date, $config, $helpFactory)
54
$this->setCommonDependencies($log, $sanitizerService, $state, $user, $help, $date, $config);
56
$this->helpFactory = $helpFactory;
62
33
function displayPage()
67
38
public function grid()
69
$helpLinks = $this->helpFactory->query($this->gridRenderSort(), $this->gridRenderFilter());
40
$helpLinks = HelpFactory::query($this->gridRenderSort(), $this->gridRenderFilter());
71
42
foreach ($helpLinks as $row) {
72
43
/* @var \Xibo\Entity\Help $row */
92
63
$row->buttons[] = array(
93
64
'id' => 'help_button_test',
94
'url' => $this->getHelp()->link($row->topic, $row->category),
65
'url' => \Xibo\Helper\Help::Link($row->topic, $row->category),
95
66
'text' => __('Test')
100
71
$this->getState()->template = 'grid';
101
$this->getState()->recordsTotal = $this->helpFactory->countLast();
72
$this->getState()->recordsTotal = HelpFactory::countLast();
102
73
$this->getState()->setData($helpLinks);
122
93
if ($this->getUser()->userTypeId != 1)
123
94
throw new AccessDeniedException();
125
$help = $this->helpFactory->getById($helpId);
96
$help = HelpFactory::getById($helpId);
127
98
$this->getState()->template = 'help-form-edit';
128
99
$this->getState()->setData([
139
110
if ($this->getUser()->userTypeId != 1)
140
111
throw new AccessDeniedException();
142
$help = $this->helpFactory->getById($helpId);
113
$help = HelpFactory::getById($helpId);
144
115
$this->getState()->template = 'help-form-delete';
145
116
$this->getState()->setData([
155
126
if ($this->getUser()->userTypeId != 1)
156
127
throw new AccessDeniedException();
158
$help = $this->helpFactory->createEmpty();
159
$help->topic = $this->getSanitizer()->getString('topic');
160
$help->category = $this->getSanitizer()->getString('category');
161
$help->link = $this->getSanitizer()->getString('link');
129
$help = new \Xibo\Entity\Help();
130
$help->topic = Sanitize::getString('topic');
131
$help->category = Sanitize::getString('category');
132
$help->link = Sanitize::getString('link');
179
150
if ($this->getUser()->userTypeId != 1)
180
151
throw new AccessDeniedException();
182
$help = $this->helpFactory->getById($helpId);
183
$help->topic = $this->getSanitizer()->getString('topic');
184
$help->category = $this->getSanitizer()->getString('category');
185
$help->link = $this->getSanitizer()->getString('link');
153
$help = HelpFactory::getById($helpId);
154
$help->topic = Sanitize::getString('topic');
155
$help->category = Sanitize::getString('category');
156
$help->link = Sanitize::getString('link');