Example #1
0
 /**
  * Show the widget at the screen
  */
 public function show()
 {
     // define the tag properties
     $this->tag->id = $this->id;
     $this->tag->name = 'file_' . $this->name;
     // tag name
     $this->tag->value = $this->value;
     // tag value
     $this->tag->type = 'file';
     // input type
     $this->tag->style = "width:{$this->size}px;height:{$this->height}px";
     // size
     $hdFileName = new THidden($this->name);
     $hdFileName->setValue($this->value);
     // verify if the widget is editable
     if (!parent::getEditable()) {
         // make the field read-only
         $this->tag->readonly = "1";
         $this->tag->type = 'text';
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
     }
     $div = new TElement('div');
     $div->style = "display:inline;width:100%;";
     $div->id = 'div_file_' . uniqid();
     $div->add($hdFileName);
     $div->add($this->tag);
     $div->show();
     $uploaderClass = 'AdiantiUploaderService';
     $action = "engine.php?class={$uploaderClass}";
     TScript::create("\n            \$(document).ready( function()\n            {\n                \$('#{$this->tag->id}').change( function()\n                {\n                    var tfile = new  TFileAjaxUpload('{$this->tag->id}','{$action}','{$div->id}');\n                    \n                    tfile.initFileAjaxUpload();\n                });\n            });");
 }
Example #2
0
 /**
  * Show the widget at the screen
  */
 public function show()
 {
     // define the tag properties
     $this->tag->id = $this->id;
     $this->tag->name = 'file_' . $this->name;
     // tag name
     $this->tag->value = $this->value;
     // tag value
     $this->tag->type = 'file';
     // input type
     $this->tag->style = "width:{$this->size}px;height:{$this->height}px";
     // size
     $hdFileName = new THidden($this->name);
     $hdFileName->setValue($this->value);
     $complete_action = "'undefined'";
     // verify if the widget is editable
     if (parent::getEditable()) {
         if (isset($this->completeAction)) {
             if (!TForm::getFormByName($this->formName) instanceof TForm) {
                 throw new Exception(AdiantiCoreTranslator::translate('You must pass the ^1 (^2) as a parameter to ^3', __CLASS__, $this->name, 'TForm::setFields()'));
             }
             $string_action = $this->completeAction->serialize(FALSE);
             $complete_action = "function() { __adianti_post_lookup('{$this->formName}', '{$string_action}', this); }";
         }
     } else {
         // make the field read-only
         $this->tag->readonly = "1";
         $this->tag->type = 'text';
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
     }
     $div = new TElement('div');
     $div->style = "display:inline;width:100%;";
     $div->id = 'div_file_' . mt_rand(1000000000, 1999999999);
     $div->add($hdFileName);
     $div->add($this->tag);
     $div->show();
     $action = "engine.php?class={$this->uploaderClass}";
     TScript::create(" tfile_start( '{$this->tag->id}', '{$action}', '{$div->id}', {$complete_action});");
 }
Example #3
0
 function __construct()
 {
     parent::__construct();
     $this->form = new TForm('doc_cessao_form');
     $this->form->style = 'width : 500px;';
     $this->form->class = 'tform';
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     $row = $table->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $row->addCell(new TLabel('Gerar Documentos da Cessão'))->colspan = 2;
     // cria os campos do formulário
     $memorando = new TEntry('memorando');
     //$cidade = new TEntry('cidade');
     $emissao = new TDate('emissao');
     $campusID = new TEntry('campusID');
     //TDBSeekButton('campusID', 'saciq', 'doc_cessao_form', 'Campus', 'nome', 'campusID', 'campusNome');
     $campusNome = new TEntry('campusNome');
     $gerente = new TEntry('gerente');
     $diretor = new TEntry('diretor');
     $cessao_id = new THidden('cessao_id');
     // define the sizes
     $memorando->setSize(300);
     //$cidade->setSize(200);
     $emissao->setSize(90);
     $emissao->setProperty('style', 'margin-right : 0px');
     $campusID->setSize(50);
     $campusID->setEditable(false);
     $campusNome->setSize(226);
     $campusNome->setEditable(false);
     $gerente->setSize(300);
     $diretor->setSize(300);
     //mascara
     $emissao->setMask('dd/mm/yyyy');
     $emissao->setValue(date('d/m/Y'));
     //validadores
     $memorando->addValidation('Memorando', new TRequiredValidator());
     $memorando->addValidation('Memorando', new TMaxLengthValidator(), array(70));
     $emissao->addValidation('Emissão', new TRequiredValidator());
     $campusID->addValidation('Destino', new TRequiredValidator());
     $gerente->addValidation('Gerente Administrativo(a)', new TRequiredValidator());
     $gerente->addValidation('Gerente Administrativo(a)', new TMaxLengthValidator(), array(70));
     $diretor->addValidation('Diretor(a) Geral', new TRequiredValidator());
     $diretor->addValidation('Diretor(a) Geral', new TMaxLengthValidator(), array(70));
     $memorando->setTip('Descrição do Memorando que aparecerá no início do documento.');
     $gerente->setTip('Nome do gerente em exercício');
     $diretor->setTip('Nome do diretor geral em exercício');
     $value = TSession::getValue('doc_cessao_form_cessao_id');
     if (isset($value)) {
         $cessao_id->setValue($value);
     }
     // add one row for each form field
     $table->addRowSet(new TLabel('Memorando:'), $memorando);
     //$table->addRowSet(new TLabel('Cidade:'), $cidade);
     $table->addRowSet(new TLabel('Emissão:'), $emissao);
     //$table->addRowSet(new TLabel('Destino:'), $destino);
     //$row = $table->addRow();
     $box = new THBox();
     $box->add($campusID);
     $box->add($campusNome)->style = 'width: 75%; display : inline-block;';
     //$row->addCell($box)->colspan = 2;
     $table->addRowSet(new TLabel('Destino:'), $box);
     $table->addRowSet(new TLabel('Gerente Administrativo(a):'), $gerente);
     $table->addRowSet(new TLabel('Diretor(a):'), $diretor);
     $table->addRowSet($cessao_id);
     $this->form->setFields(array($memorando, $emissao, $campusID, $campusNome, $gerente, $diretor, $cessao_id));
     // keep the form filled during navigation with session data
     $this->form->setData(TSession::getValue('Cessao_filter_data'));
     // create two action buttons to the form
     $generate_button = TButton::create('generate', array($this, 'onGenerate'), 'Gerar', 'fa:file-pdf-o');
     $back_button = TButton::create('back', array('DocCessaoList', 'onReload'), 'Voltar', 'ico_back.png');
     //$new_button  = TButton::create('new',  array('CessaoForm', 'onEdit'), 'Novo', 'ico_new.png');
     $this->form->addField($generate_button);
     $this->form->addField($back_button);
     $buttons_box = new THBox();
     $buttons_box->add($generate_button);
     $buttons_box->add($back_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     // create the page container
     //$container = TVBox::pack($this->form);
     parent::add($this->form);
 }