114 $this->rbacsystem = $DIC->rbac()->system();
115 $ilDB = $DIC->database();
119 $this->search_terms = explode(
" +", $search_text);
123 $this->search_results =
array();
139 if (strcmp($this->search_type,
"all") != 0) {
140 $where =
"svy_qtype.type_tag = " .
$ilDB->quote($this->search_type,
'text');
142 foreach ($this->search_terms as $term) {
143 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();
159 array_push($cumulated_fields,
"(" . join($params,
" OR ") .
")");
162 if ($this->concatenation == self::CONCAT_AND) {
163 $str_where =
"(" . join($cumulated_fields,
" AND ") .
")";
165 $str_where =
"(" . join($cumulated_fields,
" OR ") .
")";
168 $str_where =
" AND $str_where";
171 $str_where .=
" AND (" . $where .
")";
173 $result =
$ilDB->query(
"SELECT svy_question.*, svy_qtype.type_tag, object_reference.ref_id FROM " .
174 "svy_question, svy_qtype, object_reference WHERE svy_question.questiontype_fi = svy_qtype.questiontype_id " .
175 "AND svy_question.original_id IS NULL AND svy_question.obj_fi = object_reference.obj_id AND " .
176 "svy_question.obj_fi > 0$str_where");
177 $result_array =
array();
182 array_push($result_array,
$row);
186 $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.