63 $this->type = $a_type;
79 if(isset(self::$instances[$a_type]))
81 return self::$instances[$a_type];
96 foreach($this->substitutions as $field_id)
98 $sorted[] = $field_id;
99 $key = array_search($field_id,$a_definitions);
100 unset($a_definitions[$key]);
102 return array_merge($sorted,$a_definitions);
136 $this->enabled_desc = $a_status;
159 $this->enabled_field_names = $a_status;
178 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
184 if(!isset($this->active_fields[$field_id]))
188 if(!isset($values[$field_id]) or !$values[$field_id])
192 $substituted[$counter-1][
'newline'] =
true;
197 $value = $this->
parseValue($field_id,$values);
199 $substituted[$counter][
'name'] = $this->active_fields[$field_id];
200 $substituted[$counter][
'value'] = $value;
201 $substituted[$counter][
'bold'] = $this->
isBold($field_id);
204 $substituted[$counter][
'newline'] =
true;
208 $substituted[$counter][
'newline'] =
false;
214 return $substituted ? $substituted : array();
231 if($this->type ==
'crs' or $this->type ==
'rcrs')
257 if(in_array($a_field_id,$this->date_fields))
261 elseif(in_array($a_field_id,$this->datetime_fields))
267 return $value = $a_values[$a_field_id];
281 $this->substitutions = array();
282 $this->bold = array();
283 $this->newline = array();
295 $this->substitutions[] = $a_field_id;
298 $this->bold[] = $a_field_id;
302 $this->newline[] = $a_field_id;
315 return $this->substitutions ? $this->substitutions : array();
339 #var_dump("<pre>",$this->bold,$a_field_id,"</pre>");
341 return in_array($a_field_id,$this->bold);
353 return in_array($a_field_id,$this->newline);
368 foreach($this->substitutions as $field_id)
376 $query =
"DELETE FROM adv_md_substitutions WHERE obj_type = ".$ilDB->quote($this->type,
'text');
381 'obj_type' => array(
'text',$this->type),
386 $ilDB->insert(
'adv_md_substitutions',$values);
399 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
401 $this->datetime_fields = ilAdvancedMDFieldDefinition::_lookupDatetimeFields();
404 $query =
"SELECT active,field_id,amfd.title FROM adv_md_record amr ".
405 "JOIN adv_md_record_objs amro ON amr.record_id = amro.record_id ".
406 "JOIN adv_mdf_definition amfd ON amr.record_id = amfd.record_id ".
408 "AND obj_type = ".$this->db->quote($this->type ,
'text').
" ";
410 $this->active =
$res->numRows() ?
true :
false;
413 $this->active_fields[
$row->field_id] =
$row->title;
416 $query =
"SELECT * FROM adv_md_substitutions ".
417 "WHERE obj_type = ".$this->db->quote($this->type ,
'text').
" ";
419 $this->substitutions = array();
420 $this->bold = array();
421 $this->newline = array();
424 $tmp_substitutions = unserialize(
$row->substitution);
425 if(is_array($tmp_substitutions))
427 foreach($tmp_substitutions as $substitution)
429 if($substitution[
'field_id'])
431 $this->substitutions[] = $substitution[
'field_id'];
433 if($substitution[
'bold'])
435 $this->bold[] = $substitution[
'field_id'];
437 if($substitution[
'newline'])
439 $this->newline[] = $substitution[
'field_id'];
444 $this->enabled_desc = !
$row->hide_description;
445 $this->enabled_field_names = !
$row->hide_field_names;
448 if($this->type ==
'crs' or $this->type ==
'rcrs')
472 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
474 if(isset(self::$mappings) and is_object(self::$mappings))