1<?php
2/*
3    +-----------------------------------------------------------------------------+
4    | ILIAS open source                                                           |
5    +-----------------------------------------------------------------------------+
6    | Copyright (c) 1998-2006 ILIAS open source, University of Cologne            |
7    |                                                                             |
8    | This program is free software; you can redistribute it and/or               |
9    | modify it under the terms of the GNU General Public License                 |
10    | as published by the Free Software Foundation; either version 2              |
11    | of the License, or (at your option) any later version.                      |
12    |                                                                             |
13    | This program is distributed in the hope that it will be useful,             |
14    | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
15    | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
16    | GNU General Public License for more details.                                |
17    |                                                                             |
18    | You should have received a copy of the GNU General Public License           |
19    | along with this program; if not, write to the Free Software                 |
20    | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
21    +-----------------------------------------------------------------------------+
22*/
23
24include_once("Services/Block/classes/class.ilBlockGUI.php");
25
26/**
27* BlockGUI class for wiki searchblock
28*
29* @author Alex Killing <alex.killing@gmx.de>
30* @version $Id$
31*
32* @ingroup ModulesWiki
33*/
34class ilWikiSearchBlockGUI extends ilBlockGUI
35{
36    public static $block_type = "wikisearch";
37    public static $st_data;
38
39    /**
40    * Constructor
41    */
42    public function __construct()
43    {
44        global $DIC;
45
46        $this->ctrl = $DIC->ctrl();
47        $this->lng = $DIC->language();
48        $this->user = $DIC->user();
49        $this->access = $DIC->access();
50        $lng = $DIC->language();
51
52        parent::__construct();
53
54        $lng->loadLanguageModule("wiki");
55        $this->setEnableNumInfo(false);
56
57        $this->setTitle($lng->txt("wiki_wiki_search"));
58        $this->allow_moving = false;
59    }
60
61    /**
62     * @inheritdoc
63     */
64    public function getBlockType() : string
65    {
66        return self::$block_type;
67    }
68
69    /**
70     * @inheritdoc
71     */
72    protected function isRepositoryObject() : bool
73    {
74        return false;
75    }
76
77    /**
78    * Get Screen Mode for current command.
79    */
80    public static function getScreenMode()
81    {
82        return IL_SCREEN_SIDE;
83    }
84
85    /**
86    * execute command
87    */
88    public function executeCommand()
89    {
90        $ilCtrl = $this->ctrl;
91
92        $next_class = $ilCtrl->getNextClass();
93        $cmd = $ilCtrl->getCmd("getHTML");
94
95        switch ($next_class) {
96            default:
97                return $this->$cmd();
98        }
99    }
100
101    /**
102    * Get bloch HTML code.
103    */
104    public function getHTML()
105    {
106        $ilCtrl = $this->ctrl;
107        $lng = $this->lng;
108        $ilUser = $this->user;
109
110        return parent::getHTML();
111    }
112
113    /**
114    * Fill data section
115    */
116    public function fillDataSection()
117    {
118        $ilCtrl = $this->ctrl;
119        $lng = $this->lng;
120        $ilAccess = $this->access;
121
122        $tpl = new ilTemplate("tpl.wiki_search_block.html", true, true, "Modules/Wiki");
123
124        // go
125        $tpl->setVariable("TXT_PERFORM", $lng->txt("wiki_search"));
126        $tpl->setVariable(
127            "FORMACTION",
128            $ilCtrl->getFormActionByClass("ilobjwikigui", "performSearch")
129        );
130        $tpl->setVariable(
131            "SEARCH_TERM",
132            ilUtil::prepareFormOutput(ilUtil::stripSlashes($_POST["search_term"]))
133        );
134
135        $this->setDataSection($tpl->get());
136    }
137}
138