79 if (isset(self::$instances[
$a_type])) {
80 return self::$instances[
$a_type];
95 foreach ($this->substitutions as $field_id) {
96 if (isset($a_definitions[$field_id])) {
97 $sorted[$field_id] = $a_definitions[$field_id];
98 unset($a_definitions[$field_id]);
101 return array_merge($sorted, $a_definitions);
135 $this->enabled_desc = $a_status;
158 $this->enabled_field_names = $a_status;
176 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
181 if (!isset($this->active_fields[$field_id])) {
185 $value = $this->
parseValue($field_id, $values_records);
187 if ($value === null) {
189 $substituted[$counter-1][
'newline'] =
true;
194 $substituted[
$counter][
'name'] = $this->active_fields[$field_id];
195 $substituted[
$counter][
'value'] = $value;
198 $substituted[
$counter][
'newline'] =
true;
200 $substituted[
$counter][
'newline'] =
false;
206 return $substituted ? $substituted :
array();
223 if ($this->type ==
'crs' or $this->type ==
'rcrs') {
249 foreach ($a_values_records as $a_values) {
250 if ($a_values->getADTGroup()->hasElement($a_field_id)) {
251 $element = $a_values->getADTGroup()->getElement($a_field_id);
252 if (!$element->isNull()) {
269 $this->substitutions =
array();
270 $this->bold =
array();
271 $this->newline =
array();
283 $this->substitutions[] = $a_field_id;
285 $this->bold[] = $a_field_id;
288 $this->newline[] = $a_field_id;
301 return $this->substitutions ? $this->substitutions :
array();
325 #var_dump("<pre>",$this->bold,$a_field_id,"</pre>"); 327 return in_array($a_field_id, $this->bold);
339 return in_array($a_field_id, $this->newline);
354 foreach ($this->substitutions as $field_id) {
361 $query =
"DELETE FROM adv_md_substitutions WHERE obj_type = " . $ilDB->quote($this->type,
'text');
366 'obj_type' =>
array(
'text',$this->type),
371 $ilDB->insert(
'adv_md_substitutions', $values);
385 $query =
"SELECT active,field_id,amfd.title FROM adv_md_record amr " .
386 "JOIN adv_md_record_objs amro ON amr.record_id = amro.record_id " .
387 "JOIN adv_mdf_definition amfd ON amr.record_id = amfd.record_id " .
388 "WHERE active = 1 " .
389 "AND obj_type = " . $this->db->quote($this->type,
'text') .
" ";
391 $this->active =
$res->numRows() ? true :
false;
393 $this->active_fields[
$row->field_id] =
$row->title;
396 $query =
"SELECT * FROM adv_md_substitutions " .
397 "WHERE obj_type = " . $this->db->quote($this->type,
'text') .
" ";
399 $this->substitutions =
array();
400 $this->bold =
array();
401 $this->newline =
array();
403 $tmp_substitutions = unserialize(
$row->substitution);
404 if (is_array($tmp_substitutions)) {
405 foreach ($tmp_substitutions as $substitution) {
406 if ($substitution[
'field_id']) {
407 $this->substitutions[] = $substitution[
'field_id'];
409 if ($substitution[
'bold']) {
410 $this->bold[] = $substitution[
'field_id'];
412 if ($substitution[
'newline']) {
413 $this->newline[] = $substitution[
'field_id'];
417 $this->enabled_desc = !
$row->hide_description;
418 $this->enabled_field_names = !
$row->hide_field_names;
421 if ($this->type ==
'crs' or $this->type ==
'rcrs') {
444 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
446 if (isset(self::$mappings) and is_object(self::$mappings)) {
enableFieldNames($a_status)
enable field names
isSubstituted($a_field_id)
is substituted
parseValue($a_field_id, $a_values_records)
special handling for date(time) values and ECS dates
enableDescription($a_status)
Enable description presentation.
static getInstance()
Get singleton.
static _getInstanceByObjectType($a_type)
Singleton: use this method to get an instance.
enabledFieldNames()
is field name enabled
foreach($_POST as $key=> $value) $res
resetSubstitutions()
set substitutions
isDescriptionEnabled()
Is description enabled.
isBold($a_field_id)
is bold
getSubstitutions()
get substitution string
Create styles array
The data for the language used.
hasNewline($a_field_id)
has newline
initECSMappings()
init ECS mappings
appendSubstitution($a_field_id, $a_bold=false, $a_newline=false)
append field to substitutions
isActive()
Is substitution active.
static preloadedRead($a_type, $a_obj_id)
sortDefinitions($a_definitions)
Sort definitions.
static _getInstance()
Get Singleton instance.
getParsedSubstitutions($a_ref_id, $a_obj_id)
Substitute.