ILIAS  release_8 Revision v8.23
class.ilForumSearch.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 /*
5  +-----------------------------------------------------------------------------+
6  | ILIAS open source |
7  +-----------------------------------------------------------------------------+
8  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
9  | |
10  | This program is free software; you can redistribute it and/or |
11  | modify it under the terms of the GNU General Public License |
12  | as published by the Free Software Foundation; either version 2 |
13  | of the License, or (at your option) any later version. |
14  | |
15  | This program is distributed in the hope that it will be useful, |
16  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
17  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18  | GNU General Public License for more details. |
19  | |
20  | You should have received a copy of the GNU General Public License |
21  | along with this program; if not, write to the Free Software |
22  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23  +-----------------------------------------------------------------------------+
24 */
25 
38 {
39  public function performSearch(): ilSearchResult
40  {
41  // Search in topic titles, posting title, posting
42 
43  // First: search topics:
44  $this->setFields(array('thr_subject'));
45 
46  $and = $this->__createTopicAndCondition();
47  $locate = $this->__createLocateString();
48 
49  $query = "SELECT thr_pk,top_frm_fk frm_id " .
50  $locate .
51  "FROM frm_threads,frm_data " .
52  "WHERE top_pk = thr_top_fk " .
53  $and;
54 
55  $res = $this->db->query($query);
56 
57  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
58  #$thread_post = $row->thr_pk.'_0';
59  $thread_post = $row->thr_pk;
60  $this->search_result->addEntry(
61  (int) $row->frm_id,
62  'frm',
63  $this->__prepareFound($row),
64  (int) $thread_post
65  );
66  }
67 
68  // First: search post title, content:
69  $this->setFields(array('pos_subject','pos_message'));
70 
71  $and = $this->__createPostAndCondition();
72  $locate = $this->__createLocateString();
73 
74  $query = "SELECT top_frm_fk frm_id,pos_thr_fk,pos_pk " .
75  $locate .
76  "FROM frm_posts,frm_data " .
77  "WHERE pos_top_fk = top_pk " .
78  $and;
79 
80  $res = $this->db->query($query);
81  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
82  #$thread_post = $row->pos_thr_fk.'_'.$row->pos_pk;
83  $thread_post = $row->pos_thr_fk;
84  $this->search_result->addEntry(
85  (int) $row->frm_id,
86  'frm',
87  $this->__prepareFound($row),
88  (int) $thread_post
89  );
90  }
91  return $this->search_result;
92  }
93 }
$res
Definition: ltiservices.php:69
setFields(array $a_fields)
$query
ilSearchResult $search_result