~xibo-maintainers/xibo/tempel

« back to all changes in this revision

Viewing changes to lib/Controller/Help.php

  • Committer: Dan Garner
  • Date: 2015-09-29 15:16:59 UTC
  • mto: (454.2.11) (471.2.2)
  • mto: This revision was merged to the branch mainline in revision 468.
  • Revision ID: git-v1:ae24387a7b1397750b6ec86d0f286373da05eb16
Fixed Display Version Information Form (not showing media name)

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
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;
29
 
 
30
 
/**
31
 
 * Class Help
32
 
 * @package Xibo\Controller
33
 
 */
 
25
use Xibo\Helper\Sanitize;
 
26
 
 
27
 
34
28
class Help extends Base
35
29
{
36
30
    /**
37
 
     * @var HelpFactory
38
 
     */
39
 
    private $helpFactory;
40
 
 
41
 
    /**
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
51
 
     */
52
 
    public function __construct($log, $sanitizerService, $state, $user, $help, $date, $config, $helpFactory)
53
 
    {
54
 
        $this->setCommonDependencies($log, $sanitizerService, $state, $user, $help, $date, $config);
55
 
 
56
 
        $this->helpFactory = $helpFactory;
57
 
    }
58
 
 
59
 
    /**
60
31
     * Help Page
61
32
     */
62
33
    function displayPage()
66
37
 
67
38
    public function grid()
68
39
    {
69
 
        $helpLinks = $this->helpFactory->query($this->gridRenderSort(), $this->gridRenderFilter());
 
40
        $helpLinks = HelpFactory::query($this->gridRenderSort(), $this->gridRenderFilter());
70
41
 
71
42
        foreach ($helpLinks as $row) {
72
43
            /* @var \Xibo\Entity\Help $row */
91
62
                // Test
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')
96
67
                );
97
68
            }
98
69
        }
99
70
 
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);
103
74
    }
104
75
 
122
93
        if ($this->getUser()->userTypeId != 1)
123
94
            throw new AccessDeniedException();
124
95
 
125
 
        $help = $this->helpFactory->getById($helpId);
 
96
        $help = HelpFactory::getById($helpId);
126
97
 
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();
141
112
 
142
 
        $help = $this->helpFactory->getById($helpId);
 
113
        $help = HelpFactory::getById($helpId);
143
114
 
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();
157
128
 
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');
162
133
 
163
134
        $help->save();
164
135
 
179
150
        if ($this->getUser()->userTypeId != 1)
180
151
            throw new AccessDeniedException();
181
152
 
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');
186
157
 
187
158
        $help->save();
188
159
 
204
175
        if ($this->getUser()->userTypeId != 1)
205
176
            throw new AccessDeniedException();
206
177
 
207
 
        $help = $this->helpFactory->getById($helpId);
 
178
        $help = HelpFactory::getById($helpId);
208
179
        $help->delete();
209
180
 
210
181
        // Return