ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilDclDetailedViewDefinitionGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once("./Services/COPage/classes/class.ilPageObjectGUI.php");
5require_once("class.ilDclDetailedViewDefinition.php");
6
19
23 public $obj;
27 public $ctrl;
28
29
34 public function __construct($tableview_id, $a_definition_id = 0) {
35 global $DIC;
36 $tpl = $DIC['tpl'];
37 $ilCtrl = $DIC['ilCtrl'];
41 $this->ctrl = $ilCtrl;
42 $this->tableview_id = $tableview_id;
43 //TODO Permission-Check
44
45 // we always need a page object - create on demand
46 if (! ilPageObject::_exists('dclf', $tableview_id)) {
47 $viewdef = new ilDclDetailedViewDefinition();
48 $viewdef->setId($tableview_id);
49 $viewdef->setParentId(ilObject2::_lookupObjectId($_GET['ref_id']));
50 $viewdef->setActive(false);
51 $viewdef->create();
52 }
53
54 parent::__construct("dclf", $tableview_id);
55
56 // content style (using system defaults)
57 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
58
59 $tpl->setCurrentBlock("SyntaxStyle");
60 $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
61 $tpl->parseCurrentBlock();
62
63 $tpl->setCurrentBlock("ContentStyle");
64 $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
65 $tpl->parseCurrentBlock();
66 }
67
68
72 public function executeCommand() {
73 global $DIC;
74 $ilLocator = $DIC['ilLocator'];
75 $lng = $DIC['lng'];
76
77 $next_class = $this->ctrl->getNextClass($this);
78
79 $viewdef = $this->getPageObject();
80 if ($viewdef) {
81 $this->ctrl->setParameter($this, "dclv", $viewdef->getId());
82 $title = $lng->txt("dcl_view_viewdefinition");
83 }
84
85 switch ($next_class) {
86 case "ilpageobjectgui":
87 throw new ilCOPageException("Deprecated. ilDclDetailedViewDefinitionGUI gui forwarding to ilpageobject");
88 default:
89 if ($viewdef) {
91 $ilLocator->addItem($title, $this->ctrl->getLinkTarget($this, "preview"));
92 }
93
94 return parent::executeCommand();
95 }
96 }
97
98
99 public function showPage() {
100 global $DIC;
101 $ilToolbar = $DIC['ilToolbar'];
105 // :TODO: temporary legend of available placeholders
106 if ($this->getOutputMode() == IL_PAGE_EDIT) {
107 $delete_button = ilLinkButton::getInstance();
108 $delete_button->setCaption('dcl_empty_detailed_view');
109 $delete_button->setUrl($this->ctrl->getLinkTarget($this, 'confirmDelete'));
110 $ilToolbar->addButtonInstance($delete_button);
111
112 $activation_button = ilLinkButton::getInstance();
113 if ($this->getPageObject()->getActive()) {
114 $activation_button->setCaption('dcl_deactivate_view');
115 $activation_button->setUrl($this->ctrl->getLinkTarget($this, 'deactivate'));
116 } else {
117 $activation_button->setCaption('dcl_activate_view');
118 $activation_button->setUrl($this->ctrl->getLinkTarget($this, 'activate'));
119 }
120
121 $ilToolbar->addButtonInstance($activation_button);
122
123 $legend = $this->getPageObject()->getAvailablePlaceholders();
124 if (sizeof($legend)) {
125 $this->setPrependingHtml("<span class=\"small\">" . $this->lng->txt("dcl_legend_placeholders") . ": " . implode(" ", $legend)
126 . "</span>");
127 }
128 }
129
130 return parent::showPage();
131 }
132
133
134 protected function activate() {
135 $page = $this->getPageObject();
136 $page->setActive(true);
137 $page->update();
138 $this->ctrl->redirect($this, 'edit');
139 }
140
141
142 protected function deactivate() {
143 $page = $this->getPageObject();
144 $page->setActive(false);
145 $page->update();
146 $this->ctrl->redirect($this, 'edit');
147 }
148
149
153 public function confirmDelete() {
154 global $DIC;
155 $ilCtrl = $DIC['ilCtrl'];
156 $lng = $DIC['lng'];
157 $tpl = $DIC['tpl'];
158
159 include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
160 $conf = new ilConfirmationGUI();
161 $conf->setFormAction($ilCtrl->getFormAction($this));
162 $conf->setHeaderText($lng->txt('dcl_confirm_delete_detailed_view_title'));
163
164 $conf->addItem('tableview', (int)$this->tableview_id, $lng->txt('dcl_confirm_delete_detailed_view_text'));
165
166 $conf->setConfirm($lng->txt('delete'), 'deleteView');
167 $conf->setCancel($lng->txt('cancel'), 'cancelDelete');
168
169 $tpl->setContent($conf->getHTML());
170 }
171
172
176 public function cancelDelete() {
177 global $DIC;
178 $ilCtrl = $DIC['ilCtrl'];
179
180 $ilCtrl->redirect($this, "edit");
181 }
182
183
184 public function deleteView() {
185 global $DIC;
186 $ilCtrl = $DIC['ilCtrl'];
187 $lng = $DIC['lng'];
188
189 if ($this->tableview_id && ilDclDetailedViewDefinition::exists($this->tableview_id)) {
190 include_once("class.ilDclDetailedViewDefinition.php");
191 $pageObject = new ilDclDetailedViewDefinition($this->tableview_id);
192 $pageObject->delete();
193 }
194
195 ilUtil::sendSuccess($lng->txt("dcl_empty_detailed_view_success"), true);
196
197 // Bug fix for mantis 22537: Redirect to settings-tab instead of fields-tab. This solves the problem and is more intuitive.
198 $ilCtrl->redirectByClass("ilDclTableViewEditGUI", "editGeneralSettings");
199 }
200
206 {
207 global $DIC;
208 $ilCtrl = $DIC['ilCtrl'];
209 $lng = $DIC['lng'];
210
211 $this->getPageObject()->releasePageLock();
212 ilUtil::sendSuccess($lng->txt("cont_page_lock_released"), true);
213 $ilCtrl->redirectByClass('ilDclTableViewGUI', "show");
214 }
215
223 public function postOutputProcessing($a_output) {
224 // You can use this to parse placeholders and the like before outputting
225
226 // user view (IL_PAGE_PRESENTATION?)
227 if ($this->getOutputMode() == IL_PAGE_PREVIEW) {
228 //page preview is not being used inside DataCollections - if you are here, something's probably wrong
229
230// include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
231//
232// // :TODO: find a suitable presentation for matched placeholders
233// $allp = ilDataCollectionRecordViewViewdefinition::getAvailablePlaceholders($this->table_id, true);
234// foreach ($allp as $id => $item) {
235// $parsed_item = new ilTextInputGUI("", "fields[" . $item->getId() . "]");
236// $parsed_item = $parsed_item->getToolbarHTML();
237//
238// $a_output = str_replace($id, $item->getTitle() . ": " . $parsed_item, $a_output);
239// }
240 } // editor
241 else {
242 if ($this->getOutputMode() == IL_PAGE_EDIT) {
243 $allp = $this->getPageObject()->getAvailablePlaceholders();
244
245 // :TODO: find a suitable markup for matched placeholders
246 foreach ($allp as $item) {
247 $a_output = str_replace($item, "<span style=\"color:green\">" . $item . "</span>", $a_output);
248 }
249 }
250 }
251
252 return $a_output;
253 }
254}
255
256?>
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
const IL_PAGE_EDIT
const IL_PAGE_PREVIEW
Base exception class for copage service.
Confirmation screen class.
Class ilDclDetailedViewDefinitionGUI.
postOutputProcessing($a_output)
Finalizing output processing.
releasePageLock()
Release page lock overwrite to redirect properly.
Class ilDclDetailedViewDefinition.
static getInstance()
Factory.
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id)
get content style path
static _lookupObjectId($a_ref_id)
lookup object id
Class ilPageObjectGUI.
setPrependingHtml($a_prependinghtml)
Set Prepending HTML.
setPresentationTitle($a_title="")
showPage()
display content of page
__construct($a_parent_type, $a_id, $a_old_nr=0, $a_prevent_get_id=false, $a_lang="")
Constructor.
getPageObject()
Get Page Object.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
global $DIC