public function __construct() { parent::__construct(); // instancia objeto DataGrid $this->datagrid = new TDataGrid(); // instancia as colunas da DataGrid $codigo = new TDataGridColumn('codigo', 'Código', 'left', 50); $nome = new TDataGridColumn('nome', 'Nome', 'left', 180); $endereco = new TDataGridColumn('endereco', 'Endereço', 'left', 140); $telefone = new TDataGridColumn('fone', 'Fone', 'center', 100); // adiciona as colunas à DataGrid $this->datagrid->addColumn($codigo); $this->datagrid->addColumn($nome); $this->datagrid->addColumn($endereco); $this->datagrid->addColumn($telefone); // instancia duas ações da DataGrid $action1 = new TDataGridAction(array($this, 'onDelete')); $action1->setLabel('Deletar'); $action1->setImage('ico_delete.png'); $action1->setField('codigo'); $action2 = new TDataGridAction(array($this, 'onView')); $action2->setLabel('Visualizar'); $action2->setImage('ico_view.png'); $action2->setField('nome'); // adiciona as ações à DataGrid $this->datagrid->addAction($action1); $this->datagrid->addAction($action2); // cria o modelo da DataGrid, montando sua estrutura $this->datagrid->createModel(); // adiciona a DataGrid à página parent::add($this->datagrid); }
public function __construct() { parent::__construct(); // creates one datagrid $this->datagrid = new TDataGrid(); // create the datagrid columns $code = new TDataGridColumn('code', 'Code', 'right', 70); $name = new TDataGridColumn('name', 'Name', 'left', 180); $address = new TDataGridColumn('address', 'Address', 'left', 180); $telephone = new TDataGridColumn('fone', 'Phone', 'left', 160); // add the columns to the datagrid $this->datagrid->addColumn($code); $this->datagrid->addColumn($name); $this->datagrid->addColumn($address); $this->datagrid->addColumn($telephone); // creates two datagrid actions $action1 = new TDataGridAction(array($this, 'onView')); $action1->setLabel('View'); $action1->setImage('ico_find.png'); $action1->setField('name'); $action2 = new TDataGridAction(array($this, 'onDelete')); $action2->setLabel('Delete'); $action2->setImage('ico_delete.png'); $action2->setField('code'); // add the actions to the datagrid $this->datagrid->addAction($action1); $this->datagrid->addAction($action2); // creates the datagrid model $this->datagrid->createModel(); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->datagrid); parent::add($vbox); }
/** * Add action to the datagrid * @param $label Action Label * @param $action TAction Object * @param $icon Action Icon */ public function addQuickAction($label, TDataGridAction $action, $field, $icon = 'ico_save.png') { $action->setLabel($label); $action->setImage($icon); $action->setField($field); // add the datagrid action parent::addAction($action); }
/** * Constructor Method * Creates the page, the search form and the listing */ public function __construct() { parent::__construct(); // creates a new form $this->form = new TForm('form_standard_seek'); // creates a new table $table = new TTable(); // adds the table into the form $this->form->add($table); // create the form fields $display_field = new TEntry('display_field'); // keeps the field's value $display_field->setValue(TSession::getValue('tstandardseek_display_value')); // add a row for the filter field $row = $table->addRow(); $row->addCell(new TLabel('Field:')); $row->addCell($display_field); // create the action button $find_button = new TButton('busca'); // define the button action $find_button->setAction(new TAction(array($this, 'onSearch')), TAdiantiCoreTranslator::translate('Search')); $find_button->setImage('ico_find.png'); // add a row for the button in the table $row = $table->addRow(); $row->addCell($find_button); // define wich are the form fields $this->form->setFields(array($display_field, $find_button)); // creates a new datagrid $this->datagrid = new TDataGrid(); // create two datagrid columns $id = new TDataGridColumn('id', 'ID', 'right', 70); $display = new TDataGridColumn('display_field', 'Field', 'left', 220); // add the columns to the datagrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($display); // create a datagrid action $action1 = new TDataGridAction(array($this, 'onSelect')); $action1->setLabel('Selecionar'); $action1->setImage('ico_apply.png'); $action1->setField('id'); // add the actions to the datagrid $this->datagrid->addAction($action1); // create the datagrid model $this->datagrid->createModel(); // creates the paginator $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // creates the container $vbox = new TVBox(); $vbox->add($this->form); $vbox->add($this->datagrid); $vbox->add($this->pageNavigation); // add the container to the page parent::add($vbox); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); parent::setDatabase('samples'); // defines the database parent::setActiveRecord('City'); // defines the active record parent::setFilterField('name'); // define the filter field parent::setDefaultOrder('id', 'asc'); // define the default order // creates the form $this->form = new TQuickForm('form_search_City'); $this->form->setFormTitle('Standard datagrid'); $this->form->class = 'tform'; $this->form->style = 'width: 500px'; $name = new TEntry('name'); $this->form->addQuickField('Name:', $name, 200); $this->form->addQuickAction('Find', new TAction(array($this, 'onSearch')), 'ico_find.png'); $this->form->addQuickAction('New', new TAction(array('StandardFormView', 'onEdit')), 'ico_new.png'); // keep the form filled with the search data $this->form->setData(TSession::getValue('City_filter_data')); // creates the DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(230); // creates the datagrid columns $this->datagrid->addQuickColumn('id', 'id', 'right', 40, new TAction(array($this, 'onReload')), array('order', 'id')); $name = $this->datagrid->addQuickColumn('name', 'name', 'left', 400, new TAction(array($this, 'onReload')), array('order', 'name')); // creates two datagrid actions $this->datagrid->addQuickAction('Edit', new TDataGridAction(array('StandardFormView', 'onEdit')), 'id', 'ico_edit.png'); $this->datagrid->addQuickAction('Delete', new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png'); // turn on inline editing $editaction = new TDataGridAction(array($this, 'onInlineEdit')); $editaction->setField('id'); $name->setEditAction($editaction); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // creates the page structure using a table $table = new TTable(); $table->addRow()->addCell(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); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); new TSession(); // creates a DataGrid $this->datagrid = new TDataGrid(); $this->datagrid->setHeight(280); // creates the datagrid columns $id = new TDataGridColumn('id', 'id', 'right', 40); $name = new TDataGridColumn('name', 'Name', 'left', 200); $address = new TDataGridColumn('address', 'Address', 'left', 200); // creates the datagrid actions $order1 = new TAction(array($this, 'onReload')); $order2 = new TAction(array($this, 'onReload')); // define the ordering parameters $order1->setParameter('order', 'id'); $order2->setParameter('order', 'name'); // assign the ordering actions $id->setAction($order1); $name->setAction($order2); // add the columns to the DataGrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($name); $this->datagrid->addColumn($address); // creates a datagrid action $action1 = new TDataGridAction(array('CustomerFormView', 'onEdit')); $action1->setLabel('Edit'); $action1->setImage('ico_edit.png'); $action1->setField('id'); // add the actions to the datagrid $this->datagrid->addAction($action1); // creates the edit action $editaction = new TDataGridAction(array($this, 'onEdit')); $editaction->setField('id'); $name->setEditAction($editaction); // 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 $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->datagrid); $vbox->add($this->pageNavigation); // add the table inside the page parent::add($vbox); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); parent::setSize(500, 400); parent::setTitle('Telefones'); // creates a Datagrid $this->datagrid = new TDataGrid(); $this->datagrid = new BootstrapDatagridWrapper($this->datagrid); $this->datagrid->style = 'width: 100%'; $this->datagrid->setHeight(320); // $this->datagrid->datatable = 'true'; // $this->datagrid->enablePopover('Popover', 'Hi <b> {name} </b>'); // creates the datagrid columns $column_check = new TDataGridColumn('check', '', 'center'); $column_id = new TDataGridColumn('id', 'Id', 'right'); $column_numero = new TDataGridColumn('numero', 'Numero', 'left'); // add the columns to the DataGrid $this->datagrid->addColumn($column_check); $this->datagrid->addColumn($column_id); $this->datagrid->addColumn($column_numero); // create DELETE action $action_del = new TDataGridAction(array($this, 'onDelete')); $action_del->setUseButton(TRUE); $action_del->setButtonClass('btn btn-default'); $action_del->setLabel(_t('Delete')); $action_del->setImage('fa:trash-o red fa-lg'); $action_del->setField('id'); $action_del->setDisplayCondition(array($this, 'checkDelete')); $this->datagrid->addAction($action_del); // 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()); $this->datagrid->disableDefaultClick(); // put datagrid inside a form $this->formgrid = new TForm(); $this->formgrid->add($this->datagrid); // creates the delete collection button $this->deleteButton = new TButton('delete_collection'); $this->deleteButton->setAction(new TAction(array($this, 'onDeleteCollection')), AdiantiCoreTranslator::translate('Delete selected')); $this->deleteButton->setImage('fa:remove red'); $this->formgrid->addField($this->deleteButton); $gridpack = new TVBox(); $gridpack->style = 'width: 100%'; $gridpack->add($this->formgrid); $gridpack->add($this->deleteButton)->style = 'background:whiteSmoke;border:1px solid #cccccc; padding: 3px;padding: 5px;'; $this->transformCallback = array($this, 'onBeforeLoad'); // vertical box container $container = new TVBox(); $container->style = 'width: 90%'; // $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $container->add(TPanelGroup::pack('Title', $this->form)); $container->add($gridpack); $container->add($this->pageNavigation); parent::add($container); }
public function __construct() { parent::__construct(); // creates one datagrid $this->datagrid = new TDataGrid(); // create the datagrid columns $code = new TDataGridColumn('code', 'Code', 'right', 50); $name = new TDataGridColumn('name', 'Name', 'left', 180); $address = new TDataGridColumn('address', 'Address', 'left', 180); $telephone = new TDataGridColumn('fone', 'Phone', 'left', 120); // add the columns to the datagrid $this->datagrid->addColumn($code); $this->datagrid->addColumn($name); $this->datagrid->addColumn($address); $this->datagrid->addColumn($telephone); // creates two datagrid actions $action1 = new TDataGridAction(array($this, 'onView')); $action1->setLabel('View name'); $action1->setImage('bs:search blue'); $action1->setField('name'); $action2 = new TDataGridAction(array($this, 'onDelete')); $action2->setLabel('Try to delete'); $action2->setImage('bs:remove red'); $action2->setField('code'); $action3 = new TDataGridAction(array($this, 'onView')); $action3->setLabel('View address'); $action3->setImage('bs:hand-right green'); $action3->setField('address'); $action_group = new TDataGridActionGroup('Actions', 'bs:th'); $action_group->addHeader('Available Options'); $action_group->addAction($action1); $action_group->addAction($action2); $action_group->addSeparator(); $action_group->addHeader('Another Options'); $action_group->addAction($action3); // add the actions to the datagrid $this->datagrid->addActionGroup($action_group); // creates the datagrid model $this->datagrid->createModel(); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->datagrid); parent::add($vbox); }
public function __construct() { parent::__construct(); $this->form = new TForm('form_search_Contribuinte'); $this->form->class = 'tform'; $table = new TTable(); $table->style = 'width:100%'; $table->addRowSet(new TLabel('Contribuinte'), '')->class = 'tformtitle'; $this->form->add($table); $contribuinte_id = new TEntry('contribuinte_id'); $contribuinte_id->setValue(TSession::getValue('contribuinte_id')); $contribuinte_nome = new TEntry('contribuinte_nome'); $contribuinte_nome->setValue(TSession::getValue('contribuinte_nome')); $row = $table->addRowSet(new TLabel('ID: '), $contribuinte_id); $row = $table->addRowSet(new TLabel('Nome/Razão Social: '), $contribuinte_nome); $find_button = new TButton('find'); $new_button = new TButton('new'); $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find')); $find_button->setImage('ico_find.png'); $new_button->setAction(new TAction(array('ContribuinteForm', 'onEdit')), _t('New')); $new_button->setImage('ico_new.png'); $this->form->setFields(array($contribuinte_id, $contribuinte_nome, $find_button, $new_button)); $container = new THBox(); $container->add($find_button); $container->add($new_button); $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($container); $cell->colspan = 2; // creates a DataGrid $this->datagrid = new TDataGrid(); $this->datagrid->style = 'width: 100%'; $this->datagrid->setHeight(320); $contribuinte_id = new TDataGridColumn('contribuinte_id', 'ID', 'right'); $contribuinte_nome = new TDataGridColumn('contribuinte_nome', 'Nome/Razão Social', 'left'); $contribuinte_tipo = new TDataGridColumn('contribuinte_tipo', 'Tipo', 'left'); $contribuinte_tipo = new TDataGridColumn('contribuinte_tipos', 'Tipo', 'left'); $this->datagrid->addColumn($contribuinte_id); $this->datagrid->addColumn($contribuinte_nome); $this->datagrid->addColumn($contribuinte_tipo); $order_id = new TAction(array($this, 'onReload')); $order_id->setParameter('order', 'contribuinte_id'); $contribuinte_id->setAction($order_id); $order_name = new TAction(array($this, 'onReload')); $order_name->setParameter('order', 'contribuinte_nome'); $contribuinte_nome->setAction($order_name); $name_edit = new TDataGridAction(array($this, 'onInlineEdit')); $name_edit->setField('contribuinte_id'); $contribuinte_nome->setEditAction($name_edit); // creates two datagrid actions $action1 = new TDataGridAction(array('ContribuinteForm', 'onEdit')); $action1->setLabel(_t('Edit')); $action1->setImage('ico_edit.png'); $action1->setField('contribuinte_id'); $action2 = new TDataGridAction(array($this, 'onDelete')); $action2->setLabel(_t('Delete')); $action2->setImage('ico_delete.png'); $action2->setField('contribuinte_id'); $this->datagrid->addAction($action1); $this->datagrid->addAction($action2); $this->datagrid->createModel(); $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); $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); }
/** * constructor method */ public function __construct() { parent::__construct(); parent::setSize(TSession::getValue('width'), TSession::getValue('height')); parent::setTitle(TSession::getValue('titulo')); new TSession(); // creates the form $this->form = new TForm('formSeekStandart'); // creates the table $table = new TTable(); // add the table inside the form $this->form->add($table); // create the form fields $name = new TEntry('name'); // keep the session value $name->setValue(TSession::getValue('name')); // add the field inside the table $row = $table->addRow(); $row->addCell(new TLabel($this->getFiltro() . ' :')); $row->addCell($name); // create a find button $find_button = new TButton('search'); // define the button action $find_button->setAction(new TAction(array($this, 'onSearch')), 'Search'); $find_button->setImage('ico_find.png'); // add a row for the find button $row = $table->addRow(); $row->addCell($find_button); // define wich are the form fields $this->form->setFields(array($name, $find_button)); // create the datagrid $this->datagrid = new TDataGrid(); $i = 1; // create the datagrid columns if (TSession::getValue('campos')) { foreach (TSession::getValue('campos') as $field => $label) { $campos[] = new TDataGridColumn($field, $label, 'right', 200); } foreach ($campos as $campo) { // add the columns inside the datagrid $this->datagrid->addColumn($campo); } } // create one datagrid action $action1 = new TDataGridAction(array($this, 'onSelect')); $action1->setLabel('Selecionar'); $action1->setImage('ico_apply.png'); $action1->setField(TSession::getValue('key')); // add the action to the datagrid $this->datagrid->addAction($action1); // create the datagrid model $this->datagrid->createModel(); // create the page navigator $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create a table for layout $table = new TTable(); // create a row for the form $row = $table->addRow(); $row->addCell($this->form); // create a row for the datagrid $row = $table->addRow(); $row->addCell($this->datagrid); // create a row for the page navigator $row = $table->addRow(); $row->addCell($this->pageNavigation); // add the table inside the page parent::add($table); }
/** * Class constructor * Creates the page, the search form and the listing */ public function __construct() { parent::__construct(); new TSession(); // creates the form $this->form = new TForm('form_listar_crm_clientes'); $key = $_GET['key']; // create the form fields $name = new TEntry('nome'); $name->setSize(170); $table = new TTable(); $row = $table->addRow(); $cell = $row->addCell(''); $cell->width = PHP_SAPI == 'cli' ? 40 : 80; $row->addCell($name); $this->form->add($table); // creates the action button $button1 = new TButton('find'); $button1->setAction(new TAction(array($this, 'onSearch')), 'Buscar'); $button1->setImage('ico_find.png'); // create an action button $button2 = new TButton('novo'); $action2 = new TAction(array('CRMForm', 'onEdit')); $action2->setParameter('key', $key); $button2->setImage('ico_new.png'); $button2->setAction($action2, 'Novo'); $button3 = new TButton('csv'); $button3->setAction(new TAction(array($this, 'onExportCSV')), 'CSV'); $button3->setImage('ico_print.png'); // create an action button $button4 = new TButton('action3'); $action4 = new TAction(array('ClienteList', 'onReload')); // $action3->setParameter('key', $_GET['key']); $action4->setParameter('key', $key); $button4->setImage('ico_previous.png'); $button4->setAction($action4, 'Voltar'); $row->addCell($button1); $row->addCell($button2); $row->addCell($button3); $row->addCell($button4); $this->form->setFields(array($name, $button1, $button2, $button3, $button4)); // creates a DataGrid $this->datagrid = new TDataGrid(); // $this->datagrid->setHeight(200); // create the datagrid columns $dgid = new TDataGridColumn('id', 'Id', 'right', 70); $dgtitulo = new TDataGridColumn('titulo', 'Titulo', 'left', 180); $dgprojeto = new TDataGridColumn('projeto_nome', 'Projeto', 'left', 180); $dgdata = new TDataGridColumn('data_crm', 'Data', 'left', 160); $dgtempo = new TDataGridColumn('tempo', 'Tempo', 'left', 160); $dgdescricao = new TDataGridColumn('descricao', 'Descrição', 'left', 160); $dgsolicitante = new TDataGridColumn('solicitante', 'Solicitante', 'left', 160); $dgresponsavel = new TDataGridColumn('tipo_nome', 'Tipo', 'left', 160); $dgcliente = new TDataGridColumn('cliente_nome', 'Cliente', 'left', 160); $dgnome = new TDataGridColumn('prioridade_nome', 'Prioridade', 'left', 160); $dgstatus = new TDataGridColumn('status_nome', 'Status', 'left', 160); // add the columns to the datagrid $this->datagrid->addColumn($dgid); $this->datagrid->addColumn($dgtitulo); $this->datagrid->addColumn($dgprojeto); $this->datagrid->addColumn($dgdata); $this->datagrid->addColumn($dgtempo); $this->datagrid->addColumn($dgdescricao); $this->datagrid->addColumn($dgsolicitante); $this->datagrid->addColumn($dgresponsavel); $this->datagrid->addColumn($dgcliente); $this->datagrid->addColumn($dgnome); $this->datagrid->addColumn($dgstatus); // creates two datagrid actions $action1 = new TDataGridAction(array('CRMForm', 'onEdit')); $action1->setLabel('Editar'); $action1->setImage('ico_edit.png'); $action1->setField('id'); $action2 = new TDataGridAction(array($this, 'onDelete')); $action2->setLabel('Delete'); $action2->setImage('ico_delete.png'); $action2->setField('id'); // $obj = ClienteRegistroDetalhe(); $action3 = new TDataGridAction(array('ClienteRegistroDetalhe', 'onEdit')); $action3->setLabel('Registros'); $action3->setImage('ico_custom_form.png'); $action3->setField('id'); $action3->setParameter('fk', $_GET['key']); // add the actions to the datagrid $this->datagrid->addAction($action1); $this->datagrid->addAction($action2); $this->datagrid->addAction($action3); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // creates the page structure using a table $table = new TTable(); $table->addRow()->addCell($this->form); $table->addRow()->addCell($this->datagrid); $table->addRow()->addCell($this->pageNavigation); // add the table inside the page parent::add($table); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_search_SystemProgram'); $this->form->class = 'tform'; // creates a table $table = new TTable(); $table->style = 'width:100%'; $table->addRowSet(new TLabel(_t('Programs')), '')->class = 'tformtitle'; // add the table inside the form $this->form->add($table); // create the form fields $name = new TEntry('name'); $name->setValue(TSession::getValue('SystemProgram_name')); $control = new TEntry('controller'); $control->setValue(TSession::getValue('SystemProgram_control')); // add rows for the filter fields $row = $table->addRowSet(new TLabel(_t('Name') . ': '), $name); $row = $table->addRowSet(new TLabel(_t('Controller') . ': '), $control); // create two action buttons to the form $find_button = new TButton('find'); $new_button = new TButton('new'); // define the button actions $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find')); $find_button->setImage('ico_find.png'); $new_button->setAction(new TAction(array('SystemProgramForm', 'onEdit')), _t('New')); $new_button->setImage('ico_new.png'); // define wich are the form fields $this->form->setFields(array($name, $control, $find_button, $new_button)); $container = new THBox(); $container->add($find_button); $container->add($new_button); $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($container); $cell->colspan = 2; // creates a DataGrid $this->datagrid = new TDataGrid(); $this->datagrid->style = 'width: 100%'; $this->datagrid->setHeight(320); // creates the datagrid columns $id = new TDataGridColumn('id', 'ID', 'right'); $name = new TDataGridColumn('name', _t('Name'), 'left'); $controller = new TDataGridColumn('controller', _t('Controller'), 'left'); // add the columns to the DataGrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($name); $this->datagrid->addColumn($controller); // creates the datagrid column actions $order_id = new TAction(array($this, 'onReload')); $order_id->setParameter('order', 'id'); $id->setAction($order_id); $order_name = new TAction(array($this, 'onReload')); $order_name->setParameter('order', 'name'); $name->setAction($order_name); $order_controller = new TAction(array($this, 'onReload')); $order_controller->setParameter('order', 'controller'); $controller->setAction($order_controller); // inline editing $name_edit = new TDataGridAction(array($this, 'onInlineEdit')); $name_edit->setField('id'); $name->setEditAction($name_edit); $controller_edit = new TDataGridAction(array($this, 'onInlineEdit')); $controller_edit->setField('id'); $controller->setEditAction($controller_edit); // creates two datagrid actions $action1 = new TDataGridAction(array('SystemProgramForm', '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()); // 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); }
/** * */ 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; }
public function __construct() { parent::__construct(); // instancia um formulário $this->form = new TForm('form_busca_produtos'); // instancia uma tabela $table = new TTable(); // adiciona a tabela ao formulário $this->form->add($table); // cria os campos do formulário $descricao = new TEntry('descricao'); // adiciona uma linha para o campo descriçao $row = $table->addRow(); $row->addCell(new TLabel('Descrição:')); $row->addCell($descricao); // cria dois botões de ação para o formulário $find_button = new TButton('busca'); $new_button = new TButton('cadastrar'); // define as ações dos botões $find_button->setAction(new TAction(array($this, 'onReload')), 'Buscar'); $obj = new ProdutosForm(); $new_button->setAction(new TAction(array($obj, 'onEdit')), 'Cadastrar'); // adiciona uma linha para as ações do formulário $row = $table->addRow(); $row->addCell($find_button); $row->addCell($new_button); // define quais são os campos do formulário $this->form->setFields(array($descricao, $find_button, $new_button)); // instancia objeto DataGrid $this->datagrid = new TDataGrid(); // instancia as colunas da DataGrid $codigo = new TDataGridColumn('id', 'Código', 'right', 50); $descricao = new TDataGridColumn('descricao', 'Descrição', 'left', 270); $fabrica = new TDataGridColumn('nome_fabricante', 'Fabricante', 'left', 80); $estoque = new TDataGridColumn('estoque', 'Estoq.', 'right', 40); $preco = new TDataGridColumn('preco_venda', 'Venda', 'right', 40); // adiciona as colunas à DataGrid $this->datagrid->addColumn($codigo); $this->datagrid->addColumn($descricao); $this->datagrid->addColumn($fabrica); $this->datagrid->addColumn($estoque); $this->datagrid->addColumn($preco); // instancia duas ações da DataGrid $obj = new ProdutosForm(); $action1 = new TDataGridAction(array($obj, 'onEdit')); $action1->setLabel('Editar'); $action1->setImage('ico_edit.png'); $action1->setField('id'); $action2 = new TDataGridAction(array($this, 'onDelete')); $action2->setLabel('Deletar'); $action2->setImage('ico_delete.png'); $action2->setField('id'); // adiciona as ações à DataGrid $this->datagrid->addAction($action1); $this->datagrid->addAction($action2); // cria o modelo da DataGrid, montando sua estrutura $this->datagrid->createModel(); // monta a página através de uma tabela $table = new TTable(); $table->width = '100%'; // cria uma linha para o formulário $row = $table->addRow(); $row->addCell($this->form); // cria uma linha para a datagrid $row = $table->addRow(); $row->addCell($this->datagrid); // adiciona a tabela à página parent::add($table); }
public function __construct() { parent::__construct(); // instancia nova seção new TSession(); // instancia um formulário $this->form = new TForm('form_vendas'); // instancia uma tabela $table = new TTable(); // adiciona a tabela ao formulário $this->form->add($table); // cria os campos do formulário $codigo = new TEntry('id_produto'); $quantidade = new TEntry('quantidade'); // define os tamanhos $codigo->setSize(100); // adiciona uma linha para o campo código $row = $table->addRow(); $row->addCell(new TLabel('Código:')); $row->addCell($codigo); // adiciona uma linha para o campo quantidade $row = $table->addRow(); $row->addCell(new TLabel('Quantidade:')); $row->addCell($quantidade); // cria dois botões de ação para o formulário $save_button = new TButton('save'); $fim_button = new TButton('fim'); // define as ações dos botões $save_button->setAction(new TAction(array($this, 'onAdiciona')), 'Adicionar'); $fim_button->setAction(new TAction(array($this, 'onFinal')), 'Finalizar'); // adiciona uma linha para as ações do formulário $row = $table->addRow(); $row->addCell($save_button); $row->addCell($fim_button); // define quais são os campos do formulário $this->form->setFields(array($codigo, $quantidade, $save_button, $fim_button)); // instancia objeto DataGrid $this->datagrid = new TDataGrid(); // instancia as colunas da DataGrid $codigo = new TDataGridColumn('id_produto', 'Código', 'right', 50); $descricao = new TDataGridColumn('descricao', 'Descrição', 'left', 200); $quantidade = new TDataGridColumn('quantidade', 'Qtde', 'right', 40); $preco = new TDataGridColumn('preco_venda', 'Preço', 'right', 70); // define um transformador para a coluna preço $preco->setTransformer('formata_money'); // adiciona as colunas à DataGrid $this->datagrid->addColumn($codigo); $this->datagrid->addColumn($descricao); $this->datagrid->addColumn($quantidade); $this->datagrid->addColumn($preco); // cria uma ação para a datagrid $action = new TDataGridAction(array($this, 'onDelete')); $action->setLabel('Deletar'); $action->setImage('ico_delete.png'); $action->setField('id_produto'); // adiciona a ação à DataGrid $this->datagrid->addAction($action); // cria o modelo da DataGrid, montando sua estrutura $this->datagrid->createModel(); // monta a página através de uma tabela $table = new TTable(); // cria uma linha para o formulário $row = $table->addRow(); $row->addCell($this->form); // cria uma linha para a datagrid $row = $table->addRow(); $row->addCell($this->datagrid); // adiciona a tabela à página parent::add($table); }
public function __construct() { parent::__construct(); // instancia um formulário $this->form = new TForm('form_fabricantes'); // instancia uma tabela $table = new TTable(); // adiciona a tabela ao formulário $this->form->add($table); // cria os campos do formulário $codigo = new TEntry('id'); $nome = new TEntry('nome'); $site = new TEntry('site'); // define os tamanhos $codigo->setSize(40); $site->setSize(200); // adiciona uma linha para o campo código $row = $table->addRow(); $row->addCell(new TLabel('Código:')); $row->addCell($codigo); // adiciona uma linha para o campo nome $row = $table->addRow(); $row->addCell(new TLabel('Nome:')); $row->addCell($nome); // adiciona uma linha para o campo site $row = $table->addRow(); $row->addCell(new TLabel('Site:')); $row->addCell($site); // cria um botão de ação (salvar) $save_button = new TButton('save'); // define a ação do botão $save_button->setAction(new TAction(array($this, 'onSave')), 'Salvar'); // adiciona uma linha para a ação do formulário $row = $table->addRow(); $row->addCell($save_button); // define quais são os campos do formulário $this->form->setFields(array($codigo, $nome, $site, $save_button)); // instancia objeto DataGrid $this->datagrid = new TDataGrid(); // instancia as colunas da DataGrid $codigo = new TDataGridColumn('id', 'Código', 'right', 50); $nome = new TDataGridColumn('nome', 'Nome', 'left', 180); $site = new TDataGridColumn('site', 'Site', 'left', 180); // adiciona as colunas à DataGrid $this->datagrid->addColumn($codigo); $this->datagrid->addColumn($nome); $this->datagrid->addColumn($site); // instancia duas ações da DataGrid $action1 = new TDataGridAction(array($this, 'onEdit')); $action1->setLabel('Editar'); $action1->setImage('ico_edit.png'); $action1->setField('id'); $action2 = new TDataGridAction(array($this, 'onDelete')); $action2->setLabel('Deletar'); $action2->setImage('ico_delete.png'); $action2->setField('id'); // adiciona as ações à DataGrid $this->datagrid->addAction($action1); $this->datagrid->addAction($action2); // cria o modelo da DataGrid, montando sua estrutura $this->datagrid->createModel(); // monta a página através de uma tabela $table = new TTable(); // cria uma linha para o formulário $row = $table->addRow(); $row->addCell($this->form); // cria uma linha para a datagrid $row = $table->addRow(); $row->addCell($this->datagrid); // adiciona a tabela à página parent::add($table); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_search_System_Employees'); $this->form->class = 'tform'; // creates a table $table = new TTable(); $table->style = 'width:100%'; $row1 = $table->addRow(); $row1->class = 'tformtitle'; $cell1 = $row1->addCell(new TLabel('Employees'), ''); $cell1->colspan = 2; // add the table inside the form $this->form->add($table); // create the form fields $id = new TEntry('id'); $id->setValue(TSession::getValue('s_id')); $dni = new TEntry('dni'); $dni->setValue(TSession::getValue('s_dni')); $name = new TEntry('name'); $name->setValue(TSession::getValue('s_name')); $address = new TEntry('address'); $address->setValue(TSession::getValue('s_address')); $email = new TEntry('email'); $email->setValue(TSession::getValue('s_email')); $phone = new TEntry('phone'); $phone->setValue(TSession::getValue('s_phone')); $id->setSize(100); $dni->setSize(300); $name->setSize(300); $address->setSize(300); $email->setSize(300); $phone->setSize(300); // add a row for the filter field $row = $table->addRow(); $row->addCell(new TLabel('ID:')); $row->addCell($id); $row = $table->addRow(); $row->addCell(new TLabel('DNI:')); $row->addCell($dni); $row = $table->addRow(); $row->addCell(new TLabel('Name: ')); $row->addCell($name); $row = $table->addRow(); $row->addCell(new TLabel('Address: ')); $row->addCell($address); $row = $table->addRow(); $row->addCell(new TLabel('Email: ')); $row->addCell($email); $row = $table->addRow(); $row->addCell(new TLabel('Phone: ')); $row->addCell($phone); // create two action buttons to the form $find_button = new TButton('find'); $new_button = new TButton('new'); $pdf_button = new TButton('pdf'); // define the button actions $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find')); $find_button->setImage('fa:search'); $new_button->setAction(new TAction(array('SystemEmployeesForm', 'onEdit')), _t('New')); $new_button->setImage('fa:plus-square green'); $pdf_button->setAction(new TAction(array($this, 'onPDF')), 'PDF'); $pdf_button->setImage('fa:file-pdf-o red'); $container = new THBox(); $container->add($find_button); $container->add($new_button); $container->add($pdf_button); $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($container); $cell->colspan = 2; // define wich are the form fields $this->form->setFields(array($id, $dni, $name, $address, $email, $phone, $find_button, $new_button, $pdf_button)); // creates a DataGrid $this->datagrid = new TDataGrid(); $this->datagrid->style = 'width: 100%'; $this->datagrid->setHeight(320); // creates the datagrid columns $id = new TDataGridColumn('id', 'ID', 'center'); $dni = new TDataGridColumn('dni', 'DNI', 'center'); $name = new TDataGridColumn('name', 'Name', 'center'); $address = new TDataGridColumn('address', 'Address', 'center'); $email = new TDataGridColumn('email', 'Email', 'center'); $phone = new TDataGridColumn('phone', 'Phone', 'center'); // add the columns to the DataGrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($dni); $this->datagrid->addColumn($name); $this->datagrid->addColumn($address); $this->datagrid->addColumn($email); $this->datagrid->addColumn($phone); // creates the datagrid column actions $order_id = new TAction(array($this, 'onReload')); $order_id->setParameter('order', 'id'); $id->setAction($order_id); $order_dni = new TAction(array($this, 'onReload')); $order_dni->setParameter('order', 'dni'); $dni->setAction($order_dni); $order_name = new TAction(array($this, 'onReload')); $order_name->setParameter('order', 'name'); $name->setAction($order_name); $order_address = new TAction(array($this, 'onReload')); $order_address->setParameter('order', 'address'); $address->setAction($order_address); $order_email = new TAction(array($this, 'onReload')); $order_email->setParameter('order', 'email'); $email->setAction($order_email); $order_phone = new TAction(array($this, 'onReload')); $order_phone->setParameter('order', 'phone'); $phone->setAction($order_phone); // inline editing $dni_edit = new TDataGridAction(array($this, 'onInlineEdit')); $dni_edit->setField('id'); $dni->setEditAction($dni_edit); $name_edit = new TDataGridAction(array($this, 'onInlineEdit')); $name_edit->setField('id'); $name->setEditAction($name_edit); $address_edit = new TDataGridAction(array($this, 'onInlineEdit')); $address_edit->setField('id'); $address->setEditAction($address_edit); $email_edit = new TDataGridAction(array($this, 'onInlineEdit')); $email_edit->setField('id'); $email->setEditAction($email_edit); $phone_edit = new TDataGridAction(array($this, 'onInlineEdit')); $phone_edit->setField('id'); $phone->setEditAction($phone_edit); // creates two datagrid actions $action1 = new TDataGridAction(array('SystemEmployeesForm', 'onEdit')); $action1->setLabel(_t('Edit')); $action1->setImage('fa:pencil-square-o blue fa-lg'); $action1->setField('id'); $action2 = new TDataGridAction(array($this, 'onDelete')); $action2->setLabel(_t('Delete')); $action2->setImage('fa:trash-o grey fa-lg'); $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 $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); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_search_Servidor'); $this->form->class = 'tform'; // creates a table $table = new TTable(); $table->style = 'width:100%'; $table->addRowSet(new TLabel('Servidores'), '')->class = 'tformtitle'; // add the table inside the form $this->form->add($table); // create the form fields $identificacao = new TEntry('identificacao'); $identificacao->setValue(TSession::getValue('Servidor_identificacao')); $servidor = new TEntry('servidor'); $servidor->setValue(TSession::getValue('Servidor_servidor')); //$unidade = new TEntry('unidade'); //$unidade->setValue(TSession::getValue('Servidor_unidade')); // add rows for the filter fields $row = $table->addRowSet(new TLabel('Identificação' . ': '), $identificacao); $row = $table->addRowSet(new TLabel('Servidor' . ': '), $servidor); //$row=$table->addRowSet(new TLabel(('Unidade') . ': '), $unidade); // create two action buttons to the form $find_button = new TButton('find'); $clear_button = new TButton('clear'); $new_button = new TButton('new'); // define the button actions $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find')); $find_button->setImage('fa:search fa-lg'); $clear_button->setAction(new TAction(array($this, 'onClear')), 'Limpar'); $clear_button->setImage('fa:undo red fa-lg'); $new_button->setAction(new TAction(array('ServidorForm', 'onEdit')), _t('New')); $new_button->setImage('fa:plus-square green fa-lg'); // define wich are the form fields //$this->form->setFields(array($identificacao, $servidor, $unidade, $find_button, $new_button)); $this->form->setFields(array($identificacao, $servidor, $find_button, $clear_button, $new_button)); $container = new THBox(); $container->add($find_button); $container->add($clear_button); $container->add($new_button); $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($container); $cell->colspan = 2; // creates a DataGrid $this->datagrid = new TDataGrid(); $this->datagrid->style = 'width: 100%'; $this->datagrid->setHeight(320); // creates the datagrid columns $id = new TDataGridColumn('id', 'ID', 'center'); $identificacao = new TDataGridColumn('identificacao', 'Identificação', 'left'); $servidor = new TDataGridColumn('servidor', 'Servidor', 'left'); $unidade = new TDataGridColumn('unidade', 'Unidade', 'left'); // add the columns to the DataGrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($identificacao); $this->datagrid->addColumn($servidor); $this->datagrid->addColumn($unidade); // creates the datagrid column actions $order_id = new TAction(array($this, 'onReload')); $order_id->setParameter('order', 'id'); $id->setAction($order_id); $order_identificacao = new TAction(array($this, 'onReload')); $order_identificacao->setParameter('order', 'identificacao'); $identificacao->setAction($order_identificacao); $order_servidor = new TAction(array($this, 'onReload')); $order_servidor->setParameter('order', 'servidor'); $servidor->setAction($order_servidor); $order_unidade = new TAction(array($this, 'onReload')); $order_unidade->setParameter('order', 'unidade'); $unidade->setAction($order_unidade); // inline editing $identificacao_edit = new TDataGridAction(array($this, 'onInlineEdit')); $identificacao_edit->setField('id'); $identificacao->setEditAction($identificacao_edit); $servidor_edit = new TDataGridAction(array($this, 'onInlineEdit')); $servidor_edit->setField('id'); $servidor->setEditAction($servidor_edit); // creates two datagrid actions $action1 = new TDataGridAction(array('ServidorForm', 'onEdit')); $action1->setLabel(_t('Edit')); $action1->setImage('fa:pencil-square-o blue'); $action1->setField('id'); $action2 = new TDataGridAction(array($this, 'onDelete')); $action2->setLabel(_t('Delete')); $action2->setImage('fa:trash-o red'); $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); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_FreqServList'); $this->form->class = 'tform'; // creates a table $table = new TTable(); $table->style = 'width:100%'; $table->addRowSet(new TLabel('Frequência'), '')->class = 'tformtitle'; // add the table inside the form $this->form->add($table); // create the form fields //$id = new TEntry('ID'); //$id->setValue(TSession::getValue('Frequencia_id')); $servidor_id = new TDBSeekButton('servidor_id', 'lacenrh', 'form_FreqServList', 'Servidor', 'servidor', 'servidor_id', 'servidor_nome'); $servidor_id->setValue(TSession::getValue('Frequencia_servidor_id')); $servidor_nome = new TEntry('servidor_nome'); $servidor_nome->setValue(TSession::getValue('Frequencia_servidor_nome')); $diames = new TDate('Data'); $diames->setValue(TSession::getValue('Frequencia_diames')); //$id->setSize(40); $servidor_id->setSize(40); $servidor_nome->setSize(300); $diames->setSize(100); $diames->setMask('dd/mm/yyyy'); // add rows for the filter fields //$row=$table->addRowSet(new TLabel(('ID') . ': '), $id); $row = $table->addRowSet(new TLabel('Servidor' . ': '), $servidor_id); $row = $table->addRowSet(new TLabel('Nome' . ': '), $servidor_nome); $row = $table->addRowSet(new TLabel('Data' . ': '), $diames); //$row=$table->addRowSet(new TLabel(('Unidade') . ': '), $unidade); // create two action buttons to the form $find_button = new TButton('find'); $clear_button = new Tbutton('clear'); $new_button = new TButton('new'); // define the button actions $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find')); $find_button->setImage('fa:search fa-lg'); $clear_button->setAction(new TAction(array($this, 'onClear')), 'Limpar'); $clear_button->setImage('fa:undo red fa-lg'); $new_button->setAction(new TAction(array('FrequenciaServidorForm', 'onEdit')), _t('New')); $new_button->setImage('fa:plus-square green fa-lg'); // define wich are the form fields $this->form->setFields(array($servidor_id, $servidor_nome, $diames, $find_button, $clear_button, $new_button)); $container = new THBox(); $container->add($find_button); $container->add($clear_button); $container->add($new_button); $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($container); $cell->colspan = 2; // creates a DataGrid $this->datagrid = new TDataGrid(); $this->datagrid->style = 'width: 100%'; $this->datagrid->setHeight(320); // creates the datagrid columns $servidor_nome = new TDataGridColumn('servidor_nome', 'Nome', 'left', 200); $diames = new TDataGridColumn('diames', 'Data', 'center', 50); $entrada = new TDataGridColumn('entrada', 'Entrada', 'center', 40); $intervalo_inicio = new TDataGridColumn('intervalo_inicio', 'Saída', 'center', 50); $intervalo_fim = new TDataGridColumn('intervalo_fim', 'Entrada', 'center', 50); $saida = new TDataGridColumn('saida', 'Saída', 'center', 50); $ausencia_desc = new TDataGridColumn('ausencia_desc', 'Ausência', 'left'); // add the columns to the DataGrid $this->datagrid->addColumn($servidor_nome); $this->datagrid->addColumn($diames); $this->datagrid->addColumn($entrada); $this->datagrid->addColumn($intervalo_inicio); $this->datagrid->addColumn($intervalo_fim); $this->datagrid->addColumn($saida); $this->datagrid->addColumn($ausencia_desc); $order_servidor_nome = new TAction(array($this, 'onReload')); $order_servidor_nome->setParameter('order', 'servidor_nome'); $servidor_nome->setAction($order_servidor_nome); $order_diames = new TAction(array($this, 'onReload')); $order_diames->setParameter('order', 'diames'); $diames->setAction($order_diames); // inline editing $servidor_entrada_edit = new TDataGridAction(array($this, 'onInlineEdit')); $servidor_entrada_edit->setField('id'); $entrada->setEditAction($servidor_entrada_edit); $servidor_intervalo_inicio_edit = new TDataGridAction(array($this, 'onInlineEdit')); $servidor_intervalo_inicio_edit->setField('id'); $intervalo_inicio->setEditAction($servidor_intervalo_inicio_edit); $servidor_intervalo_fim_edit = new TDataGridAction(array($this, 'onInlineEdit')); $servidor_intervalo_fim_edit->setField('id'); $intervalo_fim->setEditAction($servidor_intervalo_fim_edit); $servidor_saida_edit = new TDataGridAction(array($this, 'onInlineEdit')); $servidor_saida_edit->setField('id'); $saida->setEditAction($servidor_saida_edit); // creates two datagrid actions $action1 = new TDataGridAction(array('FrequenciaServidorForm', 'onEdit')); $action1->setLabel(_t('Edit')); $action1->setImage('fa:pencil-square-o blue'); $action1->setField('id'); $action2 = new TDataGridAction(array($this, 'onDelete')); $action2->setLabel(_t('Delete')); $action2->setImage('fa:trash-o red'); $action2->setField('id'); $action3 = new TDataGridAction(array('FrequenciaServidorForm', 'onFrequencia')); $action3->setLabel('Informação'); $action3->setImage('fa:info-circle blue'); $action3->setField('id'); // add the actions to the datagrid $this->datagrid->addAction($action3); $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', 'FrequenciaServidorList')); $table->addRow()->addCell($this->form); $table->addRow()->addCell($this->datagrid); $table->addRow()->addCell($this->pageNavigation); // add the table inside the page parent::add($table); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TQuickForm('form_CargaHoraria'); $this->form->class = 'tform'; // CSS class $this->form->setFormTitle('Carga Horaria'); // define the form title $this->string = new StringsUtil(); // create the form fields $mes = new TCombo('mes'); $mes->addItems($this->string->array_meses()); $mes->setDefaultOption(FALSE); $mes->setValue(date('m')); $mes->setSize(100); $ano = new TCombo('ano'); $anos = array(2015 => '2015'); $ano->addItems($anos); $ano->setDefaultOption(FALSE); $ano->setSize(70); $qtde_horas = new TCombo('qtde_horas'); $qtde_minutos = new TCombo('qtde_minutos'); // cria combos de horas e minutos $combo_horas = array(); for ($i = 0; $i <= 300; $i++) { $combo_horas[$i] = str_pad($i, 2, 0, STR_PAD_LEFT); } $qtde_horas->addItems($combo_horas); $qtde_horas->setValue(180); $qtde_horas->setSize(60); $qtde_horas->setDefaultOption(FALSE); $combo_minutos = array(); for ($i = 0; $i <= 59; $i++) { $combo_minutos[$i] = str_pad($i, 2, 0, STR_PAD_LEFT); } $qtde_minutos->addItems($combo_minutos); $qtde_minutos->setValue(0); $qtde_minutos->setSize(60); $qtde_minutos->setDefaultOption(FALSE); // add the fields $this->form->addQuickFields('Mês/Ano', array($mes, $ano)); $this->form->addQuickFields('Carga horaria', array($qtde_horas, $qtde_minutos)); // create the form actions $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'fa:floppy-o'); $this->form->addQuickAction(_t('Find'), new TAction(array($this, 'onReload')), 'ico_find.png'); // creates a DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $horario = $this->datagrid->addQuickColumn('horario', 'horario', 'left', 50); $colaborador_id = $this->datagrid->addQuickColumn('colaborador', 'pessoa->pessoa_nome', 'left', 100); $mes = $this->datagrid->addQuickColumn('mes', 'mes', 'left', 100); $ano = $this->datagrid->addQuickColumn('ano', 'ano', 'left', 50); $mes->setTransformer(array('StringsUtil', 'retorna_mes')); $horario->setTransformer(array('StringsUtil', 'retira_segundos')); $colaborador_id->setTransformer(array($this, 'retornaPessoa')); // creates the edit action $editaction = new TDataGridAction(array($this, 'onEdit')); $editaction->setField('id'); $horario->setEditAction($editaction); // create the datagrid actions $delete_action = new TDataGridAction(array($this, 'onDelete')); // add the actions to the datagrid $this->datagrid->addQuickAction(_t('Delete'), $delete_action, 'id', 'fa:trash-o red fa-lg'); // 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 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 = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation); parent::add($container); }
public function __construct() { parent::__construct(); $this->form = new TForm('form_search_PlantaValores'); $this->form->class = 'tform'; $table = new TTable(); $table->style = 'width:100%'; $table->addRowSet(new TLabel('Planta de Valores'), '')->class = 'tformtitle'; $this->form->add($table); $plantavalores_id = new TEntry('plantavalores_id'); $plantavalores_id->setValue(TSession::getValue('plantavalores_id')); $anobase = new TEntry('anobase'); $anobase->setValue(TSession::getValue('anobase')); $row = $table->addRowSet(new TLabel('ID: '), $plantavalores_id); $row = $table->addRowSet(new TLabel('Ano Base: '), $anobase); $find_button = new TButton('find'); $new_button = new TButton('new'); // define the button actions $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find')); $find_button->setImage('ico_find.png'); $new_button->setAction(new TAction(array('PlantaValoresForm', 'onEdit')), _t('New')); $new_button->setImage('ico_new.png'); $this->form->setFields(array($plantavalores_id, $anobase, $find_button, $new_button)); $container = new THBox(); $container->add($find_button); $container->add($new_button); $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($container); $cell->colspan = 2; $this->datagrid = new TDataGrid(); $this->datagrid->style = 'width: 100%'; $this->datagrid->setHeight(320); $plantavalores_id = new TDataGridColumn('plantavalores_id', 'ID', 'right'); $anobase = new TDataGridColumn('anobase', 'Ano Base', 'left'); $this->datagrid->addColumn($plantavalores_id); $this->datagrid->addColumn($anobase); $order_id = new TAction(array($this, 'onReload')); $order_id->setParameter('order', 'plantavalores_id'); $plantavalores_id->setAction($order_id); $order_data = new TAction(array($this, 'onReload')); $order_data->setParameter('order', 'anobase'); $anobase->setAction($order_data); $action1 = new TDataGridAction(array('PlantaValoresForm', 'onEdit')); $action1->setLabel(_t('Edit')); $action1->setImage('ico_edit.png'); $action1->setField('anobase_id'); $action2 = new TDataGridAction(array($this, 'onDelete')); $action2->setLabel(_t('Delete')); $action2->setImage('ico_delete.png'); $action2->setField('plantavalores_id'); $this->datagrid->addAction($action1); $this->datagrid->addAction($action2); $this->datagrid->createModel(); $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); $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); parent::add($table); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_search_Ticket'); $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('Ticket'))->colspan = 2; // create the form fields $id = new TEntry('id'); $id->setMask('99999'); $titulo = new TEntry('titulo'); $criteria = new TCriteria(); $criteria->add(new TFilter("ativo", "=", 1)); $newparam['order'] = 'pessoa_nome'; $newparam['direction'] = 'asc'; $criteria->setProperties($newparam); // order, offset $solicitante_id = new TDBSeekButton('solicitante_id', 'atividade', 'form_search_Ticket', 'Pessoa', 'pessoa_nome', 'solicitante_id', 'solicitante_nome', $criteria); $solicitante_nome = new TEntry('solicitante_nome'); $solicitante_nome->setEditable(FALSE); $criteria = new TCriteria(); $criteria->add(new TFilter('enttipent', '=', 1)); $entcodent = new TDBComboMultiValue('entcodent', 'atividade', 'Entidade', 'entcodent', array(0 => 'entcodent', 1 => 'entrazsoc'), 'entcodent', $criteria); $tipo_ticket_id = new TDBCombo('tipo_ticket_id', 'atividade', 'TipoTicket', 'id', 'nome'); $status_ticket_id = new TDBCombo('status_ticket_id', 'atividade', 'StatusTicket', 'id', 'nome'); $criteria = new TCriteria(); $criteria->add(new TFilter("origem", "=", 1)); $criteria->add(new TFilter("ativo", "=", 1)); $criteria->add(new TFilter("codigo_cadastro_origem", "=", 100)); $responsavel_id = new TDBCombo('responsavel_id', 'atividade', 'Pessoa', 'pessoa_codigo', 'pessoa_nome', 'pessoa_nome', $criteria); $prioridade_id = new TDBCombo('prioridade_id', 'atividade', 'Prioridade', 'id', 'nome'); $sistema_id = new TDBCombo('sistema_id', 'atividade', 'Sistema', 'id', 'nome', 'nome'); // define the sizes $id->setSize(50); $titulo->setSize(274); $solicitante_id->setSize(50); $solicitante_nome->setSize(200); $entcodent->setSize(274); $status_ticket_id->setSize(100); $tipo_ticket_id->setSize(200); $sistema_id->setSize(200); $responsavel_id->setSize(274); $prioridade_id->setSize(100); // add one row for each form field $table->addRowSet(new TLabel('ID:'), $id); $table->addRowSet(new TLabel('Titulo:'), $titulo); $table->addRowSet(new TLabel('Cliente:'), array($solicitante_id, $solicitante_nome)); $table->addRowSet(new TLabel('Entidade:'), $entcodent); $table->addRowSet(new TLabel('Responsável:'), $responsavel_id); $table->addRowSet(new TLabel('Tipo Ticket:'), $tipo_ticket_id); $table->addRowSet(new TLabel('Sistema:'), $sistema_id); $table->addRowSet(new TLabel('Status:'), $status_ticket_id); $table->addRowSet(new TLabel('Prioridade:'), $prioridade_id); $this->form->setFields(array($id, $titulo, $solicitante_id, $solicitante_nome, $entcodent, $status_ticket_id, $tipo_ticket_id, $responsavel_id, $prioridade_id, $sistema_id)); // keep the form filled during navigation with session data $this->form->setData(TSession::getValue('Ticket_filter_data')); // create two action buttons to the form $find_button = TButton::create('find', array($this, 'onSearch'), _t('Find'), 'ico_find.png'); $new_button = TButton::create('new', array('TicketForm', 'onEdit'), _t('New'), 'fa:plus-square green'); $clean_button = TButton::create('clean', array($this, 'onClean'), 'Limpar', 'ico_close.png'); $this->form->addField($find_button); $this->form->addField($new_button); $this->form->addField($clean_button); $buttons_box = new THBox(); $buttons_box->add($find_button); $buttons_box->add($new_button); $buttons_box->add($clean_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->setHeight(320); // creates the datagrid columns $status_ticket_id = new TDataGridColumn('status_ticket_id', 'S', 'center', 20); $id = new TDataGridColumn('id', 'ID', 'left', 20); $titulo = new TDataGridColumn('titulo', 'Titulo', 'left', 250); $solicitante_id = new TDataGridColumn('solicitante_id', 'Cliente', 'left', 250); $responsavel_id = new TDataGridColumn('pessoa_responsavel->pessoa_nome', 'Responsavel', 'left', 100); $prioridade_id = new TDataGridColumn('prioridade->nome', 'Pri', 'right', 20); //get_prioridade()->nome $status_ticket_id->setTransformer(array($this, 'retornaStatus')); $solicitante_id->setTransformer(array($this, 'retornaCliente')); $responsavel_id->setTransformer(array($this, 'retornaPessoa')); $prioridade_id->setTransformer(array($this, 'retornaPrioridade')); // add the columns to the DataGrid $this->datagrid->addColumn($status_ticket_id); $this->datagrid->addColumn($id); $this->datagrid->addColumn($titulo); $this->datagrid->addColumn($solicitante_id); $this->datagrid->addColumn($responsavel_id); $this->datagrid->addColumn($prioridade_id); // creates the datagrid column actions $order_id = new TAction(array($this, 'onReload')); $order_id->setParameter('order', 'id'); $id->setAction($order_id); $order_titulo = new TAction(array($this, 'onReload')); $order_titulo->setParameter('order', 'titulo'); $titulo->setAction($order_titulo); $order_status_ticket_id = new TAction(array($this, 'onReload')); $order_status_ticket_id->setParameter('order', 'status_ticket_id'); $status_ticket_id->setAction($order_status_ticket_id); $order_prioridade_id = new TAction(array($this, 'onReload')); $order_prioridade_id->setParameter('order', 'prioridade->nome'); $prioridade_id->setAction($order_prioridade_id); // creates two datagrid actions $action1 = new TDataGridAction(array('TicketForm', 'onEdit')); $action1->setLabel(_t('Edit')); $action1->setImage('fa:pencil-square-o blue fa-lg'); $action1->setField('id'); // add the actions to the datagrid $this->datagrid->addAction($action1); // 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 = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation); $container->style = 'width: 100%;max-width: 1200px;'; $this->datagrid->style = ' width: 100%; max-width: 1200px;'; parent::add($container); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_search_System_user'); $this->form->class = 'tform'; // creates a table $table = new TTable(); $table->style = 'width:100%'; $table->addRowSet(new TLabel(_t('Users')), '')->class = 'tformtitle'; // add the table inside the form $this->form->add($table); // create the form fields $id = new TEntry('id'); $id->setValue(TSession::getValue('System_user_id')); $name = new TEntry('name'); $name->setValue(TSession::getValue('System_user_name')); // add a row for the filter field $table->addRowSet(new TLabel('ID:'), $id); $table->addRowSet(new TLabel(_t('Name') . ': '), $name); // create two action buttons to the form $find_button = new TButton('find'); $new_button = new TButton('new'); // define the button actions $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find')); $find_button->setImage('fa:search'); $new_button->setAction(new TAction(array('SystemUserForm', 'onEdit')), _t('New')); $new_button->setImage('fa:plus-square green'); // 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($id, $name, $find_button, $new_button)); // creates a DataGrid $this->datagrid = new TDataGrid(); $this->datagrid->setHeight(320); $this->datagrid->style = 'width: 100%'; // creates the datagrid columns $id = new TDataGridColumn('id', 'ID', 'center'); $name = new TDataGridColumn('name', _t('Name'), 'center'); $login = new TDataGridColumn('login', _t('Login'), 'center'); $email = new TDataGridColumn('email', _t('Email'), 'center'); // add the columns to the DataGrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($name); $this->datagrid->addColumn($login); $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_name = new TAction(array($this, 'onReload')); $order_name->setParameter('order', 'name'); $name->setAction($order_name); $order_login = new TAction(array($this, 'onReload')); $order_login->setParameter('order', 'login'); $login->setAction($order_login); $order_email = new TAction(array($this, 'onReload')); $order_email->setParameter('order', 'email'); $email->setAction($order_email); // inline editing $name_edit = new TDataGridAction(array($this, 'onInlineEdit')); $name_edit->setField('id'); $name->setEditAction($name_edit); // creates two datagrid actions $action1 = new TDataGridAction(array('SystemUserForm', 'onEdit')); $action1->setLabel(_t('Edit')); $action1->setImage('fa:pencil-square-o blue fa-lg'); $action1->setField('id'); $action2 = new TDataGridAction(array($this, 'onDelete')); $action2->setLabel(_t('Delete')); $action2->setImage('fa:trash-o grey fa-lg'); $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); }
/** * Execute the action * @param $action A TDataGridAction object * @ignore-autocomplete on */ public function onExecute(TDataGridAction $action) { $selection = $this->view->get_selection(); if ($selection) { list($model, $iter) = $selection->get_selected(); if ($iter) { $activeObject = $this->model->get_value($iter, $this->count); $field = $action->getField(); $label = $action->getLabel(); if (is_null($field)) { throw new Exception(TAdiantiCoreTranslator::translate('Field for action ^1 not defined', $label) . '.<br>' . TAdiantiCoreTranslator::translate('Use the ^1 method', 'setField' . '()') . '.'); } $array['key'] = $activeObject->{$field}; $callb = $action->getAction(); if (is_array($callb)) { if (is_object($callb[0])) { $object = $callb[0]; $window_visible = $object->is_visible(); // execute action call_user_func($callb, $array); if (method_exists($object, 'show')) { } // if the window wasn't visible before // the operation, shows it. // Forms: window wasn't visible, then show. // SeekBtns: window was visible, do nothing. // the operation itself closes the window. if (!$window_visible) { if ($object->get_child()) { $object->show(); } } } else { $class = $callb[0]; $method = $callb[1]; TApplication::executeMethod($class, $method, $array); } } else { // execute action call_user_func($callb, $array); } } } }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); // security check if (TSession::getValue('logged') !== TRUE) { throw new Exception(_t('Not logged')); } // creates the form $this->form = new TForm('form_search_Release'); $this->form->class = 'tform'; // creates a table $table = new TTable(); $table->width = '100%'; // add the table inside the form $this->form->add($table); $table->addRowSet(new TLabel(_t('Releases')), '')->class = 'tformtitle'; // create the form fields $filter = new TEntry('name'); $filter->setValue(TSession::getValue('Release_name')); // add a row for the filter field $row = $table->addRow(); $row->addCell(new TLabel(_t('Name') . ': ')); $row->addCell($filter); // create two action buttons to the form $find_button = new TButton('find'); $new_button = new TButton('new'); // define the button actions $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find')); $find_button->setImage('ico_find.png'); $buttons = new THBox(); $buttons->add($find_button); // security check TTransaction::open('changeman'); if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'ADMINISTRATOR' or Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'MANAGER') { $class = 'ReleaseForm'; $new_button->setAction(new TAction(array($class, 'onEdit')), _t('New')); $new_button->setImage('ico_new.png'); $buttons->add($new_button); } TTransaction::close(); $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($buttons); $cell->colspan = 2; // define wich are the form fields $this->form->setFields(array($filter, $find_button, $new_button)); // creates a DataGrid $this->datagrid = new TDataGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $id = new TDataGridColumn('id', 'ID', 'right', 50); $id_project = new TDataGridColumn('project', _t('Project'), 'left', 200); $name = new TDataGridColumn('name', _t('Name'), 'left', 300); // creates the datagrid actions $order1 = new TAction(array($this, 'onReload')); $order2 = new TAction(array($this, 'onReload')); $order3 = new TAction(array($this, 'onReload')); // define the ordering parameters $order1->setParameter('order', 'id'); $order2->setParameter('order', 'id_project'); $order3->setParameter('order', 'name'); // assign the ordering actions $id->setAction($order1); $id_project->setAction($order2); $name->setAction($order3); // add the columns to the DataGrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($id_project); $this->datagrid->addColumn($name); // security check TTransaction::open('changeman'); if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'ADMINISTRATOR' or Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'MANAGER') { // creates two datagrid actions $class = 'ReleaseForm'; $action1 = new TDataGridAction(array($class, 'onEdit')); $action1->setLabel(_t('Edit')); $action1->setImage('ico_edit.png'); $action1->setField('id'); $action2 = new TDataGridAction(array($this, 'onDelete')); $action2->setLabel(_t('Delete')); $action2->setImage('ico_delete.png'); $action2->setField('id'); // add the actions to the datagrid $this->datagrid->addAction($action1); $this->datagrid->addAction($action2); } else { // creates two datagrid actions $class = 'ViewReleaseForm'; $action1 = new TDataGridAction(array($class, 'onView')); $action1->setLabel(_t('View')); $action1->setImage('ico_view.png'); $action1->setField('id'); // add the actions to the datagrid $this->datagrid->addAction($action1); } TTransaction::close(); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // creates the page structure using a vbox $container = new TVBox(); $container->add($this->form); $container->add($this->datagrid); $container->add($this->pageNavigation); // add the vbox inside the page parent::add($container); }
/** * constructor method */ public function __construct() { parent::__construct(); parent::setTitle('Busca de Pessoas'); parent::setSize(800, 600); new TSession(); // creates the form $this->form = new TForm('form_city_Pessoa'); // creates the table $table = new TTable(); // add the table inside the form $this->form->add($table); // create the form fields $name = new TEntry('pessoa_nome'); // keep the session value $name->setValue(TSession::getValue('test_pessoa_name')); // add the field inside the table $row = $table->addRow(); $row->addCell(new TLabel('Nome:')); $row->addCell($name); // create a find button $find_button = new TButton('search'); // define the button action $find_button->setAction(new TAction(array($this, 'onSearch')), 'Search'); $find_button->setImage('ico_find.png'); // add a row for the find button $row = $table->addRow(); $row->addCell($find_button); // define wich are the form fields $this->form->setFields(array($name, $find_button)); // create the datagrid $this->datagrid = new TDataGrid(); // create the datagrid columns $id = new TDataGridColumn('pessoa_codigo', 'Id', 'right', 25); $name = new TDataGridColumn('pessoa_nome', 'Nome', 'left', 250); $origem = new TDataGridColumn('origem_nome', 'Origem', 'left', 330); $order1 = new TAction(array($this, 'onReload')); $order2 = new TAction(array($this, 'onReload')); $order1->setParameter('order', 'pessoa_codigo'); $order2->setParameter('order', 'pessoa_nome'); // define the column actions $id->setAction($order1); $name->setAction($order2); // add the columns inside the datagrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($name); $this->datagrid->addColumn($origem); // create one datagrid action $action1 = new TDataGridAction(array($this, 'onSelect')); $action1->setLabel('Selecionar'); $action1->setImage('fa:check-circle-o green'); $action1->setField('pessoa_codigo'); // add the action to the datagrid $this->datagrid->addAction($action1); // create the datagrid model $this->datagrid->createModel(); // create the page navigator $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create a table for layout $table = new TTable(); // create a row for the form $row = $table->addRow(); $row->addCell($this->form); // create a row for the datagrid $row = $table->addRow(); $row->addCell($this->datagrid); // create a row for the page navigator $row = $table->addRow(); $row->addCell($this->pageNavigation); $table->style = 'width: 100%;max-width: 1200px;'; $this->datagrid->style = ' width: 100%; max-width: 1200px;'; // add the table inside the page parent::add($table); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); // security check if (TSession::getValue('logged') !== TRUE) { throw new Exception(_t('Not logged')); } // creates the form $this->form = new TForm('form_search_Issue'); $this->form->class = 'tform'; // creates a table $table = new TTable(); $table->width = '100%'; $table->addRowSet(new TLabel(_t('Issues')), '', '', '')->class = 'tformtitle'; // add the table inside the form $this->form->add($table); // create the form fields $filter_status = new TDBCombo('id_status', 'changeman', 'Status', 'id', 'description_translated'); $filter_project = new TDBCombo('id_project', 'changeman', 'Project', 'id', 'description'); $filter_priority = new TDBCombo('id_priority', 'changeman', 'Priority', 'id', 'description_translated'); $filter_category = new TDBCombo('id_category', 'changeman', 'Category', 'id', 'description_translated'); $filter_title = new TEntry('title'); $filter_status->setValue(TSession::getValue('Issue_id_status')); $filter_project->setValue(TSession::getValue('Issue_id_project')); $filter_priority->setValue(TSession::getValue('Issue_id_priority')); $filter_category->setValue(TSession::getValue('Issue_id_category')); $filter_title->setValue(TSession::getValue('Issue_title')); $filter_title->setSize(480); // add a row for the filter field $row = $table->addRow(); $row->addCell(new TLabel(_t('Status') . ': ')); $row->addCell($filter_status); $row->addCell(new TLabel(_t('Project') . ': ')); $row->addCell($filter_project); $row = $table->addRow(); $row->addCell(new TLabel(_t('Priority') . ': ')); $row->addCell($filter_priority); $row->addCell(new TLabel(_t('Category') . ': ')); $row->addCell($filter_category); $row = $table->addRow(); $row->addCell(new TLabel(_t('Title') . ': ')); $cell = $row->addCell($filter_title); $cell->colspan = 3; // create two action buttons to the form $find_button = new TButton('find'); $new_button = new TButton('new'); // define the button actions $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find')); $find_button->setImage('ico_find.png'); TTransaction::open('changeman'); if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'CUSTOMER') { $class = 'NewIssueForm'; $new_button->setAction(new TAction(array($class, 'onEdit')), _t('New')); $new_button->setImage('ico_new.png'); } else { $class = 'UpdateIssueForm'; $new_button->setAction(new TAction(array($class, 'onEdit')), _t('New')); $new_button->setImage('ico_new.png'); } TTransaction::close(); $buttons = new THBox(); $buttons->add($find_button); $buttons->add($new_button); $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($buttons); $cell->colspan = 4; // define wich are the form fields $this->form->setFields(array($filter_status, $filter_project, $filter_priority, $filter_category, $filter_title, $find_button, $new_button)); // creates a DataGrid $this->datagrid = new TDataGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $id = new TDataGridColumn('id', 'ID', 'right', 50); $title = new TDataGridColumn('title', _t('Title'), 'left', 260); $id_status = new TDataGridColumn('status', _t('Status'), 'left', 100); $id_priority = new TDataGridColumn('priority', _t('Priority'), 'left', 100); $id_category = new TDataGridColumn('category', _t('Category'), 'left', 100); $register_date = new TDataGridColumn('register_date', _t('Start date'), 'left', 110); // creates the datagrid actions $order1 = new TAction(array($this, 'onReload')); $order2 = new TAction(array($this, 'onReload')); $order3 = new TAction(array($this, 'onReload')); $order4 = new TAction(array($this, 'onReload')); $order5 = new TAction(array($this, 'onReload')); $order6 = new TAction(array($this, 'onReload')); $order7 = new TAction(array($this, 'onReload')); $order8 = new TAction(array($this, 'onReload')); // define the ordering parameters $order1->setParameter('order', 'id'); $order2->setParameter('order', 'title'); $order3->setParameter('order', 'id_status'); $order4->setParameter('order', 'id_priority'); $order5->setParameter('order', 'id_category'); $order6->setParameter('order', 'register_date'); // assign the ordering actions $id->setAction($order1); $title->setAction($order2); $id_status->setAction($order3); $id_priority->setAction($order4); $id_category->setAction($order5); $register_date->setAction($order6); // add the columns to the DataGrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($title); $this->datagrid->addColumn($id_status); $this->datagrid->addColumn($id_priority); $this->datagrid->addColumn($id_category); $this->datagrid->addColumn($register_date); // security check TTransaction::open('changeman'); if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'ADMINISTRATOR' or Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'MANAGER') { // creates two datagrid actions $class = 'UpdateIssueForm'; $action1 = new TDataGridAction(array($class, 'onEdit')); $action1->setLabel(_t('Edit')); $action1->setImage('ico_edit.png'); $action1->setField('id'); $action2 = new TDataGridAction(array($this, 'onDelete')); $action2->setLabel(_t('Delete')); $action2->setImage('ico_delete.png'); $action2->setField('id'); // add the actions to the datagrid $this->datagrid->addAction($action1); $this->datagrid->addAction($action2); } else { if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'MEMBER') { // creates two datagrid actions $class = 'UpdateIssueForm'; $action1 = new TDataGridAction(array($class, 'onEdit')); $action1->setLabel(_t('Edit')); $action1->setImage('ico_edit.png'); $action1->setField('id'); // add the actions to the datagrid $this->datagrid->addAction($action1); } } // creates two datagrid actions $class = 'ViewIssueForm'; $action3 = new TDataGridAction(array($class, 'onView')); $action3->setLabel(_t('View')); $action3->setImage('ico_view.png'); $action3->setField('id'); $class = 'NoteForm'; $action4 = new TDataGridAction(array($class, 'onEdit')); $action4->setLabel(_t('Comment')); $action4->setImage('ico_new.png'); $action4->setField('id'); // add the actions to the datagrid $this->datagrid->addAction($action3); $this->datagrid->addAction($action4); TTransaction::close(); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // creates the page structure using a vbox $container = new TVBox(); $container->add($this->form); $container->add($this->datagrid); $container->add($this->pageNavigation); // add the vbox inside the page parent::add($container); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); // security check if (TSession::getValue('logged') !== TRUE) { throw new Exception(_t('Not logged')); } // security check TTransaction::open('library'); if (User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'LIBRARIAN') { throw new Exception(_t('Permission denied')); } TTransaction::close(); // creates the form $this->form = new TForm('form_search_Book'); $this->form->class = 'tform'; // creates a table $table = new TTable(); $table->width = '100%'; $table->addRowSet(new TLabel(_t('Books')), '')->class = 'tformtitle'; // add the table inside the form $this->form->add($table); // create the form fields $title = new TEntry('title'); $author_id = new TSeekButton('author_id'); $author_name = new TEntry('author_name'); $collection_id = new TDBCombo('collection_id', 'library', 'Collection', 'id', 'description'); $classification_id = new TDBCombo('classification_id', 'library', 'Classification', 'id', 'description'); $title->setValue(TSession::getValue('Book_title')); $author_id->setValue(TSession::getValue('Book_author_id')); $author_name->setValue(TSession::getValue('Book_author_name')); $collection_id->setValue(TSession::getValue('Book_collection_id')); $classification_id->setValue(TSession::getValue('Book_classification_id')); $author_name->setEditable(FALSE); $title->setSize(320); $author_id->setSize(100); $obj = new TStandardSeek(); $action = new TAction(array($obj, 'onSetup')); $action->setParameter('database', 'library'); $action->setParameter('parent', 'form_search_Book'); $action->setParameter('model', 'Author'); $action->setParameter('display_field', 'name'); $action->setParameter('receive_key', 'author_id'); $action->setParameter('receive_field', 'author_name'); $author_id->setAction($action); // add a row for the title field $row = $table->addRow(); $row->addCell(new TLabel(_t('Title') . ': ')); $cell = $row->addCell($title); // add a row for the title field $row = $table->addRow(); $row->addCell(new TLabel(_t('Author') . ': ')); $row->addMultiCell($author_id, $author_name); // add a row for the title field $row = $table->addRow(); $row->addCell(new TLabel(_t('Collection') . ': ')); $cell = $row->addCell($collection_id); // add a row for the title field $row = $table->addRow(); $row->addCell(new TLabel(_t('Classification') . ': ')); $cell = $row->addCell($classification_id); // create two action buttons to the form $find_button = new TButton('find'); $new_button = new TButton('new'); // define the button actions $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find')); $find_button->setImage('ico_find.png'); $new_button->setAction(new TAction(array('BookForm', 'onEdit')), _t('New')); $new_button->setImage('ico_new.png'); $table->addRowSet('', array($find_button, $new_button))->class = 'tformaction'; // define wich are the form fields $this->form->setFields(array($title, $author_id, $author_name, $collection_id, $classification_id, $find_button, $new_button)); // creates a DataGrid $this->datagrid = new TDataGrid(); $this->datagrid->setHeight(280); // creates the datagrid columns $id = new TDataGridColumn('id', _t('Code'), 'right', 50); $title = new TDataGridColumn('title', _t('Title'), 'left', 200); $main_author = new TDataGridColumn('author_name', _t('Author'), 'left', 160); $edition = new TDataGridColumn('edition', _t('Edition'), 'left', 50); $call = new TDataGridColumn('call_number', _t('Call'), 'left', 80); // creates the datagrid actions $order1 = new TAction(array($this, 'onReload')); $order2 = new TAction(array($this, 'onReload')); // define the ordering parameters $order1->setParameter('order', 'id'); $order2->setParameter('order', 'title'); // assign the ordering actions $id->setAction($order1); $title->setAction($order2); // add the columns to the DataGrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($title); $this->datagrid->addColumn($main_author); $this->datagrid->addColumn($edition); $this->datagrid->addColumn($call); // creates two datagrid actions $action1 = new TDataGridAction(array('BookForm', '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()); // creates the page structure using a vbox $container = new TVBox(); $container->add($this->form); $container->add($this->datagrid); $container->add($this->pageNavigation); // add the vbox inside the page parent::add($container); }
/** * constructor method */ public function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_item_Seek'); // creates the table $table = new TTable(); // add the table inside the form $this->form->add($table); // create the form fields $barcode = new TEntry('barcode'); // keep the session value $barcode->setValue(TSession::getValue('test_item_barcode')); // add the field inside the table $row = $table->addRow(); $row->addCell(new TLabel(_t('Barcode'))); $row->addCell($barcode); // create a find button $find_button = new TButton('search'); // define the button action $find_button->setAction(new TAction(array($this, 'onSearch')), 'Search'); $find_button->setImage('ico_find.png'); // add a row for the find button $row = $table->addRow(); $row->addCell($find_button); // define wich are the form fields $this->form->setFields(array($barcode, $find_button)); // create the datagrid $this->datagrid = new TDataGrid(); // create the datagrid columns $id = new TDataGridColumn('id', _t('Code'), 'right', 70); $barcode = new TDataGridColumn('barcode', _t('Barcode'), 'left', 100); $title = new TDataGridColumn('title', _t('Title'), 'left', 200); $order1 = new TAction(array($this, 'onReload')); $order2 = new TAction(array($this, 'onReload')); $order1->setParameter('order', 'id'); $order2->setParameter('order', 'barcode'); // define the column actions $id->setAction($order1); $barcode->setAction($order2); // add the columns inside the datagrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($barcode); $this->datagrid->addColumn($title); // create one datagrid action $action1 = new TDataGridAction(array($this, 'onSelect')); $action1->setLabel('Selecionar'); $action1->setImage('ico_apply.png'); $action1->setField('barcode'); // add the action to the datagrid $this->datagrid->addAction($action1); // create the datagrid model $this->datagrid->createModel(); // create the page navigator $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create a table for layout $table = new TTable(); // create a row for the form $row = $table->addRow(); $row->addCell($this->form); // create a row for the datagrid $row = $table->addRow(); $row->addCell($this->datagrid); // create a row for the page navigator $row = $table->addRow(); $row->addCell($this->pageNavigation); // add the table inside the page parent::add($table); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_search_RequisitoDesenvolvimento'); $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('Cadastro de DRs'))->colspan = 2; // create the form fields $id = new TEntry('ticket_id'); $id->setMask('99999'); $titulo = new TEntry('titulo'); $data_cadastro = new TDate('data_cadastro'); $data_cadastro->setMask('dd/mm/yyyy'); // define the sizes $id->setSize(50); $titulo->setSize(200); $data_cadastro->setSize(100); // add one row for each form field $table->addRowSet(new TLabel('Ticket:'), $id); $table->addRowSet(new TLabel('Título:'), $titulo); $table->addRowSet(new TLabel('Data:'), $data_cadastro); $this->form->setFields(array($id, $titulo, $data_cadastro)); // keep the form filled during navigation with session data $this->form->setData(TSession::getValue('RequisitoDesenvolvimento_filter_data')); // create two action buttons to the form $find_button = TButton::create('find', array($this, 'onSearch'), _t('Find'), 'ico_find.png'); $clean_button = TButton::create('clean', array($this, 'onClean'), 'Limpar', 'ico_close.png'); $this->form->addField($find_button); $this->form->addField($clean_button); $buttons_box = new THBox(); $buttons_box->add($find_button); $buttons_box->add($clean_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->setHeight(320); // creates the datagrid columns $id = new TDataGridColumn('ticket_id', 'ID', 'right', 20); $data_cadastro = new TDataGridColumn('data_cadastro', 'Data', 'left', 80); $titulo = new TDataGridColumn('titulo', 'Título', 'left', 300); $ticket_id = new TDataGridColumn('ticket->titulo', 'Ticket', 'right', 300); $data_cadastro->setTransformer(array('StringsUtil', 'formatDateBR')); // add the columns to the DataGrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($data_cadastro); $this->datagrid->addColumn($titulo); $this->datagrid->addColumn($ticket_id); // creates the datagrid column actions $order_id = new TAction(array($this, 'onReload')); $order_id->setParameter('order', 'id'); $id->setAction($order_id); $order_titulo = new TAction(array($this, 'onReload')); $order_titulo->setParameter('order', 'titulo'); $titulo->setAction($order_titulo); $order_data_cadastro = new TAction(array($this, 'onReload')); $order_data_cadastro->setParameter('order', 'data_cadastro'); $data_cadastro->setAction($order_data_cadastro); $order_ticket_id = new TAction(array($this, 'onReload')); $order_ticket_id->setParameter('order', 'ticket->titulo'); $ticket_id->setAction($order_ticket_id); // creates two datagrid actions $action1 = new TDataGridAction(array('RequisitoDesenvolvimentoForm', 'onEdit')); $action1->setLabel(_t('Edit')); $action1->setImage('fa:pencil-square-o blue fa-lg'); $action1->setField('id'); $action2 = new TDataGridAction(array($this, 'onDelete')); $action2->setLabel(_t('Delete')); $action2->setImage('fa:trash-o red fa-lg'); $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()); // create the page container $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation); $container->style = 'width: 100%;max-width: 1200px;'; $this->datagrid->style = ' width: 100%; max-width: 1200px;'; parent::add($container); }