ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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("banner", $banner);
142 $prfa_set->set("banner_width", (int)$form->getInput("width"));
143 $prfa_set->set("banner_height", (int)$form->getInput("height"));
144 $prfa_set->set("mask", (bool)$form->getInput("mask"));
145 $prfa_set->set("mycrs", (bool)$form->getInput("mycrs"));
146
147 ilUtil::sendSuccess($this->lng->txt("settings_saved"),true);
148 $ilCtrl->redirect($this, "editSettings");
149 }
150
151 $form->setValuesByPost();
152 $this->editSettings($form);
153 }
154
158 public function cancel()
159 {
160 global $ilCtrl;
161
162 $ilCtrl->redirect($this, "view");
163 }
164
170 protected function initFormSettings()
171 {
172 global $lng, $ilSetting;
173
174 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
175 $form = new ilPropertyFormGUI();
176 $form->setFormAction($this->ctrl->getFormAction($this));
177 $form->setTitle($this->lng->txt('prtf_settings'));
178 $form->addCommandButton('saveSettings',$this->lng->txt('save'));
179 $form->addCommandButton('cancel',$this->lng->txt('cancel'));
180
181 // Enable 'Portfolios'
182 $lng->loadLanguageModule('pd');
183 $lng->loadLanguageModule('user');
184 $prtf_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_prtf'), 'prtf');
185 $prtf_prop->setValue('1');
186 $prtf_prop->setInfo($lng->txt('user_portfolios_desc'));
187 $prtf_prop->setChecked(($ilSetting->get('user_portfolios') ? '1' : '0'));
188 $form->addItem($prtf_prop);
189
190 $banner = new ilCheckboxInputGUI($lng->txt("prtf_preview_banner"), "banner");
191 $banner->setInfo($lng->txt("prtf_preview_banner_info"));
192 $form->addItem($banner);
193
194 $width = new ilNumberInputGUI($lng->txt("prtf_preview_banner_width"), "width");
195 $width->setRequired(true);
196 $width->setSize(4);
197 $banner->addSubItem($width);
198
199 $height = new ilNumberInputGUI($lng->txt("prtf_preview_banner_height"), "height");
200 $height->setRequired(true);
201 $height->setSize(4);
202 $banner->addSubItem($height);
203
204 $prfa_set = new ilSetting("prfa");
205 $banner->setChecked($prfa_set->get("banner", false));
206 if($prfa_set->get("banner"))
207 {
208 $width->setValue($prfa_set->get("banner_width"));
209 $height->setValue($prfa_set->get("banner_height"));
210 }
211 else
212 {
213 $width->setValue(1370);
214 $height->setValue(100);
215 }
216
217 $mask = new ilCheckboxInputGUI($lng->txt("prtf_allow_html"), "mask");
218 $mask->setInfo($lng->txt("prtf_allow_html_info"));
219 $mask->setChecked($prfa_set->get("mask", false));
220 $form->addItem($mask);
221
222 $mycourses = new ilCheckboxInputGUI($lng->txt("prtf_allow_my_courses"), "mycrs");
223 $mycourses->setInfo($lng->txt("prtf_allow_my_courses_info"));
224 $mycourses->setChecked($prfa_set->get("mycrs", true));
225 $form->addItem($mycourses);
226
227 return $form;
228 }
229
230 public function addToExternalSettingsForm($a_form_id)
231 {
232 global $ilSetting;
233
234 switch($a_form_id)
235 {
237
238 $fields = array('pd_enable_prtf' => array($ilSetting->get('user_portfolios'), ilAdministrationSettingsFormHandler::VALUE_BOOL));
239
240 return array(array("editSettings", $fields));
241 }
242 }
243}
244
245?>
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.
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35