Exemple #1
0
 /**
  * Renders the form controls (if not frozen) or read-only view (if frozen)
  * of the widget as html
  */
 public function render_html()
 {
     $output = "<label for=\"{$this->namespace}_{$this->main_input_name}\"><span>{$this->field['title']}</span>\n";
     $output .= "    <select id=\"{$this->namespace}_{$this->main_input_name}\" name=\"{$this->namespace}_{$this->main_input_name}\" size=\"{$this->height}\"";
     if ($this->type->allow_multiple) {
         $output .= ' multiple';
     }
     if ($this->frozen) {
         $output .= ' disabled="disabled"';
     }
     $output .= " >\n";
     // FIXME: for read-only etc mode load only the needed option
     $options = $this->type->list_all();
     foreach ($options as $value => $label) {
         $output .= "        <option value=" . midcom_helper_xsspreventer_helper::escape_attribute($value) . '>' . midcom_helper_xsspreventer_helper::escape_element('option', $label) . "</option>\n";
     }
     $output .= "    </select>\n";
     $output .= "</label>\n";
     if ($this->type->allow_other) {
         // FIXME: load info for other
         $othervalue = '';
         $output = "<label for=\"{$this->namespace}_other\"><span>{$this->field['title']}</span>\n";
         $output .= "    <input id=\"{$this->namespace}_other\" name=\"{$this->namespace}_other\" ";
         if ($this->frozen) {
             $output .= ' disabled="disabled"';
         }
         $output .= ' value=' . midcom_helper_xsspreventer_helper::escape_attribute($othervalue) . " />\n";
         $output .= "</label>\n";
     }
     return $output;
 }
Exemple #2
0
 /**
  * Renders the form controls (if not frozen) or read-only view (if frozen)
  * of the widget as html
  */
 public function render_html()
 {
     $output = "<label class=\"text\" for=\"{$this->namespace}_{$this->main_input_name}\"><span>{$this->field['title']}</span>\n";
     $output .= "    <input id=\"{$this->namespace}_{$this->main_input_name}\" name=\"{$this->namespace}_{$this->main_input_name}\" size=\"{$this->size}\"";
     if ($this->maxlenght > 0) {
         $output .= " maxlenght=\"{$maxlenght}\"";
     }
     if ($this->frozen) {
         $output .= ' disabled="disabled"';
     }
     $output .= ' value=' . midcom_helper_xsspreventer_helper::escape_attribute($this->type->value) . " />\n";
     $output .= "</label>\n";
     return $output;
 }