24 include_once
"./Modules/Survey/classes/inc.SurveyConstants.php";
114 $this->ilDB =&
$ilDB;
116 $this->search_terms = split(
" +", $search_text);
120 $this->search_results = array();
134 if (strcmp($this->search_type,
"all") != 0)
136 $where = sprintf(
"survey_questiontype.type_tag = %s",
137 $this->ilDB->quote($this->search_type)
140 foreach ($this->search_terms as $term)
142 switch ($this->search_field)
145 $fields[
"$term"] = array();
146 array_push($fields[
"$term"], sprintf(
"survey_question.title LIKE %s",
147 $this->ilDB->quote(
"%$term%")
149 array_push($fields[
"$term"], sprintf(
"survey_question.description LIKE %s",
150 $this->ilDB->quote(
"%$term%")
152 array_push($fields[
"$term"], sprintf(
"survey_question.author LIKE %s",
153 $this->ilDB->quote(
"%$term%")
155 array_push($fields[
"$term"], sprintf(
"survey_question.questiontext LIKE %s",
156 $this->ilDB->quote(
"%$term%")
160 $fields[
"$term"] = array();
161 array_push($fields[
"$term"], sprintf(
"survey_question.$this->search_field LIKE %s",
162 $this->ilDB->quote(
"%$term%")
167 $cumulated_fields = array();
168 foreach ($fields as $params)
170 array_push($cumulated_fields,
"(" . join($params,
" OR ") .
")");
175 $str_where =
"(" . join($cumulated_fields,
" AND ") .
")";
179 $str_where =
"(" . join($cumulated_fields,
" OR ") .
")";
183 $str_where =
" AND $str_where";
187 $str_where .=
" AND (" . $where .
")";
189 $query =
"SELECT survey_question.*, survey_questiontype.type_tag, object_reference.ref_id FROM survey_question, survey_questiontype, object_reference WHERE survey_question.questiontype_fi = survey_questiontype.questiontype_id AND ISNULL(survey_question.original_id) AND survey_question.obj_fi = object_reference.obj_id AND survey_question.obj_fi > 0$str_where";
190 $result = $this->ilDB->query($query);
191 $result_array = array();
195 while ($row =
$result->fetchRow(MDB2_FETCHMODE_ASSOC))
197 if (($row[
"complete"] == 1) and ($rbacsystem->checkAccess(
'write', $row[
"ref_id"])))
199 array_push($result_array, $row);
203 $this->search_results =& $result_array;