19 declare(strict_types=1);
52 bool $has_write =
false 56 $this->ui_factory = $DIC->ui()->factory();
57 $this->ui_renderer = $DIC->ui()->renderer();
58 $this->db = $DIC->database();
66 if ($this->has_write) {
71 $this->
addColumn($this->
lng->txt(
'title'),
'title',
"30%");
72 $this->
addColumn($this->
lng->txt(
'md_used'),
'used',
"5%");
73 $this->
addColumn($this->
lng->txt(
'md_copyright_preview'),
'preview',
"50%");
74 $this->
addColumn($this->
lng->txt(
'meta_copyright_status'),
'status',
"10%");
76 if ($this->has_write) {
81 $this->
setRowTemplate(
"tpl.show_copyright_row.html",
"components/ILIAS/MetaData");
86 protected function fillRow(array $a_set): void
88 if ($this->has_write) {
89 if ($a_set[
'default']) {
90 $this->tpl->setVariable(
'DISABLED',
"disabled");
92 $this->tpl->setVariable(
'VAL_ID', $a_set[
'id']);
95 $this->tpl->setCurrentBlock(
'order_by_position');
96 if ($a_set[
'default']) {
97 $this->tpl->setVariable(
'ORDER_DISABLED',
'disabled="disabled"');
99 $this->tpl->setVariable(
'ORDER_ID', $a_set[
'id']);
100 $this->tpl->setVariable(
'ORDER_VALUE', $a_set[
'position']);
101 $this->tpl->parseCurrentBlock();
103 $this->tpl->setVariable(
'VAL_TITLE', $a_set[
'title']);
104 if ($a_set[
'description'] !==
'') {
105 $this->tpl->setVariable(
'VAL_DESCRIPTION', $a_set[
'description']);
107 $this->tpl->setVariable(
'VAL_USAGE', $a_set[
'used']);
108 $this->tpl->setVariable(
'VAL_PREVIEW', $a_set[
'preview']);
111 if ($a_set[
'status']) {
112 $status[] = $this->
lng->txt(
'meta_copyright_outdated');
114 $status[] = $this->
lng->txt(
'meta_copyright_in_use');
116 if ($a_set[
'default']) {
117 $status[] = $this->
lng->txt(
'md_copyright_default');
120 $this->tpl->setVariable(
'VAL_STATUS', implode(
', ', $status));
122 if ($this->has_write) {
125 (
int) $a_set[
'used'] > 0
132 $this->edit_modal_signals[$entry_id] = $signal;
138 $entries = $this->
repository->getAllEntries();
142 foreach ($entries as $entry) {
143 $tmp_arr[
'id'] = $entry->id();
144 $tmp_arr[
'title'] = $entry->title();
145 $tmp_arr[
'description'] = $entry->description();
147 $tmp_arr[
'preview'] = $this->ui_renderer->render(
148 $this->
renderer->toUIComponents($entry->copyrightData())
150 $tmp_arr[
'default'] = $entry->isDefault();
151 $tmp_arr[
'status'] = $entry->isOutdated();
152 $tmp_arr[
'position'] = ($position += 10);
154 $entry_arr[] = $tmp_arr;
164 $buttons[] = $this->ui_factory->button()->shy(
165 $this->
lng->txt(
'edit'),
166 $this->edit_modal_signals[
$id]
170 $this->
ctrl->setParameterByClass(
171 ilMDCopyrightUsageGUI::class,
175 $usage_link = $this->
ctrl->getLinkTargetByClass(
176 'ilMDCopyrightUsageGUI',
179 $this->
ctrl->clearParametersByClass(ilMDCopyrightUsageGUI::class);
180 $buttons[] = $this->ui_factory->button()->shy(
181 $this->
lng->txt(
'meta_copyright_show_usages'),
186 $actions = $this->ui_factory
189 ->withLabel($this->
lng->txt(
'actions'));
190 return $this->ui_renderer->render($actions);
195 $query =
"SELECT count(meta_rights_id) used FROM il_meta_rights " .
196 "WHERE description = " . $this->db->quote(
197 'il_copyright_entry__' .
IL_INST_ID .
'__' . $entry_id,
201 $res = $this->db->query($query);
202 $row = $this->db->fetchObject(
$res);
203 return (
int) $row->used;
setEditModalSignal(int $entry_id, Signal $signal)
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="")
repository()
description: > Example for rendering a repository card
RepositoryInterface $repository
countUsagesForEntry(int $entry_id)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
array $edit_modal_signals
setDefaultOrderDirection(string $a_defaultorderdirection)
RendererInterface $renderer
getActionsForEntry(int $id, bool $with_usages)
__construct(RepositoryInterface $repository, RendererInterface $renderer, ilMDCopyrightConfigurationGUI $parent_obj, string $parent_cmd='', bool $has_write=false)
__construct(Container $dic, ilPlugin $plugin)
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)
ilMDCopyrightConfigurationGUI: ilMDCopyrightUsageGUI, ilMDCopyrightImageUploadHandlerGUI ...