ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilTestSearch.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
35 include_once 'Services/Search/classes/class.ilAbstractSearch.php';
36 
38 {
40  {
41  $this->setFields(array('introduction'));
42 
43  $where = $this->__createWhereCondition(implode(',',$this->getFields()));
44  $locate = $this->__createLocateString();
45 
46  $query = "SELECT obj_fi ".
47  $locate.
48  "FROM tst_tests ".
49  $where;
50 
51  $res = $this->db->query($query);
52  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
53  {
54  $this->search_result->addEntry($row->obj_fi,'tst',$this->__prepareFound($row));
55  }
56  return $this->search_result;
57  }
58  function &__searchTestTitle()
59  {
60  $this->setFields(array('title','description'));
61 
62  $where = $this->__createWhereCondition(implode(',',$this->getFields()));
63  $locate = $this->__createLocateString();
64 
65  $query = "SELECT obj_fi ".
66  $locate.
67  "FROM qpl_questions ".
68  $where;
69 
70  $res = $this->db->query($query);
71  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
72  {
73  $this->search_result->addEntry($row->obj_fi,'qpl',$this->__prepareFound($row));
74  }
75  return $this->search_result;
76  }
78  {
79  $this->setFields(array('introduction'));
80 
81  $where = $this->__createWhereCondition(implode(',',$this->getFields()));
82  $locate = $this->__createLocateString();
83 
84  $query = "SELECT obj_fi ".
85  $locate.
86  "FROM svy_svy ".
87  $where;
88 
89  $res = $this->db->query($query);
90  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
91  {
92  $this->search_result->addEntry($row->obj_fi,'svy',$this->__prepareFound($row));
93  }
94  return $this->search_result;
95  }
96  function &__searchSurveyTitle()
97  {
98  $this->setFields(array('title','description'));
99 
100  $where = $this->__createWhereCondition(implode(',',$this->getFields()));
101  $locate = $this->__createLocateString();
102 
103  $query = "SELECT obj_fi ".
104  $locate.
105  "FROM svy_question ".
106  $where;
107 
108  $res = $this->db->query($query);
109  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
110  {
111  $this->search_result->addEntry($row->obj_fi,'spl',$this->__prepareFound($row));
112  }
113  return $this->search_result;
114  }
115 
116 
117  function &performSearch()
118  {
119  $this->__searchTestTitle();
120  $this->__searchTestIntroduction();
121  $this->__searchSurveyTitle();
123 
124  return $this->search_result;
125  }
126 }
127 ?>
getFields()
Get fields to search.
__createLocateString()
build locate string in case of AND search
setFields($a_fields)
Set fields to search.
Create styles array
The data for the language used.