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')
234 if($a_field_id == self::$mappings->getMappingByECSName(
'begin') and
235 $end = self::$mappings->getMappingByECSName(
'end'))
238 $start = in_array($a_field_id,$this->date_fields) ?
241 $end = in_array($end,$this->date_fields) ?
245 include_once(
'./Services/Calendar/classes/class.ilCalendarUtil.php');
251 return $weekday.
', '.$value;
254 if(in_array($a_field_id,$this->date_fields))
258 elseif(in_array($a_field_id,$this->datetime_fields))
264 return $value = $a_values[$a_field_id];
278 $this->substitutions = array();
279 $this->bold = array();
280 $this->newline = array();
292 $this->substitutions[] = $a_field_id;
295 $this->bold[] = $a_field_id;
299 $this->newline[] = $a_field_id;
312 return $this->substitutions ? $this->substitutions : array();
336 #var_dump("<pre>",$this->bold,$a_field_id,"</pre>");
338 return in_array($a_field_id,$this->bold);
350 return in_array($a_field_id,$this->newline);
365 foreach($this->substitutions as $field_id)
373 $query =
"DELETE FROM adv_md_substitutions WHERE obj_type = ".$ilDB->quote($this->type,
'text');
378 'obj_type' => array(
'text',$this->type),
383 $ilDB->insert(
'adv_md_substitutions',$values);
396 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
398 $this->datetime_fields = ilAdvancedMDFieldDefinition::_lookupDatetimeFields();
401 $query =
"SELECT active,field_id,amfd.title FROM adv_md_record amr ".
402 "JOIN adv_md_record_objs amro ON amr.record_id = amro.record_id ".
403 "JOIN adv_mdf_definition amfd ON amr.record_id = amfd.record_id ".
405 "AND obj_type = ".$this->db->quote($this->type ,
'text').
" ";
407 $this->active =
$res->numRows() ?
true :
false;
410 $this->active_fields[
$row->field_id] =
$row->title;
413 $query =
"SELECT * FROM adv_md_substitutions ".
414 "WHERE obj_type = ".$this->db->quote($this->type ,
'text').
" ";
416 $this->substitutions = array();
417 $this->bold = array();
418 $this->newline = array();
421 $tmp_substitutions = unserialize(
$row->substitution);
422 if(is_array($tmp_substitutions))
424 foreach($tmp_substitutions as $substitution)
426 if($substitution[
'field_id'])
428 $this->substitutions[] = $substitution[
'field_id'];
430 if($substitution[
'bold'])
432 $this->bold[] = $substitution[
'field_id'];
434 if($substitution[
'newline'])
436 $this->newline[] = $substitution[
'field_id'];
441 $this->enabled_desc = !
$row->hide_description;
442 $this->enabled_field_names = !
$row->hide_field_names;
445 if($this->type ==
'crs' or $this->type ==
'rcrs')
448 if($begin = self::$mappings->getMappingByECSName(
'begin') and
449 $end = self::$mappings->getMappingByECSName(
'end'))
452 unset($this->active_fields[$end]);
465 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
467 if(isset(self::$mappings) and is_object(self::$mappings))