コード例 #1
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();
 }
コード例 #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
ファイル: 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";
             }
         }
     }
 }
コード例 #4
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();
 }
コード例 #5
0
 /**
  * Class Constructor
  * @param $name Name of the widget
  */
 public function __construct($name)
 {
     parent::__construct($name);
     $this->widget = new GtkEntry();
     parent::add($this->widget);
     $this->setSize(200);
 }
コード例 #6
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";
         }
     }
 }
コード例 #7
0
 /**
  * Class Constructor
  * @param $name Name of the widget
  */
 public function __construct($name)
 {
     parent::__construct($name);
     $this->widget = new GtkFileChooserButton(TAdiantiCoreTranslator::translate('Open'), GTK::FILE_CHOOSER_ACTION_OPEN);
     parent::add($this->widget);
     $this->setSize(200);
 }
コード例 #8
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();
 }
コード例 #9
0
 /**
  * Define the widget's content
  * @param  $value  widget's content
  */
 public function setValue($value)
 {
     $value = str_replace('<br>', "\n", $value);
     $value = str_replace('&nbsp;', ' ', $value);
     $this->value = $value;
     parent::set_text($value);
     $this->show();
 }
コード例 #10
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();
     }
 }
コード例 #11
0
 /**
  * Class Constructor
  * @param  $name widget's name
  */
 public function __construct($name)
 {
     parent::__construct($name);
     $this->widget = GtkComboBox::new_text();
     parent::add($this->widget);
     // create the combo model
     $this->model = new GtkListStore(GObject::TYPE_STRING, GObject::TYPE_STRING);
     $this->widget->set_model($this->model);
     $this->setSize(200);
 }
コード例 #12
0
 /**
  * Class Constructor
  * @param $name Name of the widget
  */
 public function __construct($name)
 {
     parent::__construct($name);
     $this->widget = new GtkEntry();
     parent::add($this->widget);
     $this->setSize(200);
     $this->chars = array('-', '_', '.', '/', '\\', ':', '|', '(', ')', '[', ']', '{', '}');
     // Connecting 'changed' signal to check the typed chars.
     $this->handler = $this->widget->connect_after('changed', array($this, 'onChanged'));
 }
コード例 #13
0
 /**
  * Class Constructor
  * @param $name Widet's name
  */
 public function __construct($name)
 {
     parent::__construct($name);
     $this->widget = new GtkScrolledWindow();
     $this->widget->set_size_request(200, -1);
     parent::add($this->widget);
     $this->textview = new GtkTextView();
     $this->textview->set_wrap_mode(Gtk::WRAP_WORD);
     $this->textbuffer = $this->textview->get_buffer();
     $this->widget->add($this->textview);
 }
コード例 #14
0
 /**
  * Class Constructor
  * @param $name Name of the widget
  */
 public function __construct($name)
 {
     parent::__construct($name);
     $this->widget = new GtkHBox();
     parent::add($this->widget);
     $this->entry = new GtkEntry();
     $this->btn = new TButton('find');
     $this->btn->set_image(new TImage('lib/adianti/images/ico_find.png'));
     $this->btn->set_relief(Gtk::RELIEF_NONE);
     $this->useOutEvent = TRUE;
     $this->validations = array();
     $this->widget->pack_start($this->entry, false, false);
     $this->widget->pack_start($this->btn, false, false);
 }
コード例 #15
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();
 }
コード例 #16
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();
     }
 }
コード例 #17
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();
 }
コード例 #18
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();
 }
コード例 #19
0
 /**
  * Class Constructor
  * @param  $name widget's name
  * @param  $text widget's name
  */
 public function __construct($name, $text_name)
 {
     parent::__construct($name);
     $this->widget = new GtkHBox();
     parent::add($this->widget);
     $this->text_name = $text_name;
     // create the combo model
     $this->model = new GtkListStore(GObject::TYPE_STRING, GObject::TYPE_STRING);
     $this->entry = new GtkEntry();
     $this->entry->set_size_request(50, 25);
     $this->entry->set_sensitive(FALSE);
     $this->combo = GtkComboBox::new_text();
     $this->combo->set_model($this->model);
     $this->combo->set_size_request(200, -1);
     $this->combo->connect_simple('changed', array($this, 'onComboChange'));
     $this->widget->pack_start($this->entry);
     $this->widget->pack_start($this->combo);
 }
コード例 #20
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();
 }
コード例 #21
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();
 }
コード例 #22
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();
 }
コード例 #23
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();
 }
コード例 #24
0
 /**
  * Class Constructor
  * @param  $name widget's name
  */
 function __construct($name)
 {
     parent::__construct($name);
     $this->widget = new GtkFrame();
     parent::add($this->widget);
     $this->container = new GtkVBox();
     $this->initialItems = array();
     $this->items = array();
     $targets = array(array('text/plain', 0, -1));
     $this->widget->connect('drag_data_received', array($this, 'onDataReceived'));
     $this->widget->drag_dest_set(Gtk::DEST_DEFAULT_ALL, $targets, Gdk::ACTION_COPY);
     $scroll = new GtkScrolledWindow();
     $scroll->set_border_width(4);
     $this->widget->add($scroll);
     $hbox = new GtkHBox();
     $scroll->add_with_viewport($hbox);
     $hbox->pack_start($this->container, TRUE, TRUE);
     $hbox->set_border_width(20);
     parent::show_all();
 }
コード例 #25
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();
 }
コード例 #26
0
 /**
  * Class Constructor
  * @param  $name widget's name
  */
 function __construct($name)
 {
     parent::__construct($name);
     $this->widget = new GtkScrolledWindow();
     $this->widget->set_policy(GTK::POLICY_AUTOMATIC, GTK::POLICY_ALWAYS);
     parent::add($this->widget);
     $this->tree = new GtkTreeView();
     $this->tree->connect_simple('select-cursor-row', array($this, 'onPreExecuteExitAction'));
     $this->tree->connect_simple('button-press-event', array($this, 'onPreExecuteExitAction'));
     $this->model = new GtkListStore(GObject::TYPE_STRING, GObject::TYPE_STRING);
     $this->tree->set_model($this->model);
     $this->tree->set_headers_visible(FALSE);
     $this->tree->set_rubber_banding(TRUE);
     $this->tree->get_selection()->set_mode(Gtk::SELECTION_MULTIPLE);
     $column = new GtkTreeViewColumn();
     $cell_renderer = new GtkCellRendererText();
     $column->pack_start($cell_renderer, true);
     $column->add_attribute($cell_renderer, 'text', 1);
     $this->tree->append_column($column);
     $this->widget->add($this->tree);
     parent::show_all();
 }
コード例 #27
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();
 }
コード例 #28
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();
 }
コード例 #29
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();
 }
コード例 #30
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();
 }