ILIAS  release_8 Revision v8.24
class.ilECSExportedContentTableGUI.php
Go to the documentation of this file.
1<?php
2
18declare(strict_types=1);
19
24{
26
27 public function __construct($a_parent_obj, $a_parent_cmd = '')
28 {
29 global $DIC;
30 $this->ilObjDataCache = $DIC['ilObjDataCache'];
31
32 parent::__construct($a_parent_obj, $a_parent_cmd);
33 $this->addColumn($this->lng->txt('title'), 'title', '40%');
34 $this->addColumn($this->lng->txt('ecs_meta_data'), 'md', '40%');
35 $this->addColumn($this->lng->txt('last_update'), 'last_update', '10%');
36 $this->setRowTemplate('tpl.released_content_row.html', 'Services/WebServices/ECS');
37 $this->setDefaultOrderField('title');
38 $this->setDefaultOrderDirection('asc');
39 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
40 }
41
48 protected function fillRow(array $a_set): void
49 {
50 $this->tpl->setVariable('VAL_TITLE', $a_set['title']);
51 $this->tpl->setVariable('VAL_LINK', ilLink::_getLink($a_set['ref_id'], 'rcrs'));
52 $this->tpl->setVariable('VAL_DESC', $a_set['desc']);
53 $this->tpl->setVariable('VAL_REMOTE', $a_set['from'] ?? '');
54 $this->tpl->setVariable('VAL_REMOTE_INFO', $a_set['from_info'] ?? '');
55 $this->tpl->setVariable('TXT_EMAIL', $this->lng->txt('ecs_email'));
56 $this->tpl->setVariable('TXT_DNS', $this->lng->txt('ecs_dns'));
57 $this->tpl->setVariable('TXT_ABR', $this->lng->txt('ecs_abr'));
58 $this->tpl->setVariable('VAL_LAST_UPDATE', $a_set['last_update']);
59
60
61 $this->tpl->setVariable('TXT_TERM', $this->lng->txt('ecs_field_term'));
62 $this->tpl->setVariable('TXT_CRS_TYPE', $this->lng->txt('ecs_field_courseType'));
63 $this->tpl->setVariable('TXT_CRS_ID', $this->lng->txt('ecs_field_courseID'));
64 $this->tpl->setVariable('TXT_CREDITS', $this->lng->txt('ecs_field_credits'));
65 $this->tpl->setVariable('TXT_ROOM', $this->lng->txt('ecs_field_room'));
66 $this->tpl->setVariable('TXT_CYCLE', $this->lng->txt('ecs_field_cycle'));
67 $this->tpl->setVariable('TXT_SWS', $this->lng->txt('ecs_field_semester_hours'));
68 $this->tpl->setVariable('TXT_START', $this->lng->txt('ecs_field_begin'));
69 $this->tpl->setVariable('TXT_END', $this->lng->txt('ecs_field_end'));
70 $this->tpl->setVariable('TXT_LECTURER', $this->lng->txt('ecs_field_lecturer'));
71
72
73 $sid = array_pop($a_set['sids']);
75
76 $values = ilECSUtils::getAdvancedMDValuesForObjId($a_set['obj_id']);
77
78 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'lecturer')) {
79 $this->tpl->setVariable('VAL_LECTURER', $values[$field] ?? '--');
80 }
81 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'term')) {
82 $this->tpl->setVariable('VAL_TERM', $values[$field] ?? '--');
83 }
84 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'courseID')) {
85 $this->tpl->setVariable('VAL_CRS_ID', $values[$field] ?? '--');
86 }
87 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'courseType')) {
88 $this->tpl->setVariable('VAL_CRS_TYPE', $values[$field] ?? '--');
89 }
90 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'credits')) {
91 $this->tpl->setVariable('VAL_CREDITS', $values[$field] ?? '--');
92 }
93 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'semester_hours')) {
94 $this->tpl->setVariable('VAL_SWS', $values[$field] ?? '--');
95 }
96 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'room')) {
97 $this->tpl->setVariable('VAL_ROOM', $values[$field] ?? '--');
98 }
99 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'cycle')) {
100 $this->tpl->setVariable('VAL_CYCLE', $values[$field] ?? '--');
101 }
102 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'begin')) {
103 $this->tpl->setVariable('VAL_START', isset($values[$field]) ? ilDatePresentation::formatDate(new ilDateTime($values[$field], IL_CAL_UNIX)) : '--');
104 }
105 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'end')) {
106 $this->tpl->setVariable('VAL_END', isset($values[$field]) ? ilDatePresentation::formatDate(new ilDateTime($values[$field], IL_CAL_UNIX)) : '--');
107 }
108 }
109
116 public function parse($a_obj_ids): void
117 {
118 $this->ilObjDataCache->preloadObjectCache($a_obj_ids);
119
120 // read obj_ids
121 $obj_ids = array();
122 foreach ($a_obj_ids as $obj_id) {
123 $ref_ids = ilObject::_getAllReferences($obj_id);
124 $ref_id = current($ref_ids);
125
126 $obj_ids[$ref_id] = $obj_id;
127 }
128
129 $content = array();
130 foreach ($obj_ids as $ref_id => $obj_id) {
131 $tmp_arr['sids'] = ilECSExportManager::getInstance()->lookupServerIds($obj_id);
132 $tmp_arr['ref_id'] = $ref_id;
133 $tmp_arr['obj_id'] = $obj_id;
134 $tmp_arr['title'] = $this->ilObjDataCache->lookupTitle((int) $obj_id);
135 $tmp_arr['desc'] = $this->ilObjDataCache->lookupDescription((int) $obj_id);
136 $tmp_arr['md'] = '';
137 $tmp_arr['last_update'] = $this->ilObjDataCache->lookupLastUpdate((int) $obj_id);
138 $content[] = $tmp_arr;
139 }
140 $this->setData($content);
141 }
142}
const IL_CAL_UNIX
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling
static getInstanceByServerId(int $a_server_id)
Get singleton instance.
static getInstance()
Get the singelton instance of this ilECSExportManager.
__construct($a_parent_obj, $a_parent_cmd='')
static getAdvancedMDValuesForObjId(int $a_obj_id)
Get advanced metadata values for object id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getAllReferences(int $id)
get all reference ids for object ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200