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

Text survey question GUI representation. More...

+ Inheritance diagram for SurveyTextQuestionGUI:
+ Collaboration diagram for SurveyTextQuestionGUI:

Public Member Functions

 setQuestionTabs ()
 getPrintView ($question_title=1, $show_questiontext=1, $survey_id=null)
 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)
- 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)
 renderChart ($a_id, $a_variables)
 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

Text survey question GUI representation.

The SurveyTextQuestionGUI class encapsulates the GUI representation for text 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.SurveyTextQuestionGUI.php 43730 2013-07-29 13:59:58Z jluetzen

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

Member Function Documentation

SurveyTextQuestionGUI::addFieldsToEditForm ( ilPropertyFormGUI  $a_form)
protected

Reimplemented from SurveyQuestionGUI.

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

References ilPropertyFormGUI\addItem(), and ilFormPropertyGUI\setRequired().

{
// maximum number of characters
$maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars");
$maxchars->setRequired(false);
$maxchars->setSize(5);
$maxchars->setDecimals(0);
$a_form->addItem($maxchars);
// textwidth
$textwidth = new ilNumberInputGUI($this->lng->txt("width"), "textwidth");
$textwidth->setRequired(true);
$textwidth->setSize(3);
$textwidth->setDecimals(0);
$textwidth->setMinValue(10);
$a_form->addItem($textwidth);
// textheight
$textheight = new ilNumberInputGUI($this->lng->txt("height"), "textheight");
$textheight->setRequired(true);
$textheight->setSize(3);
$textheight->setDecimals(0);
$textheight->setMinValue(1);
$a_form->addItem($textheight);
// values
if ($this->object->getMaxChars() > 0)
{
$maxchars->setValue($this->object->getMaxChars());
}
$textwidth->setValue($this->object->getTextWidth());
$textheight->setValue($this->object->getTextHeight());
}

+ Here is the call graph for this function:

SurveyTextQuestionGUI::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 203 of file class.SurveyTextQuestionGUI.php.

References ilObjSurvey\_getNrOfParticipants().

{
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("given_answers"));
$textvalues = "";
if (is_array($this->cumulated["textvalues"]))
{
foreach ($this->cumulated["textvalues"] as $textvalue)
{
$textvalues .= "<li>" . preg_replace("/\n/", "<br>", $textvalue) . "</li>";
}
}
$textvalues = "<ul>$textvalues</ul>";
$template->setVariable("TEXT_OPTION_VALUE", $textvalues);
$template->parseCurrentBlock();
$template->setVariable("QUESTION_TITLE", "$counter. ".$this->object->getTitle());
return $template->get();
}

+ Here is the call graph for this function:

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

Definition at line 98 of file class.SurveyTextQuestionGUI.php.

References ilUtil\getHtmlPath(), ilUtil\getImagePath(), and SurveyQuestionGUI\outQuestionText().

{
$template = new ilTemplate("tpl.il_svy_qpl_text_printview.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
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("TEXTBOX_IMAGE", ilUtil::getHtmlPath(ilUtil::getImagePath("textbox.png")));
$template->setVariable("TEXTBOX", $this->lng->txt("textbox"));
$template->setVariable("TEXTBOX_WIDTH", $this->object->getTextWidth()*16);
$template->setVariable("TEXTBOX_HEIGHT", $this->object->getTextHeight()*16);
$template->setVariable("QUESTION_ID", $this->object->getId());
if ($this->object->getMaxChars())
{
$template->setVariable("TEXT_MAXCHARS", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxChars()));
}
return $template->get();
}

+ Here is the call graph for this function:

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

Creates the question output form for the learner.

Reimplemented from SurveyQuestionGUI.

Definition at line 130 of file class.SurveyTextQuestionGUI.php.

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

{
$template = new ilTemplate("tpl.il_svy_out_text.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
$template->setCurrentBlock("material_text");
$template->setVariable("TEXT_MATERIAL", $this->getMaterialOutput());
$template->parseCurrentBlock();
if ($this->object->getTextHeight() == 1)
{
$template->setCurrentBlock("textinput");
if (is_array($working_data))
{
if (strlen($working_data[0]["textanswer"]))
{
$template->setVariable("VALUE_ANSWER", " value=\"" . ilUtil::prepareFormOutput($working_data[0]["textanswer"]) . "\"");
}
}
$template->setVariable("QUESTION_ID", $this->object->getId());
$template->setVariable("WIDTH", $this->object->getTextWidth());
if ($this->object->getMaxChars())
{
$template->setVariable("MAXLENGTH", " maxlength=\"" . $this->object->getMaxChars() . "\"");
}
$template->parseCurrentBlock();
}
else
{
$template->setCurrentBlock("textarea");
if (is_array($working_data))
{
$template->setVariable("VALUE_ANSWER", ilUtil::prepareFormOutput($working_data[0]["textanswer"]));
}
$template->setVariable("QUESTION_ID", $this->object->getId());
$template->setVariable("WIDTH", $this->object->getTextWidth());
$template->setVariable("HEIGHT", $this->object->getTextHeight());
$template->parseCurrentBlock();
}
$template->setCurrentBlock("question_data_text");
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("LABEL_QUESTION_ID", $this->object->getId());
if (strcmp($error_message, "") != 0)
{
$template->setVariable("ERROR_MESSAGE", "<p class=\"warning\">$error_message</p>");
}
if ($this->object->getMaxChars())
{
$template->setVariable("TEXT_MAXCHARS", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxChars()));
}
$template->parseCurrentBlock();
return $template->get();
}

+ Here is the call graph for this function:

SurveyTextQuestionGUI::importEditFormValues ( ilPropertyFormGUI  $a_form)
protected

Reimplemented from SurveyQuestionGUI.

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

References ilPropertyFormGUI\getInput().

{
$max = $a_form->getInput("maxchars");
$this->object->setMaxChars(strlen($max) ? $max : null);
$this->object->setTextWidth($a_form->getInput("textwidth"));
$this->object->setTextHeight($a_form->getInput("textheight"));
}

+ Here is the call graph for this function:

SurveyTextQuestionGUI::initObject ( )
protected

Reimplemented from SurveyQuestionGUI.

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

{
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyTextQuestion.php";
$this->object = new SurveyTextQuestion();
}
SurveyTextQuestionGUI::setQuestionTabs ( )

Reimplemented from SurveyQuestionGUI.

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

References SurveyQuestionGUI\setQuestionTabsForClass().

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

+ Here is the call graph for this function:


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