ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilMetaDataSearch Class Reference
+ Inheritance diagram for ilMetaDataSearch:
+ Collaboration diagram for ilMetaDataSearch:

Public Member Functions

 setMode ($a_mode)
 Define meta elements to search. More...
 
 getMode ()
 
performSearch ()
 
 __createInStatement ()
 
 __searchContribute ()
 
 __searchKeywords ()
 
 __searchTitles ()
 
 __searchDescriptions ()
 
- 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

 $mode = ''
 
 $query_parser = null
 
 $db = null
 
- Data Fields inherited from ilAbstractSearch
 $db = null
 
 $query_parser = null
 
 $search_result = null
 
 $object_types
 

Detailed Description

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

Member Function Documentation

◆ __createInStatement()

ilMetaDataSearch::__createInStatement ( )

Definition at line 89 of file class.ilMetaDataSearch.php.

References $in, and ilAbstractSearch\getFilter().

Referenced by __searchContribute(), __searchDescriptions(), __searchKeywords(), and __searchTitles().

90  {
91  if(!$this->getFilter())
92  {
93  return '';
94  }
95  else
96  {
97  $type = "('";
98  $type .= implode("','",$this->getFilter());
99  $type .= "')";
100 
101  $in = " AND obj_type IN ".$type;
102 
103  return $in;
104  }
105  }
getFilter()
get object type to search in
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchContribute()

ilMetaDataSearch::__searchContribute ( )

Definition at line 106 of file class.ilMetaDataSearch.php.

References $in, $query, $res, $row, ilAbstractSearch\$search_result, __createInStatement(), ilAbstractSearch\__createLocateString(), array, ilDBConstants\FETCHMODE_OBJECT, and ilAbstractSearch\setFields().

Referenced by performSearch().

107  {
108  $this->setFields(array('entity'));
109 
110  $in = $this->__createInStatement();
111  $where = $this->__createContributeWhereCondition();
112  $locate = $this->__createLocateString();
113 
114  $query = "SELECT rbac_id,obj_id,obj_type ".
115  $locate.
116  "FROM il_meta_entity ".
117  $where." ".$in.' ';
118 
119  $res = $this->db->query($query);
120  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
121  {
122  $this->search_result->addEntry($row->rbac_id,$row->obj_type,$this->__prepareFound($row),$row->obj_id);
123  }
124 
125  return $this->search_result;
126  }
__createLocateString()
build locate string in case of AND search
setFields($a_fields)
Set fields to search.
Create styles array
The data for the language used.
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchDescriptions()

ilMetaDataSearch::__searchDescriptions ( )

Definition at line 171 of file class.ilMetaDataSearch.php.

References $in, $query, $res, $row, ilAbstractSearch\$search_result, __createInStatement(), ilAbstractSearch\__createLocateString(), array, ilDBConstants\FETCHMODE_OBJECT, and ilAbstractSearch\setFields().

Referenced by performSearch().

172  {
173  $this->setFields(array('description'));
174 
175  $in = $this->__createInStatement();
176  $where = $this->__createDescriptionWhereCondition();
177  $locate = $this->__createLocateString();
178 
179  $query = "SELECT rbac_id,obj_id,obj_type ".
180  $locate.
181  "FROM il_meta_description ".
182  $where." ".$in.' ';
183 
184  $res = $this->db->query($query);
185  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
186  {
187  $this->search_result->addEntry($row->rbac_id,$row->obj_type,$this->__prepareFound($row),$row->obj_id);
188  }
189 
190  return $this->search_result;
191  }
__createLocateString()
build locate string in case of AND search
setFields($a_fields)
Set fields to search.
Create styles array
The data for the language used.
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchKeywords()

ilMetaDataSearch::__searchKeywords ( )

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

References $in, $query, $res, $row, ilAbstractSearch\$search_result, __createInStatement(), ilAbstractSearch\__createLocateString(), array, ilDBConstants\FETCHMODE_OBJECT, and ilAbstractSearch\setFields().

Referenced by performSearch().

130  {
131  $this->setFields(array('keyword'));
132 
133  $in = $this->__createInStatement();
134  $where = $this->__createKeywordWhereCondition();
135  $locate = $this->__createLocateString();
136 
137  $query = "SELECT rbac_id,obj_id,obj_type ".
138  $locate.
139  "FROM il_meta_keyword ".
140  $where." ".$in.' ';
141 
142  $res = $this->db->query($query);
143  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
144  {
145  $this->search_result->addEntry($row->rbac_id,$row->obj_type,$this->__prepareFound($row),$row->obj_id);
146  }
147 
148  return $this->search_result;
149  }
__createLocateString()
build locate string in case of AND search
setFields($a_fields)
Set fields to search.
Create styles array
The data for the language used.
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchTitles()

ilMetaDataSearch::__searchTitles ( )

Definition at line 150 of file class.ilMetaDataSearch.php.

References $in, $query, $res, $row, ilAbstractSearch\$search_result, __createInStatement(), ilAbstractSearch\__createLocateString(), array, ilDBConstants\FETCHMODE_OBJECT, and ilAbstractSearch\setFields().

Referenced by performSearch().

151  {
152  $this->setFields(array('title'));
153 
154  $in = $this->__createInStatement();
155  $where = $this->__createTitleWhereCondition();
156  $locate = $this->__createLocateString();
157 
158  $query = "SELECT rbac_id,obj_id,obj_type ".
159  $locate.
160  "FROM il_meta_general ".
161  $where." ".$in.' ';
162 
163  $res = $this->db->query($query);
164  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
165  {
166  $this->search_result->addEntry($row->rbac_id,$row->obj_type,$this->__prepareFound($row),$row->obj_id);
167  }
168 
169  return $this->search_result;
170  }
__createLocateString()
build locate string in case of AND search
setFields($a_fields)
Set fields to search.
Create styles array
The data for the language used.
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMode()

ilMetaDataSearch::getMode ( )

Definition at line 58 of file class.ilMetaDataSearch.php.

References $mode.

Referenced by performSearch().

59  {
60  return $this->mode;
61  }
+ Here is the caller graph for this function:

◆ performSearch()

& ilMetaDataSearch::performSearch ( )

Definition at line 64 of file class.ilMetaDataSearch.php.

References __searchContribute(), __searchDescriptions(), __searchKeywords(), __searchTitles(), and getMode().

65  {
66  switch($this->getMode())
67  {
68  case 'keyword':
69  return $this->__searchKeywords();
70 
71  case 'contribute':
72  return $this->__searchContribute();
73 
74  case 'title':
75  return $this->__searchTitles();
76 
77  case 'description':
78  return $this->__searchDescriptions();
79 
80  default:
81  echo "ilMDSearch::performSearch() no mode given";
82  return false;
83  }
84  }
+ Here is the call graph for this function:

◆ setMode()

ilMetaDataSearch::setMode (   $a_mode)

Define meta elements to search.

Parameters
arrayelements to search in. E.G array('keyword','contribute') public

Definition at line 54 of file class.ilMetaDataSearch.php.

55  {
56  $this->mode = $a_mode;
57  }

Field Documentation

◆ $db

ilMetaDataSearch::$db = null

Definition at line 46 of file class.ilMetaDataSearch.php.

◆ $mode

ilMetaDataSearch::$mode = ''

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

Referenced by getMode().

◆ $query_parser

ilMetaDataSearch::$query_parser = null

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


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