ILIAS  release_8 Revision v8.24
class.ilRepositoryObjectSearchResultTableGUI.php
Go to the documentation of this file.
1<?php
2
20declare(strict_types=1);
21
23{
25 protected int $ref_id;
26 private string $search_term;
27
29
30 public function __construct(object $a_parent_obj, string $a_parent_cmd, int $a_ref_id)
31 {
33 $this->ref_id = $a_ref_id;
34 $this->setId('rep_obj_search_res_' . $this->ref_id);
35 parent::__construct($a_parent_obj, $a_parent_cmd);
36 }
37
38 public function setSearchTerm(string $a_term): void
39 {
40 $this->search_term = $a_term;
41 }
42
43 public function getSearchTerm(): string
44 {
45 return $this->search_term;
46 }
47
48 public function getSettings(): ilSearchSettings
49 {
50 return $this->settings;
51 }
52
53 public function setResults(ilRepositoryObjectDetailSearchResult $a_result): void
54 {
55 $this->results = $a_result;
56 }
57
59 {
60 return $this->results;
61 }
62
63 public function init(): void
64 {
65 $this->initColumns();
66 $this->initRowTemplate();
67
68 $this->setEnableHeader(true);
69 $this->setShowRowsSelector(false);
70 $this->setFormAction($this->ctrl->getFormAction($this->getParentObject()));
71 $this->setLimit(0);
72
73 $this->setTitle(
74 $this->lng->txt('search_results') . ' "' . str_replace(['"'], '', ilLegacyFormElementsUtil::prepareFormOutput($this->getSearchTerm())) . '"'
75 );
76 }
77
78 protected function initColumns(): void
79 {
80 if ($this->getSettings()->enabledLucene()) {
81 $this->lng->loadLanguageModule('search');
82 $this->addColumn($this->lng->txt("title"), "", "80%");
83 $this->addColumn($this->lng->txt("lucene_relevance_short"), "", "20%");
84 } else {
85 $this->addColumn($this->lng->txt("title"), "", "100%");
86 }
87 }
88
89 protected function initRowTemplate(): void
90 {
91 $this->setRowTemplate('tpl.repository_object_search_result_row.html', 'Services/Search');
92 }
93
94
95 abstract public function parse();
96
97
98 public function getRelevanceHTML(float $a_rel): string
99 {
100 $tpl = new ilTemplate('tpl.lucene_relevance.html', true, true, 'Services/Search');
101
103 $pbar->setCurrent($a_rel);
104
105 $tpl->setCurrentBlock('relevance');
106 $tpl->setVariable('REL_PBAR', $pbar->render());
107 $tpl->parseCurrentBlock();
108
109 return $tpl->get();
110 }
111}
static prepareFormOutput($a_str, bool $a_strip=false)
__construct(object $a_parent_obj, string $a_parent_cmd, int $a_ref_id)
setResults(ilRepositoryObjectDetailSearchResult $a_result)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setEnableHeader(bool $a_enableheader)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
special template class to simplify handling of ITX/PEAR
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc