ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilRepositoryObjectSearchBlockGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
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  }
53 
57  public function getBlockType(): string
58  {
59  return self::$block_type;
60  }
61 
65  protected function isRepositoryObject(): bool
66  {
67  return false;
68  }
69 
73  public static function getScreenMode(): string
74  {
75  return IL_SCREEN_SIDE;
76  }
77 
78  public function executeCommand(): void
79  {
80  $ilCtrl = $this->ctrl;
81 
82  $next_class = $ilCtrl->getNextClass();
83  $cmd = $ilCtrl->getCmd("getHTML");
84 
85  switch ($next_class) {
86  default:
87  $this->$cmd();
88  }
89  }
90 
94  protected function getLegacyContent(): string
95  {
96  $tpl = new ilTemplate("tpl.search_search_block.html", true, true, 'components/ILIAS/Search');
97 
98  $this->lng->loadLanguageModule('search');
99  $tpl->setVariable("TXT_SEARCH_INPUT_LABEL", $this->lng->txt('search_field'));
100  $tpl->setVariable("TXT_SEARCH_INPUT_PERFORM_LABEL", $this->lng->txt('search_field_perform'));
101  $tpl->setVariable("TXT_PERFORM", $this->lng->txt('btn_search'));
102  $tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass('ilrepositoryobjectsearchgui', 'performSearch'));
103 
104  $post_search_term = '';
105  if ($this->http->wrapper()->post()->has('search_term')) {
106  $post_search_term = $this->http->wrapper()->post()->retrieve(
107  'search_term',
108  $this->refinery->kindlyTo()->string()
109  );
110  }
111  $tpl->setVariable(
112  "SEARCH_TERM",
114  );
115  return $tpl->get();
116  }
117 }
get(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setEnableNumInfo(bool $a_enablenuminfo)
static getScreenMode()
Get Screen Mode for current command.
static prepareFormOutput($a_str, bool $a_strip=false)
getNextClass($a_gui_class=null)
static http()
Fetches the global http state from ILIAS.
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
ilTemplate $tpl
global $DIC
Definition: shib_login.php:26
__construct(Container $dic, ilPlugin $plugin)
setTitle(string $a_title)
This class represents a block method of a block.
const IL_SCREEN_SIDE