/**
  * 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);
 }
Exemplo n.º 2
0
 /**
  * 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);
 }
Exemplo n.º 3
0
 /**
  * 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();
     //
     // 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);
 }
Exemplo n.º 5
0
 /**
  * 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);
 }
Exemplo n.º 6
0
 /**
  * 
  */
 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();
     // 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);
 }
Exemplo n.º 10
0
 /**
  * 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);
 }