/**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     parent::setDatabase('samples');
     // defines the database
     parent::setActiveRecord('City');
     // defines the active record
     // creates the form
     $this->form = new TQuickForm('form_City');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     // define the form title
     $this->form->setFormTitle('Standard Form');
     // create the form fields
     $id = new TEntry('id');
     $name = new TEntry('name');
     $id->setEditable(FALSE);
     // add the form fields
     $this->form->addQuickField('ID', $id, 100);
     $this->form->addQuickField('Name', $name, 100);
     // define the form action
     $this->form->addQuickAction('Save', new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction('New', new TAction(array($this, 'onEdit')), 'ico_new.png');
     $this->form->addQuickAction('Listing', new TAction(array('StandardDataGridView', 'onReload')), 'ico_datagrid.gif');
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     parent::setDatabase('esales');
     // defines the database
     parent::setActiveRecord('Marca');
     // defines the active record
     // creates the form
     $this->form = new TQuickForm('form_Marca');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     // define the form title
     $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, new TRequiredValidator());
     // create the form actions
     $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction('Novo', new TAction(array($this, 'onEdit')), 'ico_new.png');
     // add the form to the page
     parent::add($this->form);
 }
 /**
  * Overloaded method onSave()
  * Executed whenever the user clicks at the save button
  */
 public function onSave()
 {
     // first, use the default onSave()
     $object = parent::onSave();
     // if the object has been saved
     if ($object instanceof Product) {
         $source_file = 'tmp/' . $object->photo_path;
         $target_file = 'images/' . $object->photo_path;
         $finfo = new finfo(FILEINFO_MIME_TYPE);
         // if the user uploaded a source file
         if (file_exists($source_file) and $finfo->file($source_file) == 'image/png') {
             // move to the target directory
             rename($source_file, $target_file);
             try {
                 TTransaction::open($this->database);
                 // update the photo_path
                 $object->photo_path = 'images/' . $object->photo_path;
                 $object->store();
                 TTransaction::close();
             } catch (Exception $e) {
                 new TMessage('error', '<b>Error</b> ' . $e->getMessage());
                 TTransaction::rollback();
             }
         }
     }
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     parent::setDatabase('esales');
     // defines the database
     parent::setActiveRecord('Compra');
     // defines the active record
     // creates the form
     $this->form = new TQuickForm('form_Compra');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     // define the form title
     $this->form->setFormTitle('Compra');
     // create the form fields
     $id = new TEntry('id');
     $vendedor_id = new TSeekButton('vendedor_id');
     $cliente_id = new TEntry('cliente_id');
     $filial_id = new TEntry('filial_id');
     $data = new TDate('data');
     $saida_id = new TEntry('saida_id');
     // add the fields
     $this->form->addQuickField('Código', $id, 100);
     $this->form->addQuickField('Vendedor', $vendedor_id, 100, new TRequiredValidator());
     $this->form->addQuickField('Cliente', $cliente_id, 100, new TRequiredValidator());
     $this->form->addQuickField('Filial', $filial_id, 100, new TRequiredValidator());
     $this->form->addQuickField('data', $data, 100);
     $this->form->addQuickField('saida_id', $saida_id, 100);
     // create the form actions
     $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction('Novo', new TAction(array($this, 'onEdit')), 'ico_new.png');
     // add the form to the page
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 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();
     // defines the database
     parent::setDatabase('library');
     // defines the active record
     parent::setActiveRecord('Publisher');
     // creates the form
     $this->form = new TQuickForm('form_Publisher');
     // create the form fields
     $id = new TEntry('id');
     $name = new TEntry('name');
     $id->setEditable(FALSE);
     // define the sizes
     $this->form->addQuickField(_t('Code'), $id, 100);
     $this->form->addQuickField(_t('Name'), $name, 200);
     // define the form action
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     // add the form to the page
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TQuickForm('form_SystemProgram');
     $this->form->setFormTitle(_t('Program'));
     $this->form->class = 'tform';
     // CSS class
     // defines the database
     parent::setDatabase('permission');
     // defines the active record
     parent::setActiveRecord('SystemProgram');
     // create the form fields
     $id = new TEntry('id');
     $name = new TEntry('name');
     $controller = new TEntry('controller');
     $id->setEditable(false);
     // add the fields
     $this->form->addQuickField('ID', $id, 50);
     $this->form->addQuickField(_t('Name') . ': ', $name, 200);
     $this->form->addQuickField(_t('Controller') . ': ', $controller, 200);
     // validations
     $name->addValidation(_t('Name'), new TRequiredValidator());
     $controller->addValidation('Controller', new TRequiredValidator());
     // add form actions
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     $this->form->addQuickAction(_t('Back to the listing'), new TAction(array('SystemProgramList', 'onReload')), 'ico_datagrid.png');
     $container = new TTable();
     $container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemProgramList'));
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
 function __construct()
 {
     parent::__construct();
     $this->form = new TQuickForm('form_Contribuinte');
     $this->form->setFormTitle('Contribuinte');
     $this->form->class = 'tform';
     parent::setDatabase('liger');
     parent::setActiveRecord('Contribuinte');
     $contribuinte_id = new TEntry('contribuinte_id');
     $contribuinte_nome = new TEntry('contribuinte_nome');
     $contribuinte_tipo = new TCombo('contribuinte_tipo');
     $contribuinte_endereco = new TEntry('contribuinte_endereco');
     $contribuinte_bairro = new TEntry('contribuinte_bairro');
     $contribuinte_cidade = new TEntry('contribuinte_cidade');
     $contribuinte_estado = new TDBCombo('tb_estados_uf_id', 'liger', 'Estado', 'uf_id', 'uf_nome');
     $contribuinte_cep = new TEntry('contribuinte_cep');
     $contribuinte_telefone = new TEntry('contribuinte_telefone');
     $contribuinte_cpf = new TEntry('contribuinte_cpf');
     $contribuinte_dtnascimento = new TDate('contribuinte_dtnascimento');
     $contribuinte_rg = new TEntry('contribuinte_rg');
     $contribuinte_cnpj = new TEntry('contribuinte_cnpj');
     $contribuinte_inscricaoestadual = new TEntry('contribuinte_inscricaoestadual');
     $contribuinte_inscricaomunicipal = new TEntry('contribuinte_inscricaomunicipal');
     $contribuinte_regjuceg = new TEntry('contribuinte_regjuceg');
     $contribuinte_ramo = new TEntry('contribuinte_ramo');
     $contribuinte_codatividade = new TEntry('contribuinte_codatividade');
     $contribuinte_numempregados = new TEntry('contribuinte_numempregados');
     $contribuinte_inicioatividades = new TDate('contribuinte_inicioatividades');
     $tipo = array(1 => "Físico", 2 => "Jurídico");
     $contribuinte_id->setEditable(false);
     $contribuinte_tipo->addItems($tipo);
     $this->form->addQuickField('ID', $contribuinte_id, 100);
     $this->form->addQuickField('Nome/Razão Social', $contribuinte_nome, 400);
     $this->form->addQuickField('Tipo', $contribuinte_tipo, 200);
     $this->form->addQuickField('Endereço', $contribuinte_endereco, 400);
     $this->form->addQuickField('Bairro', $contribuinte_bairro, 200);
     $this->form->addQuickField('Cidade', $contribuinte_cidade, 200);
     $this->form->addQuickField('Estado', $contribuinte_estado, 200);
     $this->form->addQuickField('CEP', $contribuinte_cep, 200);
     $this->form->addQuickField('Telefone', $contribuinte_telefone, 200);
     $this->form->addQuickField('CPF', $contribuinte_cpf, 200);
     $this->form->addQuickField('Data de Nascimento', $contribuinte_dtnascimento, 200);
     $this->form->addQuickField('RG', $contribuinte_rg, 200);
     $this->form->addQuickField('CNPJ', $contribuinte_cnpj, 200);
     $this->form->addQuickField('Inscrição Municipal', $contribuinte_inscricaomunicipal, 200);
     $this->form->addQuickField('Inscrição Estadual', $contribuinte_inscricaoestadual, 200);
     $this->form->addQuickField('Registro JUCEG', $contribuinte_regjuceg, 200);
     $this->form->addQuickField('Ramo', $contribuinte_ramo, 200);
     $this->form->addQuickField('Código de Atividade', $contribuinte_codatividade, 200);
     $this->form->addQuickField('Nº de Empregados', $contribuinte_numempregados, 200);
     $this->form->addQuickField('Início das Atividades', $contribuinte_inicioatividades, 200);
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     $this->form->addQuickAction(_t('Back to the listing'), new TAction(array('ContribuinteList', 'onReload')), 'ico_datagrid.png');
     $container = new TTable();
     $container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'ContribuinteList'));
     $container->addRow()->addCell($this->form);
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     Usuario::checkLogin();
     // creates the form
     $this->form = new TQuickForm('form_Categoria');
     $this->form->class = 'tform';
     // CSS class
     // define the form title
     $this->form->setFormTitle('Categoria');
     // defines the database
     parent::setDatabase('sample');
     // defines the active record
     parent::setActiveRecord('Categoria');
     // create the form fields
     $id = new THidden('id');
     $nome = new TEntry('nome');
     $descricao = new THtmlEditor('descricao');
     // add the fields
     $this->form->addQuickField('', $id, 100);
     $this->form->addQuickField('nome', $nome, 200);
     $this->form->addQuickField('descricao', $descricao, 200);
     $descricao->setSize(400, 300);
     // add a form action
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     // add a form action
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     // add the form to the page
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TQuickForm('form_Bairro');
     $this->form->setFormTitle('Bairro');
     $this->form->class = 'tform';
     // CSS class
     // defines the database
     parent::setDatabase('liger');
     // defines the active record
     parent::setActiveRecord('Bairro');
     // create the form fields
     $bairros_id = new TEntry('bairros_id');
     $bairros_nome = new TEntry('bairros_nome');
     $tb_cidades_cid_id = new TDBCombo('tb_cidades_cid_id', 'liger', 'Cidade', 'cid_id', 'cid_nome');
     $bairros_id->setEditable(false);
     // add the fields
     $this->form->addQuickField('ID', $bairros_id, 50);
     $this->form->addQuickField('Bairro: ', $bairros_nome, 200);
     $this->form->addQuickField('Cidade: ', $tb_cidades_cid_id, 200);
     // add form actions
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     $this->form->addQuickAction(_t('Back to the listing'), new TAction(array('BairroList', 'onReload')), 'ico_datagrid.png');
     $container = new TTable();
     $container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'BairroList'));
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     parent::setDatabase('esales');
     // defines the database
     parent::setActiveRecord('Pessoa');
     // defines the active record
     // creates the form
     $this->form = new TQuickForm('form_Pessoa');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     // define the form title
     $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 TSeekButton('cidade_id');
     $cidade_id->addValidation('Cidade', new TRequiredValidator());
     $cidade_name = new TEntry('cidade_name');
     $obj = new TStandardSeek();
     $action = new TAction(array($obj, 'onSetup'));
     $action->setParameter('database', 'esales');
     $action->setParameter('parent', 'form_Pessoa');
     $action->setParameter('model', 'Cidade');
     $action->setParameter('display_field', 'descricao');
     $action->setParameter('receive_key', 'cidade_id');
     $action->setParameter('receive_field', 'cidade_name');
     $cidade_id->setAction($action);
     $cep = new TEntry('cep');
     $cpf_cnpj = new TEntry('cpf_cnpj');
     $tipo_pessoa = new TRadioGroup('tipo_pessoa');
     $tipo_pessoa->addItems(array('F' => 'Fisica', 'J' => 'Juridica'));
     // add the fields
     $this->form->addQuickField('Codigo', $id, 100);
     $this->form->addQuickField('Nome', $nome, 200);
     $this->form->addQuickField('Telefone', $telefone, 200);
     $this->form->addQuickField('Email', $email, 200);
     $this->form->addQuickField('Endereço', $endereco, 200);
     $this->form->addQuickField('Numero', $numero, 200);
     $this->form->addQuickFields('Cidade', array($cidade_id, $cidade_name), true);
     $this->form->addQuickField('CEP', $cep, 200);
     $this->form->addQuickField('CPF/CNPJ', $cpf_cnpj, 100);
     $this->form->addQuickField('Tipo de pessoa', $tipo_pessoa, 200);
     // create the form actions
     $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction('Novo', new TAction(array($this, 'onEdit')), 'ico_new.png');
     // add the form to the page
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     Usuario::checkLogin();
     // creates the form
     $this->form = new TQuickForm('form_Clientes');
     $this->form->class = 'tform';
     // CSS class
     // define the form title
     $this->form->setFormTitle('Clientes');
     // defines the database
     parent::setDatabase('sample');
     // defines the active record
     parent::setActiveRecord('Clientes');
     // create the form fields
     $id = new THidden('id');
     $nome = new TEntry('nome');
     $sobrenome = new TEntry('sobrenome');
     $cep = new TEntry('cep');
     $logradouro = new TEntry('logradouro');
     $bairro = new TEntry('bairro');
     $cidade = new TEntry('cidade');
     $email = new TEntry('email');
     $dd = new TEntry('dd');
     $telefone = new TEntry('telefone');
     // mascaras nos campos usa-se o 9 para numero e o # para letra
     $telefone->setMask('9999-9999');
     $dd->setMask('99');
     $cep->setMask('99999-999');
     // valida email
     $email->addValidation('E-mail', new TEmailValidator());
     //  new TRequiredValidator validador que faz com que o campo seja obrigatorio
     // add the fields
     $this->form->addQuickField('id', $id, 100);
     $this->form->addQuickField('nome', $nome, 200, new TRequiredValidator());
     $this->form->addQuickField('sobrenome', $sobrenome, 200, new TRequiredValidator());
     $this->form->addQuickField('cep', $cep, 200, new TRequiredValidator());
     $this->form->addQuickField('logradouro', $logradouro, 200, new TRequiredValidator());
     $this->form->addQuickField('bairro', $bairro, 200, new TRequiredValidator());
     $this->form->addQuickField('cidade', $cidade, 200, new TRequiredValidator());
     $this->form->addQuickField('email', $email, 200, new TRequiredValidator());
     $this->form->addQuickField('dd', $dd, 200, new TRequiredValidator());
     $this->form->addQuickField('telefone', $telefone, 200, new TRequiredValidator());
     // add a form action
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     // add a form action
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     // add the form to the page
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TQuickForm('form_Servidor');
     $this->form->setFormTitle('Servidores');
     $this->form->class = 'tform';
     // CSS class
     // defines the database
     parent::setDatabase('lacenrh');
     // defines the active record
     parent::setActiveRecord('Servidor');
     // create the form fields
     $id = new TEntry('id');
     $identificacao = new TEntry('identificacao');
     $servidor = new TEntry('servidor');
     $unidade = new TRadioGroup('unidade');
     $id->setEditable(false);
     //create the combo Unidade
     $itemUnidade = array();
     $itemUnidade['XV'] = ' Alto da XV ';
     $itemUnidade['GT'] = ' Guatupê';
     // add the combo options
     $unidade->addItems($itemUnidade);
     //$unidade->setLayout('horizontal');
     // add the fields
     $this->form->addQuickField('ID', $id, 50);
     $this->form->addQuickField('Identificação', $identificacao, 150);
     $this->form->addQuickField('Nome do Servidor', $servidor, 200);
     $this->form->addQuickField('Unidade', $unidade, 200);
     // validations
     $identificacao->addValidation('Identificação', new TRequiredValidator());
     $servidor->addValidation('Nome', new TRequiredValidator());
     $unidade->addValidation('Unidade', new TRequiredValidator());
     // add form actions
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'fa:floppy-o fa-lg');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'fa:plus-square green fa-lg');
     $this->form->addQuickAction(_t('Back to the listing'), new TAction(array('ServidorList', 'onReload')), 'fa:table blue fa-lg');
     $container = new TTable();
     $container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'ServidorList'));
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TQuickForm('form_Project');
     // defines the database and active record to be handled
     parent::setDatabase('samples');
     parent::setActiveRecord('Project');
     // create the form fields
     $id = new TEntry('id');
     $name = new TEntry('name');
     $start = new TDate('start_date');
     $end = new TDate('end_date');
     $description = new TText('description');
     $goals = new TText('goals');
     $scrum_master = new TEntry('scrum_master');
     $product_owner = new TEntry('product_owner');
     $customer = new TEntry('customer');
     // add the form fields
     $this->form->addQuickField('ID', $id, 100);
     $this->form->addQuickField('Name', $name, 200);
     $this->form->addQuickField('Start', $start, 80);
     $this->form->addQuickField('End', $end, 80);
     $this->form->addQuickField('Description', $description, 200);
     $this->form->addQuickField('Goals', $goals, 200);
     $this->form->addQuickField('Scrum Master', $scrum_master, 200);
     $this->form->addQuickField('Product Owner', $product_owner, 200);
     $this->form->addQuickField('Customer', $customer, 200);
     $id->setEditable(FALSE);
     $description->setSize(200, 40);
     $goals->setSize(200, 40);
     // define the form action
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     $this->form->addQuickAction(_t('List'), new TAction(array('ProjectListView', 'onReload')), 'ico_datagrid.png');
     // creates the notebook
     $this->notebook = new TNotebook();
     $this->notebook->setSize(600, 370);
     $this->notebook->appendPage('Project Data', $this->form);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', 'ProjectListView'));
     $vbox->add($this->notebook);
     parent::add($vbox);
 }
 function __construct()
 {
     parent::__construct();
     Usuario::checkLogin();
     // cria o formulario
     $this->form = new TQuickForm('form_Produtos');
     $this->form->class = 'tform';
     // class css do framework
     // titulo do formulario
     $this->form->setFormTitle('Produtos');
     // banco de dados em uso
     parent::setDatabase('sample');
     // model em uso
     parent::setActiveRecord('Produtos');
     // cria os campos do formulario
     $id = new THidden('id');
     $nome = new TEntry('nome');
     //eleciona a categoria
     $categoria = new TDBCombo('categoria_id', 'sample', 'Categoria', 'id', 'nome', 'nome');
     $descricao = new THtmlEditor('descricao');
     $preco = new TEntry('preco');
     $imagem = new PFile('imagem');
     $imagem->setFolder('uploads');
     $preco->addValidation('preco', new TNumericValidator());
     // somente numeros
     $preco->setNumericMask(2, '.', '');
     // seta a mascara para o mesmo padrao do mysql
     // adiciona os campos label,campo,tamanho
     $this->form->addQuickField('', $id, 100);
     $this->form->addQuickField('nome', $nome, 200);
     $this->form->addQuickField('preco', $preco, 200);
     $this->form->addQuickField('categoria', $categoria, 200);
     $this->form->addQuickField('imagem', $imagem, 200);
     $this->form->addQuickField('descricao', $descricao, 200);
     // para alterar o tamanho de componentes em sua altura e largura
     //deve coloca-las apos adicionar o campos no form
     $descricao->setSize(400, 300);
     // adciona actions no form
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     // adciona o form na pagina
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     parent::setDatabase('esales');
     // defines the database
     parent::setActiveRecord('Produto');
     // defines the active record
     // creates the form
     $this->form = new TQuickForm('form_Produto');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     // define the form title
     $this->form->setFormTitle('Produto');
     // create the form fields
     $id = new TEntry('id');
     $descricao = new TEntry('descricao');
     $preco_compra = new TEntry('preco_compra');
     $preco_venda = new TEntry('preco_venda');
     $marca_id = new TEntry('marca_id');
     $marca_id = new TSeekButton('marca_id');
     $marca_name = new TEntry('marca_name');
     $obj = new TStandardSeek();
     $action = new TAction(array($obj, 'onSetup'));
     $action->setParameter('database', 'esales');
     $action->setParameter('parent', 'form_Produto');
     $action->setParameter('model', 'Marca');
     $action->setParameter('display_field', 'descricao');
     $action->setParameter('receive_key', 'marca_id');
     $action->setParameter('receive_field', 'marca_name');
     $marca_id->setAction($action);
     // add the fields
     $this->form->addQuickField('Codigo', $id, 100);
     $this->form->addQuickField('Descricao', $descricao, 200);
     $this->form->addQuickField('Preco compra', $preco_compra, 200);
     $this->form->addQuickField('Preco venda', $preco_venda, 200);
     $this->form->addQuickFields('Marca', array($marca_id, $marca_name));
     // create the form actions
     $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction('Novo', new TAction(array($this, 'onEdit')), 'ico_new.png');
     // add the form to the page
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TQuickForm('form_Content');
     $this->form->class = 'tform';
     $this->form->style = 'width: 640px';
     $this->form->setFormTitle(_t('Content'));
     // defines the database
     parent::setDatabase('blog');
     // defines the active record
     parent::setActiveRecord('Content');
     // create the form fields
     $id = new TEntry('id');
     $title = new TEntry('title');
     $subtitle = new TText('subtitle');
     $sidepanel = new THtmlEditor('sidepanel');
     $id->setEditable(FALSE);
     // add the fields
     $this->form->addQuickField('ID', $id, 100);
     $this->form->addQuickField(_t('Title'), $title, 500);
     $this->form->addQuickField(_t('Subtitle'), $subtitle, 400);
     $row = $this->form->getContainer()->addRow();
     $row->addCell($lbl = new TLabel(_t('Side panel')));
     $lbl->setFontStyle('b');
     $sidepanel->style = 'margin: 10px';
     $row = $this->form->getContainer()->addRow();
     $row->addCell($sidepanel)->colspan = 2;
     $this->form->addField($sidepanel);
     $subtitle->setSize(500, 40);
     $sidepanel->setSize(590, 200);
     // define the form action
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     TTransaction::open('blog');
     $content = new Content();
     if ($content->load(1)) {
         $this->onEdit(array('key' => 1));
     }
     TTransaction::close();
     // add the form to the page
     parent::add($this->form);
 }
Beispiel #17
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 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 !== 'ADMINISTRATOR') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // defines the database
     parent::setDatabase('library');
     // defines the active record
     parent::setActiveRecord('User');
     // creates the form
     $this->form = new TQuickForm('form_Project');
     $this->form->class = 'tform';
     $this->form->setFormTitle(_t('Users'));
     $this->form->style = 'width: 500px';
     // create the form fields
     $id = new TEntry('id');
     $login = new TEntry('login');
     $name = new TEntry('name');
     $password = new TPassword('password');
     $id_role = new TDBCombo('id_role', 'library', 'Role', 'id', 'description');
     $id->setEditable(FALSE);
     // define the sizes
     $this->form->addQuickField(_t('Code'), $id, 100);
     $this->form->addQuickField('Login', $login, 200);
     $this->form->addQuickField(_t('Name'), $name, 200);
     $this->form->addQuickField(_t('Password'), $password, 200);
     $this->form->addQuickField(_t('Role'), $id_role, 200);
     // define the form action
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $vbox = new TVBox();
     $vbox->add($this->form);
     // add the form to the page
     parent::add($vbox);
 }
Beispiel #18
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TQuickForm('form_Post');
     $this->form->class = 'tform';
     $this->form->style = 'width: 600px';
     $this->form->setFormTitle(_t('Post'));
     // defines the database
     parent::setDatabase('blog');
     // defines the active record
     parent::setActiveRecord('Post');
     // create the form fields
     $id = new TEntry('id');
     $title = new TEntry('title');
     $body = new THtmlEditor('body');
     $keywords = new TEntry('keywords');
     $date = new TDate('date');
     $category_id = new TDBCombo('category_id', 'blog', 'Category', 'id', 'name');
     $id->setEditable(FALSE);
     // add the fields
     $this->form->addQuickField('ID', $id, 100);
     $this->form->addQuickField(_t('Title'), $title, 300);
     $this->form->addQuickField(_t('Date'), $date, 80);
     $row = $this->form->getContainer()->addRow();
     $row->addCell($lbl = new TLabel(_t('Post') . ':'));
     $lbl->setFontStyle('b');
     $body->style = 'margin: 10px';
     $row = $this->form->getContainer()->addRow();
     $row->addCell($body)->colspan = 2;
     $this->form->addField($body);
     $this->form->addQuickField(_t('Keywords'), $keywords, 400);
     $this->form->addQuickField(_t('Category'), $category_id, 200);
     $body->setSize(550, 370);
     // define the form action
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     // add the form to the page
     parent::add($this->form);
 }
 function __construct()
 {
     parent::__construct();
     $this->form = new TQuickForm('form_PlantaValores');
     $this->form->setFormTitle('Planta de Valores');
     $this->form->class = 'tform';
     parent::setDatabase('liger');
     parent::setActiveRecord('PlantaValores');
     // create the form fields
     $plantavalores_id = new TEntry('plantavalores_id');
     $anobase = new TDBCombo('anobase', 'liger', 'AnoBase', 'anobase_id', 'anobase_data');
     $plantavalores_valorm2territorial = new TEntry('plantavalores_valorm2territorial');
     $plantavalores_valorm2predial = new TEntry('plantavalores_valorm2predial');
     $plantavalores_aliquotaterritorial1 = new TEntry('plantavalores_aliquotaterritorial1');
     $plantavalores_aliquotaterritorial2 = new TEntry('plantavalores_aliquotaterritorial2');
     $plantavalores_aliquotaresidencial1 = new TEntry('plantavalores_aliquotaresidencial1');
     $plantavalores_aliquotaresidencial2 = new TEntry('plantavalores_aliquotaresidencial2');
     $plantavalores_aliquotanresidencial1 = new TEntry('plantavalores_aliquotanresidencial1');
     $plantavalores_aliquotanresidencial2 = new TEntry('plantavalores_aliquotanresidencial2');
     $plantavalores_id->setEditable(false);
     $this->form->addQuickField('ID: ', $plantavalores_id, 50);
     $this->form->addQuickField('Ano Base: ', $anobase, 100);
     $this->form->addQuickField('Valor M² Territorial: ', $plantavalores_valorm2territorial, 100);
     $this->form->addQuickField('Valor M² Predial: ', $plantavalores_valorm2predial, 100);
     $this->form->addQuickField('Aliquota Territorial 1: ', $plantavalores_aliquotaterritorial1, 100);
     $this->form->addQuickField('Aliquota Territorial 2: ', $plantavalores_aliquotaterritorial2, 100);
     $this->form->addQuickField('Aliquota Residencial 1: ', $plantavalores_aliquotaresidencial1, 100);
     $this->form->addQuickField('Aliquota Residencial 2: ', $plantavalores_aliquotaresidencial2, 100);
     $this->form->addQuickField('Aliquota Não Residencial 1: ', $plantavalores_aliquotanresidencial1, 100);
     $this->form->addQuickField('Aliquota Não Residencial 2: ', $plantavalores_aliquotanresidencial2, 100);
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     $this->form->addQuickAction(_t('Back to the listing'), new TAction(array('PlantaValoresList', 'onReload')), 'ico_datagrid.png');
     $container = new TTable();
     $container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'PlantaValoresList'));
     $container->addRow()->addCell($this->form);
     parent::add($container);
 }
 public function __construct()
 {
     parent::__construct();
     parent::setDatabase('app');
     parent::setActiveRecord('TipoMaterialConsumo');
     $this->form = new TQuickForm('f');
     $this->form->class = 'tform';
     $this->form->setFormTitle('Persistência');
     // CAMPOS
     $id = new THidden('id');
     $nome = new TEntry('nome');
     $custo = new TEntry('custo');
     $this->form->addQuickField('ID:', $id);
     $this->form->addQuickField('Nome:', $nome, 400);
     $this->form->addQuickField('Custo:', $custo);
     // ACOES
     $p = array($this, 'onSave');
     $gravar = new TAction($p, 'ico_save.png');
     $this->form->addQuickAction('Gravar', $gravar);
     // Adiciona
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // security check
     TTransaction::open('changeman');
     if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic !== 'ADMINISTRATOR') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // defines the database
     parent::setDatabase('changeman');
     // defines the active record
     parent::setActiveRecord('Project');
     // creates the form
     $this->form = new TQuickForm('form_Project');
     $this->form->class = 'tform';
     $this->form->style = 'width:600px';
     $this->form->setFormTitle(_t('Projects'));
     // create the form fields
     $id = new TEntry('id');
     $description = new TEntry('description');
     $page = new TEntry('page');
     $id->setEditable(FALSE);
     // define the sizes
     $this->form->addQuickField('ID:', $id, 100);
     $this->form->addQuickField(_t('Description') . ':', $description, 200);
     $this->form->addQuickField(_t('Address') . ':', $page, 200);
     // define the form action
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $vbox = new TVBox();
     $vbox->add($this->form);
     // add the form to the page
     parent::add($vbox);
 }
 function __construct()
 {
     parent::__construct();
     parent::setDatabase('sample');
     parent::setActiveRecord('Agenda');
     $this->form = new TQuickForm('Agenda');
     $id = new THidden('id');
     $nome = new TEntry('nome');
     $lugar = new TEntry('lugar');
     $descricao = new TText('descricao');
     $data_ev = new TDate('data_ev');
     $hora_ev = new TEntry('hora_ev');
     $hora_ev->setMask('99:99');
     $this->form->addQuickField('', $id);
     $this->form->addQuickField('Nome :', $nome);
     $this->form->addQuickField('Lugar :', $lugar);
     $this->form->addQuickField('Data: ', $data_ev);
     $this->form->addQuickField('Hora: ', $hora_ev);
     $this->form->addQuickField('Descricao: ', $descricao);
     $descricao->setSize(300, 200);
     $this->form->addQuickAction('Gravar', new TAction(array($this, 'onSave')), 'ico_save.png');
     parent::add($this->form);
 }
 function __construct()
 {
     parent::__construct();
     $this->form = new TQuickForm('form_AnoBase');
     $this->form->setFormTitle('Ano Base');
     $this->form->class = 'tform';
     parent::setDatabase('liger');
     parent::setActiveRecord('AnoBase');
     // create the form fields
     $anobase_id = new TEntry('anobase_id');
     $anobase_data = new TEntry('anobase_data');
     $anobase_data->setMask('9999');
     $anobase_id->setEditable(false);
     $this->form->addQuickField('ID: ', $anobase_id, 50);
     $this->form->addQuickField('Ano Base: ', $anobase_data, 100);
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     $this->form->addQuickAction(_t('Back to the listing'), new TAction(array('AnoBaseList', 'onReload')), 'ico_datagrid.png');
     $container = new TTable();
     $container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'AnoBaseList'));
     $container->addRow()->addCell($this->form);
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     parent::setDatabase('esales');
     // defines the database
     parent::setActiveRecord('Filial');
     // defines the active record
     // creates the form
     $this->form = new TQuickForm('form_Filial');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     // define the form title
     $this->form->setFormTitle('Filial');
     // create the form fields
     $id = new TEntry('id');
     $nome = new TEntry('nome');
     $endereco = new TEntry('endereco');
     $numero = new TEntry('numero');
     $email = new TEntry('email');
     $telefone = new TEntry('telefone');
     $fl_matriz = new TRadioGroup('fl_matriz');
     // add the fields
     $this->form->addQuickField('Código', $id, 100);
     $this->form->addQuickField('Nome', $nome, 200, new TRequiredValidator());
     $this->form->addQuickField('Endereco', $endereco, 200);
     $this->form->addQuickField('Número', $numero, 200);
     $this->form->addQuickField('Email', $email, 200);
     $this->form->addQuickField('Telefone', $telefone, 200);
     $this->form->addQuickField('fl_matriz', $fl_matriz, 200);
     // create the form actions
     $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction('Novo', new TAction(array($this, 'onEdit')), 'ico_new.png');
     // add the form to the page
     parent::add($this->form);
 }