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

Public Member Functions

 FreeTextView ($parent, $question)
 
 writeScript ()
 
 writeHTML ()
 
 drawView ()
 
 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 580 of file question_renderer.inc.

Member Function Documentation

◆ drawGraph()

FreeTextView::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 652 of file question_renderer.inc.

653  {
654  $pk = $this->question->getPrimaryKey();
655  echo "<ul>\n";
656 
657  foreach($answers as $answer)
658  {
659  if ($answer->value)
660  {
661  echo "<li>" . formatAsHTML(stripHTML($answer->value)) . "</li>\n";
662  }
663  }
664  echo "</ul>\n";
665  }
$answer
The answer to the question obj.
$answers

◆ drawView()

FreeTextView::drawView ( )

Definition at line 628 of file question_renderer.inc.

629  {
630  $value = $this->parent->getAnswer($this->question);
631 
632  /* JDG 2/9/10, htmlsafe makes some text with bad characters
633  * disappear
634  */
635 
636  $answerVal = htmlsafe($value);
637  if(!$answerVal)
638  $answerVal = formatAsHTML($value);
639 
640  echo "<em>".$answerVal."</em>";
641  }

◆ FreeTextView()

FreeTextView::FreeTextView (   $parent,
  $question 
)

Definition at line 583 of file question_renderer.inc.

584  {
586  }
QuestionField($parent, $question)
$question
The question renderer obj.
$parent
The parent QuestionForm obj.

◆ writeHTML()

FreeTextView::writeHTML ( )

Reimplemented from QuestionField.

Definition at line 594 of file question_renderer.inc.

595  {
596  $pk = $this->question->getPrimaryKey();
597  $field = "question_{$this->question->$pk}";
598 
599  $rows = ($this->question->num_rows) ? $this->question->num_rows : 6;
600 
601  echo "<div>";
602  if ($this->question->char_limit)
603  {
604  $onkeypress = " onkeyup='{$field}_keyup(event);'";
605  }
606 
607  $value = $this->parent->getAnswer($this->question);
608 
609  $readonly = $this->parent->readOnlyForm ? " readonly='readonly'": "";
610  $autocomplete = "autocomplete='off'";
611 
612  $tip = $this->question->context_help;
613  if ($tip)
614  {
615  $tip = " onmouseover=\"showTextToolTip('question_{$this->question->$pk}', event, 'question_help', '".jsSafe($tip)."'); return false;\" onmouseout=\"hideToolTip('question_help');return false\" ";
616  }
617 
618  echo "<textarea name='{$field}' cols='75' rows='$rows' $onkeypress $readonly $autocomplete $tip>".htmlsafe($value)."</textarea>";
619 
620  echo "<br/><div style='clear: left; float: right'><span id='{$field}_length'>";
621 
622  parent::renderLimitEnd($this->question->char_limit, $field, $value);
623 
624  echo "</div></div>";
625 
626  }
$readonly
Whether the questions should be drawn readonly.
if( $method=="POST")

◆ writeScript()

FreeTextView::writeScript ( )

Reimplemented from QuestionField.

Definition at line 588 of file question_renderer.inc.

589  {
590  return parent::writeLimitScript();
591  }

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