ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 88 of file class.ilMetaDataSearch.php.

References $in, $type, and ilAbstractSearch\getFilter().

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

89  {
90  if (!$this->getFilter()) {
91  return '';
92  } else {
93  $type = "('";
94  $type .= implode("','", $this->getFilter());
95  $type .= "')";
96 
97  $in = " AND obj_type IN " . $type;
98 
99  return $in;
100  }
101  }
$type
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 102 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().

103  {
104  $this->setFields(array('entity'));
105 
106  $in = $this->__createInStatement();
107  $where = $this->__createContributeWhereCondition();
108  $locate = $this->__createLocateString();
109 
110  $query = "SELECT rbac_id,obj_id,obj_type " .
111  $locate .
112  "FROM il_meta_entity " .
113  $where . " " . $in . ' ';
114 
115  $res = $this->db->query($query);
116  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
117  $this->search_result->addEntry($row->rbac_id, $row->obj_type, $this->__prepareFound($row), $row->obj_id);
118  }
119 
120  return $this->search_result;
121  }
__createLocateString()
build locate string in case of AND search
setFields($a_fields)
Set fields to search.
foreach($_POST as $key=> $value) $res
$query
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 164 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().

165  {
166  $this->setFields(array('description'));
167 
168  $in = $this->__createInStatement();
169  $where = $this->__createDescriptionWhereCondition();
170  $locate = $this->__createLocateString();
171 
172  $query = "SELECT rbac_id,obj_id,obj_type " .
173  $locate .
174  "FROM il_meta_description " .
175  $where . " " . $in . ' ';
176 
177  $res = $this->db->query($query);
178  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
179  $this->search_result->addEntry($row->rbac_id, $row->obj_type, $this->__prepareFound($row), $row->obj_id);
180  }
181 
182  return $this->search_result;
183  }
__createLocateString()
build locate string in case of AND search
setFields($a_fields)
Set fields to search.
foreach($_POST as $key=> $value) $res
$query
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 124 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().

125  {
126  $this->setFields(array('keyword'));
127 
128  $in = $this->__createInStatement();
129  $where = $this->__createKeywordWhereCondition();
130  $locate = $this->__createLocateString();
131 
132  $query = "SELECT rbac_id,obj_id,obj_type " .
133  $locate .
134  "FROM il_meta_keyword " .
135  $where . " " . $in . ' ';
136 
137  $res = $this->db->query($query);
138  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
139  $this->search_result->addEntry($row->rbac_id, $row->obj_type, $this->__prepareFound($row), $row->obj_id);
140  }
141 
142  return $this->search_result;
143  }
__createLocateString()
build locate string in case of AND search
setFields($a_fields)
Set fields to search.
foreach($_POST as $key=> $value) $res
$query
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 144 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().

145  {
146  $this->setFields(array('title'));
147 
148  $in = $this->__createInStatement();
149  $where = $this->__createTitleWhereCondition();
150  $locate = $this->__createLocateString();
151 
152  $query = "SELECT rbac_id,obj_id,obj_type " .
153  $locate .
154  "FROM il_meta_general " .
155  $where . " " . $in . ' ';
156 
157  $res = $this->db->query($query);
158  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
159  $this->search_result->addEntry($row->rbac_id, $row->obj_type, $this->__prepareFound($row), $row->obj_id);
160  }
161 
162  return $this->search_result;
163  }
__createLocateString()
build locate string in case of AND search
setFields($a_fields)
Set fields to search.
foreach($_POST as $key=> $value) $res
$query
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  case 'keyword':
68  return $this->__searchKeywords();
69 
70  case 'contribute':
71  return $this->__searchContribute();
72 
73  case 'title':
74  return $this->__searchTitles();
75 
76  case 'description':
77  return $this->__searchDescriptions();
78 
79  default:
80  echo "ilMDSearch::performSearch() no mode given";
81  return false;
82  }
83  }
+ 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: