ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilForumSearch.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 {
39 
40  function &performSearch()
41  {
42  // Search in topic titles, posting title, posting
43 
44  // First: search topics:
45  $this->setFields(array('thr_subject'));
46 
47  $and = $this->__createTopicAndCondition();
48  $locate = $this->__createLocateString();
49 
50  $query = "SELECT thr_pk,top_frm_fk frm_id ".
51  $locate.
52  "FROM frm_threads,frm_data ".
53  "WHERE top_pk = thr_top_fk ".
54  $and;
55 
56  $res = $this->db->query($query);
57 
58  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
59  {
60  #$thread_post = $row->thr_pk.'_0';
61  $thread_post = $row->thr_pk;
62  $this->search_result->addEntry($row->frm_id,'frm',$this->__prepareFound($row),$thread_post);
63  }
64 
65  // First: search post title, content:
66  $this->setFields(array('pos_subject','pos_message'));
67 
68  $and = $this->__createPostAndCondition();
69  $locate = $this->__createLocateString();
70 
71  $query = "SELECT top_frm_fk frm_id,pos_thr_fk,pos_pk ".
72  $locate.
73  "FROM frm_posts,frm_data ".
74  "WHERE pos_top_fk = top_pk ".
75  $and;
76 
77  $res = $this->db->query($query);
78  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
79  {
80  #$thread_post = $row->pos_thr_fk.'_'.$row->pos_pk;
81  $thread_post = $row->pos_thr_fk;
82  $this->search_result->addEntry($row->frm_id,'frm',$this->__prepareFound($row),$thread_post);
83  }
84  return $this->search_result;
85  }
86 
88  {
89  echo "Overwrite me!";
90  }
91 
92 }
93 ?>
__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.