4
lets say i made this class.
class/xoopsform/formdualselect.php
le="color: #000000"><?php class XoopsFormDualSelect extends XoopsFormElement { var $_first; var $_second; function XoopsFormDualSelect($caption, $firstObj, $secondObj) { $this->_first = $firstObj; $this->_second = $secondObj; $this->setCaption($caption); } /** * Prepare HTML for output * * @return string HTML */ function render() { $ele_name = $this->_first->getName(); $ele_title = $this->_first->getTitle(); $ele_value = $this->_first->getValue(); $ele_options = $this->_first->getOptions(); $ret = '<select size="' . $this->_first->getSize() . '"' . $this->_first->getExtra(); if ($this->_first->isMultiple() != false) { $ret .= ' name="' . $ele_name . '[]" id="' . $ele_name . '" title="'. $ele_title. '" multiple="multiple">' ; } else { $ret .= ' name="' . $ele_name . '" id="' . $ele_name . '" title="'. $ele_title. '">' ; } foreach($ele_options as $value => $name) { $ret .= '<option value="' . htmlspecialchars($value, ENT_QUOTES) . '"'; if (count($ele_value) > 0 && in_array($value, $ele_value)) { $ret .= ' selected="selected"'; } $ret .= '>' . $name . '</option>' ; } $ret .= '</select>'; $ele_name = $this->_second->getName(); $ele_title = $this->_second->getTitle(); $ele_value = $this->_second->getValue(); $ele_options = $this->_second->getOptions(); $ret .= ' <select size="' . $this->_second->getSize() . '"' . $this->_second->getExtra(); if ($this->_second->isMultiple() != false) { $ret .= ' name="' . $ele_name . '[]" id="' . $ele_name . '" title="'. $ele_title. '" multiple="multiple">' ; } else { $ret .= ' name="' . $ele_name . '" id="' . $ele_name . '" title="'. $ele_title. '">' ; } foreach($ele_options as $value => $name) { $ret .= '<option value="' . htmlspecialchars($value, ENT_QUOTES) . '"'; if (count($ele_value) > 0 && in_array($value, $ele_value)) { $ret .= ' selected="selected"'; } $ret .= '>' . $name . '</option>' ; } $ret .= '</select>'; return $ret; } /** * @seealso XoopsForm::renderValidationJS */ function renderValidationJS() { //not finished. return ''; } }
i could use.
le="color: #000000"><?php //load class file include_once $GLOBALS['xoops']->path('class/xoopsform/formdualselect.php'); $dualDrop = new XoopsFormDualSelect('Something Cool',$umode_select,$uorder_select); //adding two xoopsselect obj to the element $form->addElement($dualDrop); //adding to the form
the above code is not tested well. (made it in like 10 minutes, but works). hopefully someone can build on it.
CBB / LatestNews / Publisher / XM-Spotlight
(ノ◕ヮ◕)ノ*:・゚✧