Ejemplo n.º 1
0
 /**
  * 
  */
 public function makeTDate($properties)
 {
     $widget = new TDate((string) $properties->{'name'});
     $widget->setValue((string) $properties->{'value'});
     $widget->setSize((int) $properties->{'width'});
     $widget->setEditable((string) $properties->{'editable'});
     if ((string) $properties->{'mask'}) {
         $widget->setMask((string) $properties->{'mask'});
     }
     if (isset($properties->{'tip'})) {
         $widget->setTip((string) $properties->{'tip'});
     }
     if (isset($properties->{'required'}) and $properties->{'required'} == '1') {
         $widget->addValidation((string) $properties->{'name'}, new TRequiredValidator());
     }
     $this->fields[] = $widget;
     $this->fieldsByName[(string) $properties->{'name'}] = $widget;
     return $widget;
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_FreqServList');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->style = 'width:100%';
     $table->addRowSet(new TLabel('Frequência'), '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     //$id = new TEntry('ID');
     //$id->setValue(TSession::getValue('Frequencia_id'));
     $servidor_id = new TDBSeekButton('servidor_id', 'lacenrh', 'form_FreqServList', 'Servidor', 'servidor', 'servidor_id', 'servidor_nome');
     $servidor_id->setValue(TSession::getValue('Frequencia_servidor_id'));
     $servidor_nome = new TEntry('servidor_nome');
     $servidor_nome->setValue(TSession::getValue('Frequencia_servidor_nome'));
     $diames = new TDate('Data');
     $diames->setValue(TSession::getValue('Frequencia_diames'));
     //$id->setSize(40);
     $servidor_id->setSize(40);
     $servidor_nome->setSize(300);
     $diames->setSize(100);
     $diames->setMask('dd/mm/yyyy');
     // add rows for the filter fields
     //$row=$table->addRowSet(new TLabel(('ID') . ': '), $id);
     $row = $table->addRowSet(new TLabel('Servidor' . ': '), $servidor_id);
     $row = $table->addRowSet(new TLabel('Nome' . ': '), $servidor_nome);
     $row = $table->addRowSet(new TLabel('Data' . ': '), $diames);
     //$row=$table->addRowSet(new TLabel(('Unidade') . ': '), $unidade);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $clear_button = new Tbutton('clear');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('fa:search fa-lg');
     $clear_button->setAction(new TAction(array($this, 'onClear')), 'Limpar');
     $clear_button->setImage('fa:undo red fa-lg');
     $new_button->setAction(new TAction(array('FrequenciaServidorForm', 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green fa-lg');
     // define wich are the form fields
     $this->form->setFields(array($servidor_id, $servidor_nome, $diames, $find_button, $clear_button, $new_button));
     $container = new THBox();
     $container->add($find_button);
     $container->add($clear_button);
     $container->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($container);
     $cell->colspan = 2;
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $servidor_nome = new TDataGridColumn('servidor_nome', 'Nome', 'left', 200);
     $diames = new TDataGridColumn('diames', 'Data', 'center', 50);
     $entrada = new TDataGridColumn('entrada', 'Entrada', 'center', 40);
     $intervalo_inicio = new TDataGridColumn('intervalo_inicio', 'Saída', 'center', 50);
     $intervalo_fim = new TDataGridColumn('intervalo_fim', 'Entrada', 'center', 50);
     $saida = new TDataGridColumn('saida', 'Saída', 'center', 50);
     $ausencia_desc = new TDataGridColumn('ausencia_desc', 'Ausência', 'left');
     // add the columns to the DataGrid
     $this->datagrid->addColumn($servidor_nome);
     $this->datagrid->addColumn($diames);
     $this->datagrid->addColumn($entrada);
     $this->datagrid->addColumn($intervalo_inicio);
     $this->datagrid->addColumn($intervalo_fim);
     $this->datagrid->addColumn($saida);
     $this->datagrid->addColumn($ausencia_desc);
     $order_servidor_nome = new TAction(array($this, 'onReload'));
     $order_servidor_nome->setParameter('order', 'servidor_nome');
     $servidor_nome->setAction($order_servidor_nome);
     $order_diames = new TAction(array($this, 'onReload'));
     $order_diames->setParameter('order', 'diames');
     $diames->setAction($order_diames);
     // inline editing
     $servidor_entrada_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $servidor_entrada_edit->setField('id');
     $entrada->setEditAction($servidor_entrada_edit);
     $servidor_intervalo_inicio_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $servidor_intervalo_inicio_edit->setField('id');
     $intervalo_inicio->setEditAction($servidor_intervalo_inicio_edit);
     $servidor_intervalo_fim_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $servidor_intervalo_fim_edit->setField('id');
     $intervalo_fim->setEditAction($servidor_intervalo_fim_edit);
     $servidor_saida_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $servidor_saida_edit->setField('id');
     $saida->setEditAction($servidor_saida_edit);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('FrequenciaServidorForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('fa:pencil-square-o blue');
     $action1->setField('id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('fa:trash-o red');
     $action2->setField('id');
     $action3 = new TDataGridAction(array('FrequenciaServidorForm', 'onFrequencia'));
     $action3->setLabel('Informação');
     $action3->setImage('fa:info-circle blue');
     $action3->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action3);
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a table
     $table = new TTable();
     $table->style = 'width: 80%';
     $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'FrequenciaServidorList'));
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
Ejemplo n.º 3
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_search_System_Sales');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->style = 'width:100%';
     $row1 = $table->addRow();
     $row1->class = 'tformtitle';
     $cell1 = $row1->addCell(new TLabel('Sales'), '');
     $cell1->colspan = 2;
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $id = new TEntry('id');
     $id->setValue(TSession::getValue('s_id'));
     $date = new TDate('date');
     $date->setValue(TSession::getValue('s_date'));
     $client = new TEntry('client');
     $client->setValue(TSession::getValue('s_client'));
     $amount = new TEntry('amount');
     $amount->setValue(TSession::getValue('s_amount'));
     $id->setSize(100);
     $date->setSize(300);
     $client->setSize(300);
     $amount->setSize(300);
     // add a row for the filter field
     $row = $table->addRow();
     $row->addCell(new TLabel('ID:'));
     $row->addCell($id);
     $row = $table->addRow();
     $row->addCell(new TLabel('Date: '));
     $row->addCell($date);
     $row = $table->addRow();
     $row->addCell(new TLabel('Client: '));
     $row->addCell($client);
     $row = $table->addRow();
     $row->addCell(new TLabel('Amount: '));
     $row->addCell($amount);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('fa:search');
     $new_button->setAction(new TAction(array('SystemSalesForm', 'onReload')), _t('New'));
     $new_button->setImage('fa:plus-square green');
     $container = new THBox();
     $container->add($find_button);
     $container->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($container);
     $cell->colspan = 2;
     // define wich are the form fields
     $this->form->setFields(array($id, $date, $client, $amount, $find_button, $new_button));
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'center');
     $date = new TDataGridColumn('date', 'Date', 'center');
     $client = new TDataGridColumn('client', 'Client', 'center');
     $amount = new TDataGridColumn('amount', 'Amount', 'center');
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($date);
     $this->datagrid->addColumn($client);
     $this->datagrid->addColumn($amount);
     // creates the datagrid column actions
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'id');
     $id->setAction($order_id);
     $order_date = new TAction(array($this, 'onReload'));
     $order_date->setParameter('order', 'date');
     $date->setAction($order_date);
     $order_client = new TAction(array($this, 'onReload'));
     $order_client->setParameter('order', 'client');
     $client->setAction($order_client);
     $order_amount = new TAction(array($this, 'onReload'));
     $order_amount->setParameter('order', 'amount');
     $amount->setAction($order_amount);
     // inline editing
     $date_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $date_edit->setField('id');
     $date->setEditAction($date_edit);
     $client_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $client_edit->setField('id');
     $client->setEditAction($client_edit);
     $amount_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $amount_edit->setField('id');
     $amount->setEditAction($amount_edit);
     // creates two datagrid actions
     /*$action1 = new TDataGridAction(array('SystemSalesForm', 'onEdit'));
       $action1->setLabel(_t('Edit'));
       $action1->setImage('fa:pencil-square-o blue fa-lg');
       $action1->setField('id');*/
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('fa:trash-o grey fa-lg');
     $action2->setField('id');
     // add the actions to the datagrid
     //$this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a table
     $container = new TTable();
     $container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->addRow()->addCell($this->form);
     $container->addRow()->addCell($this->datagrid);
     $container->addRow()->addCell($this->pageNavigation);
     // add the container inside the page
     parent::add($container);
 }
Ejemplo n.º 4
0
 /**
  * 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
     $this->form->style = 'width: 500px';
     // creates the table container
     $table = new TTable();
     $table->width = '110%';
     // add the table inside the form
     $this->form->add($table);
     // define the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $row->addCell(new TLabel('Resumo de Tickets e Atividades'))->colspan = 3;
     // create the form fields
     $ticket = new TEntry('ticket_id');
     $ticket->setMask('99999');
     $solicitante_id = new TSeekButton('solicitante_id');
     $solicitante_nome = new TEntry('solicitante_nome');
     $obj = new TicketPessoaSeek();
     $action = new TAction(array($obj, 'onReload'));
     $solicitante_id->setAction($action);
     $solicitante_nome->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);
     $criteria = new TCriteria();
     $criteria->add(new TFilter('enttipent', '=', 1));
     $entcodent = new TDBComboMultiValue('entcodent', 'atividade', 'Entidade', 'entcodent', array(0 => 'entcodent', 1 => 'entrazsoc'), 'entcodent', $criteria);
     $status_ticket_id = new TDBCombo('status_ticket_id', 'atividade', 'StatusTicket', 'id', 'nome');
     $prioridade_id = new TDBCombo('prioridade_id', 'atividade', 'Prioridade', 'id', 'nome');
     $tipo_ticket_id = new TDBCombo('tipo_ticket_id', 'atividade', 'TipoTicket', 'id', 'nome');
     $ticket_sistema_id = new TDBCombo('ticket_sistema_id', 'atividade', 'Sistema', 'id', 'nome');
     $atividade_sistema_id = new TDBCombo('atividade_sistema_id', 'atividade', 'Sistema', 'id', 'nome');
     $saldo = new TCombo('saldo');
     $combo_saldo = array();
     $combo_saldo['c'] = 'Com saldo';
     $saldo->addItems($combo_saldo);
     $data_prevista = new TDate('data_prevista');
     $data_prevista->setMask('dd/mm/yyyy');
     $dataAtividadeInicio = new TDate('data_atividade_inicio');
     $dataAtividadeInicio->setMask('dd/mm/yyyy');
     $dataAtividadeInicio->setValue('01/' . date('m/Y'));
     $dataAtividadeFinal = new TDate('data_atividade_final');
     $dataAtividadeFinal->setMask('dd/mm/yyyy');
     $dataAtividadeFinal->setValue(date('d/m/Y'));
     $criteria = new TCriteria();
     $criteria->add(new TFilter("origem", "=", 1));
     $criteria->add(new TFilter("ativo", "=", 1));
     $criteria->add(new TFilter("codigo_cadastro_origem", "=", 100));
     $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');
     $pesquisa_master = new TEntry('pesquisa_master');
     $tipo = new TRadioGroup('tipo');
     $output_type = new TRadioGroup('output_type');
     // define the sizes
     $ticket->setSize(100);
     $solicitante_id->setSize(30);
     $solicitante_nome->setSize(245);
     $responsavel_id->setSize(300);
     $colaborador_id->setSize(300);
     $entcodent->setSize(300);
     $status_ticket_id->setSize(100);
     $prioridade_id->setSize(100);
     $tipo_ticket_id->setSize(200);
     $ticket_sistema_id->setSize(200);
     $atividade_sistema_id->setSize(200);
     $saldo->setSize(100);
     $data_prevista->setSize(100);
     $dataAtividadeInicio->setSize(100);
     $dataAtividadeFinal->setSize(100);
     $tipo->setSize(100);
     $output_type->setSize(100);
     // validations
     $output_type->addValidation('Output', new TRequiredValidator());
     // add one row for each form field
     // creates a frame
     $frame = new TFrame();
     $frame->oid = 'frame-measures';
     $frame->setLegend('Tickets:');
     $row = $table->addRow();
     $cell = $row->addCell($frame);
     $cell->colspan = 2;
     $frame1 = new TTable();
     $frame->add($frame1);
     $frame1->addRowSet(new TLabel('Ticket inicial:'), $ticket);
     $frame1->addRowSet(new TLabel('Solicitante:'), array($solicitante_id, $solicitante_nome));
     $frame1->addRowSet(new TLabel('Responsável:'), $responsavel_id);
     $frame1->addRowSet(new TLabel('Cliente:'), $entcodent);
     $frame1->addRowSet(new TLabel('Tipo:'), $tipo_ticket_id);
     $frame1->addRowSet(new TLabel('Sistema:'), $ticket_sistema_id);
     $frame1->addRowSet(new TLabel('Status:'), $status_ticket_id);
     $frame1->addRowSet(new TLabel('Prioridade:'), $prioridade_id);
     $frame1->addRowSet(new TLabel('Saldo:'), $saldo);
     $frame1->addRowSet(new TLabel('Dt. Prevista limite:'), $data_prevista);
     // creates a frame
     $frame = new TFrame();
     $frame->oid = 'frame-measures';
     $frame->setLegend('Atividades:');
     $row = $table->addRow();
     $cell = $row->addCell($frame);
     $cell->colspan = 2;
     $frame2 = new TTable();
     $frame->add($frame2);
     $frame2->addRowSet(new TLabel('Dt. Atividades inicio:'), array($dataAtividadeInicio, $label_data_fim = new TLabel('Fim:'), $dataAtividadeFinal));
     $label_data_fim->setSize(48);
     $frame2->addRowSet(new TLabel('Atividades colaborador:'), $colaborador_id);
     $frame2->addRowSet(new TLabel('Tipo atividade:'), $tipo_atividade_id);
     $frame2->addRowSet(new TLabel('Sistema:'), $atividade_sistema_id);
     // creates a frame
     $frame = new TFrame();
     $frame->oid = 'frame-measures';
     $frame->setLegend('Pesquisa Master:');
     $row = $table->addRow();
     $cell = $row->addCell($frame);
     $cell->colspan = 2;
     $frame3 = new TTable();
     $frame->add($frame3);
     $frame3->addRowSet(new TLabel('<nobr>Por palavra:</nobr>'), $pesquisa_master);
     $frame3->addRowSet(new TLabel(''), new TLabel('Essa pesquisa busca pelo titulo do ticket e da descrição da atividade'));
     $table->addRowSet(new TLabel('Relatório'), $tipo);
     $table->addRowSet(new TLabel('Output:'), $output_type);
     $this->form->setFields(array($ticket, $solicitante_id, $solicitante_nome, $responsavel_id, $entcodent, $status_ticket_id, $prioridade_id, $saldo, $tipo_ticket_id, $ticket_sistema_id, $data_prevista, $dataAtividadeInicio, $dataAtividadeFinal, $colaborador_id, $tipo_atividade_id, $atividade_sistema_id, $pesquisa_master, $tipo, $output_type));
     $tipo->addItems(array('s' => 'Sintético', 'a' => 'Analitico'));
     $tipo->setValue('s');
     $tipo->setLayout('horizontal');
     //$output_type->addItems(array('html'=>'HTML', 'pdf'=>'PDF', 'rtf'=>'RTF'));
     $output_type->addItems(array('html' => 'HTML'));
     $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);
     $change_data = new TAction(array($this, 'onChangeData'));
     $dataAtividadeInicio->setExitAction($change_data);
     $dataAtividadeFinal->setExitAction($change_data);
     // add a row for the form action
     $table->addRowSet($generate_button, '')->class = 'tformaction';
     parent::add($this->form);
 }
Ejemplo n.º 5
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // creates a table
     $table = new TTable();
     $table1 = new TTable();
     $table2 = new TTable();
     // creates the form
     $this->form = new TForm('form_Issue');
     $this->form->class = 'tform';
     $this->form->style = 'width: 750px';
     $table->width = '100%';
     $this->form->add($table);
     $table->addRowSet(new TLabel(_t('Issue')), '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $id_project = new TCombo('id_project');
     $id_priority = new TDBCombo('id_priority', 'changeman', 'Priority', 'id', 'description_translated');
     $id_category = new TDBCombo('id_category', 'changeman', 'Category', 'id', 'description_translated');
     $register_date = new TDate('register_date');
     $time = new TEntry('issue_time');
     $title = new TEntry('title');
     $description = new THtmlEditor('description');
     $file = new TFile('file');
     $register_date->setValue(date('Y-m-d'));
     $register_date->setMask('yyyy-mm-dd');
     $time->setValue(date('H:i'));
     $id_priority->setValue(2);
     // default
     $description->style = 'margin: 10px';
     TTransaction::open('changeman');
     $member = Member::newFromLogin(TSession::getValue('login'));
     $member_projects = $member->getProjectsList();
     $id_project->addItems($member_projects);
     // if just one project, its the default
     if (count($member_projects) == 1) {
         $project_keys = array_keys($member_projects);
         $id_project->setValue($project_keys[0]);
     }
     TTransaction::close();
     $id_project->addValidation(_t('Project'), new TRequiredValidator());
     $id_priority->addValidation(_t('Priority'), new TRequiredValidator());
     $id_category->addValidation(_t('Category'), new TRequiredValidator());
     $register_date->addValidation(_t('Start date'), new TRequiredValidator());
     $title->addValidation(_t('Title'), new TRequiredValidator());
     $description->addValidation(_t('Description'), new TRequiredValidator());
     // define the sizes
     $id_project->setSize(200);
     $id_priority->setSize(200);
     $id_category->setSize(200);
     $register_date->setSize(100);
     $file->setSize(250);
     $time->setSize(50);
     $time->setMask('99:99');
     $title->setSize(200, 40);
     $description->setSize(680, 300);
     $table1->addRowSet(new TLabel(_t('Project') . ': '), $id_project);
     $table1->addRowSet(new TLabel(_t('Priority') . ': '), $id_priority);
     $table1->addRowSet(new TLabel(_t('Category') . ': '), $id_category);
     $table2->addRowSet(new TLabel(_t('Start date') . ':'), array($register_date, $time));
     $table2->addRowSet(new TLabel(_t('Title') . ':'), $title);
     $table2->addRowSet(new TLabel(_t('File') . ':'), $file);
     $row = $table->addRow();
     $row->addCell($table1);
     $row->addCell($table2);
     $label_description = new TLabel(_t('Description'));
     $label_description->setFontStyle('b');
     $row = $table->addRow();
     $row->addCell($label_description);
     $row = $table->addRow();
     $cell = $row->addCell($description);
     $cell->colspan = 3;
     // create an action button (save)
     $save_button = new TButton('save');
     // define the button action
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('ico_save.png');
     $table->addRowSet($save_button, '')->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($id_project, $id_priority, $id_category, $register_date, $time, $title, $file, $description, $save_button));
     // add the form to the page
     parent::add($this->form);
 }