ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilSearchResultTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Table/classes/class.ilTable2GUI.php");
5
15{
16
20 function __construct($a_parent_obj, $a_parent_cmd, $a_presenter)
21 {
22 global $ilCtrl, $lng, $ilAccess, $lng;
23
24 $this->setId("ilSearchResultsTable");
25
26 $this->presenter = $a_presenter;
27 parent::__construct($a_parent_obj, $a_parent_cmd);
28 $this->setTitle($lng->txt("search_results"));
29 $this->setLimit(999);
30// $this->setId("srcres");
31
32 //$this->addColumn("", "", "1", true);
33 #$this->addColumn($this->lng->txt("type"), "type", "1");
34 #$this->addColumn($this->lng->txt("search_title_description"), "title_sort");
35 $this->addColumn($this->lng->txt("type"), "type", "1");
36 $this->addColumn($this->lng->txt("search_title_description"), "title");
37 if($this->enabledRelevance())
38 {
39 #$this->addColumn($this->lng->txt('lucene_relevance_short'),'s_relevance','50px');
40 $this->addColumn($this->lng->txt('lucene_relevance_short'),'relevance','50px');
41 $this->setDefaultOrderField("s_relevance");
42 $this->setDefaultOrderDirection("desc");
43 }
44 $this->addColumn($this->lng->txt("actions"), "", "10px");
45
46 $this->setEnableHeader(true);
47 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
48 $this->setRowTemplate("tpl.search_result_row.html", "Services/Search");
49 //$this->disable("footer");
50 $this->setEnableTitle(true);
51 $this->setEnableNumInfo(false);
52
53 include_once "Services/Object/classes/class.ilObjectActivation.php";
54 }
55
56 public function numericOrdering($a_field)
57 {
58 switch($a_field)
59 {
60 case 'relevance':
61 return true;
62 }
63
64
65 return parent::numericOrdering($a_field);
66 }
67
71 protected function fillRow($a_set)
72 {
73 global $lng, $objDefinition;
74
75 $obj_id = $a_set["obj_id"];
76 $ref_id = $a_set["ref_id"];
77 $type = $a_set['type'];
78 $title = $a_set['title'];
79 $description = $a_set['description'];
80 $relevance = $a_set['relevance'];
81
82 if(!$type)
83 {
84 return false;
85 }
86
87 include_once './Services/Search/classes/Lucene/class.ilLuceneSearchObjectListGUIFactory.php';
88 $item_list_gui = ilLuceneSearchObjectListGUIFactory::factory($type);
89 $item_list_gui->initItem($ref_id,$obj_id,$title,$description);
90 $item_list_gui->setContainerObject($this->parent_obj);
91 $item_list_gui->setSearchFragment($this->presenter->lookupContent($obj_id,0));
92 $item_list_gui->setSeparateCommands(true);
93
95
96 $this->presenter->appendAdditionalInformation($item_list_gui,$ref_id,$obj_id,$type);
97
98 $this->tpl->setVariable("ACTION_HTML", $item_list_gui->getCommandsHTML());
99
100 if($html = $item_list_gui->getListItemHTML($ref_id,$obj_id,$title,$description))
101 {
102 $item_html[$ref_id]['html'] = $html;
103 $item_html[$ref_id]['type'] = $type;
104 }
105
106 $this->tpl->setVariable("HREF_IMG", $item_list_gui->default_command["link"]);
107
108 global $lng;
109
110 if($this->enabledRelevance())
111 {
112 include_once "Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php";
114 $pbar->setCurrent($relevance);
115
116 $this->tpl->setCurrentBlock('relev');
117 $this->tpl->setVariable('REL_PBAR', $pbar->render());
118 $this->tpl->parseCurrentBlock();
119 }
120
121 $this->tpl->setVariable("ITEM_HTML", $html);
122
123 if(!$objDefinition->isPlugin($type))
124 {
125 $type_txt = $lng->txt('icon').' '.$lng->txt('obj_'.$type);
126 $icon = ilObject::_getIcon($obj_id,'small',$type);
127 }
128 else
129 {
130 include_once("./Services/Component/classes/class.ilPlugin.php");
131 $type_txt = ilPlugin::lookupTxt("rep_robj", $type, "obj_".$type);
132 $icon = ilObject::_getIcon($obj_id,'small',$type);
133 }
134
135 $this->tpl->setVariable(
136 "TYPE_IMG",
138 $icon,
139 $type_txt,
140 '',
141 '',
142 0,
143 '',
144 'ilIcon'
145 )
146 );
147 }
148
153 protected function enabledRelevance()
154 {
155 return ilSearchSettings::getInstance()->enabledLucene() and ilSearchSettings::getInstance()->isRelevanceVisible();
156 }
157
158}
159?>
static factory($a_type)
Get list gui by type This method caches all the returned list guis.
static addListGUIActivationProperty(ilObjectListGUI $a_list_gui, array &$a_item)
Get timing details for list gui.
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
Lookup language text.
static getInstance()
Factory.
TableGUI class for search results.
enabledRelevance()
Check if relevance is visible.
numericOrdering($a_field)
Should this field be sorted numeric?
__construct($a_parent_obj, $a_parent_cmd, $a_presenter)
Constructor.
Class ilTable2GUI.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="")
Add a column to the header.
setEnableHeader($a_enableheader)
Set Enable Header.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setEnableTitle($a_enabletitle)
Set Enable Title.
setEnableNumInfo($a_val)
Set enable num info.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setLimit($a_limit=0, $a_default_limit=0)
set max.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
$ref_id
Definition: sahs_server.php:39