/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // create the form using TQuickForm class $this->form = new TQuickForm(); $this->form->class = 'tform'; $this->form->setFormTitle('Informações Pessoais'); // create the form fields $id = new TEntry('id'); $nome = new TEntry('name'); $email = new TEntry('email'); $telefone = new TEntry('phone'); $usuario = new TEntry('login'); $date = new TDate('date'); $cep = new TEntry('cep'); $senha = new TPassword('password'); $cSenha = new TPassword('rpassword'); $telefone->setMask('(99)99999-9999'); $cep->setMask('99.999-999'); //$id->setValue(TSession::getValue('id')); //$usuario->setValue (TSession::getValue('login')); $id->setEditable(FALSE); //Adcionando validaões $nome->addValidation("name", new TRequiredValidator()); $email->addValidation("email", new TEmailValidator()); $telefone->addValidation("telefone", new TRequiredValidator()); $usuario->addValidation("login", new TRequiredValidator()); $date->addValidation("date", new TRequiredValidator()); $senha->addValidation("passsword", new TRequiredValidator()); $cSenha->addValidation("rpasssword", new TRequiredValidator()); // add the fields inside the form $this->form->addQuickField('Código', $id, 80); $this->form->addQuickField('Nome', $nome, 700); $this->form->addQuickField('Usuario', $usuario, 350); $this->form->addQuickField('Nova senha ', $senha, 200); $this->form->addQuickField('Confirma senha', $cSenha, 200); $this->form->addQuickField('E-mail', $email, 280); $this->form->addQuickField('Telefone', $telefone, 180); $this->form->addQuickField('CEP', $cep, 180); $this->form->addQuickField('Data De nascimento', $date, 180); // define the form action $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png'); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->style = "width:100%"; $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->form); parent::add($vbox); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // security check if (TSession::getValue('logged') !== TRUE) { throw new Exception(_t('Not logged')); } // creates the form $this->form = new TForm('form_Issue'); $this->form->class = 'tform'; $this->form->style = 'width: 400px'; $table = new TTable(); $table->width = '100%'; $table->addRowSet(new TLabel(_t('Password')), '')->class = 'tformtitle'; $this->form->add($table); // create the form fields $current_password = new TPassword('current_password'); $new_password1 = new TPassword('new_password1'); $new_password2 = new TPassword('new_password2'); $current_password->addValidation(_t('Current password'), new TRequiredValidator()); $new_password1->addValidation(_t('New password'), new TRequiredValidator()); $new_password2->addValidation(_t('Confirm new password'), new TRequiredValidator()); // add a row for the field $row = $table->addRow(); $row->addCell(new TLabel(_t('Current password') . ': ')); $row->addCell($current_password); // add a row for the field $row = $table->addRow(); $row->addCell(new TLabel(_t('New password') . ': ')); $row->addCell($new_password1); // add a row for the field $row = $table->addRow(); $row->addCell(new TLabel(_t('Confirm new password') . ': ')); $row->addCell($new_password2); // create an action button (save) $save_button = new TButton('save'); // define the button action $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save')); $save_button->setImage('ico_save.png'); $table->addRowSet($save_button, '')->class = 'tformaction'; // define wich are the form fields $this->form->setFields(array($current_password, $new_password1, $new_password2, $save_button)); $container = new TVBox(); $container->add($this->form); parent::add($container); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // // creates the form $this->form = new TForm('form_SystemUser'); $this->form->class = 'tform'; // CSS class $this->form->style = 'width: 500px'; // add a table inside form $table = new TTable(); $table->width = '100%'; $this->form->add($table); // add a row for the form title $row = $table->addRow(); $row->class = 'tformtitle'; // CSS class $row->addCell(new TLabel('Troque sua senha'))->colspan = 2; // create the form fields $current = new TPassword('current'); $current->addValidation('Senha atual', new TRequiredValidator()); $password = new TPassword('password'); $password->addValidation('Nova senha', new TRequiredValidator()); $confirmation = new TPassword('confirmation'); $confirmation->addValidation('Confirmação', new TRequiredValidator()); // define the sizes $current->setSize(200); $password->setSize(200); $confirmation->setSize(200); // add one row for each form field $table->addRowSet(new TLabel('Senha atual'), $current); $table->addRowSet(new TLabel('Nova senha'), $password); $table->addRowSet(new TLabel('Confirmação'), $confirmation); $this->form->setFields(array($current, $password, $confirmation)); // create the form actions $save_button = TButton::create('save', array($this, 'onSave'), 'Alterar senha', 'ico_save.png'); $this->form->addField($save_button); $buttons_box = new THBox(); $buttons_box->add($save_button); // add a row for the form action $row = $table->addRow(); $row->class = 'tformaction'; // CSS class $row->addCell($buttons_box)->colspan = 2; parent::add($this->form); }
/** * */ public function makeTPassword($properties) { $widget = new TPassword((string) $properties->{'name'}); $widget->setValue((string) $properties->{'value'}); $widget->setSize((int) $properties->{'width'}); $widget->setEditable((string) $properties->{'editable'}); if (isset($properties->{'tip'})) { $widget->setTip((string) $properties->{'tip'}); } if (isset($properties->{'required'}) and $properties->{'required'} == '1') { $widget->addValidation((string) $properties->{'name'}, new TRequiredValidator()); } $this->fields[] = $widget; $this->fieldsByName[(string) $properties->{'name'}] = $widget; return $widget; }