| 1: | <?php
|
| 2: | |
| 3: | |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | |
| 15: | |
| 16: | |
| 17: | |
| 18: |
|
| 19: |
|
| 20: | defined('XOOPS_ROOT_PATH') || exit('Restricted access');
|
| 21: |
|
| 22: | xoops_load('XoopsFormElementTray');
|
| 23: |
|
| 24: | |
| 25: | |
| 26: |
|
| 27: | class XoopsFormSelectEditor extends XoopsFormElementTray
|
| 28: | {
|
| 29: | public $allowed_editors = array();
|
| 30: | public $form;
|
| 31: | public $value;
|
| 32: | public $name;
|
| 33: | public $nohtml;
|
| 34: |
|
| 35: | |
| 36: | |
| 37: | |
| 38: | |
| 39: | |
| 40: | |
| 41: | |
| 42: | |
| 43: | |
| 44: |
|
| 45: |
|
| 46: | public function __construct($form, $name = 'editor', $value = null, $nohtml = false, $allowed_editors = array())
|
| 47: | {
|
| 48: | parent::__construct(_SELECT);
|
| 49: | $this->allowed_editors = $allowed_editors;
|
| 50: | $this->form = $form;
|
| 51: | $this->name = $name;
|
| 52: | $this->value = $value;
|
| 53: | $this->nohtml = $nohtml;
|
| 54: | }
|
| 55: |
|
| 56: | |
| 57: | |
| 58: | |
| 59: | |
| 60: |
|
| 61: | public function render()
|
| 62: | {
|
| 63: | xoops_load('XoopsEditorHandler');
|
| 64: | $editor_handler = XoopsEditorHandler::getInstance();
|
| 65: | $editor_handler->allowed_editors = $this->allowed_editors;
|
| 66: | $option_select = new XoopsFormSelect('', $this->name, $this->value);
|
| 67: | $extra = 'onchange="if (this.options[this.selectedIndex].value.length > 0) {
|
| 68: | window.document.forms.' . $this->form->getName() . '.submit();
|
| 69: | }"';
|
| 70: | $option_select->setExtra($extra);
|
| 71: | $option_select->addOptionArray($editor_handler->getList($this->nohtml));
|
| 72: | $this->addElement($option_select);
|
| 73: |
|
| 74: | return parent::render();
|
| 75: | }
|
| 76: | }
|
| 77: | |