コード例 #1
0
 /**
  * Show the widget at the screen
  */
 public function show()
 {
     // define the tag properties
     $this->tag->name = $this->name;
     // tag name
     $this->tag->value = $this->value;
     // tag value
     $this->tag->type = 'password';
     // input type
     $this->setProperty('style', "width:{$this->size}px", FALSE);
     //aggregate style info
     // verify if the field is not editable
     if (parent::getEditable()) {
         if (isset($this->exitAction)) {
             if (!TForm::getFormByName($this->formName) instanceof TForm) {
                 throw new Exception(TAdiantiCoreTranslator::translate('You must pass the ^1 (^2) as a parameter to ^3', __CLASS__, $this->name, 'TForm::setFields()'));
             }
             $string_action = $this->exitAction->serialize(FALSE);
             $this->setProperty('onBlur', "serialform=(\$('#{$this->formName}').serialize());\n                                              ajaxLookup('{$string_action}&'+serialform, this)");
         }
     } else {
         // make the field read-only
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
     }
     // show the tag
     $this->tag->show();
 }
コード例 #2
0
ファイル: TPassword.class.php プロジェクト: enieber/adianti
 /**
  * Show the widget at the screen
  */
 public function show()
 {
     // define the tag properties
     $this->tag->name = $this->name;
     // tag name
     $this->tag->value = $this->value;
     // tag value
     $this->tag->type = 'password';
     // input type
     $this->tag->style = "width:{$this->size}px";
     // verify if the field is not editable
     if (parent::getEditable()) {
         if (isset($this->exitaction)) {
             $string_action = $this->exitaction->serialize(FALSE);
             $this->setProperty('onBlur', "serialform=(\$('#{$this->formName}').serialize());\n                                              ajaxLookup('{$string_action}&'+serialform, this)");
         }
     } else {
         // make the field read-only
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
     }
     // show the tag
     $this->tag->show();
 }
コード例 #3
0
 /**
  * Show the widget at the screen
  */
 public function show()
 {
     if ($this->items) {
         // iterate the RadioButton options
         foreach ($this->items as $index => $label) {
             $button = new TRadioButton($this->name);
             $button->setTip($this->tag->title);
             $button->setValue($index);
             // check if contains any value
             if ($this->value == $index) {
                 // mark as checked
                 $button->setProperty('checked', '1');
             }
             // check whether the widget is non-editable
             if (!parent::getEditable()) {
                 $button->setEditable(FALSE);
             }
             // create the label for the button
             $obj = new TLabel($label);
             $obj->add($button);
             $obj->show();
             if ($this->layout == 'vertical') {
                 // shows a line break
                 $br = new TElement('br');
                 $br->show();
             }
             echo "\n";
         }
     }
 }
コード例 #4
0
ファイル: TCheckGroup.class.php プロジェクト: enieber/adianti
 /**
  * Shows the widget at the screen
  */
 public function show()
 {
     if ($this->items) {
         // iterate the checkgroup options
         foreach ($this->items as $index => $label) {
             // instantiates a new CheckButton
             $button = new TCheckButton("{$this->name}[]");
             $button->setTip($this->tag->title);
             $button->setIndexValue($index);
             $button->setProperty('checkgroup', $this->name);
             // verify if the checkbutton is checked
             if (@in_array($index, $this->value)) {
                 //$button->setProperty('checked', '1');
                 $button->setValue($index);
                 // value=indexvalue (checked)
             }
             // check whether the widget is non-editable
             if (!parent::getEditable()) {
                 $button->setEditable(FALSE);
             }
             // create the label for the button
             $obj = new TLabel($label);
             $obj->add($button);
             $obj->show();
             if ($this->layout == 'vertical') {
                 // shows a line break
                 $br = new TElement('br');
                 $br->show();
                 echo "\n";
             }
         }
     }
 }
コード例 #5
0
 /**
  * Show the widget at the screen
  */
 public function show()
 {
     TPage::include_js('lib/adianti/include/tfile/tfile.js');
     // define the tag properties
     $this->tag->id = $this->name . '_' . uniqid();
     $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();
     $script = new TElement('script');
     $script->{'type'} = 'text/javascript';
     $action = 'engine.php?class=TFileUploader';
     $script->add("\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            });");
     $script->show();
 }
コード例 #6
0
 /**
  * Show the widget
  */
 public function show()
 {
     $this->tag->name = $this->name;
     // tag name
     $this->setProperty('style', "width:{$this->size}px", FALSE);
     //aggregate style info
     if ($this->height) {
         $this->setProperty('style', "height:{$this->height}px", FALSE);
         //aggregate style info
     }
     // check if the field is not editable
     if (!parent::getEditable()) {
         // make the widget read-only
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
     }
     if (isset($this->exitAction)) {
         if (!TForm::getFormByName($this->formName) instanceof TForm) {
             throw new Exception(TAdiantiCoreTranslator::translate('You must pass the ^1 (^2) as a parameter to ^3', __CLASS__, $this->name, 'TForm::setFields()'));
         }
         $string_action = $this->exitAction->serialize(FALSE);
         $this->setProperty('onBlur', "serialform=(\$('#{$this->formName}').serialize());\n                                          ajaxLookup('{$string_action}&'+serialform, this)");
     }
     // add the content to the textarea
     $this->tag->add(htmlspecialchars($this->value));
     // show the tag
     $this->tag->show();
 }
コード例 #7
0
ファイル: TEntry.class.php プロジェクト: enieber/adianti
 /**
  * Shows the widget at the screen
  */
 public function show()
 {
     TPage::include_js('lib/adianti/include/tentry/tentry.js');
     // define the tag properties
     $this->tag->name = $this->name;
     // TAG name
     $this->tag->value = $this->value;
     // TAG value
     $this->tag->type = 'text';
     // input type
     $this->tag->style = "width:{$this->size}px";
     // size
     if ($this->id) {
         $this->tag->id = $this->id;
     }
     // verify if the widget is non-editable
     if (parent::getEditable()) {
         if (isset($this->exitAction)) {
             $string_action = $this->exitAction->serialize(FALSE);
             $this->setProperty('onBlur', "serialform=(\$('#{$this->formName}').serialize());\n                                              ajaxLookup('{$string_action}&'+serialform, this)");
         }
         if ($this->mask) {
             TPage::include_js('app/lib/include/jquery.meiomaskmoney.js');
             if ($this->mask == 'msk:money') {
                 $this->tag->{'class'} = 'tfield money';
                 $this->tag->{'id'} = $this->name;
             } else {
                 if ($this->mask == 'msk:decimal') {
                     $this->tag->{'class'} = 'tfield decimal';
                     $this->tag->{'id'} = $this->name;
                 } else {
                     if (substr($this->mask, 3) == 'msk') {
                         $this->tag->{'msk'} = substr($this->mask, 4);
                         $this->tag->{'id'} = $this->name;
                     } else {
                         $this->tag->onKeyPress = "return entryMask(this,event,'{$this->mask}')";
                     }
                 }
             }
         }
     } else {
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
         $this->tag->style = "width:{$this->size}px;" . "-moz-user-select:none;";
         $this->tag->onmouseover = "style.cursor='default'";
     }
     // shows the tag
     $this->tag->show();
     if (isset($this->completion)) {
         $options = json_encode($this->completion);
         $script = new TElement('script');
         $script->add("\$('input[name=\"{$this->name}\"]').autocomplete({source: {$options} });");
         $script->show();
     }
 }
コード例 #8
0
ファイル: TSpinner.class.php プロジェクト: enieber/adianti
 /**
  * Shows the widget at the screen
  */
 public function show()
 {
     // define the tag properties
     $this->tag->name = $this->name;
     // TAG name
     $this->tag->value = $this->value;
     // TAG value
     $this->tag->type = 'text';
     // input type
     $this->tag->style = "width:{$this->size}px";
     // size
     if ($this->id) {
         $this->tag->id = $this->id;
     }
     // verify if the widget is non-editable
     if (parent::getEditable()) {
         $change_action = '';
         if (isset($this->exitaction)) {
             $string_action = $this->exitaction->serialize(FALSE);
             $change_action = "serialform=(\$('#{$this->formName}').serialize());\n                                                  ajaxLookup('{$string_action}&'+serialform, this);";
         }
         $script = new TElement('script');
         $script->add(' $(function() {
                     $( "#' . $this->id . '" ).spinner({
                         step: ' . $this->step . ',
                         numberFormat: "n",
                         spin: function( event, ui ) {
                             ' . $change_action . '
                             if ( ui.value > ' . $this->max . ' ) {
                                 $( this ).spinner( "value", ' . $this->min . ' );
                                 return false;
                             } else if ( ui.value < ' . $this->min . ' ) {
                                 $( this ).spinner( "value", ' . $this->max . ' );
                                 return false;
                             }
                         }
                     });
                     });');
         $script->show();
     } else {
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
         $this->tag->style = "width:{$this->size}px;" . "-moz-user-select:none;";
         $this->tag->onmouseover = "style.cursor='default'";
     }
     // shows the tag
     $this->tag->show();
 }
コード例 #9
0
ファイル: TSlider.class.php プロジェクト: enieber/adianti
 /**
  * Shows the widget at the screen
  */
 public function show()
 {
     // define the tag properties
     $this->tag->name = $this->name;
     // TAG name
     $this->tag->value = $this->value;
     // TAG value
     $this->tag->type = 'text';
     // input type
     $this->tag->style = "width:{$this->size}px";
     // size
     if ($this->id) {
         $this->tag->id = $this->id;
     }
     // verify if the widget is editable
     if (parent::getEditable()) {
         $this->tag->readonly = "1";
         $this->tag->style = "width:40px;-moz-user-select:none;border:0;text-align:center";
         $div = new TElement('div');
         $div->id = $this->id . '_div';
         $div->style = "width:{$this->size}px";
         $main_div = new TElement('div');
         $main_div->style = "text-align:center;width:{$this->size}px";
         $script = new TElement('script');
         $script->add(' $(function() {
                     $( "#' . $this->id . '_div" ).slider({
                         value: ' . $this->value . ',
                         min: ' . $this->min . ',
                         max: ' . $this->max . ',
                         step: ' . $this->step . ',
                         slide: function( event, ui ) {
                             $( "#' . $this->id . '" ).val( ui.value );
                         }
                     });
                     });');
         $script->show();
         $main_div->add($this->tag);
         $main_div->add($div);
         $main_div->show();
     } else {
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
         $this->tag->style = "width:40px;-moz-user-select:none;";
         $this->tag->onmouseover = "style.cursor='default'";
         $this->tag->show();
     }
 }
コード例 #10
0
 /**
  * método show()
  * exibe o widget na tela
  */
 public function show()
 {
     // atribui as propriedades da TAG
     $this->tag->name = $this->name;
     $this->tag->value = $this->value;
     $this->tag->type = 'radio';
     // se o campo não é editável
     if (!parent::getEditable()) {
         // desabilita a TAG input
         $this->tag->readonly = "1";
         $this->tag->class = 'tfield_disabled';
         // classe CSS
     }
     // exibe a tag
     $this->tag->show();
 }
コード例 #11
0
 /**
  * Show the widget at the screen
  */
 public function show()
 {
     // define the tag properties
     $this->tag->name = $this->name;
     $this->tag->value = $this->value;
     $this->tag->type = 'radio';
     $this->tag->{'class'} = '';
     // verify if the field is not editable
     if (!parent::getEditable()) {
         // make the field read-only
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
     }
     // show the tag
     $this->tag->show();
 }
コード例 #12
0
 public function show()
 {
     $this->tag->name = $this->name;
     // nome da TAG
     $this->tag->style = "width:{$this->size};height:{$this->height}";
     // tamanho em pixels
     // se o campo não é editável
     if (!parent::getEditable()) {
         // desabilita a TAG input
         $this->tag->readonly = "1";
         $this->tag->class = 'tfield_disabled';
         // classe CSS
     }
     // adiciona conteúdo ao textarea
     $this->tag->add(htmlspecialchars($this->value));
     // exibe a tag
     $this->tag->show();
 }
コード例 #13
0
ファイル: TFile.class.php プロジェクト: enieber/adianti
 /**
  * Show the widget at the screen
  */
 public function show()
 {
     TPage::include_css('lib/valums/fileuploader.css');
     TPage::include_js('lib/valums/fileuploader.js');
     // define the tag properties
     $this->tag->name = $this->name;
     // tag name
     $this->tag->value = $this->value;
     // tag value
     $this->tag->type = 'text';
     // input type
     $this->tag->style = "width:{$this->size}px";
     // size
     // verify if the widget is editable
     if (!parent::getEditable()) {
         // make the field read-only
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
     }
     $div = new TElement('div');
     $div->style = "display:inline";
     $div->id = 'div_file_' . uniqid();
     $table = new TTable();
     $table->cellspacing = 0;
     $row = $table->addRow();
     $row->addCell($this->tag);
     $row->addCell($div);
     $table->show();
     $script = new TElement('script');
     $script->{'type'} = 'text/javascript';
     $class = 'TFileUploader';
     $script->add('
         new qq.FileUploader({
             element: document.getElementById("' . $div->id . '"),
             action: "engine.php?class=' . $class . '",
             debug: true,
             onComplete: function(id, fileName, responseJSON)
             {
                 document.getElementsByName("' . $this->name . '")[0].value= responseJSON.target;
             }
         });');
     $script->show();
 }
コード例 #14
0
 /**
  * método show()
  * exibe o widget na tela
  */
 public function show()
 {
     // atribui as propriedades da TAG
     $this->tag->name = $this->name;
     // nome da TAG
     $this->tag->value = $this->value;
     // valor da TAG
     $this->tag->type = 'password';
     // tipo do input
     $this->tag->style = "width:{$this->size}";
     // tamanho em pixels
     // se o campo não é editável
     if (!parent::getEditable()) {
         $this->tag->readonly = "1";
         $this->tag->class = 'tfield_disabled';
     }
     // exibe a tag
     $this->tag->show();
 }
コード例 #15
0
 /**
  * método show()
  * exibe o widget na tela
  */
 public function show()
 {
     // atribui as propriedades da TAG
     $this->tag->name = $this->name;
     // nome da TAG
     $this->tag->style = "width:{$this->size}";
     // tamanho em pixels
     // cria uma TAG <option> com um valor padrão
     $option = new TElement('option');
     $option->add('');
     $option->value = '0';
     // valor da TAG
     // adiciona a opção à combo
     $this->tag->add($option);
     if ($this->items) {
         // percorre os itens adicionados
         foreach ($this->items as $chave => $item) {
             // cria uma TAG <option> para o item
             $option = new TElement('option');
             $option->value = $chave;
             // define o índice da opção
             $option->add($item);
             // adiciona o texto da opção
             // caso seja a opção selecionada
             if ($chave == $this->value) {
                 // seleciona o item da combo
                 $option->selected = 1;
             }
             // adiciona a opção à combo
             $this->tag->add($option);
         }
     }
     // verifica se o campo é editável
     if (!parent::getEditable()) {
         // desabilita a TAG input
         $this->tag->readonly = "1";
         $this->tag->class = 'tfield_disabled';
         // classe CSS
     }
     // exibe a combo
     $this->tag->show();
 }
コード例 #16
0
 /**
  * método show()
  * exibe o botão
  */
 public function show()
 {
     $url = $this->action->serialize();
     // define as propriedades do botão
     $this->tag->name = $this->name;
     // nome da TAG
     $this->tag->type = 'button';
     // tipo de input
     $this->tag->value = $this->label;
     // rótulo do botão
     // se o campo não é editável
     if (!parent::getEditable()) {
         $this->tag->disabled = "1";
         $this->tag->class = 'tfield_disabled';
         // classe CSS
     }
     // define a ação do botão
     $this->tag->onclick = "document.{$this->formName}.action='{$url}'; " . "document.{$this->formName}.submit()";
     // exibe o botão
     $this->tag->show();
 }
コード例 #17
0
ファイル: TText.class.php プロジェクト: jhonleandres/crmbf
 /**
  * Show the widget
  */
 public function show()
 {
     $this->tag->name = $this->name;
     // tag name
     $this->tag->style = "width:{$this->size}px;";
     if ($this->height) {
         $this->tag->style .= "height:{$this->height}px";
     }
     // check if the field is not editable
     if (!parent::getEditable()) {
         // make the widget read-only
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
     }
     if (isset($this->exitaction)) {
         $string_action = $this->exitaction->serialize(FALSE);
         $this->setProperty('onBlur', "serialform=(\$('#{$this->formName}').serialize());\n                                          ajaxLookup('{$string_action}&'+serialform, this)");
     }
     // add the content to the textarea
     $this->tag->add(htmlspecialchars($this->value));
     // show the tag
     $this->tag->show();
 }
コード例 #18
0
 /**
  * Shows the widget at the screen
  */
 public function show()
 {
     // define the tag properties for the checkbutton
     $this->tag->name = $this->name;
     // tag name
     $this->tag->type = 'checkbox';
     // input type
     $this->tag->value = $this->indexValue;
     // value
     $this->tag->{'class'} = '';
     // compare current value with indexValue
     if ($this->indexValue == $this->value) {
         $this->tag->checked = '1';
     }
     // check whether the widget is non-editable
     if (!parent::getEditable()) {
         // make the widget read-only
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
     }
     // shows the tag
     $this->tag->show();
 }
コード例 #19
0
 /**
  * Show the widget
  */
 public function show()
 {
     // check if the field is not editable
     if (parent::getEditable()) {
         $tag = new TElement('textarea');
         $tag->{'id'} = $this->widgetId;
         $tag->{'class'} = 'thtmleditor';
         // CSS
         $tag->name = $this->name;
         // tag name
         $tag->style = "width:{$this->size}px;";
         $this->tag->add($tag);
         if ($this->height) {
             $tag->style .= "height:{$this->height}px";
         }
         // add the content to the textarea
         $tag->add(htmlspecialchars($this->value));
         $script = new TElement('script');
         $script->type = 'text/javascript';
         $script->add('
             $("#' . $tag->{'id'} . '").cleditor({width:"' . $this->size . 'px", height:"' . $this->height . 'px"})
         ');
         $script->show();
     } else {
         $this->tag->style = "width:{$this->size}px;";
         $this->tag->style .= "height:{$this->height}px;";
         $this->tag->style .= "background-color:#FFFFFF;";
         $this->tag->style .= "border: 1px solid #000000;";
         $this->tag->style .= "padding: 5px;";
         $this->tag->style .= "overflow: auto;";
         // add the content to the textarea
         $this->tag->add($this->value);
     }
     // show the tag
     $this->tag->show();
 }
コード例 #20
0
 /**
  * Show the widget at the screen
  */
 public function show()
 {
     // include the needed libraries and styles
     if ($this->fields) {
         $table = new TTable();
         $mdr = array();
         // mandatory
         $fields = array();
         $i = 0;
         foreach ($this->fields as $name => $obj) {
             $row = $table->addRow();
             $label = new TLabel($obj->text);
             if ($obj->inform) {
                 $row->addCell($label);
                 $row->addCell($obj->field);
             }
             $fields[] = $name;
             $post_fields[$name] = 1;
             $obj->field->setName($this->name . '_' . $name);
             if (get_class($obj->field) == 'TComboCombined') {
                 $fields[] = $obj->field->getTextName();
                 $obj->field->setTextName($this->name . '_' . $obj->field->getTextName());
                 $i++;
             }
             $i++;
         }
         $table->show();
     }
     // check whether the widget is non-editable
     if (parent::getEditable()) {
         // create three buttons to control the MultiField
         $add = new TButton("{$this->name}btnStore");
         $add->setLabel(TAdiantiCoreTranslator::translate('Register'));
         //$add->setName("{$this->name}btnStore");
         $add->setImage('ico_save.png');
         $add->addFunction("mtf{$this->name}.addRowFromFormFields()");
         $del = new TButton("{$this->name}btnDelete");
         $del->setLabel(TAdiantiCoreTranslator::translate('Delete'));
         $del->setImage('ico_delete.png');
         $can = new TButton("{$this->name}btnCancel");
         $can->setLabel(TAdiantiCoreTranslator::translate('Cancel'));
         $can->setImage('ico_close.png');
         $table = new TTable();
         $row = $table->addRow();
         $row->addCell($add);
         $row->addCell($del);
         $row->addCell($can);
         $table->show();
     }
     // create the MultiField Panel
     $panel = new TElement('div');
     $panel->{'class'} = "multifieldDiv";
     $input = new THidden($this->name);
     $panel->add($input);
     // create the MultiField DataGrid Header
     $table = new TTable();
     $table->id = "{$this->name}mfTable";
     $head = new TElement('thead');
     $table->add($head);
     $row = new TTableRow();
     $head->add($row);
     // fill the MultiField DataGrid
     foreach ($this->fields as $obj) {
         $c = $obj->text;
         if (get_class($obj->field) == 'TComboCombined') {
             $row->addCell('ID');
         }
         $cell = $row->addCell($c);
         $cell->width = $obj->size . 'px';
     }
     $body = new TElement('tbody');
     $table->add($body);
     if ($this->objects) {
         foreach ($this->objects as $obj) {
             if (isset($obj->id)) {
                 $row = new TTableRow();
                 $row->dbId = $obj->id;
                 $body->add($row);
             } else {
                 $row = new TTableRow();
                 $body->add($row);
             }
             foreach ($fields as $name) {
                 $cell = $row->addCell(is_null($obj->{$name}) ? '' : $obj->{$name});
                 if (isset($this->fields[$name]->size)) {
                     $cell->style = 'width:' . $this->fields[$name]->size . 'px';
                 }
             }
         }
     }
     $panel->add($table);
     $panel->show();
     echo '<script type="text/javascript">';
     echo "var mtf{$this->name};";
     //echo '$(document).ready(function() {';
     echo "mtf{$this->name} = new MultiField('{$this->name}mfTable',{$this->width},{$this->height});\n";
     $s = implode("','", $fields);
     echo "mtf{$this->name}.formFieldsAlias = Array('{$s}');\n";
     $fields = implode("','{$this->name}_", $fields);
     echo "mtf{$this->name}.formFieldsName = Array('{$this->name}_{$fields}');\n";
     echo "mtf{$this->name}.formPostFields = Array();\n";
     foreach ($post_fields as $col => $value) {
         echo "mtf{$this->name}.formPostFields['{$col}'] = '{$value}';\n";
     }
     $mdr = implode(',', $mdr);
     echo "mtf{$this->name}.formFieldsMandatory = Array({$mdr});\n";
     echo "mtf{$this->name}.storeButton  = document.getElementsByName('{$this->name}btnStore')[0];\n";
     echo "mtf{$this->name}.deleteButton = document.getElementsByName('{$this->name}btnDelete')[0];\n";
     echo "mtf{$this->name}.cancelButton = document.getElementsByName('{$this->name}btnCancel')[0];\n";
     echo "mtf{$this->name}.inputResult  = document.getElementsByName('{$this->name}')[0];\n";
     //echo '});';
     echo '</script>';
 }
コード例 #21
0
 /**
  * Shows the widget
  */
 public function show()
 {
     $tag = new TEntry($this->name);
     $tag->setEditable(FALSE);
     $tag->setProperty('id', $this->name);
     $tag->setSize(40);
     $tag->setProperty('onchange', "aux = document.getElementsByName('{$this->text_name}'); aux[0].value = this.value;");
     $tag->show();
     // define the tag properties
     $this->tag->name = $this->text_name;
     $this->tag->onchange = "entry = document.getElementById('{$this->name}'); entry.value = this.value;";
     $this->tag->style = "width:{$this->size}px;";
     // tamanho em pixels
     // creates an empty <option> tag
     $option = new TElement('option');
     $option->add('');
     $option->value = '0';
     // valor da TAG
     // add the option tag to the combo
     $this->tag->add($option);
     if ($this->items) {
         // iterate the combobox items
         foreach ($this->items as $chave => $item) {
             // creates an <option> tag
             $option = new TElement('option');
             $option->value = $chave;
             // define the index
             $option->add($item);
             // add the item label
             // verify if this option is selected
             if ($chave == $this->value) {
                 // mark as selected
                 $option->selected = 1;
             }
             // add the option to the combo
             $this->tag->add($option);
         }
     }
     // verify whether the widget is editable
     if (!parent::getEditable()) {
         // make the widget read-only
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
     }
     // shows the combobox
     $this->tag->show();
 }
コード例 #22
0
 /**
  * Show the widget at the screen
  */
 public function show()
 {
     if ($this->items) {
         // iterate the RadioButton options
         foreach ($this->items as $index => $label) {
             $button = new TRadioButton($this->name);
             $button->setTip($this->tag->title);
             $button->setValue($index);
             // check if contains any value
             if ($this->value == $index) {
                 // mark as checked
                 $button->setProperty('checked', '1');
             }
             // check whether the widget is non-editable
             if (parent::getEditable()) {
                 if (isset($this->changeAction)) {
                     if (!TForm::getFormByName($this->formName) instanceof TForm) {
                         throw new Exception(TAdiantiCoreTranslator::translate('You must pass the ^1 (^2) as a parameter to ^3', __CLASS__, $this->name, 'TForm::setFields()'));
                     }
                     $string_action = $this->changeAction->serialize(FALSE);
                     $button->setProperty('onChange', "serialform=(\$('#{$this->formName}').serialize());\n                                                          ajaxLookup('{$string_action}&'+serialform, this)");
                 }
             } else {
                 $button->setEditable(FALSE);
             }
             // create the label for the button
             $obj = new TLabel($label);
             $obj->add($button);
             $obj->show();
             if ($this->layout == 'vertical') {
                 // shows a line break
                 $br = new TElement('br');
                 $br->show();
             }
             echo "\n";
         }
     }
 }
コード例 #23
0
ファイル: TCombo.class.php プロジェクト: enieber/adianti
 /**
  * Shows the widget
  */
 public function show()
 {
     // define the tag properties
     $this->tag->name = $this->name;
     // tag name
     $this->tag->style = "width:{$this->size}px";
     // size in pixels
     // creates an empty <option> tag
     $option = new TElement('option');
     $option->add('');
     $option->value = '';
     // tag value
     // add the option tag to the combo
     $this->tag->add($option);
     if ($this->items) {
         // iterate the combobox items
         foreach ($this->items as $chave => $item) {
             if (substr($chave, 0, 3) == '>>>') {
                 $optgroup = new TElement('optgroup');
                 $optgroup->label = $item;
                 // add the option to the combo
                 $this->tag->add($optgroup);
             } else {
                 // creates an <option> tag
                 $option = new TElement('option');
                 $option->value = $chave;
                 // define the index
                 $option->add($item);
                 // add the item label
                 // verify if this option is selected
                 if ($chave == $this->value and $this->value !== NULL) {
                     // mark as selected
                     $option->selected = 1;
                 }
                 if (isset($optgroup)) {
                     $optgroup->add($option);
                 } else {
                     $this->tag->add($option);
                 }
             }
         }
     }
     // verify whether the widget is editable
     if (parent::getEditable()) {
         if (isset($this->changeaction)) {
             $string_action = $this->changeaction->serialize(FALSE);
             $this->setProperty('onChange', "serialform=(\$('#{$this->formName}').serialize());\n                                              ajaxLookup('{$string_action}&'+serialform, this)");
         }
     } else {
         // make the widget read-only
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
     }
     // shows the combobox
     $this->tag->show();
 }
コード例 #24
0
 /**
  * Shows the widget at the screen
  */
 public function show()
 {
     if ($this->mask) {
         TPage::include_js('lib/adianti/include/tentry/tentry.js');
     } else {
         if ($this->numericMask) {
             TPage::include_js('lib/adianti/include/tentry/jquery-imask-min.js');
         }
     }
     // define the tag properties
     $this->tag->name = $this->name;
     // TAG name
     $this->tag->value = $this->value;
     // TAG value
     $this->tag->type = 'text';
     // input type
     $this->setProperty('style', "width:{$this->size}px", FALSE);
     //aggregate style info
     if ($this->id) {
         $this->tag->id = $this->id;
     }
     // verify if the widget is non-editable
     if (parent::getEditable()) {
         if (isset($this->exitAction)) {
             if (!TForm::getFormByName($this->formName) instanceof TForm) {
                 throw new Exception(TAdiantiCoreTranslator::translate('You must pass the ^1 (^2) as a parameter to ^3', __CLASS__, $this->name, 'TForm::setFields()'));
             }
             $string_action = $this->exitAction->serialize(FALSE);
             $this->setProperty('exitaction', "serialform=(\$('#{$this->formName}').serialize());\n                                                 ajaxLookup('{$string_action}&'+serialform, document.{$this->formName}.{$this->name})", FALSE);
             $this->setProperty('onBlur', $this->getProperty('exitaction'), FALSE);
         }
         if ($this->mask) {
             $this->tag->onKeyPress = "return entryMask(this,event,'{$this->mask}')";
         }
     } else {
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
         $this->tag->onmouseover = "style.cursor='default'";
     }
     // shows the tag
     $this->tag->show();
     if (isset($this->completion)) {
         $options = json_encode($this->completion);
         $script = new TElement('script');
         $script->add("\$('input[name=\"{$this->name}\"]').autocomplete({source: {$options} });");
         $script->show();
     }
     if ($this->numericMask) {
         $script = new TElement('script');
         $script->add("\$('input[name=\"{$this->name}\"]').iMask({\n\t\t                        type : 'number',\n\t\t                        decDigits   : {$this->decimals},\n\t\t                        decSymbol   : '{$this->decimalsSeparator}',\n\t\t                        groupSymbol : '{$this->thousandSeparator}'\n\t                    });");
         $script->show();
     }
 }
コード例 #25
0
ファイル: TEntry.class.php プロジェクト: jhonleandres/crmbf
 /**
  * Shows the widget at the screen
  */
 public function show()
 {
     if ($this->mask) {
         TPage::include_js('lib/adianti/include/tentry/tentry.js');
     } else {
         if ($this->numericMask) {
             TPage::include_js('lib/adianti/include/tentry/jquery-imask-min.js');
         }
     }
     // define the tag properties
     $this->tag->name = $this->name;
     // TAG name
     $this->tag->value = $this->value;
     // TAG value
     $this->tag->type = 'text';
     // input type
     $this->tag->style = "width:{$this->size}px";
     // size
     if ($this->id) {
         $this->tag->id = $this->id;
     }
     // verify if the widget is non-editable
     if (parent::getEditable()) {
         if (isset($this->exitAction)) {
             $string_action = $this->exitAction->serialize(FALSE);
             $this->setProperty('onBlur', "serialform=(\$('#{$this->formName}').serialize());\n                                              ajaxLookup('{$string_action}&'+serialform, this)", FALSE);
         }
         if ($this->mask) {
             $this->tag->onKeyPress = "return entryMask(this,event,'{$this->mask}')";
         }
     } else {
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
         $this->tag->style = "width:{$this->size}px;" . "-moz-user-select:none;";
         $this->tag->onmouseover = "style.cursor='default'";
     }
     // shows the tag
     $this->tag->show();
     if (isset($this->completion)) {
         $options = json_encode($this->completion);
         $script = new TElement('script');
         $script->add("\$('input[name=\"{$this->name}\"]').autocomplete({source: {$options} });");
         $script->show();
     }
     if ($this->numericMask) {
         $script = new TElement('script');
         $script->add("\$('input[name=\"{$this->name}\"]').iMask({\n\t\t                        type : 'number',\n\t\t                        decDigits   : {$this->decimals},\n\t\t                        decSymbol   : '{$this->decimalsSeparator}',\n\t\t                        groupSymbol : '{$this->thousandSeparator}'\n\t                    });");
         $script->show();
     }
 }
コード例 #26
0
 /**
  * Shows the widget
  */
 public function show()
 {
     // define the tag properties
     $this->tag->name = $this->name;
     // tag name
     $this->setProperty('style', "width:{$this->size}px", FALSE);
     //aggregate style info
     // creates an empty <option> tag
     $option = new TElement('option');
     $option->add('');
     $option->value = '';
     // tag value
     // add the option tag to the combo
     $this->tag->add($option);
     if ($this->items) {
         // iterate the combobox items
         foreach ($this->items as $chave => $item) {
             if (substr($chave, 0, 3) == '>>>') {
                 $optgroup = new TElement('optgroup');
                 $optgroup->label = $item;
                 // add the option to the combo
                 $this->tag->add($optgroup);
             } else {
                 // creates an <option> tag
                 $option = new TElement('option');
                 $option->value = $chave;
                 // define the index
                 $option->add($item);
                 // add the item label
                 // verify if this option is selected
                 if ($chave == $this->value and $this->value !== NULL) {
                     // mark as selected
                     $option->selected = 1;
                 }
                 if (isset($optgroup)) {
                     $optgroup->add($option);
                 } else {
                     $this->tag->add($option);
                 }
             }
         }
     }
     // verify whether the widget is editable
     if (parent::getEditable()) {
         if (isset($this->changeAction)) {
             if (!TForm::getFormByName($this->formName) instanceof TForm) {
                 throw new Exception(TAdiantiCoreTranslator::translate('You must pass the ^1 (^2) as a parameter to ^3', __CLASS__, $this->name, 'TForm::setFields()'));
             }
             $string_action = $this->changeAction->serialize(FALSE);
             $this->setProperty('onChange', "serialform=(\$('#{$this->formName}').serialize());\n                                              ajaxLookup('{$string_action}&'+serialform, this)");
         }
     } else {
         // make the widget read-only
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
     }
     // shows the combobox
     $this->tag->show();
 }
コード例 #27
0
 /**
  * Shows the widget at the screen
  */
 public function show()
 {
     if ($this->items) {
         $i = 1;
         // iterate the checkgroup options
         foreach ($this->items as $index => $label) {
             // instantiates a new Item
             $item = new TElement('li');
             if ($this->itemIcon) {
                 $item->add($this->itemIcon);
             }
             $item->add(new TLabel($label));
             $item->{'class'} = 'tsortlist_item btn';
             $item->{'style'} = 'display:block;';
             $item->{'id'} = "tsortlist_{$this->name}_item_{$i}_li";
             $item->{'title'} = $this->tag->title;
             $input = new TElement('input');
             $input->{'id'} = "tsortlist_{$this->name}_item_{$i}_li_input";
             $input->{'type'} = 'hidden';
             $input->{'name'} = $this->name . '[]';
             $input->{'value'} = $index;
             $item->add($input);
             $this->tag->add($item);
             $i++;
         }
     }
     if (parent::getEditable()) {
         $connect = '';
         if ($this->connectedTo and is_array($this->connectedTo)) {
             foreach ($this->connectedTo as $connectedList) {
                 $connectIds[] = "#{$connectedList->{'id'}}";
             }
             $connect = 'connectWith: "' . implode(', ', $connectIds) . '", ';
         }
         $script = new TElement('script');
         $script->type = 'text/javascript';
         $script->add("\n            \t\$(function() {\n                    \$( \"#{$this->id}\" ).sortable({\n                        {$connect}\n                        start: function(event,ui){\n                            ui.item.data('index',ui.item.index());\n                            ui.item.data('parenta',this.id);\n                        },\n                        receive: function(event, ui) {\n                            var sourceList = ui.sender;\n                            var targetList = \$(this);\n                            targetListName = this.getAttribute('itemname');\n                            document.getElementById(ui.item.attr('id') + '_input').name = targetListName + '[]';\n                        }\n                    }).disableSelection();\n            });");
         $script->show();
     }
     $this->tag->show();
 }