コード例 #1
0
 function __construct()
 {
     parent::__construct();
     Clientes::checkCliente();
     $this->pagseguro = new PPagSeguro('progs');
     $this->setSize(550, 400);
     $this->setTitle('Lista de Produtos');
     $this->grid = new TQuickGrid();
     $this->grid->addQuickColumn('id', 'id', 'right', 100);
     $this->grid->addQuickColumn('nome', 'nome', 'right', 200);
     $this->grid->addQuickColumn('qtd', 'qtd', 'right', 100);
     $this->grid->addQuickColumn('preco', 'preco', 'right', 100);
     $action = new TDataGridAction(array('Carrinho', 'updateItem'));
     $this->grid->addQuickAction('UpdateItem', $action, 'id', 'ico_edit.png');
     $form = new TQuickForm('frm_finalizar');
     $action2 = new TAction(array($this, 'finalizar'));
     $form->addQuickAction('finalizar', $action2);
     $this->grid->createModel();
     $produtos = PCart::getItens();
     if ($produtos) {
         foreach ($produtos as $p) {
             $item = new stdClass();
             $item->id = $p->getId();
             $item->nome = $p->getNome();
             $item->qtd = $p->getQtd();
             $item->preco = $p->getPreco();
             $this->grid->addItem($item);
         }
         $box = new TVBox();
         $box->add($this->grid);
         $box->add($form);
         parent::add($box);
     }
 }
コード例 #2
0
 /**
  * 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);
 }
コード例 #3
0
ファイル: form1.php プロジェクト: ricardohenriq/learn-php
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();
}
コード例 #4
0
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();
}
コード例 #5
0
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     parent::setTitle('New Window');
     parent::setSize(800, 400);
     parent::add(new TLabel('Another Window'));
 }
コード例 #6
0
 /**
  * Shows the exception stack
  */
 function show()
 {
     $error_array = $this->e->getTrace();
     $table = new TTable();
     $row = $table->addRow();
     $message = $this->e->getMessage();
     $message = str_replace('<br>', "\n", $message);
     $title = new GtkLabel();
     $title->set_markup('<b>General Error: ' . $message . '</b>' . "\n");
     $row->addCell($title);
     var_dump($this->e->getTraceAsString());
     foreach ($error_array as $error) {
         $file = isset($error['file']) ? $error['file'] : '';
         $line = isset($error['line']) ? $error['line'] : '';
         $file = str_replace(PATH, '', $file);
         $row = $table->addRow();
         $row->addCell('File: ' . $file . ' : ' . $line);
         $row = $table->addRow();
         $args = array();
         if ($error['args']) {
             foreach ($error['args'] as $arg) {
                 if (is_object($arg)) {
                     $args[] = get_class($arg) . ' object';
                 } else {
                     if (is_array($arg)) {
                         $array_param = array();
                         foreach ($arg as $value) {
                             if (is_object($value)) {
                                 $array_param[] = get_class($value);
                             } else {
                                 if (is_array($value)) {
                                     $array_param[] = 'array';
                                 } else {
                                     $array_param[] = $value;
                                 }
                             }
                         }
                         $args[] = implode(',', $array_param);
                     } else {
                         $args[] = (string) $arg;
                     }
                 }
             }
         }
         $label = new GtkLabel();
         $row->addCell($label);
         $class = isset($error['class']) ? $error['class'] : '';
         $type = isset($error['type']) ? $error['type'] : '';
         $label->set_markup('  <i>' . '<span foreground="#78BD4C">' . $class . '</span>' . '<span foreground="#600097">' . $type . '</span>' . '<span foreground="#5258A3">' . $error['function'] . '</span>' . '(' . '<span foreground="#894444">' . implode(',', $args) . '</span>' . ')</i>');
     }
     $scroll = new TScroll();
     $scroll->setSize(690, 390);
     $scroll->add($table);
     $scroll->child->modify_bg(GTK::STATE_NORMAL, GdkColor::parse('#ffffff'));
     parent::add($scroll);
     parent::show();
 }
コード例 #7
0
 /**
  * Constructor Method
  * Creates the page, the search form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates a new form
     $this->form = new TForm('form_standard_seek');
     // creates a new table
     $table = new TTable();
     // adds the table into the form
     $this->form->add($table);
     // create the form fields
     $display_field = new TEntry('display_field');
     // keeps the field's value
     $display_field->setValue(TSession::getValue('tstandardseek_display_value'));
     // add a row for the filter field
     $row = $table->addRow();
     $row->addCell(new TLabel('Field:'));
     $row->addCell($display_field);
     // create the action button
     $find_button = new TButton('busca');
     // define the button action
     $find_button->setAction(new TAction(array($this, 'onSearch')), TAdiantiCoreTranslator::translate('Search'));
     $find_button->setImage('ico_find.png');
     // add a row for the button in the table
     $row = $table->addRow();
     $row->addCell($find_button);
     // define wich are the form fields
     $this->form->setFields(array($display_field, $find_button));
     // creates a new datagrid
     $this->datagrid = new TDataGrid();
     // create two datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'right', 70);
     $display = new TDataGridColumn('display_field', 'Field', 'left', 220);
     // add the columns to the datagrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($display);
     // create a datagrid action
     $action1 = new TDataGridAction(array($this, 'onSelect'));
     $action1->setLabel('Selecionar');
     $action1->setImage('ico_apply.png');
     $action1->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the paginator
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the container
     $vbox = new TVBox();
     $vbox->add($this->form);
     $vbox->add($this->datagrid);
     $vbox->add($this->pageNavigation);
     // add the container to the page
     parent::add($vbox);
 }
コード例 #8
0
 /**
  * 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);
 }
コード例 #9
0
 /**
  * Shows an exception stack
  */
 function show()
 {
     $error_array = $this->e->getTrace();
     $table = new TTable();
     $row = $table->addRow();
     $row->addCell('<b>General Error: ' . $this->e->getMessage() . '<br>');
     $row = $table->addRow();
     $row->addCell('&nbsp;');
     foreach ($error_array as $error) {
         $file = isset($error['file']) ? $error['file'] : '';
         $line = isset($error['line']) ? $error['line'] : '';
         $row = $table->addRow();
         $row->addCell('File: ' . $file . ' : ' . $line);
         $row = $table->addRow();
         $args = array();
         if ($error['args']) {
             foreach ($error['args'] as $arg) {
                 if (is_object($arg)) {
                     $args[] = get_class($arg) . ' object';
                 } else {
                     if (is_array($arg)) {
                         $array_param = array();
                         foreach ($arg as $value) {
                             if (is_object($value)) {
                                 $array_param[] = get_class($value);
                             } else {
                                 if (is_array($value)) {
                                     $array_param[] = 'array';
                                 } else {
                                     $array_param[] = $value;
                                 }
                             }
                         }
                         $args[] = implode(',', $array_param);
                     } else {
                         $args[] = (string) $arg;
                     }
                 }
             }
         }
         $class = isset($error['class']) ? $error['class'] : '';
         $type = isset($error['type']) ? $error['type'] : '';
         $row->addCell('&nbsp;&nbsp;<i>' . '<font color=green>' . $class . '</font>' . '<font color=olive>' . $type . '</font>' . '<font color=darkblue>' . $error['function'] . '</font>' . '(' . '<font color=maroon>' . implode(',', $args) . '</font>' . ')</i>');
     }
     $scroll = new TScroll();
     $scroll->setSize(690, 390);
     $scroll->add($table);
     parent::add($scroll);
     parent::show();
 }
コード例 #10
0
 public function __construct()
 {
     TSession::freeSession();
     parent::__construct();
     $this->setTitle("Login");
     $this->setSize(300, 200);
     $this->form = new TQuickForm('login');
     $login = new TEntry('user');
     $senha = new TPassword('senha');
     $this->form->addQuickField('Login', $login, 200, new TRequiredValidator());
     $this->form->addQuickField('Senha', $senha, 200, new TRequiredValidator());
     $this->form->addQuickAction('Logar', new TAction(array($this, 'logar')));
     parent::add($this->form);
 }
コード例 #11
0
 /**
  * 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();
 }
コード例 #12
0
 /**
  * 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);
 }
コード例 #13
0
ファイル: page4.php プロジェクト: ricardohenriq/learn-php
    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();
    }
コード例 #14
0
 /**
  * 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);
 }
コード例 #15
0
 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);
 }
コード例 #16
0
ファイル: ItemSeek.class.php プロジェクト: jhonleandres/crmbf
 /**
  * constructor method
  */
 public function __construct()
 {
     parent::__construct();
     // 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'));
     // add the field inside the table
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Barcode')));
     $row->addCell($barcode);
     // 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($barcode, $find_button));
     // create the datagrid
     $this->datagrid = new TDataGrid();
     // create the datagrid columns
     $id = new TDataGridColumn('id', _t('Code'), 'right', 70);
     $barcode = new TDataGridColumn('barcode', _t('Barcode'), 'left', 100);
     $title = new TDataGridColumn('title', _t('Title'), 'left', 200);
     $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);
 }
コード例 #17
0
 /**
  * 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);
 }
コード例 #18
0
 /**
  * constructor method
  */
 public function __construct()
 {
     parent::__construct();
     new TSession();
     // creates the form
     $this->form = new TForm('form_city_Seek');
     // creates the table
     $table = new TTable();
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $name = new TEntry('name');
     $code = new TEntry('id');
     $crm_id = new TDBCombo('crm_id', 'db_crmbf', 'CRM', 'id', 'titulo');
     $tiporegistro_id = new TDBCombo('tiporegistro_id', 'db_crmbf', 'RegistroTipo', 'id', 'nome');
     $registro = new TText('registro');
     $temporegistro = new TEntry('tempo_registro');
     //        $temporegistro->setEditable(false);
     $dataregistro = new TDate('data_registro');
     $hora_registro = new TEntry('hora_registro');
     $numero_registro = new TEntry('numero_registro');
     // keep the session value
     //  $name->setValue(TSession::getValue('test_city_name'));
     // add the field inside the table
     //        $row=$table->addRow();
     //        $row->addCell(new TLabel('Name:'));
     //        $row->addCell($name);
     $code->setEditable(FALSE);
     $code->setSize(100);
     $crm_id->setSize(320);
     $registro->setSize(320);
     $temporegistro->setSize(160);
     //$temporegistro->setValue(date("d/m/Y H:i:s"));
     $tiporegistro_id->setSize(160);
     //$dataregistro->setRange(0,1000,1);
     $dataregistro->setSize(90);
     // $hora_registro->setRange(0,100,1);
     $hora_registro->setSize(150);
     $hora_registro->setTip('Horario EX: 8:14');
     $numero_registro->setSize(320);
     $row = $table->addRow();
     $row->addCell(new TLabel('Code:'));
     $row->addCell($code);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel('CRM Titulo:'));
     $cell = $row->addCell($crm_id);
     // add a row for the field Telefone
     $row = $table->addRow();
     $row->addCell(new TLabel('Tipo Registro:'));
     $cell = $row->addCell($tiporegistro_id);
     // add a row for the field Email
     $row = $table->addRow();
     $row->addCell(new TLabel('Tempo:'));
     $cell = $row->addCell($temporegistro);
     // add a row for the field celular
     $row = $table->addRow();
     $row->addCell(new TLabel('Data:'));
     $cell = $row->addCell($dataregistro);
     // add a row for the field skype
     $row = $table->addRow();
     $row->addCell(new TLabel('Hora:'));
     $cell = $row->addCell($hora_registro);
     // add a row for the field endereco
     $row = $table->addRow();
     $row->addCell(new TLabel('Numero Registro:'));
     $row->addCell($numero_registro);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel('Registro:'));
     $cell = $row->addCell($registro);
     // 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('id', 'Id', 'right', 70);
     $name = new TDataGridColumn('name', 'Name', 'left', 220);
     $state = new TDataGridColumn('state', 'Estado', 'left', 80);
     $order1 = new TAction(array($this, 'onReload'));
     $order2 = new TAction(array($this, 'onReload'));
     $order1->setParameter('order', 'id');
     $order2->setParameter('order', 'name');
     // 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($state);
     // create one datagrid action
     $action1 = new TDataGridAction(array($this, 'onSelect'));
     $action1->setLabel('Selecionar');
     $action1->setImage('ico_apply.png');
     $action1->setField('id');
     // 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);
 }
コード例 #19
0
/*
 * 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();
コード例 #20
0
 public function __construct()
 {
     parent::__construct();
     parent::add(new TLabel('Hello World'));
 }
コード例 #21
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_crm');
     // creates a table
     //        $table = new TTable;
     $panel = new TPanel(100, 10);
     // add the notebook inside the form
     $this->form->add($panel);
     $panel->put(new TLabel('CRM Titulo:'), 0, 0);
     // $notebook->appendPage('Cidade', $table_contact);
     //        $notebook->appendPage('Skill (aggregation)', $table_skill);
     // create the form fields
     $code = new TEntry('id');
     //        $crm_id = new TDBCombo('crm_id', 'db_crmbf', 'CRM', 'id', 'titulo');
     $crm_id = new TEntry('crm_nome');
     $tiporegistro_id = new TDBCombo('tiporegistro_id', 'db_crmbf', 'RegistroTipo', 'id', 'nome');
     $registro = new TText('registro');
     $temporegistro = new TEntry('tempo_registro');
     //        $temporegistro->setEditable(false);
     $dataregistro = new TDate('data_registro');
     $hora_registro = new TEntry('hora_registro');
     $numero_registro = new TEntry('numero_registro');
     // add field validators
     $registro->addValidation('Nome', new TRequiredValidator());
     // $cidade_id->addValidation('Cidade', new TRequiredValidator);
     // $birthdate->addValidation('Birthdate', new TRequiredValidator);
     //        $cidade_id->addValidation('Category', new TRequiredValidator);
     //$obj = new CidadeFormList;
     //$cidade_id->setAction(new TAction(array($obj, 'onReload')));
     //        $itemGender = array();
     //        $itemGender['M'] = 'Male';
     //        $itemGender['F'] = 'Female';
     //        // add the combo options
     //        $gender->addItems($itemGender);
     //        $gender->setLayout('horizontal');
     //
     //        $itemStatus = array();
     //        $itemStatus['S'] = 'Single';
     //        $itemStatus['C'] = 'Committed';
     //        $itemStatus['M'] = 'Married';
     //        $status->addItems($itemStatus);
     // define some properties for the form fields
     $code->setEditable(FALSE);
     $code->setSize(100);
     $crm_id->setSize(320);
     $registro->setSize(320);
     $temporegistro->setSize(160);
     //$temporegistro->setValue(date("d/m/Y H:i:s"));
     $tiporegistro_id->setSize(160);
     //$dataregistro->setRange(0,1000,1);
     $dataregistro->setSize(90);
     // $hora_registro->setRange(0,100,1);
     $hora_registro->setSize(150);
     $hora_registro->setTip('Horario EX: 8:14');
     $numero_registro->setSize(320);
     $panel->put("Codigo: ", 10, 25);
     $panel->put("CRM: ", 10, 50);
     $panel->put("Tipo: ", 10, 75);
     $panel->put("Tempo: ", 10, 100);
     $panel->put("Data: ", 10, 125);
     $panel->put("Horario: ", 10, 150);
     $panel->put("Nº Registro: ", 10, 175);
     $panel->put("Registro: ", 10, 200);
     $panel->put($code, 100, 25);
     $panel->put($crm_id, 100, 50);
     $panel->put($tiporegistro_id, 100, 75);
     $panel->put($temporegistro, 100, 100);
     $panel->put($dataregistro, 100, 125);
     $panel->put($hora_registro, 100, 150);
     $panel->put($numero_registro, 100, 175);
     $panel->put($registro, 100, 200);
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Code:'));
     //        $row->addCell($code);
     //
     //        // add a row for the field name
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('CRM Titulo:'));
     //        $cell = $row->addCell($crm_id);
     //
     //        // add a row for the field Telefone
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Tipo Registro:'));
     //        $cell = $row->addCell($tiporegistro_id);
     //
     //        // add a row for the field Email
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Tempo:'));
     //        $cell = $row->addCell($temporegistro);
     //
     //        // add a row for the field celular
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Data:'));
     //        $cell = $row->addCell($dataregistro);
     //
     //        // add a row for the field skype
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Hora:'));
     //        $cell = $row->addCell($hora_registro);
     //
     //        // add a row for the field endereco
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Numero Registro:'));
     //        $row->addCell($numero_registro);
     //
     //        // add a row for the field name
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Registro:'));
     //        $cell = $row->addCell($registro);
     // add a row for the field Category
     //        $row = $table_data->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $cell = $row->addCell($cidade_id);
     // add a row for the field city
     //        $row=$table_data->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $cell = $row->addCell($cidade_id);
     /*
      // add a row for the field Phone
      $row = $table_data->addRow();
      $row->addCell(new TLabel('Phone:'));
      $row->addCell($phone);
     
      // add a row for the field BirthDate
      $row->addCell(new TLabel('BirthDate:'));
      $row->addCell($birthdate);
     
      // add a row for the field status
      $row = $table_data->addRow();
      $row->addCell(new TLabel('Status:'));
      $cell = $row->addCell($status);
     
      // add a row for the field Email
      $row->addCell(new TLabel('Email:'));
      $cell = $row->addCell($email);
     
      // add a row for the field gender
      $row->addCell(new TLabel('Gender:'));
      $row->addCell($gender);
     
      $row = $table_contact->addRow();
      $cell = $row->addCell(new TLabel('<b>Contact</b>'));
      $cell->valign = 'top';
     
      // add two fields inside the multifield in the second sheet
      $contacts_list->setHeight(100);
      $contacts_list->setClass('Contact'); // define the returning class
      $contacts_list->addField('type', 'Contact Type: ', new TEntry('type'), 200);
      $contacts_list->addField('value', 'Contact Value: ', new TEntry('value'), 200);
      $row = $table_contact->addRow();
      $row->addCell($contacts_list);
     
      // create the radio button for the skills list
      $skill_list = new TDBCheckGroup('skill_list', 'samples', 'Skill', 'id', 'name');
      $table_skill->addRow()->addCell($lbl = new TLabel('Skills'));
      $table_skill->addRow()->addCell($skill_list);
      $lbl->setFontStyle('b');
     
     * 
     */
     // create an action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     $button1->setProperty('width', 150);
     //  create an action button (go to list)
     $button2 = new TButton('list');
     $button2->setAction(new TAction(array('RegistroList', 'onReload')), 'Ir para Listagem');
     $button2->setImage('ico_datagrid.gif');
     $button2->setProperty('width', 100);
     $panel->put($button1, 100, 325);
     $panel->put($button2, 200, 325);
     // define wich are the form fields
     $this->form->setFields(array($code, $crm_id, $registro, $temporegistro, $tiporegistro_id, $dataregistro, $hora_registro, $numero_registro, $button1, $button2));
     //        $subtable = new TTable;
     //        $row = $subtable->addRow();
     //        $row->addCell($button1);
     //        $row->addCell($button2);
     //        $table_layout = new TTable;
     //        $table_layout->addRow()->addCell($this->form);
     //        $table_layout->addRow()->addCell($subtable);
     // add the form inside the page
     parent::add($panel);
     //        parent::add($table_layout);
 }
 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();
 }
コード例 #23
0
 /**
  * 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);
 }
コード例 #24
0
 /**
  * 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);
 }
コード例 #25
0
 /**
  * Form constructor
  * @param $param Request
  */
 public function __construct($param)
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_Cliente');
     $this->form->class = 'tform';
     // change CSS class
     $note = new TNotebook(400, 300);
     // add a table inside form
     $table = new TTable();
     $table->width = '100%';
     // add a row for the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $row->addCell(new TLabel('Clientes'))->colspan = 2;
     // create the form fields
     $id = new TEntry('id');
     $nome = new TEntry('nome');
     // campo para telefones
     $multifield = new TMultiField('telefone');
     $telefone_id = new TEntry('id');
     $telefone_id->setEditable(false);
     $telefone = new TEntry('numero');
     $telefone->setMask('(99)99999-9999');
     //    campo para emails
     $multifield_email = new TMultiField('email');
     $email = new TEntry('email');
     $email_id = new TEntry('id');
     $email->addValidation('email', new TEmailValidator());
     $multifield->addField('id', 'Codigo', $telefone_id, 200);
     $multifield->addField('numero', 'Telefone', $telefone, 200, true);
     $multifield_email->addField('id', 'Codigo', $email_id, 200);
     $multifield_email->addField('email', 'Email', $email, 200, true);
     // define the sizes
     $id->setSize(100);
     $nome->setSize(200);
     // add one row for each form field
     $table->addRowSet(new TLabel('id:'), $id);
     $table->addRowSet(new TLabel('nome:'), $nome);
     $this->form->setFields(array($id, $nome, $multifield, $multifield_email));
     // create the form actions
     $save_button = TButton::create('save', array($this, 'onSave'), _t('Save'), 'bs:floppy-disk red');
     $new_button = TButton::create('new', array($this, 'onEdit'), _t('New'), 'bs:edit green');
     $this->form->addField($save_button);
     $this->form->addField($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;
     $note->appendPage('Clientes', $table);
     $note->appendPage('Telefone', $multifield);
     $note->appendPage('Email', $multifield_email);
     $this->form->add($note);
     // vertical box container
     $container = new TVBox();
     $container->style = 'width: 90%';
     // $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->add(TPanelGroup::pack('Title', $this->form));
     parent::add($container);
 }