81 if (isset(self::$instances[
$a_type])) {
82 return self::$instances[
$a_type];
97 foreach ($this->substitutions as $field_id) {
98 if (isset($a_definitions[$field_id])) {
99 $sorted[$field_id] = $a_definitions[$field_id];
100 unset($a_definitions[$field_id]);
103 return array_merge($sorted, $a_definitions);
137 $this->enabled_desc = $a_status;
160 $this->enabled_field_names = $a_status;
178 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
183 if (!isset($this->active_fields[$field_id])) {
187 $value = $this->
parseValue($field_id, $values_records);
189 if ($value === null) {
191 $substituted[$counter - 1][
'newline'] =
true;
196 $substituted[$counter][
'name'] = $this->active_fields[$field_id];
197 $substituted[$counter][
'value'] = $value;
198 $substituted[$counter][
'bold'] = $this->
isBold($field_id);
200 $substituted[$counter][
'newline'] =
true;
202 $substituted[$counter][
'newline'] =
false;
208 return $substituted ? $substituted : array();
227 if ($this->type ==
'crs' or $this->type ==
'rcrs') {
253 foreach ($a_values_records as $a_values) {
254 if ($a_values->getADTGroup()->hasElement($a_field_id)) {
255 $element = $a_values->getADTGroup()->getElement($a_field_id);
256 if (!$element->isNull()) {
273 $this->substitutions = array();
274 $this->bold = array();
275 $this->newline = array();
287 $this->substitutions[] = $a_field_id;
289 $this->bold[] = $a_field_id;
292 $this->newline[] = $a_field_id;
305 return $this->substitutions ? $this->substitutions : array();
329 #var_dump("<pre>",$this->bold,$a_field_id,"</pre>"); 331 return in_array($a_field_id, $this->bold);
343 return in_array($a_field_id, $this->newline);
355 $ilDB = $DIC[
'ilDB'];
360 foreach ($this->substitutions as $field_id) {
367 $query =
"DELETE FROM adv_md_substitutions WHERE obj_type = " .
$ilDB->quote($this->type,
'text');
372 'obj_type' => array(
'text',$this->type),
390 $ilDB = $DIC[
'ilDB'];
393 $query =
"SELECT active,field_id,amfd.title FROM adv_md_record amr " .
394 "JOIN adv_md_record_objs amro ON amr.record_id = amro.record_id " .
395 "JOIN adv_mdf_definition amfd ON amr.record_id = amfd.record_id " .
396 "WHERE active = 1 " .
397 "AND obj_type = " . $this->db->quote($this->type,
'text') .
" ";
399 $this->active =
$res->numRows() ? true :
false;
401 $this->active_fields[
$row->field_id] =
$row->title;
404 $query =
"SELECT * FROM adv_md_substitutions " .
405 "WHERE obj_type = " . $this->db->quote($this->type,
'text') .
" ";
407 $this->substitutions = array();
408 $this->bold = array();
409 $this->newline = array();
411 $tmp_substitutions = unserialize(
$row->substitution);
412 if (is_array($tmp_substitutions)) {
413 foreach ($tmp_substitutions as $substitution) {
414 if ($substitution[
'field_id']) {
415 $this->substitutions[] = $substitution[
'field_id'];
417 if ($substitution[
'bold']) {
418 $this->bold[] = $substitution[
'field_id'];
420 if ($substitution[
'newline']) {
421 $this->newline[] = $substitution[
'field_id'];
425 $this->enabled_desc = !
$row->hide_description;
426 $this->enabled_field_names = !
$row->hide_field_names;
429 if ($this->type ==
'crs' or $this->type ==
'rcrs') {
452 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
454 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
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.