59 $this->record_id = $a_record_id;
78 if(isset(self::$instances[$a_record_id]))
80 return self::$instances[$a_record_id];
96 $query =
"SELECT DISTINCT(amr.record_id) FROM adv_md_record amr ".
97 "JOIN adv_mdf_definition amfd ON amr.record_id = amfd.record_id ".
98 "WHERE searchable = 1 AND active = 1 ";
105 return $records ? $records : array();
118 static $title_cache = array();
120 if(isset($title_cache[$a_record_id]))
122 return $title_cache[$a_record_id];
127 $query =
"SELECT title FROM adv_md_record ".
128 "WHERE record_id = ".$ilDB->quote($a_record_id ,
'integer').
" ";
132 return $title_cache[$a_record_id] =
$row->title;
147 $query =
"SELECT record_id FROM adv_md_record ".
148 "WHERE import_id = ".$ilDB->quote($a_ilias_id ,
'text').
" ";
152 return $row->record_id;
165 return array(
'cat',
'crs',
'rcrs');
180 $query =
"SELECT DISTINCT(obj_type) FROM adv_md_record_objs amo ".
181 "JOIN adv_md_record amr ON amo.record_id = amr.record_id ".
203 $query =
"SELECT record_id FROM adv_md_record ";
209 return $records ? $records : array();
226 $query =
"SELECT * FROM adv_md_record_objs ";
249 $query =
"SELECT amro.record_id record_id FROM adv_md_record_objs amro ".
250 "JOIN adv_md_record amr ON amr.record_id = amro.record_id ".
252 "AND obj_type = ".$ilDB->quote($a_obj_type ,
'text').
" ";
279 $query =
"DELETE FROM adv_md_record ".
280 "WHERE record_id = ".$ilDB->quote($a_record_id ,
'integer').
" ";
283 $query =
"DELETE FROM adv_md_record_objs ".
284 "WHERE record_id = ".$ilDB->quote($a_record_id ,
'integer').
" ";
295 public function delete()
311 $next_id = $ilDB->nextId(
'adv_md_record');
313 $query =
"INSERT INTO adv_md_record (record_id,import_id,active,title,description) ".
315 $ilDB->quote($next_id,
'integer').
", ".
316 $this->db->quote($this->
getImportId(),
'text').
", ".
317 $this->db->quote($this->
isActive() ,
'integer').
", ".
318 $this->db->quote($this->
getTitle() ,
'text').
", ".
322 $this->record_id = $next_id;
327 $query =
"UPDATE adv_md_record ".
329 "WHERE record_id = ".$this->db->quote($this->record_id ,
'integer').
" ";
337 $query =
"INSERT INTO adv_md_record_objs (record_id,obj_type) ".
339 $this->db->quote($this->
getRecordId() ,
'integer').
", ".
340 $this->db->quote($type ,
'text').
" ".
356 $query =
"UPDATE adv_md_record ".
357 "SET active = ".$this->db->quote($this->
isActive() ,
'integer').
", ".
358 "title = ".$this->db->quote($this->
getTitle() ,
'text').
", ".
359 "description = ".$this->db->quote($this->
getDescription() ,
'text').
" ".
360 "WHERE record_id = ".$this->db->quote($this->
getRecordId() ,
'integer').
" ";
364 $query =
"DELETE FROM adv_md_record_objs ".
365 "WHERE record_id = ".$this->db->quote($this->
getRecordId() ,
'integer').
" ";
371 $query =
"INSERT INTO adv_md_record_objs (record_id,obj_type) ".
373 $this->db->quote($this->
getRecordId() ,
'integer').
", ".
374 $this->db->quote($type ,
'text').
" ".
393 $ilErr->setMessage(
'fill_out_all_required_fields');
419 $this->active = $a_active;
442 $this->title = $a_title;
465 $this->description = $a_description;
488 $this->import_id = $a_id_string;
511 $this->obj_types = $a_obj_types;
523 $this->obj_types[] = $a_obj_type;
534 return $this->obj_types ? $this->obj_types : array();
555 $writer->
xmlElement(
'ObjectType',null,$obj_type);
558 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
561 $definition->toXML($writer);
577 $query =
"SELECT * FROM adv_md_record ".
578 "WHERE record_id = ".$this->db->quote($this->
getRecordId() ,
'integer').
" ";
587 $query =
"SELECT * FROM adv_md_record_objs ".
588 "WHERE record_id = ".$this->db->quote($this->
getRecordId() ,
'integer').
" ";
592 $this->obj_types[] =
$row->obj_type;
604 return 'il_'.IL_INST_ID.
'_adv_md_record_'.$this->
getRecordId();