116 $this->search_terms = split(
" +", $search_text);
120 $this->search_results = array();
136 if (strcmp($this->search_type,
"all") != 0)
138 $where =
"svy_qtype.type_tag = " . $ilDB->quote($this->search_type,
'text');
140 foreach ($this->search_terms as $term)
142 switch ($this->search_field)
145 $fields[
"$term"] = array();
146 array_push($fields[
"$term"], $ilDB->like(
"svy_question.title",
'text',
"%" .$term .
"%"));
147 array_push($fields[
"$term"], $ilDB->like(
"svy_question.description",
'text',
"%" .$term .
"%"));
148 array_push($fields[
"$term"], $ilDB->like(
"svy_question.author",
'text',
"%" .$term .
"%"));
149 array_push($fields[
"$term"], $ilDB->like(
"svy_question.questiontext",
'text',
"%" .$term .
"%"));
152 $fields[
"$term"] = array();
153 array_push($fields[
"$term"], $ilDB->like(
"svy_question." . $this->search_field,
'text',
"%" .$term .
"%"));
157 $cumulated_fields = array();
158 foreach ($fields as $params)
160 array_push($cumulated_fields,
"(" . join($params,
" OR ") .
")");
163 if ($this->concatenation == self::CONCAT_AND)
165 $str_where =
"(" . join($cumulated_fields,
" AND ") .
")";
169 $str_where =
"(" . join($cumulated_fields,
" OR ") .
")";
173 $str_where =
" AND $str_where";
177 $str_where .=
" AND (" . $where .
")";
179 $result = $ilDB->query(
"SELECT svy_question.*, svy_qtype.type_tag, object_reference.ref_id FROM " .
180 "svy_question, svy_qtype, object_reference WHERE svy_question.questiontype_fi = svy_qtype.questiontype_id ".
181 "AND svy_question.original_id IS NULL AND svy_question.obj_fi = object_reference.obj_id AND ".
182 "svy_question.obj_fi > 0$str_where");
183 $result_array = array();
189 if ((
$row[
"complete"] == 1) and ($rbacsystem->checkAccess(
'write',
$row[
"ref_id"])))
191 array_push($result_array,
$row);
195 $this->search_results =& $result_array;