ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilMDKeyword Class Reference
+ Inheritance diagram for ilMDKeyword:
+ Collaboration diagram for ilMDKeyword:

Public Member Functions

 setKeyword ($a_keyword)
 
 getKeyword ()
 
 setKeywordLanguage (&$lng_obj)
 
getKeywordLanguage ()
 
 getKeywordLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 setKeyword ($a_keyword)
 
 getKeyword ()
 
 setKeywordLanguage (&$lng_obj)
 
getKeywordLanguage ()
 
 getKeywordLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 _getIds ($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
 
 setKeyword ($a_keyword)
 
 getKeyword ()
 
 setKeywordLanguage (&$lng_obj)
 
getKeywordLanguage ()
 
 getKeywordLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
- Public Member Functions inherited from ilMDBase
 __construct ( $a_rbac_id=0, $a_obj_id=0, $a_type=0)
 
 setRBACId ($a_id)
 
 getRBACId ()
 
 setObjId ($a_id)
 
 getObjId ()
 
 setObjType ($a_type)
 
 getObjType ()
 
 setMetaId ($a_meta_id, $a_read_data=true)
 
 getMetaId ()
 
 setParentType ($a_parent_type)
 
 getParentType ()
 
 setParentId ($a_id)
 
 getParentId ()
 
 setExportMode ($a_export_mode=true)
 
 getExportMode ()
 
 validate ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (&$writer)
 
 __construct ( $a_rbac_id=0, $a_obj_id=0, $a_type=0)
 
 setRBACId ($a_id)
 
 getRBACId ()
 
 setObjId ($a_id)
 
 getObjId ()
 
 setObjType ($a_type)
 
 getObjType ()
 
 setMetaId ($a_meta_id, $a_read_data=true)
 
 getMetaId ()
 
 setParentType ($a_parent_type)
 
 getParentType ()
 
 setParentId ($a_id)
 
 getParentId ()
 
 validate ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (&$writer)
 
 __construct ( $a_rbac_id=0, $a_obj_id=0, $a_type=0)
 
 setRBACId ($a_id)
 
 getRBACId ()
 
 setObjId ($a_id)
 
 getObjId ()
 
 setObjType ($a_type)
 
 getObjType ()
 
 setMetaId ($a_meta_id, $a_read_data=true)
 
 getMetaId ()
 
 setParentType ($a_parent_type)
 
 getParentType ()
 
 setParentId ($a_id)
 
 getParentId ()
 
 setExportMode ($a_export_mode=true)
 
 getExportMode ()
 
 validate ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (&$writer)
 

Static Public Member Functions

static _getIds ($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
 
static _getKeywordsByLanguage ($a_rbac_id, $a_obj_id, $a_type)
 Get keywords by language. More...
 
static _getKeywordsByLanguageAsString ($a_rbac_id, $a_obj_id, $a_type)
 Get keywords by language as string. More...
 
static _searchKeywords ($a_query, $a_type, $a_rbac_id=0)
 Search for objects by keywords. More...
 
static _getMatchingKeywords ($a_query, $a_type, $a_rbac_id=0)
 Search for keywords. More...
 
static lookupKeywords ($a_rbac_id, $a_obj_id, $a_return_ids=false)
 Lookup Keywords. More...
 
static updateKeywords (ilMDGeneral $a_md_section, array $a_keywords)
 Update keywords from input array. More...
 
static _getIds ($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
 
static _getKeywordsByLanguage ($a_rbac_id, $a_obj_id, $a_type)
 Get keywords by language. More...
 
static _getKeywordsByLanguageAsString ($a_rbac_id, $a_obj_id, $a_type)
 Get keywords by language as string. More...
 
static _searchKeywords ($a_query, $a_type, $a_rbac_id=0)
 Search for objects by keywords. More...
 
static _getMatchingKeywords ($a_query, $a_type, $a_rbac_id=0)
 Search for keywords. More...
 
static lookupKeywords ($a_rbac_id, $a_obj_id, $a_return_ids=false)
 Lookup Keywords. More...
 
static updateKeywords (ilMDGeneral $a_md_section, array $a_keywords)
 Update keywords from input array. More...
 

Additional Inherited Members

- Data Fields inherited from ilMDBase
 $rbac_id
 
 $obj_id
 
 $obj_type
 
 $export_mode = false
 
- Protected Attributes inherited from ilMDBase
 $log
 

Detailed Description

Definition at line 33 of file class.ilMDKeyword.php.

Member Function Documentation

◆ __getFields() [1/3]

ilMDKeyword::__getFields ( )

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

References getKeyword(), getKeywordLanguageCode(), ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getParentId(), ilMDBase\getParentType(), ilMDBase\getRBACId(), and ilUtil\prepareDBString().

107  {
108  return array('rbac_id' => $this->getRBACId(),
109  'obj_id' => $this->getObjId(),
110  'obj_type' => ilUtil::prepareDBString($this->getObjType()),
111  'parent_type' => $this->getParentType(),
112  'parent_id' => $this->getParentId(),
113  'keyword' => ilUtil::prepareDBString($this->getKeyword()),
114  'keyword_language' => ilUtil::prepareDBString($this->getKeywordLanguageCode()));
115  }
static prepareDBString($a_str)
prepare a string for db writing (insert/update)
+ Here is the call graph for this function:

◆ __getFields() [2/3]

ilMDKeyword::__getFields ( )

Definition at line 110 of file class.ilMDKeyword.php.

References getKeyword(), getKeywordLanguageCode(), ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getParentId(), ilMDBase\getParentType(), and ilMDBase\getRBACId().

111  {
112  return array('rbac_id' => array('integer',$this->getRBACId()),
113  'obj_id' => array('integer', $this->getObjId()),
114  'obj_type' => array('text', $this->getObjType()),
115  'parent_type' => array('text', $this->getParentType()),
116  'parent_id' => array('integer', $this->getParentId()),
117  'keyword' => array('text', $this->getKeyword()),
118  'keyword_language' => array('text', $this->getKeywordLanguageCode()));
119  }
+ Here is the call graph for this function:

◆ __getFields() [3/3]

ilMDKeyword::__getFields ( )

Definition at line 110 of file class.ilMDKeyword.php.

References getKeyword(), getKeywordLanguageCode(), ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getParentId(), ilMDBase\getParentType(), and ilMDBase\getRBACId().

Referenced by save().

111  {
112  return array('rbac_id' => array('integer',$this->getRBACId()),
113  'obj_id' => array('integer', $this->getObjId()),
114  'obj_type' => array('text', $this->getObjType()),
115  'parent_type' => array('text', $this->getParentType()),
116  'parent_id' => array('integer', $this->getParentId()),
117  'keyword' => array('text', $this->getKeyword()),
118  'keyword_language' => array('text', $this->getKeywordLanguageCode()));
119  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getIds() [1/3]

ilMDKeyword::_getIds (   $a_rbac_id,
  $a_obj_id,
  $a_parent_id,
  $a_parent_type 
)

Definition at line 153 of file class.ilMDKeyword.php.

References $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

154  {
155  global $ilDB;
156 
157  $query = "SELECT meta_keyword_id FROM il_meta_keyword " .
158  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id) . " " .
159  "AND obj_id = " . $ilDB->quote($a_obj_id) . " " .
160  "AND parent_id = " . $ilDB->quote($a_parent_id) . " " .
161  "AND parent_type = " . $ilDB->quote($a_parent_type);
162 
163  $res = $ilDB->query($query);
164  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
165  $ids[] = $row->meta_keyword_id;
166  }
167  return $ids ? $ids : array();
168  }
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB

◆ _getIds() [2/3]

static ilMDKeyword::_getIds (   $a_rbac_id,
  $a_obj_id,
  $a_parent_id,
  $a_parent_type 
)
static

Definition at line 165 of file class.ilMDKeyword.php.

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

166  {
167  global $DIC;
168 
169  $ilDB = $DIC['ilDB'];
170 
171  $query = "SELECT meta_keyword_id FROM il_meta_keyword " .
172  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
173  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
174  "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
175  "AND parent_type = " . $ilDB->quote($a_parent_type, 'text') . " " .
176  "ORDER BY meta_keyword_id ";
177 
178  $res = $ilDB->query($query);
179  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
180  $ids[] = $row->meta_keyword_id;
181  }
182  return $ids ? $ids : array();
183  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB

◆ _getIds() [3/3]

static ilMDKeyword::_getIds (   $a_rbac_id,
  $a_obj_id,
  $a_parent_id,
  $a_parent_type 
)
static

Definition at line 165 of file class.ilMDKeyword.php.

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilMDClassification\getKeywordIds(), and ilMDGeneral\getKeywordIds().

166  {
167  global $DIC;
168 
169  $ilDB = $DIC['ilDB'];
170 
171  $query = "SELECT meta_keyword_id FROM il_meta_keyword " .
172  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
173  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
174  "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
175  "AND parent_type = " . $ilDB->quote($a_parent_type, 'text') . " " .
176  "ORDER BY meta_keyword_id ";
177 
178  $res = $ilDB->query($query);
179  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
180  $ids[] = $row->meta_keyword_id;
181  }
182  return $ids ? $ids : array();
183  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ _getKeywordsByLanguage() [1/2]

static ilMDKeyword::_getKeywordsByLanguage (   $a_rbac_id,
  $a_obj_id,
  $a_type 
)
static

Get keywords by language.

public

Parameters
intrbac_id
intobj_id
stringobj type

Definition at line 195 of file class.ilMDKeyword.php.

References $a_type, $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

196  {
197  global $DIC;
198 
199  $ilDB = $DIC['ilDB'];
200  $ilObjDataCache = $DIC['ilObjDataCache'];
201 
202  $query = "SELECT keyword,keyword_language " .
203  "FROM il_meta_keyword " .
204  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
205  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
206  "AND obj_type = " . $ilDB->quote($a_type, 'text') . " ";
207  $res = $ilDB->query($query);
208  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
209  if ($row->keyword) {
210  $keywords[$row->keyword_language][] = $row->keyword;
211  }
212  }
213  return $keywords ? $keywords : array();
214  }
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB

◆ _getKeywordsByLanguage() [2/2]

static ilMDKeyword::_getKeywordsByLanguage (   $a_rbac_id,
  $a_obj_id,
  $a_type 
)
static

Get keywords by language.

public

Parameters
intrbac_id
intobj_id
stringobj type

Definition at line 195 of file class.ilMDKeyword.php.

References $a_type, $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by _getKeywordsByLanguageAsString().

196  {
197  global $DIC;
198 
199  $ilDB = $DIC['ilDB'];
200  $ilObjDataCache = $DIC['ilObjDataCache'];
201 
202  $query = "SELECT keyword,keyword_language " .
203  "FROM il_meta_keyword " .
204  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
205  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
206  "AND obj_type = " . $ilDB->quote($a_type, 'text') . " ";
207  $res = $ilDB->query($query);
208  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
209  if ($row->keyword) {
210  $keywords[$row->keyword_language][] = $row->keyword;
211  }
212  }
213  return $keywords ? $keywords : array();
214  }
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ _getKeywordsByLanguageAsString() [1/2]

static ilMDKeyword::_getKeywordsByLanguageAsString (   $a_rbac_id,
  $a_obj_id,
  $a_type 
)
static

Get keywords by language as string.

public

Parameters
intrbac_id
intobj_id
stringobj type

Definition at line 225 of file class.ilMDKeyword.php.

References $a_type, and _getKeywordsByLanguage().

226  {
227  foreach (ilMDKeyword::_getKeywordsByLanguage($a_rbac_id, $a_obj_id, $a_type) as $lng_code => $keywords) {
228  $key_string[$lng_code] = implode(",", $keywords);
229  }
230  return $key_string ? $key_string : array();
231  }
$a_type
Definition: workflow.php:92
static _getKeywordsByLanguage($a_rbac_id, $a_obj_id, $a_type)
Get keywords by language.
+ Here is the call graph for this function:

◆ _getKeywordsByLanguageAsString() [2/2]

static ilMDKeyword::_getKeywordsByLanguageAsString (   $a_rbac_id,
  $a_obj_id,
  $a_type 
)
static

Get keywords by language as string.

public

Parameters
intrbac_id
intobj_id
stringobj type

Definition at line 225 of file class.ilMDKeyword.php.

References $a_type, and _getKeywordsByLanguage().

Referenced by ilMDUtils\_fillHTMLMetaTags().

226  {
227  foreach (ilMDKeyword::_getKeywordsByLanguage($a_rbac_id, $a_obj_id, $a_type) as $lng_code => $keywords) {
228  $key_string[$lng_code] = implode(",", $keywords);
229  }
230  return $key_string ? $key_string : array();
231  }
$a_type
Definition: workflow.php:92
static _getKeywordsByLanguage($a_rbac_id, $a_obj_id, $a_type)
Get keywords by language.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getMatchingKeywords() [1/2]

static ilMDKeyword::_getMatchingKeywords (   $a_query,
  $a_type,
  $a_rbac_id = 0 
)
static

Search for keywords.

Parameters
string$a_query
string$a_type
int$a_rbac_id[optional]
Returns

Definition at line 282 of file class.ilMDKeyword.php.

References $a_type, $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilMDEditorGUI\keywordAutocomplete().

283  {
284  global $DIC;
285 
286  $ilDB = $DIC['ilDB'];
287 
288  $query = "SELECT DISTINCT keyword FROM il_meta_keyword " .
289  'WHERE obj_type = ' . $ilDB->quote($a_type, 'text') . ' ' .
290  'AND ' . $ilDB->like('keyword', 'text', '%' . trim($a_query) . '%') . ' ';
291 
292  if ($a_rbac_id) {
293  $query .= "AND rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . ' ';
294  }
295 
296  $res = $ilDB->query($query);
297  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
298  $kws[] = $row->keyword;
299  }
300  return (array) $kws;
301  }
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ _getMatchingKeywords() [2/2]

static ilMDKeyword::_getMatchingKeywords (   $a_query,
  $a_type,
  $a_rbac_id = 0 
)
static

Search for keywords.

Parameters
string$a_query
string$a_type
int$a_rbac_id[optional]
Returns

Definition at line 282 of file class.ilMDKeyword.php.

References $a_type, $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

283  {
284  global $DIC;
285 
286  $ilDB = $DIC['ilDB'];
287 
288  $query = "SELECT DISTINCT keyword FROM il_meta_keyword " .
289  'WHERE obj_type = ' . $ilDB->quote($a_type, 'text') . ' ' .
290  'AND ' . $ilDB->like('keyword', 'text', '%' . trim($a_query) . '%') . ' ';
291 
292  if ($a_rbac_id) {
293  $query .= "AND rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . ' ';
294  }
295 
296  $res = $ilDB->query($query);
297  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
298  $kws[] = $row->keyword;
299  }
300  return (array) $kws;
301  }
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB

◆ _searchKeywords() [1/2]

static ilMDKeyword::_searchKeywords (   $a_query,
  $a_type,
  $a_rbac_id = 0 
)
static

Search for objects by keywords.

Parameters
string$a_query
string$a_type
int$a_rbac_id[optional]
Returns

Definition at line 240 of file class.ilMDKeyword.php.

References $a_type, $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

241  {
242  global $DIC;
243 
244  $ilDB = $DIC['ilDB'];
245 
246  $qs = 'AND ';
247  $counter = 0;
248  foreach ((array) explode(' ', $a_query) as $part) {
249  if ($counter++) {
250  $qs .= 'OR ';
251  }
252  $qs .= ($ilDB->like('keyword', 'text', $part) . ' ');
253  }
254 
255  if ($a_rbac_id) {
256  $query = "SELECT obj_id FROM il_meta_keyword " .
257  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . ' ' .
258  'AND obj_type = ' . $ilDB->quote($a_type, 'text') . ' ' .
259  $qs;
260  } else {
261  $query = "SELECT obj_id FROM il_meta_keyword " .
262  'WHERE obj_type = ' . $ilDB->quote($a_type, 'text') . ' ' .
263  $qs;
264  }
265 
266  $res = $ilDB->query($query);
267  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
268  $obj_ids[] = $row->obj_id;
269  }
270 
271  return (array) $obj_ids;
272  }
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB

◆ _searchKeywords() [2/2]

static ilMDKeyword::_searchKeywords (   $a_query,
  $a_type,
  $a_rbac_id = 0 
)
static

Search for objects by keywords.

Parameters
string$a_query
string$a_type
int$a_rbac_id[optional]
Returns

Definition at line 240 of file class.ilMDKeyword.php.

References $a_type, $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilObjMediaPool\getMediaObjects().

241  {
242  global $DIC;
243 
244  $ilDB = $DIC['ilDB'];
245 
246  $qs = 'AND ';
247  $counter = 0;
248  foreach ((array) explode(' ', $a_query) as $part) {
249  if ($counter++) {
250  $qs .= 'OR ';
251  }
252  $qs .= ($ilDB->like('keyword', 'text', $part) . ' ');
253  }
254 
255  if ($a_rbac_id) {
256  $query = "SELECT obj_id FROM il_meta_keyword " .
257  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . ' ' .
258  'AND obj_type = ' . $ilDB->quote($a_type, 'text') . ' ' .
259  $qs;
260  } else {
261  $query = "SELECT obj_id FROM il_meta_keyword " .
262  'WHERE obj_type = ' . $ilDB->quote($a_type, 'text') . ' ' .
263  $qs;
264  }
265 
266  $res = $ilDB->query($query);
267  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
268  $obj_ids[] = $row->obj_id;
269  }
270 
271  return (array) $obj_ids;
272  }
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ delete() [1/3]

ilMDKeyword::delete ( )

Definition at line 90 of file class.ilMDKeyword.php.

References $ilDB, $query, and ilMDBase\getMetaId().

91  {
92  global $ilDB;
93 
94  if ($this->getMetaId()) {
95  $query = "DELETE FROM il_meta_keyword " .
96  "WHERE meta_keyword_id = " . $ilDB->quote($this->getMetaId());
97 
98  $this->db->query($query);
99 
100  return true;
101  }
102  return false;
103  }
$query
global $ilDB
+ Here is the call graph for this function:

◆ delete() [2/3]

ilMDKeyword::delete ( )

Definition at line 93 of file class.ilMDKeyword.php.

References $DIC, $ilDB, $query, $res, and ilMDBase\getMetaId().

94  {
95  global $DIC;
96 
97  $ilDB = $DIC['ilDB'];
98 
99  if ($this->getMetaId()) {
100  $query = "DELETE FROM il_meta_keyword " .
101  "WHERE meta_keyword_id = " . $ilDB->quote($this->getMetaId(), 'integer');
102  $res = $ilDB->manipulate($query);
103 
104  return true;
105  }
106  return false;
107  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ delete() [3/3]

ilMDKeyword::delete ( )

Definition at line 93 of file class.ilMDKeyword.php.

References $DIC, $ilDB, $query, $res, and ilMDBase\getMetaId().

94  {
95  global $DIC;
96 
97  $ilDB = $DIC['ilDB'];
98 
99  if ($this->getMetaId()) {
100  $query = "DELETE FROM il_meta_keyword " .
101  "WHERE meta_keyword_id = " . $ilDB->quote($this->getMetaId(), 'integer');
102  $res = $ilDB->manipulate($query);
103 
104  return true;
105  }
106  return false;
107  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ getKeyword() [1/3]

ilMDKeyword::getKeyword ( )

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

Referenced by __getFields(), and toXML().

41  {
42  return $this->keyword;
43  }
+ Here is the caller graph for this function:

◆ getKeyword() [2/3]

ilMDKeyword::getKeyword ( )

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

41  {
42  return $this->keyword;
43  }

◆ getKeyword() [3/3]

ilMDKeyword::getKeyword ( )

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

41  {
42  return $this->keyword;
43  }

◆ getKeywordLanguage() [1/3]

& ilMDKeyword::getKeywordLanguage ( )

Definition at line 50 of file class.ilMDKeyword.php.

51  {
52  return is_object($this->keyword_language) ? $this->keyword_language : false;
53  }

◆ getKeywordLanguage() [2/3]

& ilMDKeyword::getKeywordLanguage ( )

Definition at line 50 of file class.ilMDKeyword.php.

51  {
52  return is_object($this->keyword_language) ? $this->keyword_language : false;
53  }

◆ getKeywordLanguage() [3/3]

& ilMDKeyword::getKeywordLanguage ( )

Definition at line 50 of file class.ilMDKeyword.php.

51  {
52  return is_object($this->keyword_language) ? $this->keyword_language : false;
53  }

◆ getKeywordLanguageCode() [1/3]

ilMDKeyword::getKeywordLanguageCode ( )

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

Referenced by __getFields(), and toXML().

55  {
56  return is_object($this->keyword_language) ? $this->keyword_language->getLanguageCode() : false;
57  }
+ Here is the caller graph for this function:

◆ getKeywordLanguageCode() [2/3]

ilMDKeyword::getKeywordLanguageCode ( )

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

55  {
56  return is_object($this->keyword_language) ? $this->keyword_language->getLanguageCode() : false;
57  }

◆ getKeywordLanguageCode() [3/3]

ilMDKeyword::getKeywordLanguageCode ( )

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

55  {
56  return is_object($this->keyword_language) ? $this->keyword_language->getLanguageCode() : false;
57  }

◆ lookupKeywords() [1/2]

static ilMDKeyword::lookupKeywords (   $a_rbac_id,
  $a_obj_id,
  $a_return_ids = false 
)
static

Lookup Keywords.

Parameters
object$a_rbac_id
object$a_obj_id
bool$a_return_kw
Returns

Definition at line 310 of file class.ilMDKeyword.php.

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilObjMediaObjectGUI\_getMediaInfoHTML(), and ilBlogPosting\getKeywords().

311  {
312  global $DIC;
313 
314  $ilDB = $DIC['ilDB'];
315 
316  $query = "SELECT * FROM il_meta_keyword " .
317  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . ' ' .
318  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . ' ';
319  $res = $ilDB->query($query);
320  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
321  if (!$a_return_ids) {
322  if (strlen($row->keyword)) {
323  $kws[] = $row->keyword;
324  }
325  } else {
326  $kws[] = $row->meta_keyword_id;
327  }
328  }
329  return (array) $kws;
330  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ lookupKeywords() [2/2]

static ilMDKeyword::lookupKeywords (   $a_rbac_id,
  $a_obj_id,
  $a_return_ids = false 
)
static

Lookup Keywords.

Parameters
object$a_rbac_id
object$a_obj_id
bool$a_return_kw
Returns

Definition at line 310 of file class.ilMDKeyword.php.

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

311  {
312  global $DIC;
313 
314  $ilDB = $DIC['ilDB'];
315 
316  $query = "SELECT * FROM il_meta_keyword " .
317  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . ' ' .
318  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . ' ';
319  $res = $ilDB->query($query);
320  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
321  if (!$a_return_ids) {
322  if (strlen($row->keyword)) {
323  $kws[] = $row->keyword;
324  }
325  } else {
326  $kws[] = $row->meta_keyword_id;
327  }
328  }
329  return (array) $kws;
330  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB

◆ read() [1/3]

ilMDKeyword::read ( )

Definition at line 117 of file class.ilMDKeyword.php.

References $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, ilMDBase\getMetaId(), setKeyword(), setKeywordLanguage(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setParentId(), ilMDBase\setParentType(), ilMDBase\setRBACId(), and ilUtil\stripSlashes().

118  {
119  global $ilDB;
120 
121  include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
122 
123  if ($this->getMetaId()) {
124  $query = "SELECT * FROM il_meta_keyword " .
125  "WHERE meta_keyword_id = " . $ilDB->quote($this->getMetaId());
126 
127  $res = $this->db->query($query);
128  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
129  $this->setRBACId($row->rbac_id);
130  $this->setObjId($row->obj_id);
131  $this->setObjType($row->obj_type);
132  $this->setParentId($row->parent_id);
133  $this->setParentType($row->parent_type);
134  $this->setKeyword(ilUtil::stripSlashes($row->keyword));
135  $this->setKeywordLanguage(new ilMDLanguageItem($row->keyword_language));
136  }
137  }
138  return true;
139  }
setObjType($a_type)
setKeyword($a_keyword)
foreach($_POST as $key=> $value) $res
setKeywordLanguage(&$lng_obj)
setObjId($a_id)
setRBACId($a_id)
$query
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setParentId($a_id)
$row
global $ilDB
setParentType($a_parent_type)
+ Here is the call graph for this function:

◆ read() [2/3]

ilMDKeyword::read ( )

Definition at line 121 of file class.ilMDKeyword.php.

References $DIC, $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, ilMDBase\getMetaId(), setKeyword(), setKeywordLanguage(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setParentId(), ilMDBase\setParentType(), and ilMDBase\setRBACId().

122  {
123  global $DIC;
124 
125  $ilDB = $DIC['ilDB'];
126 
127  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
128 
129  if ($this->getMetaId()) {
130  $query = "SELECT * FROM il_meta_keyword " .
131  "WHERE meta_keyword_id = " . $ilDB->quote($this->getMetaId(), 'integer');
132 
133  $res = $this->db->query($query);
134  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
135  $this->setRBACId($row->rbac_id);
136  $this->setObjId($row->obj_id);
137  $this->setObjType($row->obj_type);
138  $this->setParentId($row->parent_id);
139  $this->setParentType($row->parent_type);
140  $this->setKeyword($row->keyword);
141  $this->setKeywordLanguage(new ilMDLanguageItem($row->keyword_language));
142  }
143  }
144  return true;
145  }
setObjType($a_type)
global $DIC
Definition: saml.php:7
setKeyword($a_keyword)
foreach($_POST as $key=> $value) $res
setKeywordLanguage(&$lng_obj)
setObjId($a_id)
setRBACId($a_id)
$query
setParentId($a_id)
$row
global $ilDB
setParentType($a_parent_type)
+ Here is the call graph for this function:

◆ read() [3/3]

ilMDKeyword::read ( )

Definition at line 121 of file class.ilMDKeyword.php.

References $DIC, $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, ilMDBase\getMetaId(), setKeyword(), setKeywordLanguage(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setParentId(), ilMDBase\setParentType(), and ilMDBase\setRBACId().

122  {
123  global $DIC;
124 
125  $ilDB = $DIC['ilDB'];
126 
127  include_once 'Services/Migration/DBUpdate_5295/classes/class.ilMDLanguageItem.php';
128 
129  if ($this->getMetaId()) {
130  $query = "SELECT * FROM il_meta_keyword " .
131  "WHERE meta_keyword_id = " . $ilDB->quote($this->getMetaId(), 'integer');
132 
133  $res = $this->db->query($query);
134  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
135  $this->setRBACId($row->rbac_id);
136  $this->setObjId($row->obj_id);
137  $this->setObjType($row->obj_type);
138  $this->setParentId($row->parent_id);
139  $this->setParentType($row->parent_type);
140  $this->setKeyword($row->keyword);
141  $this->setKeywordLanguage(new ilMDLanguageItem($row->keyword_language));
142  }
143  }
144  return true;
145  }
setObjType($a_type)
global $DIC
Definition: saml.php:7
setKeyword($a_keyword)
foreach($_POST as $key=> $value) $res
setKeywordLanguage(&$lng_obj)
setObjId($a_id)
setRBACId($a_id)
$query
setParentId($a_id)
$row
global $ilDB
setParentType($a_parent_type)
+ Here is the call graph for this function:

◆ save() [1/3]

ilMDKeyword::save ( )

Definition at line 59 of file class.ilMDKeyword.php.

References $DIC, $ilDB, __getFields(), ilMDBase\getMetaId(), and ilMDBase\setMetaId().

60  {
61  global $DIC;
62 
63  $ilDB = $DIC['ilDB'];
64 
65  $fields = $this->__getFields();
66  $fields['meta_keyword_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_keyword'));
67 
68  if ($this->db->insert('il_meta_keyword', $fields)) {
69  $this->setMetaId($next_id);
70  return $this->getMetaId();
71  }
72  return false;
73  }
global $DIC
Definition: saml.php:7
setMetaId($a_meta_id, $a_read_data=true)
global $ilDB
+ Here is the call graph for this function:

◆ save() [2/3]

ilMDKeyword::save ( )

Definition at line 59 of file class.ilMDKeyword.php.

References ilDBConstants\AUTOQUERY_INSERT, ilMDBase\getMetaId(), and ilMDBase\setMetaId().

60  {
61  if ($this->db->autoExecute(
62  'il_meta_keyword',
63  $this->__getFields(),
65  )) {
66  $this->setMetaId($this->db->getLastInsertId());
67 
68  return $this->getMetaId();
69  }
70  return false;
71  }
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ save() [3/3]

ilMDKeyword::save ( )

Definition at line 59 of file class.ilMDKeyword.php.

References $DIC, $ilDB, __getFields(), ilMDBase\getMetaId(), and ilMDBase\setMetaId().

60  {
61  global $DIC;
62 
63  $ilDB = $DIC['ilDB'];
64 
65  $fields = $this->__getFields();
66  $fields['meta_keyword_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_keyword'));
67 
68  if ($this->db->insert('il_meta_keyword', $fields)) {
69  $this->setMetaId($next_id);
70  return $this->getMetaId();
71  }
72  return false;
73  }
global $DIC
Definition: saml.php:7
setMetaId($a_meta_id, $a_read_data=true)
global $ilDB
+ Here is the call graph for this function:

◆ setKeyword() [1/3]

ilMDKeyword::setKeyword (   $a_keyword)

Definition at line 36 of file class.ilMDKeyword.php.

Referenced by read().

37  {
38  $this->keyword = $a_keyword;
39  }
+ Here is the caller graph for this function:

◆ setKeyword() [2/3]

ilMDKeyword::setKeyword (   $a_keyword)

Definition at line 36 of file class.ilMDKeyword.php.

37  {
38  $this->keyword = $a_keyword;
39  }

◆ setKeyword() [3/3]

ilMDKeyword::setKeyword (   $a_keyword)

Definition at line 36 of file class.ilMDKeyword.php.

37  {
38  $this->keyword = $a_keyword;
39  }

◆ setKeywordLanguage() [1/3]

ilMDKeyword::setKeywordLanguage ( $lng_obj)

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

45  {
46  if (is_object($lng_obj)) {
47  $this->keyword_language = $lng_obj;
48  }
49  }

◆ setKeywordLanguage() [2/3]

ilMDKeyword::setKeywordLanguage ( $lng_obj)

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

45  {
46  if (is_object($lng_obj)) {
47  $this->keyword_language = $lng_obj;
48  }
49  }

◆ setKeywordLanguage() [3/3]

ilMDKeyword::setKeywordLanguage ( $lng_obj)

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

Referenced by read().

45  {
46  if (is_object($lng_obj)) {
47  $this->keyword_language = $lng_obj;
48  }
49  }
+ Here is the caller graph for this function:

◆ toXML() [1/3]

ilMDKeyword::toXML ( $writer)

Definition at line 146 of file class.ilMDKeyword.php.

References getKeyword(), and getKeywordLanguageCode().

147  {
148  $writer->xmlElement('Keyword', array('Language' => $this->getKeywordLanguageCode()), $this->getKeyword());
149  }
+ Here is the call graph for this function:

◆ toXML() [2/3]

ilMDKeyword::toXML ( $writer)

Definition at line 152 of file class.ilMDKeyword.php.

References getKeyword(), and getKeywordLanguageCode().

153  {
154  $writer->xmlElement(
155  'Keyword',
156  array('Language' => $this->getKeywordLanguageCode() ?
157  $this->getKeywordLanguageCode() :
158  'en'),
159  $this->getKeyword()
160  );
161  }
+ Here is the call graph for this function:

◆ toXML() [3/3]

ilMDKeyword::toXML ( $writer)

Definition at line 152 of file class.ilMDKeyword.php.

References getKeyword(), and getKeywordLanguageCode().

153  {
154  $writer->xmlElement(
155  'Keyword',
156  array('Language' => $this->getKeywordLanguageCode() ?
157  $this->getKeywordLanguageCode() :
158  'en'),
159  $this->getKeyword()
160  );
161  }
+ Here is the call graph for this function:

◆ update() [1/3]

ilMDKeyword::update ( )

Definition at line 73 of file class.ilMDKeyword.php.

References $ilDB, ilDBConstants\AUTOQUERY_UPDATE, and ilMDBase\getMetaId().

74  {
75  global $ilDB;
76 
77  if ($this->getMetaId()) {
78  if ($this->db->autoExecute(
79  'il_meta_keyword',
80  $this->__getFields(),
82  "meta_keyword_id = " . $ilDB->quote($this->getMetaId())
83  )) {
84  return true;
85  }
86  }
87  return false;
88  }
global $ilDB
+ Here is the call graph for this function:

◆ update() [2/3]

ilMDKeyword::update ( )

Definition at line 75 of file class.ilMDKeyword.php.

References $DIC, $ilDB, and ilMDBase\getMetaId().

76  {
77  global $DIC;
78 
79  $ilDB = $DIC['ilDB'];
80 
81  if ($this->getMetaId()) {
82  if ($this->db->update(
83  'il_meta_keyword',
84  $this->__getFields(),
85  array("meta_keyword_id" => array('integer',$this->getMetaId()))
86  )) {
87  return true;
88  }
89  }
90  return false;
91  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the call graph for this function:

◆ update() [3/3]

ilMDKeyword::update ( )

Definition at line 75 of file class.ilMDKeyword.php.

References $DIC, $ilDB, and ilMDBase\getMetaId().

76  {
77  global $DIC;
78 
79  $ilDB = $DIC['ilDB'];
80 
81  if ($this->getMetaId()) {
82  if ($this->db->update(
83  'il_meta_keyword',
84  $this->__getFields(),
85  array("meta_keyword_id" => array('integer',$this->getMetaId()))
86  )) {
87  return true;
88  }
89  }
90  return false;
91  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the call graph for this function:

◆ updateKeywords() [1/2]

static ilMDKeyword::updateKeywords ( ilMDGeneral  $a_md_section,
array  $a_keywords 
)
static

Update keywords from input array.

Parameters
ilMDGeneral$a_md_section
array$a_keywordslang => keywords

Definition at line 337 of file class.ilMDKeyword.php.

References $id, $lang, ilMDGeneral\addKeyword(), ilMDGeneral\getKeyword(), ilMDGeneral\getKeywordIds(), and ilUtil\stripSlashes().

Referenced by ilBlogPosting\updateKeywords(), and ilMDEditorGUI\updateQuickEdit().

338  {
339  // trim keywords
340  $new_keywords = array();
341  foreach ($a_keywords as $lang => $keywords) {
342  foreach ((array) $keywords as $keyword) {
343  $keyword = trim($keyword);
344  if ($keyword != "" &&
345  !(is_array($new_keywords[$lang]) && in_array($keyword, $new_keywords[$lang]))) {
346  $new_keywords[$lang][] = $keyword;
347  }
348  }
349  }
350 
351  // update existing author entries (delete if not entered)
352  foreach ($ids = $a_md_section->getKeywordIds() as $id) {
353  $md_key = $a_md_section->getKeyword($id);
354  $lang = $md_key->getKeywordLanguageCode();
355 
356  // entered keyword already exists
357  if (is_array($new_keywords[$lang]) &&
358  in_array($md_key->getKeyword(), $new_keywords[$lang])) {
359  unset($new_keywords[$lang]
360  [array_search($md_key->getKeyword(), $new_keywords[$lang])]);
361  } else { // existing keyword has not been entered again -> delete
362  $md_key->delete();
363  }
364  }
365 
366  // insert entered, but not existing keywords
367  foreach ($new_keywords as $lang => $key_arr) {
368  foreach ($key_arr as $keyword) {
369  if ($keyword != "") {
370  $md_key = $a_md_section->addKeyword();
371  $md_key->setKeyword(ilUtil::stripSlashes($keyword));
372  $md_key->setKeywordLanguage(new ilMDLanguageItem($lang));
373  $md_key->save();
374  }
375  }
376  }
377  }
& getKeyword($a_keyword_id)
if(!array_key_exists('StateId', $_REQUEST)) $id
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateKeywords() [2/2]

static ilMDKeyword::updateKeywords ( ilMDGeneral  $a_md_section,
array  $a_keywords 
)
static

Update keywords from input array.

Parameters
ilMDGeneral$a_md_section
array$a_keywordslang => keywords

Definition at line 337 of file class.ilMDKeyword.php.

References $id, $lang, ilMDGeneral\addKeyword(), ilMDGeneral\getKeyword(), ilMDGeneral\getKeywordIds(), and ilUtil\stripSlashes().

338  {
339  // trim keywords
340  $new_keywords = array();
341  foreach ($a_keywords as $lang => $keywords) {
342  foreach ((array) $keywords as $keyword) {
343  $keyword = trim($keyword);
344  if ($keyword != "" &&
345  !(is_array($new_keywords[$lang]) && in_array($keyword, $new_keywords[$lang]))) {
346  $new_keywords[$lang][] = $keyword;
347  }
348  }
349  }
350 
351  // update existing author entries (delete if not entered)
352  foreach ($ids = $a_md_section->getKeywordIds() as $id) {
353  $md_key = $a_md_section->getKeyword($id);
354  $lang = $md_key->getKeywordLanguageCode();
355 
356  // entered keyword already exists
357  if (is_array($new_keywords[$lang]) &&
358  in_array($md_key->getKeyword(), $new_keywords[$lang])) {
359  unset($new_keywords[$lang]
360  [array_search($md_key->getKeyword(), $new_keywords[$lang])]);
361  } else { // existing keyword has not been entered again -> delete
362  $md_key->delete();
363  }
364  }
365 
366  // insert entered, but not existing keywords
367  foreach ($new_keywords as $lang => $key_arr) {
368  foreach ($key_arr as $keyword) {
369  if ($keyword != "") {
370  $md_key = $a_md_section->addKeyword();
371  $md_key->setKeyword(ilUtil::stripSlashes($keyword));
372  $md_key->setKeywordLanguage(new ilMDLanguageItem($lang));
373  $md_key->save();
374  }
375  }
376  }
377  }
& getKeyword($a_keyword_id)
if(!array_key_exists('StateId', $_REQUEST)) $id
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
+ Here is the call graph for this function:

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