/** * Constructor method */ function __construct($e) { parent::__construct('Error Report'); parent::setPosition(200, 100); parent::setSize(700, 400); $this->e = $e; }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); parent::setTitle('New Window'); parent::setSize(600, 370); parent::setPosition(100, 100); // create the form using TQuickForm class $this->form = new TQuickForm(); // create the notebook $notebook = new TNotebook(530, 260); // adds the notebook page $notebook->appendPage('Quick form component', $this->form); // create the form fields $id = new TEntry('id'); $description = new TEntry('description'); $date = new TDate('date'); $text = new TText('text'); // add the fields inside the form $this->form->addQuickField('Id', $id, 40); $this->form->addQuickField('Description', $description, 200); $this->form->addQuickField('Date', $date, 100); $this->form->addQuickField('Text', $text, 120); // define the form action $this->form->addQuickAction('Save', new TAction(array($this, 'onSave')), 'ico_save.png'); // add the form inside the page parent::add($notebook); }
function onView() { global $form; // obtém os dados do formulário $data = $form->getData(); // atribui os dados de volta ao formulário $form->setData($data); // cria uma janela $window = new TWindow('Dados do Form'); // define posição e tamanho em pixels $window->setPosition(300, 70); $window->setSize(300, 150); // monta o texto a ser exibido $output = "Nome: {$data->nome}\n"; $output .= "Email: {$data->email}\n"; $output .= "Título: {$data->titulo}\n"; $output .= "Mensagem: \n{$data->mensagem}"; // cria um objeto de texto $text = new TText('texto', 300); $text->setSize(290, 120); $text->setValue($output); // adiciona o objeto à janela $window->add($text); $window->show(); }
function onView() { global $form; //Obtem dados do Formulario $data = $form->getData(); //Atribui os dados de volta ao Formulario $form->setData($data); //Cria uma Janela $window = new TWindow('Dados do Formulario'); //Define posição e tamanho $window->setPosition('300', '70'); $window->setSize('300', '150'); //Monta o Texto a ser Exibido $output = "Nome: {$data->Nome}\n"; $output .= "Email: {$data->Email}\n"; $output .= "Titulo: {$data->Titulo}\n"; $output .= "Mensagem:\n{$data->Mensagem}\n"; //Cria o Objeto de Texto $texto = new TText('TEXTO', '300'); $texto->setSize('290', '120'); $texto->setValue($output); //Adiciona o objeto a janela $window->add($texto); $window->show(); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); parent::setTitle('New Window'); parent::setSize(800, 400); parent::add(new TLabel('Another Window')); }
/** * Constructor method */ function __construct($e) { parent::__construct('Error Report'); parent::connect_simple('destroy', array('Gtk', 'main_quit')); parent::setPosition(200, 100); parent::setSize(700, 400); $this->e = $e; }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); parent::setTitle('Detail Window'); parent::setSize(400, 300); $this->label = new TLabel(''); $this->label->setFontColor('#FF0000'); $this->label->setFontSize(12); // add the form inside the page parent::add($this->label); }
/** * método onProdutos() * executado quando o usuário clicar no link "Produtos" * @param $get = variável $_GET */ function onProdutos($get) { $texto = "Nesta seção você vai conhecer os produtos da nossa empresa\n Temos desde pintos, frangos, porcos, bois, vacas e todo tipo de animal\n que você pode imaginar na nossa fazenda."; // adiciona o texto na linha de conteúdo da tabela $celula = $this->content->addCell($texto); $celula->colspan = 3; // cria uma janela $win = new TWindow('Promoção'); // define posição e tamanho $win->setPosition(200, 100); $win->setSize(240, 100); // adiciona texto na janela $win->add('Temos cogumelos recém colhidos e também ovos de codorna fresquinhos'); // exibe a janela $win->show(); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); parent::setSize(570, 200); // create the form using TQuickForm class $this->form = new TQuickForm(); $this->form->class = 'tform'; $this->form->setFormTitle('Quick form'); $this->form->style = 'width: 500px'; // create the form fields $code = new TEntry('code'); $name = new TEntry('name'); // add the fields inside the form $this->form->addQuickField('Code', $code, 100); $this->form->addQuickField('Name', $name, 400); // define the form action $this->form->addQuickAction('Save', new TAction(array($this, 'onSave')), 'ico_save.png'); parent::add($this->form); }
function onProdutos($get) { $texto = 'PRODUTOS PRODUTOS PRODUTOS PRODUTOS <br /> PRODUTOS PRODUTOS<br />'; //Adiciona o $texto a uma Celula da //Linha de Conteudo $content e atribui a //referencia a variavel $celula $celula = $this->content->addCell($texto); //Deixa a celula com a dimensão de 3 Colunas $celula->colspan = 3; //Cria uma Janela Pop-Up $win = new TWindow('Promoção'); //Define o Tamanho $win->setPosition(200, 100); $win->setSize(240, 100); //Adiciona Texto na janela $win->add('TEXTO TEXTO TEXTO TEXTO'); //exibe a janela $win->show(); }
/** * Class constructor * Creates the page, the search form and the listing */ public function __construct() { parent::__construct(); parent::setSize(600, 400); parent::setTitle('Search record'); new TSession(); // creates the form $this->form = new TQuickForm('form_search_city'); // create the form fields $name = new TEntry('name'); $name->setValue(TSession::getValue('city_name')); // add the form fields $this->form->addQuickField('name', $name, 200); // define the form action $this->form->addQuickAction('Find', new TAction(array($this, 'onSearch')), 'ico_find.png'); // creates a DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(230); // creates the datagrid columns $this->datagrid->addQuickColumn('Id', 'id', 'right', 40); $this->datagrid->addQuickColumn('Name', 'name', 'left', 340); // creates two datagrid actions $this->datagrid->addQuickAction('Select', new TDataGridAction(array($this, 'onSelect')), 'id', 'ico_apply.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 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); }
public function __construct() { // parent classs constructor parent::__construct(); parent::setSize(0.8, 0.8); // label to present the docs $this->label = new TText('name'); $this->label->setSize(690, 130); // notebook to put the scroll inside $note = new TNotebook(700, 150); $note->appendPage('Explanation', $this->label); // scroll to put the source inside $scroll2 = new TScroll(); $scroll2->setSize(700, 250); $this->source = new TSourceCode(); $scroll2->add($this->source); // create a table to organize the layout $page = new TTable(); $row1 = $page->addRow(); $row2 = $page->addRow(); $row1->addCell($note); $row2->addCell($scroll2); parent::add($this->source); }
/** * constructor method */ public function __construct() { parent::__construct(); parent::setSize(TSession::getValue('width'), TSession::getValue('height')); parent::setTitle(TSession::getValue('titulo')); new TSession(); // creates the form $this->form = new TForm('formSeekStandart'); // creates the table $table = new TTable(); // add the table inside the form $this->form->add($table); // create the form fields $name = new TEntry('name'); // keep the session value $name->setValue(TSession::getValue('name')); // add the field inside the table $row = $table->addRow(); $row->addCell(new TLabel($this->getFiltro() . ' :')); $row->addCell($name); // create a find button $find_button = new TButton('search'); // define the button action $find_button->setAction(new TAction(array($this, 'onSearch')), 'Search'); $find_button->setImage('ico_find.png'); // add a row for the find button $row = $table->addRow(); $row->addCell($find_button); // define wich are the form fields $this->form->setFields(array($name, $find_button)); // create the datagrid $this->datagrid = new TDataGrid(); $i = 1; // create the datagrid columns if (TSession::getValue('campos')) { foreach (TSession::getValue('campos') as $field => $label) { $campos[] = new TDataGridColumn($field, $label, 'right', 200); } foreach ($campos as $campo) { // add the columns inside the datagrid $this->datagrid->addColumn($campo); } } // create one datagrid action $action1 = new TDataGridAction(array($this, 'onSelect')); $action1->setLabel('Selecionar'); $action1->setImage('ico_apply.png'); $action1->setField(TSession::getValue('key')); // add the action to the datagrid $this->datagrid->addAction($action1); // create the datagrid model $this->datagrid->createModel(); // create the page navigator $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create a table for layout $table = new TTable(); // create a row for the form $row = $table->addRow(); $row->addCell($this->form); // create a row for the datagrid $row = $table->addRow(); $row->addCell($this->datagrid); // create a row for the page navigator $row = $table->addRow(); $row->addCell($this->pageNavigation); // add the table inside the page parent::add($table); }
/** * constructor method */ public function __construct() { parent::__construct(); parent::setSize(900, 500); // creates the form $this->form = new TForm('form_item_Seek'); // creates the table $table = new TTable(); // add the table inside the form $this->form->add($table); // create the form fields $barcode = new TEntry('barcode'); // keep the session value $barcode->setValue(TSession::getValue('test_item_barcode')); $barcode->setSize(400); // create a find button $find_button = new TButton('search'); $find_button->setAction(new TAction(array($this, 'onSearch')), 'Search'); $find_button->setImage('ico_find.png'); $table->addRowSet(new TLabel(_t('Barcode')), $barcode, $find_button); // define wich are the form fields $this->form->setFields(array($barcode, $find_button)); // create the datagrid $this->datagrid = new TDataGrid(); // create the datagrid columns $id = new TDataGridColumn('id', _t('Code'), 'right', 100); $barcode = new TDataGridColumn('barcode', _t('Barcode'), 'left', 150); $title = new TDataGridColumn('title', _t('Title'), 'left', 500); $order1 = new TAction(array($this, 'onReload')); $order2 = new TAction(array($this, 'onReload')); $order1->setParameter('order', 'id'); $order2->setParameter('order', 'barcode'); // define the column actions $id->setAction($order1); $barcode->setAction($order2); // add the columns inside the datagrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($barcode); $this->datagrid->addColumn($title); // create one datagrid action $action1 = new TDataGridAction(array($this, 'onSelect')); $action1->setLabel('Selecionar'); $action1->setImage('ico_apply.png'); $action1->setField('barcode'); // add the action to the datagrid $this->datagrid->addAction($action1); // create the datagrid model $this->datagrid->createModel(); // create the page navigator $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create a table for layout $table = new TTable(); // create a row for the form $row = $table->addRow(); $row->addCell($this->form); // create a row for the datagrid $row = $table->addRow(); $row->addCell($this->datagrid); // create a row for the page navigator $row = $table->addRow(); $row->addCell($this->pageNavigation); // add the table inside the page parent::add($table); }
function onFinal() { // instancia uma nova janela $janela = new TWindow('Concui Venda'); $janela->setPosition(520, 200); $janela->setSize(250, 180); // lê a variável $list da seção $list = TSession::getValue('list'); // inicia transação com o banco 'sq_livro' TTransaction::open('sq_livro'); $total = 0; foreach ($list as $item) { // soma o total de produtos vendidos $total += $item->preco_venda * $item->quantidade; } // fecha a transação TTransaction::close(); // instancia formulário de conclusão de venda $form = new ConcluiVendaForm(); // define a ação do botão deste formulário $form->button->setAction(new TAction(array($this, 'onGravaVenda')), 'Salvar'); // preenche o formulário com o valor_total $dados = new StdClass(); $dados->valor_total = $total; $form->setData($dados); // adiciona o formulário à janela $janela->add($form); $janela->show(); }
/** * Class constructor * Creates the page and the registration form */ public function __construct() { parent::__construct(); parent::setSize(640, 350); parent::setTitle('Event'); // creates the form $this->form = new TForm('form_Event'); $this->form->class = 'tform'; // CSS class $this->form->style = 'width: 600px'; // 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('Event'))->colspan = 2; $hours = array(); $durations = array(); for ($n = 0; $n < 24; $n++) { $hours[$n] = "{$n}:00"; $durations[$n + 1] = $n + 1 . ' h'; } array_pop($durations); // create the form fields $id = new TEntry('id'); $event_date = new TDate('event_date'); $start_hour = new TCombo('start_hour'); $duration = new TCombo('duration'); $title = new TEntry('title'); $description = new TText('description'); $start_hour->addItems($hours); $duration->addItems($durations); $id->setEditable(FALSE); // define the sizes $id->setSize(40); $event_date->setSize(100); $start_hour->setSize(100); $duration->setSize(100); $title->setSize(400); $description->setSize(400, 50); // add one row for each form field $table->addRowSet(new TLabel('ID:'), $id); $table->addRowSet(new TLabel('Event Date:'), $event_date); $table->addRowSet(new TLabel('Start Hour:'), $start_hour); $table->addRowSet(new TLabel('Duration:'), $duration); $table->addRowSet(new TLabel('Title:'), $title); $table->addRowSet(new TLabel('Description:'), $description); // 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('Clear')); $new_button->setImage('ico_new.png'); $this->form->setFields(array($id, $event_date, $start_hour, $duration, $title, $description, $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); }
/** * constructor method */ public function __construct() { parent::__construct(); parent::setTitle('Busca de Pessoas'); parent::setSize(800, 600); new TSession(); // creates the form $this->form = new TForm('form_city_Pessoa'); // creates the table $table = new TTable(); // add the table inside the form $this->form->add($table); // create the form fields $name = new TEntry('pessoa_nome'); // keep the session value $name->setValue(TSession::getValue('test_pessoa_name')); // add the field inside the table $row = $table->addRow(); $row->addCell(new TLabel('Nome:')); $row->addCell($name); // create a find button $find_button = new TButton('search'); // define the button action $find_button->setAction(new TAction(array($this, 'onSearch')), 'Search'); $find_button->setImage('ico_find.png'); // add a row for the find button $row = $table->addRow(); $row->addCell($find_button); // define wich are the form fields $this->form->setFields(array($name, $find_button)); // create the datagrid $this->datagrid = new TDataGrid(); // create the datagrid columns $id = new TDataGridColumn('pessoa_codigo', 'Id', 'right', 25); $name = new TDataGridColumn('pessoa_nome', 'Nome', 'left', 250); $origem = new TDataGridColumn('origem_nome', 'Origem', 'left', 330); $order1 = new TAction(array($this, 'onReload')); $order2 = new TAction(array($this, 'onReload')); $order1->setParameter('order', 'pessoa_codigo'); $order2->setParameter('order', 'pessoa_nome'); // define the column actions $id->setAction($order1); $name->setAction($order2); // add the columns inside the datagrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($name); $this->datagrid->addColumn($origem); // create one datagrid action $action1 = new TDataGridAction(array($this, 'onSelect')); $action1->setLabel('Selecionar'); $action1->setImage('fa:check-circle-o green'); $action1->setField('pessoa_codigo'); // add the action to the datagrid $this->datagrid->addAction($action1); // create the datagrid model $this->datagrid->createModel(); // create the page navigator $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create a table for layout $table = new TTable(); // create a row for the form $row = $table->addRow(); $row->addCell($this->form); // create a row for the datagrid $row = $table->addRow(); $row->addCell($this->datagrid); // create a row for the page navigator $row = $table->addRow(); $row->addCell($this->pageNavigation); $table->style = 'width: 100%;max-width: 1200px;'; $this->datagrid->style = ' width: 100%; max-width: 1200px;'; // add the table inside the page parent::add($table); }
/* * função __autoload() * carrega as classes necessárias sob demanda */ function __autoload($class) { include_once "app.widgets/{$class}.class.php"; } // instancia um objeto TWindow nas coordenadas 20,20 contendo um texto $janela1 = new TWindow('janela1'); $janela1->setPosition(20, 20); $janela1->setSize(200, 200); $janela1->add(new TParagraph('conteúdo da janela 1')); $janela1->show(); // instancia um objeto TWindow nas coordenadas 300,20 contendo uma imagem $janela2 = new TWindow('janela2'); $janela2->setPosition(300, 20); $janela2->setSize(200, 200); $janela2->add(new TImage('app.images/gimp.png')); $janela2->show(); // instancia um objeto painel // coloca dentro do painel um texto e uma imagem $painel = new TPanel(210, 130); $painel->put(new TParagraph('<b>texto1</b>'), 20, 20); $painel->put(new TImage('app.images/gnome.png'), 80, 20); // instancia um objeto TWindow nas coordenadas 140,120 contendo um painel $janela3 = new TWindow('janela3'); $janela3->setPosition(140, 120); $janela3->setSize(220, 160); $janela3->add($painel); $janela3->show();