ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjPortfolioAdministrationGUI.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 = "prfa";
26 parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
27
28 $this->lng->loadLanguageModule("prtf");
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 /*
106 if ($ilSetting->get('user_portfolios'))
107 {
108 ilUtil::sendInfo($lng->txt("prtf_admin_toggle_info"));
109 }
110 else
111 {
112 ilUtil::sendInfo($lng->txt("prtf_admin_inactive_info"));
113 }
114 */
115
116 if(!$a_form)
117 {
118 $a_form = $this->initFormSettings();
119 }
120 $this->tpl->setContent($a_form->getHTML());
121 return true;
122 }
123
127 public function saveSettings()
128 {
129 global $ilCtrl, $ilSetting;
130
131 $this->checkPermission("write");
132
133 $form = $this->initFormSettings();
134 if($form->checkInput())
135 {
136 $ilSetting->set('user_portfolios', (int)$form->getInput("prtf"));
137
138 $banner = (bool)$form->getInput("banner");
139
140 $prfa_set = new ilSetting("prfa");
141 $prfa_set->set("pd_block", (bool)$form->getInput("pd_block"));
142 $prfa_set->set("banner", $banner);
143 $prfa_set->set("banner_width", (int)$form->getInput("width"));
144 $prfa_set->set("banner_height", (int)$form->getInput("height"));
145 $prfa_set->set("mask", (bool)$form->getInput("mask"));
146 $prfa_set->set("mycrs", (bool)$form->getInput("mycrs"));
147
148 ilUtil::sendSuccess($this->lng->txt("settings_saved"),true);
149 $ilCtrl->redirect($this, "editSettings");
150 }
151
152 $form->setValuesByPost();
153 $this->editSettings($form);
154 }
155
159 public function cancel()
160 {
161 global $ilCtrl;
162
163 $ilCtrl->redirect($this, "view");
164 }
165
171 protected function initFormSettings()
172 {
173 global $lng, $ilSetting, $ilAccess;
174
175 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
176 $form = new ilPropertyFormGUI();
177 $form->setFormAction($this->ctrl->getFormAction($this));
178 $form->setTitle($this->lng->txt('prtf_settings'));
179
180 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
181 {
182 $form->addCommandButton('saveSettings',$this->lng->txt('save'));
183 $form->addCommandButton('cancel',$this->lng->txt('cancel'));
184 }
185
186 // Enable 'Portfolios'
187 $lng->loadLanguageModule('pd');
188 $lng->loadLanguageModule('user');
189 $prtf_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_prtf'), 'prtf');
190 $prtf_prop->setValue('1');
191 $prtf_prop->setInfo($lng->txt('user_portfolios_desc'));
192 $prtf_prop->setChecked(($ilSetting->get('user_portfolios') ? '1' : '0'));
193 $form->addItem($prtf_prop);
194
195 $prfa_set = new ilSetting("prfa");
196
197 $pdblock = new ilCheckboxInputGUI($lng->txt("prtf_pd_block"), "pd_block");
198 $pdblock->setInfo($lng->txt("prtf_pd_block_info"));
199 $pdblock->setChecked($prfa_set->get("pd_block", false));
200 $form->addItem($pdblock);
201
202 $banner = new ilCheckboxInputGUI($lng->txt("prtf_preview_banner"), "banner");
203 $banner->setInfo($lng->txt("prtf_preview_banner_info"));
204 $form->addItem($banner);
205
206 $width = new ilNumberInputGUI($lng->txt("prtf_preview_banner_width"), "width");
207 $width->setRequired(true);
208 $width->setSize(4);
209 $banner->addSubItem($width);
210
211 $height = new ilNumberInputGUI($lng->txt("prtf_preview_banner_height"), "height");
212 $height->setRequired(true);
213 $height->setSize(4);
214 $banner->addSubItem($height);
215
216 $banner->setChecked($prfa_set->get("banner", false));
217 if($prfa_set->get("banner"))
218 {
219 $width->setValue($prfa_set->get("banner_width"));
220 $height->setValue($prfa_set->get("banner_height"));
221 }
222 else
223 {
224 $width->setValue(1370);
225 $height->setValue(100);
226 }
227
228 $mask = new ilCheckboxInputGUI($lng->txt("prtf_allow_html"), "mask");
229 $mask->setInfo($lng->txt("prtf_allow_html_info"));
230 $mask->setChecked($prfa_set->get("mask", false));
231 $form->addItem($mask);
232
233 $mycourses = new ilCheckboxInputGUI($lng->txt("prtf_allow_my_courses"), "mycrs");
234 $mycourses->setInfo($lng->txt("prtf_allow_my_courses_info"));
235 $mycourses->setChecked($prfa_set->get("mycrs", true));
236 $form->addItem($mycourses);
237
238 return $form;
239 }
240
241 public function addToExternalSettingsForm($a_form_id)
242 {
243 global $ilSetting;
244
245 switch($a_form_id)
246 {
248
249 $fields = array('pd_enable_prtf' => array($ilSetting->get('user_portfolios'), ilAdministrationSettingsFormHandler::VALUE_BOOL));
250
251 return array(array("editSettings", $fields));
252 }
253 }
254}
255
256?>
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.
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.
$mask
Definition: example_042.php:90
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35