ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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::__construct($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 switch($next_class)
45 {
46 case 'ilpermissiongui':
47 $this->tabs_gui->setTabActive('perm_settings');
48 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
49 $perm_gui = new ilPermissionGUI($this);
50 $this->ctrl->forwardCommand($perm_gui);
51 break;
52
53 default:
54 if(!$cmd || $cmd == 'view')
55 {
56 $cmd = "editSettings";
57 }
58
59 $this->$cmd();
60 break;
61 }
62 return true;
63 }
64
71 public function getAdminTabs()
72 {
73 if ($this->checkPermissionBool("visible,read"))
74 {
75 $this->tabs_gui->addTarget("settings",
76 $this->ctrl->getLinkTarget($this, "editSettings"),
77 array("editSettings", "view"));
78 }
79
80 if ($this->checkPermissionBool('edit_permission'))
81 {
82 $this->tabs_gui->addTarget("perm_settings",
83 $this->ctrl->getLinkTargetByClass('ilpermissiongui',"perm"),
84 array(),'ilpermissiongui');
85 }
86 }
87
88
92 public function editSettings($a_form = null)
93 {
94 global $lng, $ilSetting;
95
96 $this->tabs_gui->setTabActive('settings');
97
98 if (!$ilSetting->get("disable_wsp_blogs"))
99 {
100 ilUtil::sendInfo($lng->txt("blog_admin_toggle_info"));
101 }
102 else
103 {
104 ilUtil::sendInfo($lng->txt("blog_admin_inactive_info"));
105 }
106
107 if(!$a_form)
108 {
109 $a_form = $this->initFormSettings();
110 }
111 $this->tpl->setContent($a_form->getHTML());
112 return true;
113 }
114
118 public function saveSettings()
119 {
120 global $ilCtrl;
121
122 $this->checkPermission("write");
123
124 $form = $this->initFormSettings();
125 if($form->checkInput())
126 {
127 $banner = (bool)$form->getInput("banner");
128
129 $blga_set = new ilSetting("blga");
130 $blga_set->set("banner", $banner);
131 $blga_set->set("banner_width", (int)$form->getInput("width"));
132 $blga_set->set("banner_height", (int)$form->getInput("height"));
133 $blga_set->set("mask", (bool)$form->getInput("mask"));
134
135 ilUtil::sendSuccess($this->lng->txt("settings_saved"),true);
136 $ilCtrl->redirect($this, "editSettings");
137 }
138
139 $form->setValuesByPost();
140 $this->editSettings($form);
141 }
142
146 public function cancel()
147 {
148 global $ilCtrl;
149
150 $ilCtrl->redirect($this, "view");
151 }
152
158 protected function initFormSettings()
159 {
160 global $lng;
161
162 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
163 $form = new ilPropertyFormGUI();
164 $form->setFormAction($this->ctrl->getFormAction($this));
165 $form->setTitle($this->lng->txt('blog_settings'));
166
167 if ($this->checkPermissionBool("write"))
168 {
169 $form->addCommandButton('saveSettings',$this->lng->txt('save'));
170 $form->addCommandButton('cancel',$this->lng->txt('cancel'));
171 }
172
173 $banner = new ilCheckboxInputGUI($lng->txt("blog_preview_banner"), "banner");
174 $banner->setInfo($lng->txt("blog_preview_banner_info"));
175 $form->addItem($banner);
176
177 $width = new ilNumberInputGUI($lng->txt("blog_preview_banner_width"), "width");
178 $width->setRequired(true);
179 $width->setSize(4);
180 $banner->addSubItem($width);
181
182 $height = new ilNumberInputGUI($lng->txt("blog_preview_banner_height"), "height");
183 $height->setRequired(true);
184 $height->setSize(4);
185 $banner->addSubItem($height);
186
187 $blga_set = new ilSetting("blga");
188 $banner->setChecked($blga_set->get("banner", false));
189 if($blga_set->get("banner"))
190 {
191 $width->setValue($blga_set->get("banner_width"));
192 $height->setValue($blga_set->get("banner_height"));
193 }
194 else
195 {
196 $width->setValue(1370);
197 $height->setValue(100);
198 }
199
200 $mask = new ilCheckboxInputGUI($lng->txt("blog_allow_html"), "mask");
201 $mask->setInfo($lng->txt("blog_allow_html_info"));
202 $mask->setChecked($blga_set->get("mask", false));
203 $form->addItem($mask);
204
205 return $form;
206 }
207}
208?>
An exception for terminatinating execution or to throw for unit testing.
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($a_show_subobjects=true)
prepare output
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
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:17
$cmd
Definition: sahs_server.php:35