Файл: sys/classes/form.class.php
Строк: 49
<?php
class form {
public function __construct($url = '', $post = true) {
parent::__construct();
$this->_tpl_file = 'input.form.tpl';
$this->_data['el'] = array();
$this->set_url($url);
$this->set_method($post ? 'post' : 'get');
}
function button($text, $name = '', $br = true) {
$this->input($name, '', $text, 'submit', $br);
}
function captcha($br = true) {
$this->_data['el'][] = array('type' => 'captcha', 'br' => $br, 'session' => captcha::gen());
}
function input($name, $title, $value = '', $type = 'text', $br = true, $size = false, $disabled = false, $maxlength = false) {
if (!in_array($type, array('text', 'input_text', 'password', 'hidden', 'textarea', 'submit', 'file')))
return false;
$input = array();
if ($type == 'file')
$this->set_is_files();
if ($type == 'text')
$type = 'input_text'; // так уж изначально было задумано. Избавляться будем постепенно
$input['type'] = $type;
$input['title'] = text::output_text($title);
$input['br'] = (bool) $br;
$info = array();
$info['name'] = text::for_value($name);
$info['value'] = $value;
$info['disabled'] = (bool) $disabled;
if ($size)
$info['size'] = (int) $size;
if ($maxlength)
$info['maxlength'] = (int) $maxlength;
$input['info'] = $info;
$this->_data['el'][] = $input;
return true;
}
}
?>