ILIAS  release_8 Revision v8.24
class.ilRepositoryObjectSearchBlockGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
32{
33 private \ILIAS\HTTP\GlobalHttpState $http;
34 private \ILIAS\Refinery\Factory $refinery;
35
36
37 public static string $block_type = "objectsearch";
38
39 public function __construct(string $a_title)
40 {
41 global $DIC;
42
44
45 $this->http = $DIC->http();
46 $this->refinery = $DIC->refinery();
47
48 $this->setEnableNumInfo(false);
49
50 $this->setTitle($a_title);
51 $this->allow_moving = false;
52 $this->new_rendering = true;
53 }
54
58 public function getBlockType(): string
59 {
60 return self::$block_type;
61 }
62
66 protected function isRepositoryObject(): bool
67 {
68 return false;
69 }
70
74 public static function getScreenMode(): string
75 {
76 return IL_SCREEN_SIDE;
77 }
78
79 public function executeCommand(): void
80 {
81 $ilCtrl = $this->ctrl;
82
83 $next_class = $ilCtrl->getNextClass();
84 $cmd = $ilCtrl->getCmd("getHTML");
85
86 switch ($next_class) {
87 default:
88 $this->$cmd();
89 }
90 }
91
92 public function getHTML(): string
93 {
94 return parent::getHTML();
95 }
96
97 public function fillDataSection(): void
98 {
99 $this->setDataSection($this->getLegacyContent());
100 }
101
105 protected function getLegacyContent(): string
106 {
107 $tpl = new ilTemplate("tpl.search_search_block.html", true, true, 'Services/Search');
108
109 $this->lng->loadLanguageModule('search');
110 $tpl->setVariable("TXT_SEARCH_INPUT_LABEL", $this->lng->txt('search_field'));
111 $tpl->setVariable("TXT_SEARCH_INPUT_PERFORM_LABEL", $this->lng->txt('search_field_perform'));
112 $tpl->setVariable("TXT_PERFORM", $this->lng->txt('btn_search'));
113 $tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass('ilrepositoryobjectsearchgui', 'performSearch'));
114
115 $post_search_term = '';
116 if ($this->http->wrapper()->post()->has('search_term')) {
117 $post_search_term = $this->http->wrapper()->post()->retrieve(
118 'search_term',
119 $this->refinery->kindlyTo()->string()
120 );
121 }
123 "SEARCH_TERM",
125 );
126 return $tpl->get();
127 }
128}
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
const IL_SCREEN_SIDE
This class represents a block method of a block.
setDataSection(string $a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
setTitle(string $a_title)
ilTemplate $tpl
setEnableNumInfo(bool $a_enablenuminfo)
getNextClass($a_gui_class=null)
@inheritDoc
static prepareFormOutput($a_str, bool $a_strip=false)
isRepositoryObject()
Returns whether block has a corresponding repository object.
static getScreenMode()
Get Screen Mode for current command.
fillDataSection()
Standard implementation for row based data.
special template class to simplify handling of ITX/PEAR
get(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
Returns a block with all replacements done.
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc