ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $lng,$tpl;
57
58 $this->tpl = $tpl;
59 $this->lng = $lng;
60
61 $this->mode = $a_mode;
62 $this->rbac_id = $a_rbac_id;
63 $this->obj_id = $a_obj_id;
64
66 }
67
74 public function fillTemplate()
75 {
76 include_once('Services/MetaData/classes/class.ilMDCopyrightSelectionEntry.php');
77
78 $desc = ilMDRights::_lookupDescription($this->rbac_id, $this->obj_id);
79
80 if (!$this->settings->isCopyrightSelectionActive() or
81 !count($entries = ilMDCopyrightSelectionEntry::_getEntries())) {
82 $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt('meta_copyright'));
83 $this->tpl->setVariable(
84 'COPYRIGHT_VAL',
86 );
87 return true;
88 }
89
91
92 include_once('Services/MetaData/classes/class.ilMDCopyrightSelectionEntry.php');
93 $found = false;
94 foreach ($entries as $entry) {
95 $this->tpl->setCurrentBlock('copyright_selection');
96
97 if ($entry->getEntryId() == $default_id) {
98 $found = true;
99 $this->tpl->setVariable('COPYRIGHT_CHECKED', 'checked="checked"');
100 }
101 $this->tpl->setVariable('COPYRIGHT_ID', $entry->getEntryId());
102 $this->tpl->setVariable('COPYRIGHT_TITLE', $entry->getTitle());
103 $this->tpl->setVariable('COPYRIGHT_DESCRIPTION', $entry->getDescription());
104 $this->tpl->parseCurrentBlock();
105 }
106
107 $this->tpl->setCurrentBlock('copyright_selection');
108 if (!$found) {
109 $this->tpl->setVariable('COPYRIGHT_CHECKED', 'checked="checked"');
110 }
111 $this->tpl->setVariable('COPYRIGHT_ID', 0);
112 $this->tpl->setVariable('COPYRIGHT_TITLE', $this->lng->txt('meta_cp_own'));
113
114 $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt('meta_copyright'));
115 if (!$found) {
116 $this->tpl->setVariable('COPYRIGHT_VAL', $desc);
117 }
118 }
119}
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
settings()
Definition: settings.php:2