ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjBlogAdministrationGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3include_once("./Services/Object/classes/class.ilObjectGUI.php");
4
17{
23 public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
24 {
25 $this->type = "blga";
26 parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
27
28 $this->lng->loadLanguageModule("blog");
29 }
30
37 public function executeCommand()
38 {
39 $next_class = $this->ctrl->getNextClass($this);
40 $cmd = $this->ctrl->getCmd();
41
42 $this->prepareOutput();
43
44/* if(!$ilAccess->checkAccess('read','',$this->object->getRefId()))
45 {
46 $ilErr->raiseError($this->lng->txt('no_permission'),$ilErr->WARNING);
47 }
48*/
49 switch($next_class)
50 {
51 case 'ilpermissiongui':
52 $this->tabs_gui->setTabActive('perm_settings');
53 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
54 $perm_gui = new ilPermissionGUI($this);
55 $this->ctrl->forwardCommand($perm_gui);
56 break;
57
58 default:
59 if(!$cmd || $cmd == 'view')
60 {
61 $cmd = "editSettings";
62 }
63
64 $this->$cmd();
65 break;
66 }
67 return true;
68 }
69
76 public function getAdminTabs()
77 {
78 global $rbacsystem;
79
80 if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
81 {
82 $this->tabs_gui->addTarget("settings",
83 $this->ctrl->getLinkTarget($this, "editSettings"),
84 array("editSettings", "view"));
85 }
86
87 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
88 {
89 $this->tabs_gui->addTarget("perm_settings",
90 $this->ctrl->getLinkTargetByClass('ilpermissiongui',"perm"),
91 array(),'ilpermissiongui');
92 }
93 }
94
95
99 public function editSettings($a_form = null)
100 {
101 global $lng, $ilSetting;
102
103 $this->tabs_gui->setTabActive('settings');
104
105 if (!$ilSetting->get("disable_wsp_blogs"))
106 {
107 ilUtil::sendInfo($lng->txt("blog_admin_toggle_info"));
108 }
109 else
110 {
111 ilUtil::sendInfo($lng->txt("blog_admin_inactive_info"));
112 }
113
114 if(!$a_form)
115 {
116 $a_form = $this->initFormSettings();
117 }
118 $this->tpl->setContent($a_form->getHTML());
119 return true;
120 }
121
125 public function saveSettings()
126 {
127 global $ilCtrl;
128
129 $this->checkPermission("write");
130
131 $form = $this->initFormSettings();
132 if($form->checkInput())
133 {
134 $banner = (bool)$form->getInput("banner");
135
136 $blga_set = new ilSetting("blga");
137 $blga_set->set("banner", $banner);
138 $blga_set->set("banner_width", (int)$form->getInput("width"));
139 $blga_set->set("banner_height", (int)$form->getInput("height"));
140 $blga_set->set("mask", (bool)$form->getInput("mask"));
141
142 ilUtil::sendSuccess($this->lng->txt("settings_saved"),true);
143 $ilCtrl->redirect($this, "editSettings");
144 }
145
146 $form->setValuesByPost();
147 $this->editSettings($form);
148 }
149
153 public function cancel()
154 {
155 global $ilCtrl;
156
157 $ilCtrl->redirect($this, "view");
158 }
159
165 protected function initFormSettings()
166 {
167 global $lng, $ilAccess;
168
169 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
170 $form = new ilPropertyFormGUI();
171 $form->setFormAction($this->ctrl->getFormAction($this));
172 $form->setTitle($this->lng->txt('blog_settings'));
173
174 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
175 {
176 $form->addCommandButton('saveSettings',$this->lng->txt('save'));
177 $form->addCommandButton('cancel',$this->lng->txt('cancel'));
178 }
179
180 $banner = new ilCheckboxInputGUI($lng->txt("blog_preview_banner"), "banner");
181 $banner->setInfo($lng->txt("blog_preview_banner_info"));
182 $form->addItem($banner);
183
184 $width = new ilNumberInputGUI($lng->txt("blog_preview_banner_width"), "width");
185 $width->setRequired(true);
186 $width->setSize(4);
187 $banner->addSubItem($width);
188
189 $height = new ilNumberInputGUI($lng->txt("blog_preview_banner_height"), "height");
190 $height->setRequired(true);
191 $height->setSize(4);
192 $banner->addSubItem($height);
193
194 $blga_set = new ilSetting("blga");
195 $banner->setChecked($blga_set->get("banner", false));
196 if($blga_set->get("banner"))
197 {
198 $width->setValue($blga_set->get("banner_width"));
199 $height->setValue($blga_set->get("banner_height"));
200 }
201 else
202 {
203 $width->setValue(1370);
204 $height->setValue(100);
205 }
206
207 $mask = new ilCheckboxInputGUI($lng->txt("blog_allow_html"), "mask");
208 $mask->setInfo($lng->txt("blog_allow_html_info"));
209 $mask->setChecked($blga_set->get("mask", false));
210 $form->addItem($mask);
211
212 return $form;
213 }
214}
215?>
This class represents a checkbox property in a property form.
This class represents a number property in a property form.
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Contructor.
editSettings($a_form=null)
Edit settings.
initFormSettings()
Init settings property form.
Class ilObjectGUI Basic methods of all Output classes.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
prepareOutput()
prepare output
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
ILIAS Setting Class.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$mask
Definition: example_042.php:90
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35