public function __construct()
 {
     parent::__construct();
     // create the notebook
     $notebook = new TNotebook(400, 280);
     parent::add($notebook);
     // creates the notebook page
     $this->table = new TTable();
     // adds the notebook page
     $notebook->appendPage('Reusable view', $this->table);
     // create the form fields
     $fields[] = new TEntry('field1');
     $fields[] = $date = new TDate('field2');
     $fields[] = $text = new TText('field3');
     $fields[] = $combo = new TCombo('field4');
     $fields[] = new TPassword('field5');
     $date->setSize(100);
     $text->setSize(200, 100);
     $combo->addItems(array('1' => 'One', '2' => 'Two'));
     for ($n = 0; $n < 5; $n++) {
         // add a row for one field
         $row = $this->table->addRow();
         $row->addCell(new TLabel('Field ' . ($n + 1)));
         $row->addCell($fields[$n]);
     }
     // define wich are the form fields
     parent::setFields($fields);
 }
function onView()
{
    global $form;
    // obtém os dados do formulário
    $data = $form->getData();
    // atribui os dados de volta ao formulário
    $form->setData($data);
    // cria uma janela
    $window = new TWindow('Dados do Form');
    // define posição e tamanho em pixels
    $window->setPosition(300, 70);
    $window->setSize(300, 150);
    // monta o texto a ser exibido
    $output = "Nome:     {$data->nome}\n";
    $output .= "Email:    {$data->email}\n";
    $output .= "Título:   {$data->titulo}\n";
    $output .= "Mensagem: \n{$data->mensagem}";
    // cria um objeto de texto
    $text = new TText('texto', 300);
    $text->setSize(290, 120);
    $text->setValue($output);
    // adiciona o objeto à janela
    $window->add($text);
    $window->show();
}
Exemple #3
0
function onView()
{
    global $form;
    //Obtem dados do Formulario
    $data = $form->getData();
    //Atribui os dados de volta ao Formulario
    $form->setData($data);
    //Cria uma Janela
    $window = new TWindow('Dados do Formulario');
    //Define posição e tamanho
    $window->setPosition('300', '70');
    $window->setSize('300', '150');
    //Monta o Texto a ser Exibido
    $output = "Nome: {$data->Nome}\n";
    $output .= "Email: {$data->Email}\n";
    $output .= "Titulo: {$data->Titulo}\n";
    $output .= "Mensagem:\n{$data->Mensagem}\n";
    //Cria o Objeto de Texto
    $texto = new TText('TEXTO', '300');
    $texto->setSize('290', '120');
    $texto->setValue($output);
    //Adiciona o objeto a janela
    $window->add($texto);
    $window->show();
}
Exemple #4
0
function getAdsmanagerRouteCategory($id)
{
    $db = JFactory::getDBO();
    $sql = "SELECT name FROM #__adsmanager_categories WHERE id = " . (int) $id;
    $db->setQuery($sql);
    $result = $db->loadResult();
    $result = TText::_($result);
    $result = TTools::stringURLSafe($result);
    $result = JString::substr($result, 0, 30);
    return $result;
}
 /**
  * constructor method
  */
 public function __construct()
 {
     parent::__construct();
     new TSession();
     // creates the form
     $this->form = new TForm('form_city_Seek');
     // creates the table
     $table = new TTable();
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $name = new TEntry('name');
     $code = new TEntry('id');
     $crm_id = new TDBCombo('crm_id', 'db_crmbf', 'CRM', 'id', 'titulo');
     $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');
     // keep the session value
     //  $name->setValue(TSession::getValue('test_city_name'));
     // add the field inside the table
     //        $row=$table->addRow();
     //        $row->addCell(new TLabel('Name:'));
     //        $row->addCell($name);
     $code->setEditable(FALSE);
     $code->setSize(100);
     $crm_id->setSize(320);
     $registro->setSize(320);
     $temporegistro->setSize(160);
     //$temporegistro->setValue(date("d/m/Y H:i:s"));
     $tiporegistro_id->setSize(160);
     //$dataregistro->setRange(0,1000,1);
     $dataregistro->setSize(90);
     // $hora_registro->setRange(0,100,1);
     $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 a find button
     $find_button = new TButton('search');
     // define the button action
     $find_button->setAction(new TAction(array($this, 'onSearch')), 'Search');
     $find_button->setImage('ico_find.png');
     // add a row for the find button
     $row = $table->addRow();
     $row->addCell($find_button);
     // define wich are the form fields
     $this->form->setFields(array($name, $find_button));
     // create the datagrid
     $this->datagrid = new TDataGrid();
     // create the datagrid columns
     $id = new TDataGridColumn('id', 'Id', 'right', 70);
     $name = new TDataGridColumn('name', 'Name', 'left', 220);
     $state = new TDataGridColumn('state', 'Estado', 'left', 80);
     $order1 = new TAction(array($this, 'onReload'));
     $order2 = new TAction(array($this, 'onReload'));
     $order1->setParameter('order', 'id');
     $order2->setParameter('order', 'name');
     // define the column actions
     $id->setAction($order1);
     $name->setAction($order2);
     // add the columns inside the datagrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($name);
     $this->datagrid->addColumn($state);
     // create one datagrid action
     $action1 = new TDataGridAction(array($this, 'onSelect'));
     $action1->setLabel('Selecionar');
     $action1->setImage('ico_apply.png');
     $action1->setField('id');
     // add the action to the datagrid
     $this->datagrid->addAction($action1);
     // create the datagrid model
     $this->datagrid->createModel();
     // create the page navigator
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // create a table for layout
     $table = new TTable();
     // create a row for the form
     $row = $table->addRow();
     $row->addCell($this->form);
     // create a row for the datagrid
     $row = $table->addRow();
     $row->addCell($this->datagrid);
     // create a row for the page navigator
     $row = $table->addRow();
     $row->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_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 and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_crm');
     // creates a table
     //        $table = new TTable;
     $panel = new TPanel(100, 10);
     // add the notebook inside the form
     $this->form->add($panel);
     $panel->put(new TLabel('CRM Titulo:'), 0, 0);
     // $notebook->appendPage('Cidade', $table_contact);
     //        $notebook->appendPage('Skill (aggregation)', $table_skill);
     // create the form fields
     $code = new TEntry('id');
     //        $crm_id = new TDBCombo('crm_id', 'db_crmbf', 'CRM', 'id', 'titulo');
     $crm_id = new TEntry('crm_nome');
     $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');
     // add field validators
     $registro->addValidation('Nome', new TRequiredValidator());
     // $cidade_id->addValidation('Cidade', new TRequiredValidator);
     // $birthdate->addValidation('Birthdate', new TRequiredValidator);
     //        $cidade_id->addValidation('Category', new TRequiredValidator);
     //$obj = new CidadeFormList;
     //$cidade_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);
     $crm_id->setSize(320);
     $registro->setSize(320);
     $temporegistro->setSize(160);
     //$temporegistro->setValue(date("d/m/Y H:i:s"));
     $tiporegistro_id->setSize(160);
     //$dataregistro->setRange(0,1000,1);
     $dataregistro->setSize(90);
     // $hora_registro->setRange(0,100,1);
     $hora_registro->setSize(150);
     $hora_registro->setTip('Horario EX: 8:14');
     $numero_registro->setSize(320);
     $panel->put("Codigo: ", 10, 25);
     $panel->put("CRM: ", 10, 50);
     $panel->put("Tipo: ", 10, 75);
     $panel->put("Tempo: ", 10, 100);
     $panel->put("Data: ", 10, 125);
     $panel->put("Horario: ", 10, 150);
     $panel->put("Nº Registro: ", 10, 175);
     $panel->put("Registro: ", 10, 200);
     $panel->put($code, 100, 25);
     $panel->put($crm_id, 100, 50);
     $panel->put($tiporegistro_id, 100, 75);
     $panel->put($temporegistro, 100, 100);
     $panel->put($dataregistro, 100, 125);
     $panel->put($hora_registro, 100, 150);
     $panel->put($numero_registro, 100, 175);
     $panel->put($registro, 100, 200);
     //        $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);
     // add a row for the field Category
     //        $row = $table_data->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $cell = $row->addCell($cidade_id);
     // add a row for the field city
     //        $row=$table_data->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $cell = $row->addCell($cidade_id);
     /*
      // add a row for the field Phone
      $row = $table_data->addRow();
      $row->addCell(new TLabel('Phone:'));
      $row->addCell($phone);
     
      // add a row for the field BirthDate
      $row->addCell(new TLabel('BirthDate:'));
      $row->addCell($birthdate);
     
      // add a row for the field status
      $row = $table_data->addRow();
      $row->addCell(new TLabel('Status:'));
      $cell = $row->addCell($status);
     
      // add a row for the field Email
      $row->addCell(new TLabel('Email:'));
      $cell = $row->addCell($email);
     
      // add a row for the field gender
      $row->addCell(new TLabel('Gender:'));
      $row->addCell($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');
     $button1->setProperty('width', 150);
     //  create an action button (go to list)
     $button2 = new TButton('list');
     $button2->setAction(new TAction(array('RegistroList', 'onReload')), 'Ir para Listagem');
     $button2->setImage('ico_datagrid.gif');
     $button2->setProperty('width', 100);
     $panel->put($button1, 100, 325);
     $panel->put($button2, 200, 325);
     // 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($panel);
     //        parent::add($table_layout);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_RequisitoDesenvolvimento');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     $this->string = new StringsUtil();
     // add a table inside form
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     // add a row for the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $row->addCell(new TLabel('Cadastro de DTr'))->colspan = 2;
     // create the form fields
     $id = new THidden('id');
     $titulo = new TEntry('titulo');
     $data_cadastro = new TEntry('data_cadastro');
     $data_cadastro->setEditable(FALSE);
     $data_cadastro->setMask('dd/mm/yyyy');
     $data_cadastro->setValue(date('d/m/Y'));
     $rotina = new TEntry('rotina');
     $objetivo = new TText('objetivo');
     $entrada = new TText('entrada');
     $processamento = new TText('processamento');
     $saida = new TText('saida');
     $ticket_id = new TEntry('ticket_id');
     $ticket_id->setEditable(FALSE);
     $ticket_titulo = new TEntry('ticket_titulo');
     $ticket_titulo->setEditable(FALSE);
     // define the sizes
     $id->setSize(100);
     $titulo->setSize(300);
     $data_cadastro->setSize(100);
     $rotina->setSize(300);
     $objetivo->setSize(300, 60);
     $entrada->setSize(300, 60);
     $processamento->setSize(300, 60);
     $saida->setSize(300, 60);
     $ticket_id->setSize(45);
     $ticket_titulo->setSize(250);
     // validations
     $titulo->addValidation('Título', new TRequiredValidator());
     $objetivo->addValidation('Objetivo', new TRequiredValidator());
     $ticket_id->addValidation('Ticket', new TRequiredValidator());
     // add one row for each form field
     $table->addRowSet($label_titulo = new TLabel('Título:'), $titulo);
     $label_titulo->setFontColor('#FF0000');
     $table->addRowSet($label_ticket_id = new TLabel('Ticket:'), array($ticket_id, $ticket_titulo));
     $label_ticket_id->setFontColor('#FF0000');
     $table->addRowSet(new TLabel('Data de Cadastro:'), $data_cadastro);
     $table->addRowSet(new TLabel('Rotina:'), $rotina);
     $table->addRowSet($label_objetivo = new TLabel('Objetivo:'), $objetivo);
     $label_objetivo->setFontColor('#FF0000');
     $table->addRowSet(new TLabel('Entrada:'), $entrada);
     $table->addRowSet(new TLabel('Processamento:'), $processamento);
     $table->addRowSet(new TLabel('Saida:'), $saida);
     $table->addRowSet(new TLabel(''), $id);
     $this->form->setFields(array($id, $titulo, $data_cadastro, $rotina, $objetivo, $entrada, $processamento, $saida, $ticket_id, $ticket_titulo));
     // create the form actions
     $save_button = TButton::create('save', array($this, 'onSave'), _t('Save'), 'fa:floppy-o');
     $list_button = TButton::create('list', array('RequisitoDesenvolvimentoList', 'onReload'), _t('List'), 'fa:table blue');
     $gerar_dtr = TButton::create('gerar_dtr', array($this, 'onGenerate'), 'Gerar DTr', 'fa:floppy-o');
     $gerar_kanban = TButton::create('gerar_kanban', array($this, 'onGenerateKanban'), 'Gerar Kanban', 'fa:floppy-o');
     TButton::disableField('form_RequisitoDesenvolvimento', 'save');
     TButton::disableField('form_RequisitoDesenvolvimento', 'gerar_dtr');
     TButton::disableField('form_RequisitoDesenvolvimento', 'gerar_kanban');
     $this->form->addField($save_button);
     $this->form->addField($list_button);
     $this->form->addField($gerar_dtr);
     $this->form->addField($gerar_kanban);
     $buttons_box = new THBox();
     $buttons_box->add($save_button);
     $buttons_box->add($list_button);
     $buttons_box->add($gerar_dtr);
     $buttons_box->add($gerar_kanban);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_clienteRegistro Detalhe');
     // creates a table
     $table = new TTable();
     $panel = new TPanel(480, 260);
     $notebook = new TNotebook(500, 250);
     // add the notebook inside the form
     $this->form->add($notebook);
     // add the notebook inside the form
     $this->form->add($table);
     // create the form fields
     $city_id2 = new TSeekButton('city_id2');
     $city_name2 = new TEntry('city_name2');
     $city_id2->setSize(100);
     $city_name2->setEditable(FALSE);
     //dados do cliente CRM
     TTransaction::open('db_crmbf');
     $criteria = new TCriteria();
     $criteria->add(new TFilter('cliente_id', '=', $_GET['key']));
     //
     $repository = new TRepository('CRM');
     $CRM = $repository->load($criteria);
     foreach ($CRM as $crms) {
         $codigoCRM = $crms->id;
         $tituloCRM = $crms->titulo;
         $projetoCRM = $crms->projeto_nome;
         $dataCRM = $crms->data_crm;
         $tempoCRM = $crms->tempo;
         $porcentagemCRM = $crms->porcentagem;
         $descricaoCRM = $crms->descricao;
         $solicitanteCRM = $crms->solicitante;
         $usuarioalteracaoCRM = $crms->usuarioalteracao;
         $responsavel_nomeCRM = $crms->responsavel_nome;
         $tipo_nomeCRM = $crms->tipo_nome;
         $cliente_nomeCRM = $crms->cliente_nome;
         $prioridade_nomeCRM = $crms->prioridade_nome;
         $status_nomeCRM = $crms->status_nome;
     }
     TTransaction::close();
     $notebook->appendPage('Registros CRMs', $table);
     $code = new TEntry('id');
     $crm_id = new TDBCombo('crm_id', 'db_crmbf', 'CRM', 'id', 'titulo');
     $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');
     // 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->setRange(0,1000,1);
     $dataregistro->setSize(90);
     // $hora_registro->setRange(0,100,1);
     $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);
     // $notebook->appendPage('Cidade', $table_contact);
     //        $notebook->appendPage('Skill (aggregation)', $table_skill);
     // create the form fields
     //        $code = new TEntry('id');
     //        $nome = new TEntry('nome');
     //        $email = new TEntry('email');
     //        $telefone = new TEntry('telefone');
     //        $celular = new TEntry('celular');
     //        $skype = new TEntry('skype');
     //        $endereco = new TEntry('endereco');
     ////        $cidade_id = new TSeekButton('cidade_id');
     //        $cidade_id = new TDBCombo('cidade_id', 'db_crmbf', 'Cidade', 'id', 'nome');
     //        $birthdate = new TDate('birthdate');
     //        $email = new TEntry('email');
     //        $gender = new TRadioGroup('gender');
     //        $status = new TCombo('status');
     //        $contacts_list = new TMultiField('contacts_list');
     // add field validators
     //        $nome->addValidation('Nome', new TRequiredValidator);
     //        $cidade_id->addValidation('Cidade', new TRequiredValidator);
     // $birthdate->addValidation('Birthdate', new TRequiredValidator);
     //        $cidade_id->addValidation('Category', new TRequiredValidator);
     //$obj = new CidadeFormList;
     //$cidade_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);
     //        $nome->setSize(320);
     //        $email->setSize(160);
     //        $telefone->setSize(160);
     //        $celular->setSize(160);
     //        $skype->setSize(160);
     //        $endereco->setSize(320);
     //        $cidade_id->setSize(150);
     //$cidade_id->setEditable(FALSE);
     // add a row for the field code
     $panel->put("CRM: ", $codigoCRM, 10, 5);
     $panel->put($tituloCRM, 10, 20);
     $panel->put($projetoCRM, 10, 40);
     $panel->put("Data de Criação: " . $dataCRM, 10, 75);
     $panel->put("Aberto por: " . $usuarioalteracaoCRM, 10, 95);
     $panel->put("Cliente: " . $cliente_nomeCRM, 10, 55);
     $panel->put("Responsavel: " . $responsavel_nomeCRM, 10, 110);
     $panel->put("Tipo: " . $tipo_nomeCRM, 10, 130);
     $panel->put("Percentual Conclusão: " . $porcentagemCRM, 10, 140);
     $panel->put("Tempo Gasto: " . $tempoCRM, 10, 160);
     $panel->put("Situação: " . $status_nomeCRM, 10, 180);
     $panel->put("Descrição: " . $descricaoCRM, 10, 200);
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Titulo:'));
     //        $row->addCell($tituloCRM);
     //
     //        // add a row for the field name
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Projeto:'));
     //        $cell = $row->addCell($projetoCRM);
     //        $cell->colspan = 3;
     //
     //        // add a row for the field Email
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('DATA:'));
     //        $cell = $row->addCell($dataCRM);
     //        $cell->colspan = 3;
     //
     //        // add a row for the field Telefone
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Tempo:'));
     //        $cell = $row->addCell($tempoCRM);
     //        $cell->colspan = 3;
     //
     //        // add a row for the field celular
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Porcentagem:'));
     //        $cell = $row->addCell($porcentagemCRM);
     //
     //        // add a row for the field skype
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Solicitação:'));
     //        $cell = $row->addCell($solicitanteCRM);
     //        // add a row for the field endereco
     //        $row = $table_data->addRow();
     //        $row->addCell(new TLabel('Endereço:'));
     //        $row->addCell($endereco);
     //
     //        // add a row for the field endereco
     //        $row = $table_data->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $row->addCell($cidade_id);
     // add a row for the field Category
     //        $row = $table_data->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $cell = $row->addCell($cidade_id);
     // add a row for the field city
     //        $row=$table_data->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $cell = $row->addCell($cidade_id);
     /*
      // add a row for the field Phone
      $row = $table_data->addRow();
      $row->addCell(new TLabel('Phone:'));
      $row->addCell($phone);
     
      // add a row for the field BirthDate
      $row->addCell(new TLabel('BirthDate:'));
      $row->addCell($birthdate);
     
      // add a row for the field status
      $row = $table_data->addRow();
      $row->addCell(new TLabel('Status:'));
      $cell = $row->addCell($status);
     
      // add a row for the field Email
      $row->addCell(new TLabel('Email:'));
      $cell = $row->addCell($email);
     
      // add a row for the field gender
      $row->addCell(new TLabel('Gender:'));
      $row->addCell($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('ClienteList', 'onReload')), 'Ir para Listagem');
     $button2->setImage('ico_datagrid.gif');
     // create an action button
     $button3 = new TButton('action3');
     $action3 = new TAction(array('RegistroForm', 'onEdit'));
     $action3->setParameter('fk', $codigoCRM);
     $button3->setImage('ico_save.png');
     $button3->setAction($action3, 'Inserir Registro');
     // define wich are the form fields
     $this->form->setFields(array($code, $crm_id, $registro, $temporegistro, $tiporegistro_id, $dataregistro, $hora_registro, $numero_registro, $button1, $button2, $button3));
     $subtable = new TTable();
     $row = $subtable->addRow();
     $row->addCell($button1);
     $row->addCell($button2);
     $row->addCell($button3);
     $table_layout = new TTable();
     $table_layout->addRow()->addCell($this->form);
     $table_layout->addRow()->addCell($subtable);
     //         // add a row for the field gender
     //          $row->addCell(new TLabel('Gender:'));
     //          $row->addCell($registroREG);
     //
     //        // add a row for the field Category
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $cell = $row->addCell($registroREG);
     // add the form inside the page
     parent::add($panel);
     parent::add($table_layout);
     // creates the form
     $this->form2 = new TForm('form_clienteRegistro Detalhe');
     //dados do cliente CRM
     TTransaction::open('db_crmbf');
     $criteria2 = new TCriteria();
     // $criteria->add(new TFilter('crm_id', '=', $_GET['key']));
     $criteria2->setProperty('order', 'id desc');
     $repository2 = new TRepository('Registro');
     $reg = $repository2->load($criteria2);
     foreach ($reg as $regs) {
         $row = $table->addRow();
         $row->addCell(new TLabel('ID:'));
         $cell = $row->addCell($regs->id);
         $row = $table->addRow();
         $row->addCell(new TLabel('CRM:'));
         $cell = $row->addCell($regs->crm_id);
         $row = $table->addRow();
         $row->addCell(new TLabel('CRM:'));
         $cell = $row->addCell($regs->tiporegistro_id);
         $row = $table->addRow();
         $row->addCell(new TLabel('Tempo:'));
         $cell = $row->addCell($regs->tempo_registro);
         $row = $table->addRow();
         $row->addCell(new TLabel('Data:'));
         $cell = $row->addCell($regs->data_registro);
         $row = $table->addRow();
         $row->addCell(new TLabel('Horario:'));
         $cell = $row->addCell($regs->hora_registro);
         $row = $table->addRow();
         $row->addCell(new TLabel('Numero Registro:'));
         $cell = $row->addCell($regs->numero_registro);
         $row = $table->addRow();
         $row->addCell(new TLabel('Registro:'));
         $cell = $row->addCell($regs->registro);
         $row = $table->addRow();
         $row->addCell(new TLabel(' '));
         $cell = $row->addCell(' ');
         //            $idREG = $regs->id;
         //            $crm_idREG = $regs->crm_id;
         //            $tiporegistro_idREG = $regs->tiporegistro_id;
         //            $tempoREG = $regs->tempo_registro;
         //            $dataREG = $regs->data_registro;
         //            $horaREG = $regs->hora_registro;
         //            $numRegistroREG = $regs->numero_registro;
         //            $registroREG = $regs->registro;
     }
     TTransaction::close();
 }
 /**
  * 
  */
 public function makeTText($properties)
 {
     $widget = new TText((string) $properties->{'name'});
     $widget->setValue((string) $properties->{'value'});
     $widget->setSize((int) $properties->{'width'}, (int) $properties->{'height'});
     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;
 }
Exemple #11
0
$form = new TForm('formPessoa');
//Instancia uma Tabela
$table = new TTable();
//Define as propriedades da Tabela
$table->style = 'border:2px solid #989898';
$table->width = '400px';
//Adiciona a tabela no formulario
$form->add($table);
//Cria os Campos do Formulario
$codigo = new TEntry('id');
$nome = new TEntry('nome');
$endereco = new TEntry('endereco');
$datanasc = new TEntry('datanasc');
$sexo = new TRadioGroup('sexo');
$linguas = new TCheckGroup('linguas');
$qualifica = new TText('qualifica');
//Define o tamanho para o campo Codigo
$codigo->setSize('100');
//Define como somente leitura
$codigo->setEditable(false);
//Cria um vetor com as opções de Sexo
$itens = array();
$itens['M'] = 'MASCULINO';
$itens['F'] = 'FEMININO';
//Define o tamanho para o campo Data de Nascimento
$datanasc->setSize('100');
//Adiciona as opções ao Radio Button
$sexo->addItems($itens);
//Define opção Ativa
$sexo->setValue('M');
//Define posição dos Elementos
Exemple #12
0
 <?php 
 foreach ($this->fieldsByPosition[$position->id] as $field) {
     if (@$field->options->edit_admin_only == 0) {
         $fieldform = $this->field->showFieldForm($field, $this->content, $this->default);
         if ($fieldform != "") {
             echo "<div id=\"row_" . $field->name . "\" class=\"span12\">";
             if (!isset($field->options->display_edit_title) || $field->options->display_edit_title == 1) {
                 echo "<div class=\"control-group\">";
                 if ($field->required == 1) {
                     $requiredtxt = JText::_('ADSMANAGER_REQUIRED');
                 } else {
                     $requiredtxt = "";
                 }
                 if (@$field->description && $field->description != "") {
                     JHTML::_('behavior.tooltip');
                     echo "<label class=\"control-label\" for=\"{$field->name}\">" . JHTML::tooltip(TText::_($field->description), TText::_($field->title), null, $this->field->showFieldLabel($field, $this->content, $this->default) . $requiredtxt) . "</label>";
                 } else {
                     echo "<label class=\"control-label\" for=\"{$field->name}\">" . $this->field->showFieldLabel($field, $this->content, $this->default) . $requiredtxt . "</label>";
                 }
                 echo "<div class=\"controls\">";
             }
             echo $fieldform;
             if (!isset($field->options->display_edit_title) || $field->options->display_edit_title == 1) {
                 echo "</div></div>";
             }
             echo "</div>";
         }
     }
 }
 ?>
 </div>
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the notebook
     $notebook = new TNotebook(620, 340);
     // create the form
     $this->form = new TForm();
     // creates the notebook page
     $table = new TTable();
     // add the notebook inside the form
     $this->form->add($table);
     // adds the notebook page
     $notebook->appendPage('Input elements', $this->form);
     // create the form fields
     $field1 = new TEntry('field1');
     $field2 = new TEntry('field2');
     $field3 = new TEntry('field3');
     $field4 = new TEntry('field4');
     $field5 = new TPassword('field5');
     $field6 = new TDate('field6');
     $field7 = new TSpinner('field7');
     $field8 = new TSlider('field8');
     $field9 = new TText('field9');
     $field1->setTip('Tip for field 1');
     $field2->setTip('Tip for field 2');
     $field3->setTip('Tip for field 3');
     $field4->setTip('Tip for field 4');
     $field5->setTip('Tip for field 5');
     $field6->setTip('Tip for field 6');
     $field7->setTip('Tip for field 7');
     $field8->setTip('Tip for field 8');
     $field9->setTip('Tip for field 9');
     $field2->setValue('123');
     $field2->setEditable(FALSE);
     $field3->setMask('99.999-999');
     $field4->setMaxLength(10);
     $field6->setSize(100);
     $field7->setRange(0, 100, 10);
     $field8->setRange(0, 100, 10);
     $field7->setValue(30);
     $field8->setValue(50);
     $field9->setSize(300, 50);
     // add rows for the fields
     $table->addRowSet(new TLabel('TEntry object:'), $field1);
     $table->addRowSet(new TLabel('TEntry not editable:'), $field2);
     $table->addRowSet(new TLabel('TEntry with mask:'), $field3, new TLabel('99.999-999'));
     $table->addRowSet(new TLabel('TEntry with maxlength (10):'), $field4);
     $table->addRowSet(new TLabel('TPassword object:'), $field5);
     $table->addRowSet(new TLabel('TDate Object:'), $field6);
     $table->addRowSet(new TLabel('Spinner Object:'), $field7);
     $table->addRowSet(new TLabel('Slider Object:'), $field8);
     $table->addRowSet(new TLabel('TText Object:'), $field9);
     // creates the action button
     $button1 = new TButton('action1');
     // define the button action
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     // define wich are the form fields
     $this->form->setFields(array($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9, $button1));
     // add a row for the button
     $row = $table->addRow();
     $row->addCell($button1);
     // 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 TForm('form_crm');
     // creates a table
     $table = new TTable();
     $table_contact = new TTable();
     $table_skill = new TTable();
     $notebook = new TNotebook(500, 500);
     // add the notebook inside the form
     $this->form->add($notebook);
     $notebook->appendPage('Cadastro Cliente', $table);
     // $notebook->appendPage('Cidade', $table_contact);
     //        $notebook->appendPage('Skill (aggregation)', $table_skill);
     // create the form fields
     $code = new TEntry('id');
     $projeto_id = new TDBCombo('projeto_id', 'db_crmbf', 'Projeto', 'id', 'nome');
     $titulo = new TEntry('titulo');
     $data = new TEntry('data');
     $data->setEditable(false);
     $responsavel_id = new TDBCombo('responsavel_id', 'db_crmbf', 'user', 'id', 'name');
     $tempo = new TSpinner('tempo');
     $porcentagem = new TSlider('porcentagem');
     $descricao = new TText('descricao');
     $tipo_id = new TDBCombo('tipo_id', 'db_crmbf', 'Tipo', 'id', 'nome');
     $cliente_id = new TDBCombo('cliente_id', 'db_crmbf', 'Cliente', 'id', 'nome');
     $prioridade_id = new TDBCombo('prioridade_id', 'db_crmbf', 'Prioridade', 'id', 'nome');
     $status_id = new TDBCombo('status_id', 'db_crmbf', 'Status', 'id', 'nome');
     $usuarioalteracao = new THidden('usuarioalteracao');
     $solicitante = new TEntry('solicitante');
     // add field validators
     $titulo->addValidation('Nome', new TRequiredValidator());
     // $cidade_id->addValidation('Cidade', new TRequiredValidator);
     // $birthdate->addValidation('Birthdate', new TRequiredValidator);
     //        $cidade_id->addValidation('Category', new TRequiredValidator);
     //$obj = new CidadeFormList;
     //$cidade_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);
     $projeto_id->setSize(320);
     $titulo->setSize(320);
     $data->setSize(160);
     $data->setValue(date("d/m/Y H:i:s"));
     $responsavel_id->setSize(160);
     $tempo->setRange(0, 1000, 1);
     $tempo->setSize(160);
     $porcentagem->setRange(0, 100, 1);
     $porcentagem->setSize(150);
     $porcentagem->setTip('Porcentagem %');
     $descricao->setSize(320);
     $tipo_id->setSize(150);
     $cliente_id->setSize(150);
     $prioridade_id->setSize(150);
     $status_id->setSize(150);
     $solicitante->setSize(150);
     $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('Projeto:'));
     $cell = $row->addCell($projeto_id);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel('Titulo:'));
     $cell = $row->addCell($titulo);
     // add a row for the field Email
     $row = $table->addRow();
     $row->addCell(new TLabel('Data:'));
     $cell = $row->addCell($data);
     // add a row for the field Telefone
     $row = $table->addRow();
     $row->addCell(new TLabel('Responsavel:'));
     $cell = $row->addCell($responsavel_id);
     // add a row for the field celular
     $row = $table->addRow();
     $row->addCell(new TLabel('Tempo:'));
     $cell = $row->addCell($tempo);
     // add a row for the field skype
     $row = $table->addRow();
     $row->addCell(new TLabel('Porcentagem:'));
     $cell = $row->addCell($porcentagem);
     // add a row for the field endereco
     $row = $table->addRow();
     $row->addCell(new TLabel('Tipo:'));
     $row->addCell($tipo_id);
     // add a row for the field endereco
     $row = $table->addRow();
     $row->addCell(new TLabel('Cliente:'));
     $row->addCell($cliente_id);
     // add a row for the field endereco
     $row = $table->addRow();
     $row->addCell(new TLabel('Prioridade:'));
     $row->addCell($prioridade_id);
     // add a row for the field endereco
     $row = $table->addRow();
     $row->addCell(new TLabel('Solicitante:'));
     $row->addCell($solicitante);
     // add a row for the field endereco
     $row = $table->addRow();
     $row->addCell(new TLabel('Descrição:'));
     $row->addCell($descricao);
     // add a row for the field celular
     $row = $table->addRow();
     $row->addCell(new TLabel('Status:'));
     $cell = $row->addCell($status_id);
     // add a row for the field Category
     //        $row = $table_data->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $cell = $row->addCell($cidade_id);
     // add a row for the field city
     //        $row=$table_data->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $cell = $row->addCell($cidade_id);
     /*
             // add a row for the field Phone
             $row = $table_data->addRow();
             $row->addCell(new TLabel('Phone:'));
             $row->addCell($phone);
     
             // add a row for the field BirthDate
             $row->addCell(new TLabel('BirthDate:'));
             $row->addCell($birthdate);
     
             // add a row for the field status
             $row = $table_data->addRow();
             $row->addCell(new TLabel('Status:'));
             $cell = $row->addCell($status);
     
             // add a row for the field Email
             $row->addCell(new TLabel('Email:'));
             $cell = $row->addCell($email);
     
             // add a row for the field gender
             $row->addCell(new TLabel('Gender:'));
             $row->addCell($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('CRMList', 'onReload')), 'Ir para Listagem');
     $button2->setImage('ico_datagrid.gif');
     // define wich are the form fields
     $this->form->setFields(array($code, $projeto_id, $titulo, $data, $responsavel_id, $tempo, $porcentagem, $descricao, $tipo_id, $cliente_id, $prioridade_id, $status_id, $usuarioalteracao, $solicitante, $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);
 }
Exemple #15
0
 public static function categories($name = 'catid', $selected = '', $attribs = array())
 {
     require_once JPATH_ROOT . '/administrator/components/com_adsmanager/models/category.php';
     $model = new AdsmanagerModelCategory();
     $list = $model->getFlatTree(false);
     foreach ($list as $key => $cat) {
         $indent = "";
         for ($i = 0; $i < $cat->level; $i++) {
             $indent .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
         }
         if ($cat->level > 0) {
             $indent .= 'L&nbsp;';
         }
         $list[$key]->treename = $indent . TText::_($cat->name);
     }
     $options[] = JHTML::_('select.option', '', '- ' . sprintf(JText::_('ADSMANAGER_COMMON_SELECT'), JText::_('ADSMANAGER_CATEGORY')) . ' -');
     foreach ($list as $item) {
         $options[] = JHTML::_('select.option', $item->id, $item->treename);
     }
     $html = self::genericlist($options, $name, $attribs, $selected, $name);
     return $html;
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_FreqServForm');
     $this->form->class = 'tform';
     // creates the table container
     $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);
     $frame_horarios = new TFrame(NULL, 210);
     $frame_horarios->setLegend('Horários');
     $frame_horarios->style .= ';margin: 15px';
     $frame_ausencia = new TFrame(NULL, 210);
     $frame_ausencia->setLegend('Ausência');
     $frame_ausencia->style .= ';margin: 15px';
     // create the form fields
     $id = new TEntry('id');
     $servidor_id = new TDBSeekButton('servidor_id', 'lacenrh', 'form_FreqServForm', 'Servidor', 'servidor', 'servidor_id', 'servidor_nome');
     $servidor_nome = new TEntry('servidor_nome');
     $diames = new TDate('diames');
     $entrada = new TEntry('entrada');
     $intervalo_inicio = new TEntry('intervalo_inicio');
     $intervalo_fim = new TEntry('intervalo_fim');
     $saida = new TEntry('saida');
     $ausencia_id = new TDBSeekButton('ausencia_id', 'lacenrh', 'form_FreqServForm', 'Ausencia', 'ausencia', 'ausencia_id', 'ausencia_desc');
     $ausencia_desc = new TEntry('ausencia_desc');
     $horas_justificadas = new TEntry('horas_justificadas');
     $justificativa = new TText('justificativa');
     $horas_trabalhadas = new TEntry('horas_trabalhadas');
     // define the sizes
     $id->setSize(40);
     $servidor_id->setSize(40);
     $servidor_nome->setSize(300);
     $diames->setSize(100);
     $entrada->setSize(50);
     $intervalo_inicio->setSize(50);
     $intervalo_fim->setSize(50);
     $saida->setSize(50);
     $ausencia_id->setSize(40);
     $ausencia_desc->setSize(200);
     $horas_justificadas->setSize(50);
     $justificativa->setSize(200, 50);
     $horas_trabalhadas->setSize(200, 50);
     // outras propriedades
     $id->setEditable(false);
     $servidor_nome->setEditable(false);
     $diames->setMask('dd/mm/yyyy');
     $entrada->setMask('99:99');
     $entrada->setValue('00:00');
     $intervalo_inicio->setMask('99:99');
     $intervalo_inicio->setValue('00:00');
     $intervalo_fim->setMask('99:99');
     $intervalo_fim->setValue('00:00');
     $saida->setMask('99:99');
     $saida->setValue('00:00');
     $ausencia_desc->setEditable(false);
     $horas_justificadas->setMask('99:99');
     $horas_justificadas->setValue('00:00');
     $horas_trabalhadas->setMask('99:99');
     // validations
     $servidor_id->addValidation('Servidor', new TRequiredValidator());
     $servidor_nome->addValidation('Nome', new TRequiredValidator());
     $diames->addValidation('Data', new TRequiredValidator());
     $table_horarios = new TTable();
     $table_horarios->addRowSet(new TLabel('Data ' . ': '), $diames);
     $table_horarios->addRowSet(new TLabel('Entrada ' . ': '), $entrada);
     $table_horarios->addRowSet(new TLabel('Intervalo - Início ' . ': '), $intervalo_inicio);
     $table_horarios->addRowSet(new TLabel('Intervalo - Fim' . ': '), $intervalo_fim);
     $table_horarios->addRowSet(new TLabel('Saída' . ': '), $saida);
     $frame_horarios->add($table_horarios);
     $table_ausencia = new TTable();
     $table_ausencia->addRowSet(new TLabel('Motivo ' . ': '), $ausencia_id);
     $table_ausencia->addRowSet(new TLabel('Descrição ' . ': '), $ausencia_desc);
     $table_ausencia->addRowSet(new TLabel('Horas Justificadas ' . ': '), $horas_justificadas);
     $table_ausencia->addRowSet(new TLabel('Justificativa ' . ': '), $justificativa);
     $frame_ausencia->add($table_ausencia);
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('Servidor' . ': '), $servidor_id);
     $table->addRowSet(new TLabel('Nome' . ': '), $servidor_nome);
     $row = $table->addRow();
     $cell = $row->addCell($frame_horarios);
     $cell->colspan = 2;
     $cell = $row->addCell($frame_ausencia);
     $cell->colspan = 2;
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('fa:floppy-o fa-lg');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green fa-lg');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('FrequenciaServidorList', 'onReload')), _t('Back to the listing'));
     $list_button->setImage('fa:table blue fa-lg');
     // define the form fields
     $this->form->setFields(array($id, $servidor_id, $servidor_nome, $diames, $entrada, $intervalo_inicio, $intervalo_fim, $saida, $ausencia_id, $ausencia_desc, $horas_justificadas, $justificativa, $horas_trabalhadas, $save_button, $new_button, $list_button));
     $buttons = new THBox();
     $buttons->add($save_button);
     $buttons->add($new_button);
     $buttons->add($list_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 4;
     $container = new TTable();
     $container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'FrequenciaServidorList'));
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
Exemple #17
0
    function showFieldSearch($field, $catid, $default, $force = false)
    {
        $default = (object) $default;
        if (isset($default)) {
            $fieldname = $field->name;
            $value = @$default->{$fieldname};
        } else {
            $value = null;
        }
        $options = $field->options;
        $values = array();
        if (!isset($options) || !isset($options->select_values_storage_type) || $options->select_values_storage_type == "internal") {
            if (@$this->field_values[$field->fieldid]) {
                $values = $this->field_values[$field->fieldid];
            }
        } else {
            if ($options->select_values_storage_type == "db") {
                $dbname = $options->select_db_storage_db_name;
                $_name = $options->select_db_storage_column_name;
                $_value = $options->select_db_storage_column_value;
                //$parent = $options->select_db_storage_column_parent_value;
                $sql = "SELECT `{$_name}` as fieldtitle,`{$_value}` as fieldvalue FROM {$dbname}";
                $this->_db->setQuery($sql);
                $values = $this->_db->loadObjectList();
            }
        }
        if (!isset($options)) {
            $options = new stdClass();
        }
        foreach ($values as $key => $val) {
            $values[$key]->fieldtitle = htmlspecialchars(TText::_($val->fieldtitle));
        }
        if ($force == true || strpos($field->catsid, ",{$catid},") !== false || strpos($field->catsid, ",-1,") !== false) {
            $placeholder = JText::_('ADSMANAGER_SEARCH_PLACEHOLDER_' . strtoupper($field->name));
            if ($placeholder == 'ADSMANAGER_SEARCH_PLACEHOLDER_' . strtoupper($field->name)) {
                $placeholder = "";
            }
            switch ($field->type) {
                case 'checkbox':
                    if ($value == 1) {
                        echo "<input class='inputbox' type='checkbox' name='" . $field->name . "' value='1' checked='checked' />\n";
                    } else {
                        echo "<input class='inputbox' type='checkbox' name='" . $field->name . "' value='1' />\n";
                    }
                    break;
                case 'radio':
                case 'multicheckbox':
                    if (!is_array($value)) {
                        $value = array($value);
                    }
                    echo "<table class='cbMulti'>\n";
                    $k = 0;
                    for ($i = 0; $i < $field->rows; $i++) {
                        echo "<tr>\n";
                        for ($j = 0; $j < $field->cols; $j++) {
                            $fieldvalue = @$values[$k]->fieldvalue;
                            $fieldtitle = @$values[$k]->fieldtitle;
                            if (isset($fieldtitle)) {
                                $fieldtitle = TText::_($fieldtitle);
                            }
                            echo "<td>\n";
                            if (isset($values[$k])) {
                                if (!in_array($fieldvalue, $value)) {
                                    echo "<input class='inputbox' type='checkbox' id='" . $field->name . "' name='" . $field->name . "[]' value=\"" . htmlspecialchars($fieldvalue) . "\" />&nbsp;{$fieldtitle}&nbsp;\n";
                                } else {
                                    echo "<input class='inputbox' type='checkbox' id='" . $field->name . "' checked='checked' name='" . $field->name . "[]' value=\"" . htmlspecialchars($fieldvalue) . "\" />&nbsp;{$fieldtitle}&nbsp;\n";
                                }
                            }
                            echo "</td>\n";
                            $k++;
                        }
                        echo "</tr>\n";
                    }
                    echo "</table>\n";
                    break;
                case 'select':
                    if (ADSMANAGER_SPECIAL == "abrivac" && $field->name == "ad_type") {
                        $value = @$default->ad_type;
                        foreach ($values as $v) {
                            $ftitle = $v->fieldtitle;
                            $fieldvalue = $v->fieldvalue;
                            //var_dump($fieldvalue,$value);
                            if (!is_array($value)) {
                                $value = array();
                            }
                            echo "<div class='champ_filtre_checkbox'>";
                            if (in_array($fieldvalue, $value)) {
                                echo "<input class='inputbox' type='checkbox' name='" . $field->name . "[]' checked='checked' value=\"" . htmlspecialchars($fieldvalue) . "\" />&nbsp;{$ftitle}&nbsp;\n";
                            } else {
                                echo "<input class='inputbox' type='checkbox' name='" . $field->name . "[]' value=\"" . htmlspecialchars($fieldvalue) . "\" />&nbsp;{$ftitle}&nbsp;\n";
                            }
                            echo "</div>";
                        }
                    } else {
                        echo "<select id='" . $field->name . "' name='" . $field->name . "'>\n";
                        echo "<option value='' >" . $placeholder . "</option>\n";
                        foreach ($values as $v) {
                            $ftitle = $v->fieldtitle;
                            if ($value == $v->fieldvalue || $value == $ftitle) {
                                echo "<option value=\"" . htmlspecialchars($v->fieldvalue) . "\" selected='selected' >{$ftitle}</option>\n";
                            } else {
                                echo "<option value=\"" . htmlspecialchars($v->fieldvalue) . "\" >{$ftitle}</option>\n";
                            }
                        }
                        echo "</select>\n";
                    }
                    break;
                case 'multiselect':
                    echo "<select name=\"" . $field->name . "[]\" multiple='multiple' size='{$field->size}'>\n";
                    foreach ($values as $v) {
                        $ftitle = $v->fieldtitle;
                        if ($field->required == 1) {
                            $mosReq = "mosReq='1'";
                        }
                        if (strpos($value, "," . $v->fieldvalue . ",") === false && strpos($value, $ftitle . "|*|") === false && strpos($value, "|*|" . $ftitle) === false && $value != $ftitle) {
                            echo "<option value=\"" . htmlspecialchars($v->fieldvalue) . "\" >{$ftitle}</option>\n";
                        } else {
                            echo "<option value=\"" . htmlspecialchars($v->fieldvalue) . "\" selected='selected' >{$ftitle}</option>\n";
                        }
                    }
                    echo "</select>\n";
                    break;
                case 'price':
                case 'number':
                    if (!isset($options->search_type)) {
                        $options->search_type = "textfield";
                    }
                    if (isset($default)) {
                        $fieldname = $field->name . "_min";
                        $minvalue = @$default->{$fieldname};
                        $fieldname = $field->name . "_max";
                        $maxvalue = @$default->{$fieldname};
                    }
                    switch ($options->search_type) {
                        case "textfield":
                            echo "<input name='" . $field->name . "' placeholder=\"" . htmlspecialchars($placeholder) . "\" id='" . $field->name . "' value=\"" . htmlspecialchars($value) . "\" maxlength='{$field->maxlength}' class='inputbox' type='text' size='{$field->size}' />";
                            break;
                        case "select":
                            echo "<select id='" . $field->name . "' name='" . $field->name . "'>\n";
                            echo "<option value='' >" . htmlspecialchars($placeholder) . "</option>\n";
                            foreach ($values as $v) {
                                $ftitle = TText::_($v->fieldtitle);
                                if ($value == $v->fieldvalue) {
                                    echo "<option value=\"" . htmlspecialchars($v->fieldvalue) . "\" selected='selected'>{$ftitle}</option>\n";
                                } else {
                                    echo "<option value=\"" . htmlspecialchars($v->fieldvalue) . "\" >{$ftitle}</option>\n";
                                }
                            }
                            echo "</select>\n";
                            break;
                        case "minmax":
                            echo JText::_('ADSMANAGER_MINMAX_MIN') . "<input name='" . $field->name . "_min' id='" . $field->name . "_min' value=\"" . htmlspecialchars($minvalue) . "\" maxlength='{$field->maxlength}' class='inputbox' type='text' size='{$field->size}' />";
                            echo "&nbsp;" . JText::_('ADSMANAGER_MINMAX_MAX') . "<input name='" . $field->name . "_max' id='" . $field->name . "_max' value=\"" . htmlspecialchars($maxvalue) . "\" maxlength='{$field->maxlength}' class='inputbox' type='text' size='{$field->size}' />";
                            break;
                    }
                    break;
                case 'editor':
                case 'textarea':
                case 'emailaddress':
                case 'url':
                case 'text':
                    if (ADSMANAGER_SPECIAL == "abrivac" && ($field->name == "ad_capaciteconf" || $field->name == "ad_capacitemax")) {
                        ?>
						<select name="<?php 
                        echo $field->name;
                        ?>
">
							<option value="" <?php 
                        if ($value == "") {
                            echo 'selected="selected"';
                        }
                        ?>
></option>
                            <option value="1" <?php 
                        if ($value == 1) {
                            echo 'selected="selected"';
                        }
                        ?>
>1 <?php 
                        echo TText::_('ADSMANAGER_PERSONNE');
                        ?>
</option>
							<option value="2" <?php 
                        if ($value == 2) {
                            echo 'selected="selected"';
                        }
                        ?>
>2 <?php 
                        echo TText::_('ADSMANAGER_PERSONNES');
                        ?>
</option>
							<option value="3" <?php 
                        if ($value == 3) {
                            echo 'selected="selected"';
                        }
                        ?>
>3 <?php 
                        echo TText::_('ADSMANAGER_PERSONNES');
                        ?>
</option>
							<option value="4" <?php 
                        if ($value == 4) {
                            echo 'selected="selected"';
                        }
                        ?>
>4 <?php 
                        echo TText::_('ADSMANAGER_PERSONNES');
                        ?>
</option>
							<option value="5" <?php 
                        if ($value == 5) {
                            echo 'selected="selected"';
                        }
                        ?>
>5 <?php 
                        echo TText::_('ADSMANAGER_PERSONNES');
                        ?>
</option>
                            <option value="6" <?php 
                        if ($value == 6) {
                            echo 'selected="selected"';
                        }
                        ?>
>6 <?php 
                        echo TText::_('ADSMANAGER_PERSONNES');
                        ?>
</option>
							<option value="7" <?php 
                        if ($value == 7) {
                            echo 'selected="selected"';
                        }
                        ?>
>7 <?php 
                        echo TText::_('ADSMANAGER_PERSONNES');
                        ?>
</option>
							<option value="8" <?php 
                        if ($value == 8) {
                            echo 'selected="selected"';
                        }
                        ?>
>8 <?php 
                        echo TText::_('ADSMANAGER_PERSONNES');
                        ?>
</option>
						</select>
						<?php 
                    } else {
                        echo "<input name='" . $field->name . "' id='" . $field->name . "' placeholder=\"" . htmlspecialchars($placeholder) . "\" value=\"" . htmlspecialchars($value) . "\" maxlength='{$field->maxlength}' class='inputbox' type='text' size='{$field->size}' />";
                    }
                    break;
                case 'date':
                    $options = array();
                    $options['size'] = 25;
                    echo JHTML::_('behavior.calendar');
                    echo JHTML::_('calendar', '', "{$field->name}", "{$field->name}", TText::_('ADSMANAGER_DATE_FORMAT_LC'), $options);
                    break;
                default:
                    if (isset($this->plugins[$field->type])) {
                        if (method_exists($this->plugins[$field->type], "getSearchFormDisplay")) {
                            echo $this->plugins[$field->type]->getSearchFormDisplay($default, $field);
                        } else {
                            echo $this->plugins[$field->type]->getFormDisplay($default, $field);
                        }
                    }
            }
        }
    }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_Sale');
     $this->form->class = 'tform';
     // CSS class
     parent::include_css('app/resources/custom-frame.css');
     $table_master = new TTable();
     $table_master->width = '100%';
     $table_master->addRowSet(new TLabel('Sale'), '', '')->class = 'tformtitle';
     // add a table inside form
     $table_general = new TTable();
     $table_general->width = '100%';
     $tableProduct = new TTable();
     $tableProduct->width = '100%';
     $frame_general = new TFrame();
     $frame_general->setLegend('General data');
     $frame_general->style = 'background:whiteSmoke';
     $frame_general->add($table_general);
     $table_master->addRow()->addCell($frame_general)->colspan = 2;
     $row = $table_master->addRow();
     $row->addCell($tableProduct);
     $this->form->add($table_master);
     // master fields
     $id = new TEntry('id');
     $date = new TDate('date');
     $customer_id = new TDBSeekButton('customer_id', 'samples', $this->form->getName(), 'Customer', 'name', 'customer_id', 'customer_name');
     $customer_name = new TEntry('customer_name');
     $obs = new TText('obs');
     // detail fields
     $product_id = new TDBSeekButton('product_id', 'samples', $this->form->getName(), 'Product', 'description', 'product_id', 'product_name');
     $product_name = new TEntry('product_name');
     $sale_price = new TEntry('product_price');
     $amount = new TEntry('product_amount');
     $discount = new TEntry('product_discount');
     $total = new TEntry('product_total');
     $product_id->setExitAction(new TAction(array($this, 'onProductChange')));
     $id->setSize(40);
     $date->setSize(100);
     $obs->setSize(400, 100);
     $product_id->setSize(50);
     $customer_id->setSize(50);
     $id->setEditable(false);
     $product_name->setEditable(false);
     $customer_name->setEditable(false);
     $date->addValidation('Date', new TRequiredValidator());
     $customer_id->addValidation('Customer', new TRequiredValidator());
     // pedido
     $table_general->addRowSet(new TLabel('ID'), $id);
     $table_general->addRowSet($label_date = new TLabel('Date (*)'), $date);
     $table_general->addRowSet($label_customer = new TLabel('Customer (*)'), array($customer_id, $customer_name));
     $table_general->addRowSet(new TLabel('Obs'), $obs);
     $label_date->setFontColor('#FF0000');
     // products
     $frame_product = new TFrame();
     $frame_product->setLegend('Products');
     $row = $tableProduct->addRow();
     $row->addCell($frame_product);
     $add_product = new TButton('add_product');
     $action_product = new TAction(array($this, 'onProductAdd'));
     $add_product->setAction($action_product, 'Register');
     $add_product->setImage('fa:save');
     $subtable_product = new TTable();
     $frame_product->add($subtable_product);
     $subtable_product->addRowSet($label_product = new TLabel('Product (*)'), array($product_id, $product_name));
     $subtable_product->addRowSet($label_sale_price = new TLabel('Price (*)'), $sale_price);
     $subtable_product->addRowSet($label_amount = new TLabel('Amount(*)'), $amount);
     $subtable_product->addRowSet(new TLabel('Discount'), $discount);
     $subtable_product->addRowSet($add_product);
     $label_product->setFontColor('#FF0000');
     $label_amount->setFontColor('#FF0000');
     $label_sale_price->setFontColor('#FF0000');
     $this->product_list = new TQuickGrid();
     $this->product_list->setHeight(175);
     $this->product_list->makeScrollable();
     $this->product_list->disableDefaultClick();
     $this->product_list->addQuickColumn('', 'edit', 'left', 50);
     $this->product_list->addQuickColumn('', 'delete', 'left', 50);
     $this->product_list->addQuickColumn('ID', 'product_id', 'center', 40);
     $this->product_list->addQuickColumn('Product', 'product_name', 'left', 200);
     $this->product_list->addQuickColumn('Amount', 'product_amount', 'left', 60);
     $this->product_list->addQuickColumn('Price', 'product_price', 'right', 80);
     $this->product_list->addQuickColumn('Discount', 'product_discount', 'right', 80);
     $this->product_list->createModel();
     $row = $tableProduct->addRow();
     $row->addCell($this->product_list);
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('ico_save.png');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onClear')), _t('New'));
     $new_button->setImage('ico_new.png');
     // define form fields
     $this->formFields = array($id, $date, $customer_id, $customer_name, $obs, $product_id, $product_name, $sale_price, $amount, $discount, $total, $add_product, $save_button, $new_button);
     $this->form->setFields($this->formFields);
     $table_master->addRowSet(array($save_button, $new_button), '', '')->class = 'tformaction';
     // CSS class
     // create the page container
     $container = new TVBox();
     $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->add($this->form);
     parent::add($container);
 }
 /**
  * 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);
 }
Exemple #20
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // security check
     TTransaction::open('library');
     if (User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'LIBRARIAN') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // creates the form
     $this->form = new TForm('form_Book');
     // creates a table
     $table1 = new TTable();
     $table2 = new TTable();
     $table3 = new TTable();
     $notebook = new TNotebook(550, 400);
     $notebook->appendPage(_t('Basic data'), $table1);
     $notebook->appendPage(_t('Secundary data'), $table2);
     $notebook->appendPage(_t('Items'), $table3);
     // add the table inside the form
     $this->form->add($notebook);
     // create the form fields
     $id = new TEntry('id');
     $title = new TEntry('title');
     $isbn = new TEntry('isbn');
     $call_number = new TEntry('call_number');
     $author_id = new TSeekButton('author_id');
     $author_name = new TEntry('author_name');
     $edition = new TEntry('edition');
     $volume = new TEntry('volume');
     $collection_id = new TDBCombo('collection_id', 'library', 'Collection', 'id', 'description');
     $classification_id = new TDBCombo('classification_id', 'library', 'Classification', 'id', 'description');
     $publisher_id = new TSeekButton('publisher_id');
     $publisher_name = new TEntry('publisher_name');
     $publish_place = new TEntry('publish_place');
     $publish_date = new TDate('publish_date');
     $abstract = new TText('abstract');
     $notes = new TText('notes');
     $obj = new TStandardSeek();
     $action = new TAction(array($obj, 'onSetup'));
     $action->setParameter('database', 'library');
     $action->setParameter('parent', 'form_Book');
     $action->setParameter('model', 'Publisher');
     $action->setParameter('display_field', 'name');
     $action->setParameter('receive_key', 'publisher_id');
     $action->setParameter('receive_field', 'publisher_name');
     $publisher_id->setAction($action);
     $obj = new TStandardSeek();
     $action = new TAction(array($obj, 'onSetup'));
     $action->setParameter('database', 'library');
     $action->setParameter('parent', 'form_Book');
     $action->setParameter('model', 'Author');
     $action->setParameter('display_field', 'name');
     $action->setParameter('receive_key', 'author_id');
     $action->setParameter('receive_field', 'author_name');
     $author_id->setAction($action);
     // define the sizes
     $id->setSize(100);
     $title->setSize(340);
     $isbn->setSize(120);
     $call_number->setSize(120);
     $author_id->setSize(100);
     $edition->setSize(120);
     $volume->setSize(120);
     $collection_id->setSize(100);
     $classification_id->setSize(100);
     $publisher_id->setSize(100);
     $publish_place->setSize(140);
     $publish_date->setSize(100);
     $abstract->setSize(400, 40);
     $notes->setSize(400, 40);
     $id->setEditable(FALSE);
     $publisher_name->setEditable(FALSE);
     $author_name->setEditable(FALSE);
     // add a row for the field id
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Code')));
     $cell = $row->addCell($id);
     $cell->colspan = 3;
     // add a row for the field title
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Title')));
     $cell = $row->addCell($title);
     $cell->colspan = 3;
     // add a row for the field isbn/call_nuber
     $row = $table1->addRow();
     $row->addCell(new TLabel('ISBN' . ': '));
     $row->addCell($isbn);
     $row->addCell(new TLabel(_t('Call')));
     $row->addCell($call_number);
     // add a row for the field author_id
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Author') . ': '));
     $row->addCell($author_id);
     $row->addCell(new TLabel(_t('Name') . ': '));
     $row->addCell($author_name);
     // add a row for the field edition/volume
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Edition') . ': '));
     $row->addCell($edition);
     $row->addCell(new TLabel(_t('Volume') . ': '));
     $row->addCell($volume);
     // add a row for the field collection_id/classification_id
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Collection') . ': '));
     $row->addCell($collection_id);
     $row->addCell(new TLabel(_t('Classification') . ': '));
     $row->addCell($classification_id);
     // add a row for the field publisher_id
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Publisher') . ': '));
     $row->addCell($publisher_id);
     $row->addCell(new TLabel(_t('Name') . ': '));
     $row->addCell($publisher_name);
     // add a row for the field publish_place
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Place') . ': '));
     $row->addCell($publish_place);
     $row->addCell(new TLabel(_t('Date') . ': '));
     $row->addCell($publish_date);
     // add a row for the field abstract
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Abstract') . ': '));
     $cell = $row->addCell($abstract);
     $cell->colspan = 3;
     // add a row for the field notes
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Notes') . ': '));
     $cell = $row->addCell($notes);
     $cell->colspan = 3;
     // secundary authors
     $authors = new TMultiField('author_list');
     $sub_author_id = new TSeekButton('id');
     $sub_author_name = new TEntry('name');
     $sub_author_name->setEditable(FALSE);
     $sub_author_id->setSize(50);
     $sub_author_name->setSize(300);
     $obj = new TStandardSeek();
     $action = new TAction(array($obj, 'onSetup'));
     $action->setParameter('database', 'library');
     $action->setParameter('parent', 'form_Book');
     $action->setParameter('model', 'Author');
     $action->setParameter('display_field', 'name');
     $action->setParameter('receive_key', 'author_list_id');
     $action->setParameter('receive_field', 'author_list_name');
     $sub_author_id->setAction($action);
     $authors->setHeight(80);
     $authors->setClass('Author');
     $authors->addField('id', _t('Author'), $sub_author_id, 50);
     $authors->addField('name', _t('Name'), $sub_author_name, 300);
     $row = $table2->addRow();
     $row->addCell($l = new TLabel(_t('Authors')));
     $l->setFontStyle('b');
     $row = $table2->addRow();
     $row->addCell($authors);
     // secundary subjects
     $subjects = new TMultiField('subject_list');
     $sub_subject_id = new TSeekButton('id');
     $sub_subject_name = new TEntry('name');
     $sub_subject_name->setEditable(FALSE);
     $sub_subject_id->setSize(50);
     $sub_subject_name->setSize(300);
     $obj = new TStandardSeek();
     $action = new TAction(array($obj, 'onSetup'));
     $action->setParameter('database', 'library');
     $action->setParameter('parent', 'form_Book');
     $action->setParameter('model', 'Subject');
     $action->setParameter('display_field', 'name');
     $action->setParameter('receive_key', 'subject_list_id');
     $action->setParameter('receive_field', 'subject_list_name');
     $sub_subject_id->setAction($action);
     $subjects->setHeight(80);
     $subjects->setClass('Subject');
     $subjects->addField('id', _t('Subject'), $sub_subject_id, 50);
     $subjects->addField('name', _t('Name'), $sub_subject_name, 300);
     $row = $table2->addRow();
     $row->addCell($l = new TLabel(_t('Subjects')));
     $l->setFontStyle('b');
     $row = $table2->addRow();
     $row->addCell($subjects);
     // items
     $items = new TMultiField('item_list');
     $item_barcode = new TEntry('barcode');
     $item_status_id = new TComboCombined('status_id', 'status_description');
     $item_cost = new TEntry('cost');
     $item_acquire_date = new TDate('acquire_date');
     $item_notes = new TEntry('notes');
     $item_status_id->setSize(150);
     $item_cost->setSize(100);
     $item_acquire_date->setSize(100);
     TTransaction::open('library');
     $rep = new TRepository('Status');
     $objects = $rep->load(new TCriteria());
     $options = array();
     if ($objects) {
         foreach ($objects as $object) {
             $options[$object->id] = $object->description;
         }
     }
     $item_status_id->addItems($options);
     TTransaction::close();
     $items->setHeight(140);
     $items->setClass('Item');
     $items->addField('barcode', _t('Barcode'), $item_barcode, 80);
     $items->addField('status_id', _t('Status'), $item_status_id, 100);
     $items->addField('cost', _t('Cost'), $item_cost, 80);
     $items->addField('acquire_date', _t('Acquire date'), $item_acquire_date, 80);
     $items->addField('notes', _t('Notes'), $item_notes, 150);
     $row = $table3->addRow();
     $row->addCell($l = new TLabel(_t('Items')));
     $l->setFontStyle('b');
     $row = $table3->addRow();
     $row->addCell($items);
     // 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');
     // add a row for the form action
     $row = $table1->addRow();
     $row->addCell($save_button);
     // define wich are the form fields
     $this->form->setFields(array($id, $title, $isbn, $call_number, $author_id, $author_name, $edition, $volume, $collection_id, $classification_id, $publisher_id, $publisher_name, $publish_place, $publish_date, $abstract, $notes, $authors, $subjects, $items, $save_button));
     // add the form to the page
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the notebook
     $notebook = new TNotebook(620, 410);
     // create the form
     $this->form = new TForm();
     // creates the notebook page
     $table = new TTable();
     // add the notebook inside the form
     $this->form->add($table);
     // adds the notebook page
     $notebook->appendPage('Input elements', $this->form);
     // create the form fields
     $field1 = new TEntry('field1');
     $field2 = new TEntry('field2');
     $field3 = new TEntry('field3');
     $field4 = new TEntry('field4');
     $field5 = new TEntry('field5');
     $field6 = new TPassword('field6');
     $field7 = new TDate('field7');
     $field8 = new TSpinner('field8');
     $field9 = new TSlider('field9');
     $field10 = new TText('field10');
     $field1->setTip('Tip for field 1');
     $field2->setTip('Tip for field 2');
     $field3->setTip('Tip for field 3');
     $field4->setTip('Tip for field 4');
     $field5->setTip('Tip for field 5');
     $field6->setTip('Tip for field 6');
     $field7->setTip('Tip for field 7');
     $field8->setTip('Tip for field 8');
     $field9->setTip('Tip for field 9');
     $field10->setTip('Tip for field 10');
     $field2->setValue('123');
     $field2->setEditable(FALSE);
     $field3->setMask('99.999-999');
     $field4->setMaxLength(10);
     $field5->setCompletion(array('Allen', 'Albert', 'Alberto', 'Alladin'));
     $field7->setSize(100);
     $field8->setRange(0, 100, 10);
     $field9->setRange(0, 100, 10);
     $field8->setValue(30);
     $field9->setValue(50);
     $field10->setSize(300, 80);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TEntry object:'));
     $cell = $row->addCell($field1);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TEntry not editable:'));
     $cell = $row->addCell($field2);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TEntry with mask:'));
     $cell = $row->addCell($field3);
     $cell = $row->addCell(new TLabel('99.999-999'));
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TEntry with maxlength (10):'));
     $cell = $row->addCell($field4);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TEntry with completion (a..):'));
     $cell = $row->addCell($field5);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TPassword object:'));
     $cell = $row->addCell($field6);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TDate Object:'));
     $cell = $row->addCell($field7);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('Spinner Object:'));
     $cell = $row->addCell($field8);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('Slider Object:'));
     $cell = $row->addCell($field9);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TText Object:'));
     $cell = $row->addCell($field10);
     // creates the action button
     $button1 = new TButton('action1');
     // define the button action
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     // define wich are the form fields
     $this->form->setFields(array($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9, $field10, $button1));
     // add a row for the button
     $row = $table->addRow();
     $row->addCell($button1);
     // add the form inside the page
     parent::add($notebook);
 }
Exemple #22
0
	function showFieldSearch($field,$catid,$default,$force=false)
	{
		$default = (object) $default;
		
		if (isset($default))
		{
			$fieldname = $field->name;
			$value = @$default->$fieldname;
		} else {
			$value = null;
		}
		
		$options = $field->options;
        //We initialize the placeholder if they exist, if not we let it empty
        if(isset($options->placeholder_search) && $options->placeholder_search != ""){
            $placeholder = htmlspecialchars($options->placeholder_search);
        } else {
            $placeholder = "";
        }
		$values = array();
		if ((!isset($options))||
			(!isset($options->select_values_storage_type))||
			($options->select_values_storage_type == "internal")) {
			if (@$this->field_values[$field->fieldid]) {
				$values = $this->field_values[$field->fieldid];
			}
		} else if ($options->select_values_storage_type == "db") {
			$dbname = $options->select_db_storage_db_name;
			$_name = $options->select_db_storage_column_name;
			$_value = $options->select_db_storage_column_value;
			//$parent = $options->select_db_storage_column_parent_value;
			$sql = "SELECT `$_name` as fieldtitle,`$_value` as fieldvalue FROM $dbname";
			$this->_db->setQuery($sql);
			$values = $this->_db->loadObjectList();
		}
		if (!isset($options)){
			$options = new stdClass();
		}

		foreach($values as $key => $val) {
				$values[$key]->fieldtitle = htmlspecialchars(TText::_($val->fieldtitle));
		}
		
		if (($force==true) ||(strpos($field->catsid, ",$catid,") !== false)||(strpos($field->catsid, ",-1,") !== false))
		{
			if(isset($options->searchtype_render)&&$options->searchtype_render != "") {
				$field->type = $options->searchtype_render;
			}
			
			switch($field->type)
			{
				case 'checkbox':
					if ($value == 1)
						echo "<input class='inputbox' type='checkbox' name='".$field->name."' value='1' checked='checked' />\n";
					else
						echo "<input class='inputbox' type='checkbox' name='".$field->name."' value='1' />\n";
					break;
				case 'radio':
                case 'radioimage':
				case 'multicheckbox':
					if (!is_array($value)) {
						$value = array($value);
					}
                    $k = 0;
                    echo "<table class='cbMulti'>\n";
                    for ($i=0 ; $i < $field->rows;$i++)
                    {
                        echo "<tr>\n";
                        for ($j=0 ; $j < $field->cols;$j++)
                        {
                            echo "<td>\n";
                            $fieldvalue = @$values[$k]->fieldvalue;
                            $fieldtitle = @$values[$k]->fieldtitle;
                            if ($field->type != 'radioimage') {
                                if (isset($fieldtitle))
                                    $fieldtitle=TText::_($fieldtitle);
                            }
                            else
                            {
                                $fieldtitle="<img src=\"{$this->baseurl}images/com_adsmanager/fields/$fieldtitle\" alt=\"$fieldtitle\" />";
                            } 
                            if (isset($values[$k])) {
                                echo "<label>\n";
                                if (!in_array($fieldvalue,$value))
									echo "<input type='checkbox' id='".$field->name."' name='".$field->name."[]' value=\"".htmlspecialchars($fieldvalue)."\" />&nbsp;$fieldtitle&nbsp;\n";
								else
									echo "<input type='checkbox' id='".$field->name."' checked='checked' name='".$field->name."[]' value=\"".htmlspecialchars($fieldvalue)."\" />&nbsp;$fieldtitle&nbsp;\n";
                                echo "</label>\n";
                            }
                            $k++;
                            echo "</td>\n";
                        }
                        echo "</tr>\n";
                    }
                    echo "</table>\n";
					break;

				case 'select':
					if ((ADSMANAGER_SPECIAL == "abrivac")&&($field->name == "ad_type")) {
						$value = @$default->ad_type;
						foreach($values as $v)
						{
							$ftitle = $v->fieldtitle;
							$fieldvalue = $v->fieldvalue;
							//var_dump($fieldvalue,$value);
							if (!is_array($value))
								$value = array();
							echo "<div class='champ_filtre_checkbox'>";
							if (in_array($fieldvalue,$value))
								echo "<input class='inputbox' type='checkbox' name='".$field->name."[]' checked='checked' value=\"".htmlspecialchars($fieldvalue)."\" />&nbsp;$ftitle&nbsp;\n";
							else
								echo "<input class='inputbox' type='checkbox' name='".$field->name."[]' value=\"".htmlspecialchars($fieldvalue)."\" />&nbsp;$ftitle&nbsp;\n";
							echo "</div>";
						}						
					} else {
						echo "<select id='".$field->name."' name='".$field->name."'>\n";
						echo "<option value='' >".$placeholder."</option>\n";	
						foreach($values as $v)
						{
							$ftitle = $v->fieldtitle;
							if (($value == $v->fieldvalue)||($value == $ftitle))
								echo "<option value=\"".htmlspecialchars($v->fieldvalue)."\" selected='selected' >$ftitle</option>\n";
							else
								echo "<option value=\"".htmlspecialchars($v->fieldvalue)."\" >$ftitle</option>\n";
						}
					
						echo "</select>\n";
					}
					break;
				
				case 'multiselect':
				
					echo "<select name=\"".$field->name."[]\" multiple='multiple' size='$field->size'>\n";	
					foreach($values as $v)
					{
						$ftitle = $v->fieldtitle;
						if ($field->required == 1)
							$mosReq = "required";
							
						if ((strpos($value, ",".$v->fieldvalue.",") === false) &&
							(strpos($value, $ftitle."|*|") === false) &&
							(strpos($value, "|*|".$ftitle) === false) &&
							($value !=  $ftitle))
							echo "<option value=\"".htmlspecialchars($v->fieldvalue)."\" >$ftitle</option>\n";
						else
							echo "<option value=\"".htmlspecialchars($v->fieldvalue)."\" selected='selected' >$ftitle</option>\n";
					}
					
					echo "</select>\n";
					break;
					
				case 'price':
				case 'number':
					if (!isset($options->search_type)) {
						$options->search_type = "textfield";
					}
					if (isset($default))
					{
						$fieldname = $field->name."_min";
						$minvalue = @$default->$fieldname;
						
						$fieldname = $field->name."_max";
						$maxvalue = @$default->$fieldname;
					}
					switch($options->search_type) {
						case "textfield":
							echo "<input name='".$field->name."' placeholder=\"".$placeholder."\" id='".$field->name."' value=\"".htmlspecialchars($value)."\" maxlength='$field->maxlength' class='inputbox' type='text' size='$field->size' />";
							break;
							
						case "select":
							echo "<select id='".$field->name."' name='".$field->name."'>\n";
							echo "<option value='' >".$placeholder."</option>\n";
							foreach($values as $v)
							{
								$ftitle = TText::_($v->fieldtitle);
								if ($value == $v->fieldvalue)
									echo "<option value=\"".htmlspecialchars($v->fieldvalue)."\" selected='selected'>$ftitle</option>\n";
								else
									echo "<option value=\"".htmlspecialchars($v->fieldvalue)."\" >$ftitle</option>\n";
							}
								
							echo "</select>\n";
							break;
						case "minmax":
                            if($placeholder != '') {
                                $placeholder = explode(',',$placeholder);
                                echo "<input name='".$field->name."_min' id='".$field->name."_min' value=\"".htmlspecialchars($minvalue)."\" maxlength='$field->maxlength' class='inputbox' placeholder='".$placeholder[0]."' type='text' size='$field->size' />";
                                echo "<input name='".$field->name."_max' id='".$field->name."_max' value=\"".htmlspecialchars($maxvalue)."\" maxlength='$field->maxlength' class='inputbox' placeholder='".$placeholder[1]."' type='text' size='$field->size' />";
                            } else {
                                echo JText::_('ADSMANAGER_MINMAX_MIN')."<input name='".$field->name."_min' id='".$field->name."_min' value=\"".htmlspecialchars($minvalue)."\" maxlength='$field->maxlength' class='inputbox' type='text' size='$field->size' />";
                                echo "&nbsp;".JText::_('ADSMANAGER_MINMAX_MAX')."<input name='".$field->name."_max' id='".$field->name."_max' value=\"".htmlspecialchars($maxvalue)."\" maxlength='$field->maxlength' class='inputbox' type='text' size='$field->size' />";
                            }
                            break;
					}
					break;
					
				case 'editor':
				case 'textarea':
				case 'emailaddress':
				case 'url':
				case 'text':
					if ((ADSMANAGER_SPECIAL == "abrivac")&&(($field->name == "ad_capaciteconf")||($field->name == "ad_capacitemax"))) {
						?>
						<select name="<?php echo $field->name;?>">
							<option value="" <?php if ($value=="") echo 'selected="selected"';?>></option>
                            <option value="1" <?php if ($value==1) echo 'selected="selected"';?>>1 <?php echo TText::_('ADSMANAGER_PERSONNE') ?></option>
							<option value="2" <?php if ($value==2) echo 'selected="selected"';?>>2 <?php echo TText::_('ADSMANAGER_PERSONNES') ?></option>
							<option value="3" <?php if ($value==3) echo 'selected="selected"';?>>3 <?php echo TText::_('ADSMANAGER_PERSONNES') ?></option>
							<option value="4" <?php if ($value==4) echo 'selected="selected"';?>>4 <?php echo TText::_('ADSMANAGER_PERSONNES') ?></option>
							<option value="5" <?php if ($value==5) echo 'selected="selected"';?>>5 <?php echo TText::_('ADSMANAGER_PERSONNES') ?></option>
                            <option value="6" <?php if ($value==6) echo 'selected="selected"';?>>6 <?php echo TText::_('ADSMANAGER_PERSONNES') ?></option>
							<option value="7" <?php if ($value==7) echo 'selected="selected"';?>>7 <?php echo TText::_('ADSMANAGER_PERSONNES') ?></option>
							<option value="8" <?php if ($value==8) echo 'selected="selected"';?>>8 <?php echo TText::_('ADSMANAGER_PERSONNES') ?></option>
						</select>
						<?php
					} else {
						echo "<input name='".$field->name."' id='".$field->name."' placeholder=\"".$placeholder."\" value=\"".htmlspecialchars($value)."\" maxlength='$field->maxlength' class='inputbox' type='text' size='$field->size' />";
					}
					break;
					
				case 'date':
					$options = array();
					$options['size'] = 25;
					echo JHTML::_('behavior.calendar');
					echo JHTML::_('calendar', '', "$field->name", "$field->name", TText::_('ADSMANAGER_DATE_FORMAT_LC'), $options);
					break;

				default:
					if(isset($this->plugins[$field->type]))
					{
						if (method_exists($this->plugins[$field->type],"getSearchFormDisplay")) {
							echo $this->plugins[$field->type]->getSearchFormDisplay($default,$field );
						} else {
							echo $this->plugins[$field->type]->getFormDisplay($default,$field );
						}
					}
			}
		}
	}
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     $string = new StringsUtil();
     // creates the form
     $this->form = new TForm('form_Atividade');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     // add a table inside form
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     // add a row for the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $row->addCell(new TLabel('Atividade'))->colspan = 2;
     // busca dados do banco
     try {
         TTransaction::open('atividade');
         $logado = Pessoa::retornaUsuario();
         $ultimoPonto = Ponto::retornaUltimoPonto($logado->pessoa_codigo);
         $ponto = new Ponto($ultimoPonto);
         if ($ponto->hora_saida) {
             $action = new TAction(array('PontoFormList', 'onReload'));
             new TMessage('error', 'Não existe ponto com horario em aberto!', $action);
         }
         $data_padrao = $string->formatDateBR($ponto->data_ponto);
         $hora_padrao = Ponto::retornaHoraInicio($string->formatDate($data_padrao), $logado->pessoa_codigo);
         TTransaction::close();
     } catch (Exception $e) {
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
     }
     // create the form fields
     $id = new THidden('id');
     $data_atividade = new TEntry('data_atividade');
     $data_atividade->setMask('dd/mm/yyyy');
     $data_atividade->setValue($data_padrao);
     $data_atividade->setEditable(FALSE);
     $hora_inicio = new TEntry('hora_inicio');
     $hora_inicio->setEditable(FALSE);
     $hora_inicio->setValue($hora_padrao);
     $hora_fim = new THidden('hora_fim');
     $hora_fim->setEditable(FALSE);
     $tempo_atividade = new TEntry('tempo_atividade');
     $tempo_atividade->setEditable(FALSE);
     $qtde_horas = new TCombo('qtde_horas');
     $qtde_minutos = new TCombo('qtde_minutos');
     $descricao = new TText('descricao');
     $colaborador_id = new THidden('colaborador_id');
     $colaborador_id->setValue($logado->pessoa_codigo);
     $colaborador_nome = new TEntry('colaborador_nome');
     $colaborador_nome->setEditable(FALSE);
     $colaborador_nome->setValue($logado->pessoa_nome);
     $tipo_atividade_id = new TDBCombo('tipo_atividade_id', 'atividade', 'TipoAtividade', 'id', 'nome', 'nome');
     $sistema_id = new TDBCombo('sistema_id', 'atividade', 'Sistema', 'id', 'nome');
     $ticket_id = new TCombo('ticket_id');
     $criteria = new TCriteria();
     $criteria->add(new TFilter("status_ticket_id", "IN", array(1, 5)));
     $newparam['order'] = 'id';
     $newparam['direction'] = 'asc';
     $criteria->setProperties($newparam);
     // order, offset
     $this->onComboTicket($criteria);
     $horario = explode(':', $hora_padrao);
     // cria combos de horas e minutos
     $combo_horas = array();
     for ($i = 8; $i <= 18; $i++) {
         $combo_horas[$i] = str_pad($i, 2, 0, STR_PAD_LEFT);
     }
     $qtde_horas->addItems($combo_horas);
     $qtde_horas->setValue($horario[0]);
     $qtde_horas->setDefaultOption(FALSE);
     $combo_minutos = array();
     for ($i = 0; $i <= 59; $i++) {
         $combo_minutos[$i] = str_pad($i, 2, 0, STR_PAD_LEFT);
     }
     $qtde_minutos->addItems($combo_minutos);
     $qtde_minutos->setValue($horario[1]);
     $qtde_minutos->setDefaultOption(FALSE);
     // set exit action for input_exit
     $change_action = new TAction(array($this, 'onChangeAction'));
     $qtde_horas->setChangeAction($change_action);
     $qtde_minutos->setChangeAction($change_action);
     $change_atividade_action = new TAction(array($this, 'onTrocaTipoAtividade'));
     $tipo_atividade_id->setChangeAction($change_atividade_action);
     $change_ticket_action = new TAction(array($this, 'onTrocaTicket'));
     $ticket_id->setChangeAction($change_ticket_action);
     // define the sizes
     $id->setSize(100);
     $data_atividade->setSize(100);
     $hora_inicio->setSize(100);
     $hora_fim->setSize(100);
     $qtde_horas->setSize(60);
     $qtde_minutos->setSize(60);
     $tempo_atividade->setSize(100);
     $descricao->setSize(300, 80);
     $colaborador_id->setSize(200);
     $tipo_atividade_id->setSize(200);
     $ticket_id->setSize(300);
     // validações
     $tempo_atividade->addValidation('Hora Fim', new THoraFimValidator());
     $tipo_atividade_id->addValidation('Tipo de Atividade', new TRequiredValidator());
     $ticket_id->addValidation('Ticket', new TRequiredValidator());
     $sistema_id->addValidation('Sistema', new TRequiredValidator());
     $descricao->addValidation('Descrição', new TMinLengthValidator(), array(10));
     $sem_atividade = TButton::create('atividade', array($this, 'onSemAtividade'), 'Sem Registro', 'ico_add.png');
     $this->form->addField($sem_atividade);
     // add one row for each form field
     $table->addRowSet(new TLabel('Colaborador:'), $colaborador_nome);
     $table->addRowSet(new TLabel('Data Atividade:'), array($data_atividade, $label_data = new TLabel('Data do último ponto')));
     $label_data->setFontColor('#A9A9A9');
     $table->addRowSet(new TLabel('Hora Inicio:'), $hora_inicio);
     $table->addRowSet($label_qtde_horas = new TLabel('Hora Fim:'), array($qtde_horas, $qtde_minutos, $sem_atividade));
     $label_qtde_horas->setFontColor('#FF0000');
     $table->addRowSet(new TLabel('Tempo Atividade:'), $tempo_atividade);
     $table->addRowSet($label_atividade = new TLabel('Tipo Atividade:'), $tipo_atividade_id);
     $label_atividade->setFontColor('#FF0000');
     $table->addRowSet($label_ticket = new TLabel('Ticket:'), $ticket_id);
     $label_ticket->setFontColor('#FF0000');
     $table->addRowSet($label_sistema = new TLabel('Sistema:'), $sistema_id);
     $label_sistema->setFontColor('#FF0000');
     $table->addRowSet($label_descricao = new TLabel('Descrição:'), $descricao);
     $label_descricao->setFontColor('#FF0000');
     $table->addRowSet(new TLabel(''), $id);
     $table->addRowSet(new TLabel(''), $colaborador_id);
     $table->addRowSet(new TLabel(''), $hora_fim);
     //esconder
     $this->form->setFields(array($id, $data_atividade, $hora_inicio, $qtde_horas, $qtde_minutos, $hora_fim, $tempo_atividade, $descricao, $colaborador_id, $colaborador_nome, $tipo_atividade_id, $ticket_id, $sistema_id));
     // create the form actions
     $save_button = TButton::create('save', array($this, 'onSave'), _t('Save'), 'fa:floppy-o');
     $new_button = TButton::create('new', array($this, 'onEdit'), _t('New'), 'fa:plus-square green');
     $del_button = TButton::create('delete', array($this, 'onDelete'), _t('Delete'), 'fa:trash-o red fa-lg');
     $list_button = TButton::create('list', array('AtividadeList', 'onClean'), _t('List'), 'fa:table blue');
     $this->form->addField($save_button);
     $this->form->addField($new_button);
     $this->form->addField($del_button);
     $this->form->addField($list_button);
     $buttons_box = new THBox();
     $buttons_box->add($save_button);
     $buttons_box->add($new_button);
     $buttons_box->add($del_button);
     $buttons_box->add($list_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     //                        TScript::create(' $( "#descricao" ).focus(); ');
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // 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);
 }
 public static function onChangeRadio($param)
 {
     if ($param['alergia'] == 2) {
         TText::disableField('matricula', 'descAlergia');
         TText::clearField('matricula', 'descAlergia');
     } else {
         TText::enableField('matricula', 'descAlergia');
     }
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the table container
     $table = new TTable();
     $table->style = 'width:100%';
     // creates the form
     $this->form = new TForm('form_System_Charge');
     $this->form->class = 'tform';
     // add the notebook inside the form
     $this->form->add($table);
     $row1 = $table->addRow();
     $row1->class = 'tformtitle';
     $cell1 = $row1->addCell(new TLabel('Add new charge'), '');
     $cell1->colspan = 2;
     // create the form fields
     $id = new TEntry('id');
     $client = new TDBCombo('client', 'permission', 'SystemClients', 'name', 'name');
     $amount = new TEntry('amount');
     $description = new TText('description');
     $date = new TDate('date');
     $id->setEditable(false);
     // define the sizes
     $id->setSize(100);
     $client->setSize(300);
     $amount->setSize(300);
     $description->setSize(300);
     $date->setSize(300);
     // validations
     $client->addValidation('client', new TRequiredValidator());
     $amount->addValidation('amount', new TRequiredValidator());
     $description->addValidation('description', new TRequiredValidator());
     $date->addValidation('date', new TRequiredValidator());
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('Client: '), $client);
     $table->addRowSet(new TLabel('Amount: '), $amount);
     $table->addRowSet(new TLabel('Description: '), $description);
     $table->addRowSet(new TLabel('Date: '), $date);
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('fa:floppy-o');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('SystemChargeList', 'onReload')), _t('Back to the listing'));
     $list_button->setImage('fa:table blue');
     // define the form fields
     $this->form->setFields(array($id, $client, $amount, $description, $date, $save_button, $new_button, $list_button));
     $buttons = new THBox();
     $buttons->add($save_button);
     $buttons->add($new_button);
     $buttons->add($list_button);
     $container = new TTable();
     $container->width = '80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemChargeList'));
     $container->addRow()->addCell($this->form);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 2;
     // add the form to the page
     parent::add($container);
 }
// instancia uma tabela
$table = new TTable();
// define algumas propriedades da tabela
$table->bgcolor = '#f0f0f0';
$table->style = 'border:2px solid grey';
$table->width = 400;
// adiciona a tabela ao formulário
$form->add($table);
// cria os campos do formulário
$codigo = new TEntry('id');
$nome = new TEntry('nome');
$endereco = new TEntry('endereco');
$datanasc = new TEntry('datanasc');
$sexo = new TRadioGroup('sexo');
$linguas = new TCheckGroup('linguas');
$qualifica = new TText('qualifica');
// define tamanho para campo código
$codigo->setSize(100);
// define como somente leitura
$codigo->setEditable(FALSE);
// cria um vetor com as opções de sexo
$items = array();
$items['M'] = 'Masculino';
$items['F'] = 'Feminino';
// define tamanho para campo data de nascimento
$datanasc->setSize(100);
// adiciona as opções ao radio button
$sexo->addItems($items);
// define a opção ativa
$sexo->setValue('M');
// define a posição dos elementos
 /**
  * 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);
 }
 /**
  * Construtor de classe
  * Cria o formulário de material consumo
  */
 function __construct()
 {
     parent::__construct();
     parent::setDatabase("app");
     parent::setActiveRecord("MaterialConsumoDerivado");
     parent::setDefaultOrder("id", "asc");
     // Cria o formulário
     $this->form = new TQuickForm('form_MaterialConsumo');
     $this->form->class = 'tform';
     // CSS class
     $this->form->setFormTitle('Material de consumo (novos ou necessidade extraordinária) a ser incluído na Proposta Orçamentária de 2017');
     // define the form title
     // Cria os campos de formulário
     $id = new THidden('id');
     $tipo_material_consumo_id = new TDBCombo('tipo_material_consumo_id', 'app', 'TipoMaterialConsumo', 'id', 'nome', 'nome');
     $tipo_material_consumo_id->addValidation('Tipo do material', new TRequiredValidator());
     $change_action = new TAction(array($this, 'onChangeAction'));
     $tipo_material_consumo_id->setChangeAction($change_action);
     $descricao = new TEntry('descricao');
     $justificativa = new TText('justificativa');
     $justificativa->addValidation('Justificativa', new TRequiredValidator());
     $quantidade = new TEntry('quantidade');
     $quantidade->addValidation('Quantidade', new TRequiredValidator());
     $quantidade->addValidation('Quantidade', new TNumericValidator());
     $custo = new TEntry('custo');
     $custo->addValidation('Custo', new TRequiredValidator());
     $custo->addValidation('Custo', new TNumericValidator());
     $total = new TEntry('total');
     $total->setEditable(false);
     // Adiciona os campos
     $this->form->addQuickField('', $id);
     //$this->form->add($id);
     $this->form->addQuickField('Tipo de material consumo', $tipo_material_consumo_id, 480);
     $this->form->addQuickField('Descrição', $descricao, 480);
     $this->form->addQuickField('Justificativa', $justificativa, 200);
     $justificativa->setSize(480, 100);
     $this->form->addQuickField('Quantidade', $quantidade, 200);
     $this->form->addQuickField('Previsão de custo unitário', $custo, 200);
     $this->form->addQuickField('Total', $total, 200);
     // Cria as ações do formulário
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     $actionHelp = new TAction(array("PaginaAjuda", 'onHelp'));
     $actionHelp->setParameters(array("key" => 3));
     $this->form->addQuickAction(_t('Help'), $actionHelp, 'ico_help.png');
     // Cria o datagrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // Cria as colunas do datagrid
     $this->datagrid->addQuickColumn('Tipo de material consumo', 'tipoMaterialConsumo->nome', 'left', 200);
     $this->datagrid->addQuickColumn('Descrição', 'descricao', 'left', 200);
     $this->datagrid->addQuickColumn('Quant.', 'quantidade', 'right', 100);
     $this->datagrid->addQuickColumn('Previsão de custo', 'custo', 'right', 100);
     $this->datagrid->addQuickColumn('Total', 'total', 'right', 100);
     // Cria as ações do datagrid
     $edit_action = new TDataGridAction(array($this, 'onEdit'));
     $delete_action = new TDataGridAction(array($this, 'onDelete'));
     // Adiciona as ações do datagrid
     $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), $delete_action, 'id', 'ico_delete.png');
     // Cria o modelo do datagrid
     $this->datagrid->createModel();
     // Cria a navegação de página
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // Cria o container da página
     $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation);
     parent::add($container);
 }
        <?php
		foreach($this->fields as $field)
		{
			if (@$field->options->edit_admin_only == 0) {
				$fieldform = $this->field->showFieldForm($field,$this->content,$this->default);
				if ($fieldform != "") {
                                    echo "<div id=\"row_".$field->name."\" class=\"span12\">";
                    echo "<div class=\"control-group\">";
                    if ($field->required == 1)
                    	$requiredtxt = JText::_('ADSMANAGER_REQUIRED');
                    else
                    	$requiredtxt = "";
                    if ((@$field->description)&&($field->description !="")) {
                    	JHTML::_('behavior.tooltip');
                    	echo "<label class=\"control-label\" for=\"{$field->name}\">".
                    		 JHTML::tooltip(TText::_($field->description),TText::_($field->title),null,$this->field->showFieldLabel($field,$this->content,$this->default).$requiredtxt).
                    		 "</label>";
                    } else {
						echo "<label class=\"control-label\" for=\"{$field->name}\">".$this->field->showFieldLabel($field,$this->content,$this->default).$requiredtxt."</label>";
					}
					echo $fieldform;
                    echo "</div>";
                                    echo "</div>";
				}
			} 
		}
		?>
        </div>
            </fieldset>
		<!-- fields -->
		<!-- image -->