4 include_once
'Services/Search/classes/class.ilSearchSettings.php';
19 include_once
'./Services/JSON/classes/class.ilJsonUtil.php';
21 $result->response =
new stdClass();
22 $result->response->results = array();
23 if (strlen($a_str) < 3)
28 $a_str = str_replace(
'"',
"", $a_str);
32 $object_types = array(
'cat',
'dbk',
'crs',
'fold',
'frm',
'grp',
'lm',
'sahs',
'glo',
'mep',
'htlm',
'exc',
'file',
'qpl',
'tst',
'svy',
'spl',
33 'chat',
'icrs',
'icla',
'webr',
'mcst',
'sess',
'pg',
'st',
'wiki');
35 $set = $ilDB->query(
"SELECT title, obj_id FROM object_data WHERE "
36 .$ilDB->like(
'title',
'text', $a_str.
"%").
" AND "
37 .$ilDB->in(
'type', $object_types,
false,
'text').
" ORDER BY title");
38 $max = ($settings->getAutoCompleteLength() > 0)
39 ? $settings->getAutoCompleteLength()
46 while (($rec = $ilDB->fetchAssoc($set)) && $cnt < $max)
48 if (!in_array($rec[
"title"], $list) && !in_array($rec[
"obj_id"], $checked))
52 if (strpos($rec[
"title"],
" ") > 0 || strpos($rec[
"title"],
"-") > 0)
54 $rec[
"title"] =
'"'.$rec[
"title"].
'"';
56 $list[] = $lim.$rec[
"title"];
59 $checked[] = $rec[
"obj_id"];
63 $set = $ilDB->query(
"SELECT rbac_id,obj_id,obj_type, keyword FROM il_meta_keyword WHERE "
64 .$ilDB->like(
'keyword',
'text', $a_str.
"%").
" AND "
65 .$ilDB->in(
'obj_type', $object_types,
false,
'text').
" ORDER BY keyword");
66 while (($rec = $ilDB->fetchAssoc($set)) && $cnt < $max)
68 if (!in_array($rec[
"keyword"], $list) && !in_array($rec[
"rbac_id"], $checked))
72 if (strpos($rec[
"keyword"],
" ") > 0)
74 $rec[
"keyword"] =
'"'.$rec[
"keyword"].
'"';
76 $list[] = $lim.$rec[
"keyword"];
80 $checked[] = $rec[
"rbac_id"];
86 $result->response->results[$i] =
new stdClass();
87 $result->response->results[$i]->term = $l;
102 foreach ($refs as $ref)
104 if ($ilAccess->checkAccess(
"read",
"", $ref))