/**
  * 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);
 }
示例#2
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 public function __construct()
 {
     parent::__construct();
     parent::setSize(640, 350);
     parent::setTitle('Event');
     // creates the form
     $this->form = new TForm('form_Event');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 600px';
     // 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('Event'))->colspan = 2;
     $hours = array();
     $durations = array();
     for ($n = 0; $n < 24; $n++) {
         $hours[$n] = "{$n}:00";
         $durations[$n + 1] = $n + 1 . ' h';
     }
     array_pop($durations);
     // create the form fields
     $id = new TEntry('id');
     $event_date = new TDate('event_date');
     $start_hour = new TCombo('start_hour');
     $duration = new TCombo('duration');
     $title = new TEntry('title');
     $description = new TText('description');
     $start_hour->addItems($hours);
     $duration->addItems($durations);
     $id->setEditable(FALSE);
     // define the sizes
     $id->setSize(40);
     $event_date->setSize(100);
     $start_hour->setSize(100);
     $duration->setSize(100);
     $title->setSize(400);
     $description->setSize(400, 50);
     // add one row for each form field
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('Event Date:'), $event_date);
     $table->addRowSet(new TLabel('Start Hour:'), $start_hour);
     $table->addRowSet(new TLabel('Duration:'), $duration);
     $table->addRowSet(new TLabel('Title:'), $title);
     $table->addRowSet(new TLabel('Description:'), $description);
     // 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, 'onEdit')), _t('Clear'));
     $new_button->setImage('ico_new.png');
     $this->form->setFields(array($id, $event_date, $start_hour, $duration, $title, $description, $save_button, $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);
 }
 /**
  * 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);
 }
 /**
  * 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 and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_customer');
     // creates a table
     $table_data = new TTable();
     $table_contact = new TTable();
     $table_skill = new TTable();
     $notebook = new TNotebook(500, 250);
     // add the notebook inside the form
     $this->form->add($notebook);
     $notebook->appendPage('Registration Data', $table_data);
     $notebook->appendPage('Contact (composition)', $table_contact);
     $notebook->appendPage('Skill (aggregation)', $table_skill);
     // create the form fields
     $code = new TEntry('id');
     $name = new TEntry('name');
     $address = new TEntry('address');
     $phone = new TEntry('phone');
     $city_id = new TSeekButton('city_id');
     $city_name = new TEntry('city_name');
     $birthdate = new TDate('birthdate');
     $email = new TEntry('email');
     $gender = new TRadioGroup('gender');
     $status = new TCombo('status');
     $contacts_list = new TMultiField('contacts_list');
     $category_id = new TDBCombo('category_id', 'samples', 'Category', 'id', 'name');
     // add field validators
     $name->addValidation('Name', new TRequiredValidator());
     $city_id->addValidation('City', new TRequiredValidator());
     $birthdate->addValidation('Birthdate', new TRequiredValidator());
     $category_id->addValidation('Category', new TRequiredValidator());
     $obj = new CitySeek();
     $city_id->setAction(new TAction(array($obj, 'onReload')));
     $itemGender = array();
     $itemGender['M'] = 'Male';
     $itemGender['F'] = 'Female';
     // add the combo options
     $gender->addItems($itemGender);
     $gender->setLayout('horizontal');
     $itemStatus = array();
     $itemStatus['S'] = 'Single';
     $itemStatus['C'] = 'Committed';
     $itemStatus['M'] = 'Married';
     $status->addItems($itemStatus);
     // define some properties for the form fields
     $code->setEditable(FALSE);
     $code->setSize(100);
     $city_id->setSize(100);
     $city_name->setSize(150);
     $city_name->setEditable(FALSE);
     $name->setSize(320);
     $address->setSize(320);
     $phone->setSize(120);
     $email->setSize(160);
     $birthdate->setSize(90);
     $status->setSize(120);
     $category_id->setSize(120);
     // add a row for the field code
     $table_data->addRowSet(new TLabel('Code:'), $code);
     $table_data->addRowSet(new TLabel('Name:'), $name);
     $table_data->addRowSet(new TLabel('Address:'), $address);
     $table_data->addRowSet(new TLabel('City:'), array($city_id, new TLabel('Name:'), $city_name));
     $table_data->addRowSet(new TLabel('Phone:'), array($phone, new TLabel('BirthDate:'), $birthdate));
     $table_data->addRowSet(new TLabel('Status:'), array($status, new TLabel('Email:'), $email));
     $table_data->addRowSet(new TLabel('Category:'), array($category_id, new TLabel('Gender:'), $gender));
     $row = $table_contact->addRow();
     $cell = $row->addCell(new TLabel('<b>Contact</b>'));
     $cell->valign = 'top';
     // add two fields inside the multifield in the second sheet
     $contacts_list->setHeight(100);
     $contacts_list->setClass('Contact');
     // define the returning class
     $contacts_list->addField('type', 'Contact Type: ', new TEntry('type'), 200);
     $contacts_list->addField('value', 'Contact Value: ', new TEntry('value'), 200);
     $row = $table_contact->addRow();
     $row->addCell($contacts_list);
     // create the radio button for the skills list
     $skill_list = new TDBCheckGroup('skill_list', 'samples', 'Skill', 'id', 'name');
     $table_skill->addRow()->addCell($lbl = new TLabel('Skills'));
     $table_skill->addRow()->addCell($skill_list);
     $lbl->setFontStyle('b');
     // create an action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     // create an action button (go to list)
     $button2 = new TButton('list');
     $button2->setAction(new TAction(array('CustomerDataGridView', 'onReload')), 'Go to Listing');
     $button2->setImage('ico_datagrid.gif');
     // define wich are the form fields
     $this->form->setFields(array($code, $name, $address, $phone, $city_id, $city_name, $birthdate, $email, $gender, $status, $category_id, $contacts_list, $skill_list, $button1, $button2));
     $subtable = new TTable();
     $row = $subtable->addRow();
     $row->addCell($button1);
     $row->addCell($button2);
     // wrap the page content
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', 'CustomerDataGridView'));
     $vbox->add($this->form);
     $vbox->add($subtable);
     // add the form inside the page
     parent::add($vbox);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // creates a notebook
     $notebook = new TNotebook(500, 250);
     // creates the notebook page
     $page = new TTable();
     // adds the notebook page
     $notebook->appendPage('Register data', $page);
     // create the form fields
     $field1 = new TEntry('field1');
     $field2 = new TEntry('field2');
     $field3 = new TEntry('field3');
     $field4 = new TCombo('field4');
     $field5 = new TEntry('field5');
     $field6 = new TEntry('field6');
     $field7 = new TEntry('field7');
     $field8 = new TEntry('field8');
     $field9 = new TEntry('field9');
     // creates an array with items
     $units = array();
     $units['PC'] = 'Piece';
     $units['LT'] = 'Liter';
     $units['ML'] = 'Milliliter';
     $units['GL'] = 'Gallon';
     $units['KG'] = 'Kilogram';
     $units['GR'] = 'Gram';
     // add the items to the combo
     $field4->addItems($units);
     // define some sizes
     $field1->setEditable(FALSE);
     $field1->setSize(100);
     $field2->setSize(300);
     $field4->setSize(100);
     $field3->setSize(100);
     $field5->setSize(100);
     $field6->setSize(100);
     $field7->setSize(100);
     $field8->setSize(100);
     $field9->setSize(300);
     // add a row for one field
     $row = $page->addRow();
     $row->addCell(new TLabel('Id:'));
     $cell = $row->addCell($field1);
     // add a row for one field
     $row = $page->addRow();
     $row->addCell(new TLabel('Description:'));
     $cell = $row->addCell($field2);
     // creates a frame
     $frame = new TFrame();
     $frame->oid = 'frame-measures';
     $frame->setLegend('Measures');
     $button = new TButton('show_hide');
     $button->class = 'btn btn-default btn-sm active';
     $button->setLabel('Show/hide measures');
     $button->addFunction("\$('[oid=frame-measures]').slideToggle(); \$(this).toggleClass( 'active' )");
     $row = $page->addRow();
     $row->addCell($button);
     // add the frame inside the table
     $row = $page->addRow();
     $cell = $row->addCell($frame);
     $cell->colspan = 2;
     // adds another table inside the frame
     $page2 = new TTable();
     $frame->add($page2);
     // add a row for tow fields
     $row = $page2->addRow();
     $row->addCell(new TLabel('Stock:'));
     $row->addCell($field3);
     $row->addCell(new TLabel('Unit:'));
     $row->addCell($field4);
     // add a row for tow fields
     $row = $page2->addRow();
     $row->addCell(new TLabel('Cost Price:'));
     $row->addCell($field5);
     $row->addCell(new TLabel('Sell Price:'));
     $row->addCell($field6);
     // add a row for tow fields
     $row = $page2->addRow();
     $row->addCell(new TLabel('Net Weight:'));
     $row->addCell($field7);
     $row->addCell(new TLabel('Gross Weight:'));
     $row->addCell($field8);
     // add just another field
     $row = $page->addRow();
     $row->addCell(new TLabel('Another field:'));
     $cell = $row->addCell($field9);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($notebook);
     parent::add($vbox);
 }
 /**
  * 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&nbsp;&nbsp;</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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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 and the registration form
  */
 function __construct()
 {
     parent::__construct();
     $this->string = new StringsUtil();
     // creates the form
     $this->form = new TForm('form_Atividade_Cliente');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     // 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 por Periodo'));
     $cell->colspan = 2;
     // create the form fields
     // cria array para popular as combos
     TTransaction::open('atividade');
     $criteria = new TCriteria();
     $criteria->add(new TFilter("origem", "=", 1));
     $criteria->add(new TFilter("codigo_cadastro_origem", "=", 100));
     $criteria->add(new TFilter("ativo", "=", 1));
     $newparam['order'] = 'pessoa_nome';
     $newparam['direction'] = 'asc';
     $criteria->setProperties($newparam);
     // order, offset
     $repo = new TRepository('Pessoa');
     $pessoas = $repo->load($criteria);
     $arrayPessoas[-1] = 'TODOS COLABORADORES';
     foreach ($pessoas as $pessoa) {
         $arrayPessoas[$pessoa->pessoa_codigo] = $pessoa->pessoa_nome;
     }
     $criteria = new TCriteria();
     $criteria->add(new TFilter("enttipent", "=", "1"));
     $newparam['order'] = 'entcodent';
     $newparam['direction'] = 'asc';
     $criteria->setProperties($newparam);
     // order, offset
     $repo = new TRepository('Entidade');
     $clientes = $repo->load($criteria);
     $arrayClientes[-1] = 'TODOS CLIENTES';
     foreach ($clientes as $cliente) {
         $arrayClientes[$cliente->entcodent] = str_pad($cliente->entcodent, 4, '0', STR_PAD_LEFT) . ' - ' . $cliente->entrazsoc;
     }
     $arrayClientes[999] = 'ECS 999';
     TTransaction::close();
     $colaborador_id = new TCombo('colaborador_id');
     $colaborador_id->setDefaultOption(FALSE);
     $colaborador_id->addItems($arrayPessoas);
     $cliente_id = new TCombo('cliente_id');
     $cliente_id->setDefaultOption(FALSE);
     $cliente_id->addItems($arrayClientes);
     $anos = array(2015 => '2015');
     $mes_atividade_inicial = new TCombo('mes_atividade_inicial');
     $mes_atividade_inicial->addItems($this->string->array_meses());
     $mes_atividade_inicial->setDefaultOption(FALSE);
     $mes_atividade_inicial->setValue(date('m'));
     $ano_atividade_inicial = new TCombo('ano_atividade_inicial');
     $ano_atividade_inicial->addItems($anos);
     $ano_atividade_inicial->setDefaultOption(FALSE);
     $mes_atividade_final = new TCombo('mes_atividade_final');
     $mes_atividade_final->addItems($this->string->array_meses());
     $mes_atividade_final->setDefaultOption(FALSE);
     $mes_atividade_final->setValue(date('m'));
     $ano_atividade_final = new TCombo('ano_atividade_final');
     $ano_atividade_final->addItems($anos);
     $ano_atividade_final->setDefaultOption(FALSE);
     $output_type = new TRadioGroup('output_type');
     // define the sizes
     $colaborador_id->setSize(353);
     $cliente_id->setSize(353);
     $mes_atividade_inicial->setSize(250);
     $ano_atividade_inicial->setSize(100);
     $mes_atividade_final->setSize(250);
     $ano_atividade_final->setSize(100);
     $output_type->setSize(100);
     // validations
     $output_type->addValidation('Output', new TRequiredValidator());
     // add one row for each form field
     $table->addRowSet(new TLabel('Colaborador:'), $colaborador_id);
     $table->addRowSet(new TLabel('Cliente:'), $cliente_id);
     $table->addRowSet(new TLabel('Mês ano inicial:'), array($mes_atividade_inicial, $ano_atividade_inicial));
     $table->addRowSet(new TLabel('Mês ano final:'), array($mes_atividade_final, $ano_atividade_final));
     $table->addRowSet(new TLabel('Output:'), $output_type);
     $this->form->setFields(array($colaborador_id, $cliente_id, $mes_atividade_inicial, $mes_atividade_final, $ano_atividade_inicial, $ano_atividade_final, $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();
     // create the form
     $this->form = new TForm();
     $this->form->class = 'tform';
     // creates the form field container
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     // title row
     $table->addRowSet(new TLabel('Static selections'), '')->class = 'tformtitle';
     // create the form fields
     $radio = new TRadioGroup('radio');
     $check = new TCheckGroup('check');
     $combo = new TCombo('combo');
     $select = new TSelect('select');
     $search = new TMultiSearch('search');
     $autocomp = new TEntry('autocomplete');
     $radio->setLayout('horizontal');
     $check->setLayout('horizontal');
     $combo->setSize(100);
     $select->setSize(200, 70);
     $search->setSize(300, 70);
     $items = array();
     $items['a'] = 'Item a';
     $items['b'] = 'Item b';
     $items['c'] = 'Item c';
     $radio->addItems($items);
     $check->addItems($items);
     $combo->addItems($items);
     $select->addItems($items);
     $search->addItems($items);
     $autocomp->setCompletion(array_values($items));
     foreach ($radio->getLabels() as $key => $label) {
         $label->setTip("Radio {$key}");
     }
     foreach ($check->getLabels() as $key => $label) {
         $label->setTip("Check {$key}");
     }
     // define default values
     $search->setMinLength(3);
     $radio->setValue('a');
     $check->setValue(array('a', 'c'));
     $combo->setValue('b');
     $select->setValue(array('b', 'c'));
     $search->setValue(array('b' => 'Item b'));
     // add the fields to the table
     $table->addRowSet(new TLabel('TRadioGroup:'), $radio);
     $table->addRowSet(new TLabel('TCheckGroup:'), $check);
     $table->addRowSet(new TLabel('TCombo:'), $combo);
     $table->addRowSet(new TLabel('TSelect:'), $select);
     $table->addRowSet(new TLabel('TMultiSearch:'), $search);
     $table->addRowSet(new TLabel('Autocomplete:'), $autocomp);
     // creates the action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     $table->addRowSet($button1, '')->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($radio, $check, $combo, $select, $search, $autocomp, $button1));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
 /**
  * Class constructor
  * Creates the page
  */
 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);
 }
示例#11
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // security check
     TTransaction::open('changeman');
     if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic !== 'ADMINISTRATOR' and Member::newFromLogin(TSession::getValue('login'))->role_mnemonic !== 'MANAGER') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // creates a table
     $table = new TTable();
     $table1 = new TTable();
     $table2 = new TTable();
     // creates the form
     $this->form = new TForm('form_Member');
     $this->form->class = 'tform';
     $this->form->style = 'width: 640px';
     $this->form->add($table);
     $table->width = '100%';
     $table->addRowSet(new TLabel(_t('Members')), '')->class = 'tformtitle';
     $row = $table->addRow();
     $row->addCell($table1);
     $cell = $row->addCell($table2);
     $cell->valign = 'top';
     $options = array('Y' => _t('Yes'), 'N' => _t('No'));
     // create the form fields
     $id = new TEntry('id');
     $name = new TEntry('name');
     $id_role = new TDBCombo('id_role', 'changeman', 'Role', 'id', 'description');
     $login = new TEntry('login');
     $password = new TPassword('password');
     $email = new TEntry('email');
     $active = new TCombo('active');
     $projects = new TDBCheckGroup('project_ids', 'changeman', 'Project', 'id', 'description');
     $id->setEditable(FALSE);
     $active->addItems($options);
     // define the sizes
     $id->setSize(100);
     $name->setSize(200, 40);
     $id_role->setSize(160);
     $login->setSize(200, 40);
     $password->setSize(200, 40);
     $email->setSize(200, 40);
     $active->setSize(200);
     // add a row for the field id
     $row = $table1->addRow();
     $cell = $row->addCell(new TLabel('ID:'));
     $cell->width = '100px';
     $row->addCell($id);
     // add a row for the field name
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Name') . ': '));
     $row->addCell($name);
     // add a row for the field id_role
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Role') . ': '));
     $row->addCell($id_role);
     // add a row for the field login
     $row = $table1->addRow();
     $row->addCell(new TLabel('Login:'******'Password') . ': '));
     $row->addCell($password);
     // add a row for the field email
     $row = $table1->addRow();
     $row->addCell(new TLabel('Email:'));
     $row->addCell($email);
     // add a row for the field active
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Active') . ': '));
     $row->addCell($active);
     // add a row for the field projects
     $row = $table2->addRow();
     $cell = $row->addCell($lbl_pro = new TLabel(_t('Projects') . ': '));
     $row = $table2->addRow();
     $row->addCell($projects);
     $lbl_pro->setFontStyle('b');
     // 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');
     $row = $table->addRow();
     $row->class = 'tformaction';
     $row->addCell($save_button)->colspan = 2;
     // define wich are the form fields
     $this->form->setFields(array($id, $name, $id_role, $login, $password, $email, $active, $projects, $save_button));
     $container = new TVBox();
     $container->add($this->form);
     parent::add($container);
 }
// 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();
$items['1'] = 'Porto Alegre';
$items['2'] = 'Lajeado';
$cidade->addItems($items);
// ajusta o tamanho destes campos
$codigo->setSize(70);
$nome->setSize(140);
$endereco->setSize(140);
$telefone->setSize(140);
$cidade->setSize(140);
// cria uma série de rótulos de texto
$label1 = new TLabel('Código');
$label2 = new TLabel('Nome');
$label3 = new TLabel('Cidade');
$label4 = new TLabel('Endereço');
$label5 = new TLabel('Telefone');
// adiciona linha na tabela para o código
$row = $table1->addRow();
$row->addCell($label1);
$row->addCell($codigo);
// adiciona linha na tabela para o nome
$row = $table1->addRow();
$row->addCell($label2);
$row->addCell($nome);
// adiciona linha na tabela para a cidade
 /**
  * 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 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);
 }
 public function __construct()
 {
     parent::__construct();
     // instancia um formulário
     $this->form = new TForm('form_cidades');
     // instancia uma tabela
     $table = new TTable();
     // adiciona a tabela ao formulário
     $this->form->add($table);
     // cria os campos do formulário
     $codigo = new TEntry('id');
     $descricao = new TEntry('nome');
     $estado = new TCombo('estado');
     // cria um vetor com as opções da combo
     $items = array();
     $items['RS'] = 'Rio Grande do Sul';
     $items['SP'] = 'São Paulo';
     $items['MG'] = 'Minas Gerais';
     $items['PR'] = 'Paraná';
     // adiciona as opções na combo
     $estado->addItems($items);
     // define os tamanhos dos campos
     $codigo->setSize(40);
     $estado->setSize(200);
     // adiciona uma linha para o campo código
     $row = $table->addRow();
     $row->addCell(new TLabel('Código:'));
     $row->addCell($codigo);
     // adiciona uma linha para o campo descrição
     $row = $table->addRow();
     $row->addCell(new TLabel('Descrição:'));
     $row->addCell($descricao);
     // adiciona uma linha para o campo estado
     $row = $table->addRow();
     $row->addCell(new TLabel('Estado:'));
     $row->addCell($estado);
     // cria um botão de ação (salvar)
     $save_button = new TButton('save');
     // define a ação do botão
     $save_button->setAction(new TAction(array($this, 'onSave')), 'Salvar');
     // adiciona uma linha para a ação do formulário
     $row = $table->addRow();
     $row->addCell($save_button);
     // define quais são os campos do formulário
     $this->form->setFields(array($codigo, $descricao, $estado, $save_button));
     // instancia objeto DataGrid
     $this->datagrid = new TDataGrid();
     // instancia as colunas da DataGrid
     $codigo = new TDataGridColumn('id', 'Código', 'right', 50);
     $nome = new TDataGridColumn('nome', 'Nome', 'left', 200);
     $estado = new TDataGridColumn('estado', 'Estado', 'left', 40);
     // adiciona as colunas à DataGrid
     $this->datagrid->addColumn($codigo);
     $this->datagrid->addColumn($nome);
     $this->datagrid->addColumn($estado);
     // instancia duas ações da DataGrid
     $action1 = new TDataGridAction(array($this, 'onEdit'));
     $action1->setLabel('Editar');
     $action1->setImage('ico_edit.png');
     $action1->setField('id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel('Deletar');
     $action2->setImage('ico_delete.png');
     $action2->setField('id');
     // adiciona as ações à DataGrid
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     // cria o modelo da DataGrid, montando sua estrutura
     $this->datagrid->createModel();
     // monta a página através de uma tabela
     $table = new TTable();
     // cria uma linha para o formulário
     $row = $table->addRow();
     $row->addCell($this->form);
     // cria uma linha para a datagrid
     $row = $table->addRow();
     $row->addCell($this->datagrid);
     // adiciona a tabela à página
     parent::add($table);
 }
示例#16
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_crm');
     // creates a table
     $table = new TTable();
     $notebook = new TNotebook(500, 320);
     // add the notebook inside the form
     $this->form->add($notebook);
     $notebook->appendPage('Cadastro Registro CRM', $table);
     // create the form fields
     $code = new TEntry('id');
     $crm_id = new TCombo('crm_id');
     $tiporegistro_id = new TDBCombo('tiporegistro_id', 'db_crmbf', 'RegistroTipo', 'id', 'nome');
     $registro = new TText('registro');
     $temporegistro = new TEntry('tempo_registro');
     //        $temporegistro->setEditable(false);
     $dataregistro = new TDate('data_registro');
     $hora_registro = new TEntry('hora_registro');
     $numero_registro = new TEntry('numero_registro');
     // finaliza a transacao
     TTransaction::close();
     $items1 = array();
     //dados do cliente CRM
     TTransaction::open('db_crmbf');
     $criteria = new TCriteria();
     $criteria->add(new TFilter('cliente_id', '=', $_GET['fk']));
     $repository = new TRepository('CRM');
     $cadastros = $repository->load($criteria);
     //adiciona os objetos no combo
     foreach ($cadastros as $object) {
         $items1[$object->id] = $object->titulo;
     }
     // adiciona as opcoes na combo
     $crm_id->addItems($items1);
     TTransaction::close();
     // add field validators
     $registro->addValidation('Registro deve ser informado', new TRequiredValidator());
     // define some properties for the form fields
     $code->setEditable(FALSE);
     $code->setSize(100);
     $crm_id->setSize(320);
     //        $crm_id->setEditable(FALSE);
     $registro->setSize(320);
     $temporegistro->setSize(160);
     $temporegistro->setValue(date("d/m/Y H:i:s"));
     $tiporegistro_id->setSize(160);
     $dataregistro->setSize(90);
     $hora_registro->setSize(150);
     $hora_registro->setTip('Horario EX: 8:14');
     $numero_registro->setSize(320);
     $row = $table->addRow();
     $row->addCell(new TLabel('Code:'));
     $row->addCell($code);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel('CRM Titulo:'));
     $cell = $row->addCell($crm_id);
     // add a row for the field Telefone
     $row = $table->addRow();
     $row->addCell(new TLabel('Tipo Registro:'));
     $cell = $row->addCell($tiporegistro_id);
     // add a row for the field Email
     $row = $table->addRow();
     $row->addCell(new TLabel('Tempo:'));
     $cell = $row->addCell($temporegistro);
     // add a row for the field celular
     $row = $table->addRow();
     $row->addCell(new TLabel('Data:'));
     $cell = $row->addCell($dataregistro);
     // add a row for the field skype
     $row = $table->addRow();
     $row->addCell(new TLabel('Hora:'));
     $cell = $row->addCell($hora_registro);
     // add a row for the field endereco
     $row = $table->addRow();
     $row->addCell(new TLabel('Numero Registro:'));
     $row->addCell($numero_registro);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel('Registro:'));
     $cell = $row->addCell($registro);
     // create an action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     // create an action button
     $button2 = new TButton('action3');
     $action2 = new TAction(array('ClienteRegistroDetalhe', 'onEdit'));
     //parametro fk e key da sessao
     $action2->setParameter('fk', TSession::getValue('cliente_fk'));
     $action2->setParameter('key', TSession::getValue('crm_key'));
     $button2->setImage('ico_datagrid.png');
     $button2->setAction($action2, 'Voltar');
     // define wich are the form fields
     $this->form->setFields(array($code, $crm_id, $registro, $temporegistro, $tiporegistro_id, $dataregistro, $hora_registro, $numero_registro, $button1, $button2));
     $subtable = new TTable();
     $row = $subtable->addRow();
     $row->addCell($button1);
     $row->addCell($button2);
     $table_layout = new TTable();
     $table_layout->addRow()->addCell($this->form);
     $table_layout->addRow()->addCell($subtable);
     // add the form inside the page
     parent::add($table_layout);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the form
     $this->form = new TForm();
     $this->form->class = 'tform';
     // creates the form field container
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     // title row
     $table->addRowSet(new TLabel('Manual selections'), '')->class = 'tformtitle';
     // create the form fields
     $radio = new TRadioGroup('radio');
     $check = new TCheckGroup('check');
     $combo = new TCombo('combo');
     $select = new TSelect('select');
     $search = new TMultiSearch('search');
     $autocomp = new TEntry('autocomplete');
     $search->setMinLength(3);
     $radio->setLayout('horizontal');
     $check->setLayout('horizontal');
     $combo->setSize(160);
     $select->setSize(200, 70);
     // open database transaction
     TTransaction::open('samples');
     // items repository
     $repository = new TRepository('Category');
     // load all objects
     $collection = $repository->load(new TCriteria());
     // add the combo items
     $items = array();
     foreach ($collection as $object) {
         $items[$object->id] = $object->name;
     }
     $radio->addItems($items);
     $check->addItems($items);
     $combo->addItems($items);
     $select->addItems($items);
     $search->addItems($items);
     $autocomp->setCompletion(array_values($items));
     TTransaction::close();
     // add the fields to the table
     $table->addRowSet(new TLabel('TRadioGroup:'), $radio);
     $table->addRowSet(new TLabel('TCheckGroup:'), $check);
     $table->addRowSet(new TLabel('TCombo:'), $combo);
     $table->addRowSet(new TLabel('TSelect:'), $select);
     $table->addRowSet(new TLabel('TMultiSearch:'), $search);
     $table->addRowSet(new TLabel('Autocomplete:'), $autocomp);
     // creates the action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     $table->addRowSet($button1, '')->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($radio, $check, $combo, $select, $search, $autocomp, $button1));
     // 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 makeTCombo($properties)
 {
     $widget = new TCombo((string) $properties->{'name'});
     $pieces = explode("\n", (string) $properties->{'items'});
     $items = array();
     if ($pieces) {
         foreach ($pieces as $line) {
             $part = explode(':', $line);
             $items[$part[0]] = $part[1];
         }
     }
     $widget->addItems($items);
     if (isset($properties->{'value'})) {
         $widget->setValue((string) $properties->{'value'});
     }
     if (isset($properties->{'tip'})) {
         $widget->setTip((string) $properties->{'tip'});
     }
     $widget->setSize((int) $properties->{'width'});
     $this->fields[] = $widget;
     $this->fieldsByName[(string) $properties->{'name'}] = $widget;
     return $widget;
 }
 /**
  * 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);
 }
示例#20
0
//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';
$cidade->addItems($itens);
//Ajusta o Tamanho destes Campos
$codigo->setSize('70');
$nome->setSize('140');
$endereco->setSize('140');
$telefone->setSize('140');
$cidade->setSize('140');
//Cria uma serie de Rotulos de Texto
$label1 = new TLabel('Código');
$label2 = new TLabel('Nome');
$label3 = new TLabel('Cidade');
$label4 = new TLabel('Endereço');
$label5 = new TLabel('Telefone');
//Posiciona os Campos e os Rotulos dentro do Painel
$painel->put($label1, '10', '40');
$painel->put($codigo, '10', '60');
$painel->put($label2, '10', '90');
$painel->put($nome, '10', '110');
$painel->put($label3, '10', '140');
$painel->put($cidade, '10', '160');
$painel->put($label4, '200', '40');
$painel->put($endereco, '200', '60');
示例#21
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);
 }