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 if(isset($a_definitions[$field_id]))
100 $sorted[$field_id] = $a_definitions[$field_id];
101 unset($a_definitions[$field_id]);
104 return array_merge($sorted,$a_definitions);
138 $this->enabled_desc = $a_status;
161 $this->enabled_field_names = $a_status;
180 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
186 if(!isset($this->active_fields[$field_id]))
191 $value = $this->
parseValue($field_id, $values_records);
197 $substituted[$counter-1][
'newline'] =
true;
202 $substituted[$counter][
'name'] = $this->active_fields[$field_id];
203 $substituted[$counter][
'value'] = $value;
204 $substituted[$counter][
'bold'] = $this->
isBold($field_id);
207 $substituted[$counter][
'newline'] =
true;
211 $substituted[$counter][
'newline'] =
false;
217 return $substituted ? $substituted : array();
234 if($this->type ==
'crs' or $this->type ==
'rcrs')
261 foreach($a_values_records as $a_values)
263 if($a_values->getADTGroup()->hasElement($a_field_id))
265 $element = $a_values->getADTGroup()->getElement($a_field_id);
266 if(!$element->isNull())
284 $this->substitutions = array();
285 $this->bold = array();
286 $this->newline = array();
298 $this->substitutions[] = $a_field_id;
301 $this->bold[] = $a_field_id;
305 $this->newline[] = $a_field_id;
318 return $this->substitutions ? $this->substitutions : array();
342 #var_dump("<pre>",$this->bold,$a_field_id,"</pre>");
344 return in_array($a_field_id,$this->bold);
356 return in_array($a_field_id,$this->newline);
371 foreach($this->substitutions as $field_id)
379 $query =
"DELETE FROM adv_md_substitutions WHERE obj_type = ".$ilDB->quote($this->type,
'text');
384 'obj_type' => array(
'text',$this->type),
389 $ilDB->insert(
'adv_md_substitutions',$values);
403 $query =
"SELECT active,field_id,amfd.title FROM adv_md_record amr ".
404 "JOIN adv_md_record_objs amro ON amr.record_id = amro.record_id ".
405 "JOIN adv_mdf_definition amfd ON amr.record_id = amfd.record_id ".
407 "AND obj_type = ".$this->db->quote($this->type ,
'text').
" ";
409 $this->active =
$res->numRows() ?
true :
false;
412 $this->active_fields[
$row->field_id] =
$row->title;
415 $query =
"SELECT * FROM adv_md_substitutions ".
416 "WHERE obj_type = ".$this->db->quote($this->type ,
'text').
" ";
418 $this->substitutions = array();
419 $this->bold = array();
420 $this->newline = array();
423 $tmp_substitutions = unserialize(
$row->substitution);
424 if(is_array($tmp_substitutions))
426 foreach($tmp_substitutions as $substitution)
428 if($substitution[
'field_id'])
430 $this->substitutions[] = $substitution[
'field_id'];
432 if($substitution[
'bold'])
434 $this->bold[] = $substitution[
'field_id'];
436 if($substitution[
'newline'])
438 $this->newline[] = $substitution[
'field_id'];
443 $this->enabled_desc = !
$row->hide_description;
444 $this->enabled_field_names = !
$row->hide_field_names;
447 if($this->type ==
'crs' or $this->type ==
'rcrs')
471 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
473 if(isset(self::$mappings) and is_object(self::$mappings))