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)
95 $tmp_entries = array();
99 if($check_and && in_array(0, $entry[
'found']))
111 if($this->ilAccess->checkAccessOfUser($this->getUserId(),
116 if($a_root_node == ROOT_FOLDER_ID || $tree->isGrandChild($a_root_node,
$ref_id))
121 $entry[
'type'] =
$type;
123 $tmp_entries[
$ref_id] = $entry;
129 $this->results = array();
134 foreach($tmp_entries as $entry)
138 $this->
addResult($entry[
'ref_id'], $entry[
'obj_id'], $entry[
'type']);
139 $this->search_cache->appendToChecked($entry[
'ref_id'], $entry[
'obj_id']);
143 $this->search_cache->setResults($this->results);
149 include_once
'Services/Payment/classes/class.ilGeneralSettings.php';
151 $this->
setMaxHits(($maxhits > 0 ? $maxhits : 20));
178 $objects_with_topics = array();
179 $objects_with_no_topcis = array();
186 if(!(
int)$topic_id && !array_key_exists($result[
'ref_id'], $objects_with_no_topcis))
188 $objects_with_no_topcis[$result[
'ref_id']] =
$result;
192 if((
int)$topic_id != $oTopic->getId())
197 if(!array_key_exists($result[
'ref_id'], $objects_with_topics))
199 $objects_with_topics[$result[
'ref_id']] =
$result;
202 switch($result[
'type'])
213 $type = $result[
'type'];
221 'description' => $description,
222 'type' => $result[
'type'],
223 'obj_id' => $result[
'obj_id'],
224 'topic_id' => $topic_id,
225 'child' => $result[
'child']);
231 if(!array_key_exists($result[
'ref_id'], $objects_with_topics) &&
232 !array_key_exists($result[
'ref_id'], $objects_with_no_topcis))
234 $objects_with_no_topcis[$result[
'ref_id']] =
$result;
237 foreach($objects_with_no_topcis as $result)
239 switch($result[
'type'])
250 $type = $result[
'type'];
258 'description' => $description,
259 'type' => $result[
'type'],
260 'obj_id' => $result[
'obj_id'],
261 'child' => $result[
'child']);
270 return is_array($this->topics) ? $this->topics : array();
274 $this->topics = $a_topics;
279 $this->result_page_number = (int)$a_result_page_number > 0 ? $a_result_page_number : 1;
288 $this->presentation_results[] = $a_presentation_result;
292 return is_array($this->presentation_results) ? $this->presentation_results : array();
299 $this->search_cache->switchSearchType($this->search_type);
302 function addEntry($a_ref_id, $a_type, $found, $a_child_id = 0)
304 global $ilObjDataCache;
306 $a_obj_id = $ilObjDataCache->lookupObjId($a_ref_id);
309 if(!$this->entries[$a_ref_id])
311 $this->entries[$a_ref_id][
'ref_id'] = $a_ref_id;
312 $this->entries[$a_ref_id][
'obj_id'] = $a_obj_id;
313 $this->entries[$a_ref_id][
'type'] = $a_type;
314 $this->entries[$a_ref_id][
'found'] = $found;
316 if($a_child_id and $a_child_id != $a_ref_id)
318 $this->entries[$a_ref_id][
'child'][$a_child_id] = $a_child_id;
324 if($a_child_id and $a_child_id != $a_obj_id)
326 $this->entries[$a_ref_id][
'child'][$a_child_id] = $a_child_id;
331 foreach($found as $position)
335 $this->entries[$a_ref_id][
'found'][$counter] = $position;
345 if($this->entries[$a_ref_id] and is_array($a_childs))
347 foreach($a_childs as $child_id)
351 $this->entries[$a_ref_id][
'child'][$child_id] = $child_id;
361 foreach($result_obj->getEntries() as $entry)
363 $this->
addEntry($entry[
'ref_id'],$entry[
'type'],$entry[
'found']);
372 $this->entries = array();
375 foreach($this->search_cache->getCheckedItems() as
$ref_id => $obj_id)
377 if(isset($new_entries[$ref_id]))
379 $this->
addEntry($new_entries[$ref_id][
'ref_id'],
380 $new_entries[$ref_id][
'type'],
381 $new_entries[$ref_id][
'found']);
383 $new_entries[$ref_id][
'child']);