Beispiel #1
0
 /**
  * Shows the widget
  */
 public function show()
 {
     parent::show();
     $min = $this->minLength;
     $orderColumn = isset($this->orderColumn) ? $this->orderColumn : $this->column;
     $criteria = '';
     if ($this->criteria) {
         $criteria = base64_encode(serialize($this->criteria));
     }
     $seed = APPLICATION_NAME . 's8dkld83kf73kf094';
     $hash = md5("{$seed}{$this->database}{$this->column}{$this->model}");
     $length = $this->minLength;
     $class = 'AdiantiAutocompleteService';
     $callback = array($class, 'onSearch');
     $method = $callback[1];
     $url = "engine.php?class={$class}&method={$method}&static=1&database={$this->database}&column={$this->column}&model={$this->model}&orderColumn={$orderColumn}&criteria={$criteria}&operator={$this->operator}&hash={$hash}";
     TScript::create(" tdbentry_start( '{$this->name}', '{$url}', '{$min}' );");
 }
Beispiel #2
0
 /**
  * Shows the widget at the screen
  */
 public function show()
 {
     $wrapper = new TElement('div');
     $wrapper->{'class'} = 'input-group color-div';
     $span = new TElement('span');
     $span->{'class'} = 'input-group-addon tcolor';
     $i = new TElement('i');
     $i->{'class'} = 'tcolor-icon';
     $span->add($i);
     ob_start();
     parent::show();
     $child = ob_get_contents();
     ob_end_clean();
     $wrapper->add($child);
     $wrapper->add($span);
     $wrapper->show();
     if (parent::getEditable()) {
         TScript::create(" tcolor_start(); ");
     }
 }
 /**
  * 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 = "aux_entry = document.getElementById('{$this->name}'); aux_entry.value = this.value;";
     $this->setProperty('style', "width:{$this->size}px", FALSE);
     //aggregate style info
     $this->tag->auxiliar = 1;
     // 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();
 }
Beispiel #4
0
 /**
  * Show the widget
  */
 public function show()
 {
     // check if it's not editable
     if (parent::getEditable()) {
         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()'));
         }
         $serialized_action = '';
         if ($this->action) {
             // get the action class name
             if (is_array($callback = $this->action->getAction())) {
                 if (is_object($callback[0])) {
                     $rc = new ReflectionClass($callback[0]);
                     $classname = $rc->getShortName();
                 } else {
                     $classname = $callback[0];
                 }
                 $inst = new $classname();
                 $ajaxAction = new TAction(array($inst, 'onSelect'));
                 if (in_array($classname, array('TStandardSeek2'))) {
                     $ajaxAction->setParameter('parent', $this->action->getParameter('parent'));
                     $ajaxAction->setParameter('database', $this->action->getParameter('database'));
                     $ajaxAction->setParameter('model', $this->action->getParameter('model'));
                     $ajaxAction->setParameter('display_field', $this->action->getParameter('display_field'));
                     $ajaxAction->setParameter('receive_key', $this->action->getParameter('receive_key'));
                     $ajaxAction->setParameter('receive_field', $this->action->getParameter('receive_field'));
                     $ajaxAction->setParameter('criteria', $this->action->getParameter('criteria'));
                     $ajaxAction->setParameter('display_field2', $this->action->getParameter('display_field2'));
                 } else {
                     if ($actionParameters = $this->action->getParameters()) {
                         foreach ($actionParameters as $key => $value) {
                             $ajaxAction->setParameter($key, $value);
                         }
                     }
                 }
                 $ajaxAction->setParameter('form_name', $this->formName);
                 $string_action = $ajaxAction->serialize(FALSE);
                 if ($this->useOutEvent) {
                     $this->setProperty('seekaction', "__adianti_post_lookup('{$this->formName}', '{$string_action}', document.{$this->formName}.{$this->name})");
                     $this->setProperty('onBlur', $this->getProperty('seekaction'), FALSE);
                 }
             }
             $this->action->setParameter('form_name', $this->formName);
             $serialized_action = $this->action->serialize(FALSE);
         }
         parent::show();
         $this->button->onclick = "javascript:serialform=(\$('#{$this->formName}').serialize());\n                  __adianti_append_page('engine.php?{$serialized_action}&'+serialform)";
         $this->button->show();
         if ($this->auxiliar) {
             echo '&nbsp;';
             $this->auxiliar->show();
         }
     } else {
         parent::show();
     }
 }
Beispiel #5
0
 /**
  * Shows the widget at the screen
  */
 public function show()
 {
     $js_mask = str_replace('yyyy', 'yy', $this->mask);
     $language = strtolower(LANG);
     if (parent::getEditable()) {
         TScript::create("tdate_start( '#{$this->id}', '{$this->mask}', '{$language}');");
     }
     parent::show();
 }