| 1: | <?php |
| 2: | /** |
| 3: | * XOOPS form element |
| 4: | * |
| 5: | * You may not change or alter any portion of this comment or credits |
| 6: | * of supporting developers from this source code or any supporting source code |
| 7: | * which is considered copyrighted (c) material of the original comment or credit authors. |
| 8: | * This program is distributed in the hope that it will be useful, |
| 9: | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10: | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 11: | * |
| 12: | * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) |
| 13: | * @license GNU GPL 2 (https://www.gnu.org/licenses/gpl-2.0.html) |
| 14: | * @package kernel |
| 15: | * @subpackage form |
| 16: | * @since 2.0.0 |
| 17: | * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, http://jp.xoops.org/ |
| 18: | */ |
| 19: | |
| 20: | defined('XOOPS_ROOT_PATH') || exit('Restricted access'); |
| 21: | |
| 22: | xoops_load('XoopsLists'); |
| 23: | xoops_load('XoopsFormSelect'); |
| 24: | |
| 25: | /** |
| 26: | * A select box with available themes |
| 27: | */ |
| 28: | class XoopsFormSelectTheme extends XoopsFormSelect |
| 29: | { |
| 30: | /** |
| 31: | * Constructor |
| 32: | * |
| 33: | * @param string $caption |
| 34: | * @param string $name |
| 35: | * @param mixed $value Pre-selected value (or array of them). |
| 36: | * @param int $size Number of rows. "1" makes a drop-down-list |
| 37: | * @param bool $theme_set_allowed Flag to use only selectable theme |
| 38: | */ |
| 39: | public function __construct($caption, $name, $value = null, $size = 1, $theme_set_allowed = false) |
| 40: | { |
| 41: | parent::__construct($caption, $name, $value, $size); |
| 42: | if ($theme_set_allowed === false) { |
| 43: | $this->addOptionArray(XoopsLists::getThemesList()); |
| 44: | } else { |
| 45: | $theme_arr = $GLOBALS['xoopsConfig']['theme_set_allowed']; |
| 46: | foreach (array_keys($theme_arr) as $i) { |
| 47: | $this->addOption($theme_arr[$i], $theme_arr[$i]); |
| 48: | } |
| 49: | } |
| 50: | } |
| 51: | } |
| 52: |