105 function __construct($search_text =
"", $concatenation = self::CONCAT_AND, $search_field =
"all", $search_type =
"all")
111 $this->search_terms = explode(
" +", $search_text);
115 $this->search_results =
array();
131 if (strcmp($this->search_type,
"all") != 0)
133 $where =
"svy_qtype.type_tag = " . $ilDB->quote($this->search_type,
'text');
135 foreach ($this->search_terms as $term)
137 switch ($this->search_field)
140 $fields[
"$term"] =
array();
141 array_push($fields[
"$term"], $ilDB->like(
"svy_question.title",
'text',
"%" .$term .
"%"));
142 array_push($fields[
"$term"], $ilDB->like(
"svy_question.description",
'text',
"%" .$term .
"%"));
143 array_push($fields[
"$term"], $ilDB->like(
"svy_question.author",
'text',
"%" .$term .
"%"));
144 array_push($fields[
"$term"], $ilDB->like(
"svy_question.questiontext",
'text',
"%" .$term .
"%"));
147 $fields[
"$term"] =
array();
148 array_push($fields[
"$term"], $ilDB->like(
"svy_question." . $this->search_field,
'text',
"%" .$term .
"%"));
152 $cumulated_fields =
array();
155 array_push($cumulated_fields,
"(" . join($params,
" OR ") .
")");
158 if ($this->concatenation == self::CONCAT_AND)
160 $str_where =
"(" . join($cumulated_fields,
" AND ") .
")";
164 $str_where =
"(" . join($cumulated_fields,
" OR ") .
")";
168 $str_where =
" AND $str_where";
172 $str_where .=
" AND (" . $where .
")";
174 $result = $ilDB->query(
"SELECT svy_question.*, svy_qtype.type_tag, object_reference.ref_id FROM " .
175 "svy_question, svy_qtype, object_reference WHERE svy_question.questiontype_fi = svy_qtype.questiontype_id ".
176 "AND svy_question.original_id IS NULL AND svy_question.obj_fi = object_reference.obj_id AND ".
177 "svy_question.obj_fi > 0$str_where");
178 $result_array =
array();
184 if ((
$row[
"complete"] == 1)
and ($rbacsystem->checkAccess(
'write',
$row[
"ref_id"])))
186 array_push($result_array,
$row);
190 $this->search_results =& $result_array;
search()
Executes a search.
__construct($search_text="", $concatenation=self::CONCAT_AND, $search_field="all", $search_type="all")
SurveySearch constructor.
Create styles array
The data for the language used.
Class for search actions in ILIAS survey tool.