ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLikeShopMetaDataSearch.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2008 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 
24 include_once 'Services/Search/classes/class.ilShopMetaDataSearch.php';
25 
36 {
37  public function __construct($qp_obj)
38  {
39  parent::__construct($qp_obj);
40  }
41 
43  {
44  $where = '';
45  $types = array();
46  $values = array();
47 
48  $where .= ' WHERE (payment_objects.status = 1 OR payment_objects.status = 2) AND (';
49  $counter = 0;
50  foreach($this->query_parser->getQuotedWords() as $word)
51  {
52  if($counter++)
53  {
54  $where .= 'OR';
55  }
56 
57  $where .= $this->db->like(' keyword', 'text', '%%'.$word.'%%');
58  }
59 
60  if($this->getFilterShopTopicId() != 0)
61  {
62  $where .= ' AND pt_topic_fk = %s ';
63  $types[] = 'integer';
64  $values[] = $this->getFilterShopTopicId();
65  }
66 
67  return array(
68  'query' => $where.')',
69  'types' => $types,
70  'values' => $values
71  );
72  }
73 
75  {
76  $where = '';
77  $types = array();
78  $values = array();
79 
80  $where .= ' WHERE (payment_objects.status = 1 OR payment_objects.status = 2) AND (';
81  $counter = 0;
82  foreach($this->query_parser->getQuotedWords() as $word)
83  {
84  if($counter++)
85  {
86  $where .= 'OR';
87  }
88  $where .= $this->db->like(' entity', 'text', '%%'.$word.'%%');
89  }
90 
91  if($this->getFilterShopTopicId() != 0)
92  {
93  $where .= ' AND pt_topic_fk = %s ';
94  $types[] = 'integer';
95  $values[] = $this->getFilterShopTopicId();
96  }
97 
98  return array(
99  'query' => $where.')',
100  'types' => $types,
101  'values' => $values
102  );
103  }
104 
105  public function __createTitleWhereCondition()
106  {
107  $where = '';
108  $types = array();
109  $values = array();
110 
111  $where .= ' WHERE (payment_objects.status = 1 OR payment_objects.status = 2) AND (';
112  $counter = 0;
113  foreach($this->query_parser->getQuotedWords() as $word)
114  {
115  if($counter++)
116  {
117  $where .= 'OR';
118  }
119  $where .= $this->db->like(' title', 'text', '%%'.$word.'%%');
120  }
121 
122  if($this->getFilterShopTopicId() != 0)
123  {
124  $where .= ' AND pt_topic_fk = %s ';
125  $types[] = 'integer';
126  $values[] = $this->getFilterShopTopicId();
127  }
128 
129  return array(
130  'query' => $where.')',
131  'types' => $types,
132  'values' => $values
133  );
134  }
135 
137  {
138  $where = '';
139  $types = array();
140  $values = array();
141 
142  $where = ' WHERE (payment_objects.status = 1 OR payment_objects.status = 2) AND (';
143  $counter = 0;
144  foreach($this->query_parser->getQuotedWords() as $word)
145  {
146  if($counter++)
147  {
148  $where .= 'OR';
149  }
150  $where .= $this->db->like(' description', 'text', '%%'.$word.'%%');
151  }
152 
153  if($this->getFilterShopTopicId() != 0)
154  {
155  $where .= ' AND pt_topic_fk = %s ';
156  $types[] = 'integer';
157  $values[] = $this->getFilterShopTopicId();
158  }
159 
160  return array(
161  'query' => $where.')',
162  'types' => $types,
163  'values' => $values
164  );
165  }
166 }
167 ?>