/** * 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_login'); $this->form->class = 'tform'; $this->form->style = 'margin:auto;width: 350px'; // add the notebook inside the form $this->form->add($table); // create the form fields $login = new TEntry('login'); $password = new TPassword('password'); // define the sizes $login->setSize(150, 40); $password->setSize(150, 40); // create an action button (save) $save_button = new TButton('save'); $save_button->setAction(new TAction(array($this, 'onLogin')), _t('Login')); $save_button->setImage('ico_apply.png'); // add a row for the field login $row = $table->addRow(); $cell = $row->addCell(new TLabel('Login')); $cell->colspan = 2; $row->class = 'tformtitle'; $table->addRowSet(new TLabel(_t('User') . ': '), $login); $table->addRowSet(new TLabel(_t('Password') . ': '), $password); $row = $table->addRowSet($save_button, ''); $row->class = 'tformaction'; $this->form->setFields(array($login, $password, $save_button)); // add the form to the page parent::add($this->form); }
/** * 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:10px;'; // add the notebook inside the form $this->form->add($table); // create the form fields $login = new TEntry('login'); $password = new TPassword('password'); // 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 = _t('User'); $password->placeholder = _t('Password'); $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 $caixa = new TVBox(); $caixa->style = "text-align:center"; $caixa->add(new TImage("app/images/pgo.png")); $caixa->add($this->form); parent::add($caixa); }
/** * 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(); Usuario::checkLogin(); // creates the form $this->form = new TForm('form_Usuario'); $this->form->class = 'tform'; // CSS class // 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('Usuario'))->colspan = 2; // create the form fields $id = new TEntry('id'); $login = new TEntry('login'); $senha = new TPassword('senha'); // define the sizes $id->setSize(100); $login->setSize(200); $senha->setSize(200); // add one row for each form field $table->addRowSet(new TLabel('id:'), $id); $table->addRowSet(new TLabel('login:'******'senha:'), $senha); // create an action button (save) $save_button = new TButton('save'); $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save')); $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')), _t('New')); $new_button->setImage('ico_new.png'); $this->form->setFields(array($id, $login, $senha, $save_button, $new_button)); $buttons_box = new THBox(); $buttons_box->add($save_button); $buttons_box->add($new_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); }
/** * 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); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // create the notebook $notebook = new TNotebook(620, 340); // create the form $this->form = new TForm(); // creates the notebook page $table = new TTable(); // add the notebook inside the form $this->form->add($table); // adds the notebook page $notebook->appendPage('Input elements', $this->form); // create the form fields $field1 = new TEntry('field1'); $field2 = new TEntry('field2'); $field3 = new TEntry('field3'); $field4 = new TEntry('field4'); $field5 = new TPassword('field5'); $field6 = new TDate('field6'); $field7 = new TSpinner('field7'); $field8 = new TSlider('field8'); $field9 = new TText('field9'); $field1->setTip('Tip for field 1'); $field2->setTip('Tip for field 2'); $field3->setTip('Tip for field 3'); $field4->setTip('Tip for field 4'); $field5->setTip('Tip for field 5'); $field6->setTip('Tip for field 6'); $field7->setTip('Tip for field 7'); $field8->setTip('Tip for field 8'); $field9->setTip('Tip for field 9'); $field2->setValue('123'); $field2->setEditable(FALSE); $field3->setMask('99.999-999'); $field4->setMaxLength(10); $field6->setSize(100); $field7->setRange(0, 100, 10); $field8->setRange(0, 100, 10); $field7->setValue(30); $field8->setValue(50); $field9->setSize(300, 50); // add rows for the fields $table->addRowSet(new TLabel('TEntry object:'), $field1); $table->addRowSet(new TLabel('TEntry not editable:'), $field2); $table->addRowSet(new TLabel('TEntry with mask:'), $field3, new TLabel('99.999-999')); $table->addRowSet(new TLabel('TEntry with maxlength (10):'), $field4); $table->addRowSet(new TLabel('TPassword object:'), $field5); $table->addRowSet(new TLabel('TDate Object:'), $field6); $table->addRowSet(new TLabel('Spinner Object:'), $field7); $table->addRowSet(new TLabel('Slider Object:'), $field8); $table->addRowSet(new TLabel('TText Object:'), $field9); // creates the action button $button1 = new TButton('action1'); // define the button action $button1->setAction(new TAction(array($this, 'onSave')), 'Save'); $button1->setImage('ico_save.png'); // define wich are the form fields $this->form->setFields(array($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9, $button1)); // add a row for the button $row = $table->addRow(); $row->addCell($button1); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($notebook); parent::add($vbox); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_System_user'); $this->form->class = 'tform'; // creates the table container $table = new TTable(); $table1 = new TTable(); $table2 = new TTable(); $hbox1 = new THBox(); $hbox2 = new THBox(); $table->style = 'width: 100%'; $table1->style = 'width: 100%'; $table2->style = 'width: 100%'; $this->form->add($table); $table->addRowSet(new TLabel(_t('User')), '', '', '')->class = 'tformtitle'; $table->addRowSet($hbox1); $table->addRowSet($hbox2); $hbox1->add($table1); $hbox1->add($table2); // add the table inside the form $this->form->add($table); $frame_groups = new TFrame(NULL, 280); $frame_groups->setLegend(_t('Groups')); $frame_groups->style .= ';margin: 4px'; $frame_programs = new TFrame(NULL, 280); $frame_programs->setLegend(_t('Programs')); $frame_programs->style .= ';margin: 4px'; // create the form fields $id = new TEntry('id'); $name = new TEntry('name'); $login = new TEntry('login'); $password = new TPassword('password'); $repassword = new TPassword('repassword'); $email = new TEntry('email'); $multifield_programs = new TMultiField('programs'); $program_id = new TDBSeekButton('program_id', 'permission', 'form_System_user', 'SystemProgram', 'name', 'programs_id', 'programs_name'); $program_name = new TEntry('program_name'); $groups = new TDBCheckGroup('groups', 'permission', 'SystemGroup', 'id', 'name'); $frontpage_id = new TDBSeekButton('frontpage_id', 'permission', 'form_System_user', 'SystemProgram', 'name', 'frontpage_id', 'frontpage_name'); $frontpage_name = new TEntry('frontpage_name'); $scroll = new TScroll(); $scroll->setSize(290, 240); $scroll->add($groups); $frame_groups->add($scroll); $frame_programs->add($multifield_programs); // define the sizes $id->setSize('50%'); $name->setSize('100%'); $login->setSize('100%'); $password->setSize('100%'); $repassword->setSize('100%'); $email->setSize('100%'); $frontpage_id->setSize('20%'); $multifield_programs->setHeight(140); // outros $id->setEditable(false); $program_name->setEditable(false); $frontpage_name->setEditable(false); // validations $name->addValidation(_t('Name'), new TRequiredValidator()); $login->addValidation('Login', new TRequiredValidator()); $email->addValidation('Email', new TEmailValidator()); $program_id->setSize(50); $program_name->setSize(200); // configuracoes multifield $multifield_programs->setClass('SystemProgram'); $multifield_programs->addField('id', 'ID', $program_id, 60); $multifield_programs->addField('name', _t('Name'), $program_name, 250); $multifield_programs->setOrientation('horizontal'); // add a row for the field id $row = $table1->addRow(); $row->addCell(new TLabel('ID:'))->style = 'width:150px'; $row->addCell($id); $table1->addRowSet(new TLabel(_t('Login') . ': '), $login); $table1->addRowSet(new TLabel(_t('Password') . ': '), $password); $table1->addRowSet(new TLabel(_t('Password confirmation') . ': '), $repassword); $row = $table2->addRow(); $row->addCell(new TLabel('Name:'))->style = 'width:150px'; $row->addCell($name); $table2->addRowSet(new TLabel(_t('Email') . ': '), $email); $table2->addRowSet(new TLabel(_t('Front page') . ': '), $frontpage_id); $table2->addRowSet(new TLabel(_t('Page name') . ': '), $frontpage_name); $hbox2->add($frame_groups); $hbox2->add($frame_programs); // create an action button (save) $save_button = new TButton('save'); $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save')); $save_button->setImage('fa:floppy-o'); // create an new button (edit with no parameters) $new_button = new TButton('new'); $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New')); $new_button->setImage('fa:plus-square green'); $list_button = new TButton('list'); $list_button->setAction(new TAction(array('SystemUserList', 'onReload')), _t('Back to the listing')); $list_button->setImage('fa:table blue'); // define the form fields $this->form->setFields(array($id, $name, $login, $password, $repassword, $multifield_programs, $frontpage_id, $frontpage_name, $groups, $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', 'SystemUserList')); $container->addRow()->addCell($this->form); // add the form to the page parent::add($container); }
/** * */ 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 */ function __construct() { parent::__construct(); // create the notebook $notebook = new TNotebook(620, 410); // create the form $this->form = new TForm(); // creates the notebook page $table = new TTable(); // add the notebook inside the form $this->form->add($table); // adds the notebook page $notebook->appendPage('Input elements', $this->form); // create the form fields $field1 = new TEntry('field1'); $field2 = new TEntry('field2'); $field3 = new TEntry('field3'); $field4 = new TEntry('field4'); $field5 = new TEntry('field5'); $field6 = new TPassword('field6'); $field7 = new TDate('field7'); $field8 = new TSpinner('field8'); $field9 = new TSlider('field9'); $field10 = new TText('field10'); $field1->setTip('Tip for field 1'); $field2->setTip('Tip for field 2'); $field3->setTip('Tip for field 3'); $field4->setTip('Tip for field 4'); $field5->setTip('Tip for field 5'); $field6->setTip('Tip for field 6'); $field7->setTip('Tip for field 7'); $field8->setTip('Tip for field 8'); $field9->setTip('Tip for field 9'); $field10->setTip('Tip for field 10'); $field2->setValue('123'); $field2->setEditable(FALSE); $field3->setMask('99.999-999'); $field4->setMaxLength(10); $field5->setCompletion(array('Allen', 'Albert', 'Alberto', 'Alladin')); $field7->setSize(100); $field8->setRange(0, 100, 10); $field9->setRange(0, 100, 10); $field8->setValue(30); $field9->setValue(50); $field10->setSize(300, 80); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TEntry object:')); $cell = $row->addCell($field1); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TEntry not editable:')); $cell = $row->addCell($field2); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TEntry with mask:')); $cell = $row->addCell($field3); $cell = $row->addCell(new TLabel('99.999-999')); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TEntry with maxlength (10):')); $cell = $row->addCell($field4); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TEntry with completion (a..):')); $cell = $row->addCell($field5); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TPassword object:')); $cell = $row->addCell($field6); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TDate Object:')); $cell = $row->addCell($field7); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('Spinner Object:')); $cell = $row->addCell($field8); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('Slider Object:')); $cell = $row->addCell($field9); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TText Object:')); $cell = $row->addCell($field10); // creates the action button $button1 = new TButton('action1'); // define the button action $button1->setAction(new TAction(array($this, 'onSave')), 'Save'); $button1->setImage('ico_save.png'); // define wich are the form fields $this->form->setFields(array($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9, $field10, $button1)); // add a row for the button $row = $table->addRow(); $row->addCell($button1); // add the form inside the page parent::add($notebook); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_System_user'); $this->form->class = 'tform'; // creates the table container $table = new TTable(); $table->style = 'width: 100%'; $table->addRowSet(new TLabel('Usuário'), '', '', '')->class = 'tformtitle'; // add the table inside the form $this->form->add($table); $frame_groups = new TFrame(NULL, 280); $frame_groups->setLegend('Grupos'); $frame_groups->style .= ';margin: 4px'; $frame_programs = new TFrame(NULL, 280); $frame_programs->setLegend('Programas'); $frame_programs->style .= ';margin: 15px'; // create the form fields $id = new TEntry('id'); $name = new TEntry('name'); $login = new TEntry('login'); $password = new TPassword('password'); $repassword = new TPassword('repassword'); $email = new TEntry('email'); $multifield_programs = new TMultiField('programs'); $program_id = new TDBSeekButton('program_id', 'esales', 'form_System_user', 'SystemProgram', 'name', 'programs_id', 'programs_name'); $program_name = new TEntry('program_name'); $groups = new TDBCheckGroup('groups', 'esales', 'SystemGroup', 'id', 'name'); $frontpage_id = new TDBSeekButton('frontpage_id', 'esales', 'form_System_user', 'SystemProgram', 'name', 'frontpage_id', 'frontpage_name'); $frontpage_name = new TEntry('frontpage_name'); $scroll = new TScroll(); $scroll->setSize(290, 230); $scroll->add($groups); $frame_groups->add($scroll); $frame_programs->add($multifield_programs); // define the sizes $id->setSize(100); $name->setSize(200); $login->setSize(150); $password->setSize(150); $email->setSize(200); $frontpage_id->setSize(100); $multifield_programs->setHeight(140); // outros $id->setEditable(false); $program_name->setEditable(false); $frontpage_name->setEditable(false); // validations $name->addValidation('Nome', new TRequiredValidator()); $login->addValidation('Login', new TRequiredValidator()); $email->addValidation('Email', new TEmailValidator()); $program_id->setSize(50); $program_name->setSize(200); // configuracoes multifield $multifield_programs->setClass('SystemProgram'); $multifield_programs->addField('id', 'ID', $program_id, 60); $multifield_programs->addField('name', 'Nome', $program_name, 250); $multifield_programs->setOrientation('horizontal'); // add a row for the field id $table->addRowSet(new TLabel('ID:'), $id, new TLabel('Nome' . ': '), $name); $table->addRowSet(new TLabel('login' . ': '), $login, new TLabel('Email' . ': '), $email); $table->addRowSet(new TLabel('Senha' . ': '), $password, new TLabel('Confirmar senha' . ': '), $repassword); $table->addRowSet(new TLabel('Página inicial' . ': '), $frontpage_id, new TLabel('Nome página' . ': '), $frontpage_name); $row = $table->addRow(); $cell = $row->addCell($frame_groups); $cell->colspan = 2; $row = $table->addRow(); $cell = $row->addCell($frame_programs); $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('SystemUserList', 'onReload')), 'Voltar para listagem'); $list_button->setImage('ico_datagrid.png'); // define the form fields $this->form->setFields(array($id, $name, $login, $password, $repassword, $multifield_programs, $frontpage_id, $frontpage_name, $groups, $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', 'SystemUserList')); $container->addRow()->addCell($this->form); // add the form to the page parent::add($container); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_Clientes'); $this->form->class = 'tform'; // CSS class // 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('Clientes'))->colspan = 2; // create the form fields $id = new TEntry('id'); $nome = new TEntry('nome'); $sobrenome = new TEntry('sobrenome'); $cep = new TEntry('cep'); $logradouro = new TEntry('logradouro'); $bairro = new TEntry('bairro'); $cidade = new TEntry('cidade'); $email = new TEntry('email'); $dd = new TEntry('dd'); $telefone = new TEntry('telefone'); $senha = new TPassword('senha'); $buscaCep = new TAction(array($this, 'onSearch')); $cep->setExitAction($buscaCep); // mascaras $cep->setMask('99999-999'); // define the sizes $id->setSize(100); $nome->setSize(200); $sobrenome->setSize(200); $cep->setSize(200); $logradouro->setSize(200); $bairro->setSize(200); $cidade->setSize(200); $email->setSize(200); $dd->setSize(200); $telefone->setSize(200); $senha->setSize(200); // add one row for each form field $table->addRowSet(new TLabel('id:'), $id); $table->addRowSet(new TLabel('nome:'), $nome); $table->addRowSet(new TLabel('sobrenome:'), $sobrenome); $table->addRowSet(new TLabel('cep:'), $cep); $table->addRowSet(new TLabel('logradouro:'), $logradouro); $table->addRowSet(new TLabel('bairro:'), $bairro); $table->addRowSet(new TLabel('cidade:'), $cidade); $table->addRowSet(new TLabel('email:'), $email); $table->addRowSet(new TLabel('dd:'), $dd); $table->addRowSet(new TLabel('telefone:'), $telefone); $table->addRowSet(new TLabel('senha:'), $senha); // create an action button (save) $save_button = new TButton('save'); $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save')); $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')), _t('New')); $new_button->setImage('ico_new.png'); $this->form->setFields(array($id, $nome, $sobrenome, $cep, $logradouro, $bairro, $cidade, $email, $dd, $telefone, $senha, $save_button, $new_button)); $buttons_box = new THBox(); $buttons_box->add($save_button); $buttons_box->add($new_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); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the notebook $this->notebook = new TNotebook(); $this->notebook->setSize(700, 390); // creates the table container $tableCampos = new TTable(); // creates the form $this->form = new TForm('form_System_user'); $this->notebook->appendPage(_t('User'), $tableCampos); // add the notebook inside the form $this->form->add($this->notebook); $frame_groups = new TFrame(300, 250); $frame_groups->setLegend(_t('Groups')); $frame_groups->style = 'margin: 4px'; $frame_programs = new TFrame(340, 250); $frame_programs->setLegend(_t('Programs')); $frame_programs->style = 'margin: 4px'; // create the form fields $id = new TEntry('id'); $name = new TEntry('name'); $login = new TEntry('login'); $password = new TPassword('password'); $repassword = new TPassword('repassword'); $email = new TEntry('email'); $multifield_programs = new TMultiField('programs'); $program_id = new TDBSeekButton('program_id', 'permission', 'form_System_user', 'SystemProgram', 'name', 'programs_id', 'programs_name'); $program_name = new TEntry('program_name'); $groups = new TDBCheckGroup('groups', 'permission', 'SystemGroup', 'id', 'name'); $frontpage_id = new TDBSeekButton('frontpage_id', 'permission', 'form_System_user', 'SystemProgram', 'name', 'frontpage_id', 'frontpage_name'); $frontpage_name = new TEntry('frontpage_name'); $scroll = new TScroll(); $scroll->setSize(290, 230); $scroll->add($groups); $frame_groups->add($scroll); $frame_programs->add($multifield_programs); // define the sizes $id->setSize(100); $name->setSize(200); $login->setSize(150); $password->setSize(150); $email->setSize(200); $frontpage_id->setSize(100); $multifield_programs->setHeight(140); // outros $id->setEditable(false); $program_name->setEditable(false); $frontpage_name->setEditable(false); // validations $name->addValidation(_t('Name'), new TRequiredValidator()); $login->addValidation('Login', new TRequiredValidator()); $email->addValidation('Email', new TEmailValidator()); $program_id->setSize(50); $program_name->setSize(200); // configuracoes multifield $multifield_programs->setClass('SystemProgram'); $multifield_programs->addField('id', 'ID', $program_id, 60); $multifield_programs->addField('name', _t('Name'), $program_name, 250); $multifield_programs->setOrientation('horizontal'); // add a row for the field id $tableCampos->addRowSet(new TLabel('ID:'), $id, new TLabel(_t('Name') . ': '), $name); $tableCampos->addRowSet(new TLabel(_t('Login') . ': '), $login, new TLabel(_t('Email') . ': '), $email); $tableCampos->addRowSet(new TLabel(_t('Password') . ': '), $password, new TLabel(_t('Password confirmation') . ': '), $repassword); $tableCampos->addRowSet(new TLabel(_t('Front page') . ': '), $frontpage_id, new TLabel(_t('Page name') . ': '), $frontpage_name); $row = $tableCampos->addRow(); $cell = $row->addCell($frame_groups); $cell->colspan = 2; $cell = $row->addCell($frame_programs); $cell->colspan = 2; // create an action button (save) $save_button = new TButton('save'); $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save')); $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')), _t('New')); $new_button->setImage('ico_new.png'); $list_button = new TButton('list'); $list_button->setAction(new TAction(array('SystemUserList', 'onReload')), _t('Back to the listing')); $list_button->setImage('ico_datagrid.png'); // define the form fields $this->form->setFields(array($id, $name, $login, $password, $repassword, $multifield_programs, $frontpage_id, $frontpage_name, $groups, $email, $save_button, $new_button, $list_button)); $table_buttons = new TTable(); $row_buttons = $table_buttons->addRow(); $row_buttons->addCell($save_button); $row_buttons->addCell($new_button); $row_buttons->addCell($list_button); $container = new TTable(); $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemUserList')); $container->addRow()->addCell($this->form); $container->addRow()->addCell($table_buttons); // add the form to the page parent::add($container); }
/** * 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')); } // security check TTransaction::open('changeman'); if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic !== 'ADMINISTRATOR' and Member::newFromLogin(TSession::getValue('login'))->role_mnemonic !== 'MANAGER') { throw new Exception(_t('Permission denied')); } TTransaction::close(); // creates a table $table = new TTable(); $table1 = new TTable(); $table2 = new TTable(); // creates the form $this->form = new TForm('form_Member'); $this->form->class = 'tform'; $this->form->style = 'width: 640px'; $this->form->add($table); $table->width = '100%'; $table->addRowSet(new TLabel(_t('Members')), '')->class = 'tformtitle'; $row = $table->addRow(); $row->addCell($table1); $cell = $row->addCell($table2); $cell->valign = 'top'; $options = array('Y' => _t('Yes'), 'N' => _t('No')); // create the form fields $id = new TEntry('id'); $name = new TEntry('name'); $id_role = new TDBCombo('id_role', 'changeman', 'Role', 'id', 'description'); $login = new TEntry('login'); $password = new TPassword('password'); $email = new TEntry('email'); $active = new TCombo('active'); $projects = new TDBCheckGroup('project_ids', 'changeman', 'Project', 'id', 'description'); $id->setEditable(FALSE); $active->addItems($options); // define the sizes $id->setSize(100); $name->setSize(200, 40); $id_role->setSize(160); $login->setSize(200, 40); $password->setSize(200, 40); $email->setSize(200, 40); $active->setSize(200); // add a row for the field id $row = $table1->addRow(); $cell = $row->addCell(new TLabel('ID:')); $cell->width = '100px'; $row->addCell($id); // add a row for the field name $row = $table1->addRow(); $row->addCell(new TLabel(_t('Name') . ': ')); $row->addCell($name); // add a row for the field id_role $row = $table1->addRow(); $row->addCell(new TLabel(_t('Role') . ': ')); $row->addCell($id_role); // add a row for the field login $row = $table1->addRow(); $row->addCell(new TLabel('Login:'******'Password') . ': ')); $row->addCell($password); // add a row for the field email $row = $table1->addRow(); $row->addCell(new TLabel('Email:')); $row->addCell($email); // add a row for the field active $row = $table1->addRow(); $row->addCell(new TLabel(_t('Active') . ': ')); $row->addCell($active); // add a row for the field projects $row = $table2->addRow(); $cell = $row->addCell($lbl_pro = new TLabel(_t('Projects') . ': ')); $row = $table2->addRow(); $row->addCell($projects); $lbl_pro->setFontStyle('b'); // create an action button (save) $save_button = new TButton('save'); $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save')); $save_button->setImage('ico_save.png'); $row = $table->addRow(); $row->class = 'tformaction'; $row->addCell($save_button)->colspan = 2; // define wich are the form fields $this->form->setFields(array($id, $name, $id_role, $login, $password, $email, $active, $projects, $save_button)); $container = new TVBox(); $container->add($this->form); parent::add($container); }