4 include_once
'Services/Search/classes/class.ilSearchResult.php';
27 $this->search_type = $a_search_type;
29 parent::__construct($ilUser->getId());
34 $this->search_type = $_search_type;
46 $ordered_entries = array();
48 $num_entries = count($a_entries);
49 foreach($this->topics as $oTopic)
51 foreach($a_entries as $aEntry)
53 if($oTopic->getId() == $aEntry[
'topic_id'])
55 $ordered_entries[$aEntry[
'ref_id']] = $aEntry;
59 if(count($ordered_entries) < $num_entries)
61 foreach($a_entries as $aEntry)
63 if(0 == $aEntry[
'topic_id'])
65 $ordered_entries[$aEntry[
'ref_id']] = $aEntry;
70 return is_array($ordered_entries) ? $ordered_entries : array();
85 public function filter($a_root_node, $check_and)
93 $tmp_entries = array();
97 if($check_and && in_array(0, $entry[
'found']))
103 if($type ==
'rolt' or $type ==
'usr' or $type ==
'role')
109 if($this->ilAccess->checkAccessOfUser($this->getUserId(),
114 if($a_root_node == ROOT_FOLDER_ID || $tree->isGrandChild($a_root_node,
$ref_id))
119 $entry[
'type'] = $type;
121 $tmp_entries[
$ref_id] = $entry;
127 $this->results = array();
131 foreach($tmp_entries as $entry)
135 $this->
addResult($entry[
'ref_id'], $entry[
'obj_id'], $entry[
'type']);
136 $this->search_cache->appendToChecked($entry[
'ref_id'], $entry[
'obj_id']);
140 $this->search_cache->setResults($this->results);
146 include_once
'Services/Payment/classes/class.ilPaymentSettings.php';
148 $this->
setMaxHits(($maxhits > 0 ? $maxhits : 20));
159 $objects_with_topics = array();
160 $objects_with_no_topcis = array();
161 $objects_of_subtree = array();
179 if(
$_GET[
'tree_ref_id'])
183 $tree_ref_id =
$_GET[
'tree_ref_id'];
185 $parent_id = $tree->getParentId($result[
'ref_id']);
187 if($tree_ref_id == $parent_id)
189 $objects_of_subtree[$result[
'ref_id']] =
$result;
192 foreach($objects_of_subtree as $result)
194 switch($result[
'type'])
205 $type = $result[
'type'];
213 'description' => $description,
214 'type' => $result[
'type'],
215 'obj_id' => $result[
'obj_id'],
216 'child' => $result[
'child']);
231 if(!(
int)$topic_id && !array_key_exists($result[
'ref_id'], $objects_with_no_topcis))
233 $objects_with_no_topcis[$result[
'ref_id']] =
$result;
237 if((
int)$topic_id != $oTopic->getId())
242 if(!array_key_exists($result[
'ref_id'], $objects_with_topics))
244 $objects_with_topics[$result[
'ref_id']] =
$result;
247 switch($result[
'type'])
258 $type = $result[
'type'];
265 if($result[
'type'] ==
'exc')
268 $subtype =
' ('.$lng->txt($check_sub[0]).
')';
272 'title' =>
$title.
' '.$subtype,
273 'description' => $description,
274 'type' => $result[
'type'],
275 'obj_id' => $result[
'obj_id'],
276 'topic_id' => $topic_id,
277 'child' => $result[
'child']);
283 if(!array_key_exists($result[
'ref_id'], $objects_with_topics) &&
284 !array_key_exists($result[
'ref_id'], $objects_with_no_topcis))
286 $objects_with_no_topcis[$result[
'ref_id']] =
$result;
289 foreach($objects_with_no_topcis as $result)
291 switch($result[
'type'])
302 $type = $result[
'type'];
310 'description' => $description,
311 'type' => $result[
'type'],
312 'obj_id' => $result[
'obj_id'],
313 'child' => $result[
'child']);
323 return is_array($this->topics) ? $this->topics : array();
327 $this->topics = $a_topics;
332 $this->result_page_number = (int)$a_result_page_number > 0 ? $a_result_page_number : 1;
341 $this->presentation_results[] = $a_presentation_result;
345 return is_array($this->presentation_results) ? $this->presentation_results : array();
352 $this->search_cache->switchSearchType($this->search_type);
355 function addEntry($a_ref_id, $a_type, $found, $a_child_id = 0)
357 global $ilObjDataCache;
359 $a_obj_id = $ilObjDataCache->lookupObjId($a_ref_id);
362 if(!$this->entries[$a_ref_id])
364 $this->entries[$a_ref_id][
'ref_id'] = $a_ref_id;
365 $this->entries[$a_ref_id][
'obj_id'] = $a_obj_id;
366 $this->entries[$a_ref_id][
'type'] = $a_type;
367 $this->entries[$a_ref_id][
'found'] = $found;
369 if($a_child_id and $a_child_id != $a_ref_id)
371 $this->entries[$a_ref_id][
'child'][$a_child_id] = $a_child_id;
377 if($a_child_id and $a_child_id != $a_obj_id)
379 $this->entries[$a_ref_id][
'child'][$a_child_id] = $a_child_id;
384 foreach($found as $position)
388 $this->entries[$a_ref_id][
'found'][$counter] = $position;
398 if($this->entries[$a_ref_id] and is_array($a_childs))
400 foreach($a_childs as $child_id)
404 $this->entries[$a_ref_id][
'child'][$child_id] = $child_id;
414 foreach($result_obj->getEntries() as $entry)
416 $this->
addEntry($entry[
'ref_id'],$entry[
'type'],$entry[
'found']);
425 $this->entries = array();
428 foreach($this->search_cache->getCheckedItems() as
$ref_id => $obj_id)
430 if(isset($new_entries[$ref_id]))
432 $this->
addEntry($new_entries[$ref_id][
'ref_id'],
433 $new_entries[$ref_id][
'type'],
434 $new_entries[$ref_id][
'found']);
436 $new_entries[$ref_id][
'child']);