XOOPS  2.6.0
category_imagemanager.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
22 {
28  public function __construct($param)
29  {
31  $groups = $xoops->getUserGroups();
32  extract($param);
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  $button = new Xoops\Form\Button('', 'submit', _IMAGES_ADD, 'submit');
55  $button->setClass('btn btn-success floatright');
56  $this->addElement($button);
57  }
58  }
59 }
static getInstance()
Definition: Xoops.php:160
const _IMAGES_ADD
Definition: main.php:27
addElement(Element $formElement, $required=false)
Definition: Form.php:206
const _AM_IMAGES_CAT_SELECT
Definition: admin.php:38
$button
Definition: xoops_code.php:29
$xoops
Definition: admin.php:25
static getHelper($dirname= 'system')
Definition: Helper.php:27
$groups
$imgcat_id
$helper
$target