ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 global $DIC;
26
27 $this->lng = $DIC->language();
28 $this->settings = $DIC->settings();
29 $this->ctrl = $DIC->ctrl();
30 $this->access = $DIC->access();
31 $this->type = "prfa";
32 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
33
34 $this->lng->loadLanguageModule("prtf");
35 }
36
43 public function executeCommand()
44 {
45 $next_class = $this->ctrl->getNextClass($this);
46 $cmd = $this->ctrl->getCmd();
47
48 $this->prepareOutput();
49
50 switch ($next_class) {
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 $cmd = "editSettings";
61 }
62
63 $this->$cmd();
64 break;
65 }
66 return true;
67 }
68
75 public function getAdminTabs()
76 {
77 if ($this->checkPermissionBool("visible,read")) {
78 $this->tabs_gui->addTarget(
79 "settings",
80 $this->ctrl->getLinkTarget($this, "editSettings"),
81 array("editSettings", "view")
82 );
83 }
84
85 if ($this->checkPermissionBool('edit_permission')) {
86 $this->tabs_gui->addTarget(
87 "perm_settings",
88 $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"),
89 array(),
90 'ilpermissiongui'
91 );
92 }
93 }
94
95
99 public function editSettings($a_form = null)
100 {
103
104 $this->tabs_gui->setTabActive('settings');
105
106 /*
107 if ($ilSetting->get('user_portfolios'))
108 {
109 ilUtil::sendInfo($lng->txt("prtf_admin_toggle_info"));
110 }
111 else
112 {
113 ilUtil::sendInfo($lng->txt("prtf_admin_inactive_info"));
114 }
115 */
116
117 if (!$a_form) {
118 $a_form = $this->initFormSettings();
119 }
120 $this->tpl->setContent($a_form->getHTML());
121 return true;
122 }
123
127 public function saveSettings()
128 {
131
132 $this->checkPermission("write");
133
134 $form = $this->initFormSettings();
135 if ($form->checkInput()) {
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 {
162
163 $ilCtrl->redirect($this, "view");
164 }
165
171 protected function initFormSettings()
172 {
175 $ilAccess = $this->access;
176
177 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
178 $form = new ilPropertyFormGUI();
179 $form->setFormAction($this->ctrl->getFormAction($this));
180 $form->setTitle($this->lng->txt('prtf_settings'));
181
182 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
183 $form->addCommandButton('saveSettings', $this->lng->txt('save'));
184 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
185 }
186
187 // Enable 'Portfolios'
188 $lng->loadLanguageModule('pd');
189 $lng->loadLanguageModule('user');
190 $prtf_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_prtf'), 'prtf');
191 $prtf_prop->setValue('1');
192 $prtf_prop->setInfo($lng->txt('user_portfolios_desc'));
193 $prtf_prop->setChecked(($ilSetting->get('user_portfolios') ? '1' : '0'));
194 $form->addItem($prtf_prop);
195
196 $prfa_set = new ilSetting("prfa");
197
198 $pdblock = new ilCheckboxInputGUI($lng->txt("prtf_pd_block"), "pd_block");
199 $pdblock->setInfo($lng->txt("prtf_pd_block_info"));
200 $pdblock->setChecked($prfa_set->get("pd_block", false));
201 $form->addItem($pdblock);
202
203 $banner = new ilCheckboxInputGUI($lng->txt("prtf_preview_banner"), "banner");
204 $banner->setInfo($lng->txt("prtf_preview_banner_info"));
205 $form->addItem($banner);
206
207 $width = new ilNumberInputGUI($lng->txt("prtf_preview_banner_width"), "width");
208 $width->setRequired(true);
209 $width->setSize(4);
210 $banner->addSubItem($width);
211
212 $height = new ilNumberInputGUI($lng->txt("prtf_preview_banner_height"), "height");
213 $height->setRequired(true);
214 $height->setSize(4);
215 $banner->addSubItem($height);
216
217 $banner->setChecked($prfa_set->get("banner", false));
218 if ($prfa_set->get("banner")) {
219 $width->setValue($prfa_set->get("banner_width"));
220 $height->setValue($prfa_set->get("banner_height"));
221 } else {
222 $width->setValue(1370);
223 $height->setValue(100);
224 }
225
226 /*
227 $mask = new ilCheckboxInputGUI($lng->txt("prtf_allow_html"), "mask");
228 $mask->setInfo($lng->txt("prtf_allow_html_info"));
229 $mask->setChecked($prfa_set->get("mask", false));
230 $form->addItem($mask);*/
231
233 $ne = new ilNonEditableValueGUI($lng->txt("prtf_allow_html"), "", true);
234 $this->ctrl->setParameter($gui, "ref_id", $gui->object->getRefId());
235 $link = $this->ctrl->getLinkTarget($gui);
236 $ne->setValue("<a href='$link'> >> ".$this->lng->txt("settings")."</a>");
237 $form->addItem($ne);
238
239 $mycourses = new ilCheckboxInputGUI($lng->txt("prtf_allow_my_courses"), "mycrs");
240 $mycourses->setInfo($lng->txt("prtf_allow_my_courses_info"));
241 $mycourses->setChecked($prfa_set->get("mycrs", true));
242 $form->addItem($mycourses);
243
244 return $form;
245 }
246
247 public function addToExternalSettingsForm($a_form_id)
248 {
250
251 switch ($a_form_id) {
253
254 $fields = array('pd_enable_prtf' => array($ilSetting->get('user_portfolios'), ilAdministrationSettingsFormHandler::VALUE_BOOL));
255
256 return array(array("editSettings", $fields));
257 }
258 }
259}
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 non editable value 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.
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:17
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2