ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilObjQuestionPoolSettingsGeneralGUI Class Reference
+ Collaboration diagram for ilObjQuestionPoolSettingsGeneralGUI:

Public Member Functions

 __construct (ilCtrl $ctrl, ilAccessHandler $access, ilLanguage $lng, ilTemplate $tpl, ilTabsGUI $tabs, ilObjQuestionPoolGUI $poolGUI)
 Constructor. More...
 
 executeCommand ()
 Command Execution. More...
 

Data Fields

const CMD_SHOW_FORM = 'showForm'
 command constants More...
 
const CMD_SAVE_FORM = 'saveForm'
 

Protected Member Functions

 formPropertyExists (ilPropertyFormGUI $form, $propertyId)
 

Protected Attributes

 $ctrl = null
 
 $access = null
 
 $lng = null
 
 $tpl = null
 
 $tabs = null
 
 $poolGUI = null
 
 $poolOBJ = null
 

Private Member Functions

 showFormCmd (ilPropertyFormGUI $form=null)
 
 saveFormCmd ()
 
 performSaveForm (ilPropertyFormGUI $form)
 
 buildForm ()
 
 getTaxonomySelectInputOptions ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ buildForm()

ilObjQuestionPoolSettingsGeneralGUI::buildForm ( )
private

Definition at line 200 of file class.ilObjQuestionPoolSettingsGeneralGUI.php.

201 {
202 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
203 $form = new ilPropertyFormGUI();
204
205 $form->setFormAction($this->ctrl->getFormAction($this));
206 $form->addCommandButton(self::CMD_SAVE_FORM, $this->lng->txt('save'));
207
208 $form->setTitle($this->lng->txt('qpl_form_general_settings'));
209 $form->setId('properties');
210
211 include_once 'Services/MetaData/classes/class.ilMD.php';
212 $md_obj = new ilMD($this->poolOBJ->getId(), 0, "qpl");
213 $md_section = $md_obj->getGeneral();
214
215 $title = new ilTextInputGUI($this->lng->txt("title"), "title");
216 $title->setRequired(true);
217 $title->setValue($md_section->getTitle());
218 $form->addItem($title);
219
220 $ids = $md_section->getDescriptionIds();
221 if($ids)
222 {
223 $desc_obj = $md_section->getDescription(array_pop($ids));
224
225 $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description");
226 $desc->setCols(50);
227 $desc->setRows(4);
228 $desc->setValue($desc_obj->getDescription());
229 $form->addItem($desc);
230 }
231
232 // online
233
234 $online = new ilCheckboxInputGUI($this->lng->txt('qpl_settings_general_form_property_online'), 'online');
235 $online->setInfo($this->lng->txt('qpl_settings_general_form_property_online_description'));
236 $online->setChecked($this->poolOBJ->getOnline());
237 $form->addItem($online);
238
239 // show taxonomies
240
241 $showTax = new ilCheckboxInputGUI($this->lng->txt('qpl_settings_general_form_property_show_taxonomies'), 'show_taxonomies');
242 $showTax->setInfo($this->lng->txt('qpl_settings_general_form_prop_show_tax_desc'));
243 $showTax->setChecked($this->poolOBJ->getShowTaxonomies());
244 $form->addItem($showTax);
245
246 $taxSelectOptions = $this->getTaxonomySelectInputOptions();
247
248 // pool navigation taxonomy
249
250 $navTax = new ilSelectInputGUI($this->lng->txt('qpl_settings_general_form_property_nav_taxonomy'), 'nav_taxonomy');
251 $navTax->setInfo($this->lng->txt('qpl_settings_general_form_property_nav_taxonomy_description'));
252 $navTax->setValue($this->poolOBJ->getNavTaxonomyId());
253 $navTax->setOptions($taxSelectOptions);
254 $showTax->addSubItem($navTax);
255
256 // skill service activation
257
259 {
260 $skillService = new ilCheckboxInputGUI($this->lng->txt('tst_activate_skill_service'), 'skill_service');
261 $skillService->setChecked($this->poolOBJ->isSkillServiceEnabled());
262 $form->addItem($skillService);
263 }
264
265 return $form;
266 }
This class represents a checkbox property in a property form.
This class represents a property form user interface.
This class represents a selection list property in a property form.
This class represents a text area property in a property form.
This class represents a text property in a property form.

References getTaxonomySelectInputOptions(), and ilObjQuestionPool\isSkillManagementGloballyActivated().

Referenced by saveFormCmd(), and showFormCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjQuestionPoolSettingsGeneralGUI::executeCommand ( )

Command Execution.

Definition at line 90 of file class.ilObjQuestionPoolSettingsGeneralGUI.php.

91 {
92 // allow only write access
93
94 if (!$this->access->checkAccess('write', '', $this->poolGUI->ref_id))
95 {
96 ilUtil::sendInfo($this->lng->txt('cannot_edit_question_pool'), true);
97 $this->ctrl->redirectByClass('ilObjQuestionPoolGUI', 'infoScreen');
98 }
99
100 // activate corresponding tab (auto activation does not work in ilObjTestGUI-Tabs-Salad)
101
102 $this->tabs->activateTab('settings');
103
104 // process command
105
106 $nextClass = $this->ctrl->getNextClass();
107
108 switch($nextClass)
109 {
110 default:
111 $cmd = $this->ctrl->getCmd(self::CMD_SHOW_FORM).'Cmd';
112 $this->$cmd();
113 }
114 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$cmd
Definition: sahs_server.php:35

References $cmd, and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ formPropertyExists()

ilObjQuestionPoolSettingsGeneralGUI::formPropertyExists ( ilPropertyFormGUI  $form,
  $propertyId 
)
protected

Definition at line 282 of file class.ilObjQuestionPoolSettingsGeneralGUI.php.

283 {
284 return $form->getItemByPostVar($propertyId) instanceof ilFormPropertyGUI;
285 }
This class represents a property in a property form.
getItemByPostVar($a_post_var)
Get Item by POST variable.

References ilPropertyFormGUI\getItemByPostVar().

Referenced by performSaveForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTaxonomySelectInputOptions()

ilObjQuestionPoolSettingsGeneralGUI::getTaxonomySelectInputOptions ( )
private

Definition at line 268 of file class.ilObjQuestionPoolSettingsGeneralGUI.php.

269 {
270 $taxSelectOptions = array(
271 '0' => $this->lng->txt('qpl_settings_general_form_property_opt_notax_selected')
272 );
273
274 foreach($this->poolOBJ->getTaxonomyIds() as $taxId)
275 {
276 $taxSelectOptions[$taxId] = ilObject::_lookupTitle($taxId);
277 }
278
279 return $taxSelectOptions;
280 }
static _lookupTitle($a_id)
lookup object title

References ilObject\_lookupTitle().

Referenced by buildForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performSaveForm()

ilObjQuestionPoolSettingsGeneralGUI::performSaveForm ( ilPropertyFormGUI  $form)
private

Definition at line 153 of file class.ilObjQuestionPoolSettingsGeneralGUI.php.

154 {
155 include_once 'Services/MetaData/classes/class.ilMD.php';
156 $md_obj = new ilMD($this->poolOBJ->getId(), 0, "qpl");
157 $md_section = $md_obj->getGeneral();
158
159 // title
160 $md_section->setTitle($form->getItemByPostVar('title')->getValue());
161 $md_section->update();
162
163 // Description
164 $md_desc_ids = $md_section->getDescriptionIds();
165 if ($md_desc_ids)
166 {
167 $md_desc = $md_section->getDescription(array_pop($md_desc_ids));
168 $md_desc->setDescription($form->getItemByPostVar('description')->getValue());
169 $md_desc->update();
170 }
171 else
172 {
173 $md_desc = $md_section->addDescription();
174 $md_desc->setDescription($form->getItemByPostVar('description')->getValue());
175 $md_desc->save();
176 }
177
178 $this->poolOBJ->setTitle($form->getItemByPostVar('title')->getValue());
179 $this->poolOBJ->setDescription($form->getItemByPostVar('description')->getValue());
180 $this->poolOBJ->update();
181
182 $online = $form->getItemByPostVar('online');
183 $this->poolOBJ->setOnline($online->getChecked());
184
185 $showTax = $form->getItemByPostVar('show_taxonomies');
186 $this->poolOBJ->setShowTaxonomies($showTax->getChecked());
187
188 $navTax = $form->getItemByPostVar('nav_taxonomy');
189 $this->poolOBJ->setNavTaxonomyId($navTax->getValue());
190
191 if( $this->formPropertyExists($form, 'skill_service') )
192 {
193 $skillService = $form->getItemByPostVar('skill_service');
194 $this->poolOBJ->setSkillServiceEnabled($skillService->getChecked());
195 }
196
197 $this->poolOBJ->saveToDb();
198 }

References formPropertyExists(), and ilPropertyFormGUI\getItemByPostVar().

Referenced by saveFormCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveFormCmd()

ilObjQuestionPoolSettingsGeneralGUI::saveFormCmd ( )
private

Definition at line 126 of file class.ilObjQuestionPoolSettingsGeneralGUI.php.

127 {
128 $form = $this->buildForm();
129
130 // form validation and initialisation
131
132 $errors = !$form->checkInput(); // ALWAYS CALL BEFORE setValuesByPost()
133 $form->setValuesByPost(); // NEVER CALL THIS BEFORE checkInput()
134
135 // return to form when any form validation errors exist
136
137 if($errors)
138 {
139 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
140 return $this->showFormCmd($form);
141 }
142
143 // perform saving the form data
144
145 $this->performSaveForm($form);
146
147 // redirect to form output
148
149 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
150 $this->ctrl->redirect($this, self::CMD_SHOW_FORM);
151 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$errors

References $errors, buildForm(), performSaveForm(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and showFormCmd().

+ Here is the call graph for this function:

◆ showFormCmd()

ilObjQuestionPoolSettingsGeneralGUI::showFormCmd ( ilPropertyFormGUI  $form = null)
private

Definition at line 116 of file class.ilObjQuestionPoolSettingsGeneralGUI.php.

117 {
118 if( $form === null )
119 {
120 $form = $this->buildForm();
121 }
122
123 $this->tpl->setContent( $this->ctrl->getHTML($form) );
124 }

References buildForm().

Referenced by saveFormCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilObjQuestionPoolSettingsGeneralGUI::$access = null
protected

Definition at line 35 of file class.ilObjQuestionPoolSettingsGeneralGUI.php.

Referenced by __construct().

◆ $ctrl

ilObjQuestionPoolSettingsGeneralGUI::$ctrl = null
protected

Definition at line 28 of file class.ilObjQuestionPoolSettingsGeneralGUI.php.

Referenced by __construct().

◆ $lng

ilObjQuestionPoolSettingsGeneralGUI::$lng = null
protected

Definition at line 42 of file class.ilObjQuestionPoolSettingsGeneralGUI.php.

Referenced by __construct().

◆ $poolGUI

ilObjQuestionPoolSettingsGeneralGUI::$poolGUI = null
protected

Definition at line 63 of file class.ilObjQuestionPoolSettingsGeneralGUI.php.

Referenced by __construct().

◆ $poolOBJ

ilObjQuestionPoolSettingsGeneralGUI::$poolOBJ = null
protected

◆ $tabs

ilObjQuestionPoolSettingsGeneralGUI::$tabs = null
protected

Definition at line 56 of file class.ilObjQuestionPoolSettingsGeneralGUI.php.

Referenced by __construct().

◆ $tpl

ilObjQuestionPoolSettingsGeneralGUI::$tpl = null
protected

Definition at line 49 of file class.ilObjQuestionPoolSettingsGeneralGUI.php.

Referenced by __construct().

◆ CMD_SAVE_FORM

const ilObjQuestionPoolSettingsGeneralGUI::CMD_SAVE_FORM = 'saveForm'

◆ CMD_SHOW_FORM

const ilObjQuestionPoolSettingsGeneralGUI::CMD_SHOW_FORM = 'showForm'

command constants

Definition at line 20 of file class.ilObjQuestionPoolSettingsGeneralGUI.php.


The documentation for this class was generated from the following file: