31 include_once
'class.ilMDBase.php';
35 function ilMDKeyword($a_rbac_id = 0,$a_obj_id = 0,$a_obj_type =
'')
45 $this->keyword = $a_keyword;
49 return $this->keyword;
53 if(is_object($lng_obj))
55 $this->keyword_language = $lng_obj;
60 return is_object($this->keyword_language) ? $this->keyword_language :
false;
64 return is_object($this->keyword_language) ? $this->keyword_language->getLanguageCode() :
false;
72 $fields[
'meta_keyword_id'] = array(
'integer',$next_id = $ilDB->nextId(
'il_meta_keyword'));
74 if($this->db->insert(
'il_meta_keyword',$fields))
88 if($this->db->update(
'il_meta_keyword',
90 array(
"meta_keyword_id" => array(
'integer',$this->
getMetaId()))))
104 $query =
"DELETE FROM il_meta_keyword ".
105 "WHERE meta_keyword_id = ".$ilDB->quote($this->
getMetaId() ,
'integer');
116 return array(
'rbac_id' => array(
'integer',$this->
getRBACId()),
117 'obj_id' => array(
'integer', $this->
getObjId()),
118 'obj_type' => array(
'text', $this->
getObjType()),
120 'parent_id' => array(
'integer', $this->
getParentId()),
121 'keyword' => array(
'text', $this->
getKeyword()),
129 include_once
'Services/MetaData/classes/class.ilMDLanguageItem.php';
133 $query =
"SELECT * FROM il_meta_keyword ".
134 "WHERE meta_keyword_id = ".$ilDB->quote($this->
getMetaId() ,
'integer');
166 function _getIds($a_rbac_id,$a_obj_id,$a_parent_id,$a_parent_type)
170 $query =
"SELECT meta_keyword_id FROM il_meta_keyword ".
171 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,
'integer').
" ".
172 "AND obj_id = ".$ilDB->quote($a_obj_id ,
'integer').
" ".
173 "AND parent_id = ".$ilDB->quote($a_parent_id ,
'integer').
" ".
174 "AND parent_type = ".$ilDB->quote($a_parent_type ,
'text').
" ".
175 "ORDER BY meta_keyword_id ";
180 $ids[] =
$row->meta_keyword_id;
182 return $ids ? $ids : array();
197 global
$ilDB,$ilObjDataCache;
199 $query =
"SELECT keyword,keyword_language ".
200 "FROM il_meta_keyword ".
201 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,
'integer').
" ".
202 "AND obj_id = ".$ilDB->quote($a_obj_id ,
'integer').
" ".
203 "AND obj_type = ".$ilDB->quote($a_type ,
'text').
" ";
209 $keywords[
$row->keyword_language][] =
$row->keyword;
212 return $keywords ? $keywords : array();
228 $key_string[$lng_code] = implode(
",",$keywords);
230 return $key_string ? $key_string : array();
246 foreach((array) explode(
' ',$a_query) as $part)
252 $qs .= ($ilDB->like(
'keyword',
'text',$part).
' ');
257 $query =
"SELECT * FROM il_meta_keyword ".
258 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id,
'integer').
' '.
259 'AND obj_type = '.$ilDB->quote($a_type,
'text').
' '.
264 $query =
"SELECT * FROM il_meta_keyword ".
265 'WHERE obj_type = '.$ilDB->quote($a_type,
'text').
' '.
271 $obj_ids[] =
$row->obj_id;
273 return (array) $obj_ids;
287 $query =
"SELECT * FROM il_meta_keyword ".
288 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id,
'integer').
' '.
289 "AND obj_id = ".$ilDB->quote($a_obj_id,
'integer').
' ';
293 if(strlen(
$row->keyword))
294 $kws[] =
$row->keyword;