Ejemplo n.º 1
1
 function __construct()
 {
     parent::__construct();
     //cria os containers
     $this->form_requisicao = new TForm('form_requisicao');
     $this->form_requisicao->class = 'tform';
     $this->form_itens = new TForm('form_itens');
     $this->form_itens->class = 'tform';
     $table_requisicao = new TTable();
     $table_requisicao->width = '100%';
     $table_itens = new TTable();
     $table_itens->width = '100%';
     //empacota os dados
     $this->form_requisicao->add($table_requisicao);
     $this->form_itens->add($table_itens);
     //campos da requisicao;
     $numeroSRP = new TSeekButton('numeroSRP');
     $nome = new TEntry('nome');
     $numeroProcessoOrigem = new TEntry('numeroProcessoOrigem');
     $uasg = new TEntry('uasg');
     $validadeAta = new TEntry('validade');
     $numeroProcesso = new TEntry('numeroProcesso');
     $emissao = new TDate('emissao');
     //campos do itens
     $numeroItem = new TSeekButton('numeroItem');
     $item_id = new THidden('item_id');
     $descricaoSumaria = new TEntry('descricaoSumaria');
     $valorUnitario = new TEntry('valorUnitario');
     $quantidade = new TEntry('quantidade');
     $prazoEntrega = new TEntry('prazoEntrega');
     $justificativa = new TEntry('justificativa');
     $addItem = new TButton('addItem');
     $save = new TButton('save');
     $new = new TButton('new');
     $list = new TButton('list');
     //ações dos campos
     $numeroSRP->setAction(new TAction(array(new SrpSeekRequisicao(), 'onReload')));
     $numeroProcesso->setExitAction(new TAction(array($this, 'onExitNumeroProcesso')));
     $emissao->setExitAction(new TAction(array($this, 'onExitEmissao')));
     $numeroItem->setAction(new TAction(array(new ItemSeekRequisicao(), 'onReload')));
     $addItem->setAction(new TAction(array($this, 'onAddItem')), 'Adicionar');
     $addItem->setImage('fa:plus-square-o');
     $save->setAction(new TAction(array($this, 'onSave')), 'Salvar');
     $save->setImage('ico_save.png');
     $new->setAction(new TAction(array($this, 'onEdit')), 'Novo');
     $new->setImage('ico_new.png');
     $list->setAction(new TAction(array('RequisicaoList', 'onReload')), 'Voltar para listagem');
     $list->setImage('ico_datagrid.png');
     //$onProductChange = new TAction(array($this, 'onProductChange'));
     //$item_id->setExitAction($onProductChange);
     $quantidade->setExitAction(new TAction(array($this, 'onValidaQuantidade')));
     //validadores
     $numeroSRP->addValidation('Nº SRP', new TRequiredValidator());
     $emissao->addValidation('Emissão', new TRequiredValidator());
     $numeroItem->addValidation('Item', new TRequiredValidator());
     $valorUnitario->addValidation('Preço', new TRequiredValidator());
     $quantidade->addValidation('Quantidade', new TRequiredValidator());
     $quantidade->addValidation('Quantidade', new TMinValueValidator(), array(1));
     $quantidade->addValidation('Quantidade', new TMaxLengthValidator(), array(11));
     $justificativa->addValidation('Justificativa', new TRequiredValidator());
     $justificativa->addValidation('Justificativa', new TMaxLengthValidator(), array(100));
     $prazoEntrega->addValidation('Prazo de entrega', new TRequiredValidator());
     $prazoEntrega->addValidation('Prazo de entrega', new TMaxLengthValidator(), array(20));
     $numeroProcesso->addValidation('Nº Processo', new TRequiredValidator());
     $numeroProcesso->addValidation('Nº Processo', new TMaxLengthValidator(), array(30));
     //outras propriedades
     $descricaoSumaria->setEditable(false);
     $nome->setEditable(false);
     $numeroProcessoOrigem->setEditable(false);
     $uasg->setEditable(false);
     $validadeAta->setEditable(false);
     $valorUnitario->setEditable(false);
     $numeroSRP->setSize(80);
     $numeroSRP->setMaxLength(10);
     $emissao->setProperty('style', 'margin-right: 0px;', false);
     $nome->setSize(300);
     $nome->setProperty('style', 'margin-right: 10px', false);
     $numeroProcessoOrigem->setSize(160);
     $uasg->setSize(70);
     $validadeAta->setSize(85);
     $numeroProcesso->setMaxLength(30);
     $numeroProcesso->setTip('Número do processo gerado no SIGA');
     $numeroItem->setSize(60);
     $numeroItem->setMaxLength(11);
     $descricaoSumaria->setSize(490);
     $descricaoSumaria->setProperty('style', 'margin-right: 10px', false);
     $prazoEntrega->setSize(90);
     $justificativa->setSize(400);
     $justificativa->setMaxLength(100);
     $emissao->setSize(90);
     $emissao->setMask('dd/mm/yyyy');
     $emissao->setValue(date('d/m/Y'));
     $validadeAta->setMask('dd/mm/yyyy');
     $quantidade->class = 'frm_number_only';
     $quantidade->setMaxLength(11);
     $prazoEntrega->setValue('60 Dias');
     $prazoEntrega->setMaxLength(20);
     //$addItem->setProperty('style', 'margin: 0 0 10px 10px;', false);
     $row = $table_requisicao->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $cell = $row->addCell(new TLabel('Requisição de quantitativo'));
     $cell->colspan = 4;
     $row = $table_requisicao->addRow();
     $row->addCell(new TLabel('Nº SRP:'))->width = '150px';
     $row->addCell($numeroSRP);
     $row->addCell(new TLabel('Nome Licitação:'))->width = '150px';
     $row->addCell($nome);
     $table_requisicao->addRowSet(new TLabel('Proc. Orig:'), $numeroProcessoOrigem, new TLabel('UASG:'), $uasg);
     $table_requisicao->addRowSet(new TLabel('Validade da Ata:'), $validadeAta, new TLabel('Nº Processo:'), $numeroProcesso);
     $table_requisicao->addRowSet(new TLabel('Data Emissão:'), $emissao);
     $row = $table_itens->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $cell = $row->addCell(new TLabel('Itens'));
     $cell->colspan = 4;
     $row = $table_itens->addRow();
     $row->addCell(new TLabel('Item:'));
     $box = new THBox();
     $box->add($numeroItem);
     $box->add($descricaoSumaria)->style = 'width : 75%;display:inline-block;';
     $row->addCell($box);
     //->style = 'width : 85%';
     $table_itens->addRowSet($item_id);
     $table_itens->addRowSet(new TLabel('Preço:'), $valorUnitario);
     $table_itens->addRowSet(new TLabel('Quantidade:'), $quantidade);
     $table_itens->addRowSet(new TLabel('Prazo de entrega:'), $prazoEntrega);
     $table_itens->addRowSet(new TLabel('Justificativa:'), $justificativa);
     $row = $table_itens->addRow();
     $row->class = 'tformaction';
     $row->addCell($addItem)->colspan = 2;
     //$table_itens->addRowSet($addItem);
     parent::include_css('app/resources/custom-table.css');
     $this->datagrid = new TDataGrid();
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->class = 'tdatagrid_table customized-table';
     $this->datagrid->setHeight(175);
     $this->datagrid->makeScrollable();
     $this->datagrid->disableDefaultClick();
     $GnumeroItem = new TDataGridColumn('numeroItem', 'Item', 'center', 50);
     $GdescricaoSumaria = new TDataGridColumn('descricaoSumaria', 'Descrição', 'left', 230);
     $Gquantidade = new TDataGridColumn('quantidade', 'Quantidade', 'right', 110);
     $GvalorUnitario = new TDataGridColumn('valorUnitario', 'Preço', 'right', 110);
     $Gtotal = new TDataGridColumn('total', 'Total', 'right', 160);
     //transformers
     $GvalorUnitario->setTransformer(array($this, 'formatValor'));
     $Gtotal->setTransformer(array($this, 'formatValor'));
     $edit = new TDataGridAction(array($this, 'onEditItem'));
     $edit->setLabel('Editar');
     $edit->setImage('ico_edit.png');
     $edit->setField('numeroItem');
     $delete = new TDataGridAction(array($this, 'onDeleteItem'));
     $delete->setLabel('Deletar');
     $delete->setImage('ico_delete.png');
     $delete->setField('numeroItem');
     $this->datagrid->addAction($edit);
     $this->datagrid->addAction($delete);
     $this->datagrid->addColumn($GnumeroItem);
     $this->datagrid->addColumn($GdescricaoSumaria);
     $this->datagrid->addColumn($Gquantidade);
     $this->datagrid->addColumn($GvalorUnitario);
     $this->datagrid->addColumn($Gtotal);
     $this->datagrid->createModel();
     $this->form_requisicao->setFields(array($numeroSRP, $nome, $numeroProcessoOrigem, $uasg, $validadeAta, $numeroProcesso, $emissao, $new, $save, $list));
     $this->form_itens->setFields(array($item_id, $numeroItem, $descricaoSumaria, $valorUnitario, $quantidade, $prazoEntrega, $justificativa, $addItem));
     $hbox = new THBox();
     $hbox->add($save);
     $hbox->add($new);
     $hbox->add($list);
     $table_grid = new TTable();
     $table_grid->style = 'width: 100%;border-spacing: 0px;';
     $table_grid->addRowSet($this->datagrid);
     $row = $table_grid->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($hbox)->colspan = 2;
     $vbox = new TVBox();
     $vbox->add($this->form_requisicao);
     $vbox->add($this->form_itens);
     $vbox->add($table_grid);
     $vbox->add(new TLabel(' '));
     parent::add($vbox);
 }
Ejemplo n.º 2
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);
     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();
 }
Ejemplo n.º 3
0
 function __construct()
 {
     parent::__construct();
     parent::setSize(850, 500);
     parent::setTitle('Busca de SRP');
     new TSession();
     //cria o formulario
     $this->form = new TQuickForm('form_busca_srp');
     //cria os campos de busca do formulario
     $numeroSRP = new TEntry('numeroSRP');
     $numeroProcesso = new TEntry('numeroProcesso');
     $nome = new TEntry('nome');
     //valors da sessao
     $numeroSRP->setValue(TSession::getValue('srp_numeroSRP'));
     $numeroProcesso->setValue(TSession::getValue('srp_numeroProcesso'));
     $nome->setValue(TSession::getValue('srp_nome'));
     //adiciona os campos no formulario
     $this->form->addQuickField('Nº SRP', $numeroSRP);
     $this->form->addQuickField('Proc. Orig.', $numeroProcesso);
     $this->form->addQuickField('Nome', $nome);
     //adiciona a acao ao formulario
     $this->form->addQuickAction('Buscar', new TAction(array($this, 'onSearch')), 'ico_find.png');
     //criar a datagrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(300);
     //criar as colunas da datagrid
     $this->datagrid->addQuickColumn('Nº SRP', 'numeroSRP', 'left', 45);
     $this->datagrid->addQuickColumn('Proc. Orig.', 'numeroProcesso', 'left', 140);
     $this->datagrid->addQuickColumn('UASG', 'uasg', 'left', 50);
     $this->datagrid->addQuickColumn('Validade', 'validade', 'left', 70);
     $this->datagrid->addQuickColumn('Nome', 'nome', 'left', 280);
     //criar acao da coluna
     $this->datagrid->addQuickAction('Select', new TDataGridAction(array($this, 'onSelect')), 'numeroSRP', 'ico_apply.png');
     //cria o modelo
     $this->datagrid->createModel();
     //criar o navegador de pagina
     $this->navegadorPagina = new TPageNavigation();
     $this->navegadorPagina->setAction(new TAction(array($this, 'onReload')));
     $this->navegadorPagina->setWidth($this->datagrid->getWidth());
     // criar a estrutura da pagina usando uma tabela
     $table = new TTable();
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->navegadorPagina);
     // add the table inside the page
     parent::add($table);
 }
Ejemplo n.º 4
0
 /**
  * Constructor method
  */
 function __construct($e)
 {
     $error_array = $e->getTrace();
     $table = new TTable();
     $row = $table->addRow();
     $row->addCell('<b>Error: ' . $e->getMessage() . '</b><br>');
     $row = $table->addRow();
     $row->addCell('&nbsp;');
     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;
                     }
                 }
             }
         }
         $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);
     ob_start();
     $table->show();
     $content = ob_get_clean();
     new TMessage('error', $content);
 }
Ejemplo n.º 5
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     parent::include_css('app/resources/custom-table.css');
     // creates the form
     $this->form = new TForm('form_search_Subelemento');
     $this->form->class = 'tform';
     // CSS class
     // creates a table
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     // add a row for the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     $row->addCell(new TLabel('Consulta SubElemento'))->colspan = 2;
     //$table->addRowSet( new TLabel('Consulta SubElemento') ,'')->class = 'tformtitle'; // CSS class
     // create the form fields
     $descricao = new TEntry('descricao');
     // define the sizes
     $descricao->setSize(350);
     // add one row for each form field
     $table->addRowSet(new TLabel('Descrição:'), $descricao);
     $this->form->setFields(array($descricao));
     // keep the form filled during navigation with session data
     $this->form->setData(TSession::getValue('Subelemento_filter_data'));
     // create two action buttons to the form
     $find_button = TButton::create('find', array($this, 'onSearch'), _t('Find'), 'ico_find.png');
     $this->form->addField($find_button);
     $buttons_box = new THBox();
     $buttons_box->add($find_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     // creates a Datagrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->class = 'tdatagrid_table customized-table';
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'right', 100);
     $descricao = new TDataGridColumn('descricao', 'Descrição', 'left');
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($descricao);
     // creates the datagrid column actions
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'id');
     $id->setAction($order_id);
     $order_descricao = new TAction(array($this, 'onReload'));
     $order_descricao->setParameter('order', 'descricao');
     $descricao->setAction($order_descricao);
     // 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());
     // create the page container
     $container = new TTable();
     //$container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->addRow()->addCell($this->form);
     $container->addRow()->addCell($this->datagrid);
     $container->addRow()->addCell($this->pageNavigation);
     parent::add($container);
 }
Ejemplo n.º 6
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_Campus');
     $this->form->class = 'tform';
     // CSS class
     //$this->form->style = 'width: 500px';
     // add a table inside form
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     // add a row for the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $row->addCell(new TLabel('Cadastro de Câmpus'))->colspan = 2;
     // create the form fields
     $id = new TEntry('id');
     $nome = new TEntry('nome');
     $uasg = new TEntry('uasg');
     $sigla = new TEntry('sigla');
     $id->setEditable(FALSE);
     // define the sizes
     $id->setSize(50);
     $nome->setSize(400);
     $uasg->setSize(150);
     $sigla->setSize(100);
     // validations
     $nome->addValidation('Nome', new TRequiredValidator());
     $uasg->addValidation('UASG', new TRequiredValidator());
     $sigla->addValidation('Sigla', new TRequiredValidator());
     $nome->addValidation('Nome', new TMaxLengthValidator(), array(50));
     $uasg->addValidation('UASG', new TMaxLengthValidator(), array(10));
     $sigla->addValidation('Sigla', new TMaxLengthValidator(), array(3));
     // add one row for each form field
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet($label_nome = new TLabel('Nome:'), $nome);
     //$label_nome->setFontColor('#FF0000');
     $table->addRowSet($label_uasg = new TLabel('UASG:'), $uasg);
     //$label_uasg->setFontColor('#FF0000');
     $table->addRowSet($label_sigla = new TLabel('Sigla:'), $sigla);
     //$label_sigla->setFontColor('#FF0000');
     $this->form->setFields(array($id, $nome, $uasg, $sigla));
     // create the form actions
     $save_button = TButton::create('save', array($this, 'onSave'), 'Salvar', 'ico_save.png');
     $new_button = TButton::create('new', array($this, 'onEdit'), 'Novo', 'ico_new.png');
     $back_button = TButton::create('back', array('CampusList', 'onReload'), 'Voltar para a listagem', 'ico_datagrid.png');
     $this->form->addField($save_button);
     $this->form->addField($new_button);
     $this->form->addField($back_button);
     $buttons_box = new THBox();
     $buttons_box->add($save_button);
     $buttons_box->add($new_button);
     $buttons_box->add($back_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     $container = new TTable();
     //$container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'CampusList'));
     $container->addRow()->addCell($this->form);
     parent::add($container);
 }
Ejemplo n.º 7
0
 function __construct()
 {
     parent::__construct();
     parent::setSize(850, 750);
     parent::setTitle('Busca de Itens');
     new TSession();
     if (!TSession::getValue('SRP_id')) {
         $this->continue = false;
     } else {
         $this->continue = true;
     }
     //cria o formulario
     $this->form = new TQuickForm('form_busca_item');
     //cria os campos de busca do formulario
     $numeroItem = new TEntry('numeroItem');
     $descricaoSumaria = new TEntry('descricaoSumaria');
     $fabricante = new TEntry('fabricante');
     //valors da sessao
     $descricaoSumaria->setValue(TSession::getValue('item_descricaoSumaria'));
     //adiciona os campos no formulario
     //if ((TSession::getValue('Item_filter_data')!== NULL) && (TSession::getValue('Item_filter_data'))){
     //    var_dump(TSession::getValue('Item_filter_data'));
     //    $this->form->setData( TSession::getValue('Item_filter_data'));
     //}
     $this->form->addQuickField('Nº Item:', $numeroItem, 70);
     $this->form->addQuickField('Descrição Sumária:', $descricaoSumaria, 250);
     $this->form->addQuickField('Fabricante:', $fabricante, 150);
     //adiciona a acao ao formulario
     $this->form->addQuickAction('Buscar', new TAction(array($this, 'onSearch')), 'ico_find.png');
     //criar a datagrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->makeScrollable();
     //$this->datagrid->width = '100%';
     $this->datagrid->setHeight(400);
     //criar as colunas da datagrid
     $GnumeroItem = new TDataGridColumn('numeroItem', 'Nº Item', 'left', 50);
     $GdescricaoSumaria = new TDataGridColumn('descricaoSumaria', 'Descrição Sumária', 'left', 500);
     $Gquantidade = new TDataGridColumn('estoqueDisponivel', 'Quantidade', 'right', 70);
     $GunidadeMedida = new TDataGridColumn('unidadeMedida', 'Unidade', 'left', 50);
     $GvalorUnitario = new TDataGridColumn('valorUnitario', 'Valor Unit.', 'right', 70);
     // add the columns to the DataGrid
     $this->datagrid->addColumn($GnumeroItem);
     $this->datagrid->addColumn($GdescricaoSumaria);
     $this->datagrid->addColumn($Gquantidade);
     $this->datagrid->addColumn($GunidadeMedida);
     $this->datagrid->addColumn($GvalorUnitario);
     //criar acao da coluna
     $action = new TDataGridAction(array($this, 'onSelect'));
     $action->setLabel('Select');
     $action->setImage('ico_apply.png');
     $action->setField('numeroItem');
     $this->datagrid->addAction($action);
     //cria o modelo
     $this->datagrid->createModel();
     //criar o navegador de pagina
     //$this->navegadorPagina = new TPageNavigation();
     //$this->navegadorPagina->setAction(new TAction(array($this, 'onReload')));
     //$this->navegadorPagina->setWidth($this->datagrid->getWidth());
     // criar a estrutura da pagina usando uma tabela
     $table = new TTable();
     $table->style = "width = 100%";
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     //$table->addRow()->addCell($this->navegadorPagina);
     // add the table inside the page
     parent::add($table);
 }
Ejemplo n.º 8
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_Srp_report');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     // creates the table container
     $table = new TTable();
     $table->width = '100%';
     // add the table inside the form
     $this->form->add($table);
     // define the form title
     $row = $table->addRow();
     //Set( new TLabel('Relatório de Srp'), '', '','', '' )->class = 'tformtitle';
     $row->class = 'tformtitle';
     $row->addCell(new TLabel('Relatório de Srp'))->colspan = 2;
     // create the form fields
     $numeroSRPI = new TEntry('numeroSRPI');
     $numeroSRPF = new TEntry('numeroSRPF');
     $numeroIRPI = new TEntry('numeroIRPI');
     $numeroIRPF = new TEntry('numeroIRPF');
     $numeroProcessoI = new TEntry('numeroProcessoI');
     $numeroProcessoF = new TEntry('numeroProcessoF');
     $validadeI = new TDate('validadeI');
     $validadeF = new TDate('validadeF');
     $nomeI = new TEntry('nomeI');
     $nomeF = new TEntry('nomeF');
     $itensZero = new TRadioGroup('itensZero');
     // define the sizes
     $numeroSRPI->setSize(150);
     $numeroSRPF->setSize(150);
     $numeroIRPI->setSize(150);
     $numeroIRPF->setSize(150);
     $numeroProcessoI->setSize(150);
     $numeroProcessoF->setSize(150);
     $validadeI->setSize(85);
     $validadeI->setProperty('style', 'margin-right : 0px');
     $validadeF->setSize(85);
     $validadeF->setProperty('style', 'margin-right : 0px');
     //$aprovado->setSize(90);
     //mask
     $validadeI->setMask('dd/mm/yyyy');
     $validadeF->setMask('dd/mm/yyyy');
     $validadeF->setValue(date('d/m/Y'));
     //$validadeI->setNumericMask(0, '', '');
     // validations
     //$aprovado->addValidation('Aprovado', new TRequiredValidator);
     $validadeF->addValidation('Validade - Até', new TDateValidator(), array('dd/mm/yyyy'));
     $itensZero->addItems(array('1' => 'Sim', '0' => 'Não'));
     $itensZero->setValue('0');
     $itensZero->setLayout('horizontal');
     // add one row for each form field
     $table->addRowSet(new TLabel('Nº SRP'), array($numeroSRPI, new TLabel('Até'), $numeroSRPF));
     $table->addRowSet(new TLabel('Nº IRP'), array($numeroIRPI, new TLabel('Até'), $numeroIRPF));
     $table->addRowSet(new TLabel('Nº Processo'), array($numeroProcessoI, new TLabel('Até'), $numeroProcessoF));
     $table->addRowSet(new TLabel('Emissão'), array($validadeI, new TLabel('Até'), $validadeF));
     $table->addRowSet(new TLabel('Lista itens zerado?'), $itensZero);
     $this->form->setFields(array($numeroProcessoI, $numeroProcessoF, $numeroIRPI, $numeroIRPF, $nomeI, $nomeF, $validadeI, $validadeF, $numeroSRPI, $numeroSRPF, $itensZero));
     //$aprovado->addItems(array('1' => 'Sim', '0' => 'Não', '%' => 'Todos'));
     //$aprovado->setValue('%');
     //$aprovado->setLayout('horizontal');
     $generate_button = TButton::create('generate', array($this, 'onGenerate'), _t('Generate'), 'ico_apply.png');
     $this->form->addField($generate_button);
     // add a row for the form action
     $table->addRowSet($generate_button, '')->class = 'tformaction';
     $container = new TTable();
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->addRow()->addCell($this->form);
     parent::add($container);
 }
Ejemplo n.º 9
0
 /**
  * Show the widget at the screen
  */
 public function show()
 {
     $wrapper = new TElement('div');
     $wrapper->{'mtf_name'} = $this->getName();
     // include the needed libraries and styles
     if ($this->fields) {
         $table = new TTable();
         $mandatory = array();
         // mandatory
         $fields = array();
         $i = 0;
         if ($this->orientation == 'horizontal') {
             $row_label = $table->addRow();
             $row_field = $table->addRow();
         }
         foreach ($this->fields as $name => $obj) {
             if ($this->orientation == 'vertical') {
                 $row = $table->addRow();
                 $row_label = $row;
                 $row_field = $row;
             }
             $label = new TLabel($obj->text);
             if ($obj->mandatory) {
                 $label->setFontColor('red');
             }
             $row_label->addCell($label);
             $row_field->addCell($obj->field);
             $mandatory[] = $obj->mandatory;
             $fields[] = $name;
             $post_fields[$name] = 1;
             $sizes[$name] = $obj->size;
             $obj->field->setName($this->name . '_' . $name);
             if (in_array(get_class($obj->field), array('TComboCombined', 'Adianti\\Widget\\Form\\TComboCombined'))) {
                 $aux_name = $obj->field->getTextName();
                 $aux_full_name = $this->name . '_' . $aux_name;
                 $mandatory[] = 0;
                 $obj->field->setTextName($aux_full_name);
                 $fields[] = $aux_name;
                 $post_fields[$aux_name] = 1;
                 // invert sizes
                 $sizes[$aux_name] = $obj->size;
                 $sizes[$name] = 20;
                 $i++;
             }
             $i++;
         }
         $wrapper->add($table);
     }
     // check whether the widget is non-editable
     if (parent::getEditable()) {
         // create three buttons to control the MultiField
         $add = new TButton("{$this->name}btnStore");
         $add->setLabel(AdiantiCoreTranslator::translate('Register'));
         //$add->setName("{$this->name}btnStore");
         $add->setImage('ico_save.png');
         $add->addFunction("mtf{$this->name}.addRowFromFormFields()");
         $del = new TButton("{$this->name}btnDelete");
         $del->setLabel(AdiantiCoreTranslator::translate('Delete'));
         $del->setImage('ico_delete.png');
         $can = new TButton("{$this->name}btnCancel");
         $can->setLabel(AdiantiCoreTranslator::translate('Cancel'));
         $can->setImage('ico_close.png');
         $hbox_buttons = new THBox();
         $hbox_buttons->{'style'} = 'margin-top:3px;margin-bottom:3px';
         $hbox_buttons->add($add);
         $hbox_buttons->add($del);
         $hbox_buttons->add($can);
         $wrapper->add($hbox_buttons);
     }
     // create the MultiField Panel
     $panel = new TElement('div');
     $panel->{'class'} = "multifieldDiv";
     $input = new THidden($this->name);
     $panel->add($input);
     // create the MultiField DataGrid Header
     $table = new TTable();
     $table->{'class'} = 'multifield';
     $table->{'id'} = "{$this->name}mfTable";
     $head = new TElement('thead');
     $table->add($head);
     $row = new TTableRow();
     $head->add($row);
     // fill the MultiField DataGrid
     if ($this->fields) {
         foreach ($this->fields as $obj) {
             $c = $obj->text;
             if (in_array(get_class($obj->field), array('TComboCombined', 'Adianti\\Widget\\Form\\TComboCombined'))) {
                 $cell = $row->addCell('ID');
                 $cell->{'width'} = '20px';
                 $cell->{'class'} = 'multifield_header';
             }
             $cell = $row->addCell($c);
             $cell->{'width'} = $obj->size . 'px';
             $cell->{'class'} = 'multifield_header';
         }
     }
     $body_height = $this->height - 34;
     $body = new TElement('tbody');
     $body->{'style'} = "height: {$body_height}px";
     $body->{'class'} = 'tmultifield_scrolling';
     $table->add($body);
     if ($this->objects) {
         foreach ($this->objects as $obj) {
             if (isset($obj->id)) {
                 $row = new TTableRow();
                 $row->dbId = $obj->id;
                 $body->add($row);
             } else {
                 $row = new TTableRow();
                 $body->add($row);
             }
             if ($fields) {
                 foreach ($fields as $name) {
                     $cellValue = is_null($obj->{$name}) ? '' : $obj->{$name};
                     $original = $cellValue;
                     if (is_array(json_decode($cellValue))) {
                         $content = json_decode($cellValue);
                         $rows = array();
                         foreach ($content as $_row) {
                             $rows[] = implode(':', array_values(get_object_vars($_row)));
                         }
                         $cellValue = implode(',', $rows);
                         $cell = $row->addCell($cellValue);
                         $cell->{'data'} = htmlspecialchars($original);
                     } else {
                         $cell = $row->addCell($cellValue);
                         $cell->{'data'} = $cellValue;
                     }
                     if (isset($sizes[$name])) {
                         $cell->style = 'width:' . $sizes[$name] . 'px;';
                     }
                 }
             }
         }
     }
     $panel->add($table);
     $wrapper->add($panel);
     $wrapper->show();
     echo '<script type="text/javascript">';
     echo "var mtf{$this->name};";
     echo "mtf{$this->name} = new MultiField('{$this->name}mfTable',{$this->width},{$this->height});\n";
     $s = implode("','", $fields);
     echo "mtf{$this->name}.formFieldsAlias = Array('{$s}');\n";
     $sfields = implode("','{$this->name}_", $fields);
     echo "mtf{$this->name}.formFieldsName = Array('{$this->name}_{$sfields}');\n";
     echo "mtf{$this->name}.formPostFields = Array();\n";
     if ($post_fields) {
         foreach ($post_fields as $col => $value) {
             echo "mtf{$this->name}.formPostFields['{$col}'] = '{$value}';\n";
         }
     }
     $mdr_array = implode(',', $mandatory);
     echo "mtf{$this->name}.formFieldsMandatory = [{$mdr_array}];\n";
     echo "mtf{$this->name}.mandatoryMessage = '" . AdiantiCoreTranslator::translate('The field ^1 is required') . "';\n";
     echo "mtf{$this->name}.storeButton  = document.getElementsByName('{$this->name}btnStore')[0];\n";
     echo "mtf{$this->name}.deleteButton = document.getElementsByName('{$this->name}btnDelete')[0];\n";
     echo "mtf{$this->name}.cancelButton = document.getElementsByName('{$this->name}btnCancel')[0];\n";
     echo "mtf{$this->name}.inputResult  = document.getElementsByName('{$this->name}')[0];\n";
     echo '</script>';
 }
Ejemplo n.º 10
0
 /**
  * Shows the DataGrid
  */
 function show()
 {
     // shows the datagrid
     parent::show();
     $params = $_REQUEST;
     unset($params['class']);
     unset($params['method']);
     // to keep browsing parameters (order, page, first_page, ...)
     $urlparams = '&' . http_build_query($params);
     // inline editing treatment
     TScript::create('$(function() {
     	$(".inlineediting").editInPlace({
     		callback: function(unused, enteredText)
     		{
     		    __adianti_load_page($(this).attr("action")+"' . $urlparams . '&key="+$(this).attr("key")+"&field="+$(this).attr("field")+"&value="+encodeURIComponent(enteredText));
     		    return enteredText;
     		},
     		show_buttons: false,
     		text_size:20,
     		params:column=name
 	    });
     });');
 }
Ejemplo n.º 11
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_search_Requisicao');
     $this->form->class = 'tform';
     // CSS class
     // creates a table
     $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('Consulta Requisicao'))->colspan = 2;
     // create the form fields
     $numeroProcesso = new TEntry('numeroProcesso');
     // define the sizes
     $numeroProcesso->setSize(200);
     $numeroProcesso->setMaxLength(30);
     $numeroProcesso->setTip('Número do processo gerado no SIGA');
     // add one row for each form field
     $table->addRowSet(new TLabel('Nº do Processo:'), $numeroProcesso);
     $this->form->setFields(array($numeroProcesso));
     // keep the form filled during navigation with session data
     $this->form->setData(TSession::getValue('Requisicao_filter_data'));
     // create two action buttons to the form
     $find_button = TButton::create('find', array($this, 'onSearch'), 'Buscar', 'ico_find.png');
     $new_button = TButton::create('new', array('RequisicaoForm', 'onEdit'), 'Novo', 'ico_new.png');
     $this->form->addField($find_button);
     $this->form->addField($new_button);
     $buttons_box = new THBox();
     $buttons_box->add($find_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;
     // creates a Datagrid
     parent::include_css('app/resources/custom-table.css');
     $this->datagrid = new TDataGrid();
     $this->datagrid->class = 'tdatagrid_table customized-table';
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'right', 80);
     $srp = new TDataGridColumn('numeroSRP', 'Nº SRP', 'left', 100);
     $numeroProcesso = new TDataGridColumn('numeroProcesso', 'Nº do processo', 'left', 250);
     $data = new TDataGridColumn('emissao', 'Data', 'left', 100);
     $id->setTransformer(array($this, 'rowFormat'));
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($srp);
     $this->datagrid->addColumn($numeroProcesso);
     $this->datagrid->addColumn($data);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('RequisicaoForm', 'onEdit'));
     //$action1 = new TDataGridAction(array($this, 'onCheckValidadeSRP'));
     $action1->setLabel('Editar');
     $action1->setImage('ico_edit.png');
     $action1->setField('id');
     $action1->setDisplayCondition(array($this, 'onDisplayConditionEdit'));
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel('Excluir');
     $action2->setImage('ico_delete.png');
     $action2->setField('id');
     $actAprovar = new TDataGridAction(array($this, 'onQuestionAprovarRequisicao'));
     $actAprovar->setLabel('Aprovar Requisição');
     $actAprovar->setImage('fa:check fa-fw');
     $actAprovar->setField('id');
     $actAprovar->setDisplayCondition(array($this, 'onDisplayConditionEdit'));
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     $this->datagrid->addAction($actAprovar);
     // 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());
     //limpar a sessao com detalhes de itens e requisicao
     TSession::delValue('requisicao_itens');
     TSession::delValue('SRP_id');
     TSession::delValue('form_requisicao');
     // create the page container
     //$container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation);
     $container = new TTable();
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->addRow()->addCell($this->form);
     $container->addRow()->addCell($this->datagrid);
     $container->addRow()->addCell($this->pageNavigation);
     parent::add($container);
 }
Ejemplo n.º 12
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_funcionalidades = new TFrame();
     $frame_funcionalidades->setLegend('Funcionalidades');
     // Cria o form
     $this->form = new TForm('form_Grupo');
     $this->form->class = 'tform';
     // add the notebook inside the form
     $this->form->add($table);
     $table->addRowSet(new TLabel('Grupo'), '')->class = 'tformtitle';
     // cria os campos de pesquisa do form
     $id = new TEntry('id');
     $nome = new TEntry('nome');
     $sigla = new TEntry('sigla');
     $this->list1 = new TSortList('list1');
     $this->list2 = new TSortList('list2');
     $this->list1->setSize(300, 200);
     $this->list2->setSize(300, 200);
     $this->list1->connectTo($this->list2);
     $this->list2->connectTo($this->list1);
     /* $multifield = new TMultiField('programs');
               $program_id = new TDBSeekButton('program_id', 'saciq', 'form_Grupo', 'Funcionalidade', 'nome', 'programs_id', 'programs_nome');
               $program_nome = new TEntry('program_nome');
     
               $frame_programs->add($multifield);
     
               $multifield->setHeight(140);
               $multifield->setClass('Funcionalidade');
               $multifield->addField('id', 'ID', $program_id, 100, true);
               $multifield->addField('nome', 'Funcionalidade', $program_nome, 250);
               $multifield->setOrientation('horizontal'); */
     // define the sizes
     //$program_id->setSize(70);
     $id->setSize(100);
     $nome->setSize(400);
     $sigla->setSize(150);
     // validations
     $nome->addValidation('Nome', new TRequiredValidator());
     $sigla->addValidation('Sigla', new TRequiredValidator());
     $nome->addValidation('Nome', new TMaxLengthValidator(), array(45));
     $sigla->addValidation('Sigla', new TMaxLengthValidator(), array(10));
     // outras propriedades
     $id->setEditable(false);
     //$program_nome->setEditable(false);
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('Nome: '), $nome);
     $table->addRowSet(new TLabel('Sigla:'), $sigla);
     // add a row for the field nome
     //$row = $table->addRow();
     //$cell = $row->addCell($frame_programs);
     //$cell->colspan = 2;
     $vbox1 = new TVBox();
     $vbox1->add(new TLabel('<b>Disponível</b>'));
     $vbox1->add($this->list1);
     $vbox2 = new TVBox();
     $vbox2->add(new TLabel('<b>Selecionado</b>'));
     $vbox2->add($this->list2);
     $hbox = new THBox();
     $hbox->add($vbox1);
     $hbox->add($vbox2);
     $frame_funcionalidades->add($hbox);
     $row = $table->addRow();
     $cell = $row->addCell($frame_funcionalidades);
     $cell->colspan = 2;
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), 'Salvar');
     $save_button->setImage('ico_save.png');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), 'Novo');
     $new_button->setImage('ico_new.png');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('GrupoList', 'onReload')), 'Voltar para a listagem');
     $list_button->setImage('ico_datagrid.png');
     // define the form fields
     $this->form->setFields(array($id, $nome, $sigla, $this->list1, $this->list2, $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', 'GrupoList'));
     $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);
 }
Ejemplo n.º 13
0
 /**
  * Construtor
  * 
  * Criação da listagem de grupos
  */
 public function __construct()
 {
     parent::__construct();
     parent::include_css('app/resources/custom-table.css');
     // Cria o form
     $this->form = new TForm('form_search_Grupo');
     $this->form->class = 'tform';
     // cria a tabela
     $table = new TTable();
     $table->style = 'width:100%';
     //cria o titulo
     $table->addRowSet(new TLabel('Consulta Grupos'), '')->class = 'tformtitle';
     // Adiciona a tabela no form
     $this->form->add($table);
     // Cria os campos para filtro
     $nome = new TEntry('nome');
     $nome->setValue(TSession::getValue('s_nome'));
     $nome->setSize(300);
     $sigla = new TEntry('sigla');
     $sigla->setValue(TSession::getValue('s_sigla'));
     $sigla->setSize(100);
     // Adiciona linha na tabela para inserir o campos
     $row = $table->addRow();
     $row->addCell(new TLabel('Nome: '));
     $row->addCell($nome);
     $row = $table->addRow();
     $row->addCell(new TLabel('Sigla: '));
     $row->addCell($sigla);
     // cria os dois botoes de ações do form
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     // define o botao de acao
     $find_button->setAction(new TAction(array($this, 'onSearch')), 'Buscar');
     $find_button->setImage('ico_find.png');
     $new_button->setAction(new TAction(array('GrupoForm', 'onEdit')), 'Novo');
     $new_button->setImage('ico_new.png');
     $container = new THBox();
     $container->add($find_button);
     $container->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($container);
     $cell->colspan = 2;
     // define qual é os campos do form
     $this->form->setFields(array($nome, $sigla, $find_button, $new_button));
     // cria o datagrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->class = 'tdatagrid_table customized-table';
     $this->datagrid->setHeight(320);
     // cria as colunas do datagrid
     $id = new TDataGridColumn('id', 'ID', 'center');
     $nome = new TDataGridColumn('nome', 'Nome', 'center');
     $sigla = new TDataGridColumn('sigla', 'Sigla', 'center');
     // adiciona as colunas ao datagrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($nome);
     $this->datagrid->addColumn($sigla);
     // cria as acoes das colunas do datagrid (quando clica no titulo do grid)
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'id');
     $id->setAction($order_id);
     $order_nome = new TAction(array($this, 'onReload'));
     $order_nome->setParameter('order', 'nome');
     $nome->setAction($order_nome);
     $order_sigla = new TAction(array($this, 'onReload'));
     $order_sigla->setParameter('order', 'sigla');
     $sigla->setAction($order_sigla);
     // edição em linha
     $nome_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $nome_edit->setField('id');
     $nome->setEditAction($nome_edit);
     $sigla_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $sigla_edit->setField('id');
     $sigla->setEditAction($sigla_edit);
     // cria duas acoes do datagrid
     $action1 = new TDataGridAction(array('GrupoForm', 'onEdit'));
     $action1->setLabel('Editar');
     $action1->setImage('ico_edit.png');
     $action1->setField('id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel('Excluir');
     $action2->setImage('ico_delete.png');
     $action2->setField('id');
     // adiciona as acoes ao datagrid
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     // cria o modelo do datagrid
     $this->datagrid->createModel();
     // cria o navegador de paginas
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // cria a estrutura da tela usando tabelas
     $container = new TTable();
     //$container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->addRow()->addCell($this->form);
     $container->addRow()->addCell($this->datagrid);
     $container->addRow()->addCell($this->pageNavigation);
     // add the container inside the page
     parent::add($container);
 }
Ejemplo n.º 14
0
 /**
  * Shows the DataGrid
  */
 function show()
 {
     // shows the datagrid
     parent::show();
     $params = $_REQUEST;
     unset($params['class']);
     unset($params['method']);
     // to keep browsing parameters (order, page, first_page, ...)
     $urlparams = '&' . http_build_query($params);
     // inline editing treatment
     TScript::create(" tdatagrid_inlineedit( '{$urlparams}' );");
     TScript::create(" tdatagrid_enable_groups();");
 }
Ejemplo n.º 15
0
 function __construct()
 {
     parent::__construct();
     parent::include_css('app/resources/custom-table.css');
     //criar o form
     $this->form = new TForm('form_consulta_srp');
     $this->form->class = 'tform';
     //cria a tabela
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     //adiciona uma linha na tabela para o titulo
     $row = $table->addRow();
     $row->class = 'tformtitle';
     $row->addCell(new TLabel('Consulta SRP'))->colspan = 2;
     // cria os campos do formulario
     $numeroSRP = new TEntry('numeroSRP');
     $numeroIRP = new TEntry('numeroIRP');
     $numeroProcesso = new TEntry('numeroProcesso');
     $uasg = new TEntry('uasg');
     $validade = new TDate('validade');
     $nome = new TEntry('nome');
     // define os tamanhos
     $numeroSRP->setSize(70);
     $numeroIRP->setSize(70);
     $numeroProcesso->setSize(150);
     $uasg->setSize(70);
     $validade->setSize(100);
     $validade->setProperty('style', 'margin-right : 0px');
     $nome->setSize(400);
     $validade->setMask('dd/mm/yyyy');
     // adiciona uma linha na tabela para cada campo
     $table->addRowSet(new TLabel('Nº SRP:'), $numeroSRP);
     $table->addRowSet(new TLabel('Nº IRP:'), $numeroIRP);
     $table->addRowSet(new TLabel('Proc. Orig.:'), $numeroProcesso);
     $table->addRowSet(new TLabel('Nome:'), $nome);
     $table->addRowSet(new TLabel('UASG:'), $uasg);
     $table->addRowSet(new TLabel('Validade:'), $validade);
     $this->form->setFields(array($numeroSRP, $numeroIRP, $numeroProcesso, $uasg, $validade, $nome));
     // manter o formulario preenchido durante navegação com os dados da sessao
     $this->form->setData(TSession::getValue('Srp_filter_data'));
     //cria o botão de ação
     $find_button = TButton::create('find', array($this, 'onSearch'), 'Consultar', 'ico_find.png');
     $this->form->addField($find_button);
     // adiciona uma linha para a acao do formulario
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($find_button)->colspan = 2;
     // cria o datagrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->class = 'tdatagrid_table customized-table';
     $this->datagrid->setHeight(320);
     // cria as colunas do datagrid
     $numeroSRP = new TDataGridColumn('numeroSRP', 'Nº SRP', 'left', 70);
     $numeroIRP = new TDataGridColumn('numeroIRP', 'Nº IRP', 'left', 70);
     $numeroProcesso = new TDataGridColumn('numeroProcesso', 'Proc. Orig.', 'left', 150);
     $uasg = new TDataGridColumn('uasg', 'UASG', 'left', 50);
     $validade = new TDataGridColumn('validade', 'Validade', 'left', 100);
     $nome = new TDataGridColumn('nome', 'Nome', 'left', 300);
     $validade->setTransformer(array($this, 'rowFormat'));
     // adiciona as colunas ao datagrid
     $this->datagrid->addColumn($numeroSRP);
     $this->datagrid->addColumn($numeroIRP);
     $this->datagrid->addColumn($numeroProcesso);
     $this->datagrid->addColumn($nome);
     $this->datagrid->addColumn($uasg);
     $this->datagrid->addColumn($validade);
     $srpViewAction = new TDataGridAction(array('SrpFormView', 'onViewSrp'));
     $srpViewAction->setLabel('Itens');
     $srpViewAction->setImage('fa:th-list');
     $srpViewAction->setField('id');
     $this->datagrid->addAction($srpViewAction);
     // cria o modelo no datagrid
     $this->datagrid->createModel();
     // cria o navegador de pagina
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     $container = new TTable();
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->addRow()->addCell($this->form);
     $container->addRow()->addCell($this->datagrid);
     $container->addRow()->addCell($this->pageNavigation);
     parent::add($container);
 }
Ejemplo n.º 16
0
 /**
  * Show the PageNavigation widget
  */
 public function show()
 {
     if (!$this->action instanceof TAction) {
         throw new Exception(AdiantiCoreTranslator::translate('You must call ^1 before add this component', __CLASS__ . '::' . 'setAction()'));
     }
     $first_page = isset($this->first_page) ? $this->first_page : 1;
     $direction = 'asc';
     $page_size = isset($this->limit) ? $this->limit : 10;
     $max = 10;
     $registros = $this->count;
     if (!$registros) {
         $registros = 0;
     }
     if ($page_size > 0) {
         $pages = (int) ($registros / $page_size) - $first_page + 1;
     } else {
         $pages = 1;
     }
     if ($page_size > 0) {
         $resto = $registros % $page_size;
     }
     $pages += $resto > 0 ? 1 : 0;
     $last_page = min($pages, $max);
     $div = new TElement('div');
     $div->{'class'} = 'tpagenavigation';
     $div->align = 'center';
     $table = new TTable();
     $table->cellpadding = 0;
     $table->cellspacing = 0;
     $row = $table->addRow();
     //previous
     $link = new TElement('a');
     $span = new TElement('span');
     $cell = $row->addCell($link);
     $link->add($span);
     $cell->{'class'} = 'prev';
     if ($first_page > 1) {
         $this->action->setParameter('offset', ($first_page - $max) * $page_size);
         $this->action->setParameter('limit', $page_size);
         $this->action->setParameter('page', $first_page - $max);
         $this->action->setParameter('first_page', $first_page - $max);
         $this->action->setParameter('order', $this->order);
         $link->href = $this->action->serialize();
         $link->generator = 'adianti';
         $span->add('&lt;&lt;');
     } else {
         $span->add('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
     }
     for ($n = $first_page; $n <= $last_page + $first_page - 1; $n++) {
         $offset = ($n - 1) * $page_size;
         $link = new TElement('a');
         $this->action->setParameter('offset', $offset);
         $this->action->setParameter('limit', $page_size);
         $this->action->setParameter('page', $n);
         $this->action->setParameter('first_page', $first_page);
         $this->action->setParameter('order', $this->order);
         $link->href = $this->action->serialize();
         $link->generator = 'adianti';
         $span = new TElement('span');
         $span->add($n);
         $cell = $row->addCell($link);
         $link->add($span);
         if ($this->page == $n) {
             $cell->{'class'} = 'on';
         }
     }
     for ($z = $n; $z <= 10; $z++) {
         $link = new TElement('a');
         $span = new TElement('span');
         $span->add($z);
         $cell = $row->addCell($link);
         $link->add($span);
         $cell->{'class'} = 'off';
     }
     $link = new TElement('a');
     $span = new TElement('span');
     $cell = $row->addCell($link);
     $link->add($span);
     $cell->{'class'} = 'next';
     if ($pages > $max) {
         $offset = ($n - 1) * $page_size;
         $first_page = $n;
         $this->action->setParameter('offset', $offset);
         $this->action->setParameter('limit', $page_size);
         $this->action->setParameter('page', $n);
         $this->action->setParameter('first_page', $first_page);
         $this->action->setParameter('order', $this->order);
         $link->href = $this->action->serialize();
         $link->generator = 'adianti';
         $span->add('&nbsp; &gt;&gt; &nbsp; ');
     } else {
         $span->add('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
     }
     $div->add($table);
     $div->show();
 }
Ejemplo n.º 17
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // Cria o form
     $this->form = new TForm('form_Usuario');
     $this->form->class = 'tform';
     // creates the table container
     $table = new TTable();
     $table->style = 'width: 100%';
     $table->addRowSet(new TLabel('Usuário'), '', '', '')->class = 'tformtitle';
     // adiciona a tabela no form
     $this->form->add($table);
     $frame_grupos = new TFrame(NULL, 280);
     $frame_grupos->setLegend('Grupos');
     $frame_grupos->style .= ';margin: 4px';
     $frame_funcionalidades = new TFrame(NULL, 280);
     $frame_funcionalidades->setLegend('Funcionalidades');
     $frame_funcionalidades->style .= ';margin: 15px';
     // cria os campos de pesquisa do form
     $id = new TEntry('id');
     $nome = new TEntry('nome');
     $prontuario = new TEntry('prontuario');
     $password = new TPassword('senha');
     $repassword = new TPassword('resenha');
     $email = new TEntry('email');
     $multifield_funcionalidades = new TMultiField('funcionalidades');
     $funcionalidade_id = new TDBSeekButton('funcionalidade_id', 'saciq', 'form_Usuario', 'Funcionalidade', 'nome', 'funcionalidades_id', 'funcionalidades_nome');
     $funcionalidade_nome = new TEntry('funcionalidade_nome');
     $grupos = new TDBCheckGroup('grupos', 'saciq', 'Grupo', 'id', 'nome');
     //$frontpage_id        = new TDBSeekButton('frontpage_id', 'saciq', 'form_Usuario', 'Funcionalidade', 'nome', 'frontpage_id', 'frontpage_nome');
     //$frontpage_nome      = new TEntry('frontpage_nome');
     $scroll = new TScroll();
     $scroll->setSize(290, 230);
     $scroll->add($grupos);
     $frame_grupos->add($scroll);
     $frame_funcionalidades->add($multifield_funcionalidades);
     // define the sizes
     $id->setSize(100);
     $nome->setSize(350);
     $prontuario->setSize(150);
     $password->setSize(150);
     $repassword->setSize(150);
     $email->setSize(250);
     $multifield_funcionalidades->setHeight(140);
     // outros
     $id->setEditable(false);
     $funcionalidade_nome->setEditable(false);
     $email->setProperty('autocomplete', 'off');
     // validations
     $nome->addValidation('Nome', new TRequiredValidator());
     $prontuario->addValidation('Prontuário', new TRequiredValidator());
     $email->addValidation('Email', new TEmailValidator());
     $nome->addValidation('Nome', new TMaxLengthValidator(), array(60));
     $prontuario->addValidation('Prontuário', new TMaxLengthValidator(), array(60));
     $email->addValidation('Email', new TMaxLengthValidator(), array(60));
     $funcionalidade_id->setSize(50);
     $funcionalidade_nome->setSize(200);
     // configuracoes multifield
     $multifield_funcionalidades->setClass('Funcionalidade');
     $multifield_funcionalidades->addField('id', 'ID', $funcionalidade_id, 60, true);
     $multifield_funcionalidades->addField('nome', 'Nome', $funcionalidade_nome, 250);
     $multifield_funcionalidades->setOrientation('horizontal');
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $id, new TLabel('Nome: '), $nome);
     $table->addRowSet(new TLabel('Prontuário: '), $prontuario, new TLabel('Email: '), $email);
     $table->addRowSet(new TLabel('Senha: '), $password, new TLabel('Confirmação <br>da senha: '), $repassword);
     $row = $table->addRow();
     $cell = $row->addCell($frame_grupos);
     $cell->colspan = 2;
     $cell = $row->addCell($frame_funcionalidades);
     $cell->colspan = 2;
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), 'Salvar');
     $save_button->setImage('ico_save.png');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), 'Novo');
     $new_button->setImage('ico_new.png');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('UsuarioList', 'onReload')), 'Voltar para a listagem');
     $list_button->setImage('ico_datagrid.png');
     // define the form fields
     $this->form->setFields(array($id, $nome, $prontuario, $password, $repassword, $multifield_funcionalidades, $grupos, $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', 'UsuarioList'));
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
Ejemplo n.º 18
0
 /**
  * 
  */
 public function makeTDataGrid($properties)
 {
     $table = new TTable();
     $widget = new TDataGrid();
     $widget->setHeight((string) $properties->{'height'});
     if ($properties->{'columns'}) {
         foreach ($properties->{'columns'} as $Column) {
             $dgcolumn = new TDataGridColumn((string) $Column->{'name'}, (string) $Column->{'label'}, (string) $Column->{'align'}, (string) $Column->{'width'});
             $widget->addColumn($dgcolumn);
             $this->fieldsByName[(string) $Column->{'name'}] = $dgcolumn;
         }
     }
     if ($properties->{'actions'}) {
         foreach ($properties->{'actions'} as $Action) {
             $dgaction = new TDataGridAction(array($this->controller, (string) $Action->{'method'}));
             $dgaction->setLabel((string) $Action->{'label'});
             $dgaction->setImage((string) $Action->{'image'});
             $dgaction->setField((string) $Action->{'field'});
             $widget->addAction($dgaction);
             //$this->fieldsByName[(string)$properties->Name] = $column;
         }
     }
     if ((string) $properties->{'pagenavigator'} == 'yes') {
         $loader = (string) $properties->{'loader'} ? (string) $properties->{'loader'} : 'onReload';
         $pageNavigation = new TPageNavigation();
         $pageNavigation->setAction(new TAction(array($this->controller, $loader)));
         $pageNavigation->setWidth($widget->getWidth());
     }
     $widget->createModel();
     $row = $table->addRow();
     $row->addCell($widget);
     if (isset($pageNavigation)) {
         $row = $table->addRow();
         $row->addCell($pageNavigation);
         $widget->setPageNavigation($pageNavigation);
     }
     $this->fieldsByName[(string) $properties->{'name'}] = $widget;
     $widget = $table;
     return $widget;
 }
Ejemplo n.º 19
0
 /**
  * Add a form action
  * @param $label  Action Label
  * @param $action TAction Object
  * @param $icon   Action Icon
  */
 public function addQuickAction($label, TAction $action, $icon = 'ico_save.png')
 {
     $name = strtolower(str_replace(' ', '_', $label));
     $button = new TButton($name);
     parent::addField($button);
     // define the button action
     $button->setAction($action, $label);
     $button->setImage($icon);
     if (!$this->has_action) {
         // creates the action table
         $actions = new TTable();
         $this->action_row = $actions->addRow();
         $row = $this->table->addRow();
         $row->{'class'} = 'tformaction';
         $cell = $row->addCell($actions);
         $cell->colspan = 2;
     }
     // add cell for button
     $this->action_row->addCell($button);
     $this->has_action = TRUE;
     $this->actionButtons[] = $button;
     return $button;
 }
Ejemplo n.º 20
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_pessoa');
     // creates a table
     $table_data = new TTable();
     $table_contato = new TTable();
     $notebook = new TNotebook(500, 250);
     // add the notebook inside the form
     $this->form->add($notebook);
     $notebook->appendPage('Dados Principais', $table_data);
     $notebook->appendPage('Contatos', $table_contato);
     // create the form fields
     $idpessoa = new TEntry('idpessoa');
     $nome = new TEntry('nome');
     $dtcadastro = new TDate('dtcadastro');
     $dtnascimento = new TDate('dtnascimento');
     $natureza = new TRadioGroup('natureza');
     $idramoatividade = new TDBCombo('idramoatividade', 'sobcontrole', 'ramoatividade', 'idramoatividade', 'descricao');
     $obs = new TText('obs');
     // add field validators
     $nome->addValidation('Nome', new TRequiredValidator());
     $dtcadastro->addValidation('Data Cadastro', new TRequiredValidator());
     $dtnascimento->addValidation('Data Nascimento', new TRequiredValidator());
     $idramoatividade->addValidation('Ramo de Atividade', new TRequiredValidator());
     $natureza->addValidation('Natureza', new TRequiredValidator());
     $itemNatureza = array();
     $itemNatureza['F'] = 'Física';
     $itemNatureza['J'] = 'Jurídica';
     // add the combo options
     $natureza->addItems($itemNatureza);
     $natureza->setLayout('horizontal');
     // define some properties for the form fields
     $idpessoa->setEditable(FALSE);
     $idpessoa->setSize(100);
     $nome->setSize(320);
     $obs->setSize(320);
     $dtcadastro->setSize(90);
     $dtnascimento->setSize(90);
     $natureza->setSize(70);
     $idramoatividade->setSize(120);
     // add a row for the field code
     $table_data->addRowSet(new TLabel('ID:'), array($idpessoa, new TLabel('Natureza:'), $natureza));
     $table_data->addRowSet(new TLabel('Nome/Fantasia:'), $nome);
     $table_data->addRowSet(new TLabel('Data Cadastro:'), $dtcadastro);
     $table_data->addRowSet(new TLabel('Data Nascimento/Início:'), $dtnascimento);
     $table_data->addRowSet(new TLabel('Ramo de Atividade:'), $idramoatividade);
     $table_data->addRowSet(new TLabel('Observações:'), $obs);
     $row = $table_contato->addRow();
     // adiciona linha
     $cell = $row->addCell(new TLabel('<b>Contatos</b>'));
     // adiciona celular na linha
     $cell->valign = 'top';
     // define alinhamento
     $listacontatos = new TMultiField('listacontatos');
     // cria multifield
     // com TDBSeekButton
     //$idtipocontato= new TDBSeekButton('idtipocontato', 'sobcontrole', $this->form->getName(), 'tipocontato', 'descricao', 'listacontatos_idtipocontato', 'listacontatos_descricaotipocontato');
     // com  TSeekButton
     /*$idtipocontato= new TSeekButton('idtipocontato');
       $auxidtipocontato = new BuscaTipoContato;
       $auxaction= new TAction(array($auxidtipocontato,'onReload'));
       $idtipocontato->setAction($auxaction);*/
     $idtipocontato = new TDBCombo('idtipocontato', 'sobcontrole', 'tipocontato', 'idtipocontato', 'descricao', 'descricao');
     $descricaotipocontato = new \Adianti\Widget\Form\THidden('tipocontato->descricao');
     //$descricaotipocontato->setEditable(false);
     $valorcontato = new TEntry('valorcontato');
     $listacontatos->setClass('contato');
     // define the returning class
     // colunas do multifield
     // coluna do ID do tipo de contato (1->email, 2->telefone, etc...)
     $listacontatos->addField('idtipocontato', 'ID: ', $idtipocontato, 40);
     // coluna da descricao do tipo de contato
     //                        desta forma o grid OK
     $listacontatos->addField('tipocontato->descricao', '', $descricaotipocontato, 200);
     //                        desta forma o TDBSeekButton fica OK.
     //$listacontatos->addField('descricaotipocontato', 'Descrição Tipo Contato: ', $descricaotipocontato, 200);
     // coluna com o valor do contato, número do telefone, celular, etc.
     $listacontatos->addField('descricao', 'Valor Contato: ', $valorcontato, 200);
     $listacontatos->setHeight(250);
     $row = $table_contato->addRow();
     $row->addCell($listacontatos);
     // create an action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onSave')), 'Salvar');
     $button1->setImage('ico_save.png');
     // create an action button (go to list)
     $button2 = new TButton('list');
     $button2->setAction(new TAction(array('PessoaDataGrid', 'onReload')), 'Listar');
     $button2->setImage('ico_datagrid.gif');
     $button0 = new TButton('new');
     $button0->setAction(new TAction(array($this, 'onClear')), 'Novo');
     $button0->setImage('ico_new.png');
     // define wich are the form fields
     $this->form->setFields(array($idpessoa, $nome, $dtcadastro, $dtnascimento, $natureza, $idramoatividade, $obs, $listacontatos, $button0, $button1, $button2));
     $subtable = new TTable();
     $row = $subtable->addRow();
     $row->addCell($button0);
     $row->addCell($button1);
     $row->addCell($button2);
     // wrap the page content
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     $vbox->add($subtable);
     // add the form inside the page
     parent::add($vbox);
 }
Ejemplo n.º 21
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // Cria o form
     $this->form = new TForm('form_search_Funcionalidade');
     $this->form->class = 'tform';
     // cria a tabela
     $table = new TTable();
     $table->style = 'width:100%';
     $table->addRowSet(new TLabel('Consulta Funcionalidades'), '')->class = 'tformtitle';
     // adiciona a tabela no form
     $this->form->add($table);
     // cria os campos de pesquisa do form
     $nome = new TEntry('nome');
     $nome->setValue(TSession::getValue('Funcionalidade_nome'));
     $nome->setSize(500);
     $control = new TEntry('classe');
     $control->setValue(TSession::getValue('Funcionalidade_control'));
     $control->setSize(500);
     // adiciona linha para os campos de filtro
     $row = $table->addRowSet(new TLabel('Nome: '), $nome);
     $row = $table->addRowSet(new TLabel('Classe de Controle: '), $control);
     // cria dois botoes de acao para o form
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     // define as acoes dos botoes
     $find_button->setAction(new TAction(array($this, 'onSearch')), 'Buscar');
     $find_button->setImage('ico_find.png');
     $new_button->setAction(new TAction(array('FuncionalidadeForm', 'onEdit')), 'Novo');
     $new_button->setImage('ico_new.png');
     // define quais sao os campos do form
     $this->form->setFields(array($nome, $control, $find_button, $new_button));
     $container = new THBox();
     $container->add($find_button);
     $container->add($new_button);
     //$container->style = "float: right";
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($container);
     $cell->colspan = 2;
     parent::include_css('app/resources/custom-table.css');
     // cria o datagrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->class = 'tdatagrid_table customized-table';
     $this->datagrid->setHeight(320);
     // cria as colunas do datagrid
     $id = new TDataGridColumn('id', 'ID', 'right');
     $nome = new TDataGridColumn('nome', 'Nome', 'left');
     $classe = new TDataGridColumn('classe', 'Classe de Controle', 'left');
     // adiciona as colunas ao datagrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($nome);
     $this->datagrid->addColumn($classe);
     // cria as acoes das colunas do datagrid
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'id');
     $id->setAction($order_id);
     $order_nome = new TAction(array($this, 'onReload'));
     $order_nome->setParameter('order', 'nome');
     $nome->setAction($order_nome);
     $order_classe = new TAction(array($this, 'onReload'));
     $order_classe->setParameter('order', 'classe');
     $classe->setAction($order_classe);
     // edicao inline
     $nome_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $nome_edit->setField('id');
     $nome->setEditAction($nome_edit);
     $classe_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $classe_edit->setField('id');
     $classe->setEditAction($classe_edit);
     // cria 2 acoes do datagrid
     $action1 = new TDataGridAction(array('FuncionalidadeForm', 'onEdit'));
     $action1->setLabel('Editar');
     $action1->setImage('ico_edit.png');
     $action1->setField('id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel('Excluir');
     $action2->setImage('ico_delete.png');
     $action2->setField('id');
     // adiciona as acoes ao datagrid
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     // cria o modelo do datagrid
     $this->datagrid->createModel();
     // cria o navegador de paginas
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // cria a estrutura da pagina usando tabela
     $table = new TTable();
     $table->style = 'width: 80%';
     $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     // adiciona a tabela $table dentro da pagina
     parent::add($table);
 }
Ejemplo n.º 22
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     parent::include_css('app/resources/custom-table.css');
     // Cria o form
     $this->form = new TForm('form_search_Usuario');
     $this->form->class = 'tform';
     // cria a tabela
     $table = new TTable();
     $table->style = 'width:100%';
     $table->addRowSet(new TLabel('Consulta Usuários'), '')->class = 'tformtitle';
     // adiciona a tabela no form
     $this->form->add($table);
     // cria os campos de pesquisa do form
     //$id = new TEntry('id');
     //$id->setValue(TSession::getValue('Usuario_id'));
     $nome = new TEntry('nome');
     $nome->setValue(TSession::getValue('Usuario_nome'));
     $nome->setSize(300);
     // add a row for the filter field
     //$table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('Nome: '), $nome);
     // cria dois botoes de acao para o form
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     // define as acoes dos botoes
     $find_button->setAction(new TAction(array($this, 'onSearch')), 'Buscar');
     $find_button->setImage('ico_find.png');
     $new_button->setAction(new TAction(array('UsuarioForm', 'onEdit')), 'Novo');
     $new_button->setImage('ico_new.png');
     // add a row for the form actions
     $container = new THBox();
     $container->add($find_button);
     $container->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($container);
     $cell->colspan = 2;
     // define wich are the form fields
     $this->form->setFields(array($nome, $find_button, $new_button));
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->setHeight(320);
     $this->datagrid->class = 'tdatagrid_table customized-table';
     $this->datagrid->style = 'width: 100%';
     // creates the datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'right');
     $nome = new TDataGridColumn('nome', 'Nome', 'left');
     $prontuario = new TDataGridColumn('prontuario', 'Prontuario', 'left');
     $email = new TDataGridColumn('email', 'Email', 'left');
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($nome);
     $this->datagrid->addColumn($prontuario);
     $this->datagrid->addColumn($email);
     // creates the datagrid column actions
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'id');
     $id->setAction($order_id);
     $order_nome = new TAction(array($this, 'onReload'));
     $order_nome->setParameter('order', 'nome');
     $nome->setAction($order_nome);
     // inline editing
     $nome_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $nome_edit->setField('id');
     $nome->setEditAction($nome_edit);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('UsuarioForm', 'onEdit'));
     $action1->setLabel('Editar');
     $action1->setImage('ico_edit.png');
     $action1->setField('id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel('Excluir');
     $action2->setImage('ico_delete.png');
     $action2->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     // 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->style = 'width: 80%';
     $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
Ejemplo n.º 23
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_Desaprovar_Cessao');
     $this->form->class = 'tform';
     // CSS class
     // creates a table
     $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('Desaprovar Cessao'))->colspan = 2;
     // create the form fields
     $numeroCessao = new TEntry('numeroCessao');
     $numeroCessao->setTip('Número do processo gerado no SIGA');
     // define the sizes
     $numeroCessao->setSize(200);
     // add one row for each form field
     $table->addRowSet(new TLabel('Nº da Cessão:'), $numeroCessao);
     $this->form->setFields(array($numeroCessao));
     // keep the form filled during navigation with session data
     $this->form->setData(TSession::getValue('Cessao_filter_data'));
     // create two action buttons to the form
     $find_button = TButton::create('find', array($this, 'onSearch'), 'Buscar', 'ico_find.png');
     //$new_button  = TButton::create('new',  array('CessaoForm', 'onEdit'), 'Novo', 'ico_new.png');
     $this->form->addField($find_button);
     //$this->form->addField($new_button);
     $buttons_box = new THBox();
     $buttons_box->add($find_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;
     // creates a Datagrid
     parent::include_css('app/resources/custom-table.css');
     $this->datagrid = new TDataGrid();
     $this->datagrid->class = 'tdatagrid_table customized-table';
     $this->datagrid->setHeight(320);
     $this->datagrid->makeScrollable();
     $this->datagrid->disableDefaultClick();
     // creates the datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'right', 80);
     $srp = new TDataGridColumn('numeroSRP', 'Nº SRP', 'left', 100);
     $numeroCessao = new TDataGridColumn('numeroCessao', 'Nº da Cessão', 'left', 250);
     $data = new TDataGridColumn('emissao', 'Data', 'left', 100);
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($srp);
     $this->datagrid->addColumn($numeroCessao);
     $this->datagrid->addColumn($data);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array($this, 'onQuestionAprovarCessao'));
     $action1->setLabel('Desaprovar Cessao');
     $action1->setImage('fa:history fa-fw');
     $action1->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     // create the datagrid model
     $this->datagrid->createModel();
     //limpar a sessao com detalhes de itens e cessao
     TSession::delValue('cessao_itens');
     TSession::delValue('SRP_id');
     TSession::delValue('form_cessao');
     // create the page container
     //$container = TVBox::pack( $this->form, $this->datagrid);
     $container = new TTable();
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->addRow()->addCell($this->form);
     $container->addRow()->addCell($this->datagrid);
     //$container->addRow()->addCell($this->pageNavigation);
     parent::add($container);
 }
Ejemplo n.º 24
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     parent::include_css('app/resources/custom-table.css');
     // creates the form
     $this->form = new TForm('form_search_Campus');
     $this->form->class = 'tform';
     // CSS class
     // creates a table
     $table = new TTable();
     $table->width = '100%';
     // add a row for the form title
     $table->addRowSet(new TLabel('Consulta Câmpus'), '')->class = 'tformtitle';
     // CSS class
     $this->form->add($table);
     // create the form fields
     $nome = new TEntry('nome');
     $nome->setValue(TSession::getValue('s_nome'));
     $uasg = new TEntry('uasg');
     $uasg->setValue(TSession::getValue('s_uasg'));
     $sigla = new TEntry('sigla');
     $sigla->setValue(TSession::getValue('s_sigla'));
     // define the sizes
     $nome->setSize(500);
     $uasg->setSize(100);
     $sigla->setSize(150);
     // add one row for each form field
     $table->addRowSet(new TLabel('Nome:'), $nome);
     $table->addRowSet(new TLabel('UASG:'), $uasg);
     $table->addRowSet(new TLabel('Sigla:'), $sigla);
     $this->form->setFields(array($nome, $uasg, $sigla));
     // keep the form filled during navigation with session data
     $this->form->setData(TSession::getValue('Campus_filter_data'));
     // create two action buttons to the form
     $find_button = TButton::create('find', array($this, 'onSearch'), 'Buscar', 'ico_find.png');
     $new_button = TButton::create('new', array('CampusForm', 'onEdit'), 'Novo', 'ico_new.png');
     $this->form->addField($find_button);
     $this->form->addField($new_button);
     $buttons_box = new THBox();
     $buttons_box->add($find_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;
     // creates a Datagrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->class = 'tdatagrid_table customized-table';
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'right');
     $nome = new TDataGridColumn('nome', 'Nome', 'left');
     $uasg = new TDataGridColumn('uasg', 'UASG', 'left');
     $sigla = new TDataGridColumn('sigla', 'Sigla', 'left');
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($nome);
     $this->datagrid->addColumn($uasg);
     $this->datagrid->addColumn($sigla);
     // creates the datagrid column actions
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'id');
     $id->setAction($order_id);
     $order_nome = new TAction(array($this, 'onReload'));
     $order_nome->setParameter('order', 'nome');
     $nome->setAction($order_nome);
     $order_uasg = new TAction(array($this, 'onReload'));
     $order_uasg->setParameter('order', 'uasg');
     $uasg->setAction($order_uasg);
     $order_sigla = new TAction(array($this, 'onReload'));
     $order_sigla->setParameter('order', 'sigla');
     $sigla->setAction($order_sigla);
     // inline editing
     $nome_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $nome_edit->setField('id');
     $nome->setEditAction($nome_edit);
     /*
             $uasg_edit = new TDataGridAction(array($this, 'onInlineEdit'));
             $uasg_edit->setField('id');
             $uasg->setEditAction($uasg_edit);
     
             $sigla_edit = new TDataGridAction(array($this, 'onInlineEdit'));
             $sigla_edit->setField('id');
             $sigla->setEditAction($sigla_edit);
     */
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('CampusForm', '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);
     // 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());
     $container = new TTable();
     //$container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->addRow()->addCell($this->form);
     $container->addRow()->addCell($this->datagrid);
     $container->addRow()->addCell($this->pageNavigation);
     // add the container inside the page
     parent::add($container);
 }
Ejemplo n.º 25
0
 /**
  * Show the widget at the screen
  */
 public function show()
 {
     $wrapper = new TElement('div');
     $wrapper->{'mtf_name'} = $this->getName();
     // include the needed libraries and styles
     if ($this->fields) {
         $table = new TTable();
         $mandatories = array();
         // mandatory
         $fields = array();
         $i = 0;
         if ($this->orientation == 'horizontal') {
             $row_label = $table->addRow();
             $row_field = $table->addRow();
         }
         foreach ($this->fields as $name => $obj) {
             if ($this->orientation == 'vertical') {
                 $row = $table->addRow();
                 $row_label = $row;
                 $row_field = $row;
             }
             $label = new TLabel($obj->text);
             if ($obj->mandatory) {
                 $label->setFontColor('red');
             }
             $row_label->addCell($label);
             $row_field->addCell($obj->field);
             $mandatories[] = $obj->mandatory;
             $fields[] = $name;
             $post_fields[$name] = 1;
             $sizes[$name] = $obj->size;
             $obj->field->setName($this->name . '_' . $name);
             if (in_array(get_class($obj->field), array('TComboCombined', 'Adianti\\Widget\\Form\\TComboCombined'))) {
                 $aux_name = $obj->field->getTextName();
                 $aux_full_name = $this->name . '_' . $aux_name;
                 $mandatories[] = 0;
                 $obj->field->setTextName($aux_full_name);
                 $fields[] = $aux_name;
                 $post_fields[$aux_name] = 1;
                 // invert sizes
                 $sizes[$aux_name] = $obj->size;
                 $sizes[$name] = 20;
                 $i++;
             }
             $i++;
         }
         $wrapper->add($table);
     }
     // check whether the widget is non-editable
     if (parent::getEditable()) {
         // create three buttons to control the MultiField
         $add = new TButton("{$this->name}btnStore");
         $add->setLabel(AdiantiCoreTranslator::translate('Register'));
         $add->setImage('fa:angle-double-down');
         $add->addFunction("multifields['{$this->name}'].addRowFromFormFields()");
         $del = new TButton("{$this->name}btnDelete");
         $del->setLabel(AdiantiCoreTranslator::translate('Delete'));
         $del->setImage('fa:trash');
         $can = new TButton("{$this->name}btnCancel");
         $can->setLabel(AdiantiCoreTranslator::translate('Cancel'));
         $can->setImage('fa:times-circle');
         $hbox_buttons = new THBox();
         $hbox_buttons->{'style'} = 'margin-top:3px;margin-bottom:3px';
         $hbox_buttons->add($add);
         $hbox_buttons->add($del);
         $hbox_buttons->add($can);
         $wrapper->add($hbox_buttons);
     }
     // create the MultiField Panel
     $panel = new TElement('div');
     $panel->{'class'} = "multifieldDiv";
     $input = new THidden($this->name);
     $panel->add($input);
     // create the MultiField DataGrid Header
     $table = new TTable();
     $table->{'class'} = 'multifield';
     $table->{'id'} = "{$this->name}mfTable";
     $head = new TElement('thead');
     $table->add($head);
     $row = new TTableRow();
     $head->add($row);
     // fill the MultiField DataGrid
     if ($this->fields) {
         foreach ($this->fields as $obj) {
             $c = $obj->text;
             if (in_array(get_class($obj->field), array('TComboCombined', 'Adianti\\Widget\\Form\\TComboCombined'))) {
                 $cell = $row->addCell('ID');
                 $cell->{'width'} = '20px';
                 $cell->{'class'} = 'multifield_header';
             }
             $cell = $row->addCell($c);
             $cell->{'width'} = $obj->size . 'px';
             $cell->{'class'} = 'multifield_header';
         }
     }
     $body_height = $this->height - 34;
     $body = new TElement('tbody');
     $body->{'style'} = "height: {$body_height}px";
     $body->{'class'} = 'tmultifield_scrolling';
     $table->add($body);
     if ($this->objects) {
         foreach ($this->objects as $obj) {
             if (isset($obj->id)) {
                 $row = new TTableRow();
                 $row->dbId = $obj->id;
                 $body->add($row);
             } else {
                 $row = new TTableRow();
                 $body->add($row);
             }
             if ($fields) {
                 foreach ($fields as $name) {
                     $cellValue = is_null($obj->{$name}) ? '' : $obj->{$name};
                     $original = $cellValue;
                     if (is_array(json_decode($cellValue))) {
                         $content = json_decode($cellValue);
                         $rows = array();
                         foreach ($content as $_row) {
                             $rows[] = implode(':', array_values(get_object_vars($_row)));
                         }
                         $cellValue = implode(',', $rows);
                         $cell = $row->addCell($cellValue);
                         $cell->{'data'} = htmlspecialchars($original);
                     } else {
                         $cell = $row->addCell($cellValue);
                         $cell->{'data'} = $cellValue;
                     }
                     if (isset($sizes[$name])) {
                         $cell->style = 'width:' . $sizes[$name] . 'px;';
                     }
                 }
             }
         }
     }
     $panel->add($table);
     $wrapper->add($panel);
     $wrapper->show();
     $fields_json = json_encode($fields);
     $mandatories_json = json_encode($mandatories);
     TScript::create(" tmultifield_start( '{$this->name}', {$fields_json}, {$mandatories_json}, {$this->width},{$this->height} ) ");
 }
Ejemplo n.º 26
0
 /**
  * Show the notebook at the screen
  */
 public function show()
 {
     // count the pages
     $pages = $this->getPageCount();
     // creates a table
     $note_table = new TTable();
     $note_table->{'width'} = $this->width;
     $note_table->{'border'} = 0;
     $note_table->{'cellspacing'} = 0;
     $note_table->{'cellpadding'} = 0;
     $note_table->{'class'} = 'notebook-table';
     // add a row for the tabs
     $row = $note_table->addRow();
     $i = 0;
     $id = $this->id;
     // get javascript code to show/hide sub-notebooks
     $subnotes_hide = $this->_getHideCode();
     $subnotes_show = $this->_getShowCode();
     if ($this->pages) {
         // iterate the tabs, showing them
         foreach ($this->pages as $title => $content) {
             // verify if the current page is to be shown
             $classe = $i == $this->currentPage ? 'tnotebook_aba_sim' : 'tnotebook_aba_nao';
             // add a cell for this tab
             if ($this->tabsVisibility) {
                 $cell = $row->addCell("&nbsp;{$title}&nbsp;");
                 $cell->{'class'} = $classe;
                 $cell->id = "aba_{$id}_{$i}";
                 $cell->height = '23px';
                 $cell->onclick = $subnotes_hide . "tnotebook_hide('{$id}', {$pages});" . "tnotebook_show_tab('{$id}',{$i});" . $this->getShowPageCode($title);
                 // show only this page sub-contents
                 if ($this->tabAction) {
                     $this->tabAction->setParameter('current_page', $i + 1);
                     $string_action = $this->tabAction->serialize(FALSE);
                     $cell->onclick = $cell->onclick . "__adianti_ajax_exec('{$string_action}')";
                 }
                 $cell->onmouseover = "javascript:tnotebook_prelight(this, '{$id}', {$i})";
                 $cell->onmouseout = "javascript:tnotebook_unprelight(this, '{$id}', {$i})";
                 // creates the cell spacer
                 $cell = $row->addCell('&nbsp;');
                 $cell->{'class'} = 'tnotebook_spacer';
                 $cell->width = '3px';
                 $i++;
             }
         }
     }
     // creates the cell terminator
     $cell = $row->addCell('&nbsp;');
     $cell->{'class'} = 'tnotebook_end';
     if ($this->tabsVisibility) {
         $row = $note_table->addRow();
         $row->height = '7px';
         $cell = $row->addCell('<span></span>');
         $cell->{'class'} = 'tnotebook_down';
         $cell->colspan = 100;
     }
     // show the table
     $note_table->show();
     // creates a <div> around the content
     $quadro = new TElement('div');
     $quadro->{'class'} = 'tnotebook_quadro';
     $width = $this->width - 7;
     $quadro->style = "height:{$this->height}px;width:{$width}px";
     if ($this->counter == 1) {
         self::$subNotes = $this->_getSubNotes();
     }
     $i = 0;
     // iterate the tabs again, now to show the content
     if ($this->pages) {
         foreach ($this->pages as $title => $content) {
             // verify if the current page is to be shown
             if ($i == $this->currentPage and ($this->counter == 1 or in_array($this->id, self::$subNotes))) {
                 $classe = 'tnotebook_painel_sim';
             } else {
                 $classe = 'tnotebook_painel_nao';
             }
             // creates a <div> for the contents
             $painel = new TElement('div');
             $painel->{'class'} = $classe;
             // CSS
             $painel->id = "painel_{$id}_{$i}";
             // ID
             $quadro->add($painel);
             // check if the content is an object
             if (is_object($content)) {
                 $painel->add($content);
             }
             $i++;
         }
     }
     $quadro_table = new TTable();
     $quadro_table->width = $this->width;
     $quadro_table->{'class'} = 'tnotebook_table';
     $quadro_table->border = 0;
     $quadro_table->cellspacing = 0;
     $quadro_table->cellpadding = 0;
     $row = $quadro_table->addRow();
     $row->addCell($quadro);
     $quadro_table->show();
 }