1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11:
12: 13: 14: 15: 16: 17: 18: 19:
20:
21: class ImagesCategory_imagemanagerForm extends Xoops\Form\ThemeForm
22: {
23: 24: 25: 26: 27:
28: public function __construct($param)
29: {
30: $xoops = Xoops::getInstance();
31: $groups = $xoops->getUserGroups();
32: extract($param);
33: $helper = Xoops\Module\Helper::getHelper('images');
34: $categories = $helper->getHandlerCategories()->getListByPermission($groups, 'imgcat_read');
35:
36: parent::__construct('', '', $xoops->getEnv('PHP_SELF'), 'post', false, 'inline');
37: $select = new Xoops\Form\Select('', 'imgcat_id', $imgcat_id);
38: $select->addOption(0, _AM_IMAGES_CAT_SELECT);
39: $select->addOptionArray($categories);
40: if (isset($target)) {
41: $select->setExtra("onchange='javascript:window.location.href=\"" . $xoops->getEnv('PHP_SELF') . "?target=" . $target . "&imgcat_id=\" + this.value'");
42: } else {
43: $select->setExtra("onchange='javascript:window.location.href=\"" . $xoops->getEnv('PHP_SELF') . "?imgcat_id=\" + this.value'");
44: }
45: $this->addElement($select);
46:
47: if (isset($target)) {
48: $this->addElement(new Xoops\Form\Hidden('target', $target));
49: }
50:
51: $write = $helper->getHandlerCategories()->getListByPermission($groups, 'imgcat_write');
52: if ($imgcat_id > 0 && array_key_exists($imgcat_id, $write)) {
53: $this->addElement(new Xoops\Form\Hidden('op', 'upload'));
54: $buttonSubmit = new Xoops\Form\Button('', 'submit', _IMAGES_ADD, 'submit');
55: $buttonSubmit->setClass('btn btn-success floatright');
56: $this->addElement($buttonSubmit);
57: }
58: }
59: }
60: