ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
65 $this->settings = ilMDSettings::_getInstance();
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
82 {
83 $this->tpl->setVariable("TXT_COPYRIGHT",$this->lng->txt('meta_copyright'));
84 $this->tpl->setVariable('COPYRIGHT_VAL',
86 return true;
87 }
88
90
91 include_once('Services/MetaData/classes/class.ilMDCopyrightSelectionEntry.php');
92 $found = false;
93 foreach($entries as $entry)
94 {
95 $this->tpl->setCurrentBlock('copyright_selection');
96
97 if($entry->getEntryId() == $default_id)
98 {
99 $found = true;
100 $this->tpl->setVariable('COPYRIGHT_CHECKED','checked="checked"');
101 }
102 $this->tpl->setVariable('COPYRIGHT_ID',$entry->getEntryId());
103 $this->tpl->setVariable('COPYRIGHT_TITLE',$entry->getTitle());
104 $this->tpl->setVariable('COPYRIGHT_DESCRIPTION',$entry->getDescription());
105 $this->tpl->parseCurrentBlock();
106 }
107
108 $this->tpl->setCurrentBlock('copyright_selection');
109 if(!$found)
110 {
111 $this->tpl->setVariable('COPYRIGHT_CHECKED','checked="checked"');
112 }
113 $this->tpl->setVariable('COPYRIGHT_ID',0);
114 $this->tpl->setVariable('COPYRIGHT_TITLE',$this->lng->txt('meta_cp_own'));
115
116 $this->tpl->setVariable("TXT_COPYRIGHT",$this->lng->txt('meta_copyright'));
117 if(!$found)
118 {
119 $this->tpl->setVariable('COPYRIGHT_VAL',$desc);
120 }
121 }
122}
123
124
125?>
static _extractEntryId($a_cp_string)
extract entry id
__construct($a_mode, $a_rbac_id, $a_obj_id)
Constructor.
_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