ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SurveyMetricQuestionGUI Class Reference

Metric survey question GUI representation. More...

+ Inheritance diagram for SurveyMetricQuestionGUI:
+ Collaboration diagram for SurveyMetricQuestionGUI:

Public Member Functions

 setQuestionTabs ()
 
 getParsedAnswers (array $a_working_data=null, $a_only_user_anwers=false)
 
 getPrintView ($question_title=1, $show_questiontext=1, $survey_id=null, array $a_working_data=null)
 Creates a HTML representation of the question. More...
 
 getWorkingForm ($working_data="", $question_title=1, $show_questiontext=1, $error_message="", $survey_id=null)
 Creates the question output form for the learner. More...
 
- Public Member Functions inherited from SurveyQuestionGUI
 __construct ($a_id=-1)
 
 setQuestionTabs ()
 
executeCommand ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 setBackUrl ($a_url)
 
 setQuestionTabsForClass ($guiclass)
 
 getPrintView ($question_title=1, $show_questiontext=1)
 
 preview ()
 Creates a preview of the question. More...
 
 getWorkingForm ($working_data="", $question_title=1, $show_questiontext=1, $error_message="", $survey_id=null)
 
 material ($checkonly=false)
 Material tab of the survey questions. More...
 
 deleteMaterial ()
 
 addMaterial ()
 Add materials to a question. More...
 
 removeMaterial ()
 
 cancelExplorer ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 linkChilds ()
 
 savePhrase ($a_reload=false)
 Creates an output to save the current answers as a phrase. More...
 
 confirmSavePhrase ()
 Save a new phrase to the database. More...
 

Protected Member Functions

 initObject ()
 
 addFieldsToEditForm (ilPropertyFormGUI $a_form)
 
 importEditFormValues (ilPropertyFormGUI $a_form)
 
- Protected Member Functions inherited from SurveyQuestionGUI
 initObject ()
 
 outQuestionText ($template)
 
 initEditForm ()
 
 addCommandButtons ($a_form)
 
 editQuestion (ilPropertyFormGUI $a_form=null)
 
 saveSync ()
 
 saveReturn ()
 
 saveForm ()
 
 save ($a_return=false, $a_sync=false)
 
 copySyncForm ()
 
 syncCopies ()
 
 originalSyncForm ()
 
 sync ()
 
 cancelSync ()
 
 redirectAfterSaving ($a_return=false)
 Redirect to calling survey or to edit form. More...
 
 cancel ()
 
 validateEditForm (ilPropertyFormGUI $a_form)
 
 addFieldsToEditForm (ilPropertyFormGUI $a_form)
 
 importEditFormValues (ilPropertyFormGUI $a_form)
 
 getPrintViewQuestionTitle ($question_title=1)
 
 getMaterialOutput ()
 Creates the HTML output of the question material(s) More...
 
 initPhrasesForm ()
 
 addPhrase (ilPropertyFormGUI $a_form=null)
 Creates an output for the addition of phrases. More...
 
 addSelectedPhrase ()
 
 renderStatisticsDetailsTable (array $a_head, array $a_rows, array $a_foot=null)
 

Additional Inherited Members

- Static Public Member Functions inherited from SurveyQuestionGUI
static _getQuestionGUI ($questiontype, $question_id=-1)
 Creates a question gui representation. More...
 
static _getGUIClassNameForId ($a_q_id)
 
static _getClassNameForQType ($q_type)
 
- Data Fields inherited from SurveyQuestionGUI
 $object
 
- Protected Attributes inherited from SurveyQuestionGUI
 $rbacsystem
 
 $user
 
 $access
 
 $tree
 
 $toolbar
 
 $tabs
 
 $tpl
 
 $lng
 
 $ctrl
 
 $cumulated
 
 $parent_url
 
 $log
 

Detailed Description

Metric survey question GUI representation.

The SurveyMetricQuestionGUI class encapsulates the GUI representation for metric survey question types.

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
Version
$Id$

Definition at line 37 of file class.SurveyMetricQuestionGUI.php.

Member Function Documentation

◆ addFieldsToEditForm()

SurveyMetricQuestionGUI::addFieldsToEditForm ( ilPropertyFormGUI  $a_form)
protected

Definition at line 55 of file class.SurveyMetricQuestionGUI.php.

References ilPropertyFormGUI\addItem(), object, ilNumberInputGUI\setDecimals(), ilFormPropertyGUI\setRequired(), SurveyMetricQuestion\SUBTYPE_NON_RATIO, SurveyMetricQuestion\SUBTYPE_RATIO_ABSOLUTE, and SurveyMetricQuestion\SUBTYPE_RATIO_NON_ABSOLUTE.

56  {
57  // subtype
58  $subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type");
59  $subtype->setRequired(true);
60  $a_form->addItem($subtype);
61 
62  // #10652
63  $opt = new ilRadioOption($this->lng->txt('non_ratio'), SurveyMetricQuestion::SUBTYPE_NON_RATIO, $this->lng->txt("metric_subtype_description_interval"));
64  $subtype->addOption($opt);
65 
66  // minimum value
67  $minimum1 = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum3");
68  $minimum1->setRequired(false);
69  $minimum1->setSize(6);
70  $opt->addSubItem($minimum1);
71 
72  // maximum value
73  $maximum1 = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum3");
74  $maximum1->setRequired(false);
75  $maximum1->setSize(6);
76  $opt->addSubItem($maximum1);
77 
78  $opt = new ilRadioOption($this->lng->txt('ratio_non_absolute'), SurveyMetricQuestion::SUBTYPE_RATIO_NON_ABSOLUTE, $this->lng->txt("metric_subtype_description_rationonabsolute"));
79  $subtype->addOption($opt);
80 
81  // minimum value
82  $minimum2 = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum4");
83  $minimum2->setRequired(false);
84  $minimum2->setSize(6);
85  $minimum2->setMinValue(0);
86  $opt->addSubItem($minimum2);
87 
88  // maximum value
89  $maximum2 = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum4");
90  $maximum2->setRequired(false);
91  $maximum2->setSize(6);
92  $opt->addSubItem($maximum2);
93 
94  $opt = new ilRadioOption($this->lng->txt('ratio_absolute'), SurveyMetricQuestion::SUBTYPE_RATIO_ABSOLUTE, $this->lng->txt("metric_subtype_description_ratioabsolute"));
95  $subtype->addOption($opt);
96 
97  // minimum value
98  $minimum3 = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum5");
99  $minimum3->setRequired(false);
100  $minimum3->setSize(6);
101  $minimum3->setMinValue(0);
102  $minimum3->setDecimals(0);
103  $opt->addSubItem($minimum3);
104 
105  // maximum value
106  $maximum3 = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum5");
107  $maximum3->setDecimals(0);
108  $maximum3->setRequired(false);
109  $maximum3->setSize(6);
110  $opt->addSubItem($maximum3);
111 
112 
113  // values
114  $subtype->setValue($this->object->getSubtype());
115 
116  switch ($this->object->getSubtype()) {
118  $minimum1->setValue($this->object->getMinimum());
119  $maximum1->setValue($this->object->getMaximum());
120  break;
121 
123  $minimum2->setValue($this->object->getMinimum());
124  $maximum2->setValue($this->object->getMaximum());
125  break;
126 
128  $minimum3->setValue($this->object->getMinimum());
129  $maximum3->setValue($this->object->getMaximum());
130  break;
131  }
132  }
This class represents an option in a radio group.
addItem($a_item)
Add Item (Property, SectionHeader).
setDecimals($a_decimals)
Set Decimal Places.
This class represents a property in a property form.
This class represents a number property in a property form.
Create new PHPExcel object
obj_idprivate
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:

◆ getParsedAnswers()

SurveyMetricQuestionGUI::getParsedAnswers ( array  $a_working_data = null,
  $a_only_user_anwers = false 
)

Definition at line 143 of file class.SurveyMetricQuestionGUI.php.

References $res, and array.

Referenced by getPrintView().

144  {
145  $res = array();
146 
147  if (is_array($a_working_data)) {
148  $res[] = array("value" => $a_working_data[0]["value"]);
149  }
150 
151  return $res;
152  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getPrintView()

SurveyMetricQuestionGUI::getPrintView (   $question_title = 1,
  $show_questiontext = 1,
  $survey_id = null,
array  $a_working_data = null 
)

Creates a HTML representation of the question.

Creates a HTML representation of the question

private

Definition at line 161 of file class.SurveyMetricQuestionGUI.php.

References $i, $template, getParsedAnswers(), SurveyQuestionGUI\getPrintViewQuestionTitle(), object, and SurveyQuestionGUI\outQuestionText().

162  {
163  $user_answer = null;
164  if ($a_working_data) {
165  $user_answer = $this->getParsedAnswers($a_working_data);
166  $user_answer = $user_answer[0]["value"];
167  }
168 
169  $template = new ilTemplate("tpl.il_svy_qpl_metric_printview.html", true, true, "Modules/SurveyQuestionPool");
170  $template->setVariable("MIN_MAX", $this->object->getMinMaxText());
171 
172  if ($show_questiontext) {
173  $this->outQuestionText($template);
174  }
175  if ($question_title) {
176  $template->setVariable("QUESTION_TITLE", $this->getPrintViewQuestionTitle($question_title));
177  }
178  $template->setVariable("TEXT_ANSWER", $this->lng->txt("answer"));
179  $template->setVariable("QUESTION_ID", $this->object->getId());
180 
181  if (!is_array($a_working_data) || !trim($user_answer)) {
182  $solution_text = "";
183  $len = 10;
184  for ($i = 0; $i < 10; $i++) {
185  $solution_text .= "&#160;";
186  }
187  } else {
188  $solution_text = $user_answer;
189  }
190  $template->setVariable("TEXT_SOLUTION", $solution_text);
191 
192  $template->parseCurrentBlock();
193  return $template->get();
194  }
$template
special template class to simplify handling of ITX/PEAR
getParsedAnswers(array $a_working_data=null, $a_only_user_anwers=false)
Create new PHPExcel object
obj_idprivate
$i
Definition: disco.tpl.php:19
getPrintViewQuestionTitle($question_title=1)
+ Here is the call graph for this function:

◆ getWorkingForm()

SurveyMetricQuestionGUI::getWorkingForm (   $working_data = "",
  $question_title = 1,
  $show_questiontext = 1,
  $error_message = "",
  $survey_id = null 
)

Creates the question output form for the learner.

Creates the question output form for the learner

public

Definition at line 208 of file class.SurveyMetricQuestionGUI.php.

References $template, SurveyQuestionGUI\getMaterialOutput(), object, and SurveyQuestionGUI\outQuestionText().

209  {
210  $template = new ilTemplate("tpl.il_svy_out_metric.html", true, true, "Modules/SurveyQuestionPool");
211  $template->setCurrentBlock("material_metric");
212  $template->setVariable("TEXT_MATERIAL", $this->getMaterialOutput());
213  $template->parseCurrentBlock();
214  $template->setVariable("MIN_MAX", $this->object->getMinMaxText());
215  /*if (strlen($this->object->getMinimum()))
216  {
217  $template->setCurrentBlock("minimum");
218  $template->setVariable("TEXT_MINIMUM", $this->lng->txt("minimum"));
219  $template->setVariable("VALUE_MINIMUM", $this->object->getMinimum());
220  $template->parseCurrentBlock();
221  }
222  if (strlen($this->object->getMaximum()))
223  {
224  $template->setCurrentBlock("maximum");
225  $template->setVariable("TEXT_MAXIMUM", $this->lng->txt("maximum"));
226  $template->setVariable("VALUE_MAXIMUM", $this->object->getMaximum());
227  $template->parseCurrentBlock();
228  }*/
229 
230  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
231  if ($show_questiontext) {
232  $this->outQuestionText($template);
233  }
234  if ($question_title) {
235  $template->setVariable("QUESTION_TITLE", $this->object->getTitle());
236  }
237  $template->setVariable("TEXT_ANSWER", $this->lng->txt("answer"));
238  $template->setVariable("QUESTION_ID", $this->object->getId());
239  if (is_array($working_data)) {
240  $template->setVariable("VALUE_METRIC", $working_data[0]["value"]);
241  }
242 
243  $template->setVariable("INPUT_SIZE", 10);
244 
245  if (strcmp($error_message, "") != 0) {
246  $template->setVariable("ERROR_MESSAGE", "<p class=\"warning\">$error_message</p>");
247  }
248  $template->parseCurrentBlock();
249  return $template->get();
250  }
getMaterialOutput()
Creates the HTML output of the question material(s)
$template
special template class to simplify handling of ITX/PEAR
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ importEditFormValues()

SurveyMetricQuestionGUI::importEditFormValues ( ilPropertyFormGUI  $a_form)
protected

Definition at line 134 of file class.SurveyMetricQuestionGUI.php.

References $type, and ilPropertyFormGUI\getInput().

135  {
136  $type = (int) $a_form->getInput("type");
137  $this->object->setOrientation($a_form->getInput("orientation"));
138  $this->object->setSubtype($type);
139  $this->object->setMinimum($a_form->getInput("minimum" . $type));
140  $this->object->setMaximum($a_form->getInput("maximum" . $type));
141  }
$type
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
+ Here is the call graph for this function:

◆ initObject()

SurveyMetricQuestionGUI::initObject ( )
protected

Definition at line 39 of file class.SurveyMetricQuestionGUI.php.

40  {
41  include_once "./Modules/SurveyQuestionPool/classes/class.SurveyMetricQuestion.php";
42  $this->object = new SurveyMetricQuestion();
43  }
Metric survey question.

◆ setQuestionTabs()

SurveyMetricQuestionGUI::setQuestionTabs ( )

Definition at line 50 of file class.SurveyMetricQuestionGUI.php.

References SurveyQuestionGUI\setQuestionTabsForClass().

51  {
52  $this->setQuestionTabsForClass("surveymetricquestiongui");
53  }
+ Here is the call graph for this function:

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