public function __construct()
 {
     parent::__construct();
     // instancia um formulário
     $this->form = new TForm('form_relat_vendas');
     // instancia uma tabela
     $table = new TTable();
     // adiciona a tabela ao formulário
     $this->form->add($table);
     // cria os campos do formulário
     $data_ini = new TEntry('data_ini');
     $data_fim = new TEntry('data_fim');
     // define os tamanhos
     $data_ini->setSize(100);
     $data_fim->setSize(100);
     // adiciona uma linha para o campo data inicial
     $row = $table->addRow();
     $row->addCell(new TLabel('Data Inicial:'));
     $row->addCell($data_ini);
     // adiciona uma linha para o campo data final
     $row = $table->addRow();
     $row->addCell(new TLabel('Data Final:'));
     $row->addCell($data_fim);
     // cria um botão de ação
     $gera_button = new TButton('gera');
     // define a ação do boão
     $gera_button->setAction(new TAction(array($this, 'onGera')), 'Gerar Relatório');
     // adiciona uma linha para a ação do formulário
     $row = $table->addRow();
     $row->addCell($gera_button);
     // define quais são os campos do formulário
     $this->form->setFields(array($data_ini, $data_fim, $gera_button));
     // adiciona o formulário à página
     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_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();
     // creates the form
     $this->form = new TForm('form_City');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     // creates a table
     $table = new TTable();
     $table->width = '100%';
     $table_buttons = new TTable();
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $id = new TEntry('id');
     $name = new TEntry('name');
     // define the sizes
     $id->setSize(100);
     $name->setSize(100);
     $id->setEditable(FALSE);
     // define the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     $cell = $row->addCell(new TLabel('Manual form'));
     $cell->colspan = 2;
     // add the form fields
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('Name:'), $name);
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), 'Save');
     $save_button->setImage('ico_save.png');
     // create an action button (new)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), 'New');
     $new_button->setImage('ico_new.png');
     // create an action button (go to list)
     $goto_button = new TButton('list');
     $goto_button->setAction(new TAction(array('CompleteDataGridView', 'onReload')), 'Listing');
     $goto_button->setImage('ico_datagrid.gif');
     // add a row for the form action
     $row = $table_buttons->addRow();
     $row->addCell($save_button);
     $row->addCell($new_button);
     $row->addCell($goto_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($table_buttons);
     $cell->colspan = 2;
     // define wich are the form fields
     $this->form->setFields(array($id, $name, $save_button, $new_button, $goto_button));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $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();
     // creates the table container
     $table = new TTable();
     $table->style = 'width:100%';
     // creates the form
     $this->form = new TForm('form_System_Provider');
     $this->form->class = 'tform';
     // add the notebook inside the form
     $this->form->add($table);
     $row1 = $table->addRow();
     $row1->class = 'tformtitle';
     $cell1 = $row1->addCell(new TLabel('Add new provider'), '');
     $cell1->colspan = 2;
     // create the form fields
     $id = new TEntry('id');
     $nif = new TEntry('nif');
     $name = new TEntry('name');
     $id->setEditable(false);
     // define the sizes
     $id->setSize(100);
     $nif->setSize(300);
     $name->setSize(300);
     // validations
     $nif->addValidation('nif', new TRequiredValidator());
     $name->addValidation('name', new TRequiredValidator());
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('NIF: '), $nif);
     $table->addRowSet(new TLabel('Name: '), $name);
     // 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('SystemProvidersList', 'onReload')), _t('Back to the listing'));
     $list_button->setImage('fa:table blue');
     // define the form fields
     $this->form->setFields(array($id, $nif, $name, $save_button, $new_button, $list_button));
     $buttons = new THBox();
     $buttons->add($save_button);
     $buttons->add($new_button);
     $buttons->add($list_button);
     $container = new TTable();
     $container->width = '80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemProvidersList'));
     $container->addRow()->addCell($this->form);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 2;
     // 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();
     // creates the form
     $this->form = new TForm('form_Document');
     $this->form->add($this->notebook);
     $this->form->class = 'tform';
     $this->form->add($table);
     $table->addRowSet(new TLabel(_t('Document')), '')->class = 'tformtitle';
     // create the form fields
     $id = new TEntry('id');
     $id_project = new TDBCombo('id_project', 'changeman', 'Project', 'id', 'description');
     $title = new TEntry('title');
     $content = new THtmlEditor('content');
     $id->setEditable(FALSE);
     // define the sizes
     $id->setSize(100);
     $id_project->setSize(200);
     $title->setSize(200, 40);
     $content->setSize(680, 350);
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel(_t('Project') . ': '), $id_project);
     $table->addRowSet(new TLabel(_t('Title') . ': '), $title);
     $hbox = new THBox();
     $hbox->style = 'margin: 10px';
     $hbox->add($content);
     $row = $table->addRow();
     $row->addCell($lbl = new TLabel(_t('Content') . ': '));
     $lbl->setFontStyle('b');
     $row = $table->addRow();
     $cell = $row->addCell($hbox);
     $cell->colspan = 3;
     // 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');
     // define wich are the form fields
     $this->form->setFields(array($id, $id_project, $title, $content, $save_button));
     $table->addRowSet($save_button, '')->class = 'tformaction';
     $container = new TTable();
     $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();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // creates a table
     $table = new TTable();
     $this->notebook = new TNotebook();
     $this->notebook->setSize(600, 350);
     $this->notebook->appendPage(_t('Data'), $table);
     // creates the form
     $this->form = new TForm('form_Release');
     $this->form->add($this->notebook);
     $options = array('Y' => _t('Yes'), 'N' => _t('No'));
     // create the form fields
     $id = new TEntry('id');
     $id_project = new TEntry('project');
     $name = new TEntry('name');
     $description = new THtmlEditor('description');
     $id->setEditable(FALSE);
     $id_project->setEditable(FALSE);
     $name->setEditable(FALSE);
     $description->setEditable(FALSE);
     // define the sizes
     $id->setSize(100);
     $id_project->setSize(200);
     $name->setSize(200, 40);
     $description->setSize(530, 200);
     // add a row for the field id
     $row = $table->addRow();
     $row->addCell(new TLabel('ID:'));
     $row->addCell($id);
     // add a row for the field id_project
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Project') . ': '));
     $row->addCell($id_project);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Name') . ': '));
     $row->addCell($name);
     // add a row for the field description
     $row = $table->addRow();
     $row->addCell($lbl = new TLabel(_t('Description') . ': '));
     $lbl->setFontStyle('b');
     $row = $table->addRow();
     $cell = $row->addCell($description);
     $cell->colspan = 3;
     // define wich are the form fields
     $this->form->setFields(array($id, $id_project, $name, $description));
     $container = new TTable();
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
示例#7
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);
 }
 function __construct()
 {
     parent::__construct();
     // instancia o formulário
     $this->form = new TForm();
     $this->form->setName('form_livros');
     // instancia o painél
     $panel = new TPanel(400, 300);
     $this->form->add($panel);
     // coloca o campo id no formulário
     $panel->put(new TLabel('ID'), 10, 10);
     $panel->put($id = new TEntry('id'), 100, 10);
     $id->setSize(100);
     $id->setEditable(FALSE);
     // coloca a imagem de um livro
     $panel->put(new TImage('book.png'), 320, 20);
     // coloca o campo título no formulário
     $panel->put(new TLabel('Título'), 10, 40);
     $panel->put($titulo = new TEntry('titulo'), 100, 40);
     // coloca o campo autor no formulário
     $panel->put(new TLabel('Autor'), 10, 70);
     $panel->put($autor = new TEntry('autor'), 100, 70);
     // coloca o campo tema no formulário
     $panel->put(new TLabel('Tema'), 10, 100);
     $panel->put($tema = new TCombo('tema'), 100, 100);
     // cria um vetor com as opções da combo tema
     $items = array();
     $items['1'] = 'Administração';
     $items['2'] = 'Informática';
     $items['3'] = 'Economia';
     $items['4'] = 'Matemática';
     // adiciona os itens na combo
     $tema->addItems($items);
     // coloca o campo editora no formulário
     $editora = new TEntry('editora');
     $panel->put(new TLabel('Editora'), 10, 130);
     $panel->put($editora, 100, 130);
     // coloca o campo ano no formulário
     $panel->put(new TLabel('Ano'), 210, 130);
     $panel->put($ano = new TEntry('ano'), 260, 130);
     $editora->setSize(100);
     $ano->setSize(40);
     // coloca o campo resumo no formulário
     $panel->put(new TLabel('Resumo'), 10, 160);
     $panel->put($resumo = new TText('resumo'), 100, 160);
     // cria uma ação
     $panel->put($acao = new TButton('action1'), 320, 240);
     $acao->setAction(new TAction(array($this, 'onSave')), 'Salvar');
     // define quais são os campos do formulário
     $this->form->setFields(array($id, $titulo, $autor, $tema, $editora, $ano, $resumo, $acao));
     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_Customer_Report');
     $this->form->class = 'tform';
     // CSS class
     // creates a table
     $table = new TTable();
     $table->width = '100%';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $name = new TEntry('name');
     $city_id = new TDBSeekButton('city_id', 'samples', 'form_Customer_Report', 'City', 'name', 'city_id', 'city_name');
     $city_name = new TEntry('city_name');
     $category_id = new TDBCombo('category_id', 'samples', 'Category', 'id', 'name');
     $output_type = new TRadioGroup('output_type');
     $options = array('html' => 'HTML', 'pdf' => 'PDF', 'rtf' => 'RTF');
     $output_type->addItems($options);
     $output_type->setValue('pdf');
     $output_type->setLayout('horizontal');
     // define the sizes
     $name->setSize(200);
     $city_id->setSize(100);
     $category_id->setSize(100);
     $city_name->setEditable(FALSE);
     // add a row for the field name
     $row = $table->addRowSet(new TLabel('Report filters'), '');
     $row->class = 'tformtitle';
     // CSS class
     // add the fields into the table
     $table->addRowSet(new TLabel('Name' . ': '), $name);
     $table->addRowSet(new TLabel('City' . ': '), array($city_id, $city_name));
     $table->addRowSet(new TLabel('Category' . ': '), $category_id);
     $table->addRowSet(new TLabel('Output' . ': '), $output_type);
     // create an action button (save)
     $save_button = new TButton('generate');
     $save_button->setAction(new TAction(array($this, 'onGenerate')), 'Generate');
     $save_button->setImage('ico_save.png');
     // add a row for the form action
     $row = $table->addRowSet($save_button, '');
     $row->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($name, $city_id, $city_name, $category_id, $output_type, $save_button));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
示例#10
0
 /**
  * Shows the widget
  */
 public function show()
 {
     $tag = new TEntry($this->name);
     $tag->setEditable(FALSE);
     $tag->setProperty('id', $this->name);
     $tag->setSize(40);
     $tag->setProperty('onchange', "aux = document.getElementsByName('{$this->text_name}'); aux[0].value = this.value;");
     $tag->show();
     // define the tag properties
     $this->tag->name = $this->text_name;
     $this->tag->onchange = "entry = document.getElementById('{$this->name}'); entry.value = this.value;";
     $this->tag->style = "width:{$this->size}px;";
     // tamanho em pixels
     // creates an empty <option> tag
     $option = new TElement('option');
     $option->add('');
     $option->value = '0';
     // valor da TAG
     // add the option tag to the combo
     $this->tag->add($option);
     if ($this->items) {
         // iterate the combobox items
         foreach ($this->items as $chave => $item) {
             // creates an <option> tag
             $option = new TElement('option');
             $option->value = $chave;
             // define the index
             $option->add($item);
             // add the item label
             // verify if this option is selected
             if ($chave == $this->value) {
                 // mark as selected
                 $option->selected = 1;
             }
             // add the option to the combo
             $this->tag->add($option);
         }
     }
     // verify whether the widget is editable
     if (!parent::getEditable()) {
         // make the widget read-only
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
     }
     // shows the combobox
     $this->tag->show();
 }
 /**
  * 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);
 }
示例#12
0
 function __construct()
 {
     parent::__construct();
     //Instancia um novo Formulario
     $this->form = new TForm('livroForm');
     //Isntancia o Painel
     $painel = new TPanel('400', '300');
     $this->form->add($painel);
     //Coloca o campo ID no Formulario
     $painel->put(new TLabel('ID'), '10', '10');
     $painel->put($id = new TEntry('id'), '100', '10');
     $id->setSize('100');
     $id->setEditable(false);
     //Coloca o campo titulo no formulario
     $painel->put(new TLabel('Titulo'), '10', '40');
     $painel->put($titulo = new TEntry('titulo'), '100', '40');
     //Coloca o campo autor no formulario
     $painel->put(new TLabel('Autor'), '10', '70');
     $painel->put($autor = new TEntry('autor'), '100', '70');
     //coloca o campo tema no formulario
     $painel->put(new TLabel('Tema'), '10', '100');
     $painel->put($tema = new TCombo('tema'), '100', '100');
     //Cria um vetor com as opções da Combo Tema
     $itens = array();
     $itens['1'] = 'Administração';
     $itens['2'] = 'Matematica';
     $itens['3'] = 'Informatica';
     //Adiciona os na Combo
     $tema->addItems($itens);
     //Coloca o campo editora no formulario
     $painel->put(new TLabel('Editora'), '10', '130');
     $painel->put($editora = new TEntry('editora'), '100', '130');
     $editora->setSize('100');
     //Coloca o campo ano no formulario
     $painel->put(new TLabel('Ano'), '210', '130');
     $painel->put($ano = new TEntry('ano'), '260', '130');
     $ano->setSize('40');
     //coloca o campo resumo no formulario
     $painel->put(new TLabel('Remuno'), '10', '160');
     $painel->put($resumo = new TText('resumo'), '100', '160');
     //Cria uma Ação
     $painel->put($acao = new TButton('action'), '320', '240');
     $acao->setAction(new TAction(array($this, 'onSave')), 'Salvar');
     //Define quais são os Campos do Formulario
     $this->form->setFields(array($id, $titulo, $autor, $tema, $editora, $ano, $resumo, $acao));
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // creates a table
     $table = new TTable();
     // creates a label with the title
     $title = new TLabel('Table Multi Cell');
     $title->setFontSize(18);
     $title->setFontFace('Arial');
     $title->setFontColor('red');
     // adds a row to the table
     $row = $table->addRow();
     $title = $row->addCell($title);
     $title->colspan = 2;
     // creates a series of input widgets
     $id = new TEntry('id');
     $name = new TEntry('name');
     $min = new TEntry('min');
     $max = new TEntry('max');
     $start_date = new TDate('start_date');
     $end_date = new TDate('end_date');
     $address = new TEntry('address');
     // adjust the size of the code
     $id->setSize(70);
     $start_date->setSize(70);
     $end_date->setSize(70);
     $min->setSize(87);
     $max->setSize(87);
     // add rows for the fields
     $table->addRowSet(new TLabel('Code'), $id);
     $table->addRowSet(new TLabel('Name'), $name);
     // first approach
     $table->addRowSet(new TLabel('Value'), array($min, new TLabel('To'), $max));
     // second approach
     $row = $table->addRow();
     $row->addCell(new TLabel('Date'));
     $row->addMultiCell($start_date, $end_date);
     $table->addRowSet(new TLabel('Address'), $address);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($table);
     parent::add($vbox);
 }
 function __construct()
 {
     parent::__construct('form_conclui_venda');
     // instancia uma tabela
     $table = new TTable();
     // adiciona a tabela ao formulário
     parent::add($table);
     // cria os campos do formulário
     $cliente = new TEntry('id_cliente');
     $desconto = new TEntry('desconto');
     $valor_total = new TEntry('valor_total');
     $valor_pago = new TEntry('valor_pago');
     // define alguns atributos para os campos do formulário
     $valor_total->setEditable(FALSE);
     $cliente->setSize(100);
     $desconto->setSize(100);
     $valor_total->setSize(100);
     $valor_pago->setSize(100);
     // adiciona uma linha para o campo cliente
     $row = $table->addRow();
     $row->addCell(new TLabel('Cliente:'));
     $row->addCell($cliente);
     // adiciona uma linha para o campo desconto
     $row = $table->addRow();
     $row->addCell(new TLabel('Desconto:'));
     $row->addCell($desconto);
     // adiciona uma linha para o campo valor total
     $row = $table->addRow();
     $row->addCell(new TLabel('Valor Total:'));
     $row->addCell($valor_total);
     // adiciona uma linha para o campo valor pago
     $row = $table->addRow();
     $row->addCell(new TLabel('Valor Pago:'));
     $row->addCell($valor_pago);
     // cria um botão de ação para o formulário
     $this->button = new TButton('action1');
     // adiciona uma linha para as ações do formulário
     $row = $table->addRow();
     $row->addCell('');
     $row->addCell($this->button);
     // define quais são os campos do formulário
     parent::setFields(array($cliente, $desconto, $valor_total, $valor_pago, $this->button));
 }
 /**
  * 
  */
 public function makeTEntry($properties)
 {
     $widget = new TEntry((string) $properties->{'name'});
     $widget->setValue((string) $properties->{'value'});
     $widget->setMask((string) $properties->{'mask'});
     $widget->setSize((int) $properties->{'width'});
     if (isset($properties->{'maxlen'})) {
         $widget->setMaxLength((int) $properties->{'maxlen'});
     }
     if (isset($properties->{'tip'})) {
         $widget->setTip((string) $properties->{'tip'});
     }
     if (isset($properties->{'required'}) and $properties->{'required'} == '1') {
         $widget->addValidation((string) $properties->{'name'}, new TRequiredValidator());
     }
     $widget->setEditable((string) $properties->{'editable'});
     $this->fields[] = $widget;
     $this->fieldsByName[(string) $properties->{'name'}] = $widget;
     return $widget;
 }
 /**
  * Class constructor
  * Creates the page
  */
 public function __construct()
 {
     parent::__construct();
     // creates the customer form and add a table inside it
     $this->form = new TQuickForm('form');
     $this->form->class = 'tform';
     $this->form->setFormTitle('Customer');
     // create the form fields
     $customer_id = new TDBSeekButton('customer_id', 'samples', 'form', 'Customer', 'name', 'customer_id', 'customer_name');
     $customer_name = new TEntry('customer_name');
     $this->form->addQuickFields('Customer', array($customer_id, $customer_name));
     $this->form->addQuickAction('Check status', new TAction(array($this, 'onCheckSales')), 'ico_apply.png');
     $customer_id->setSize(50);
     $customer_name->setSize(400);
     $customer_name->setEditable(FALSE);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // creates a table
     $table = new TTable();
     // creates a label with the title
     $title = new TLabel('Table Columns');
     $title->setFontSize(18);
     $title->setFontFace('Arial');
     $title->setFontColor('red');
     // adds a row to the table
     $row = $table->addRow();
     $title = $row->addCell($title);
     $title->colspan = 2;
     // creates a series of input widgets
     $id = new TEntry('id');
     $name = new TEntry('name');
     $address = new TEntry('address');
     $telephone = new TEntry('telephone');
     $city = new TCombo('city');
     $text = new TText('text');
     $items = array();
     $items['1'] = 'Porto Alegre';
     $items['2'] = 'Lajeado';
     $city->addItems($items);
     // adjust the size of the code
     $id->setSize(70);
     // add rows for the fields
     $table->addRowSet(new TLabel('Code'), $id);
     $table->addRowSet(new TLabel('Name'), $name);
     $table->addRowSet(new TLabel('City'), $city);
     $table->addRowSet(new TLabel('Address'), $address);
     $table->addRowSet(new TLabel('Telephone'), $telephone);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($table);
     parent::add($vbox);
 }
示例#18
0
 /**
  * Class constructor
  * Creates the page, the search form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     new TSession();
     // creates the form
     $this->form = new TForm('form_listar_crm_clientes');
     $key = $_GET['key'];
     // create the form fields
     $name = new TEntry('nome');
     $name->setSize(170);
     $table = new TTable();
     $row = $table->addRow();
     $cell = $row->addCell('');
     $cell->width = PHP_SAPI == 'cli' ? 40 : 80;
     $row->addCell($name);
     $this->form->add($table);
     // creates the action button
     $button1 = new TButton('find');
     $button1->setAction(new TAction(array($this, 'onSearch')), 'Buscar');
     $button1->setImage('ico_find.png');
     // create an action button
     $button2 = new TButton('novo');
     $action2 = new TAction(array('CRMForm', 'onEdit'));
     $action2->setParameter('key', $key);
     $button2->setImage('ico_new.png');
     $button2->setAction($action2, 'Novo');
     $button3 = new TButton('csv');
     $button3->setAction(new TAction(array($this, 'onExportCSV')), 'CSV');
     $button3->setImage('ico_print.png');
     // create an action button
     $button4 = new TButton('action3');
     $action4 = new TAction(array('ClienteList', 'onReload'));
     //        $action3->setParameter('key', $_GET['key']);
     $action4->setParameter('key', $key);
     $button4->setImage('ico_previous.png');
     $button4->setAction($action4, 'Voltar');
     $row->addCell($button1);
     $row->addCell($button2);
     $row->addCell($button3);
     $row->addCell($button4);
     $this->form->setFields(array($name, $button1, $button2, $button3, $button4));
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     //        $this->datagrid->setHeight(200);
     // create the datagrid columns
     $dgid = new TDataGridColumn('id', 'Id', 'right', 70);
     $dgtitulo = new TDataGridColumn('titulo', 'Titulo', 'left', 180);
     $dgprojeto = new TDataGridColumn('projeto_nome', 'Projeto', 'left', 180);
     $dgdata = new TDataGridColumn('data_crm', 'Data', 'left', 160);
     $dgtempo = new TDataGridColumn('tempo', 'Tempo', 'left', 160);
     $dgdescricao = new TDataGridColumn('descricao', 'Descrição', 'left', 160);
     $dgsolicitante = new TDataGridColumn('solicitante', 'Solicitante', 'left', 160);
     $dgresponsavel = new TDataGridColumn('tipo_nome', 'Tipo', 'left', 160);
     $dgcliente = new TDataGridColumn('cliente_nome', 'Cliente', 'left', 160);
     $dgnome = new TDataGridColumn('prioridade_nome', 'Prioridade', 'left', 160);
     $dgstatus = new TDataGridColumn('status_nome', 'Status', 'left', 160);
     // add the columns to the datagrid
     $this->datagrid->addColumn($dgid);
     $this->datagrid->addColumn($dgtitulo);
     $this->datagrid->addColumn($dgprojeto);
     $this->datagrid->addColumn($dgdata);
     $this->datagrid->addColumn($dgtempo);
     $this->datagrid->addColumn($dgdescricao);
     $this->datagrid->addColumn($dgsolicitante);
     $this->datagrid->addColumn($dgresponsavel);
     $this->datagrid->addColumn($dgcliente);
     $this->datagrid->addColumn($dgnome);
     $this->datagrid->addColumn($dgstatus);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('CRMForm', 'onEdit'));
     $action1->setLabel('Editar');
     $action1->setImage('ico_edit.png');
     $action1->setField('id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel('Delete');
     $action2->setImage('ico_delete.png');
     $action2->setField('id');
     //        $obj = ClienteRegistroDetalhe();
     $action3 = new TDataGridAction(array('ClienteRegistroDetalhe', 'onEdit'));
     $action3->setLabel('Registros');
     $action3->setImage('ico_custom_form.png');
     $action3->setField('id');
     $action3->setParameter('fk', $_GET['key']);
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     $this->datagrid->addAction($action3);
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a table
     $table = new TTable();
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
 function __construct()
 {
     parent::__construct();
     // instancia um formulário
     $this->form = new TForm('form_clientes');
     // instancia uma tabela
     $table = new TTable();
     // adiciona a tabela ao formulário
     $this->form->add($table);
     // cria os campos do formulário
     $codigo = new TEntry('id');
     $nome = new TEntry('nome');
     $endereco = new TEntry('endereco');
     $telefone = new TEntry('telefone');
     $cidade = new TCombo('id_cidade');
     // define alguns atributos para os campos do formulário
     $codigo->setEditable(FALSE);
     $codigo->setSize(100);
     $nome->setSize(300);
     $endereco->setSize(300);
     // carrega as cidades do banco de dados
     TTransaction::open('pg_livro');
     // instancia um repositório de Cidade
     $repository = new TRepository('Cidade');
     // carrega todos os objetos
     $collection = $repository->load(new TCriteria());
     // adiciona objetos na combo
     foreach ($collection as $object) {
         $items[$object->id] = $object->nome;
     }
     $cidade->addItems($items);
     TTransaction::close();
     // adiciona uma linha para o campo código
     $row = $table->addRow();
     $row->addCell(new TLabel('Código:'));
     $row->addCell($codigo);
     // adiciona uma linha para o campo nome
     $row = $table->addRow();
     $row->addCell(new TLabel('Nome:'));
     $row->addCell($nome);
     // adiciona uma linha para o campo endereço
     $row = $table->addRow();
     $row->addCell(new TLabel('Endereco:'));
     $row->addCell($endereco);
     // adiciona uma linha para o campo telefone
     $row = $table->addRow();
     $row->addCell(new TLabel('Telefone:'));
     $row->addCell($telefone);
     // adiciona uma linha para o campo cidade
     $row = $table->addRow();
     $row->addCell(new TLabel('Cidade:'));
     $row->addCell($cidade);
     // cria um botão de ação para o formulário
     $button1 = new TButton('action1');
     // define a ação do botão
     $button1->setAction(new TAction(array($this, 'onSave')), 'Salvar');
     // adiciona uma linha para a ação do formulário
     $row = $table->addRow();
     $row->addCell('');
     $row->addCell($button1);
     // define quais são os campos do formulário
     $this->form->setFields(array($codigo, $nome, $endereco, $telefone, $cidade, $button1));
     // adiciona o formulário na página
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page, the search form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     new TSession();
     // creates the form
     $this->form = new TForm('form_search_customer');
     // create the form fields
     $name = new TEntry('name');
     $city_name = new TEntry('city_name');
     $name->setSize(170);
     $city_name->setSize(126);
     $name->setValue(TSession::getValue('customer_name'));
     $city_name->setValue(TSession::getValue('customer_city_name'));
     $table = new TTable();
     $row = $table->addRow();
     $cell = $row->addCell('');
     $cell->width = 80;
     $row->addCell($name);
     $cell = $row->addCell('');
     $row->addCell($city_name);
     $this->form->add($table);
     // creates the action button
     $button1 = new TButton('find');
     $button1->setAction(new TAction(array($this, 'onSearch')), 'Find');
     $button1->setImage('ico_find.png');
     $button2 = new TButton('new');
     $button2->setAction(new TAction(array('CustomerFormView', 'onEdit')), 'New');
     $button2->setImage('ico_new.png');
     $button3 = new TButton('csv');
     $button3->setAction(new TAction(array($this, 'onExportCSV')), 'CSV');
     $button3->setImage('ico_print.png');
     $row->addCell($button1);
     $row->addCell($button2);
     $row->addCell($button3);
     $this->form->setFields(array($name, $city_name, $button1, $button2, $button3));
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(200);
     // creates the datagrid columns
     $this->datagrid->addQuickColumn('Id', 'id', 'right', 40, new TAction(array($this, 'onReload')), array('order', 'id'));
     $this->datagrid->addQuickColumn('Name', 'name', 'left', 170, new TAction(array($this, 'onReload')), array('order', 'name'));
     $this->datagrid->addQuickColumn('City', 'city->name', 'left', 140, new TAction(array($this, 'onReload')), array('order', 'city->name'));
     $this->datagrid->addQuickColumn('Address', 'address', 'left', 190);
     // creates two datagrid actions
     $this->datagrid->addQuickAction('Edit', new TDataGridAction(array('CustomerFormView', 'onEdit')), 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction('Delete', new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png');
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     $vbox->add($this->datagrid);
     $vbox->add($this->pageNavigation);
     // add the box inside the page
     parent::add($vbox);
 }
示例#21
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public 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_search_Issue');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->width = '100%';
     $table->addRowSet(new TLabel(_t('Issues')), '', '', '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $filter_status = new TDBCombo('id_status', 'changeman', 'Status', 'id', 'description_translated');
     $filter_project = new TDBCombo('id_project', 'changeman', 'Project', 'id', 'description');
     $filter_priority = new TDBCombo('id_priority', 'changeman', 'Priority', 'id', 'description_translated');
     $filter_category = new TDBCombo('id_category', 'changeman', 'Category', 'id', 'description_translated');
     $filter_title = new TEntry('title');
     $filter_status->setValue(TSession::getValue('Issue_id_status'));
     $filter_project->setValue(TSession::getValue('Issue_id_project'));
     $filter_priority->setValue(TSession::getValue('Issue_id_priority'));
     $filter_category->setValue(TSession::getValue('Issue_id_category'));
     $filter_title->setValue(TSession::getValue('Issue_title'));
     $filter_title->setSize(480);
     // add a row for the filter field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Status') . ': '));
     $row->addCell($filter_status);
     $row->addCell(new TLabel(_t('Project') . ': '));
     $row->addCell($filter_project);
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Priority') . ': '));
     $row->addCell($filter_priority);
     $row->addCell(new TLabel(_t('Category') . ': '));
     $row->addCell($filter_category);
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Title') . ': '));
     $cell = $row->addCell($filter_title);
     $cell->colspan = 3;
     // create two action buttons to the form
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('ico_find.png');
     TTransaction::open('changeman');
     if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'CUSTOMER') {
         $class = 'NewIssueForm';
         $new_button->setAction(new TAction(array($class, 'onEdit')), _t('New'));
         $new_button->setImage('ico_new.png');
     } else {
         $class = 'UpdateIssueForm';
         $new_button->setAction(new TAction(array($class, 'onEdit')), _t('New'));
         $new_button->setImage('ico_new.png');
     }
     TTransaction::close();
     $buttons = new THBox();
     $buttons->add($find_button);
     $buttons->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 4;
     // define wich are the form fields
     $this->form->setFields(array($filter_status, $filter_project, $filter_priority, $filter_category, $filter_title, $find_button, $new_button));
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'right', 50);
     $title = new TDataGridColumn('title', _t('Title'), 'left', 260);
     $id_status = new TDataGridColumn('status', _t('Status'), 'left', 100);
     $id_priority = new TDataGridColumn('priority', _t('Priority'), 'left', 100);
     $id_category = new TDataGridColumn('category', _t('Category'), 'left', 100);
     $register_date = new TDataGridColumn('register_date', _t('Start date'), 'left', 110);
     // creates the datagrid actions
     $order1 = new TAction(array($this, 'onReload'));
     $order2 = new TAction(array($this, 'onReload'));
     $order3 = new TAction(array($this, 'onReload'));
     $order4 = new TAction(array($this, 'onReload'));
     $order5 = new TAction(array($this, 'onReload'));
     $order6 = new TAction(array($this, 'onReload'));
     $order7 = new TAction(array($this, 'onReload'));
     $order8 = new TAction(array($this, 'onReload'));
     // define the ordering parameters
     $order1->setParameter('order', 'id');
     $order2->setParameter('order', 'title');
     $order3->setParameter('order', 'id_status');
     $order4->setParameter('order', 'id_priority');
     $order5->setParameter('order', 'id_category');
     $order6->setParameter('order', 'register_date');
     // assign the ordering actions
     $id->setAction($order1);
     $title->setAction($order2);
     $id_status->setAction($order3);
     $id_priority->setAction($order4);
     $id_category->setAction($order5);
     $register_date->setAction($order6);
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($title);
     $this->datagrid->addColumn($id_status);
     $this->datagrid->addColumn($id_priority);
     $this->datagrid->addColumn($id_category);
     $this->datagrid->addColumn($register_date);
     // security check
     TTransaction::open('changeman');
     if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'ADMINISTRATOR' or Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'MANAGER') {
         // creates two datagrid actions
         $class = 'UpdateIssueForm';
         $action1 = new TDataGridAction(array($class, 'onEdit'));
         $action1->setLabel(_t('Edit'));
         $action1->setImage('ico_edit.png');
         $action1->setField('id');
         $action2 = new TDataGridAction(array($this, 'onDelete'));
         $action2->setLabel(_t('Delete'));
         $action2->setImage('ico_delete.png');
         $action2->setField('id');
         // add the actions to the datagrid
         $this->datagrid->addAction($action1);
         $this->datagrid->addAction($action2);
     } else {
         if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'MEMBER') {
             // creates two datagrid actions
             $class = 'UpdateIssueForm';
             $action1 = new TDataGridAction(array($class, 'onEdit'));
             $action1->setLabel(_t('Edit'));
             $action1->setImage('ico_edit.png');
             $action1->setField('id');
             // add the actions to the datagrid
             $this->datagrid->addAction($action1);
         }
     }
     // creates two datagrid actions
     $class = 'ViewIssueForm';
     $action3 = new TDataGridAction(array($class, 'onView'));
     $action3->setLabel(_t('View'));
     $action3->setImage('ico_view.png');
     $action3->setField('id');
     $class = 'NoteForm';
     $action4 = new TDataGridAction(array($class, 'onEdit'));
     $action4->setLabel(_t('Comment'));
     $action4->setImage('ico_new.png');
     $action4->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action3);
     $this->datagrid->addAction($action4);
     TTransaction::close();
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a vbox
     $container = new TVBox();
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     // add the vbox inside the page
     parent::add($container);
 }
示例#22
0
$painel->put($imagem, '320', '120');
//Cria uma serie de Campos de entrada de dados
$codigo = new TEntry('codigo');
$nome = new TEntry('nome');
$endereco = new TEntry('endereco');
$telefone = new TEntry('telefone');
$cidade = new TCombo('cidade');
$itens = array();
$itens['1'] = 'Porto Alegre';
$itens['2'] = 'Lajeado';
$cidade->addItems($itens);
//Ajusta o Tamanho destes Campos
$codigo->setSize('70');
$nome->setSize('140');
$endereco->setSize('140');
$telefone->setSize('140');
$cidade->setSize('140');
//Cria uma serie de Rotulos de Texto
$label1 = new TLabel('Código');
$label2 = new TLabel('Nome');
$label3 = new TLabel('Cidade');
$label4 = new TLabel('Endereço');
$label5 = new TLabel('Telefone');
//Posiciona os Campos e os Rotulos dentro do Painel
$painel->put($label1, '10', '40');
$painel->put($codigo, '10', '60');
$painel->put($label2, '10', '90');
$painel->put($nome, '10', '110');
$painel->put($label3, '10', '140');
$painel->put($cidade, '10', '160');
$painel->put($label4, '200', '40');
$nome = new TEntry('nome');
$endereco = new TEntry('endereco');
$datanasc = new TEntry('datanasc');
$sexo = new TRadioGroup('sexo');
$linguas = new TCheckGroup('linguas');
$qualifica = new TText('qualifica');
// define tamanho para campo código
$codigo->setSize(100);
// define como somente leitura
$codigo->setEditable(FALSE);
// cria um vetor com as opções de sexo
$items = array();
$items['M'] = 'Masculino';
$items['F'] = 'Feminino';
// define tamanho para campo data de nascimento
$datanasc->setSize(100);
// adiciona as opções ao radio button
$sexo->addItems($items);
// define a opção ativa
$sexo->setValue('M');
// define a posição dos elementos
$sexo->setLayout('horizontal');
// cria um vetor com as opções de idiomas
$items = array();
$items['E'] = 'Inglês';
$items['S'] = 'Espanhol';
$items['I'] = 'Italiano';
$items['F'] = 'Francês';
// adiciona as opções ao check button
$linguas->addItems($items);
// define as opções ativas
 function __construct()
 {
     parent::__construct();
     // instancia um formulário
     $this->form = new TForm('form_produtos');
     // instancia uma tabela
     $table = new TTable();
     // adiciona a tabela ao formulário
     $this->form->add($table);
     // cria os campos do formulário
     $codigo = new TEntry('id');
     $descricao = new TEntry('descricao');
     $estoque = new TEntry('estoque');
     $preco_custo = new TEntry('preco_custo');
     $preco_venda = new TEntry('preco_venda');
     $fabricante = new TCombo('id_fabricante');
     // carrega os fabricantes do banco de dados
     TTransaction::open('pg_livro');
     // instancia um repositório de Fabricante
     $repository = new TRepository('Fabricante');
     // carrega todos objetos
     $collection = $repository->load(new TCriteria());
     // adiciona objetos na combo
     foreach ($collection as $object) {
         $items[$object->id] = $object->nome;
     }
     $fabricante->addItems($items);
     TTransaction::close();
     // define alguns atributos para os campos do formulário
     $codigo->setEditable(FALSE);
     $codigo->setSize(100);
     $estoque->setSize(100);
     $preco_custo->setSize(100);
     $preco_venda->setSize(100);
     // adiciona uma linha para o campo código
     $row = $table->addRow();
     $row->addCell(new TLabel('Código:'));
     $row->addCell($codigo);
     // adiciona uma linha para o campo descrição
     $row = $table->addRow();
     $row->addCell(new TLabel('Descrição:'));
     $row->addCell($descricao);
     // adiciona uma linha para o campo estoque
     $row = $table->addRow();
     $row->addCell(new TLabel('Estoque:'));
     $row->addCell($estoque);
     // adiciona uma linha para o campo preco de custo
     $row = $table->addRow();
     $row->addCell(new TLabel('Preço Custo:'));
     $row->addCell($preco_custo);
     // adiciona uma linha para o campo preço de venda
     $row = $table->addRow();
     $row->addCell(new TLabel('Preço Venda:'));
     $row->addCell($preco_venda);
     // adiciona uma linha para o campo fabricante
     $row = $table->addRow();
     $row->addCell(new TLabel('Fabricante:'));
     $row->addCell($fabricante);
     // cria um botão de ação para o formulário
     $button1 = new TButton('action1');
     // define a ação dos botão
     $button1->setAction(new TAction(array($this, 'onSave')), 'Salvar');
     // adiciona uma linha para a ação do formulário
     $row = $table->addRow();
     $row->addCell('');
     $row->addCell($button1);
     // define quais são os campos do formulário
     $this->form->setFields(array($codigo, $descricao, $estoque, $preco_custo, $preco_venda, $fabricante, $button1));
     // adiciona o formulário na página
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the table container
     $table = new TTable();
     $table->style = 'width:100%';
     $frame_programs = new TFrame();
     $frame_programs->setLegend(_t('Programs'));
     // creates the form
     $this->form = new TForm('form_System_group');
     $this->form->class = 'tform';
     // add the notebook inside the form
     $this->form->add($table);
     $table->addRowSet(new TLabel(_t('Group')), '')->class = 'tformtitle';
     // create the form fields
     $id = new TEntry('id');
     $name = new TEntry('name');
     $multifield = new TMultiField('programs');
     $program_id = new TDBSeekButton('program_id', 'permission', 'form_System_group', 'SystemProgram', 'name', 'programs_id', 'programs_name');
     $program_name = new TEntry('program_name');
     $frame_programs->add($multifield);
     $multifield->setHeight(140);
     $multifield->setClass('SystemProgram');
     $multifield->addField('id', _t('Program') . ' ID', $program_id, 100, true);
     $multifield->addField('name', _t('Name'), $program_name, 250);
     $multifield->setOrientation('horizontal');
     // define the sizes
     $program_id->setSize(70);
     $id->setSize(100);
     $name->setSize(200);
     // validations
     $name->addValidation('name', new TRequiredValidator());
     // outras propriedades
     $id->setEditable(false);
     $program_name->setEditable(false);
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel(_t('Name') . ': '), $name);
     // add a row for the field name
     $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')), _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('SystemGroupList', 'onReload')), _t('Back to the listing'));
     $list_button->setImage('ico_datagrid.png');
     // define the form fields
     $this->form->setFields(array($id, $name, $multifield, $save_button, $new_button, $list_button));
     $buttons = new THBox();
     $buttons->add($save_button);
     $buttons->add($new_button);
     $buttons->add($list_button);
     $container = new TTable();
     $container->width = '80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemGroupList'));
     $container->addRow()->addCell($this->form);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 2;
     // add the form to the page
     parent::add($container);
 }
示例#26
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public 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();
     // defines the database
     parent::setDatabase('changeman');
     // defines the active record
     parent::setActiveRecord('Member');
     // defines the filter field
     parent::setFilterField('name');
     parent::setLimit(50);
     // creates the form
     $this->form = new TForm('form_search_Member');
     // creates a table
     $table = new TTable();
     $table->width = '100%';
     // add the table inside the form
     $this->form->add($table);
     $this->form->class = 'tform';
     $table->addRowSet(new TLabel(_t('Members')), '')->class = 'tformtitle';
     // create the form fields
     $filter = new TEntry('name');
     $filter->setSize(400);
     $filter->setValue(TSession::getValue('Member_name'));
     // add a row for the filter field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Name') . ': '));
     $row->addCell($filter);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('ico_find.png');
     $class = 'MemberForm';
     $new_button->setAction(new TAction(array($class, 'onEdit')), _t('New'));
     $new_button->setImage('ico_new.png');
     $buttons = new THBox();
     $buttons->add($find_button);
     $buttons->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 2;
     // define wich are the form fields
     $this->form->setFields(array($filter, $find_button, $new_button));
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $this->datagrid->addQuickColumn('ID', 'id', 'right', 50, new TAction(array($this, 'onReload')), array('order', 'id'));
     $this->datagrid->addQuickColumn(_t('Name'), 'name', 'left', 160, new TAction(array($this, 'onReload')), array('order', 'name'));
     $this->datagrid->addQuickColumn(_t('Role'), 'role_description', 'left', 140, new TAction(array($this, 'onReload')), array('order', 'id_role'));
     $this->datagrid->addQuickColumn('Login', 'login', 'left', 100, new TAction(array($this, 'onReload')), array('order', 'login'));
     $this->datagrid->addQuickColumn('Email', 'email', 'left', 100, new TAction(array($this, 'onReload')), array('order', 'email'));
     $this->datagrid->addQuickColumn(_t('Active'), 'is_active', 'left', 70, new TAction(array($this, 'onReload')), array('order', 'active'));
     // add the actions to the datagrid
     $class = 'MemberForm';
     $this->datagrid->addQuickAction(_t('Edit'), new TDataGridAction(array($class, 'onEdit')), 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png');
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a vbox
     $container = new TVBox();
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     // add the vbox inside the page
     parent::add($container);
 }
示例#27
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);
 }
示例#28
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('library');
     if (User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'LIBRARIAN') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // creates the form
     $this->form = new TForm('form_Book');
     // creates a table
     $table1 = new TTable();
     $table2 = new TTable();
     $table3 = new TTable();
     $notebook = new TNotebook(550, 400);
     $notebook->appendPage(_t('Basic data'), $table1);
     $notebook->appendPage(_t('Secundary data'), $table2);
     $notebook->appendPage(_t('Items'), $table3);
     // add the table inside the form
     $this->form->add($notebook);
     // create the form fields
     $id = new TEntry('id');
     $title = new TEntry('title');
     $isbn = new TEntry('isbn');
     $call_number = new TEntry('call_number');
     $author_id = new TSeekButton('author_id');
     $author_name = new TEntry('author_name');
     $edition = new TEntry('edition');
     $volume = new TEntry('volume');
     $collection_id = new TDBCombo('collection_id', 'library', 'Collection', 'id', 'description');
     $classification_id = new TDBCombo('classification_id', 'library', 'Classification', 'id', 'description');
     $publisher_id = new TSeekButton('publisher_id');
     $publisher_name = new TEntry('publisher_name');
     $publish_place = new TEntry('publish_place');
     $publish_date = new TDate('publish_date');
     $abstract = new TText('abstract');
     $notes = new TText('notes');
     $obj = new TStandardSeek();
     $action = new TAction(array($obj, 'onSetup'));
     $action->setParameter('database', 'library');
     $action->setParameter('parent', 'form_Book');
     $action->setParameter('model', 'Publisher');
     $action->setParameter('display_field', 'name');
     $action->setParameter('receive_key', 'publisher_id');
     $action->setParameter('receive_field', 'publisher_name');
     $publisher_id->setAction($action);
     $obj = new TStandardSeek();
     $action = new TAction(array($obj, 'onSetup'));
     $action->setParameter('database', 'library');
     $action->setParameter('parent', 'form_Book');
     $action->setParameter('model', 'Author');
     $action->setParameter('display_field', 'name');
     $action->setParameter('receive_key', 'author_id');
     $action->setParameter('receive_field', 'author_name');
     $author_id->setAction($action);
     // define the sizes
     $id->setSize(100);
     $title->setSize(340);
     $isbn->setSize(120);
     $call_number->setSize(120);
     $author_id->setSize(100);
     $edition->setSize(120);
     $volume->setSize(120);
     $collection_id->setSize(100);
     $classification_id->setSize(100);
     $publisher_id->setSize(100);
     $publish_place->setSize(140);
     $publish_date->setSize(100);
     $abstract->setSize(400, 40);
     $notes->setSize(400, 40);
     $id->setEditable(FALSE);
     $publisher_name->setEditable(FALSE);
     $author_name->setEditable(FALSE);
     // add a row for the field id
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Code')));
     $cell = $row->addCell($id);
     $cell->colspan = 3;
     // add a row for the field title
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Title')));
     $cell = $row->addCell($title);
     $cell->colspan = 3;
     // add a row for the field isbn/call_nuber
     $row = $table1->addRow();
     $row->addCell(new TLabel('ISBN' . ': '));
     $row->addCell($isbn);
     $row->addCell(new TLabel(_t('Call')));
     $row->addCell($call_number);
     // add a row for the field author_id
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Author') . ': '));
     $row->addCell($author_id);
     $row->addCell(new TLabel(_t('Name') . ': '));
     $row->addCell($author_name);
     // add a row for the field edition/volume
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Edition') . ': '));
     $row->addCell($edition);
     $row->addCell(new TLabel(_t('Volume') . ': '));
     $row->addCell($volume);
     // add a row for the field collection_id/classification_id
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Collection') . ': '));
     $row->addCell($collection_id);
     $row->addCell(new TLabel(_t('Classification') . ': '));
     $row->addCell($classification_id);
     // add a row for the field publisher_id
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Publisher') . ': '));
     $row->addCell($publisher_id);
     $row->addCell(new TLabel(_t('Name') . ': '));
     $row->addCell($publisher_name);
     // add a row for the field publish_place
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Place') . ': '));
     $row->addCell($publish_place);
     $row->addCell(new TLabel(_t('Date') . ': '));
     $row->addCell($publish_date);
     // add a row for the field abstract
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Abstract') . ': '));
     $cell = $row->addCell($abstract);
     $cell->colspan = 3;
     // add a row for the field notes
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Notes') . ': '));
     $cell = $row->addCell($notes);
     $cell->colspan = 3;
     // secundary authors
     $authors = new TMultiField('author_list');
     $sub_author_id = new TSeekButton('id');
     $sub_author_name = new TEntry('name');
     $sub_author_name->setEditable(FALSE);
     $sub_author_id->setSize(50);
     $sub_author_name->setSize(300);
     $obj = new TStandardSeek();
     $action = new TAction(array($obj, 'onSetup'));
     $action->setParameter('database', 'library');
     $action->setParameter('parent', 'form_Book');
     $action->setParameter('model', 'Author');
     $action->setParameter('display_field', 'name');
     $action->setParameter('receive_key', 'author_list_id');
     $action->setParameter('receive_field', 'author_list_name');
     $sub_author_id->setAction($action);
     $authors->setHeight(80);
     $authors->setClass('Author');
     $authors->addField('id', _t('Author'), $sub_author_id, 50);
     $authors->addField('name', _t('Name'), $sub_author_name, 300);
     $row = $table2->addRow();
     $row->addCell($l = new TLabel(_t('Authors')));
     $l->setFontStyle('b');
     $row = $table2->addRow();
     $row->addCell($authors);
     // secundary subjects
     $subjects = new TMultiField('subject_list');
     $sub_subject_id = new TSeekButton('id');
     $sub_subject_name = new TEntry('name');
     $sub_subject_name->setEditable(FALSE);
     $sub_subject_id->setSize(50);
     $sub_subject_name->setSize(300);
     $obj = new TStandardSeek();
     $action = new TAction(array($obj, 'onSetup'));
     $action->setParameter('database', 'library');
     $action->setParameter('parent', 'form_Book');
     $action->setParameter('model', 'Subject');
     $action->setParameter('display_field', 'name');
     $action->setParameter('receive_key', 'subject_list_id');
     $action->setParameter('receive_field', 'subject_list_name');
     $sub_subject_id->setAction($action);
     $subjects->setHeight(80);
     $subjects->setClass('Subject');
     $subjects->addField('id', _t('Subject'), $sub_subject_id, 50);
     $subjects->addField('name', _t('Name'), $sub_subject_name, 300);
     $row = $table2->addRow();
     $row->addCell($l = new TLabel(_t('Subjects')));
     $l->setFontStyle('b');
     $row = $table2->addRow();
     $row->addCell($subjects);
     // items
     $items = new TMultiField('item_list');
     $item_barcode = new TEntry('barcode');
     $item_status_id = new TComboCombined('status_id', 'status_description');
     $item_cost = new TEntry('cost');
     $item_acquire_date = new TDate('acquire_date');
     $item_notes = new TEntry('notes');
     $item_status_id->setSize(150);
     $item_cost->setSize(100);
     $item_acquire_date->setSize(100);
     TTransaction::open('library');
     $rep = new TRepository('Status');
     $objects = $rep->load(new TCriteria());
     $options = array();
     if ($objects) {
         foreach ($objects as $object) {
             $options[$object->id] = $object->description;
         }
     }
     $item_status_id->addItems($options);
     TTransaction::close();
     $items->setHeight(140);
     $items->setClass('Item');
     $items->addField('barcode', _t('Barcode'), $item_barcode, 80);
     $items->addField('status_id', _t('Status'), $item_status_id, 100);
     $items->addField('cost', _t('Cost'), $item_cost, 80);
     $items->addField('acquire_date', _t('Acquire date'), $item_acquire_date, 80);
     $items->addField('notes', _t('Notes'), $item_notes, 150);
     $row = $table3->addRow();
     $row->addCell($l = new TLabel(_t('Items')));
     $l->setFontStyle('b');
     $row = $table3->addRow();
     $row->addCell($items);
     // 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');
     // add a row for the form action
     $row = $table1->addRow();
     $row->addCell($save_button);
     // define wich are the form fields
     $this->form->setFields(array($id, $title, $isbn, $call_number, $author_id, $author_name, $edition, $volume, $collection_id, $classification_id, $publisher_id, $publisher_name, $publish_place, $publish_date, $abstract, $notes, $authors, $subjects, $items, $save_button));
     // add the form to the page
     parent::add($this->form);
 }
示例#29
0
 /**
  * método construtor
  * Cria a página e o formulário de cadastro
  */
 function __construct()
 {
     parent::__construct();
     $this->form = new TForm('form_person');
     $this->form->{'class'} = 'tform';
     // CSS class
     $this->form->{'style'} = 'width:570px';
     $vbox = new TVBox();
     $this->form->add($vbox);
     $table = new TTable();
     $table_buttons = new TTable();
     $table->{'width'} = '100%';
     $vbox->add($table);
     //TSession::freeSession();
     $row = $table->addRow();
     $row->class = 'tformtitle';
     $cell = $row->addCell(new TLabel('TESTE'));
     $cell->colspan = 2;
     $id = new TEntry('id');
     $name = new TEntry('name');
     $address = new TEntry('address');
     $code = new TEntry('code');
     $description = new TEntry('description');
     $value = new TEntry('value');
     $code->setSize(40);
     $value->setSize(140);
     $table->addRowSet(new TLabel('ID'), $id);
     $table->addRowSet(new TLabel('Name'), $name);
     $table->addRowSet(new TLabel('Address'), $address);
     $frame = new TFrame(460, 70);
     $frame->setLegend('Itens');
     $row = $table->addRow();
     $row->addCell($frame)->colspan = 2;
     $add_button = new TButton('add');
     $delAction = new TAction(array($this, 'onAddDado'));
     $add_button->setAction($delAction, 'Save');
     $add_button->setImage('ico_save.png');
     $subtable = new TTable();
     $frame->add($subtable);
     $subtable->addRowSet(new TLabel('Code'), new TLabel('Descrição'), new TLabel('Valor'));
     $subtable->addRowSet($code, $description, $value, $add_button);
     $this->lista = new TQuickGrid();
     $this->lista->setHeight(200);
     $this->lista->makeScrollable();
     $this->lista->addQuickColumn('', 'edit', 'left', 40);
     $this->lista->addQuickColumn('', 'delete', 'left', 40);
     $this->lista->addQuickColumn('Código', 'code', 'left', 40);
     $this->lista->addQuickColumn('Descricao', 'description', 'left', 300);
     $this->lista->addQuickColumn('Valor', 'value', 'left', 100);
     $this->lista->createModel();
     $vbox->add($this->lista);
     $row = $table->addRow();
     $row->addCell($this->lista)->colspan = 2;
     // cria um botão de ação (salvar)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('ico_save.png');
     // cria um botão de ação (novo)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New'));
     $new_button->setImage('ico_new.png');
     // define quais são os campos do formulário
     $this->formFields = array($id, $name, $address, $code, $description, $value, $save_button, $new_button, $add_button);
     $this->form->setFields($this->formFields);
     // add a row for the form action
     $row = $table_buttons->addRow();
     $row->addCell($save_button);
     $row->addCell($new_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($table_buttons);
     $cell->colspan = 2;
     $this->form->add($table);
     parent::add($this->form);
 }
示例#30
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the table container
     $table = new TTable();
     $table->style = 'width:100%';
     $frame_programs = new TFrame();
     // creates the form
     $this->form = new TForm('form_System_Receipt');
     $this->form->class = 'tform';
     // add the notebook inside the form
     $this->form->add($table);
     $row1 = $table->addRow();
     $row1->class = 'tformtitle';
     $cell1 = $row1->addCell(new TLabel('Add new receipt'), '');
     $cell1->colspan = 2;
     // create the form fields
     $id = new TEntry('id');
     $client = new TDBCombo('client', 'permission', 'SystemClients', 'name', 'name');
     $amount = new TEntry('account_money');
     $date = new TDate('date');
     $id->setEditable(false);
     // define the sizes
     $id->setSize(100);
     $client->setSize(300);
     $amount->setSize(300);
     $date->setSize(300);
     // validations
     $client->addValidation('client', new TRequiredValidator());
     $amount->addValidation('account_money', new TRequiredValidator());
     $date->addValidation('date', new TRequiredValidator());
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('Client: '), $client);
     $table->addRowSet(new TLabel('Account money: '), $amount);
     $table->addRowSet(new TLabel('Date: '), $date);
     // 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('SystemInvoicesList', 'onReload')), _t('Back to the listing'));
     $list_button->setImage('fa:table blue');
     // define the form fields
     $this->form->setFields(array($id, $client, $amount, $date, $save_button, $new_button, $list_button));
     $buttons = new THBox();
     $buttons->add($save_button);
     $buttons->add($new_button);
     $buttons->add($list_button);
     $container = new TTable();
     $container->width = '80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemInvoicesList'));
     $container->addRow()->addCell($this->form);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 2;
     // add the form to the page
     parent::add($container);
 }