ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilMDCopyrightTableGUI.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
33{
34 protected $has_write; // [bool]
35
43 public function __construct($a_parent_obj, $a_parent_cmd = '', $a_has_write = false)
44 {
45 global $DIC;
46
47 $ilCtrl = $DIC['ilCtrl'];
48
49 $this->has_write = (bool) $a_has_write;
50
51 parent::__construct($a_parent_obj, $a_parent_cmd);
52
53 if ($this->has_write) {
54 $this->addColumn('', 'f', 1);
55 $this->addColumn($this->lng->txt("position"), "order");
56 $this->addCommandButton("saveCopyrightPosition", $this->lng->txt("meta_save_order"));
57 }
58 $this->addColumn($this->lng->txt('title'), 'title', "30%");
59 $this->addColumn($this->lng->txt('md_used'), 'used', "5%");
60 $this->addColumn($this->lng->txt('md_copyright_preview'), 'preview', "50%");
61 $this->addColumn($this->lng->txt('meta_copyright_status'), 'status', "5%");
62
63 if ($this->has_write) {
64 $this->addColumn('', 'edit', "10%");
65 }
66
67 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
68 $this->setRowTemplate("tpl.show_copyright_row.html", "Services/MetaData");
69 $this->setDefaultOrderField("order");
70 $this->setDefaultOrderDirection("asc");
71 }
72
80 public function fillRow($a_set)
81 {
82 if ($this->has_write) {
83 if ($a_set['default']) {
84 $this->tpl->setVariable('DISABLED', "disabled");
85 }
86 $this->tpl->setVariable('VAL_ID', $a_set['id']);
87
88 // order
89 $this->tpl->setCurrentBlock('order_by_position');
90 if ($a_set['default']) {
91 $this->tpl->setVariable('ORDER_DISABLED', 'disabled="disabled"');
92 }
93 $this->tpl->setVariable('ORDER_ID', $a_set['id']);
94 $this->tpl->setVariable('ORDER_VALUE', $a_set['position']);
95 $this->tpl->parseCurrentBlock();
96 }
97 $this->tpl->setVariable('VAL_TITLE', $a_set['title']);
98 if (strlen($a_set['description'])) {
99 $this->tpl->setVariable('VAL_DESCRIPTION', $a_set['description']);
100 }
101 $this->tpl->setVariable('VAL_USAGE', $a_set['used']);
102 $this->tpl->setVariable('VAL_PREVIEW', $a_set['preview']);
103 if ($a_set['status']) {
104 $this->tpl->setVariable('VAL_STATUS', $this->lng->txt('meta_copyright_outdated'));
105 } else {
106 $this->tpl->setVariable('VAL_STATUS', $this->lng->txt('meta_copyright_in_use'));
107 }
108
109 if ($this->has_write) {
110 $this->ctrl->setParameter($this->getParentObject(), 'entry_id', $a_set['id']);
111 $this->tpl->setVariable('EDIT_LINK', $this->ctrl->getLinkTarget($this->getParentObject(), 'editEntry'));
112 $this->ctrl->clearParameters($this->getParentObject());
113
114 $this->tpl->setVariable('TXT_EDIT', $this->lng->txt('edit'));
115
116 if ((int) $a_set['used'] > 0) {
117 $this->tpl->setCurrentBlock("link_usage");
118
119 // direct redirection to ...UsageGUI
120 $this->ctrl->setParameterByClass(
121 'ilMDCopyrightUsageGUI',
122 'entry_id',
123 $a_set['id']
124 );
125 $this->tpl->setVariable(
126 'USAGE_LINK',
127 $this->ctrl->getLinkTargetByClass(
128 'ilMDCopyrightUsageGUI',
129 ''
130 )
131 );
132 $this->tpl->setVariable('TXT_USAGE', $this->lng->txt('meta_copyright_show_usages'));
133 $this->tpl->parseCurrentBlock();
134 }
135 }
136 }
137
145 public function parseSelections()
146 {
147 // These entries are ordered by 1. is_default, 2. position
149
150 $position = -10;
151 foreach ($entries as $entry) {
152 $tmp_arr['id'] = $entry->getEntryId();
153 $tmp_arr['title'] = $entry->getTitle();
154 $tmp_arr['description'] = $entry->getDescription();
155 $tmp_arr['used'] = $entry->getUsage();
156 $tmp_arr['preview'] = $entry->getCopyright();
157 $tmp_arr['default'] = $entry->getIsDefault();
158 $tmp_arr['status'] = $entry->getOutdated();
159 $tmp_arr['position'] = ($position += 10);
160
161 $entry_arr[] = $tmp_arr;
162 }
163
164 $this->setData($entry_arr ? $entry_arr : array());
165 }
166}
An exception for terminatinating execution or to throw for unit testing.
__construct($a_parent_obj, $a_parent_cmd='', $a_has_write=false)
Constructor.
Class ilTable2GUI.
getParentObject()
Get parent object.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7