ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 119 of file class.ilObjectSearch.php.

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

Referenced by performSearch().

120  {
121  global $ilDB;
122 
123  $in = ' AND '.$ilDB->in('type',(array) $this->object_types,false,'text');
124  if($this->getIdFilter())
125  {
126  $in .= ' AND ';
127  $in .= $ilDB->in('obj_id',$this->getIdFilter(),false,'integer');
128  }
129  return $in;
130  }
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 146 of file class.ilObjectSearch.php.

References $cdate_date.

Referenced by performSearch().

147  {
148  return $this->cdate_date;
149  }
+ Here is the caller graph for this function:

◆ getCreationDateFilterOperator()

ilObjectSearch::getCreationDateFilterOperator ( )

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

References $cdate_operator.

Referenced by performSearch().

152  {
153  return $this->cdate_operator;
154  }
+ 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  {
74  {
75  switch($this->getCreationDateFilterOperator())
76  {
77  case self::CDATE_OPERATOR_AFTER:
78  $cdate = 'AND create_date >= '.$ilDB->quote($this->getCreationDateFilterDate()->get(IL_CAL_DATE),'text').' ';
79  break;
80 
81  case self::CDATE_OPERATOR_BEFORE:
82  $cdate = 'AND create_date <= '.$ilDB->quote($this->getCreationDateFilterDate()->get(IL_CAL_DATE),'text').' ';
83  break;
84 
85  case self::CDATE_OPERATOR_ON:
86  $cdate = 'AND '.$ilDB->like(
87  'create_date',
88  'text',
89  $this->getCreationDateFilterDate()->get(IL_CAL_DATE).'%'
90  );
91  break;
92  }
93  }
94 
95 
96  }
97 
98  $locate = $this->__createLocateString();
99 
100  $query = "SELECT obj_id,type ".
101  $locate.
102  "FROM object_data ".
103  $where." ".$cdate.' '.$in.' '.
104  "ORDER BY obj_id DESC";
105 
106  ilLoggerFactory::getLogger('src')->debug('Object search query: '. $query);
107 
108  $res = $this->db->query($query);
109  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
110  {
111  $this->search_result->addEntry($row->obj_id,$row->type,$this->__prepareFound($row));
112  }
113  return $this->search_result;
114  }
__createLocateString()
build locate string in case of AND search
Class for single dates.
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 136 of file class.ilObjectSearch.php.

Referenced by ilSearchGUI\parseCreationFilter().

137  {
138  $this->cdate_date = $day;
139  }
+ Here is the caller graph for this function:

◆ setCreationDateFilterOperator()

ilObjectSearch::setCreationDateFilterOperator (   $a_operator)

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

Referenced by ilSearchGUI\parseCreationFilter().

142  {
143  $this->cdate_operator = $a_operator;
144  }
+ 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: