19 declare(strict_types=1);
46 bool $has_write =
false 50 $this->ui_factory = $DIC->ui()->factory();
51 $this->ui_renderer = $DIC->ui()->renderer();
60 if ($this->has_write) {
65 $this->
addColumn($this->
lng->txt(
'title'),
'title',
"30%");
66 $this->
addColumn($this->
lng->txt(
'md_used'),
'used',
"5%");
67 $this->
addColumn($this->
lng->txt(
'md_copyright_preview'),
'preview',
"50%");
68 $this->
addColumn($this->
lng->txt(
'meta_copyright_status'),
'status',
"10%");
70 if ($this->has_write) {
75 $this->
setRowTemplate(
"tpl.show_copyright_row.html",
"Services/MetaData");
80 protected function fillRow(array $a_set): void
82 if ($this->has_write) {
83 if ($a_set[
'default']) {
84 $this->tpl->setVariable(
'DISABLED',
"disabled");
86 $this->tpl->setVariable(
'VAL_ID', $a_set[
'id']);
89 $this->tpl->setCurrentBlock(
'order_by_position');
90 if ($a_set[
'default']) {
91 $this->tpl->setVariable(
'ORDER_DISABLED',
'disabled="disabled"');
93 $this->tpl->setVariable(
'ORDER_ID', $a_set[
'id']);
94 $this->tpl->setVariable(
'ORDER_VALUE', $a_set[
'position']);
95 $this->tpl->parseCurrentBlock();
97 $this->tpl->setVariable(
'VAL_TITLE', $a_set[
'title']);
98 if ($a_set[
'description'] !==
'') {
99 $this->tpl->setVariable(
'VAL_DESCRIPTION', $a_set[
'description']);
101 $this->tpl->setVariable(
'VAL_USAGE', $a_set[
'used']);
102 $this->tpl->setVariable(
'VAL_PREVIEW', $a_set[
'preview']);
105 if ($a_set[
'status']) {
106 $status[] = $this->
lng->txt(
'meta_copyright_outdated');
108 $status[] = $this->
lng->txt(
'meta_copyright_in_use');
110 if ($a_set[
'default']) {
111 $status[] = $this->
lng->txt(
'md_copyright_default');
114 $this->tpl->setVariable(
'VAL_STATUS', implode(
', ', $status));
116 if ($this->has_write) {
119 (
int) $a_set[
'used'] > 0
126 $this->edit_modal_signals[$entry_id] = $signal;
136 foreach ($entries as $entry) {
137 $tmp_arr[
'id'] = $entry->getEntryId();
138 $tmp_arr[
'title'] = $entry->getTitle();
139 $tmp_arr[
'description'] = $entry->getDescription();
140 $tmp_arr[
'used'] = $entry->getUsage();
141 $tmp_arr[
'preview'] = $entry->getCopyright();
142 $tmp_arr[
'default'] = $entry->getIsDefault();
143 $tmp_arr[
'status'] = $entry->getOutdated();
144 $tmp_arr[
'position'] = ($position += 10);
146 $entry_arr[] = $tmp_arr;
156 $buttons[] = $this->ui_factory->button()->shy(
157 $this->
lng->txt(
'edit'),
158 $this->edit_modal_signals[
$id]
162 $this->
ctrl->setParameterByClass(
163 ilMDCopyrightUsageGUI::class,
167 $usage_link = $this->
ctrl->getLinkTargetByClass(
168 'ilMDCopyrightUsageGUI',
171 $this->
ctrl->clearParametersByClass(ilMDCopyrightUsageGUI::class);
172 $buttons[] = $this->ui_factory->button()->shy(
173 $this->
lng->txt(
'meta_copyright_show_usages'),
178 $actions = $this->ui_factory
181 ->withLabel($this->
lng->txt(
'actions'));
182 return $this->ui_renderer->render($actions);
setEditModalSignal(int $entry_id, Signal $signal)
ilMDCopyrightSelectionGUI: ilMDCopyrightUsageGUI
setFormAction(string $a_form_action, bool $a_multipart=false)
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
__construct(ilMDCopyrightSelectionGUI $parent_obj, string $parent_cmd='', bool $has_write=false)
ilMDSettingsModalService $modal_service
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
array $edit_modal_signals
setDefaultOrderDirection(string $a_defaultorderdirection)
getActionsForEntry(int $id, bool $with_usages)
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)