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