ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilRepositoryObjectSearchResultTableGUI.php
Go to the documentation of this file.
1<?php
18declare(strict_types=1);
19
21{
22 private $settings = null;
23 protected $ref_id = 0;
24 private $search_term = '';
25
26 private $results = null;
27
33 public function __construct($a_parent_obj, $a_parent_cmd, $a_ref_id)
34 {
36 $this->ref_id = $a_ref_id;
37 $this->setId('repository_object_search_result_' . $this->ref_id);
38 parent::__construct($a_parent_obj, $a_parent_cmd);
39 }
40
45 public function setSearchTerm($a_term)
46 {
47 $this->search_term = $a_term;
48 }
49
54 public function getSearchTerm()
55 {
56 return $this->search_term;
57 }
58
63 public function getSettings()
64 {
65 return $this->settings;
66 }
67
73 {
74 $this->results = $a_result;
75 }
76
77 public function getResults()
78 {
79 return $this->results;
80 }
81
85 public function init()
86 {
87 $this->initColumns();
88 $this->initRowTemplate();
89
90 global $DIC;
91
92 $ilCtrl = $DIC['ilCtrl'];
93 $lng = $DIC['lng'];
94
95 $this->setEnableHeader(true);
96 $this->setShowRowsSelector(false);
97 $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
98 $this->setLimit(0);
99 $this->setTitle(
100 $lng->txt('search_results') . ' "' . str_replace(['"'], '', ilUtil::prepareFormOutput($this->getSearchTerm())) . '"'
101 );
102 }
103
107 protected function initColumns()
108 {
109 global $DIC;
110
111 $lng = $DIC['lng'];
112
113
114 if ($this->getSettings()->enabledLucene()) {
115 $lng->loadLanguageModule('search');
116 #$this->addColumn($lng->txt("title"), "title", "80%");
117 #$this->addColumn($lng->txt("lucene_relevance_short"), "relevance", "20%");
118 $this->addColumn($lng->txt("title"), "", "80%");
119 $this->addColumn($lng->txt("lucene_relevance_short"), "", "20%");
120 } else {
121 $this->addColumn($lng->txt("title"), "", "100%");
122 }
123 }
124
128 protected function initRowTemplate()
129 {
130 $this->setRowTemplate('tpl.repository_object_search_result_row.html', 'Services/Search');
131 }
132
133
137 abstract public function parse();
138
139
143 public function getRelevanceHTML($a_rel)
144 {
145 $tpl = new ilTemplate('tpl.lucene_relevance.html', true, true, 'Services/Search');
146
147 include_once "Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php";
149 $pbar->setCurrent($a_rel);
150
151 $tpl->setCurrentBlock('relevance');
152 $tpl->setVariable('REL_PBAR', $pbar->render());
153 $tpl->parseCurrentBlock();
154
155 return $tpl->get();
156 }
157}
An exception for terminatinating execution or to throw for unit testing.
static getInstance()
Factory.
setResults(ilRepositoryObjectDetailSearchResult $a_result)
Set result object.
parse()
Parse search result set and call set data.
__construct($a_parent_obj, $a_parent_cmd, $a_ref_id)
Constructor.
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setLimit($a_limit=0, $a_default_limit=0)
set max.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
special template class to simplify handling of ITX/PEAR
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
settings()
Definition: settings.php:2