ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
SurveyMetricQuestionGUI Class Reference

Metric survey question GUI representation. More...

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

Public Member Functions

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

Protected Member Functions

 initObject ()
 addFieldsToEditForm (ilPropertyFormGUI $a_form)
 importEditFormValues (ilPropertyFormGUI $a_form)
 renderChart ($a_id, $a_values)
- Protected Member Functions inherited from SurveyQuestionGUI
 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.
 cancel ()
 validateEditForm (ilPropertyFormGUI $a_form)
 getMaterialOutput ()
 Creates the HTML output of the question material(s)
 initPhrasesForm ()
 addPhrase (ilPropertyFormGUI $a_form=null)
 Creates an output for the addition of phrases.
 addSelectedPhrase ()

Additional Inherited Members

- Static Public Member Functions inherited from SurveyQuestionGUI
static & _getQuestionGUI ($questiontype, $question_id=-1)
 Creates a question gui representation.
- Data Fields inherited from SurveyQuestionGUI
 $object
- Protected Attributes inherited from SurveyQuestionGUI
 $tpl
 $lng
 $ctrl
 $cumulated
 $parent_url

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:
class.SurveyMetricQuestionGUI.php 43730 2013-07-29 13:59:58Z jluetzen

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

Member Function Documentation

SurveyMetricQuestionGUI::addFieldsToEditForm ( ilPropertyFormGUI  $a_form)
protected

Reimplemented from SurveyQuestionGUI.

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

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

{
// subtype
$subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type");
$subtype->setRequired(true);
$a_form->addItem($subtype);
// #10652
$opt = new ilRadioOption($this->lng->txt('non_ratio'), SurveyMetricQuestion::SUBTYPE_NON_RATIO, $this->lng->txt("metric_subtype_description_interval"));
$subtype->addOption($opt);
// minimum value
$minimum1 = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum3");
$minimum1->setRequired(false);
$minimum1->setSize(6);
$opt->addSubItem($minimum1);
// maximum value
$maximum1 = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum3");
$maximum1->setRequired(false);
$maximum1->setSize(6);
$opt->addSubItem($maximum1);
$opt = new ilRadioOption($this->lng->txt('ratio_non_absolute'), SurveyMetricQuestion::SUBTYPE_RATIO_NON_ABSOLUTE, $this->lng->txt("metric_subtype_description_rationonabsolute"));
$subtype->addOption($opt);
// minimum value
$minimum2 = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum4");
$minimum2->setRequired(false);
$minimum2->setSize(6);
$minimum2->setMinValue(0);
$opt->addSubItem($minimum2);
// maximum value
$maximum2 = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum4");
$maximum2->setRequired(false);
$maximum2->setSize(6);
$opt->addSubItem($maximum2);
$opt = new ilRadioOption($this->lng->txt('ratio_absolute'), SurveyMetricQuestion::SUBTYPE_RATIO_ABSOLUTE, $this->lng->txt("metric_subtype_description_ratioabsolute"));
$subtype->addOption($opt);
// minimum value
$minimum3 = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum5");
$minimum3->setRequired(false);
$minimum3->setSize(6);
$minimum3->setMinValue(0);
$minimum3->setDecimals(0);
$opt->addSubItem($minimum3);
// maximum value
$maximum3 = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum5");
$maximum3->setDecimals(0);
$maximum3->setRequired(false);
$maximum3->setSize(6);
$opt->addSubItem($maximum3);
// values
$subtype->setValue($this->object->getSubtype());
switch($this->object->getSubtype())
{
$minimum1->setValue($this->object->getMinimum());
$maximum1->setValue($this->object->getMaximum());
break;
$minimum2->setValue($this->object->getMinimum());
$maximum2->setValue($this->object->getMaximum());
break;
$minimum3->setValue($this->object->getMinimum());
$maximum3->setValue($this->object->getMaximum());
break;
}
}

+ Here is the call graph for this function:

SurveyMetricQuestionGUI::getCumulatedResultsDetails (   $survey_id,
  $counter,
  $finished_ids 
)

Creates the detailed output of the cumulated results for the question.

Parameters
integer$survey_idThe database ID of the survey
integer$counterThe counter of the question position in the survey
Returns
string HTML text with the cumulated results private

Reimplemented from SurveyQuestionGUI.

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

References ilObjSurvey\_getNrOfParticipants(), renderChart(), SurveyMetricQuestion\SUBTYPE_NON_RATIO, SurveyMetricQuestion\SUBTYPE_RATIO_ABSOLUTE, and SurveyMetricQuestion\SUBTYPE_RATIO_NON_ABSOLUTE.

{
if (count($this->cumulated) == 0)
{
if(!$finished_ids)
{
include_once "./Modules/Survey/classes/class.ilObjSurvey.php";
$nr_of_users = ilObjSurvey::_getNrOfParticipants($survey_id);
}
else
{
$nr_of_users = sizeof($finished_ids);
}
$this->cumulated =& $this->object->getCumulatedResults($survey_id, $nr_of_users, $finished_ids);
}
$output = "";
include_once "./Services/UICore/classes/class.ilTemplate.php";
$template = new ilTemplate("tpl.il_svy_svy_cumulated_results_detail.html", TRUE, TRUE, "Modules/Survey");
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("question"));
$questiontext = $this->object->getQuestiontext();
$template->setVariable("TEXT_OPTION_VALUE", $this->object->prepareTextareaOutput($questiontext, TRUE));
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("question_type"));
$template->setVariable("TEXT_OPTION_VALUE", $this->lng->txt($this->getQuestionType()));
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("users_answered"));
$template->setVariable("TEXT_OPTION_VALUE", $this->cumulated["USERS_ANSWERED"]);
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("users_skipped"));
$template->setVariable("TEXT_OPTION_VALUE", $this->cumulated["USERS_SKIPPED"]);
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("subtype"));
switch ($this->object->getSubType())
{
$template->setVariable("TEXT_OPTION_VALUE", $this->lng->txt("non_ratio"));
break;
$template->setVariable("TEXT_OPTION_VALUE", $this->lng->txt("ratio_non_absolute"));
break;
$template->setVariable("TEXT_OPTION_VALUE", $this->lng->txt("ratio_absolute"));
break;
}
$template->parseCurrentBlock();
/*
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("mode"));
$template->setVariable("TEXT_OPTION_VALUE", $this->cumulated["MODE"]);
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("mode_nr_of_selections"));
$template->setVariable("TEXT_OPTION_VALUE", $this->cumulated["MODE_NR_OF_SELECTIONS"]);
$template->parseCurrentBlock();
*/
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("median"));
$template->setVariable("TEXT_OPTION_VALUE", $this->cumulated["MEDIAN"]);
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("arithmetic_mean"));
$template->setVariable("TEXT_OPTION_VALUE", $this->cumulated["ARITHMETIC_MEAN"]);
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("values"));
$values = "";
if (is_array($this->cumulated["values"]))
{
foreach ($this->cumulated["values"] as $key => $value)
{
$values .= "<li>" . $value["value"] . ": n=" . $value["selected"] .
" (" . sprintf("%.2f", 100*$value["percentage"]) . "%)</li>";
}
}
$values = "<ol>$values</ol>";
$template->setVariable("TEXT_OPTION_VALUE", $values);
$template->parseCurrentBlock();
// chart
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("chart"));
$template->setVariable("TEXT_OPTION_VALUE", $this->renderChart("svy_ch_".$this->object->getId(), $this->cumulated["values"]));
$template->parseCurrentBlock();
$template->setVariable("QUESTION_TITLE", "$counter. ".$this->object->getTitle());
return $template->get();
}

+ Here is the call graph for this function:

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

Creates a HTML representation of the question.

Creates a HTML representation of the question

private

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

References SurveyQuestionGUI\outQuestionText().

{
$template = new ilTemplate("tpl.il_svy_qpl_metric_printview.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
$template->setVariable("MIN_MAX", $this->object->getMinMaxText());
$template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
if ($show_questiontext)
{
$this->outQuestionText($template);
}
if ($question_title)
{
$template->setVariable("QUESTION_TITLE", $this->object->getTitle());
}
$template->setVariable("TEXT_ANSWER", $this->lng->txt("answer"));
$template->setVariable("QUESTION_ID", $this->object->getId());
$solution_text = "";
$len = 10;
for ($i = 0; $i < 10; $i++) $solution_text .= "&#160;";
$template->setVariable("TEXT_SOLUTION", $solution_text);
$template->parseCurrentBlock();
return $template->get();
}

+ Here is the call graph for this function:

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

Reimplemented from SurveyQuestionGUI.

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

References SurveyQuestionGUI\getMaterialOutput(), and SurveyQuestionGUI\outQuestionText().

{
$template = new ilTemplate("tpl.il_svy_out_metric.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
$template->setCurrentBlock("material_metric");
$template->setVariable("TEXT_MATERIAL", $this->getMaterialOutput());
$template->parseCurrentBlock();
$template->setVariable("MIN_MAX", $this->object->getMinMaxText());
/*if (strlen($this->object->getMinimum()))
{
$template->setCurrentBlock("minimum");
$template->setVariable("TEXT_MINIMUM", $this->lng->txt("minimum"));
$template->setVariable("VALUE_MINIMUM", $this->object->getMinimum());
$template->parseCurrentBlock();
}
if (strlen($this->object->getMaximum()))
{
$template->setCurrentBlock("maximum");
$template->setVariable("TEXT_MAXIMUM", $this->lng->txt("maximum"));
$template->setVariable("VALUE_MAXIMUM", $this->object->getMaximum());
$template->parseCurrentBlock();
}*/
$template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
if ($show_questiontext)
{
$this->outQuestionText($template);
}
if ($question_title)
{
$template->setVariable("QUESTION_TITLE", $this->object->getTitle());
}
$template->setVariable("TEXT_ANSWER", $this->lng->txt("answer"));
$template->setVariable("QUESTION_ID", $this->object->getId());
if (is_array($working_data))
{
$template->setVariable("VALUE_METRIC", $working_data[0]["value"]);
}
$template->setVariable("INPUT_SIZE", 10);
if (strcmp($error_message, "") != 0)
{
$template->setVariable("ERROR_MESSAGE", "<p class=\"warning\">$error_message</p>");
}
$template->parseCurrentBlock();
return $template->get();
}

+ Here is the call graph for this function:

SurveyMetricQuestionGUI::importEditFormValues ( ilPropertyFormGUI  $a_form)
protected

Reimplemented from SurveyQuestionGUI.

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

References ilPropertyFormGUI\getInput().

{
$type = (int)$a_form->getInput("type");
$this->object->setOrientation($a_form->getInput("orientation"));
$this->object->setSubtype($type);
$this->object->setMinimum($a_form->getInput("minimum".$type));
$this->object->setMaximum($a_form->getInput("maximum".$type));
}

+ Here is the call graph for this function:

SurveyMetricQuestionGUI::initObject ( )
protected

Reimplemented from SurveyQuestionGUI.

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

{
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyMetricQuestion.php";
$this->object = new SurveyMetricQuestion();
}
SurveyMetricQuestionGUI::renderChart (   $a_id,
  $a_values 
)
protected

Reimplemented from SurveyQuestionGUI.

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

Referenced by getCumulatedResultsDetails().

{
include_once "Services/Chart/classes/class.ilChart.php";
$chart = new ilChart($a_id, 700, 400);
$legend = new ilChartLegend();
$chart->setLegend($legend);
$data = new ilChartData("bars");
$data->setLabel($this->lng->txt("users_answered"));
$data->setBarOptions(0.1, "center");
if($a_values)
{
$labels = array();
foreach($a_values as $idx => $answer)
{
$data->addPoint($answer["value"], $answer["selected"]);
$labels[$answer["value"]] = $answer["value"];
}
$chart->addData($data);
$chart->setTicks($labels, false, true);
}
return "<div style=\"margin:10px\">".$chart->getHTML()."</div>";
}

+ Here is the caller graph for this function:

SurveyMetricQuestionGUI::setQuestionTabs ( )

Reimplemented from SurveyQuestionGUI.

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

References SurveyQuestionGUI\setQuestionTabsForClass().

{
$this->setQuestionTabsForClass("surveymetricquestiongui");
}

+ Here is the call graph for this function:


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