ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilECSExportedContentTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25{
27
28 public function __construct($a_parent_obj, $a_parent_cmd = '')
29 {
30 global $DIC;
31 $this->ilObjDataCache = $DIC['ilObjDataCache'];
32
33 parent::__construct($a_parent_obj, $a_parent_cmd);
34 $this->addColumn($this->lng->txt('title'), 'title', '40%');
35 $this->addColumn($this->lng->txt('ecs_meta_data'), 'md', '40%');
36 $this->addColumn($this->lng->txt('last_update'), 'last_update', '10%');
37 $this->setRowTemplate('tpl.released_content_row.html', 'components/ILIAS/WebServices/ECS');
38 $this->setDefaultOrderField('title');
39 $this->setDefaultOrderDirection('asc');
40 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
41 }
42
49 protected function fillRow(array $a_set): void
50 {
51 $this->tpl->setVariable('VAL_TITLE', $a_set['title']);
52 $this->tpl->setVariable('VAL_LINK', ilLink::_getLink($a_set['ref_id'], 'rcrs'));
53 $this->tpl->setVariable('VAL_DESC', $a_set['desc']);
54 $this->tpl->setVariable('VAL_REMOTE', $a_set['from'] ?? '');
55 $this->tpl->setVariable('VAL_REMOTE_INFO', $a_set['from_info'] ?? '');
56 $this->tpl->setVariable('TXT_EMAIL', $this->lng->txt('ecs_email'));
57 $this->tpl->setVariable('TXT_DNS', $this->lng->txt('ecs_dns'));
58 $this->tpl->setVariable('TXT_ABR', $this->lng->txt('ecs_abr'));
59 $this->tpl->setVariable('VAL_LAST_UPDATE', $a_set['last_update']);
60
61
62 $this->tpl->setVariable('TXT_TERM', $this->lng->txt('ecs_field_term'));
63 $this->tpl->setVariable('TXT_CRS_TYPE', $this->lng->txt('ecs_field_courseType'));
64 $this->tpl->setVariable('TXT_CRS_ID', $this->lng->txt('ecs_field_courseID'));
65 $this->tpl->setVariable('TXT_CREDITS', $this->lng->txt('ecs_field_credits'));
66 $this->tpl->setVariable('TXT_ROOM', $this->lng->txt('ecs_field_room'));
67 $this->tpl->setVariable('TXT_CYCLE', $this->lng->txt('ecs_field_cycle'));
68 $this->tpl->setVariable('TXT_SWS', $this->lng->txt('ecs_field_semester_hours'));
69 $this->tpl->setVariable('TXT_START', $this->lng->txt('ecs_field_begin'));
70 $this->tpl->setVariable('TXT_END', $this->lng->txt('ecs_field_end'));
71 $this->tpl->setVariable('TXT_LECTURER', $this->lng->txt('ecs_field_lecturer'));
72
73
74 $sid = array_pop($a_set['sids']);
76
77 $values = ilECSUtils::getAdvancedMDValuesForObjId($a_set['obj_id']);
78
79 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'lecturer')) {
80 $this->tpl->setVariable('VAL_LECTURER', $values[$field] ?? '--');
81 }
82 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'term')) {
83 $this->tpl->setVariable('VAL_TERM', $values[$field] ?? '--');
84 }
85 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'courseID')) {
86 $this->tpl->setVariable('VAL_CRS_ID', $values[$field] ?? '--');
87 }
88 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'courseType')) {
89 $this->tpl->setVariable('VAL_CRS_TYPE', $values[$field] ?? '--');
90 }
91 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'credits')) {
92 $this->tpl->setVariable('VAL_CREDITS', $values[$field] ?? '--');
93 }
94 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'semester_hours')) {
95 $this->tpl->setVariable('VAL_SWS', $values[$field] ?? '--');
96 }
97 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'room')) {
98 $this->tpl->setVariable('VAL_ROOM', $values[$field] ?? '--');
99 }
100 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'cycle')) {
101 $this->tpl->setVariable('VAL_CYCLE', $values[$field] ?? '--');
102 }
103 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'begin')) {
104 $this->tpl->setVariable('VAL_START', isset($values[$field]) ? ilDatePresentation::formatDate(new ilDateTime($values[$field], IL_CAL_UNIX)) : '--');
105 }
106 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'end')) {
107 $this->tpl->setVariable('VAL_END', isset($values[$field]) ? ilDatePresentation::formatDate(new ilDateTime($values[$field], IL_CAL_UNIX)) : '--');
108 }
109 }
110
117 public function parse($a_obj_ids): void
118 {
119 $this->ilObjDataCache->preloadObjectCache($a_obj_ids);
120
121 // read obj_ids
122 $obj_ids = array();
123 foreach ($a_obj_ids as $obj_id) {
124 $ref_ids = ilObject::_getAllReferences($obj_id);
125 $ref_id = current($ref_ids);
126
127 $obj_ids[$ref_id] = $obj_id;
128 }
129
130 $content = array();
131 foreach ($obj_ids as $ref_id => $obj_id) {
132 $tmp_arr['sids'] = ilECSExportManager::getInstance()->lookupServerIds($obj_id);
133 $tmp_arr['ref_id'] = $ref_id;
134 $tmp_arr['obj_id'] = $obj_id;
135 $tmp_arr['title'] = $this->ilObjDataCache->lookupTitle((int) $obj_id);
136 $tmp_arr['desc'] = $this->ilObjDataCache->lookupDescription((int) $obj_id);
137 $tmp_arr['md'] = '';
138 $tmp_arr['last_update'] = $this->ilObjDataCache->lookupLastUpdate((int) $obj_id);
139 $content[] = $tmp_arr;
140 }
141 $this->setData($content);
142 }
143}
const IL_CAL_UNIX
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@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.
class ilObjectDataCache
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.
$ref_id
Definition: ltiauth.php:66
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26