function getField()
 {
     $result = $this->loadItems();
     if ($result === false) {
         return false;
     }
     switch ($this->params['mode']) {
         case 'list':
             $value = current($this->items);
             $is_link = $this->getParam('is_link');
             $link = $this->getParam('link');
             $external_link = $this->getParam('external_link');
             $key_field_value = $this->getParam('key_field_value');
             if ($is_link && $link && $key_field_value) {
                 $link = str_replace('*', $key_field_value, $link);
                 $link = $this->getURLString($link);
                 $field = '<a href="' . $link . '">' . $value . '</a>' . "\n";
             } elseif ($external_link) {
                 $external_id = key($this->items);
                 $external_link = str_replace('*', $external_id, $external_link);
                 $external_link = $this->getURLString($external_link);
                 $field = '<a href="' . $external_link . '">' . $value . '</a>' . "\n";
             } else {
                 $field = $value;
             }
             break;
         case 'single':
             $field_obj = new HTMLSelect();
             $field_obj->addParams($this->params);
             $field_obj->addItems($this->items);
             $field = $field_obj->getField();
             break;
     }
     return $field;
 }
 function getField()
 {
     $value = $this->getParam('value');
     switch ($this->params['mode']) {
         case 'list':
             $field = $value;
             if (isset($this->params['items'][$value])) {
                 $field = $this->params['items'][$value];
             }
             break;
         case 'single':
             //				$this->params['size'] = 4;
             $field_obj = new HTMLSelect();
             $field_obj->addParams($this->params);
             $field_obj->addItems($this->params['items']);
             $field = $field_obj->getField();
             break;
     }
     return $field;
 }
Beispiel #3
0
$inputNome->addAttribute('size', 60);
$text = new HTMLTextNode('Nome');
$label->addChild($inputNome);
$divNome->addChild($label);
//***************************************************
$divNascimento = new HTMLDIV('d_nasc');
$labelNascimento = new HTMLLabel("Data de Nascimento", 'i_nasc');
$nascimento = new HTMLInput('date', 'i_nasc');
$nascimento->addAttribute('size', 25);
$nascimento->addClass('input_n');
$nascimento->addClass('input_md');
$labelNascimento->addChild($nascimento);
$divNascimento->addChild($labelNascimento);
//***************************************************
$arrayOptions = ['Corsa', 'Fiesta', 'Cobalt', 'Onix', 'Escort', 'Ipanema', 'Uno', 'Palio', 'Gol', 'Verona'];
$select = new HTMLSelect('carros');
foreach ($arrayOptions as $opt) {
    if ($opt === 'Fiesta') {
        $select->addChild(new HTMLOption($opt, $opt, true));
    } else {
        $select->addChild(new HTMLOption($opt, $opt));
    }
}
$divTextArea = new HTMLDIV('text_area');
$textarea = new HTMLTextArea('message', 30, 5);
$divTextArea->addChild($textarea);
$radio = new HTMLRadio('sim', 'Deseja receber atualizações do nosso site');
$divTextArea->addChild($radio);
$divRadio = new HTMLDIV('radio_b');
$divRadio->addChild($radio);
$anchor = new HTMLAnchor('http://www.uol.com.br', 'Universo Online');
 function SortAndSearchForm()
 {
     $select = new HTMLSelect("sort", 1);
     if (count($this->cols) == 0) {
     } else {
         while (list($col, $val) = @each($this->cols)) {
             if ($this->descriptions[$col] != "") {
                 $select->AddOption("Nach {$this->descriptions[$col]} Sortieren", $col);
             } else {
                 $select->AddOption("Nach {$col} Sortieren", $col);
             }
         }
     }
     $html = $select->Get();
     $search = new HTMLInput("search", "text", "", 20);
     $html .= $search->Get();
     $html .= "<input type=\"submit\" value=\"Suchen\">";
     $html .= "<br>";
     $alphabet = range('A', 'Z');
     $html .= "<table width=\"100%\" cellpadding=\"7\"><tr>";
     foreach ($alphabet as $letter) {
         $html .= "<td><a href=\"\">{$letter}</a></td>";
     }
     $html .= "</tr></table>";
     return $html;
 }