/** * Class constructor */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_pdf_shapes'); // creates a table $table = new TTable(); // add the table inside the form $this->form->add($table); // create the form fields $name = new TEntry('name'); $name->addValidation('Name', new TRequiredValidator()); $label = new TLabel('Name' . ': '); $label->setFontColor('red'); $table->addRowSet($label, $name); $save_button = new TButton('generate'); $save_button->setAction(new TAction(array($this, 'onGenerate')), 'Generate'); $save_button->setImage('ico_save.png'); // add a row for the form action $table->addRowSet($save_button); // define wich are the form fields $this->form->setFields(array($name, $save_button)); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->form); parent::add($vbox); }
/** * */ public function makeTLabel($properties) { $widget = new TLabel((string) $properties->{'name'}); $widget->setValue((string) $properties->{'value'}); $widget->setFontColor((string) $properties->{'color'}); $widget->setFontSize((string) $properties->{'size'}); $widget->setFontStyle((string) $properties->{'style'}); $this->fieldsByName[(string) $properties->{'name'}] = $widget; return $widget; }
/** * Open an input dialog */ public function onInputDialog($param) { $name = new TEntry('name'); $amount = new TEntry('amount'); $name->setValue($param['key']); $form = new TForm('input_form'); $form->style = 'padding:20px'; $table = new TTable(); $table->addRowSet(new TLabel('Name: '), $name); $table->addRowSet($lbl = new TLabel('Amount: '), $amount); $lbl->setFontColor('red'); $form->setFields(array($name, $amount)); $form->add($table); // show the input dialog new TInputDialog('Input dialog', $form, new TAction(array($this, 'onConfirm')), 'Confirm'); }
/** * Add a form field * @param $label Field Label * @param $object Field Object * @param $size Field Size * @param $validator Field Validator */ public function addQuickField($label, IWidget $object, $size = 200, TFieldValidator $validator = NULL) { $object->setSize($size, $size); parent::addField($object); // add the field to the container $row = $this->table->addRow(); if ($validator instanceof TRequiredValidator) { $label_field = new TLabel($label . '(*)'); $label_field->setFontColor('#FF0000'); } else { $label_field = new TLabel($label); } $row->addCell($label_field); $row->addCell($object); if ($validator) { $object->addValidation($label, $validator); } }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // creates a table $table = new TTable(); // creates a label with the title $title = new TLabel('Table Multi Cell'); $title->setFontSize(18); $title->setFontFace('Arial'); $title->setFontColor('red'); // adds a row to the table $row = $table->addRow(); $title = $row->addCell($title); $title->colspan = 2; // creates a series of input widgets $id = new TEntry('id'); $name = new TEntry('name'); $min = new TEntry('min'); $max = new TEntry('max'); $start_date = new TDate('start_date'); $end_date = new TDate('end_date'); $address = new TEntry('address'); // adjust the size of the code $id->setSize(70); $start_date->setSize(70); $end_date->setSize(70); $min->setSize(87); $max->setSize(87); // add rows for the fields $table->addRowSet(new TLabel('Code'), $id); $table->addRowSet(new TLabel('Name'), $name); // first approach $table->addRowSet(new TLabel('Value'), array($min, new TLabel('To'), $max)); // second approach $row = $table->addRow(); $row->addCell(new TLabel('Date')); $row->addMultiCell($start_date, $end_date); $table->addRowSet(new TLabel('Address'), $address); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($table); parent::add($vbox); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_Ponto_report'); $this->form->class = 'tform'; // CSS class $this->form->style = 'width: 500px'; $this->string = new StringsUtil(); // creates the table container $table = new TTable(); $table->width = '100%'; // add the table inside the form $this->form->add($table); // define the form title $row = $table->addRow(); $row->class = 'tformtitle'; $cell = $row->addCell(new TLabel('Indicador de produtividade por colaborador')); $cell->colspan = 2; // create the form fields $mes_atividade = new TCombo('mes_atividade'); $mes_atividade->addItems($this->string->array_meses()); $mes_atividade->setDefaultOption(FALSE); $mes_atividade->setValue(date('m')); $mes_atividade->setSize(250); $output_type = new TRadioGroup('output_type'); $output_type->setSize(100); // validations $output_type->addValidation('Saida', new TRequiredValidator()); // add one row for each form field $table->addRowSet(new TLabel('Mês referencia:'), $mes_atividade); $table->addRowSet($label_output_type = new TLabel('Saida:'), $output_type); $label_output_type->setFontColor('#FF0000'); $this->form->setFields(array($mes_atividade, $output_type)); $output_type->addItems(array('html' => 'HTML', 'pdf' => 'PDF', 'rtf' => 'RTF')); $output_type->setValue('html'); $output_type->setLayout('horizontal'); $generate_button = TButton::create('generate', array($this, 'onGenerate'), _t('Generate'), 'fa:check-circle-o green'); $this->form->addField($generate_button); // add a row for the form action $table->addRowSet($generate_button, '')->class = 'tformaction'; parent::add($this->form); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // creates a table $table = new TTable(); // creates a label with the title $title = new TLabel('Table Columns'); $title->setFontSize(18); $title->setFontFace('Arial'); $title->setFontColor('red'); // adds a row to the table $row = $table->addRow(); $title = $row->addCell($title); $title->colspan = 2; // creates a series of input widgets $id = new TEntry('id'); $name = new TEntry('name'); $address = new TEntry('address'); $telephone = new TEntry('telephone'); $city = new TCombo('city'); $text = new TText('text'); $items = array(); $items['1'] = 'Porto Alegre'; $items['2'] = 'Lajeado'; $city->addItems($items); // adjust the size of the code $id->setSize(70); // add rows for the fields $table->addRowSet(new TLabel('Code'), $id); $table->addRowSet(new TLabel('Name'), $name); $table->addRowSet(new TLabel('City'), $city); $table->addRowSet(new TLabel('Address'), $address); $table->addRowSet(new TLabel('Telephone'), $telephone); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($table); parent::add($vbox); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); $string = new StringsUtil(); // creates the form $this->form = new TForm('form_Atividade'); $this->form->class = 'tform'; // CSS class $this->form->style = 'width: 500px'; // add a table inside form $table = new TTable(); $table->width = '100%'; $this->form->add($table); // add a row for the form title $row = $table->addRow(); $row->class = 'tformtitle'; // CSS class $row->addCell(new TLabel('Atividade'))->colspan = 2; // busca dados do banco try { TTransaction::open('atividade'); $logado = Pessoa::retornaUsuario(); $ultimoPonto = Ponto::retornaUltimoPonto($logado->pessoa_codigo); $ponto = new Ponto($ultimoPonto); if ($ponto->hora_saida) { $action = new TAction(array('PontoFormList', 'onReload')); new TMessage('error', 'Não existe ponto com horario em aberto!', $action); } $data_padrao = $string->formatDateBR($ponto->data_ponto); $hora_padrao = Ponto::retornaHoraInicio($string->formatDate($data_padrao), $logado->pessoa_codigo); TTransaction::close(); } catch (Exception $e) { new TMessage('error', '<b>Error</b> ' . $e->getMessage()); } // create the form fields $id = new THidden('id'); $data_atividade = new TEntry('data_atividade'); $data_atividade->setMask('dd/mm/yyyy'); $data_atividade->setValue($data_padrao); $data_atividade->setEditable(FALSE); $hora_inicio = new TEntry('hora_inicio'); $hora_inicio->setEditable(FALSE); $hora_inicio->setValue($hora_padrao); $hora_fim = new THidden('hora_fim'); $hora_fim->setEditable(FALSE); $tempo_atividade = new TEntry('tempo_atividade'); $tempo_atividade->setEditable(FALSE); $qtde_horas = new TCombo('qtde_horas'); $qtde_minutos = new TCombo('qtde_minutos'); $descricao = new TText('descricao'); $colaborador_id = new THidden('colaborador_id'); $colaborador_id->setValue($logado->pessoa_codigo); $colaborador_nome = new TEntry('colaborador_nome'); $colaborador_nome->setEditable(FALSE); $colaborador_nome->setValue($logado->pessoa_nome); $tipo_atividade_id = new TDBCombo('tipo_atividade_id', 'atividade', 'TipoAtividade', 'id', 'nome', 'nome'); $sistema_id = new TDBCombo('sistema_id', 'atividade', 'Sistema', 'id', 'nome'); $ticket_id = new TCombo('ticket_id'); $criteria = new TCriteria(); $criteria->add(new TFilter("status_ticket_id", "IN", array(1, 5))); $newparam['order'] = 'id'; $newparam['direction'] = 'asc'; $criteria->setProperties($newparam); // order, offset $this->onComboTicket($criteria); $horario = explode(':', $hora_padrao); // cria combos de horas e minutos $combo_horas = array(); for ($i = 8; $i <= 18; $i++) { $combo_horas[$i] = str_pad($i, 2, 0, STR_PAD_LEFT); } $qtde_horas->addItems($combo_horas); $qtde_horas->setValue($horario[0]); $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($horario[1]); $qtde_minutos->setDefaultOption(FALSE); // set exit action for input_exit $change_action = new TAction(array($this, 'onChangeAction')); $qtde_horas->setChangeAction($change_action); $qtde_minutos->setChangeAction($change_action); $change_atividade_action = new TAction(array($this, 'onTrocaTipoAtividade')); $tipo_atividade_id->setChangeAction($change_atividade_action); $change_ticket_action = new TAction(array($this, 'onTrocaTicket')); $ticket_id->setChangeAction($change_ticket_action); // define the sizes $id->setSize(100); $data_atividade->setSize(100); $hora_inicio->setSize(100); $hora_fim->setSize(100); $qtde_horas->setSize(60); $qtde_minutos->setSize(60); $tempo_atividade->setSize(100); $descricao->setSize(300, 80); $colaborador_id->setSize(200); $tipo_atividade_id->setSize(200); $ticket_id->setSize(300); // validações $tempo_atividade->addValidation('Hora Fim', new THoraFimValidator()); $tipo_atividade_id->addValidation('Tipo de Atividade', new TRequiredValidator()); $ticket_id->addValidation('Ticket', new TRequiredValidator()); $sistema_id->addValidation('Sistema', new TRequiredValidator()); $descricao->addValidation('Descrição', new TMinLengthValidator(), array(10)); $sem_atividade = TButton::create('atividade', array($this, 'onSemAtividade'), 'Sem Registro', 'ico_add.png'); $this->form->addField($sem_atividade); // add one row for each form field $table->addRowSet(new TLabel('Colaborador:'), $colaborador_nome); $table->addRowSet(new TLabel('Data Atividade:'), array($data_atividade, $label_data = new TLabel('Data do último ponto'))); $label_data->setFontColor('#A9A9A9'); $table->addRowSet(new TLabel('Hora Inicio:'), $hora_inicio); $table->addRowSet($label_qtde_horas = new TLabel('Hora Fim:'), array($qtde_horas, $qtde_minutos, $sem_atividade)); $label_qtde_horas->setFontColor('#FF0000'); $table->addRowSet(new TLabel('Tempo Atividade:'), $tempo_atividade); $table->addRowSet($label_atividade = new TLabel('Tipo Atividade:'), $tipo_atividade_id); $label_atividade->setFontColor('#FF0000'); $table->addRowSet($label_ticket = new TLabel('Ticket:'), $ticket_id); $label_ticket->setFontColor('#FF0000'); $table->addRowSet($label_sistema = new TLabel('Sistema:'), $sistema_id); $label_sistema->setFontColor('#FF0000'); $table->addRowSet($label_descricao = new TLabel('Descrição:'), $descricao); $label_descricao->setFontColor('#FF0000'); $table->addRowSet(new TLabel(''), $id); $table->addRowSet(new TLabel(''), $colaborador_id); $table->addRowSet(new TLabel(''), $hora_fim); //esconder $this->form->setFields(array($id, $data_atividade, $hora_inicio, $qtde_horas, $qtde_minutos, $hora_fim, $tempo_atividade, $descricao, $colaborador_id, $colaborador_nome, $tipo_atividade_id, $ticket_id, $sistema_id)); // create the form actions $save_button = TButton::create('save', array($this, 'onSave'), _t('Save'), 'fa:floppy-o'); $new_button = TButton::create('new', array($this, 'onEdit'), _t('New'), 'fa:plus-square green'); $del_button = TButton::create('delete', array($this, 'onDelete'), _t('Delete'), 'fa:trash-o red fa-lg'); $list_button = TButton::create('list', array('AtividadeList', 'onClean'), _t('List'), 'fa:table blue'); $this->form->addField($save_button); $this->form->addField($new_button); $this->form->addField($del_button); $this->form->addField($list_button); $buttons_box = new THBox(); $buttons_box->add($save_button); $buttons_box->add($new_button); $buttons_box->add($del_button); $buttons_box->add($list_button); // add a row for the form action $row = $table->addRow(); $row->class = 'tformaction'; // CSS class $row->addCell($buttons_box)->colspan = 2; // TScript::create(' $( "#descricao" ).focus(); '); 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('db_crmbf'); if (User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'ADMINISTRATOR') { throw new Exception(_t('Permission denied')); } TTransaction::close(); // defines the database parent::setDatabase('db_crmbf'); // defines the active record parent::setActiveRecord('RegistroTipo'); // creates the form $this->form = new TQuickForm('form_Registro'); $titulo = new TLabel('Cadastrar Tipo Registro'); $titulo->setFontColor('red'); $titulo->setFontSize(16); // create the form fields $id = new TEntry('id'); $nome = new TEntry('nome'); $id->setEditable(FALSE); // define the sizes $this->form->addQuickField('', $titulo, 100); $this->form->addQuickField('Code', $id, 100); $this->form->addQuickField('Nome', $nome, 200); // define the form action $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png'); $this->form->addQuickAction('Novo', new TAction(array($this, 'onEdit')), 'ico_new.png'); // creates a DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $this->datagrid->addQuickColumn('ID', 'id', 'left', 100, new TAction(array($this, 'onReload')), array('order', 'id')); $this->datagrid->addQuickColumn('Nome', 'nome', 'left', 200, new TAction(array($this, 'onReload')), array('order', 'nome')); // add the actions to the datagrid $this->datagrid->addQuickAction('Edit', new TDataGridAction(array($this, 'onEdit')), 'id', 'ico_edit.png'); $this->datagrid->addQuickAction('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(); // add a row to the form $row = $table->addRow(); $row->addCell($this->form); // add a row to the datagrid $row = $table->addRow(); $row->addCell($this->datagrid); // add a row for page navigation $row = $table->addRow(); $row->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 TForm('form_clienteRegistro_Detalhe'); new TSession(); // creates a table $table = new TTable(); $panel = new TPanel(480, 250); // $panel->style = "background-image: url(app/images/background.png);"; $notebook = new TNotebook(500, 250); // add the notebook inside the form $this->form->add($notebook); // add the notebook inside the form $this->form->add($table); // envia key e fk para sessao TSession::setValue('crm_key', $_GET['key']); TSession::setValue('cliente_fk', $_GET['fk']); //dados do cliente CRM TTransaction::open('db_crmbf'); $criteria = new TCriteria(); $criteria->add(new TFilter('cliente_id', '=', $_GET['fk'])); $repository = new TRepository('CRM'); $CRM = $repository->load($criteria); foreach ($CRM as $crms) { $codigoCRM = $crms->id; $tituloCRM = $crms->titulo; $projetoCRM = $crms->projeto_nome; $dataCRM = $crms->data_crm; $tempoCRM = $crms->tempo; $porcentagemCRM = $crms->porcentagem; $descricaoCRM = $crms->descricao; $solicitanteCRM = $crms->solicitante; $usuarioalteracaoCRM = $crms->usuarioalteracao; $responsavel_nomeCRM = $crms->responsavel_nome; $tipo_nomeCRM = $crms->tipo_nome; $cliente_nomeCRM = $crms->cliente_nome; $prioridade_nomeCRM = $crms->prioridade_nome; $status_nomeCRM = $crms->status_nome; } TTransaction::close(); $titulo = new TLabel('CRM - Registros'); $titulo->setFontSize(14); $titulo->setFontFace('Arial'); $titulo->setFontColor('red'); // add a row for the field code $panel->put($titulo, 10, 5); $panel->put("CRM: " . $codigoCRM, 10, 25); $panel->put("Titulo: " . $tituloCRM, 10, 45); $panel->put("Projeto: " . $projetoCRM, 10, 65); $panel->put("Data de Criação: " . $dataCRM, 10, 85); $panel->put("Aberto por: " . $usuarioalteracaoCRM, 10, 105); $panel->put("Cliente: " . $cliente_nomeCRM, 10, 125); $panel->put("Responsavel: " . $responsavel_nomeCRM, 10, 145); $panel->put("Tipo: " . $tipo_nomeCRM, 10, 165); $panel->put("Percentual Conclusão: " . $porcentagemCRM, 10, 185); $panel->put("Tempo Gasto: " . $tempoCRM, 10, 205); $panel->put("Situação: " . $status_nomeCRM, 10, 225); //inserir button no panel $panel->put($button1, 10, 325); $panel->put($button2, 100, 325); // create an action button $button1 = new TButton('action1'); $action1 = new TAction(array('CRMClienteList', 'onReload')); $action1->setParameter('key', $_GET['fk']); $button1->setImage('ico_datagrid.png'); $button1->setAction($action1, 'Voltar'); // create an action button $button2 = new TButton('action2'); $action2 = new TAction(array('RegistroForm', 'onEdit')); $action2->setParameter('fk', $_GET['fk']); $button2->setImage('ico_save.png'); $button2->setAction($action2, 'Inserir Registro'); // define wich are the form fields $this->form->setFields(array($button1, $button2)); $subtable = new TTable(); $row = $subtable->addRow(); $row->addCell($button2); $row->addCell($button1); $table_layout = new TTable(); $table_layout->addRow()->addCell($subtable); $table_layout->addRow()->addCell($this->form); //dados do cliente CRM TTransaction::open('db_crmbf'); $criteria2 = new TCriteria(); // $criteria->add(new TFilter('crm_id', '=', $_GET['key'])); $criteria2->setProperty('order', 'id desc'); $repository2 = new TRepository('Registro'); $reg = $repository2->load($criteria2); foreach ($reg as $regs) { $row = $table->addRow(); $row->addCell(new TLabel('ID:')); $cell = $row->addCell($regs->id); $row = $table->addRow(); $row->addCell(new TLabel('CRM:')); $cell = $row->addCell($regs->crm_id); $row = $table->addRow(); $row->addCell(new TLabel('CRM:')); $cell = $row->addCell($regs->tiporegistro_id); $row = $table->addRow(); $row->addCell(new TLabel('Tempo:')); $cell = $row->addCell($regs->tempo_registro); $row = $table->addRow(); $row->addCell(new TLabel('Data:')); $cell = $row->addCell($regs->data_registro); $row = $table->addRow(); $row->addCell(new TLabel('Horario:')); $cell = $row->addCell($regs->hora_registro); $row = $table->addRow(); $row->addCell(new TLabel('Numero Registro:')); $cell = $row->addCell($regs->numero_registro); $row = $table->addRow(); $row->addCell(new TLabel('Registro:')); $cell = $row->addCell($regs->registro); $row = $table->addRow(); $row->addCell(new TLabel(' ')); $cell = $row->addCell(' '); } TTransaction::close(); parent::add($panel); parent::add($table_layout); }
/** * Class constructor * Creates the page */ public function __construct() { parent::__construct(); new TSession(); // creates the items form and add a table inside $this->form_item = new TForm('form_pos'); $this->form_item->class = 'tform'; $table_item = new TTable(); $table_item->width = '100%'; $this->form_item->add($table_item); // create the form fields $product_id = new TDBSeekButton('product_id', 'samples', 'form_pos', 'Product', 'description', 'product_id', 'product_description'); $product_description = new TEntry('product_description'); $sale_price = new TEntry('sale_price'); $amount = new TEntry('amount'); $discount = new TEntry('discount'); $total = new TEntry('total'); // add validators $product_id->addValidation('Product', new TRequiredValidator()); $amount->addValidation('Amount', new TRequiredValidator()); // define the exit actions $product_id->setExitAction(new TAction(array($this, 'onExitProduct'))); $amount->setExitAction(new TAction(array($this, 'onUpdateTotal'))); $discount->setExitAction(new TAction(array($this, 'onUpdateTotal'))); // define some attributes $product_id->style = 'font-size: 17pt; height: 30px'; $product_description->style = 'font-size: 17pt; height: 30px'; $sale_price->style = 'font-size: 17pt; height: 30px'; $amount->style = 'font-size: 17pt; height: 30px'; $discount->style = 'font-size: 17pt; height: 30px'; $total->style = 'font-size: 17pt; height: 30px'; $product_id->button->style = 'height: 30px; margin-top:0px; vertical-align:top'; // define some properties $product_id->setSize(50); $product_description->setEditable(FALSE); $sale_price->setEditable(FALSE); $total->setEditable(FALSE); $sale_price->setNumericMask(2, '.', ','); $discount->setNumericMask(2, '.', ','); $total->setNumericMask(2, '.', ','); $sale_price->setSize(100); $amount->setSize(100); $discount->setSize(100); $total->setSize(100); // add a row for the form title $row = $table_item->addRow(); $row->class = 'tformtitle'; // CSS class $cell = $row->addCell(new TLabel('Point of Sales')); $cell->colspan = 4; // create the field labels $lab_pro = new TLabel('Product'); $lab_des = new TLabel('Description'); $lab_pri = new TLabel('Price'); $lab_amo = new TLabel('Amount'); $lab_dis = new TLabel('Discount'); $lab_tot = new TLabel('Total'); $lab_pro->setFontSize(17); $lab_des->setFontSize(17); $lab_pri->setFontSize(17); $lab_amo->setFontSize(17); $lab_dis->setFontSize(17); $lab_tot->setFontSize(17); $lab_pro->setFontFace('Trebuchet MS'); $lab_des->setFontFace('Trebuchet MS'); $lab_pri->setFontFace('Trebuchet MS'); $lab_amo->setFontFace('Trebuchet MS'); $lab_dis->setFontFace('Trebuchet MS'); $lab_tot->setFontFace('Trebuchet MS'); $lab_pro->setFontColor('red'); $lab_amo->setFontColor('red'); // creates the action button $button1 = new TButton('add'); $button1->setAction(new TAction(array($this, 'onAddItem')), 'Add item'); $button1->setImage('ico_add.png'); // add the form fields $table_item->addRowSet($lab_pro, $product_id, $lab_des, $product_description); $table_item->addRowSet($lab_pri, $sale_price, $lab_amo, $amount); $table_item->addRowSet($lab_dis, $discount, $lab_tot, array($total, $button1)); // define the form fields $this->form_item->setFields(array($product_id, $product_description, $sale_price, $amount, $discount, $total, $button1)); // creates the customer form and add a table inside it $this->form_customer = new TForm('form_customer'); $this->form_customer->class = 'tform'; $table_customer = new TTable(); $table_customer->width = '100%'; $this->form_customer->add($table_customer); // add a row for the form title $row = $table_customer->addRow(); $row->class = 'tformtitle'; // CSS class $cell = $row->addCell(new TLabel('Customer')); $cell->colspan = 5; // create the form fields $customer_id = new TDBSeekButton('customer_id', 'samples', 'form_customer', 'Customer', 'name', 'customer_id', 'customer_name'); $customer_name = new TEntry('customer_name'); // define validation and other properties $customer_id->addValidation('Customer', new TRequiredValidator()); $customer_id->style = 'font-size: 17pt; height: 30px'; $customer_name->style = 'font-size: 17pt; height: 30px'; $customer_id->button->style = 'height: 30px; margin-top:0px; vertical-align:top'; $customer_id->setSize(50); $customer_name->setEditable(FALSE); // create tha form labels $lab_cus = new TLabel('Customer'); $lab_nam = new TLabel('Name'); $lab_cus->setFontSize(17); $lab_nam->setFontSize(17); $lab_cus->setFontFace('Trebuchet MS'); $lab_nam->setFontFace('Trebuchet MS'); $lab_cus->setFontColor('red'); // action button $button2 = new TButton('save'); $button2->setAction(new TAction(array($this, 'onSave')), 'Save and finish'); $button2->setImage('ico_save.png'); // add the form fields inside the table $table_customer->addRowSet($lab_cus, $customer_id, $lab_nam, $customer_name, $button2); // define the form fields $this->form_customer->setFields(array($customer_id, $customer_name, $button2)); // creates the grid for items $this->cartgrid = new TQuickGrid(); $this->cartgrid->class = 'tdatagrid_table customized-table'; $this->cartgrid->makeScrollable(); $this->cartgrid->setHeight(150); parent::include_css('app/resources/custom-table.css'); $this->cartgrid->addQuickColumn('ID', 'product_id', 'right', 25); $this->cartgrid->addQuickColumn('Description', 'product_description', 'left', 230); $this->cartgrid->addQuickColumn('Price', 'sale_price', 'right', 80); $this->cartgrid->addQuickColumn('Amount', 'amount', 'right', 70); $this->cartgrid->addQuickColumn('Discount', 'discount', 'right', 70); $this->cartgrid->addQuickColumn('Total', 'total', 'right', 100); $this->cartgrid->addQuickAction('Delete', new TDataGridAction(array($this, 'onDelete')), 'product_id', 'ico_delete.png'); $this->cartgrid->createModel(); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->form_item); $vbox->add(new TLabel(' ')); $vbox->add($this->cartgrid); $vbox->add(new TLabel(' ')); $vbox->add($this->form_customer); parent::add($vbox); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // creates a table $table = new TTable(); // creates a label with the title $title = new TLabel('Table Layout'); $title->setFontSize(18); $title->setFontFace('Arial'); $title->setFontColor('red'); // adds a row to the table $row = $table->addRow(); $title = $row->addCell($title); $title->colspan = 2; // creates two sub-tables $table1 = new TTable(); $table2 = new TTable(); $table->border = '1'; $table->cellpadding = '4'; $table->style = 'border-collapse:collapse;'; $table1->border = '1'; $table1->cellpadding = '2'; $table1->style = 'border-collapse:collapse; border-color: red'; $table2->border = '1'; $table2->cellpadding = '2'; $table2->style = 'border-collapse:collapse; border-color: blue'; // creates a series of input widgets $id = new TEntry('id'); $name = new TEntry('name'); $address = new TEntry('address'); $telephone = new TEntry('telephone'); $city = new TCombo('city'); $text = new TText('text'); $items = array(); $items['1'] = 'Porto Alegre'; $items['2'] = 'Lajeado'; $city->addItems($items); // adjust the size of the fields $id->setSize(70); $name->setSize(140); $address->setSize(140); $telephone->setSize(140); $city->setSize(140); $text->setSize(400, 100); // creates a series of labels $label1 = new TLabel('Code'); $label2 = new TLabel('Name'); $label3 = new TLabel('City'); $label4 = new TLabel('Address'); $label5 = new TLabel('Telephone'); // adds a row for the code field $row = $table1->addRow(); $row->addCell($label1); $row->addCell($id); // adds a row for the name field $row = $table1->addRow(); $row->addCell($label2); $row->addCell($name); // adds a row for the city field $row = $table1->addRow(); $row->addCell($label3); $row->addCell($city); // adds a row for the address field $row = $table2->addRow(); $row->addCell($label4); $row->addCell($address); // adds a row for the phone field $row = $table2->addRow(); $row->addCell($label5); $row->addCell($telephone); // adds the tables side by side $row = $table->addRow(); $row->addCell($table1); $row->addCell($table2); $row = $table->addRow(); $cell = $row->addCell($text); $cell->colspan = 2; $label6 = new TLabel('Obs'); $label6->setFontStyle('b'); $label6->setValue('PS: The table borders are just for understanding purposes.'); $row = $table->addRow(); $cell = $row->addCell($label6); $cell->colspan = 2; // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($table); parent::add($vbox); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_Ticket'); $this->form->class = 'tform'; // CSS class $table = new TTable(); $table->style = 'width: 600px'; $tablePagamento = new TTable(); $tablePagamento->style = 'width: 600px'; $notebook = new TNotebook(600, 650); $notebook->appendPage('Ticket - Cadastramento', $table); $notebook->appendPage('Ticket - Orçamento / Pagamento', $tablePagamento); // create the form fields $id = new TEntry('id'); $id->setEditable(FALSE); $titulo = new TEntry('titulo'); $origem = new TCombo('origem'); $combo_origem = array(); $combo_origem['I'] = 'Interno'; $combo_origem['E'] = 'Externo'; $origem->addItems($combo_origem); $origem->setDefaultOption(FALSE); $solicitacao_descricao = new TText('solicitacao_descricao'); $providencia = new TText('providencia'); $orcamento_horas = new TEntry('orcamento_horas'); $orcamento_horas->setMask('999999'); $orcamento_valor_hora = new TEntry('orcamento_valor_hora'); $orcamento_valor_hora->setNumericMask(2, ',', '.'); $valor_desconto = new TEntry('valor_desconto'); $valor_desconto->setNumericMask(2, ',', '.'); $valor_total = new TEntry('valor_total'); $valor_total->setNumericMask(2, ',', '.'); $valor_total->setEditable(FALSE); $forma_pagamento = new TEntry('forma_pagamento'); $data_ultimo_pgto = new TEntry('data_ultimo_pgto'); $data_ultimo_pgto->setEditable(FALSE); $valor_ultimo_pgto = new TEntry('valor_ultimo_pgto'); $valor_ultimo_pgto->setNumericMask(2, ',', '.'); $valor_ultimo_pgto->setEditable(FALSE); $valor_total_pago = new TEntry('valor_total_pago'); $valor_total_pago->setNumericMask(2, ',', '.'); $valor_total_pago->setEditable(FALSE); $data_pagamento = new TDate('data_pagamento'); $data_pagamento->setMask('dd/mm/yyyy'); $valor_pagamento = new TEntry('valor_pagamento'); $valor_pagamento->setNumericMask(2, ',', '.'); $valor_total_parcial = new TEntry('valor_total_parcial'); $valor_total_parcial->setNumericMask(2, ',', '.'); $valor_total_parcial->setEditable(FALSE); $valor_saldo = new TEntry('valor_saldo'); $valor_saldo->setNumericMask(2, ',', '.'); $valor_saldo->setEditable(FALSE); $data_cadastro = new TEntry('data_cadastro'); $data_cadastro->setEditable(FALSE); $data_cadastro->setMask('dd/mm/yyyy'); $data_cadastro->setValue(date('d/m/Y')); $data_inicio = new TDate('data_inicio'); $data_inicio->setMask('dd/mm/yyyy'); $data_inicio_oculta = new THidden('data_inicio_oculta'); $data_cancelamento = new TDate('data_cancelamento'); $data_cancelamento->setMask('dd/mm/yyyy'); $data_encerramento = new TDate('data_encerramento'); $data_encerramento->setMask('dd/mm/yyyy'); $data_prevista = new TDate('data_prevista'); $data_prevista->setMask('dd/mm/yyyy'); $data_aprovacao = new TDate('data_aprovacao'); $data_aprovacao->setMask('dd/mm/yyyy'); $observacao = new TText('observacao'); $nome_dtr = new TEntry('nome_dtr'); $nome_dtr->setEditable(FALSE); $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); $tipo_ticket_id = new TDBCombo('tipo_ticket_id', 'atividade', 'TipoTicket', 'id', 'nome'); $tipo_ticket_id->setDefaultOption(FALSE); $sistema_id = new TDBCombo('sistema_id', 'atividade', 'Sistema', 'id', 'nome'); $status_ticket_id = new TDBCombo('status_ticket_id', 'atividade', 'StatusTicket', 'id', 'nome'); $status_ticket_id->setValue(2); $status_ticket_id->setEditable(FALSE); $prioridade_id = new TDBCombo('prioridade_id', 'atividade', 'Prioridade', 'id', 'nome'); $prioridade_id->setDefaultOption(FALSE); $prioridade_id->setValue(3); $combo_tipo_origens = new TCombo('tipo_origens'); $combo_tipo_origens->addItems(array(1 => 'Entidade', 2 => 'Estabelecimento', 3 => 'Empresa')); $combo_codigo_origem = new TCombo('codigo_cadastro_origem'); $combo_solicitante_id = new TCombo('solicitante_id'); try { TTransaction::open('atividade'); $logado = Pessoa::retornaUsuario(); TTransaction::close(); } catch (Exception $e) { new TMessage('error', '<b>Error</b> ' . $e->getMessage()); // shows the exception error message } $logado_id = new THidden('logado_id'); $logado_id->setValue($logado->pessoa_codigo); // define the sizes $id->setSize(100); $origem->setSize(200); $solicitacao_descricao->setSize(400, 180); $data_inicio->setSize(90); $data_encerramento->setSize(90); $data_cancelamento->setSize(90); $providencia->setSize(400, 80); $orcamento_horas->setSize(100); $orcamento_valor_hora->setSize(100); $valor_desconto->setSize(100); $valor_total->setSize(100); $valor_saldo->setSize(121); $forma_pagamento->setSize(400); $data_ultimo_pgto->setSize(100); $data_pagamento->setSize(100); $valor_pagamento->setSize(121); $valor_ultimo_pgto->setSize(100); $valor_total_pago->setSize(100); $valor_total_parcial->setSize(121); $data_cadastro->setSize(100); $data_prevista->setSize(100); $data_aprovacao->setSize(100); $observacao->setSize(400, 80); $nome_dtr->setSize(400); $titulo->setSize(390); $responsavel_id->setSize(390); $tipo_ticket_id->setSize(200); $sistema_id->setSize(200); $status_ticket_id->setSize(200); $prioridade_id->setSize(200); $combo_tipo_origens->setSize(135); $combo_codigo_origem->setSize(250); $combo_solicitante_id->setSize(390); // validações $titulo->addValidation('Titulo', new TRequiredValidator()); $combo_solicitante_id->addValidation('Solicitante', new TRequiredValidator()); $responsavel_id->addValidation('Responsável', new TRequiredValidator()); $sistema_id->addValidation('Sistema', new TRequiredValidator()); $gerar_dr = TButton::create('gerar_dr', array('RequisitoDesenvolvimentoForm', 'onEdit'), 'Gerar DTR', 'ico_add.png'); $link_dtr = new TButton('link_dtr'); $link_dtr->setImage('bs:edit green'); $link_dtr->setLabel('ir para DTR'); $link_dtr->addFunction("__adianti_load_page('index.php?class=RequisitoDesenvolvimentoForm&method=onBuscaDTR&key={$_REQUEST['key']}');"); $this->form->addField($gerar_dr); $this->form->addField($link_dtr); TButton::disableField('form_Ticket', 'gerar_dr'); TButton::disableField('form_Ticket', 'link_dtr'); // add one row for each form field // notebook Cadastramento $table->addRowSet(new TLabel('Ticket:'), array($id, new TLabel('Data Cadastro'), $data_cadastro)); $table->addRowSet($label_combo_origem = new TLabel('Origem:'), array($combo_tipo_origens, $combo_codigo_origem)); $label_combo_origem->setFontColor('#FF0000'); $table->addRowSet($label_solicitante = new TLabel('Solicitante:'), $combo_solicitante_id); $label_solicitante->setFontColor('#FF0000'); $table->addRowSet($label_responsavel = new TLabel('Responsável:'), $responsavel_id); $label_responsavel->setFontColor('#FF0000'); $table->addRowSet($label_titulo = new TLabel('Título:'), $titulo); $label_titulo->setFontColor('#FF0000'); $table->addRowSet(new TLabel('Data Inicio'), array($data_inicio, $label_status = new TLabel('Status:'), $status_ticket_id)); $label_status->setSize(70); $table->addRowSet(new TLabel('Data Encerramento:'), array($data_encerramento, $label_data_cancelamento = new TLabel('Data Cancelamento:'), $data_cancelamento)); $label_data_cancelamento->setSize(160); $table->addRowSet(new TLabel('Prioridade:'), $prioridade_id); $table->addRowSet(new TLabel('Origem:'), $origem); $table->addRowSet(new TLabel('Tipo Ticket:'), $tipo_ticket_id); $table->addRowSet($label_sistema = new TLabel('Sistema:'), $sistema_id); $label_sistema->setFontColor('#FF0000'); $table->addRowSet(new TLabel('Descrição Solicitação:'), $solicitacao_descricao); $table->addRowSet(new TLabel('DR.:'), $nome_dtr); $table->addRowSet(new TLabel(''), array($gerar_dr, $link_dtr)); $table->addRowSet(new TLabel(''), $data_inicio_oculta); // notebook Pagamento $tablePagamento->addRowSet(new TLabel('Data Prevista:'), $data_prevista); $tablePagamento->addRowSet(new TLabel('Data Aprovação:'), $data_aprovacao); $tablePagamento->addRowSet(new TLabel('Qte Horas:'), $orcamento_horas); $tablePagamento->addRowSet(new TLabel('Valor Hora:'), $orcamento_valor_hora); $tablePagamento->addRowSet(new TLabel('Valor Desconto:'), $valor_desconto); $tablePagamento->addRowSet(new TLabel('Valor Total:'), $valor_total); $tablePagamento->addRowSet(new TLabel('Forma de Pgto:'), $forma_pagamento); $tablePagamento->addRowSet(new TLabel('Descrição Providência:'), $providencia); $tablePagamento->addRowSet(new TLabel('Observação:'), $observacao); // creates a frame $frame = new TFrame(); $frame->oid = 'frame-measures'; $frame->setLegend('Pagamentos:'); $row = $tablePagamento->addRow(); $cell = $row->addCell($frame); $cell->colspan = 2; $page2 = new TTable(); $frame->add($page2); $page2->addRowSet(new TLabel('Valor Pgto:'), array($valor_pagamento, $tamanho_label = new TLabel('Valor Ultimo Pgto:'), $valor_ultimo_pgto)); $tamanho_label->setSize(150); $page2->addRowSet(new TLabel('Data Pgto:'), array($data_pagamento, $tamanho_label = new TLabel('Data Ultimo Pgto:'), $data_ultimo_pgto)); $tamanho_label->setSize(150); $page2->addRowSet(new TLabel('Valor Total:'), array($valor_total_parcial, $tamanho_label = new TLabel('Valor Total Pago: '), $valor_total_pago)); $tamanho_label->setSize(150); $page2->addRowSet(new TLabel('Saldo a pagar:'), $valor_saldo); $tablePagamento->addRowSet(new TLabel(''), $logado_id); // Envia campos para o formulario $this->form->setFields(array($id, $titulo, $data_inicio, $data_inicio_oculta, $data_encerramento, $data_cancelamento, $origem, $solicitacao_descricao, $nome_dtr, $providencia, $orcamento_horas, $orcamento_valor_hora, $valor_desconto, $valor_total, $forma_pagamento, $data_ultimo_pgto, $valor_ultimo_pgto, $valor_total_pago, $data_cadastro, $data_prevista, $data_aprovacao, $observacao, $tipo_ticket_id, $sistema_id, $status_ticket_id, $prioridade_id, $responsavel_id, $valor_total_parcial, $valor_pagamento, $data_pagamento, $valor_saldo, $combo_tipo_origens, $combo_codigo_origem, $combo_solicitante_id, $logado_id)); // create the form actions $save_button = TButton::create('save', array($this, 'onSave'), _t('Save'), 'fa:floppy-o'); $new_button = TButton::create('new', array($this, 'onEdit'), _t('New'), 'fa:plus-square green'); $del_button = TButton::create('delete', array($this, 'onDelete'), _t('Delete'), 'fa:trash-o red fa-lg'); $list_button = TButton::create('list', array('TicketList', 'onReload'), _t('List'), 'fa:table blue'); $enviar_email = TButton::create('email', array($this, 'onEnviaEmail'), 'Enviar Email', 'ico_email.png'); $sincronizar = TButton::create('sincronizar', array($this, 'onSincronizarContatos'), 'Sincronizar Contatos', 'sincronizar.png'); $this->form->addField($save_button); $this->form->addField($new_button); $this->form->addField($del_button); $this->form->addField($list_button); $this->form->addField($enviar_email); $this->form->addField($sincronizar); $subtable = new TTable(); $row = $subtable->addRow(); $row->addCell($save_button); $row->addCell($new_button); $row->addCell($del_button); $row->addCell($list_button); $row->addCell($enviar_email); $row->addCell($sincronizar); $pretable = new TTable(); $pretable->style = 'width: 100%'; $row = $pretable->addRow(); $row->class = 'tformtitle'; // CSS class $row->addCell(new TLabel('Cadastro de Ticket'))->colspan = 2; $change_action = new TAction(array($this, 'onCalculaValorTotal')); $orcamento_horas->setExitAction($change_action); $orcamento_valor_hora->setExitAction($change_action); $valor_desconto->setExitAction($change_action); $change_data_action = new TAction(array($this, 'onChangeDataAction')); $data_aprovacao->setExitAction($change_data_action); $change_data_prev = new TAction(array($this, 'onChangeDataPrevista')); $data_prevista->setExitAction($change_data_prev); $change_data_pagamento = new TAction(array($this, 'onChangeDataPagamento')); $data_pagamento->setExitAction($change_data_pagamento); $change_valor = new TAction(array($this, 'onCalculaValorParcial')); $valor_pagamento->setExitAction($change_valor); $change_status = new TAction(array($this, 'onChangeDataInicio')); $data_inicio->setExitAction($change_status); $change_status = new TAction(array($this, 'onChangeDataCancelamento')); $data_cancelamento->setExitAction($change_status); $change_status = new TAction(array($this, 'onChangeDataEncerramento')); $data_encerramento->setExitAction($change_status); $change_origem = new TAction(array($this, 'onChangeOrigem')); $combo_tipo_origens->setChangeAction($change_origem); $change_tipo_origem = new TAction(array($this, 'onChangeTipoOrigem')); $combo_codigo_origem->setChangeAction($change_tipo_origem); $vbox = new TVBox(); $vbox->add($pretable); $vbox->add($notebook); $vbox->add($subtable); $this->form->add($vbox); parent::add($this->form); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // creates a panel $panel = new TPanel(480, 260); if (PHP_SAPI !== 'cli') { $panel->style = "background-image: url(app/images/background.png);"; } // creates a label with the title $titulo = new TLabel('Panel Layout'); $titulo->setFontSize(18); $titulo->setFontFace('Arial'); $titulo->setFontColor('red'); // put the title label in the panel $panel->put($titulo, 120, 4); $imagem = new TImage('app/images/mouse.png'); // put the image in the panel $panel->put($imagem, 260, 140); // create the input widgets $id = new TEntry('id'); $name = new TEntry('name'); $address = new TEntry('address'); $telephone = new TEntry('telephone'); $city = new TCombo('city'); $items = array(); $items['1'] = 'Porto Alegre'; $items['2'] = 'Lajeado'; // add the options to the combo $city->addItems($items); // adjust the size of the fields $id->setSize(70); $name->setSize(140); $address->setSize(140); $telephone->setSize(140); $city->setSize(140); // create the labels $label1 = new TLabel('Code'); $label2 = new TLabel('Name'); $label3 = new TLabel('City'); $label4 = new TLabel('Address'); $label5 = new TLabel('Telephone'); // put the widgets in the panel $panel->put($label1, 10, 40); $panel->put($id, 10, 60); $panel->put($label2, 30, 90); $panel->put($name, 40, 110); $panel->put($label3, 100, 140); $panel->put($city, 100, 160); $panel->put($label4, 230, 40); $panel->put($address, 230, 60); $panel->put($label5, 200, 90); $panel->put($telephone, 200, 110); if (PHP_SAPI !== 'cli') { $label6 = new TLabel('Obs'); $label6->setFontStyle('b'); $label6->setValue('PS: The panel background is just for understanding purposes.'); $panel->put($label6, 2, 237); } // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($panel); parent::add($vbox); }
/** * Add a field to the MultiField * @param $name Widget's name * @param $text Widget's label * @param $object Widget * @param $size Widget's size * @param $inform Show the Widget in the form */ public function addField($name, $text, GtkObject $object, $size, $mandatory = FALSE) { if ($this->orientation == 'horizontal') { if (count($this->fields) == 0) { $this->row_label = $this->table_fields->addRow(); $this->row_field = $this->table_fields->addRow(); } } else { $row = $this->table_fields->addRow(); $this->row_label = $row; $this->row_field = $row; } $label = new TLabel("<i>{$text}</i>"); if ($mandatory) { $label->setFontColor('#FF0000'); } $n = $this->count; $object->setName("{$this->name}_text{$n}"); $this->row_label->addCell($label); $this->row_field->addCell($object); $this->fields[$name] = array($text, $object, $size, FALSE, $mandatory); $this->allfields[$name] = array($text, $object, $size, FALSE, $mandatory); if (get_class($object) == 'TComboCombined') { $column = new GtkTreeViewColumn('ID'); } else { $column = new GtkTreeViewColumn($text); } $cell_renderer = new GtkCellRendererText(); $cell_renderer->set_property('width', $size); $column->set_fixed_width($size); $column->pack_start($cell_renderer, true); $column->add_attribute($cell_renderer, 'text', $this->count); $this->types[] = GObject::TYPE_STRING; $this->view->append_column($column); $this->columns[$name] = $this->count; $this->count++; // combocombined, need to add one more column and treat different if (get_class($object) == 'TComboCombined') { $cell_renderer->set_property('width', 20); $column->set_fixed_width(20); $tname = $object->getTextName(); $this->fields[$tname] = array($text, $object, $size, TRUE, $mandatory); $this->fields[$name][2] = 20; $this->allfields[$name][2] = 20; $column = new GtkTreeViewColumn($text); $cell_renderer = new GtkCellRendererText(); $cell_renderer->set_property('width', $size); $column->set_fixed_width($size); $column->pack_start($cell_renderer, true); $column->add_attribute($cell_renderer, 'text', $this->count); $this->types[] = GObject::TYPE_STRING; $this->view->append_column($column); $this->allfields[$tname] = array($text, $object, $size, TRUE, $mandatory); $this->columns[$tname] = $this->count; $this->count++; } }
if (file_exists("app.widgets/{$classe}.class.php")) { include_once "app.widgets/{$classe}.class.php"; } } // cria o formulário $form = new TForm('form_pessoas'); // cria a tabela para organizar o layout $table = new TTable(); $table->border = 1; $table->bgcolor = '#f2f2f2'; // adiciona a tabela no formulário $form->add($table); // cria um rótulo de texto para o título $titulo = new TLabel('Exemplo de Formulário'); $titulo->setFontFace('Arial'); $titulo->setFontColor('red'); $titulo->setFontSize(18); // adiciona uma linha à tabela $row = $table->addRow(); $titulo = $row->addCell($titulo); $titulo->colspan = 2; // cria duas outras tabelas $table1 = new TTable(); $table2 = new TTable(); // cria uma série de campos de entrada de dados $codigo = new TEntry('codigo'); $nome = new TEntry('nome'); $endereco = new TEntry('endereco'); $telefone = new TEntry('telefone'); $cidade = new TCombo('cidade'); $items = array();
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); $this->string = new StringsUtil(); // creates the form $this->form = new TForm('form_Atividade'); $this->form->class = 'tform'; // CSS class $this->form->style = 'width: 500px'; // add a table inside form $table = new TTable(); $table->width = '100%'; $this->form->add($table); // add a row for the form title $row = $table->addRow(); $row->class = 'tformtitle'; // CSS class $row->addCell(new TLabel('Registro de ausências'))->colspan = 2; // create the form fields $id = new THidden('id'); $criteria = new TCriteria(); $criteria->add(new TFilter("origem", "=", 1)); $criteria->add(new TFilter("codigo_cadastro_origem", "=", 100)); $criteria->add(new TFilter("ativo", "=", 1)); $criteria->add(new TFilter("usuario", "is not ")); $colaborador_id = new TDBCombo('colaborador_id', 'atividade', 'Pessoa', 'pessoa_codigo', 'pessoa_nome', 'pessoa_nome', $criteria); $criteria = new TCriteria(); $criteria->add(new TFilter("id", "in", array(10, 17))); $tipo_atividade_id = new TDBCombo('tipo_atividade_id', 'atividade', 'TipoAtividade', 'id', 'nome', 'nome', $criteria); $tipo_atividade_id->setDefaultOption(FALSE); $data_inicial = new TDate('data_inicial'); $data_inicial->setMask('dd/mm/yyyy'); $data_final = new TDate('data_final'); $data_final->setMask('dd/mm/yyyy'); // define the sizes $id->setSize(100); $data_inicial->setSize(100); $data_final->setSize(100); $colaborador_id->setSize(290); $tipo_atividade_id->setSize(290); // validações $data_inicial->addValidation('Data inicial', new TRequiredValidator()); $data_final->addValidation('Data final', new TRequiredValidator()); $colaborador_id->addValidation('Colaborador', new TRequiredValidator()); $tipo_atividade_id->addValidation('Tipo atividade', new TRequiredValidator()); // add one row for each form field $table->addRowSet($label1 = new TLabel('Colaborador:'), $colaborador_id); $label1->setFontColor('#FF0000'); $table->addRowSet($label2 = new TLabel('Tipo Atividade:'), $tipo_atividade_id); $label2->setFontColor('#FF0000'); $table->addRowSet($label3 = new TLabel('Data inicial:'), array($data_inicial, $label4 = new TLabel('final:'), $data_final)); $label3->setFontColor('#FF0000'); $label4->setFontColor('#FF0000'); $table->addRowSet(new TLabel(''), $id); // add some row for the form info $row = $table->addRow(); $row->addCell(new TLabel('Este sistema deve ser utilizado para registrar ausências de dias completos'))->colspan = 2; $row = $table->addRow(); $row->addCell(new TLabel('No periodo selecionado não pode haver ponto cadastrado'))->colspan = 2; $row = $table->addRow(); $row->addCell($label_red = new TLabel('Cuidado para não cadastrar finais de semana e feriados (periodo útil)'))->colspan = 2; $label_red->setFontColor('#FF0000'); $this->form->setFields(array($id, $data_inicial, $data_final, $colaborador_id, $tipo_atividade_id)); $change_data = new TAction(array($this, 'onChangeData')); $data_inicial->setExitAction($change_data); $data_final->setExitAction($change_data); // create the form actions $save_button = TButton::create('save', array($this, 'onSave'), _t('Save'), 'fa:floppy-o'); $new_button = TButton::create('new', array($this, 'onEdit'), _t('New'), 'fa:plus-square green'); $this->form->addField($save_button); $this->form->addField($new_button); $buttons_box = new THBox(); $buttons_box->add($save_button); $buttons_box->add($new_button); // add a row for the form action $row = $table->addRow(); $row->class = 'tformaction'; // CSS class $row->addCell($buttons_box)->colspan = 2; parent::add($this->form); }
function onStep2() { try { $data = $this->form->getData(); $this->form->validate(); $page2 = new TTable(); $this->notebook->appendPage('Page 2', $page2); $gender_options = array('M' => 'Male', 'F' => 'Female'); $ocupation_optins = array('S' => 'Self employed', 'B' => 'Business', 'R' => 'Retired'); switch ($data->field1) { case 'combo': $field3 = new TCombo('field3'); break; case 'radio': $field3 = new TRadioGroup('field3'); $field3->setLayout('horizontal'); break; case 'check': $field3 = new TCheckGroup('field3'); $field3->setLayout('horizontal'); break; } $field3->addValidation('Field 3', new TRequiredValidator()); switch ($data->field2) { case '1': $label = 'Gender'; $field3->addItems($gender_options); break; case '2': $label = 'Ocupation'; $field3->addItems($ocupation_optins); break; } $field4 = new TEntry('field4'); $field4->addValidation('Field 4', new TRequiredValidator()); // add a row for one field $row = $page2->addRow(); $row->addCell($l3 = new TLabel($label . ':')); $cell = $row->addCell($field3); // add a row for one field $row = $page2->addRow(); $row->addCell($l4 = new TLabel('Next tab title:')); $cell = $row->addCell($field4); $l3->setFontColor('#FF0000'); $l4->setFontColor('#FF0000'); // creates the action button $button2 = new TButton('action2'); $button2->setAction(new TAction(array($this, 'onStep3')), 'Next'); $button2->setImage('ico_next.png'); $row = $page2->addRow(); $row->addCell($button2); $this->form->addField($field3); $this->form->addField($field4); $this->form->addField($button2); $this->notebook->setCurrentPage(1); $this->form->setData($data); } catch (Exception $e) { new TMessage('error', $e->getMessage()); } }
/** * Show the widget at the screen */ public function show() { $wrapper = new TElement('div'); $wrapper->{'mtf_name'} = $this->getName(); // include the needed libraries and styles if ($this->fields) { $table = new TTable(); $mandatory = array(); // mandatory $fields = array(); $i = 0; if ($this->orientation == 'horizontal') { $row_label = $table->addRow(); $row_field = $table->addRow(); } foreach ($this->fields as $name => $obj) { if ($this->orientation == 'vertical') { $row = $table->addRow(); $row_label = $row; $row_field = $row; } $label = new TLabel($obj->text); if ($obj->mandatory) { $label->setFontColor('red'); } $row_label->addCell($label); $row_field->addCell($obj->field); $mandatory[] = $obj->mandatory; $fields[] = $name; $post_fields[$name] = 1; $sizes[$name] = $obj->size; $obj->field->setName($this->name . '_' . $name); if (get_class($obj->field) == 'TComboCombined') { $aux_name = $obj->field->getTextName(); $aux_full_name = $this->name . '_' . $aux_name; $mandatory[] = 0; $obj->field->setTextName($aux_full_name); $fields[] = $aux_name; $post_fields[$aux_name] = 1; // invert sizes $sizes[$aux_name] = $obj->size; $sizes[$name] = 20; $i++; } $i++; } $wrapper->add($table); } // check whether the widget is non-editable if (parent::getEditable()) { // create three buttons to control the MultiField $add = new TButton("{$this->name}btnStore"); $add->setLabel(TAdiantiCoreTranslator::translate('Register')); //$add->setName("{$this->name}btnStore"); $add->setImage('ico_save.png'); $add->addFunction("mtf{$this->name}.addRowFromFormFields()"); $del = new TButton("{$this->name}btnDelete"); $del->setLabel(TAdiantiCoreTranslator::translate('Delete')); $del->setImage('ico_delete.png'); $can = new TButton("{$this->name}btnCancel"); $can->setLabel(TAdiantiCoreTranslator::translate('Cancel')); $can->setImage('ico_close.png'); $table = new TTable(); $row = $table->addRow(); $row->addCell($add); $row->addCell($del); $row->addCell($can); $wrapper->add($table); } // create the MultiField Panel $panel = new TElement('div'); $panel->{'class'} = "multifieldDiv"; $input = new THidden($this->name); $panel->add($input); // create the MultiField DataGrid Header $table = new TTable(); $table->id = "{$this->name}mfTable"; $head = new TElement('thead'); $table->add($head); $row = new TTableRow(); $head->add($row); // fill the MultiField DataGrid if ($this->fields) { foreach ($this->fields as $obj) { $c = $obj->text; if (get_class($obj->field) == 'TComboCombined') { $cell = $row->addCell('ID'); $cell->width = '20px'; } $cell = $row->addCell($c); $cell->width = $obj->size . 'px'; } } $body_height = $this->height - 27; $body = new TElement('tbody'); $body->style = "height: {$body_height}px"; $table->add($body); if ($this->objects) { foreach ($this->objects as $obj) { if (isset($obj->id)) { $row = new TTableRow(); $row->dbId = $obj->id; $body->add($row); } else { $row = new TTableRow(); $body->add($row); } if ($fields) { foreach ($fields as $name) { $cell = $row->addCell(is_null($obj->{$name}) ? '' : $obj->{$name}); if (isset($sizes[$name])) { $cell->style = 'width:' . $sizes[$name] . 'px'; } } } } } $panel->add($table); $wrapper->add($panel); $wrapper->show(); echo '<script type="text/javascript">'; echo "var mtf{$this->name};"; //echo '$(document).ready(function() {'; echo "mtf{$this->name} = new MultiField('{$this->name}mfTable',{$this->width},{$this->height});\n"; $s = implode("','", $fields); echo "mtf{$this->name}.formFieldsAlias = Array('{$s}');\n"; $sfields = implode("','{$this->name}_", $fields); echo "mtf{$this->name}.formFieldsName = Array('{$this->name}_{$sfields}');\n"; echo "mtf{$this->name}.formPostFields = Array();\n"; if ($post_fields) { foreach ($post_fields as $col => $value) { echo "mtf{$this->name}.formPostFields['{$col}'] = '{$value}';\n"; } } $mdr_array = implode(',', $mandatory); echo "mtf{$this->name}.formFieldsMandatory = [{$mdr_array}];\n"; echo "mtf{$this->name}.mandatoryMessage = '" . TAdiantiCoreTranslator::translate('The field ^1 is required') . "';\n"; echo "mtf{$this->name}.storeButton = document.getElementsByName('{$this->name}btnStore')[0];\n"; echo "mtf{$this->name}.deleteButton = document.getElementsByName('{$this->name}btnDelete')[0];\n"; echo "mtf{$this->name}.cancelButton = document.getElementsByName('{$this->name}btnCancel')[0];\n"; echo "mtf{$this->name}.inputResult = document.getElementsByName('{$this->name}')[0];\n"; //echo '});'; echo '</script>'; }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_Sale'); $this->form->class = 'tform'; // CSS class parent::include_css('app/resources/custom-frame.css'); $table_master = new TTable(); $table_master->width = '100%'; $table_master->addRowSet(new TLabel('Sale'), '', '')->class = 'tformtitle'; // add a table inside form $table_general = new TTable(); $table_general->width = '100%'; $tableProduct = new TTable(); $tableProduct->width = '100%'; $frame_general = new TFrame(); $frame_general->setLegend('General data'); $frame_general->style = 'background:whiteSmoke'; $frame_general->add($table_general); $table_master->addRow()->addCell($frame_general)->colspan = 2; $row = $table_master->addRow(); $row->addCell($tableProduct); $this->form->add($table_master); // master fields $id = new TEntry('id'); $date = new TDate('date'); $customer_id = new TDBSeekButton('customer_id', 'samples', $this->form->getName(), 'Customer', 'name', 'customer_id', 'customer_name'); $customer_name = new TEntry('customer_name'); $obs = new TText('obs'); // detail fields $product_id = new TDBSeekButton('product_id', 'samples', $this->form->getName(), 'Product', 'description', 'product_id', 'product_name'); $product_name = new TEntry('product_name'); $sale_price = new TEntry('product_price'); $amount = new TEntry('product_amount'); $discount = new TEntry('product_discount'); $total = new TEntry('product_total'); $product_id->setExitAction(new TAction(array($this, 'onProductChange'))); $id->setSize(40); $date->setSize(100); $obs->setSize(400, 100); $product_id->setSize(50); $customer_id->setSize(50); $id->setEditable(false); $product_name->setEditable(false); $customer_name->setEditable(false); $date->addValidation('Date', new TRequiredValidator()); $customer_id->addValidation('Customer', new TRequiredValidator()); // pedido $table_general->addRowSet(new TLabel('ID'), $id); $table_general->addRowSet($label_date = new TLabel('Date (*)'), $date); $table_general->addRowSet($label_customer = new TLabel('Customer (*)'), array($customer_id, $customer_name)); $table_general->addRowSet(new TLabel('Obs'), $obs); $label_date->setFontColor('#FF0000'); // products $frame_product = new TFrame(); $frame_product->setLegend('Products'); $row = $tableProduct->addRow(); $row->addCell($frame_product); $add_product = new TButton('add_product'); $action_product = new TAction(array($this, 'onProductAdd')); $add_product->setAction($action_product, 'Register'); $add_product->setImage('fa:save'); $subtable_product = new TTable(); $frame_product->add($subtable_product); $subtable_product->addRowSet($label_product = new TLabel('Product (*)'), array($product_id, $product_name)); $subtable_product->addRowSet($label_sale_price = new TLabel('Price (*)'), $sale_price); $subtable_product->addRowSet($label_amount = new TLabel('Amount(*)'), $amount); $subtable_product->addRowSet(new TLabel('Discount'), $discount); $subtable_product->addRowSet($add_product); $label_product->setFontColor('#FF0000'); $label_amount->setFontColor('#FF0000'); $label_sale_price->setFontColor('#FF0000'); $this->product_list = new TQuickGrid(); $this->product_list->setHeight(175); $this->product_list->makeScrollable(); $this->product_list->disableDefaultClick(); $this->product_list->addQuickColumn('', 'edit', 'left', 50); $this->product_list->addQuickColumn('', 'delete', 'left', 50); $this->product_list->addQuickColumn('ID', 'product_id', 'center', 40); $this->product_list->addQuickColumn('Product', 'product_name', 'left', 200); $this->product_list->addQuickColumn('Amount', 'product_amount', 'left', 60); $this->product_list->addQuickColumn('Price', 'product_price', 'right', 80); $this->product_list->addQuickColumn('Discount', 'product_discount', 'right', 80); $this->product_list->createModel(); $row = $tableProduct->addRow(); $row->addCell($this->product_list); // create an action button (save) $save_button = new TButton('save'); $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save')); $save_button->setImage('ico_save.png'); // create an new button (edit with no parameters) $new_button = new TButton('new'); $new_button->setAction(new TAction(array($this, 'onClear')), _t('New')); $new_button->setImage('ico_new.png'); // define form fields $this->formFields = array($id, $date, $customer_id, $customer_name, $obs, $product_id, $product_name, $sale_price, $amount, $discount, $total, $add_product, $save_button, $new_button); $this->form->setFields($this->formFields); $table_master->addRowSet(array($save_button, $new_button), '', '')->class = 'tformaction'; // CSS class // create the page container $container = new TVBox(); $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $container->add($this->form); parent::add($container); }
function __autoload($classe) { if (file_exists("../app.widgets/{$classe}.class.php")) { include_once "../app.widgets/{$classe}.class.php"; } } //Cria o Formulario $form = new TForm('formPessoas'); //Cria um Painel $painel = new TPanel('440', '200'); //Adicona o Painel ao Formulario $form->add($painel); //Cria um rotulo de texto para o Titulo $titulo = new TLabel('Exemplo'); $titulo->setFontFace('Arial'); $titulo->setFontColor('#ff0000'); $titulo->setFontSize('18'); //Posiciona o titulo no Painel $painel->put($titulo, '120', '4'); $imagem = new TImage('../app.images/mouse.png'); //Posiciona a imagem no painel $painel->put($imagem, '320', '120'); //Cria uma serie de Campos de entrada de dados $codigo = new TEntry('codigo'); $nome = new TEntry('nome'); $endereco = new TEntry('endereco'); $telefone = new TEntry('telefone'); $cidade = new TCombo('cidade'); $itens = array(); $itens['1'] = 'Porto Alegre'; $itens['2'] = 'Lajeado';
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_RequisitoDesenvolvimento'); $this->form->class = 'tform'; // CSS class $this->form->style = 'width: 500px'; $this->string = new StringsUtil(); // add a table inside form $table = new TTable(); $table->width = '100%'; $this->form->add($table); // add a row for the form title $row = $table->addRow(); $row->class = 'tformtitle'; // CSS class $row->addCell(new TLabel('Cadastro de DTr'))->colspan = 2; // create the form fields $id = new THidden('id'); $titulo = new TEntry('titulo'); $data_cadastro = new TEntry('data_cadastro'); $data_cadastro->setEditable(FALSE); $data_cadastro->setMask('dd/mm/yyyy'); $data_cadastro->setValue(date('d/m/Y')); $rotina = new TEntry('rotina'); $objetivo = new TText('objetivo'); $entrada = new TText('entrada'); $processamento = new TText('processamento'); $saida = new TText('saida'); $ticket_id = new TEntry('ticket_id'); $ticket_id->setEditable(FALSE); $ticket_titulo = new TEntry('ticket_titulo'); $ticket_titulo->setEditable(FALSE); // define the sizes $id->setSize(100); $titulo->setSize(300); $data_cadastro->setSize(100); $rotina->setSize(300); $objetivo->setSize(300, 60); $entrada->setSize(300, 60); $processamento->setSize(300, 60); $saida->setSize(300, 60); $ticket_id->setSize(45); $ticket_titulo->setSize(250); // validations $titulo->addValidation('Título', new TRequiredValidator()); $objetivo->addValidation('Objetivo', new TRequiredValidator()); $ticket_id->addValidation('Ticket', new TRequiredValidator()); // add one row for each form field $table->addRowSet($label_titulo = new TLabel('Título:'), $titulo); $label_titulo->setFontColor('#FF0000'); $table->addRowSet($label_ticket_id = new TLabel('Ticket:'), array($ticket_id, $ticket_titulo)); $label_ticket_id->setFontColor('#FF0000'); $table->addRowSet(new TLabel('Data de Cadastro:'), $data_cadastro); $table->addRowSet(new TLabel('Rotina:'), $rotina); $table->addRowSet($label_objetivo = new TLabel('Objetivo:'), $objetivo); $label_objetivo->setFontColor('#FF0000'); $table->addRowSet(new TLabel('Entrada:'), $entrada); $table->addRowSet(new TLabel('Processamento:'), $processamento); $table->addRowSet(new TLabel('Saida:'), $saida); $table->addRowSet(new TLabel(''), $id); $this->form->setFields(array($id, $titulo, $data_cadastro, $rotina, $objetivo, $entrada, $processamento, $saida, $ticket_id, $ticket_titulo)); // create the form actions $save_button = TButton::create('save', array($this, 'onSave'), _t('Save'), 'fa:floppy-o'); $list_button = TButton::create('list', array('RequisitoDesenvolvimentoList', 'onReload'), _t('List'), 'fa:table blue'); $gerar_dtr = TButton::create('gerar_dtr', array($this, 'onGenerate'), 'Gerar DTr', 'fa:floppy-o'); $gerar_kanban = TButton::create('gerar_kanban', array($this, 'onGenerateKanban'), 'Gerar Kanban', 'fa:floppy-o'); TButton::disableField('form_RequisitoDesenvolvimento', 'save'); TButton::disableField('form_RequisitoDesenvolvimento', 'gerar_dtr'); TButton::disableField('form_RequisitoDesenvolvimento', 'gerar_kanban'); $this->form->addField($save_button); $this->form->addField($list_button); $this->form->addField($gerar_dtr); $this->form->addField($gerar_kanban); $buttons_box = new THBox(); $buttons_box->add($save_button); $buttons_box->add($list_button); $buttons_box->add($gerar_dtr); $buttons_box->add($gerar_kanban); // add a row for the form action $row = $table->addRow(); $row->class = 'tformaction'; // CSS class $row->addCell($buttons_box)->colspan = 2; parent::add($this->form); }