33 public function __construct($a_field_id,$a_obj_id = 0, $a_sub_type =
"", $a_sub_id = 0)
39 $this->obj_id = $a_obj_id;
42 $this->field_id = $a_field_id;
55 public static function _getInstance($a_obj_id,$a_field_id, $a_sub_type =
"", $a_sub_id = 0)
57 if ($a_sub_type ==
"")
61 if(isset(self::$instances[$a_obj_id][$a_field_id][$a_sub_type][$a_sub_id]))
63 return self::$instances[$a_obj_id][$a_field_id][$a_sub_type][$a_sub_id];
65 return self::$instances[$a_obj_id][$a_field_id][$a_sub_type][$a_sub_id] =
new ilAdvancedMDValue($a_field_id,$a_obj_id, $a_sub_type, $a_sub_id);
88 $this->obj_id = $a_obj_id;
102 $this->sub_type = $a_val;
112 return $this->sub_type;
122 $this->sub_id = (int) $a_val;
132 return $this->sub_id;
144 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
146 $xml_writer->xmlElement(
'Value',
161 $this->value = $a_value;
196 $this->disabled = (bool) $a_status;
205 public function delete()
209 $query =
"DELETE FROM adv_md_values ".
210 "WHERE obj_id = ".$this->db->quote($this->obj_id ,
'integer').
" ".
211 "AND sub_type = ".$this->db->quote($this->
getSubType() ,
'text').
" ".
212 "AND sub_id = ".$this->db->quote($this->
getSubId() ,
'integer').
" ".
213 "AND field_id = ".$this->db->quote($this->field_id ,
'integer');
229 $query =
"INSERT INTO adv_md_values (obj_id,field_id,sub_type, sub_id, value,disabled) ".
231 $this->db->quote($this->obj_id ,
'integer').
", ".
232 $this->db->quote($this->field_id ,
'integer').
", ".
233 $this->db->quote($this->
getSubType() ,
'text').
", ".
234 $this->db->quote($this->getSubid() ,
'integer').
", ".
235 $this->db->quote($this->
getValue() ,
'text').
", ".
236 $ilDB->quote($this->
isDisabled(),
'integer').
" ".
250 if(!$this->obj_id or !$this->field_id)
255 $query =
"SELECT * FROM adv_md_values ".
256 "WHERE obj_id = ".$this->db->quote($this->obj_id ,
'integer').
" ".
257 "AND sub_type = ".$this->db->quote($this->
getSubType() ,
'text').
" ".
258 "AND sub_id = ".$this->db->quote($this->
getSubId() ,
'integer').
" ".
259 "AND field_id = ".$this->db->quote($this->field_id ,
'integer').
" ";