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(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); }
/** * 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(); }
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); } }
/** * Method onHelp * Shows the source code for this sample, along with an explanation */ function onHelp($param) { if (isset($param['classname']) and $param['classname']) { $folder = 'app/control'; $classname = $param['classname']; foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($folder), RecursiveIteratorIterator::SELF_FIRST) as $entry) { if (is_dir($entry)) { if (file_exists("{$entry}/{$classname}.class.php")) { $resource = str_replace('app/control', 'app/resources', "{$entry}/{$classname}.txt"); if (file_exists($resource)) { $this->label->setValue(file_get_contents($resource)); } else { $this->label->setValue('This is the source-code for this sample.'); } $this->source->loadFile("{$entry}/{$classname}.class.php"); parent::setTitle("{$entry}/{$classname}.class.php"); return; } } } } else { $this->source->loadFile('index.web.php'); parent::setTitle('index.web.php'); } }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); parent::setTitle('New Window'); parent::setSize(800, 400); parent::add(new TLabel('Another Window')); }
public function __construct() { parent::__construct(); //checa para verificar se esta logado Usuario::checkLogin(); //verifica o nivel de usuario que pode acessar Usuario::acesso(3); }
/** * 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(); }
/** * 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); }
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(); }
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); }
/** * 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(' '); 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(' <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(); }
/** * 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); }
/* * 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();
/** * Select the register by ID and return the information to the main form * When using onblur signal, AJAX passes all needed parameters via GET * instead of calling onSetup before. */ public function onSelect($param) { $key = $param['key']; $database = isset($param['database']) ? $param['database'] : TSession::getValue('standard_seek_database'); $receive_key = isset($param['receive_key']) ? $param['receive_key'] : TSession::getValue('standard_seek_receive_key'); $receive_field = isset($param['receive_field']) ? $param['receive_field'] : TSession::getValue('standard_seek_receive_field'); $display_field = isset($param['display_field']) ? $param['display_field'] : TSession::getValue('standard_seek_display_field'); $parent = isset($param['parent']) ? $param['parent'] : TSession::getValue('standard_seek_parent'); try { TTransaction::open($database); // load the active record $model = isset($param['model']) ? $param['model'] : TSession::getValue('standard_seek_model'); $activeRecord = new $model($key); TTransaction::close(); $object = new StdClass(); $object->{$receive_key} = $activeRecord->{'id'}; $object->{$receive_field} = $activeRecord->{$display_field}; TForm::sendData($parent, $object); parent::closeWindow(); // closes the window } catch (Exception $e) { // clear fields $object = new StdClass(); $object->{$receive_key} = ''; $object->{$receive_field} = ''; TForm::sendData($parent, $object); // undo all pending operations TTransaction::rollback(); } }
/** * method show() * Shows the page */ function show() { // check if the datagrid is already loaded if (!$this->loaded) { $this->onReload(); } parent::show(); }
public function __construct() { parent::__construct(); parent::add(new TLabel('Hello World')); }
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); }
/** * Executed when the user chooses the record */ function onSelect($param) { try { $key = $param['key']; TTransaction::open('samples'); // load the active record $city = new City($key); // closes the transaction TTransaction::close(); $object = new StdClass(); $object->city_id1 = $city->id; $object->city_name1 = $city->name; TForm::sendData('form_seek_sample', $object); parent::closeWindow(); // closes the window } catch (Exception $e) { // em caso de exceção // clear fields $object = new StdClass(); $object->city_id1 = ''; $object->city_name1 = ''; TForm::sendData('form_seek_sample', $object); // undo pending operations TTransaction::rollback(); } }
/** * Shows the page */ function show() { // if the datagrid was not loaded yet if (!$this->loaded) { $this->onReload(); } parent::show(); }
/** * 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); }