Basic class for all survey question types The SurveyQuestionGUI class defines and encapsulates basic methods and attributes for survey question types to be used for all parent classes.
More...
Basic class for all survey question types The SurveyQuestionGUI class defines and encapsulates basic methods and attributes for survey question types to be used for all parent classes.
- Author
- Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Definition at line 28 of file class.SurveyQuestionGUI.php.
◆ __construct()
| SurveyQuestionGUI::__construct |
( |
|
$a_id = -1 | ) |
|
Definition at line 47 of file class.SurveyQuestionGUI.php.
References $DIC, $lng, $tpl, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilLoggerFactory\getLogger(), initObject(), ILIAS\Repository\lng(), setQuestionTabs(), ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().
51 $this->rbacsystem = $DIC->rbac()->system();
52 $this->
user = $DIC->user();
53 $this->
access = $DIC->access();
54 $this->tree = $DIC->repositoryTree();
55 $this->
toolbar = $DIC->toolbar();
56 $lng = $DIC->language();
58 $ilCtrl = $DIC->ctrl();
61 $this->request = $DIC->surveyQuestionPool()
69 $this->
ctrl = $ilCtrl;
70 $this->
ctrl->saveParameter($this,
"q_id");
71 $this->
ctrl->setParameterByClass(
72 $this->
ctrl->getCmdClass(),
74 $this->request->getSelectedQuestionTypes()
76 $this->cumulated = array();
77 $this->
tabs = $DIC->tabs();
82 $this->
object->loadFromDb($a_id);
86 $this->edit_manager = $DIC->surveyQuestionPool()
90 $this->gui = $DIC->survey()->internal()->gui();
static getLogger(string $a_component_id)
Get component logger.
ilGlobalTemplateInterface $tpl
◆ _getClassNameForQType()
| static SurveyQuestionGUI::_getClassNameForQType |
( |
string |
$q_type | ) |
|
|
static |
◆ _getGUIClassNameForId()
| static SurveyQuestionGUI::_getGUIClassNameForId |
( |
int |
$a_q_id | ) |
|
|
static |
◆ _getQuestionGUI()
| static SurveyQuestionGUI::_getQuestionGUI |
( |
?string |
$questiontype, |
|
|
int |
$question_id = -1 |
|
) |
| |
|
static |
◆ addCommandButtons()
◆ addFieldsToEditForm()
◆ cancel()
| SurveyQuestionGUI::cancel |
( |
| ) |
|
|
protected |
◆ cancelSync()
| SurveyQuestionGUI::cancelSync |
( |
| ) |
|
|
protected |
◆ copySyncForm()
| SurveyQuestionGUI::copySyncForm |
( |
| ) |
|
|
protected |
◆ editQuestion()
◆ executeCommand()
| SurveyQuestionGUI::executeCommand |
( |
| ) |
|
◆ getPrintView()
| SurveyQuestionGUI::getPrintView |
( |
int |
$question_title = 1, |
|
|
bool |
$show_questiontext = true, |
|
|
?int |
$survey_id = null, |
|
|
?array |
$working_data = null |
|
) |
| |
|
abstract |
◆ getPrintViewQuestionTitle()
| SurveyQuestionGUI::getPrintViewQuestionTitle |
( |
int |
$question_title = 1 | ) |
|
|
protected |
◆ getQuestionTitle()
| SurveyQuestionGUI::getQuestionTitle |
( |
int |
$question_title_mode = 1 | ) |
|
|
protected |
◆ getQuestionType()
| SurveyQuestionGUI::getQuestionType |
( |
| ) |
|
◆ getWorkingForm()
| SurveyQuestionGUI::getWorkingForm |
( |
array |
$working_data = null, |
|
|
int |
$question_title = 1, |
|
|
bool |
$show_questiontext = true, |
|
|
string |
$error_message = "", |
|
|
int |
$survey_id = null, |
|
|
bool |
$compress_view = false |
|
) |
| |
|
abstract |
◆ importEditFormValues()
◆ initEditForm()
| SurveyQuestionGUI::initEditForm |
( |
| ) |
|
|
protected |
Definition at line 222 of file class.SurveyQuestionGUI.php.
References ilObjAdvancedEditing\_getRichTextEditor(), addCommandButtons(), addFieldsToEditForm(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilFormPropertyGUI\setRequired().
Referenced by editQuestion(), and saveForm().
225 $form->setFormAction($this->
ctrl->getFormAction($this,
"save"));
226 $form->setTitle($this->
lng->txt($this->getQuestionType()));
227 $form->setMultipart(
false);
228 $form->setTableWidth(
"100%");
233 $title->setMaxLength(200);
234 $title->setRequired(
true);
235 $form->addItem($title);
239 $label->setInfo($this->
lng->txt(
"label_info"));
240 $title->setMaxLength(255);
241 $label->setRequired(
false);
242 $form->addItem($label);
246 $author->setRequired(
true);
247 $title->setMaxLength(100);
248 $form->addItem($author);
251 $description =
new ilTextInputGUI($this->
lng->txt(
"description"),
"description");
252 $description->setRequired(
false);
253 $title->setMaxLength(200);
254 $form->addItem($description);
259 $question->setRows(10);
260 $question->setCols(80);
262 $question->setUseRte(
true);
263 $question->setRteTagSet(
"mini");
265 $form->addItem($question);
269 $shuffle->setValue(1);
270 $shuffle->setRequired(
false);
271 $form->addItem($shuffle);
278 $title->setValue($this->
object->getTitle());
279 $label->setValue($this->
object->label);
280 $author->setValue($this->
object->getAuthor());
281 $description->setValue($this->
object->getDescription());
282 $question->setValue($this->
object->prepareTextareaOutput($this->object->getQuestiontext()));
283 $shuffle->setChecked($this->
object->getObligatory());
static _getRichTextEditor()
Returns the identifier for the Rich Text Editor.
addFieldsToEditForm(ilPropertyFormGUI $a_form)
addCommandButtons(ilPropertyFormGUI $a_form)
This class represents a text area property in a property form.
◆ initObject()
| SurveyQuestionGUI::initObject |
( |
| ) |
|
|
abstractprotected |
◆ originalSyncForm()
| SurveyQuestionGUI::originalSyncForm |
( |
| ) |
|
|
protected |
◆ outQuestionText()
| SurveyQuestionGUI::outQuestionText |
( |
ilTemplate |
$template | ) |
|
|
protected |
Definition at line 146 of file class.SurveyQuestionGUI.php.
References ILIAS\Repository\object(), and HTML_Template_IT\setVariable().
Referenced by SurveyTextQuestionGUI\getPrintView(), SurveySingleChoiceQuestionGUI\getPrintView(), SurveyMetricQuestionGUI\getPrintView(), SurveyMultipleChoiceQuestionGUI\getPrintView(), SurveyMatrixQuestionGUI\getPrintView(), SurveyTextQuestionGUI\getWorkingForm(), SurveyMetricQuestionGUI\getWorkingForm(), SurveySingleChoiceQuestionGUI\getWorkingForm(), SurveyMultipleChoiceQuestionGUI\getWorkingForm(), and SurveyMatrixQuestionGUI\getWorkingForm().
148 $questiontext = $this->
object->getQuestiontext();
149 if (preg_match(
"/^<.[\\>]?>(.*?)<\\/.[\\>]*?>$/", $questiontext, $matches)) {
150 $questiontext = $matches[1];
152 $template->
setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($questiontext,
true));
153 if ($this->
object->getObligatory()) {
setVariable($variable, $value='')
Sets a variable value.
◆ preview()
| SurveyQuestionGUI::preview |
( |
| ) |
|
Definition at line 590 of file class.SurveyQuestionGUI.php.
References Vendor\Package\$f, $r, $tabs, ilTabsGUI\activateTab(), ilGlobalTemplateInterface\get(), getWorkingForm(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilGlobalTemplateInterface\parseCurrentBlock(), ilGlobalTemplateInterface\setCurrentBlock(), and ilGlobalTemplateInterface\setVariable().
596 $tpl =
new ilTemplate(
"tpl.il_svy_qpl_preview.html",
true,
true,
"components/ILIAS/SurveyQuestionPool");
598 if ($this->
object->getObligatory()) {
606 $f = $this->gui->ui()->factory();
607 $r = $this->gui->ui()->renderer();
608 $p =
$f->panel()->standard(
613 $this->tpl->setContent(
$r->render($p));
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
ilGlobalTemplateInterface $tpl
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
activateTab(string $a_id)
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
getWorkingForm(array $working_data=null, int $question_title=1, bool $show_questiontext=true, string $error_message="", int $survey_id=null, bool $compress_view=false)
◆ redirectAfterSaving()
| SurveyQuestionGUI::redirectAfterSaving |
( |
bool |
$a_return = false | ) |
|
|
protected |
Redirect to calling survey or to edit form.
Definition at line 479 of file class.SurveyQuestionGUI.php.
References ILIAS\Repository\ctrl(), and ilUtil\redirect().
Referenced by cancelSync(), save(), sync(), and syncCopies().
485 if ($this->parent_url) {
487 if ($this->request->getNewForSurvey() > 0) {
488 $addurl =
"&new_id=" . $this->request->getQuestionId();
494 $this->
ctrl->redirectByClass(
"ilObjSurveyQuestionPoolGUI",
"questions");
499 $this->
ctrl->setParameterByClass(
500 $this->
ctrl->getCmdClass(),
502 $this->
object->getId()
504 $this->
ctrl->setParameterByClass(
505 $this->
ctrl->getCmdClass(),
506 "sel_question_types",
507 $this->request->getSelectedQuestionTypes()
509 $this->
ctrl->setParameterByClass(
510 $this->
ctrl->getCmdClass(),
512 $this->request->getNewForSurvey()
514 $this->
ctrl->redirectByClass($this->
ctrl->getCmdClass(),
"editQuestion");
static redirect(string $a_script)
◆ renderStatisticsDetailsTable()
| SurveyQuestionGUI::renderStatisticsDetailsTable |
( |
array |
$a_head, |
|
|
array |
$a_rows, |
|
|
array |
$a_foot = null |
|
) |
| |
|
protected |
Definition at line 631 of file class.SurveyQuestionGUI.php.
637 $html[] =
'<div class="ilTableOuter table-responsive">';
638 $html[] =
'<table class="table table-striped">';
642 foreach ($a_head as $col) {
645 $html[] = ($col !=
"") ? $col :
" ";
649 $html[] =
"</thead>";
652 foreach ($a_rows as $row) {
654 foreach ($row as $col) {
657 $html[] = ($col !=
"") ? $col :
" ";
662 $html[] =
"</tbody>";
667 foreach ($a_foot as $col) {
670 $html[] = ($col !=
"") ? $col :
" ";
674 $html[] =
"</tfoot>";
677 $html[] =
"</table>";
679 return implode(
"\n", $html);
◆ save()
| SurveyQuestionGUI::save |
( |
bool |
$a_return = false, |
|
|
bool |
$a_sync = false |
|
) |
| |
|
protected |
Definition at line 345 of file class.SurveyQuestionGUI.php.
References $user, SurveyQuestion\_isComplete(), SurveyQuestion\_isWriteable(), SurveyQuestion\_questionExists(), ILIAS\Repository\ctrl(), editQuestion(), ILIAS\Repository\lng(), ILIAS\Repository\object(), redirectAfterSaving(), and saveForm().
Referenced by saveReturn(), and saveSync().
355 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"survey_error_insert_incomplete_question"));
360 $ilUser->setPref(
"svy_lastquestiontype", $this->
object->getQuestionType());
361 $ilUser->writePref(
"svy_lastquestiontype", $this->
object->getQuestionType());
364 $this->
ctrl->setParameter($this,
"q_id", $this->
object->getId());
368 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
369 $this->
ctrl->redirect($this,
'copySyncForm');
370 } elseif ($originalexists &&
374 $this->
ctrl->setParameter($this,
'rtrn', 1);
376 $this->
ctrl->redirect($this,
'originalSyncForm');
379 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
static _isWriteable(int $question_id, int $user_id)
is question writeable by a certain user
static _isComplete(int $question_id)
Checks whether the question is complete or not.
redirectAfterSaving(bool $a_return=false)
Redirect to calling survey or to edit form.
editQuestion(ilPropertyFormGUI $a_form=null)
static _questionExists(int $question_id)
◆ saveForm()
| SurveyQuestionGUI::saveForm |
( |
| ) |
|
|
protected |
Definition at line 321 of file class.SurveyQuestionGUI.php.
References editQuestion(), importEditFormValues(), initEditForm(), and validateEditForm().
Referenced by save().
325 $this->
object->setTitle($form->getInput(
"title"));
326 $this->
object->label = ($form->getInput(
"label"));
327 $this->
object->setAuthor($form->getInput(
"author"));
328 $this->
object->setDescription($form->getInput(
"description"));
329 $this->
object->setQuestiontext($form->getInput(
"question"));
330 $this->
object->setObligatory($form->getInput(
"obligatory"));
335 $this->
object->saveToDb();
340 $form->setValuesByPost();
validateEditForm(ilPropertyFormGUI $a_form)
importEditFormValues(ilPropertyFormGUI $a_form)
editQuestion(ilPropertyFormGUI $a_form=null)
◆ saveReturn()
| SurveyQuestionGUI::saveReturn |
( |
| ) |
|
|
protected |
◆ saveSync()
| SurveyQuestionGUI::saveSync |
( |
| ) |
|
|
protected |
◆ setBackUrl()
| SurveyQuestionGUI::setBackUrl |
( |
string |
$a_url | ) |
|
◆ setQuestionTabs()
| SurveyQuestionGUI::setQuestionTabs |
( |
| ) |
|
|
abstract |
◆ setQuestionTabsForClass()
| SurveyQuestionGUI::setQuestionTabsForClass |
( |
string |
$guiclass | ) |
|
Definition at line 163 of file class.SurveyQuestionGUI.php.
References $rbacsystem, $tabs, ilRbacSystem\checkAccess(), ILIAS\Repository\ctrl(), getQuestionType(), ILIAS\Repository\lng(), and ILIAS\Repository\object().
Referenced by SurveyMatrixQuestionGUI\setQuestionTabs(), SurveyMultipleChoiceQuestionGUI\setQuestionTabs(), SurveyMetricQuestionGUI\setQuestionTabs(), SurveyTextQuestionGUI\setQuestionTabs(), and SurveySingleChoiceQuestionGUI\setQuestionTabs().
168 $this->
ctrl->setParameterByClass($guiclass,
"sel_question_types", $this->
getQuestionType());
169 $this->
ctrl->setParameterByClass(
172 $this->request->getQuestionId()
175 if ($this->parent_url) {
177 if ($this->request->getNewForSurvey() > 0) {
178 $addurl =
"&new_id=" . $this->request->getQuestionId();
180 $ilTabs->setBackTarget($this->
lng->txt(
"menubacktosurvey"), $this->parent_url . $addurl);
182 $ilTabs->setBackTarget($this->
lng->txt(
"spl"), $this->
ctrl->getLinkTargetByClass(
"ilObjSurveyQuestionPoolGUI",
"questions"));
184 if ($this->request->getQuestionId()) {
185 $ilTabs->addNonTabbedLink(
187 $this->
lng->txt(
"preview"),
188 $this->
ctrl->getLinkTargetByClass($guiclass,
"preview")
195 $this->
lng->txt(
"properties"),
196 $this->
ctrl->getLinkTargetByClass($guiclass,
"editQuestion")
199 if (stripos($guiclass,
"matrix") !==
false) {
202 $this->
lng->txt(
"layout"),
203 $this->
ctrl->getLinkTargetByClass($guiclass,
"layout")
208 if ($this->
object->getId() > 0) {
209 $title = $this->
lng->txt(
"edit") .
" "" . $this->
object->getTitle() .
""";
214 $this->tpl->setVariable(
"HEADER", $title);
getQuestionType()
Returns the question type string.
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
◆ sync()
| SurveyQuestionGUI::sync |
( |
| ) |
|
|
protected |
Definition at line 459 of file class.SurveyQuestionGUI.php.
References ILIAS\Repository\lng(), and redirectAfterSaving().
461 $original_id = $this->
object->original_id;
463 $this->
object->syncWithOriginal();
466 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
redirectAfterSaving(bool $a_return=false)
Redirect to calling survey or to edit form.
◆ syncCopies()
| SurveyQuestionGUI::syncCopies |
( |
| ) |
|
|
protected |
Definition at line 395 of file class.SurveyQuestionGUI.php.
References $access, $id, $lng, $ref_id, ilObject\_getAllReferences(), copySyncForm(), ILIAS\Repository\object(), redirectAfterSaving(), and ilLanguage\txt().
400 $qids = $this->request->getQuestionIds();
401 if (count($qids) === 0) {
402 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"select_one"));
407 foreach ($this->
object->getCopyIds(
true) as $survey_id => $questions) {
411 foreach ($ref_ids as
$ref_id) {
412 if ($ilAccess->checkAccess(
"edit",
"", $ref_id)) {
419 foreach ($questions as $qid) {
420 if (in_array($qid, $qids)) {
421 $id = $this->
object->getId();
423 $this->
object->setId($qid);
424 $this->
object->setOriginalId(
$id);
425 $this->
object->saveToDb();
427 $this->
object->setId(
$id);
428 $this->
object->setOriginalId(null);
437 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"survey_sync_success"),
true);
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _getAllReferences(int $id)
get all reference ids for object ID
redirectAfterSaving(bool $a_return=false)
Redirect to calling survey or to edit form.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
◆ validateEditForm()
◆ $access
◆ $ctrl
| ilCtrl SurveyQuestionGUI::$ctrl |
|
protected |
◆ $cumulated
| array SurveyQuestionGUI::$cumulated = [] |
|
protected |
◆ $edit_manager
◆ $gui
| ILIAS Survey InternalGUIService SurveyQuestionGUI::$gui |
|
protected |
◆ $lng
◆ $log
◆ $object
◆ $parent_url
| string SurveyQuestionGUI::$parent_url = "" |
|
protected |
◆ $rbacsystem
◆ $request
◆ $tabs
◆ $toolbar
◆ $tpl
◆ $tree
| ilTree SurveyQuestionGUI::$tree |
|
protected |
◆ $user
The documentation for this class was generated from the following file: