ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilScaleInputGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Form/classes/class.ilTextInputGUI.php");
5 
14 {
15  private $scale;
16  private $scale_disabled;
17  private $scale_stylecss;
18 
25  function __construct($a_title = "", $a_postvar = "")
26  {
27  parent::__construct($a_title, $a_postvar);
28  $this->scale_disabled = true;
29  $this->scale_stylecss = 'text-align: right;';
30  }
31 
37  function setScaleInlineStyle($a_value)
38  {
39  $this->scale_stylecss = $a_value;
40  }
41 
48  {
49  return $this->scale_stylecss;
50  }
51 
57  function setScaleDisabled($a_value)
58  {
59  $this->scale_disabled = $a_value;
60  }
61 
67  function getScaleDisabled()
68  {
69  return $this->scale_disabled;
70  }
71 
77  function setScale($a_value)
78  {
79  $this->scale = $a_value;
80  }
81 
87  function getScale()
88  {
89  return $this->scale;
90  }
91 
92 
96  protected function render($a_mode = "")
97  {
98  $tpl = new ilTemplate("tpl.prop.scaleinput.html", true, true, "Modules/SurveyQuestionPool");
99  if (strlen($this->getValue()))
100  {
101  $tpl->setCurrentBlock("prop_text_propval");
102  $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($this->getValue()));
103  $tpl->parseCurrentBlock();
104  }
105  if (strlen($this->getScale()))
106  {
107  $tpl->setCurrentBlock("prop_text_scale");
108  $tpl->setVariable("SCALE_VALUE", ilUtil::prepareFormOutput($this->getScale()));
109  $tpl->parseCurrentBlock();
110  }
111  if (strlen($this->getInlineStyle()))
112  {
113  $tpl->setCurrentBlock("stylecss");
114  $tpl->setVariable("CSS_STYLE", ilUtil::prepareFormOutput($this->getInlineStyle()));
115  $tpl->parseCurrentBlock();
116  }
117  if (strlen($this->getScaleInlineStyle()))
118  {
119  $tpl->setCurrentBlock("scale_stylecss");
120  $tpl->setVariable("CSS_STYLE", ilUtil::prepareFormOutput($this->getScaleInlineStyle()));
121  $tpl->parseCurrentBlock();
122  }
123 
124  $tpl->setVariable("ID", $this->getFieldId());
125  $tpl->setVariable("SIZE", $this->getSize());
126  $tpl->setVariable("MAXLENGTH", $this->getMaxLength());
127  if (strlen($this->getSuffix())) $tpl->setVariable("INPUT_SUFFIX", $this->getSuffix());
128 
129  if ($this->getDisabled())
130  {
131  $tpl->setVariable("DISABLED", " disabled=\"disabled\"");
132  }
133  if ($this->getScaleDisabled())
134  {
135  $tpl->setVariable("SCALE_DISABLED", " disabled=\"disabled\"");
136  }
137  $tpl->setVariable("POST_VAR", $this->getPostVar());
138 
139  return $tpl->get();
140  }
141 }
142 ?>