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);
363 foreach($this->substitutions as $field_id)
372 $query =
"REPLACE INTO adv_md_substitutions ".
373 "SET obj_type = ".$this->db->quote($this->type).
", ".
374 "substitution = ".$this->db->quote(serialize(
$substitutions)).
", ".
379 $res = $this->db->query($query);
390 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
392 $this->datetime_fields = ilAdvancedMDFieldDefinition::_lookupDatetimeFields();
395 $query =
"SELECT active,field_id,amfd.title FROM adv_md_record AS amr ".
396 "JOIN adv_md_record_objs AS amro ON amr.record_id = amro.record_id ".
397 "JOIN adv_md_field_definition AS amfd ON amr.record_id = amfd.record_id ".
399 "AND obj_type = ".$this->db->quote($this->type).
" ";
400 $res = $this->db->query($query);
401 $this->active =
$res->numRows() ?
true :
false;
404 $this->active_fields[$row->field_id] = $row->title;
407 $query =
"SELECT * FROM adv_md_substitutions ".
408 "WHERE obj_type = ".$this->db->quote($this->type).
" ";
409 $res = $this->db->query($query);
410 $this->substitutions = array();
411 $this->bold = array();
412 $this->newline = array();
415 $tmp_substitutions = unserialize($row->substitution);
416 if(is_array($tmp_substitutions))
418 foreach($tmp_substitutions as $substitution)
420 if($substitution[
'field_id'])
422 $this->substitutions[] = $substitution[
'field_id'];
424 if($substitution[
'bold'])
426 $this->bold[] = $substitution[
'field_id'];
428 if($substitution[
'newline'])
430 $this->newline[] = $substitution[
'field_id'];
435 $this->enabled_desc = !$row->hide_description;
436 $this->enabled_field_names = !$row->hide_field_names;
439 if($this->type ==
'crs' or $this->type ==
'rcrs')
442 if($begin = self::$mappings->getMappingByECSName(
'begin') and
443 $end = self::$mappings->getMappingByECSName(
'end'))
446 unset($this->active_fields[$end]);
459 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
461 if(isset(self::$mappings) and is_object(self::$mappings))