Ejemplo n.º 1
0
 /**
  * Shows the widget at the screen
  */
 public function show()
 {
     $js_mask = str_replace('yyyy', 'yy', $this->mask);
     if (parent::getEditable()) {
         $script = new TElement('script');
         $script->type = 'text/javascript';
         $script->add("\n            \t\$(function() {\n                \$(\"#{$this->id}\").datepicker({\n                    showOn: 'button',\n                    buttonImage: 'lib/adianti/images/tdate.png',\n                    buttonImageOnly: true,    \n            \t\tchangeMonth: true,\n            \t\tchangeYear: true,\n            \t\tdateFormat: '{$js_mask}',\n            \t\tshowButtonPanel: true\n            \t});\n            });");
         $script->show();
     }
     parent::show();
 }
Ejemplo n.º 2
0
 /**
  * Show the widget
  */
 public function show()
 {
     // check if it's not editable
     if (parent::getEditable()) {
         $serialized_action = '';
         if ($this->action) {
             // get the action class name
             if (is_array($callback = $this->action->getAction())) {
                 $classname = get_class($callback[0]);
                 $inst = new $classname();
                 $ajaxAction = new TAction(array($inst, 'onSelect'));
                 if ($classname == 'TStandardSeek') {
                     $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'));
                 }
                 $string_action = $ajaxAction->serialize(FALSE);
                 if ($this->useOutEvent) {
                     $this->setProperty('onBlur', "serialform=(\$('#{$this->formName}').serialize());\n                                                      ajaxLookup('{$string_action}&'+serialform, this)");
                 }
             }
             $serialized_action = $this->action->serialize(FALSE);
         }
         parent::show();
         $image = new TImage('lib/adianti/images/ico_find.png');
         $link = new TElement('a');
         $link->onmouseover = 'style.cursor = \'pointer\'';
         $link->onmouseout = 'style.cursor = \'default\'';
         $link->onclick = "javascript:serialform=(\$('#{$this->formName}').serialize());\n                  __adianti_append_page('engine.php?{$serialized_action}&'+serialform)";
         $link->add($image);
         $link->show();
         if ($this->auxiliar) {
             echo ' ';
             $this->auxiliar->show();
         }
     } else {
         parent::show();
     }
 }
Ejemplo n.º 3
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(TAdiantiCoreTranslator::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())) {
                 $classname = is_object($callback[0]) ? get_class($callback[0]) : $callback[0];
                 $inst = new $classname();
                 $ajaxAction = new TAction(array($inst, 'onSelect'));
                 if ($classname == 'TStandardSeek') {
                     $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'));
                 }
                 $string_action = $ajaxAction->serialize(FALSE);
                 if ($this->useOutEvent) {
                     $this->setProperty('seekaction', "serialform=(\$('#{$this->formName}').serialize());\n                                                         ajaxLookup('{$string_action}&'+serialform, document.{$this->formName}.{$this->name})");
                     $this->setProperty('onBlur', $this->getProperty('seekaction'), FALSE);
                 }
             }
             $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 ' ';
             $this->auxiliar->show();
         }
     } else {
         parent::show();
     }
 }