ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilMDCopyrightSelectionGUI.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
33include_once('Services/MetaData/classes/class.ilMDSettings.php');
34include_once('Services/MetaData/classes/class.ilMDRights.php');
35
37{
38 const MODE_QUICKEDIT = 1;
39 const MODE_EDIT = 2;
40
41 protected $tpl;
42 protected $lng;
43 protected $settings;
44
45 private $mode;
46 private $rbac_id;
47 private $obj_id;
48
54 public function __construct($a_mode, $a_rbac_id, $a_obj_id)
55 {
56 global $DIC;
57
58 $lng = $DIC['lng'];
59 $tpl = $DIC['tpl'];
60
61 $this->tpl = $tpl;
62 $this->lng = $lng;
63
64 $this->mode = $a_mode;
65 $this->rbac_id = $a_rbac_id;
66 $this->obj_id = $a_obj_id;
67
69 }
70
77 public function fillTemplate()
78 {
79 include_once('Services/MetaData/classes/class.ilMDCopyrightSelectionEntry.php');
80
81 $desc = ilMDRights::_lookupDescription($this->rbac_id, $this->obj_id);
82
83 if (!$this->settings->isCopyrightSelectionActive() or
84 !count($entries = ilMDCopyrightSelectionEntry::_getEntries())) {
85 $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt('meta_copyright'));
86 $this->tpl->setVariable(
87 'COPYRIGHT_VAL',
89 );
90 return true;
91 }
92
94
95 include_once('Services/MetaData/classes/class.ilMDCopyrightSelectionEntry.php');
96 $found = false;
97 foreach ($entries as $entry) {
98 $this->tpl->setCurrentBlock('copyright_selection');
99
100 if ($entry->getEntryId() == $default_id) {
101 $found = true;
102 $this->tpl->setVariable('COPYRIGHT_CHECKED', 'checked="checked"');
103 }
104 $this->tpl->setVariable('COPYRIGHT_ID', $entry->getEntryId());
105 $this->tpl->setVariable('COPYRIGHT_TITLE', $entry->getTitle());
106 $this->tpl->setVariable('COPYRIGHT_DESCRIPTION', $entry->getDescription());
107 $this->tpl->parseCurrentBlock();
108 }
109
110 $this->tpl->setCurrentBlock('copyright_selection');
111 if (!$found) {
112 $this->tpl->setVariable('COPYRIGHT_CHECKED', 'checked="checked"');
113 }
114 $this->tpl->setVariable('COPYRIGHT_ID', 0);
115 $this->tpl->setVariable('COPYRIGHT_TITLE', $this->lng->txt('meta_cp_own'));
116
117 $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt('meta_copyright'));
118 if (!$found) {
119 $this->tpl->setVariable('COPYRIGHT_VAL', $desc);
120 }
121 }
122}
An exception for terminatinating execution or to throw for unit testing.
static _extractEntryId($a_cp_string)
extract entry id
__construct($a_mode, $a_rbac_id, $a_obj_id)
Constructor.
static _lookupDescription($a_rbac_id, $a_obj_id)
Lookup description (copyright)
static _getInstance()
get instance
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
global $DIC
Definition: goto.php:24
settings()
Definition: settings.php:2