ILIAS  release_4-4 Revision
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 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()

ilObjQuestionPoolSettingsGeneralGUI::__construct ( ilCtrl  $ctrl,
ilAccessHandler  $access,
ilLanguage  $lng,
ilTemplate  $tpl,
ilTabsGUI  $tabs,
ilObjQuestionPoolGUI  $poolGUI 
)

Member Function Documentation

◆ buildForm()

ilObjQuestionPoolSettingsGeneralGUI::buildForm ( )
private

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

References getTaxonomySelectInputOptions(), and ilFormPropertyGUI\setInfo().

Referenced by saveFormCmd(), and showFormCmd().

168  {
169  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
170  $form = new ilPropertyFormGUI();
171 
172  $form->setFormAction($this->ctrl->getFormAction($this));
173  $form->addCommandButton(self::CMD_SAVE_FORM, $this->lng->txt('save'));
174 
175  $form->setTitle($this->lng->txt('qpl_form_general_settings'));
176  $form->setId('properties');
177 
178  // online
179 
180  $online = new ilCheckboxInputGUI($this->lng->txt('qpl_settings_general_form_property_online'), 'online');
181  $online->setInfo($this->lng->txt('qpl_settings_general_form_property_online_description'));
182  $online->setChecked($this->poolOBJ->getOnline());
183  $form->addItem($online);
184 
185  // show taxonomies
186 
187  $showTax = new ilCheckboxInputGUI($this->lng->txt('qpl_settings_general_form_property_show_taxonomies'), 'show_taxonomies');
188  $showTax->setInfo($this->lng->txt('qpl_settings_general_form_prop_show_tax_desc'));
189  $showTax->setChecked($this->poolOBJ->getShowTaxonomies());
190  $form->addItem($showTax);
191 
192  $taxSelectOptions = $this->getTaxonomySelectInputOptions();
193 
194  // pool navigation taxonomy
195 
196  $navTax = new ilSelectInputGUI($this->lng->txt('qpl_settings_general_form_property_nav_taxonomy'), 'nav_taxonomy');
197  $navTax->setInfo($this->lng->txt('qpl_settings_general_form_property_nav_taxonomy_description'));
198  $navTax->setValue($this->poolOBJ->getNavTaxonomyId());
199  $navTax->setOptions($taxSelectOptions);
200  $showTax->addSubItem($navTax);
201 
202  return $form;
203  }
This class represents a selection list property in a property form.
This class represents a property form user interface.
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Information Text.
+ 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.

References $cmd, and ilUtil\sendInfo().

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  }
$cmd
Definition: sahs_server.php:35
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ getTaxonomySelectInputOptions()

ilObjQuestionPoolSettingsGeneralGUI::getTaxonomySelectInputOptions ( )
private

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

References ilObject\_lookupTitle().

Referenced by buildForm().

206  {
207  $taxSelectOptions = array(
208  '0' => $this->lng->txt('qpl_settings_general_form_property_opt_notax_selected')
209  );
210 
211  foreach($this->poolOBJ->getTaxonomyIds() as $taxId)
212  {
213  $taxSelectOptions[$taxId] = ilObject::_lookupTitle($taxId);
214  }
215 
216  return $taxSelectOptions;
217  }
static _lookupTitle($a_id)
lookup object title
+ 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.

References ilPropertyFormGUI\getItemByPostVar().

Referenced by saveFormCmd().

154  {
155  $online = $form->getItemByPostVar('online');
156  $this->poolOBJ->setOnline($online->getChecked());
157 
158  $showTax = $form->getItemByPostVar('show_taxonomies');
159  $this->poolOBJ->setShowTaxonomies($showTax->getChecked());
160 
161  $navTax = $form->getItemByPostVar('nav_taxonomy');
162  $this->poolOBJ->setNavTaxonomyId($navTax->getValue());
163 
164  $this->poolOBJ->saveToDb();
165  }
getItemByPostVar($a_post_var)
Get Item by POST variable.
+ 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.

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

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.
$errors
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ showFormCmd()

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

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

References buildForm().

Referenced by saveFormCmd().

117  {
118  if( $form === null )
119  {
120  $form = $this->buildForm();
121  }
122 
123  $this->tpl->setContent( $this->ctrl->getHTML($form) );
124  }
+ 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: