/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); $table = new TTable(); $table->width = '100%'; // creates the form $this->form = new TForm('form_User'); $this->form->class = 'tform'; $this->form->style = 'width: 450px;margin:auto; margin-top:120px;'; // add the notebook inside the form $this->form->add($table); // create the form fields $login = new TEntry('prontuario'); $password = new TPassword('senha'); // define the sizes $login->setSize(320, 40); $password->setSize(320, 40); $login->style = 'height:35px; font-size:14px;float:left;border-bottom-left-radius: 0;border-top-left-radius: 0;'; $password->style = 'height:35px;margin-bottom: 15px;font-size:14px;float:left;border-bottom-left-radius: 0;border-top-left-radius: 0;'; $row = $table->addRow(); $row->addCell(new TLabel('Login'))->colspan = 2; $row->class = 'tformtitle'; $login->placeholder = 'Prontuário'; $password->placeholder = 'Senha'; $user = '******'; $locker = '<span style="float:left;width:35px;margin-left:45px;height:35px;" class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>'; $container1 = new TElement('div'); $container1->add($user); $container1->add($login); $container2 = new TElement('div'); $container2->add($locker); $container2->add($password); $row = $table->addRow(); $row->addCell($container1)->colspan = 2; // add a row for the field password $row = $table->addRow(); $row->addCell($container2)->colspan = 2; // create an action button (save) $save_button = new TButton('save'); // define the button action $save_button->setAction(new TAction(array($this, 'onLogin')), _t('Log in')); $save_button->class = 'btn btn-success btn-defualt'; $save_button->style = 'margin-left:32px;width:355px;height:40px;border-radius:6px;font-size:18px'; $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($save_button); $cell->colspan = 2; $this->form->setFields(array($login, $password, $save_button)); // add the form to the page 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; }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // Cria o form $this->form = new TForm('form_Usuario'); $this->form->class = 'tform'; // creates the table container $table = new TTable(); $table->style = 'width: 100%'; $table->addRowSet(new TLabel('Usuário'), '', '', '')->class = 'tformtitle'; // adiciona a tabela no form $this->form->add($table); $frame_grupos = new TFrame(NULL, 280); $frame_grupos->setLegend('Grupos'); $frame_grupos->style .= ';margin: 4px'; $frame_funcionalidades = new TFrame(NULL, 280); $frame_funcionalidades->setLegend('Funcionalidades'); $frame_funcionalidades->style .= ';margin: 15px'; // cria os campos de pesquisa do form $id = new TEntry('id'); $nome = new TEntry('nome'); $prontuario = new TEntry('prontuario'); $password = new TPassword('senha'); $repassword = new TPassword('resenha'); $email = new TEntry('email'); $multifield_funcionalidades = new TMultiField('funcionalidades'); $funcionalidade_id = new TDBSeekButton('funcionalidade_id', 'saciq', 'form_Usuario', 'Funcionalidade', 'nome', 'funcionalidades_id', 'funcionalidades_nome'); $funcionalidade_nome = new TEntry('funcionalidade_nome'); $grupos = new TDBCheckGroup('grupos', 'saciq', 'Grupo', 'id', 'nome'); //$frontpage_id = new TDBSeekButton('frontpage_id', 'saciq', 'form_Usuario', 'Funcionalidade', 'nome', 'frontpage_id', 'frontpage_nome'); //$frontpage_nome = new TEntry('frontpage_nome'); $scroll = new TScroll(); $scroll->setSize(290, 230); $scroll->add($grupos); $frame_grupos->add($scroll); $frame_funcionalidades->add($multifield_funcionalidades); // define the sizes $id->setSize(100); $nome->setSize(350); $prontuario->setSize(150); $password->setSize(150); $repassword->setSize(150); $email->setSize(250); $multifield_funcionalidades->setHeight(140); // outros $id->setEditable(false); $funcionalidade_nome->setEditable(false); $email->setProperty('autocomplete', 'off'); // validations $nome->addValidation('Nome', new TRequiredValidator()); $prontuario->addValidation('Prontuário', new TRequiredValidator()); $email->addValidation('Email', new TEmailValidator()); $nome->addValidation('Nome', new TMaxLengthValidator(), array(60)); $prontuario->addValidation('Prontuário', new TMaxLengthValidator(), array(60)); $email->addValidation('Email', new TMaxLengthValidator(), array(60)); $funcionalidade_id->setSize(50); $funcionalidade_nome->setSize(200); // configuracoes multifield $multifield_funcionalidades->setClass('Funcionalidade'); $multifield_funcionalidades->addField('id', 'ID', $funcionalidade_id, 60, true); $multifield_funcionalidades->addField('nome', 'Nome', $funcionalidade_nome, 250); $multifield_funcionalidades->setOrientation('horizontal'); // add a row for the field id $table->addRowSet(new TLabel('ID:'), $id, new TLabel('Nome: '), $nome); $table->addRowSet(new TLabel('Prontuário: '), $prontuario, new TLabel('Email: '), $email); $table->addRowSet(new TLabel('Senha: '), $password, new TLabel('Confirmação <br>da senha: '), $repassword); $row = $table->addRow(); $cell = $row->addCell($frame_grupos); $cell->colspan = 2; $cell = $row->addCell($frame_funcionalidades); $cell->colspan = 2; // create an action button (save) $save_button = new TButton('save'); $save_button->setAction(new TAction(array($this, 'onSave')), 'Salvar'); $save_button->setImage('ico_save.png'); // create an new button (edit with no parameters) $new_button = new TButton('new'); $new_button->setAction(new TAction(array($this, 'onEdit')), 'Novo'); $new_button->setImage('ico_new.png'); $list_button = new TButton('list'); $list_button->setAction(new TAction(array('UsuarioList', 'onReload')), 'Voltar para a listagem'); $list_button->setImage('ico_datagrid.png'); // define the form fields $this->form->setFields(array($id, $nome, $prontuario, $password, $repassword, $multifield_funcionalidades, $grupos, $email, $save_button, $new_button, $list_button)); $buttons = new THBox(); $buttons->add($save_button); $buttons->add($new_button); $buttons->add($list_button); $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($buttons); $cell->colspan = 4; $container = new TTable(); //$container->style = 'width: 80%'; $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'UsuarioList')); $container->addRow()->addCell($this->form); // add the form to the page parent::add($container); }