ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
class.ilObjectSearch.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
37
class
ilObjectSearch
extends
ilAbstractSearch
38
{
39
const
CDATE_OPERATOR_BEFORE
= 1;
40
const
CDATE_OPERATOR_AFTER
= 2;
41
const
CDATE_OPERATOR_ON
= 3;
42
43
private
$cdate_operator
= null;
44
private
$cdate_date
= null;
45
46
51
public
function
__construct
(&$qp_obj)
52
{
53
parent::__construct($qp_obj);
54
55
$this->
setFields
(array(
'title'
,
'description'
));
56
}
57
58
59
60
61
public
function
performSearch
()
62
{
63
global
$DIC
;
64
65
$ilDB
= $DIC[
'ilDB'
];
66
67
$in
= $this->
__createInStatement
();
68
$where = $this->__createWhereCondition();
69
70
71
72
$cdate =
''
;
73
if
($this->
getCreationDateFilterDate
() instanceof
ilDate
) {
74
if
($this->
getCreationDateFilterOperator
()) {
75
switch
($this->
getCreationDateFilterOperator
()) {
76
case
self::CDATE_OPERATOR_AFTER:
77
$cdate =
'AND create_date >= '
.
$ilDB
->quote($this->
getCreationDateFilterDate
()->
get
(
IL_CAL_DATE
),
'text'
) .
' '
;
78
break
;
79
80
case
self::CDATE_OPERATOR_BEFORE:
81
$cdate =
'AND create_date <= '
.
$ilDB
->quote($this->
getCreationDateFilterDate
()->
get
(
IL_CAL_DATE
),
'text'
) .
' '
;
82
break
;
83
84
case
self::CDATE_OPERATOR_ON:
85
$cdate =
'AND '
.
$ilDB
->like(
86
'create_date'
,
87
'text'
,
88
$this->
getCreationDateFilterDate
()->
get
(
IL_CAL_DATE
) .
'%'
89
);
90
break
;
91
}
92
}
93
}
94
95
$locate = $this->
__createLocateString
();
96
97
$query
=
"SELECT obj_id,type "
.
98
$locate .
99
"FROM object_data "
.
100
$where .
" "
. $cdate .
' '
.
$in
.
' '
.
101
"ORDER BY obj_id DESC"
;
102
103
ilLoggerFactory::getLogger
(
'src'
)->debug(
'Object search query: '
.
$query
);
104
105
$res
= $this->db->query(
$query
);
106
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
107
$this->search_result->addEntry(
$row
->obj_id,
$row
->type, $this->__prepareFound(
$row
));
108
}
109
return
$this->search_result
;
110
}
111
112
113
114
// Protected can be overwritten in Like or Fulltext classes
115
public
function
__createInStatement
()
116
{
117
global
$DIC
;
118
119
$ilDB
= $DIC[
'ilDB'
];
120
121
$in
=
' AND '
.
$ilDB
->in(
'type'
, (array) $this->object_types,
false
,
'text'
);
122
if
($this->
getIdFilter
()) {
123
$in
.=
' AND '
;
124
$in
.=
$ilDB
->in(
'obj_id'
, $this->
getIdFilter
(),
false
,
'integer'
);
125
}
126
return
$in
;
127
}
128
129
133
public
function
setCreationDateFilterDate
(
ilDate
$day)
134
{
135
$this->cdate_date = $day;
136
}
137
138
public
function
setCreationDateFilterOperator
($a_operator)
139
{
140
$this->cdate_operator = $a_operator;
141
}
142
143
public
function
getCreationDateFilterDate
()
144
{
145
return
$this->cdate_date
;
146
}
147
148
public
function
getCreationDateFilterOperator
()
149
{
150
return
$this->cdate_operator
;
151
}
152
}
ilObjectSearch\__construct
__construct(&$qp_obj)
Constructor public.
Definition:
class.ilObjectSearch.php:51
ilObjectSearch\getCreationDateFilterDate
getCreationDateFilterDate()
Definition:
class.ilObjectSearch.php:143
ilAbstractSearch
Definition:
class.ilAbstractSearch.php:16
$DIC
global $DIC
Definition:
saml.php:7
ilAbstractSearch\__createLocateString
__createLocateString()
build locate string in case of AND search
Definition:
class.ilAbstractSearch.php:143
ilObjectSearch\performSearch
performSearch()
Definition:
class.ilObjectSearch.php:61
ilObjectSearch\CDATE_OPERATOR_BEFORE
const CDATE_OPERATOR_BEFORE
Definition:
class.ilObjectSearch.php:39
ilAbstractSearch\setFields
setFields($a_fields)
Set fields to search.
Definition:
class.ilAbstractSearch.php:64
ilObjectSearch\CDATE_OPERATOR_AFTER
const CDATE_OPERATOR_AFTER
Definition:
class.ilObjectSearch.php:40
ilDate
Class for single dates.
Definition:
class.ilDate.php:36
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
ilAbstractSearch\getIdFilter
getIdFilter()
Get Id filter.
Definition:
class.ilAbstractSearch.php:105
ilObjectSearch\$cdate_operator
$cdate_operator
Definition:
class.ilObjectSearch.php:43
ilObjectSearch\setCreationDateFilterDate
setCreationDateFilterDate(ilDate $day)
Set creation date filter.
Definition:
class.ilObjectSearch.php:133
ilObjectSearch\__createInStatement
__createInStatement()
Definition:
class.ilObjectSearch.php:115
$query
$query
Definition:
proxy_ylocal.php:13
$row
$row
Definition:
migrateto20.php:360
$in
if(php_sapi_name() !='cli') $in
Definition:
Utf8Test.php:37
ilObjectSearch\setCreationDateFilterOperator
setCreationDateFilterOperator($a_operator)
Definition:
class.ilObjectSearch.php:138
IL_CAL_DATE
const IL_CAL_DATE
Definition:
class.ilDateTime.php:10
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilObjectSearch
Definition:
class.ilObjectSearch.php:37
ilObjectSearch\getCreationDateFilterOperator
getCreationDateFilterOperator()
Definition:
class.ilObjectSearch.php:148
php
ilLoggerFactory\getLogger
static getLogger($a_component_id)
Get component logger.
Definition:
class.ilLoggerFactory.php:74
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
ilObjectSearch\CDATE_OPERATOR_ON
const CDATE_OPERATOR_ON
Definition:
class.ilObjectSearch.php:41
ilObjectSearch\$cdate_date
$cdate_date
Definition:
class.ilObjectSearch.php:44
ilAbstractSearch\$search_result
$search_result
Definition:
class.ilAbstractSearch.php:30
Services
Search
classes
class.ilObjectSearch.php
Generated on Thu Jan 16 2025 19:02:29 for ILIAS by
1.8.13 (using
Doxyfile
)