Exemple #1
0
 /**
  * render
  *
  * @return string
  */
 public function render()
 {
     $editor_handler = \XoopsEditorHandler::getInstance();
     $editor_handler->allowed_editors = $this->allowed_editors;
     $option_select = new Select("", $this->name, $this->value);
     $onchangeCode = '"if(this.options[this.selectedIndex].value.length > 0 ){window.document.forms.' . $this->form->getName() . '.submit();}"';
     $option_select->set('onchange', $onchangeCode);
     $option_select->addOptionArray($editor_handler->getList($this->nohtml));
     $this->addElement($option_select);
     return parent::render();
 }
Exemple #2
0
 /**
  * create HTML to output the form as a table
  *
  * @return string
  */
 public function render()
 {
     $xoops = \Xoops::getInstance();
     $xoops->theme()->addBaseScriptAssets('@jquery');
     $xoops->theme()->addBaseScriptAssets('@jqueryui');
     $xoops->theme()->addBaseStylesheetAssets('@jqueryuicss');
     $xoops->theme()->addScript('', '', '$(function() { $("#tabs_' . $this->getName() . '").tabs(); });');
     $ret = '<div id="tabs_' . $this->getName() . '">' . NWLINE;
     $ret .= '<ul>' . NWLINE;
     foreach ($this->getElements() as $ele) {
         if ($ele instanceof Tab) {
             $ret .= '<li><a href="#tab_' . $ele->getName() . '"><span>' . $ele->getCaption() . '</span></a></li>' . NWLINE;
         }
     }
     $ret .= '</ul>' . NWLINE;
     $hidden = '';
     $extras = array();
     foreach ($this->getElements() as $ele) {
         /* @var $ele Element */
         if (!$ele->isHidden()) {
             if (!$ele instanceof Raw) {
                 if ($ele instanceof Tab) {
                     $ret .= '<div id="tab_' . $ele->getName() . '">' . NWLINE;
                     $ret .= '<table class="outer" cellspacing="1">' . NWLINE;
                     $ret .= $ele->render();
                     $ret .= '</table>' . NWLINE;
                     $ret .= '</div>' . NWLINE;
                 } else {
                     $extras[] = $ele;
                 }
             } else {
                 $ret .= $ele->render();
             }
         } else {
             $hidden .= $ele->render();
         }
     }
     if (!empty($extras)) {
         $tray = new ElementTray('', $this->getDelimiter());
         foreach ($extras as $extra) {
             $tray->addElement($extra);
         }
         $ret .= $tray->render();
         $ret .= NWLINE;
     }
     $ret .= $hidden . NWLINE;
     $ret .= '</div>' . NWLINE;
     return $ret;
 }
 /**
  * @covers Xoops\Form\ElementTray::render
  * @todo   Implement testRender().
  */
 public function testRender()
 {
     $value = $this->object->render();
     $this->assertTrue(is_string($value));
 }