public function __construct() { parent::__construct(); $this->form = new TQuickForm(); $this->form->class = 'tform'; $this->form->setFormTitle(_t('Profile')); $name = new TEntry('name'); $login = new TEntry('login'); $email = new TEntry('email'); $password1 = new TPassword('password1'); $password2 = new TPassword('password2'); $login->setEditable(FALSE); $this->form->addQuickField(_t('Name'), $name, '80%', new TRequiredValidator()); $this->form->addQuickField(_t('Login'), $login, '80%', new TRequiredValidator()); $this->form->addQuickField(_t('Email'), $email, '80%', new TRequiredValidator()); $table = $this->form->getContainer(); $row = $table->addRow(); $row->style = 'background: #FFFBCB;'; $cell = $row->addCell(new TLabel(_t('Change password') . ' (' . _t('Leave empty to keep old password') . ')')); $cell->colspan = 2; $this->form->addQuickField(_t('Password'), $password1, '80%'); $this->form->addQuickField(_t('Password confirmation'), $password2, '80%'); $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'fa:save'); $bc = new TBreadCrumb(); $bc->addHome(); $bc->addItem('Profile'); $container = TVBox::pack($bc, $this->form); $container->style = 'width:80%'; parent::add($container); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); parent::setDatabase("app"); parent::setActiveRecord("TipoMaterialPermanente"); parent::setDefaultOrder("nome", "asc"); // creates the form $this->form = new TQuickForm('form_TipoMaterialPermanente'); $this->form->class = 'tform'; // CSS class $this->form->setFormTitle('Tipo de material permanente'); // define the form title // // create the form fields $id = new TEntry('id'); $id->setEditable(false); $nome = new TEntry('nome'); $nome->addValidation('Tipo do material permanente', new TRequiredValidator()); $custo = new TEntry('custo'); $custo->addValidation('Custo', new TRequiredValidator()); $custo->addValidation('Custo unitário', new TNumericValidator()); // add the fields $this->form->addQuickField('#', $id, 50); $this->form->addQuickField('Tipo de material permanente', $nome, 400); $this->form->addQuickField('Custo unitário', $custo, 100); // create the 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('Relatório', new TAction(array($this, 'onReport')), 'ico_print.png'); // creates a DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $id = $this->datagrid->addQuickColumn('#', 'id', 'left', 50); $nome = $this->datagrid->addQuickColumn('Tipo de material permanente', 'nome', 'left', 600); $custo = $this->datagrid->addQuickColumn('Custo unitário', 'custo', 'right', 100); // create the datagrid actions $edit_action = new TDataGridAction(array($this, 'onEdit')); $delete_action = new TDataGridAction(array($this, 'onDelete')); // add the actions to the datagrid $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'ico_edit.png'); $this->datagrid->addQuickAction(_t('Delete'), $delete_action, 'id', 'ico_delete.png'); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create the page container $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation); parent::add($container); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); parent::setDatabase('esales'); // defines the database parent::setActiveRecord('Marca'); // defines the active record parent::setDefaultOrder('id', 'asc'); // defines the default order parent::addFilterField('id', '='); // add a filter field parent::addFilterField('descricao', 'ilike'); // add a filter field // creates the form, with a table inside $this->form = new TQuickForm('form_search_Marca'); $this->form->class = 'tform'; // CSS class $this->form->setFormTitle('Marca'); // create the form fields $id = new TEntry('id'); $descricao = new TEntry('descricao'); // add the fields $this->form->addQuickField('id', $id, 100); $this->form->addQuickField('Descrição', $descricao, 200); // keep the form filled during navigation with session data $this->form->setData(TSession::getValue('Marca_filter_data')); // add the search form actions $this->form->addQuickAction('Buscar', new TAction(array($this, 'onSearch')), 'ico_find.png'); $this->form->addQuickAction('Novo', new TAction(array('MarcaForm', 'onEdit')), 'ico_new.png'); // creates a DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $id = $this->datagrid->addQuickColumn('id', 'id', 'right', 100); $descricao = $this->datagrid->addQuickColumn('Descrição', 'descricao', 'left', 200); // create the datagrid actions $edit_action = new TDataGridAction(array('MarcaForm', 'onEdit')); $delete_action = new TDataGridAction(array($this, 'onDelete')); // add the actions to the datagrid $this->datagrid->addQuickAction('Editar', $edit_action, 'id', 'ico_edit.png'); $this->datagrid->addQuickAction('Deletar', $delete_action, 'id', 'ico_delete.png'); // create the datagrid model $this->datagrid->createModel(); // create the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create the page container $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation); parent::add($container); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); parent::setDatabase('app'); // defines the database parent::setActiveRecord('Ajuda'); // defines the active record parent::setDefaultOrder('id', 'asc'); // defines the default order // creates the form $this->form = new TQuickForm('form_Ajuda'); $this->form->class = 'tform'; // CSS class $this->form->setFormTitle('Ajuda'); // define the form title // create the form fields $id = new TEntry('id'); $id->setEditable(false); $titulo = new TEntry('titulo'); $texto = new THtmlEditor('texto'); // add the fields $this->form->addQuickField('id', $id, 100); $this->form->addQuickField('titulo', $titulo, 700); $this->form->addQuickField('texto', $texto, 700); $texto->setSize(700, 300); // create the 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'); // creates a DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $id = $this->datagrid->addQuickColumn('#', 'id', 'left', 100); $texto = $this->datagrid->addQuickColumn('Ajuda', 'titulo', 'left', 640); // create the datagrid actions $edit_action = new TDataGridAction(array($this, 'onEdit')); $delete_action = new TDataGridAction(array($this, 'onDelete')); // add the actions to the datagrid $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'ico_edit.png'); $this->datagrid->addQuickAction(_t('Delete'), $delete_action, 'id', 'ico_delete.png'); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create the page container $container = TVBox::pack($this->datagrid, $this->pageNavigation, $this->form); parent::add($container); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); TPage::include_css('app/resources/styles.css'); $html1 = new THtmlRenderer('app/resources/welcome.html'); $html2 = new THtmlRenderer('app/resources/bemvindo.html'); // replace the main section variables $html1->enableSection('main', array()); $html2->enableSection('main', array()); $panel1 = new TPanelGroup('Welcome!'); $panel1->add($html1); $panel2 = new TPanelGroup('Bem-vindo!'); $panel2->add($html2); // add the template to the page parent::add(TVBox::pack($panel1, $panel2)); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TQuickForm('form_StatusTicket'); $this->form->class = 'tform'; // CSS class $this->form->setFormTitle('Tabela Status do Ticket'); // define the form title // create the form fields $id = new THidden('id'); $nome = new TEntry('nome'); // add the fields $this->form->addQuickField('Status', $nome, 200, new TRequiredValidator()); $this->form->addQuickField('', $id, 100); // create the form actions $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'fa:floppy-o'); $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'fa:plus-square green'); // creates a DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $nome = $this->datagrid->addQuickColumn('Status', 'nome', 'left', 200); // create the datagrid actions $edit_action = new TDataGridAction(array($this, 'onEdit')); $delete_action = new TDataGridAction(array($this, 'onDelete')); // add the actions to the datagrid $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'fa:pencil-square-o blue fa-lg'); $this->datagrid->addQuickAction(_t('Delete'), $delete_action, 'id', 'fa:trash-o red fa-lg'); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create the page container $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation); $container->style = 'width:80%;max-width:500px'; $this->datagrid->style = 'width:100%'; parent::add($container); }
public function __construct() { parent::__construct(); $html = new THtmlRenderer('app/resources/profile.html'); $replaces = array(); try { TTransaction::open('permission'); $user = SystemUser::newFromLogin(TSession::getValue('login')); $replaces = $user->toArray(); $replaces['frontpage'] = $user->frontpage_name; $replaces['groupnames'] = $user->getSystemUserGroupNames(); TTransaction::close(); } catch (Exception $e) { new TMessage('error', $e->getMessage()); } $html->enableSection('main', $replaces); $html->enableTranslation(); $bc = new TBreadCrumb(); $bc->addHome(); $bc->addItem('Perfil'); $container = TVBox::pack($bc, $html); $container->style = 'width:60%'; parent::add($container); }
/** * Construtor de classe * Cria o formulário de material consumo */ function __construct() { parent::__construct(); parent::setDatabase("app"); parent::setActiveRecord("MaterialConsumoDerivado"); parent::setDefaultOrder("id", "asc"); // Cria o formulário $this->form = new TQuickForm('form_MaterialConsumo'); $this->form->class = 'tform'; // CSS class $this->form->setFormTitle('Material de consumo (novos ou necessidade extraordinária) a ser incluído na Proposta Orçamentária de 2017'); // define the form title // Cria os campos de formulário $id = new THidden('id'); $tipo_material_consumo_id = new TDBCombo('tipo_material_consumo_id', 'app', 'TipoMaterialConsumo', 'id', 'nome', 'nome'); $tipo_material_consumo_id->addValidation('Tipo do material', new TRequiredValidator()); $change_action = new TAction(array($this, 'onChangeAction')); $tipo_material_consumo_id->setChangeAction($change_action); $descricao = new TEntry('descricao'); $justificativa = new TText('justificativa'); $justificativa->addValidation('Justificativa', new TRequiredValidator()); $quantidade = new TEntry('quantidade'); $quantidade->addValidation('Quantidade', new TRequiredValidator()); $quantidade->addValidation('Quantidade', new TNumericValidator()); $custo = new TEntry('custo'); $custo->addValidation('Custo', new TRequiredValidator()); $custo->addValidation('Custo', new TNumericValidator()); $total = new TEntry('total'); $total->setEditable(false); // Adiciona os campos $this->form->addQuickField('', $id); //$this->form->add($id); $this->form->addQuickField('Tipo de material consumo', $tipo_material_consumo_id, 480); $this->form->addQuickField('Descrição', $descricao, 480); $this->form->addQuickField('Justificativa', $justificativa, 200); $justificativa->setSize(480, 100); $this->form->addQuickField('Quantidade', $quantidade, 200); $this->form->addQuickField('Previsão de custo unitário', $custo, 200); $this->form->addQuickField('Total', $total, 200); // Cria as ações do formulário $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'); $actionHelp = new TAction(array("PaginaAjuda", 'onHelp')); $actionHelp->setParameters(array("key" => 3)); $this->form->addQuickAction(_t('Help'), $actionHelp, 'ico_help.png'); // Cria o datagrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // Cria as colunas do datagrid $this->datagrid->addQuickColumn('Tipo de material consumo', 'tipoMaterialConsumo->nome', 'left', 200); $this->datagrid->addQuickColumn('Descrição', 'descricao', 'left', 200); $this->datagrid->addQuickColumn('Quant.', 'quantidade', 'right', 100); $this->datagrid->addQuickColumn('Previsão de custo', 'custo', 'right', 100); $this->datagrid->addQuickColumn('Total', 'total', 'right', 100); // Cria as ações do datagrid $edit_action = new TDataGridAction(array($this, 'onEdit')); $delete_action = new TDataGridAction(array($this, 'onDelete')); // Adiciona as ações do datagrid $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'ico_edit.png'); $this->datagrid->addQuickAction(_t('Delete'), $delete_action, 'id', 'ico_delete.png'); // Cria o modelo do datagrid $this->datagrid->createModel(); // Cria a navegação de página $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // Cria o container da página $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation); parent::add($container); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TQuickForm('form_Ponto'); $this->form->class = 'tform'; // CSS class $this->form->setFormTitle('Ponto'); // define the form title $this->string = new StringsUtil(); // create the form fields $id = new THidden('id'); $data_ponto = new TDate('data_ponto'); $data_ponto->setMask('dd/mm/yyyy'); $change_data_action = new TAction(array($this, 'onChangeDataAction')); $data_ponto->setExitAction($change_data_action); $hora_entrada = new THidden('hora_entrada'); $hora_saida = new THidden('hora_saida'); $qtde_horas = new TCombo('qtde_horas'); $qtde_minutos = new TCombo('qtde_minutos'); $qtde_horas_final = new TCombo('qtde_horas_final'); $qtde_minutos_final = new TCombo('qtde_minutos_final'); $colaborador_id = new THidden('colaborador_id'); TTransaction::open('atividade'); $logado = Pessoa::retornaUsuario(); $saldo_mes = Ponto::saldoHorasMes($logado->pessoa_codigo); TTransaction::close(); $colaborador_id->setValue($logado->pessoa_codigo); $colaborador_nome = new TEntry('colaborador_nome'); $colaborador_nome->setEditable(FALSE); $colaborador_nome->setValue($logado->pessoa_nome); $saldo_horas = new TEntry('saldo_horas'); $saldo_horas->setEditable(FALSE); $saldo_horas->setValue($saldo_mes); // cria combos de horas e minutos $combo_horas = array(); $combo_horas_final = array(); for ($i = 8; $i <= 18; $i++) { $combo_horas[$i] = str_pad($i, 2, 0, STR_PAD_LEFT); $combo_horas_final[$i] = str_pad($i, 2, 0, STR_PAD_LEFT); } $combo_horas_final[19] = '19'; $qtde_horas->addItems($combo_horas); $qtde_horas->setValue(8); $qtde_horas->setSize(60); $qtde_horas->setDefaultOption(FALSE); $qtde_horas_final->addItems($combo_horas_final); $qtde_horas_final->setSize(60); $combo_minutos = array(); $combo_minutos_final = array(); for ($i = 0; $i <= 59; $i++) { $combo_minutos[$i] = str_pad($i, 2, 0, STR_PAD_LEFT); $combo_minutos_final[$i] = str_pad($i, 2, 0, STR_PAD_LEFT); } $qtde_minutos->addItems($combo_minutos); $qtde_minutos->setValue(0); $qtde_minutos->setSize(60); $qtde_minutos->setDefaultOption(FALSE); $qtde_minutos_final->addItems($combo_minutos_final); $qtde_minutos_final->setSize(60); // validations $data_ponto->addValidation('Data', new TRequiredValidator()); // add the fields $this->form->addQuickField('Colaborador', $colaborador_nome, 200); $this->form->addQuickField('Data', $data_ponto, 100); $this->form->addQuickFields('Hora entrada', array($qtde_horas, $qtde_minutos)); $this->form->addQuickFields('Hora saida', array($qtde_horas_final, $qtde_minutos_final)); $this->form->addQuickField('Saldo no mês:', $saldo_horas, 125); $this->form->addQuickField('% Produtividade', new TLabel('<span style="background-color: #00B4FF;"><b>> 49% satisfatoria </b></span><br/><span style="background-color: #FFF800;"><b>30%-49% - Atenção</b></span><br/><span style="background-color: #FF0000;"><b>0-29% Baixa </b></span>'), 200); $this->form->addQuickField('', $hora_entrada, 200); $this->form->addQuickField('', $hora_saida, 200); $this->form->addQuickField('', $colaborador_id, 100); $this->form->addQuickField('', $id, 100); // create the form actions $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'fa:floppy-o'); $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'fa:plus-square green'); $this->form->addQuickAction('Excluir', new TAction(array($this, 'onDelete')), 'fa:trash-o red fa-lg'); TButton::disableField('form_Ponto', 'salvar'); TButton::disableField('form_Ponto', 'excluir'); // creates a DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $data_ponto = $this->datagrid->addQuickColumn('Data', 'data_ponto', 'left', 50); $hora_entrada = $this->datagrid->addQuickColumn('H.Ent', 'hora_entrada', 'left', 30); $hora_saida = $this->datagrid->addQuickColumn('H.Sai', 'hora_saida', 'left', 30); $hora_ponto = $this->datagrid->addQuickColumn('H.Pto', 'hora_ponto', 'left', 30); $intervalo = $this->datagrid->addQuickColumn('Atividades', 'intervalo', 'right', 30); $produtividade = $this->datagrid->addQuickColumn('% prod.', 'produtividade', 'right', 55); // transformers $hora_entrada->setTransformer(array($this, 'tiraSegundos')); $hora_saida->setTransformer(array($this, 'tiraSegundos')); $hora_ponto->setTransformer(array($this, 'calculaDiferenca')); $intervalo->setTransformer(array($this, 'retornaIntervalo')); $produtividade->setTransformer(array($this, 'calculaPercentualProdutividade')); // create the datagrid actions $edit_action = new TDataGridAction(array($this, 'onEdit')); $delete_action = new TDataGridAction(array($this, 'onDelete')); // add the actions to the datagrid $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'fa:pencil-square-o blue fa-lg'); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create the page container $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation); parent::add($container); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_search_RequisitoDesenvolvimento'); $this->form->class = 'tform'; // CSS class // creates a table $table = new TTable(); $table->width = '100%'; $this->form->add($table); // add a row for the form title $row = $table->addRow(); $row->class = 'tformtitle'; // CSS class $row->addCell(new TLabel('Cadastro de DRs'))->colspan = 2; // create the form fields $id = new TEntry('ticket_id'); $id->setMask('99999'); $titulo = new TEntry('titulo'); $data_cadastro = new TDate('data_cadastro'); $data_cadastro->setMask('dd/mm/yyyy'); // define the sizes $id->setSize(50); $titulo->setSize(200); $data_cadastro->setSize(100); // add one row for each form field $table->addRowSet(new TLabel('Ticket:'), $id); $table->addRowSet(new TLabel('Título:'), $titulo); $table->addRowSet(new TLabel('Data:'), $data_cadastro); $this->form->setFields(array($id, $titulo, $data_cadastro)); // keep the form filled during navigation with session data $this->form->setData(TSession::getValue('RequisitoDesenvolvimento_filter_data')); // create two action buttons to the form $find_button = TButton::create('find', array($this, 'onSearch'), _t('Find'), 'ico_find.png'); $clean_button = TButton::create('clean', array($this, 'onClean'), 'Limpar', 'ico_close.png'); $this->form->addField($find_button); $this->form->addField($clean_button); $buttons_box = new THBox(); $buttons_box->add($find_button); $buttons_box->add($clean_button); // add a row for the form action $row = $table->addRow(); $row->class = 'tformaction'; // CSS class $row->addCell($buttons_box)->colspan = 2; // creates a Datagrid $this->datagrid = new TDataGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $id = new TDataGridColumn('ticket_id', 'ID', 'right', 20); $data_cadastro = new TDataGridColumn('data_cadastro', 'Data', 'left', 80); $titulo = new TDataGridColumn('titulo', 'Título', 'left', 300); $ticket_id = new TDataGridColumn('ticket->titulo', 'Ticket', 'right', 300); $data_cadastro->setTransformer(array('StringsUtil', 'formatDateBR')); // add the columns to the DataGrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($data_cadastro); $this->datagrid->addColumn($titulo); $this->datagrid->addColumn($ticket_id); // creates the datagrid column actions $order_id = new TAction(array($this, 'onReload')); $order_id->setParameter('order', 'id'); $id->setAction($order_id); $order_titulo = new TAction(array($this, 'onReload')); $order_titulo->setParameter('order', 'titulo'); $titulo->setAction($order_titulo); $order_data_cadastro = new TAction(array($this, 'onReload')); $order_data_cadastro->setParameter('order', 'data_cadastro'); $data_cadastro->setAction($order_data_cadastro); $order_ticket_id = new TAction(array($this, 'onReload')); $order_ticket_id->setParameter('order', 'ticket->titulo'); $ticket_id->setAction($order_ticket_id); // creates two datagrid actions $action1 = new TDataGridAction(array('RequisitoDesenvolvimentoForm', 'onEdit')); $action1->setLabel(_t('Edit')); $action1->setImage('fa:pencil-square-o blue fa-lg'); $action1->setField('id'); $action2 = new TDataGridAction(array($this, 'onDelete')); $action2->setLabel(_t('Delete')); $action2->setImage('fa:trash-o red fa-lg'); $action2->setField('id'); // add the actions to the datagrid $this->datagrid->addAction($action1); $this->datagrid->addAction($action2); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create the page container $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation); $container->style = 'width: 100%;max-width: 1200px;'; $this->datagrid->style = ' width: 100%; max-width: 1200px;'; parent::add($container); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); parent::setDatabase('esales'); // defines the database parent::setActiveRecord('Pessoa'); // defines the active record parent::setDefaultOrder('id', 'asc'); // defines the default order parent::addFilterField('id', 'like'); // add a filter field parent::addFilterField('nome', 'like'); // add a filter field parent::addFilterField('telefone', 'like'); // add a filter field parent::addFilterField('email', 'like'); // add a filter field parent::addFilterField('endereco', 'like'); // add a filter field parent::addFilterField('numero', 'like'); // add a filter field parent::addFilterField('cidade_id', 'like'); // add a filter field parent::addFilterField('cep', 'like'); // add a filter field parent::addFilterField('cpf_cnpj', 'like'); // add a filter field parent::addFilterField('tipo_pessoa', 'like'); // add a filter field // creates the form, with a table inside $this->form = new TQuickForm('form_search_Pessoa'); $this->form->class = 'tform'; // CSS class $this->form->setFormTitle('Pessoa'); // create the form fields $id = new TEntry('id'); $nome = new TEntry('nome'); $telefone = new TEntry('telefone'); $email = new TEntry('email'); $endereco = new TEntry('endereco'); $numero = new TEntry('numero'); $cidade_id = new TEntry('cidade_id'); $cep = new TEntry('cep'); $cpf_cnpj = new TEntry('cpf_cnpj'); $tipo_pessoa = new TEntry('tipo_pessoa'); // add the fields $this->form->addQuickField('id', $id, 100); $this->form->addQuickField('nome', $nome, 200); $this->form->addQuickField('telefone', $telefone, 200); $this->form->addQuickField('email', $email, 200); $this->form->addQuickField('endereco', $endereco, 200); $this->form->addQuickField('numero', $numero, 200); $this->form->addQuickField('cidade_id', $cidade_id, 100); $this->form->addQuickField('cep', $cep, 200); $this->form->addQuickField('cpf_cnpj', $cpf_cnpj, 100); $this->form->addQuickField('tipo_pessoa', $tipo_pessoa, 200); // keep the form filled during navigation with session data $this->form->setData(TSession::getValue('Pessoa_filter_data')); // add the search form actions $this->form->addQuickAction('Buscar', new TAction(array($this, 'onSearch')), 'ico_find.png'); $this->form->addQuickAction('Novo', new TAction(array('PessoaForm', 'onEdit')), 'ico_new.png'); // creates a DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $id = $this->datagrid->addQuickColumn('id', 'id', 'right', 100); $nome = $this->datagrid->addQuickColumn('Nome', 'nome', 'left', 200); $telefone = $this->datagrid->addQuickColumn('Telefone', 'telefone', 'left', 200); $email = $this->datagrid->addQuickColumn('Email', 'email', 'left', 200); $endereco = $this->datagrid->addQuickColumn('Endereço', 'endereco', 'left', 200); $numero = $this->datagrid->addQuickColumn('Número', 'numero', 'left', 200); $cidade_id = $this->datagrid->addQuickColumn('Cidade', 'cidade_id', 'right', 100); $cep = $this->datagrid->addQuickColumn('CEP', 'cep', 'left', 200); $cpf_cnpj = $this->datagrid->addQuickColumn('Cpf/Cnpj', 'cpf_cnpj', 'right', 100); $tipo_pessoa = $this->datagrid->addQuickColumn('Tipo Pessoa', 'tipo_pessoa', 'left', 200); // create the datagrid actions $edit_action = new TDataGridAction(array('PessoaForm', 'onEdit')); $delete_action = new TDataGridAction(array($this, 'onDelete')); // add the actions to the datagrid $this->datagrid->addQuickAction('Editar', $edit_action, 'id', 'ico_edit.png'); $this->datagrid->addQuickAction('Deletar', $delete_action, 'id', 'ico_delete.png'); // create the datagrid model $this->datagrid->createModel(); // create the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create the page container $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation); parent::add($container); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_search_Ticket'); $this->form->class = 'tform'; // CSS class // creates a table $table = new TTable(); $table->width = '100%'; $this->form->add($table); // add a row for the form title $row = $table->addRow(); $row->class = 'tformtitle'; // CSS class $row->addCell(new TLabel('Ticket'))->colspan = 2; // create the form fields $id = new TEntry('id'); $id->setMask('99999'); $titulo = new TEntry('titulo'); $criteria = new TCriteria(); $criteria->add(new TFilter("ativo", "=", 1)); $newparam['order'] = 'pessoa_nome'; $newparam['direction'] = 'asc'; $criteria->setProperties($newparam); // order, offset $solicitante_id = new TDBSeekButton('solicitante_id', 'atividade', 'form_search_Ticket', 'Pessoa', 'pessoa_nome', 'solicitante_id', 'solicitante_nome', $criteria); $solicitante_nome = new TEntry('solicitante_nome'); $solicitante_nome->setEditable(FALSE); $criteria = new TCriteria(); $criteria->add(new TFilter('enttipent', '=', 1)); $entcodent = new TDBComboMultiValue('entcodent', 'atividade', 'Entidade', 'entcodent', array(0 => 'entcodent', 1 => 'entrazsoc'), 'entcodent', $criteria); $tipo_ticket_id = new TDBCombo('tipo_ticket_id', 'atividade', 'TipoTicket', 'id', 'nome'); $status_ticket_id = new TDBCombo('status_ticket_id', 'atividade', 'StatusTicket', 'id', 'nome'); $criteria = new TCriteria(); $criteria->add(new TFilter("origem", "=", 1)); $criteria->add(new TFilter("ativo", "=", 1)); $criteria->add(new TFilter("codigo_cadastro_origem", "=", 100)); $responsavel_id = new TDBCombo('responsavel_id', 'atividade', 'Pessoa', 'pessoa_codigo', 'pessoa_nome', 'pessoa_nome', $criteria); $prioridade_id = new TDBCombo('prioridade_id', 'atividade', 'Prioridade', 'id', 'nome'); $sistema_id = new TDBCombo('sistema_id', 'atividade', 'Sistema', 'id', 'nome', 'nome'); // define the sizes $id->setSize(50); $titulo->setSize(274); $solicitante_id->setSize(50); $solicitante_nome->setSize(200); $entcodent->setSize(274); $status_ticket_id->setSize(100); $tipo_ticket_id->setSize(200); $sistema_id->setSize(200); $responsavel_id->setSize(274); $prioridade_id->setSize(100); // add one row for each form field $table->addRowSet(new TLabel('ID:'), $id); $table->addRowSet(new TLabel('Titulo:'), $titulo); $table->addRowSet(new TLabel('Cliente:'), array($solicitante_id, $solicitante_nome)); $table->addRowSet(new TLabel('Entidade:'), $entcodent); $table->addRowSet(new TLabel('Responsável:'), $responsavel_id); $table->addRowSet(new TLabel('Tipo Ticket:'), $tipo_ticket_id); $table->addRowSet(new TLabel('Sistema:'), $sistema_id); $table->addRowSet(new TLabel('Status:'), $status_ticket_id); $table->addRowSet(new TLabel('Prioridade:'), $prioridade_id); $this->form->setFields(array($id, $titulo, $solicitante_id, $solicitante_nome, $entcodent, $status_ticket_id, $tipo_ticket_id, $responsavel_id, $prioridade_id, $sistema_id)); // keep the form filled during navigation with session data $this->form->setData(TSession::getValue('Ticket_filter_data')); // create two action buttons to the form $find_button = TButton::create('find', array($this, 'onSearch'), _t('Find'), 'ico_find.png'); $new_button = TButton::create('new', array('TicketForm', 'onEdit'), _t('New'), 'fa:plus-square green'); $clean_button = TButton::create('clean', array($this, 'onClean'), 'Limpar', 'ico_close.png'); $this->form->addField($find_button); $this->form->addField($new_button); $this->form->addField($clean_button); $buttons_box = new THBox(); $buttons_box->add($find_button); $buttons_box->add($new_button); $buttons_box->add($clean_button); // add a row for the form action $row = $table->addRow(); $row->class = 'tformaction'; // CSS class $row->addCell($buttons_box)->colspan = 2; // creates a Datagrid $this->datagrid = new TDataGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $status_ticket_id = new TDataGridColumn('status_ticket_id', 'S', 'center', 20); $id = new TDataGridColumn('id', 'ID', 'left', 20); $titulo = new TDataGridColumn('titulo', 'Titulo', 'left', 250); $solicitante_id = new TDataGridColumn('solicitante_id', 'Cliente', 'left', 250); $responsavel_id = new TDataGridColumn('pessoa_responsavel->pessoa_nome', 'Responsavel', 'left', 100); $prioridade_id = new TDataGridColumn('prioridade->nome', 'Pri', 'right', 20); //get_prioridade()->nome $status_ticket_id->setTransformer(array($this, 'retornaStatus')); $solicitante_id->setTransformer(array($this, 'retornaCliente')); $responsavel_id->setTransformer(array($this, 'retornaPessoa')); $prioridade_id->setTransformer(array($this, 'retornaPrioridade')); // add the columns to the DataGrid $this->datagrid->addColumn($status_ticket_id); $this->datagrid->addColumn($id); $this->datagrid->addColumn($titulo); $this->datagrid->addColumn($solicitante_id); $this->datagrid->addColumn($responsavel_id); $this->datagrid->addColumn($prioridade_id); // creates the datagrid column actions $order_id = new TAction(array($this, 'onReload')); $order_id->setParameter('order', 'id'); $id->setAction($order_id); $order_titulo = new TAction(array($this, 'onReload')); $order_titulo->setParameter('order', 'titulo'); $titulo->setAction($order_titulo); $order_status_ticket_id = new TAction(array($this, 'onReload')); $order_status_ticket_id->setParameter('order', 'status_ticket_id'); $status_ticket_id->setAction($order_status_ticket_id); $order_prioridade_id = new TAction(array($this, 'onReload')); $order_prioridade_id->setParameter('order', 'prioridade->nome'); $prioridade_id->setAction($order_prioridade_id); // creates two datagrid actions $action1 = new TDataGridAction(array('TicketForm', 'onEdit')); $action1->setLabel(_t('Edit')); $action1->setImage('fa:pencil-square-o blue fa-lg'); $action1->setField('id'); // add the actions to the datagrid $this->datagrid->addAction($action1); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create the page container $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation); $container->style = 'width: 100%;max-width: 1200px;'; $this->datagrid->style = ' width: 100%; max-width: 1200px;'; parent::add($container); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TQuickForm('form_CargaHoraria'); $this->form->class = 'tform'; // CSS class $this->form->setFormTitle('Carga Horaria'); // define the form title $this->string = new StringsUtil(); // create the form fields $mes = new TCombo('mes'); $mes->addItems($this->string->array_meses()); $mes->setDefaultOption(FALSE); $mes->setValue(date('m')); $mes->setSize(100); $ano = new TCombo('ano'); $anos = array(2015 => '2015'); $ano->addItems($anos); $ano->setDefaultOption(FALSE); $ano->setSize(70); $qtde_horas = new TCombo('qtde_horas'); $qtde_minutos = new TCombo('qtde_minutos'); // cria combos de horas e minutos $combo_horas = array(); for ($i = 0; $i <= 300; $i++) { $combo_horas[$i] = str_pad($i, 2, 0, STR_PAD_LEFT); } $qtde_horas->addItems($combo_horas); $qtde_horas->setValue(180); $qtde_horas->setSize(60); $qtde_horas->setDefaultOption(FALSE); $combo_minutos = array(); for ($i = 0; $i <= 59; $i++) { $combo_minutos[$i] = str_pad($i, 2, 0, STR_PAD_LEFT); } $qtde_minutos->addItems($combo_minutos); $qtde_minutos->setValue(0); $qtde_minutos->setSize(60); $qtde_minutos->setDefaultOption(FALSE); // add the fields $this->form->addQuickFields('Mês/Ano', array($mes, $ano)); $this->form->addQuickFields('Carga horaria', array($qtde_horas, $qtde_minutos)); // create the form actions $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'fa:floppy-o'); $this->form->addQuickAction(_t('Find'), new TAction(array($this, 'onReload')), 'ico_find.png'); // creates a DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $horario = $this->datagrid->addQuickColumn('horario', 'horario', 'left', 50); $colaborador_id = $this->datagrid->addQuickColumn('colaborador', 'pessoa->pessoa_nome', 'left', 100); $mes = $this->datagrid->addQuickColumn('mes', 'mes', 'left', 100); $ano = $this->datagrid->addQuickColumn('ano', 'ano', 'left', 50); $mes->setTransformer(array('StringsUtil', 'retorna_mes')); $horario->setTransformer(array('StringsUtil', 'retira_segundos')); $colaborador_id->setTransformer(array($this, 'retornaPessoa')); // creates the edit action $editaction = new TDataGridAction(array($this, 'onEdit')); $editaction->setField('id'); $horario->setEditAction($editaction); // create the datagrid actions $delete_action = new TDataGridAction(array($this, 'onDelete')); // add the actions to the datagrid $this->datagrid->addQuickAction(_t('Delete'), $delete_action, 'id', 'fa:trash-o red fa-lg'); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create the page container $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation); parent::add($container); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); $this->string = new StringsUtil(); // creates the form $this->form = new TForm('form_search_Atividade'); $this->form->class = 'tform'; // CSS class // creates a table $table = new TTable(); $table->width = '100%'; $this->form->add($table); // add a row for the form title $row = $table->addRow(); $row->class = 'tformtitle'; // CSS class $row->addCell(new TLabel('Atividade'))->colspan = 2; // create the form fields $id = new THidden('id'); $data_atividade_inicial = new TDate('data_atividade_inicial'); $data_atividade_inicial->setMask('dd/mm/yyyy'); $data_atividade_final = new TDate('data_atividade_final'); $data_atividade_final->setMask('dd/mm/yyyy'); $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); $tipo_atividade_id = new TDBCombo('tipo_atividade_id', 'atividade', 'TipoAtividade', 'id', 'nome', 'nome'); $ticket_id = new TDBMultiSearch('ticket_id', 'atividade', 'Ticket', 'id', 'titulo', 'titulo'); $pesquisa_master = new TEntry('pesquisa_master'); $criteria = new TCriteria(); $criteria->add(new TFilter("ativo", "=", 1)); $newparam['order'] = 'pessoa_nome'; $newparam['direction'] = 'asc'; $criteria->setProperties($newparam); // order, offset $solicitante_id = new TDBSeekButton('solicitante_id', 'atividade', 'form_search_Ticket', 'Pessoa', 'pessoa_nome', 'solicitante_id', 'solicitante_nome', $criteria); $solicitante_nome = new TEntry('solicitante_nome'); $solicitante_nome->setEditable(FALSE); $total_atividades = new TEntry('total_atividades'); $total_atividades->setEditable(FALSE); // define the sizes $id->setSize(50); $data_atividade_inicial->setSize(100); $data_atividade_final->setSize(100); $colaborador_id->setSize(300); $tipo_atividade_id->setSize(300); $ticket_id->setMinLength(0); $ticket_id->setMaxSize(1); $ticket_id->setSize(300); $ticket_id->setOperator('ilike'); $solicitante_id->setSize(40); $solicitante_nome->setSize(235); $total_atividades->setSize(100); $pesquisa_master->setSize(300); // add one row for each form field $table->addRowSet(new TLabel('Solicitante:'), array($solicitante_id, $solicitante_nome)); $table->addRowSet(new TLabel('Colaborador:'), $colaborador_id); $table->addRowSet(new TLabel('Dt. Atividades inicio:'), array($data_atividade_inicial, $label_data_fim = new TLabel('Fim:'), $data_atividade_final)); $label_data_fim->setSize(48); $table->addRowSet(new TLabel('Atividade:'), $tipo_atividade_id); $table->addRowSet(new TLabel('Ticket:'), $ticket_id); $table->addRowSet(new TLabel('Pesquisa por palavra:'), $pesquisa_master); $table->addRowSet(new TLabel('Total horas atividades:'), $total_atividades); $table->addRowSet(new TLabel(''), $id); $this->form->setFields(array($id, $data_atividade_inicial, $data_atividade_final, $colaborador_id, $tipo_atividade_id, $ticket_id, $solicitante_id, $solicitante_nome, $pesquisa_master, $total_atividades)); $change_data = new TAction(array($this, 'onChangeData')); $data_atividade_inicial->setExitAction($change_data); $data_atividade_final->setExitAction($change_data); // keep the form filled during navigation with session data $this->form->setData(TSession::getValue('Atividade_filter_data')); // create two action buttons to the form $find_button = TButton::create('find', array($this, 'onSearch'), _t('Find'), 'ico_find.png'); $new_button = TButton::create('new', array('AtividadeForm', 'onEdit'), _t('New'), 'fa:plus-square green'); $clean_button = TButton::create('clean', array($this, 'onClean'), 'Limpar', 'ico_close.png'); $this->form->addField($find_button); $this->form->addField($new_button); $this->form->addField($clean_button); $buttons_box = new THBox(); $buttons_box->add($find_button); $buttons_box->add($new_button); $buttons_box->add($clean_button); // add a row for the form action $row = $table->addRow(); $row->class = 'tformaction'; // CSS class $row->addCell($buttons_box)->colspan = 2; // creates a Datagrid $this->datagrid = new TDataGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $data_atividade = new TDataGridColumn('data_atividade', 'Data', 'right', 40); $hora_inicio = new TDataGridColumn('hora_inicio', 'Inicio', 'right', 20); $hora_fim = new TDataGridColumn('hora_fim', 'Fim', 'right', 20); $hora_qte = new TDataGridColumn('hora_qte', 'Qtde', 'right', 20); $colaborador_id = new TDataGridColumn('pessoa->pessoa_nome', 'Colaborador', 'left', 50); $tipo_atividade_id = new TDataGridColumn('tipo_atividade->nome', 'Atividade', 'left', 100); //get_tipo_atividade()->nome $sistema_id = new TDataGridColumn('sistema->nome', 'Sistema', 'left', 100); $ticket_id = new TDataGridColumn('ticket->titulo', 'Ticket', 'left', 200); // get_ticket()->titulo // transformers $colaborador_id->setTransformer(array($this, 'retornaPessoa')); $hora_qte->setTransformer(array($this, 'calculaDiferenca')); $data_atividade->setTransformer(array('StringsUtil', 'formatDateBR')); $hora_inicio->setTransformer(array('StringsUtil', 'retira_segundos')); $hora_fim->setTransformer(array('StringsUtil', 'retira_segundos')); // add the columns to the DataGrid $this->datagrid->addColumn($data_atividade); $this->datagrid->addColumn($hora_inicio); $this->datagrid->addColumn($hora_fim); $this->datagrid->addColumn($hora_qte); $this->datagrid->addColumn($colaborador_id); $this->datagrid->addColumn($tipo_atividade_id); $this->datagrid->addColumn($sistema_id); $this->datagrid->addColumn($ticket_id); // creates the datagrid column actions $order_data_atividade = new TAction(array($this, 'onReload')); $order_data_atividade->setParameter('order', 'data_atividade'); $data_atividade->setAction($order_data_atividade); $order_colaborador_id = new TAction(array($this, 'onReload')); $order_colaborador_id->setParameter('order', 'pessoa->pessoa_nome'); $colaborador_id->setAction($order_colaborador_id); $order_tipo_atividade_id = new TAction(array($this, 'onReload')); $order_tipo_atividade_id->setParameter('order', 'tipo_atividade->nome'); $tipo_atividade_id->setAction($order_tipo_atividade_id); $order_sistema_id = new TAction(array($this, 'onReload')); $order_sistema_id->setParameter('order', 'sistema->nome'); $sistema_id->setAction($order_sistema_id); $order_ticket_id = new TAction(array($this, 'onReload')); $order_ticket_id->setParameter('order', 'ticket->titulo'); $ticket_id->setAction($order_ticket_id); // creates two datagrid actions $action1 = new TDataGridAction(array('AtividadeForm', 'onEdit')); $action1->setLabel(_t('Edit')); $action1->setImage('fa:pencil-square-o blue fa-lg'); $action1->setField('id'); // add the actions to the datagrid $this->datagrid->addAction($action1); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create the page container $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation); $container->style = 'width: 100%;max-width: 1200px;'; $this->datagrid->style = ' width: 100%; max-width: 1200px;'; parent::add($container); }