ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilObjectSearch Class Reference
+ Inheritance diagram for ilObjectSearch:
+ Collaboration diagram for ilObjectSearch:

Public Member Functions

 __construct (&$qp_obj)
 Constructor public. More...
 
 performSearch ()
 
 __createInStatement ()
 
 setCreationDateFilterDate (ilDate $day)
 Set creation date filter. More...
 
 setCreationDateFilterOperator ($a_operator)
 
 getCreationDateFilterDate ()
 
 getCreationDateFilterOperator ()
 
- Public Member Functions inherited from ilAbstractSearch
 __construct ($qp_obj)
 Constructor public. More...
 
 setFields ($a_fields)
 Set fields to search. More...
 
 getFields ()
 Get fields to search. More...
 
 setFilter ($a_filter)
 set object type to search in More...
 
 setIdFilter ($a_id_filter)
 Set id filter Filters search by given object id. More...
 
 getIdFilter ()
 Get Id filter. More...
 
 appendToFilter ($a_type)
 Append object type to filter. More...
 
 getFilter ()
 get object type to search in More...
 
 __createLocateString ()
 build locate string in case of AND search More...
 
 __prepareFound (&$row)
 
 performSearch ()
 

Data Fields

const CDATE_OPERATOR_BEFORE = 1
 
const CDATE_OPERATOR_AFTER = 2
 
const CDATE_OPERATOR_ON = 3
 
- Data Fields inherited from ilAbstractSearch
 $db = null
 
 $query_parser = null
 
 $search_result = null
 
 $object_types
 

Private Attributes

 $cdate_operator = null
 
 $cdate_date = null
 

Detailed Description

Definition at line 37 of file class.ilObjectSearch.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjectSearch::__construct ( $qp_obj)

Constructor public.

Definition at line 51 of file class.ilObjectSearch.php.

References array, and ilAbstractSearch\setFields().

52  {
53  parent::__construct($qp_obj);
54 
55  $this->setFields(array('title','description'));
56  }
setFields($a_fields)
Set fields to search.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

Member Function Documentation

◆ __createInStatement()

ilObjectSearch::__createInStatement ( )

Definition at line 113 of file class.ilObjectSearch.php.

References $ilDB, $in, array, and ilAbstractSearch\getIdFilter().

Referenced by performSearch().

114  {
115  global $ilDB;
116 
117  $in = ' AND ' . $ilDB->in('type', (array) $this->object_types, false, 'text');
118  if ($this->getIdFilter()) {
119  $in .= ' AND ';
120  $in .= $ilDB->in('obj_id', $this->getIdFilter(), false, 'integer');
121  }
122  return $in;
123  }
getIdFilter()
Get Id filter.
Create styles array
The data for the language used.
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCreationDateFilterDate()

ilObjectSearch::getCreationDateFilterDate ( )

Definition at line 139 of file class.ilObjectSearch.php.

References $cdate_date.

Referenced by performSearch().

140  {
141  return $this->cdate_date;
142  }
+ Here is the caller graph for this function:

◆ getCreationDateFilterOperator()

ilObjectSearch::getCreationDateFilterOperator ( )

Definition at line 144 of file class.ilObjectSearch.php.

References $cdate_operator.

Referenced by performSearch().

145  {
146  return $this->cdate_operator;
147  }
+ Here is the caller graph for this function:

◆ performSearch()

ilObjectSearch::performSearch ( )

Definition at line 61 of file class.ilObjectSearch.php.

References $ilDB, $in, $query, $res, $row, ilAbstractSearch\$search_result, __createInStatement(), ilAbstractSearch\__createLocateString(), ilDBConstants\FETCHMODE_OBJECT, getCreationDateFilterDate(), getCreationDateFilterOperator(), ilLoggerFactory\getLogger(), and IL_CAL_DATE.

62  {
63  global $ilDB;
64 
65  $in = $this->__createInStatement();
66  $where = $this->__createWhereCondition();
67 
68 
69 
70  $cdate = '';
71  if ($this->getCreationDateFilterDate() instanceof ilDate) {
72  if ($this->getCreationDateFilterOperator()) {
73  switch ($this->getCreationDateFilterOperator()) {
74  case self::CDATE_OPERATOR_AFTER:
75  $cdate = 'AND create_date >= ' . $ilDB->quote($this->getCreationDateFilterDate()->get(IL_CAL_DATE), 'text') . ' ';
76  break;
77 
78  case self::CDATE_OPERATOR_BEFORE:
79  $cdate = 'AND create_date <= ' . $ilDB->quote($this->getCreationDateFilterDate()->get(IL_CAL_DATE), 'text') . ' ';
80  break;
81 
82  case self::CDATE_OPERATOR_ON:
83  $cdate = 'AND ' . $ilDB->like(
84  'create_date',
85  'text',
86  $this->getCreationDateFilterDate()->get(IL_CAL_DATE) . '%'
87  );
88  break;
89  }
90  }
91  }
92 
93  $locate = $this->__createLocateString();
94 
95  $query = "SELECT obj_id,type " .
96  $locate .
97  "FROM object_data " .
98  $where . " " . $cdate . ' ' . $in . ' ' .
99  "ORDER BY obj_id DESC";
100 
101  ilLoggerFactory::getLogger('src')->debug('Object search query: ' . $query);
102 
103  $res = $this->db->query($query);
104  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
105  $this->search_result->addEntry($row->obj_id, $row->type, $this->__prepareFound($row));
106  }
107  return $this->search_result;
108  }
__createLocateString()
build locate string in case of AND search
Class for single dates.
foreach($_POST as $key=> $value) $res
$query
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
const IL_CAL_DATE
global $ilDB
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

◆ setCreationDateFilterDate()

ilObjectSearch::setCreationDateFilterDate ( ilDate  $day)

Set creation date filter.

Definition at line 129 of file class.ilObjectSearch.php.

Referenced by ilSearchGUI\parseCreationFilter().

130  {
131  $this->cdate_date = $day;
132  }
+ Here is the caller graph for this function:

◆ setCreationDateFilterOperator()

ilObjectSearch::setCreationDateFilterOperator (   $a_operator)

Definition at line 134 of file class.ilObjectSearch.php.

Referenced by ilSearchGUI\parseCreationFilter().

135  {
136  $this->cdate_operator = $a_operator;
137  }
+ Here is the caller graph for this function:

Field Documentation

◆ $cdate_date

ilObjectSearch::$cdate_date = null
private

Definition at line 44 of file class.ilObjectSearch.php.

Referenced by getCreationDateFilterDate().

◆ $cdate_operator

ilObjectSearch::$cdate_operator = null
private

Definition at line 43 of file class.ilObjectSearch.php.

Referenced by getCreationDateFilterOperator().

◆ CDATE_OPERATOR_AFTER

const ilObjectSearch::CDATE_OPERATOR_AFTER = 2

Definition at line 40 of file class.ilObjectSearch.php.

Referenced by ilSearchGUI\parseCreationFilter().

◆ CDATE_OPERATOR_BEFORE

const ilObjectSearch::CDATE_OPERATOR_BEFORE = 1

Definition at line 39 of file class.ilObjectSearch.php.

Referenced by ilSearchGUI\parseCreationFilter().

◆ CDATE_OPERATOR_ON

const ilObjectSearch::CDATE_OPERATOR_ON = 3

Definition at line 41 of file class.ilObjectSearch.php.

Referenced by ilSearchGUI\parseCreationFilter().


The documentation for this class was generated from the following file: