ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilRepositoryObjectSearchResultTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 include_once './Services/Table/classes/class.ilTable2GUI.php';
4 
6 {
7  private $settings = null;
8  protected $ref_id = 0;
9  private $search_term = '';
10 
11  private $results = null;
12 
18  public function __construct($a_parent_obj, $a_parent_cmd, $a_ref_id)
19  {
21  $this->ref_id = $a_ref_id;
22  $this->setId('repository_object_search_result_'.$this->ref_id);
23  parent::__construct($a_parent_obj, $a_parent_cmd);
24  }
25 
30  public function setSearchTerm($a_term)
31  {
32  $this->search_term = $a_term;
33  }
34 
39  public function getSearchTerm()
40  {
41  return $this->search_term;
42  }
43 
48  public function getSettings()
49  {
50  return $this->settings;
51  }
52 
58  {
59  $this->results = $a_result;
60  }
61 
62  public function getResults()
63  {
64  return $this->results;
65  }
66 
70  public function init()
71  {
72  $this->initColumns();
73  $this->initRowTemplate();
74 
75  global $ilCtrl, $lng;
76 
77  $this->setEnableHeader(true);
78  $this->setShowRowsSelector(FALSE);
79  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
80  $this->setLimit(0);
81 
82  $this->setTitle($lng->txt('search_results').' "'.str_replace(array('"'), '', $this->getSearchTerm()).'"');
83  }
84 
88  protected function initColumns()
89  {
90  global $lng;
91 
92 
93  if($this->getSettings()->enabledLucene())
94  {
95  $lng->loadLanguageModule('search');
96  #$this->addColumn($lng->txt("title"), "title", "80%");
97  #$this->addColumn($lng->txt("lucene_relevance_short"), "relevance", "20%");
98  $this->addColumn($lng->txt("title"), "", "80%");
99  $this->addColumn($lng->txt("lucene_relevance_short"), "", "20%");
100  }
101  else
102  {
103  $this->addColumn($lng->txt("title"), "", "100%");
104  }
105  }
106 
110  protected function initRowTemplate()
111  {
112  $this->setRowTemplate('tpl.repository_object_search_result_row.html','Services/Search');
113  }
114 
115 
119  abstract public function parse();
120 
121 
125  public function getRelevanceHTML($a_rel)
126  {
127  $tpl = new ilTemplate('tpl.lucene_relevance.html',true,true,'Services/Search');
128 
129  include_once "Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php";
130  $pbar = ilProgressBar::getInstance();
131  $pbar->setCurrent($a_rel);
132 
133  $tpl->setCurrentBlock('relevance');
134  $tpl->setVariable('REL_PBAR', $pbar->render());
135  $tpl->parseCurrentBlock();
136 
137  return $tpl->get();
138  }
139 
140 
141 }
142 ?>
setId($a_val)
Set id.
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
static getInstance()
Factory.
special template class to simplify handling of ITX/PEAR
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
settings()
Definition: settings.php:2
parse()
Parse search result set and call set data.
global $lng
Definition: privfeed.php:17
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setEnableHeader($a_enableheader)
Set Enable Header.
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.
setResults(ilRepositoryObjectDetailSearchResult $a_result)
Set result object.
setLimit($a_limit=0, $a_default_limit=0)
__construct($a_parent_obj, $a_parent_cmd, $a_ref_id)
Constructor.