1<?php
2
3use dokuwiki\Extension\AdminPlugin;
4
5/**
6 * Class admin_plugin_newsfeed_stream
7 * @author Michal Červeňák <miso@fykos.cz>
8 */
9class admin_plugin_newsfeed_stream extends AdminPlugin {
10
11    private helper_plugin_newsfeed $helper;
12
13    public function __construct() {
14        $this->helper = $this->loadHelper('newsfeed');
15    }
16
17    public function getMenuSort(): int {
18        return 290;
19    }
20
21    public function forAdminOnly(): bool {
22        return false;
23    }
24
25    public function getMenuText($lang): string {
26        return $this->getLang('stream_menu');
27    }
28
29    public function html(): void {
30        echo '<h1>' . $this->getLang('stream_list') . '</h1>';
31        $streams = $this->helper->serviceStream->getAll();
32        echo('<ul>');
33        foreach ($streams as $stream) {
34            echo '<li class="form-group row"><span class="col-3">' . $stream->name . '</span>';
35            echo '<input type="text" class="col-9 form-control" value="' .
36                hsc('{{news-stream>stream="' . $stream->name . '" feed="5"}}') . '" />';
37            echo '</li>';
38        }
39        echo '</ul>';
40        echo '</div>';
41    }
42
43}
44