ILIAS  release_8 Revision v8.24
class.ilMDCopyrightSelectionGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4/*
5 +-----------------------------------------------------------------------------+
6 | ILIAS open source |
7 +-----------------------------------------------------------------------------+
8 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
9 | |
10 | This program is free software; you can redistribute it and/or |
11 | modify it under the terms of the GNU General Public License |
12 | as published by the Free Software Foundation; either version 2 |
13 | of the License, or (at your option) any later version. |
14 | |
15 | This program is distributed in the hope that it will be useful, |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | GNU General Public License for more details. |
19 | |
20 | You should have received a copy of the GNU General Public License |
21 | along with this program; if not, write to the Free Software |
22 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23 +-----------------------------------------------------------------------------+
24*/
25
32{
33 public const MODE_QUICKEDIT = 1;
34 public const MODE_EDIT = 2;
35
37 protected ilLanguage $lng;
39
40 private int $rbac_id;
41 private int $obj_id;
42
43 public function __construct(int $a_mode, int $a_rbac_id, int $a_obj_id)
44 {
45 global $DIC;
46
47 $this->lng = $DIC->language();
48 $this->tpl = $DIC->ui()->mainTemplate();
49
50 $this->rbac_id = $a_rbac_id;
51 $this->obj_id = $a_obj_id;
52
54 }
55
56 public function fillTemplate(): bool
57 {
58 $desc = ilMDRights::_lookupDescription($this->rbac_id, $this->obj_id);
59
60 if (!$this->settings->isCopyrightSelectionActive() or
61 !count($entries = ilMDCopyrightSelectionEntry::_getEntries())) {
62 $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt('meta_copyright'));
63 $this->tpl->setVariable(
64 'COPYRIGHT_VAL',
66 );
67 return true;
68 }
69
71
72 $found = false;
73 foreach ($entries as $entry) {
74 $this->tpl->setCurrentBlock('copyright_selection');
75
76 if ($entry->getEntryId() === $default_id) {
77 $found = true;
78 $this->tpl->setVariable('COPYRIGHT_CHECKED', 'checked="checked"');
79 }
80 $this->tpl->setVariable('COPYRIGHT_ID', $entry->getEntryId());
81 $this->tpl->setVariable('COPYRIGHT_TITLE', $entry->getTitle());
82 $this->tpl->setVariable('COPYRIGHT_DESCRIPTION', $entry->getDescription());
83 $this->tpl->parseCurrentBlock();
84 }
85
86 $this->tpl->setCurrentBlock('copyright_selection');
87 if (!$found) {
88 $this->tpl->setVariable('COPYRIGHT_CHECKED', 'checked="checked"');
89 }
90 $this->tpl->setVariable('COPYRIGHT_ID', 0);
91 $this->tpl->setVariable('COPYRIGHT_TITLE', $this->lng->txt('meta_cp_own'));
92
93 $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt('meta_copyright'));
94 if (!$found) {
95 $this->tpl->setVariable('COPYRIGHT_VAL', $desc);
96 }
97 return false;
98 }
99}
language handling
static prepareFormOutput($a_str, bool $a_strip=false)
__construct(int $a_mode, int $a_rbac_id, int $a_obj_id)
static _lookupDescription(int $a_rbac_id, int $a_obj_id)
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...