CMS  Version 3.9
ShortTextView Class Reference
+ Inheritance diagram for ShortTextView:
+ Collaboration diagram for ShortTextView:

Public Member Functions

 ShortTextView ($parent, $question)
 
 writeHTML ()
 
 drawView ()
 
 writeScript ()
 
 drawGraph ($mgr, $answers)
 There is no graphical display for free text questions so just display the answers as a list. More...
 
- Public Member Functions inherited from QuestionField
 QuestionField ($parent, $question)
 
 getID ()
 
 drawGraph ()
 
 drawSummaryView ()
 
 getAnswer ()
 
 getSpreadsheetAnswer ()
 
 getOptionAnswer ()
 
 writeLimitScript ()
 
 renderLimitEnd ($limit, $field, $value)
 
 getRequired ()
 
 getRequiredValidator ()
 

Additional Inherited Members

- Static Public Member Functions inherited from QuestionField
static create ($parent, $question)
 
- Public Attributes inherited from QuestionField
 $parent
 The parent QuestionForm obj. More...
 
 $question
 The question renderer obj. More...
 
 $readonly
 Whether the questions should be drawn readonly. More...
 
 $answer
 The answer to the question obj. More...
 
 $answerSeparator = "<br>"
 for list of answers in checklist renderer More...
 

Detailed Description

Definition at line 509 of file question_renderer.inc.

Member Function Documentation

◆ drawGraph()

ShortTextView::drawGraph (   $mgr,
  $answers 
)

There is no graphical display for free text questions so just display the answers as a list.

Parameters
obj$mgr- object of the Survey/Questionnaire Results manager class
Array$answers- all survey or questionnaire answers to this question

Definition at line 564 of file question_renderer.inc.

565  {
566  $pk = $this->question->getPrimaryKey();
567  echo "<ul>\n";
568 
569  foreach($answers as $answer)
570  {
571  if ($answer->value)
572  {
573  echo "<li>" . formatAsHTML(stripHTML($answer->value)) . "</li>\n";
574  }
575  }
576  echo "</ul>\n";
577  }
$answer
The answer to the question obj.
$answers

◆ drawView()

ShortTextView::drawView ( )

Definition at line 545 of file question_renderer.inc.

546  {
547  $value = $this->parent->getAnswer($this->question);
548  echo "<em>".htmlsafe($value)."</em>";
549  }

◆ ShortTextView()

ShortTextView::ShortTextView (   $parent,
  $question 
)

Definition at line 511 of file question_renderer.inc.

512  {
514  }
QuestionField($parent, $question)
$question
The question renderer obj.
$parent
The parent QuestionForm obj.

◆ writeHTML()

ShortTextView::writeHTML ( )

Reimplemented from QuestionField.

Definition at line 516 of file question_renderer.inc.

517  {
518  $value = $this->parent->getAnswer($this->question);
519  $readonly = $this->parent->readOnlyForm ? " readonly='readonly'": "";
520  $autocomplete = "autocomplete='off'";
521 
522  $pk = $this->question->getPrimaryKey();
523 
524  $field = "question_" . $this->question->$pk;
525 
526  if ($this->question->char_limit)
527  {
528  $onkeypress = " onkeyup='{$field}_keyup(event);'";
529  }
530 
531  $tip = $this->question->context_help;
532  if ($tip)
533  {
534  $tip = " onmouseover=\"showTextToolTip('question_{$this->question->$pk}', event, 'question_help', '".jsSafe($tip)."'); return false;\" onmouseout=\"hideToolTip('question_help');return false\" ";
535  }
536 
537  echo "<input id='$field' type='text' name='$field' $readonly $autocomplete value='".htmlspecialchars($value, ENT_QUOTES, 'UTF-8')."' size='50' $disable $onkeypress $tip/>";
538  echo "<br/><div style='clear: left; float: right'><span id='{$field}_length'>";
539 
540  parent::renderLimitEnd($this->question->char_limit, $field, $value);
541  echo "</div>";
542 
543  }
$readonly
Whether the questions should be drawn readonly.

◆ writeScript()

ShortTextView::writeScript ( )

Reimplemented from QuestionField.

Definition at line 551 of file question_renderer.inc.

552  {
553  return parent::writeLimitScript();
554  }

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