/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); parent::setDatabase('samples'); // defines the database parent::setActiveRecord('Product'); // defines the active record parent::setDefaultOrder('id', 'asc'); // defines the default order parent::addFilterField('description', 'like'); // add a filter field parent::addFilterField('unity', '='); // add a filter field // creates the form, with a table inside $this->form = new TQuickForm('form_search_Product'); $this->form->class = 'tform'; $this->form->style = 'width: 650px'; $this->form->setFormTitle('Products'); $units = array('PC' => 'Pieces', 'GR' => 'Grain'); // create the form fields $description = new TEntry('description'); $unit = new TCombo('unity'); $unit->addItems($units); // add a row for the filter field $this->form->addQuickField('Description', $description, 200); $this->form->addQuickField('Unit', $unit, 200); $this->form->setData(TSession::getValue('Product_filter_data')); $this->form->addQuickAction(_t('Find'), new TAction(array($this, 'onSearch')), 'ico_find.png'); $this->form->addQuickAction(_t('New'), new TAction(array('ProductForm', 'onEdit')), 'ico_new.png'); // creates a DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $id = $this->datagrid->addQuickColumn('ID', 'id', 'center', 50); $description = $this->datagrid->addQuickColumn('Description', 'description', 'left', 300); $stock = $this->datagrid->addQuickColumn('Stock', 'stock', 'right', 70); $sale_price = $this->datagrid->addQuickColumn('Sale Price', 'sale_price', 'right', 70); $unity = $this->datagrid->addQuickColumn('Unit', 'unity', 'right', 70); // create the datagrid actions $edit_action = new TDataGridAction(array('ProductForm', 'onEdit')); $delete_action = new TDataGridAction(array($this, 'onDelete')); // add the actions to the datagrid $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'ico_edit.png'); $this->datagrid->addQuickAction(_t('Delete'), $delete_action, 'id', 'ico_delete.png'); // create the datagrid model $this->datagrid->createModel(); // create the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create the page container $container = new TVBox(); $container->add(new TXMLBreadCrumb('menu.xml', 'ProductList')); $container->add($this->form); $container->add($this->datagrid); $container->add($this->pageNavigation); parent::add($container); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); Usuario::checkLogin(); parent::setDatabase('sample'); // defines the database parent::setActiveRecord('Usuario'); // defines the active record parent::setDefaultOrder('id', 'asc'); // defines the default order parent::setFilterField('login'); // defines the filter field // creates the form, with a table inside $this->form = new TForm('form_search_Usuario'); $table = new TTable(); $this->form->add($table); // create the form fields $filter = new TEntry('login'); $filter->setValue(TSession::getValue('Usuario_login')); // add a row for the filter field $table->addRowSet(new TLabel('login:'******'find'); $new_button = new TButton('new'); $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find')); $new_button->setAction(new TAction(array('UsuarioForm', 'onEdit')), _t('New')); $find_button->setImage('ico_find.png'); $new_button->setImage('ico_new.png'); // add a row for the form actions $table->addRowSet($find_button, $new_button); // define wich are the form fields $this->form->setFields(array($filter, $find_button, $new_button)); // creates a DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $id = $this->datagrid->addQuickColumn('id', 'id', 'right', 100); $login = $this->datagrid->addQuickColumn('login', 'login', 'left', 200); $senha = $this->datagrid->addQuickColumn('senha', 'senha', 'left', 200); // create the datagrid actions $edit_action = new TDataGridAction(array('UsuarioForm', 'onEdit')); $delete_action = new TDataGridAction(array($this, 'onDelete')); // add the actions to the datagrid $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'ico_edit.png'); $this->datagrid->addQuickAction(_t('Delete'), $delete_action, 'id', 'ico_delete.png'); // create the datagrid model $this->datagrid->createModel(); // create the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create the page container $container = new TVBox(); $container->add($this->form); $container->add($this->datagrid); $container->add($this->pageNavigation); parent::add($container); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); Usuario::checkLogin(); parent::setDatabase('sample'); // defines the database parent::setActiveRecord('Pedidos'); // defines the active record parent::setDefaultOrder('id', 'asc'); // defines the default order parent::setFilterField('id'); // defines the filter field // creates the form, with a table inside $this->form = new TForm('form_search_Pedidos'); $table = new TTable(); $this->form->add($table); // create the form fields $filter = new TEntry('id'); $filter->setValue(TSession::getValue('Pedidos_id')); // add a row for the filter field $table->addRowSet(new TLabel('id:'), $filter); // create two action buttons to the form $find_button = new TButton('find'); $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find')); $find_button->setImage('ico_find.png'); // add a row for the form actions $table->addRowSet($find_button); // define wich are the form fields $this->form->setFields(array($filter, $find_button)); // creates a DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $id = $this->datagrid->addQuickColumn('id', 'id', 'right', 100); $dataP = $this->datagrid->addQuickColumn('dataP', 'dataP', 'left', 100); $clientes_id = $this->datagrid->addQuickColumn('cliente', 'clientes->nome', 'right', 100); $status = $this->datagrid->addQuickColumn('status', 'status', 'right', 100); // create the datagrid actions $itens_action = new TDataGridAction(array($this, 'showItens')); // add the actions to the datagrid $this->datagrid->addQuickAction("Produtos", $itens_action, 'id', 'ico_find.png'); // create the datagrid model $this->datagrid->createModel(); // create the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create the page container $container = new TVBox(); $container->add($this->form); $container->add($this->datagrid); $container->add($this->pageNavigation); parent::add($container); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); parent::setDatabase('esales'); // defines the database parent::setActiveRecord('Marca'); // defines the active record parent::setDefaultOrder('id', 'asc'); // defines the default order parent::addFilterField('id', '='); // add a filter field parent::addFilterField('descricao', 'ilike'); // add a filter field // creates the form, with a table inside $this->form = new TQuickForm('form_search_Marca'); $this->form->class = 'tform'; // CSS class $this->form->setFormTitle('Marca'); // create the form fields $id = new TEntry('id'); $descricao = new TEntry('descricao'); // add the fields $this->form->addQuickField('id', $id, 100); $this->form->addQuickField('Descrição', $descricao, 200); // keep the form filled during navigation with session data $this->form->setData(TSession::getValue('Marca_filter_data')); // add the search form actions $this->form->addQuickAction('Buscar', new TAction(array($this, 'onSearch')), 'ico_find.png'); $this->form->addQuickAction('Novo', new TAction(array('MarcaForm', 'onEdit')), 'ico_new.png'); // creates a DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $id = $this->datagrid->addQuickColumn('id', 'id', 'right', 100); $descricao = $this->datagrid->addQuickColumn('Descrição', 'descricao', 'left', 200); // create the datagrid actions $edit_action = new TDataGridAction(array('MarcaForm', 'onEdit')); $delete_action = new TDataGridAction(array($this, 'onDelete')); // add the actions to the datagrid $this->datagrid->addQuickAction('Editar', $edit_action, 'id', 'ico_edit.png'); $this->datagrid->addQuickAction('Deletar', $delete_action, 'id', 'ico_delete.png'); // create the datagrid model $this->datagrid->createModel(); // create 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); }
/** * 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(); parent::setDatabase('log'); // defines the database parent::setActiveRecord('SystemAccessLog'); // defines the active record parent::setDefaultOrder('id', 'asc'); // defines the default order parent::addFilterField('login', 'like'); // add a filter field parent::setLimit(20); // creates the form, with a table inside $this->form = new TQuickForm('form_search_SystemAccessLog'); $this->form->class = 'tform'; // CSS class $this->form->setFormTitle('Access Log'); // create the form fields $login = new TEntry('login'); // add the fields $this->form->addQuickField(_t('Login'), $login, '80%'); // keep the form filled during navigation with session data $this->form->setData(TSession::getValue('SystemAccessLog_filter_data')); // add the search form actions $this->form->addQuickAction(_t('Find'), new TAction(array($this, 'onSearch')), 'ico_find.png'); // creates a DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->style = 'width: 100%'; $this->datagrid->setHeight(320); // creates the datagrid columns $id = $this->datagrid->addQuickColumn('id', 'id', 'left'); $sessionid = $this->datagrid->addQuickColumn('sessionid', 'sessionid', 'left'); $login = $this->datagrid->addQuickColumn(_t('Login'), 'login', 'left'); $login_time = $this->datagrid->addQuickColumn('login_time', 'login_time', 'left'); $logout_time = $this->datagrid->addQuickColumn('logout_time', 'logout_time', 'left'); // create the datagrid model $this->datagrid->createModel(); // create the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); $container = new TVBox(); $container->style = 'width: 97%'; $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $container->add($this->form); $container->add($this->datagrid); $container->add($this->pageNavigation); parent::add($container); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); parent::setDatabase('esales'); // defines the database parent::setActiveRecord('Pessoa'); // defines the active record parent::setDefaultOrder('id', 'asc'); // defines the default order parent::addFilterField('id', 'like'); // add a filter field parent::addFilterField('nome', 'like'); // add a filter field parent::addFilterField('telefone', 'like'); // add a filter field parent::addFilterField('email', 'like'); // add a filter field parent::addFilterField('endereco', 'like'); // add a filter field parent::addFilterField('numero', 'like'); // add a filter field parent::addFilterField('cidade_id', 'like'); // add a filter field parent::addFilterField('cep', 'like'); // add a filter field parent::addFilterField('cpf_cnpj', 'like'); // add a filter field parent::addFilterField('tipo_pessoa', 'like'); // add a filter field // creates the form, with a table inside $this->form = new TQuickForm('form_search_Pessoa'); $this->form->class = 'tform'; // CSS class $this->form->setFormTitle('Pessoa'); // create the form fields $id = new TEntry('id'); $nome = new TEntry('nome'); $telefone = new TEntry('telefone'); $email = new TEntry('email'); $endereco = new TEntry('endereco'); $numero = new TEntry('numero'); $cidade_id = new TEntry('cidade_id'); $cep = new TEntry('cep'); $cpf_cnpj = new TEntry('cpf_cnpj'); $tipo_pessoa = new TEntry('tipo_pessoa'); // add the fields $this->form->addQuickField('id', $id, 100); $this->form->addQuickField('nome', $nome, 200); $this->form->addQuickField('telefone', $telefone, 200); $this->form->addQuickField('email', $email, 200); $this->form->addQuickField('endereco', $endereco, 200); $this->form->addQuickField('numero', $numero, 200); $this->form->addQuickField('cidade_id', $cidade_id, 100); $this->form->addQuickField('cep', $cep, 200); $this->form->addQuickField('cpf_cnpj', $cpf_cnpj, 100); $this->form->addQuickField('tipo_pessoa', $tipo_pessoa, 200); // keep the form filled during navigation with session data $this->form->setData(TSession::getValue('Pessoa_filter_data')); // add the search form actions $this->form->addQuickAction('Buscar', new TAction(array($this, 'onSearch')), 'ico_find.png'); $this->form->addQuickAction('Novo', new TAction(array('PessoaForm', 'onEdit')), 'ico_new.png'); // creates a DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $id = $this->datagrid->addQuickColumn('id', 'id', 'right', 100); $nome = $this->datagrid->addQuickColumn('Nome', 'nome', 'left', 200); $telefone = $this->datagrid->addQuickColumn('Telefone', 'telefone', 'left', 200); $email = $this->datagrid->addQuickColumn('Email', 'email', 'left', 200); $endereco = $this->datagrid->addQuickColumn('Endereço', 'endereco', 'left', 200); $numero = $this->datagrid->addQuickColumn('Número', 'numero', 'left', 200); $cidade_id = $this->datagrid->addQuickColumn('Cidade', 'cidade_id', 'right', 100); $cep = $this->datagrid->addQuickColumn('CEP', 'cep', 'left', 200); $cpf_cnpj = $this->datagrid->addQuickColumn('Cpf/Cnpj', 'cpf_cnpj', 'right', 100); $tipo_pessoa = $this->datagrid->addQuickColumn('Tipo Pessoa', 'tipo_pessoa', 'left', 200); // create the datagrid actions $edit_action = new TDataGridAction(array('PessoaForm', 'onEdit')); $delete_action = new TDataGridAction(array($this, 'onDelete')); // add the actions to the datagrid $this->datagrid->addQuickAction('Editar', $edit_action, 'id', 'ico_edit.png'); $this->datagrid->addQuickAction('Deletar', $delete_action, 'id', 'ico_delete.png'); // create the datagrid model $this->datagrid->createModel(); // create 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); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); parent::setDatabase('blog'); // defines the database parent::setActiveRecord('Post'); // defines the active record parent::setFilterField('title'); // defines the filter field parent::setDefaultOrder('id', 'desc'); // creates the form $this->form = new TForm('form_search_Post'); $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('Posts')), '')->class = 'tformtitle'; // create the form fields $filter = new TEntry('title'); $filter->setValue(TSession::getValue('Post_title')); // add a row for the filter field $row = $table->addRow(); $row->addCell(new TLabel('title:')); $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'); $new_button->setAction(new TAction(array('PostForm', 'onEdit')), _t('New')); $new_button->setImage('ico_new.png'); $buttons = new THBox(); $buttons->add($find_button); $buttons->add($new_button); $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 TQuickGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $id = $this->datagrid->addQuickColumn('ID', 'id', 'left', 40); $title = $this->datagrid->addQuickColumn(_t('Title'), 'title', 'left', 300); $category_name = $this->datagrid->addQuickColumn(_t('Category'), 'category_name', 'left', 200); // add the actions to the datagrid $this->datagrid->addQuickAction(_t('Edit'), new TDataGridAction(array('PostForm', 'onEdit')), 'id', 'ico_edit.png'); $this->datagrid->addQuickAction(_t('Delete'), new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png'); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // creates the page structure using a table $table = new TTable(); $table->addRow()->addCell($this->form); $table->addRow()->addCell($this->datagrid); $table->addRow()->addCell($this->pageNavigation); // add the table inside the page parent::add($table); }