XOOPS  2.6.0
category.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 
13 
23 {
27  public function __construct(ImagesCategory $obj)
28  {
30 
31  $perm_handler = $xoops->getHandlerGroupperm();
32 
33  if ($obj->isNew()) {
35  $read = FixedGroups::ADMIN;
36  $write = FixedGroups::ADMIN;
37  } else {
39  $read = $perm_handler->getGroupIds('imgcat_read', $obj->getVar('imgcat_id'), $xoops->module->getVar('mid'));
40  $write = $perm_handler->getGroupIds('imgcat_write', $obj->getVar('imgcat_id'), $xoops->module->getVar('mid'));
41  }
42 
43  parent::__construct($title, 'imagecat_form', $xoops->getEnv('PHP_SELF'), 'post', true);
44 
45  $tabtray = new Xoops\Form\TabTray('', 'uniqueid', $xoops->getModuleConfig('jquery_theme', 'system'));
46 
47  $tab1 = new Xoops\Form\Tab(_MI_IMAGES_CATEGORIES, 'tabid-1');
48  $tab1->addElement(new Xoops\Form\Text(_AM_IMAGES_CAT_NAME, 'imgcat_name', 50, 255, $obj->getVar('imgcat_name')), true);
49  $tab1->addElement(new Xoops\Form\Text(_AM_IMAGES_CAT_SIZE, 'imgcat_maxsize', 2, 8, $obj->getVar('imgcat_maxsize')));
50  $tab1->addElement(new Xoops\Form\Text(_AM_IMAGES_CAT_WIDTH, 'imgcat_maxwidth', 1, 4, $obj->getVar('imgcat_maxwidth')));
51  $tab1->addElement(new Xoops\Form\Text(_AM_IMAGES_CAT_HEIGHT, 'imgcat_maxheight', 1, 4, $obj->getVar('imgcat_maxheight')));
52  $tab1->addElement(new Xoops\Form\Text(_AM_IMAGES_WEIGHT, 'imgcat_weight', 1, 5, $obj->getVar('imgcat_weight')));
53  $tab1->addElement(new Xoops\Form\RadioYesNo(_AM_IMAGES_CAT_DISPLAY, 'imgcat_display', $obj->getVar('imgcat_display')));
54  if ($obj->isNew()) {
55  $store = new Xoops\Form\Radio(_AM_IMAGES_CAT_STR_TYPE . '<div class="red">' . _AM_IMAGES_CAT_STR_TYOPENG . '</div>', 'imgcat_storetype', 'file');
56  $store->addOptionArray(array('file' => _AM_IMAGES_CAT_ASFILE, 'db' => _AM_IMAGES_CAT_INDB));
57  $tab1->addElement($store);
58  } else {
59  $store = array('db' => _AM_IMAGES_CAT_INDB, 'file' => _AM_IMAGES_CAT_ASFILE);
60  $tab1->addElement(new Xoops\Form\Label(_AM_IMAGES_CAT_STR_TYPE, $store[$obj->getVar('imgcat_storetype')]));
61  $this->addElement(new Xoops\Form\Hidden('imgcat_storetype', $obj->getVar('imgcat_storetype')));
62  }
63 
64  $tab2 = new Xoops\Form\Tab(_MI_IMAGES_PERMISSIONS, 'tabid-2');
65  $tab2->addElement(new Xoops\Form\SelectGroup(_AM_IMAGES_CAT_READ_GRP, 'readgroup', true, $read, 5, true));
66  $tab2->addElement(new Xoops\Form\SelectGroup(_AM_IMAGES_CAT_WRITE_GRP, 'writegroup', true, $write, 5, true));
67 
68  $tabtray->addElement($tab1);
69  $tabtray->addElement($tab2);
70  $this->addElement($tabtray);
71 
72  $this->addElement(new Xoops\Form\Hidden('imgcat_id', $obj->getVar('imgcat_id')));
73 
78  $button_tray->addElement(new Xoops\Form\Hidden('op', 'save'));
79 
80  $button = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit');
81  $button->setClass('btn btn-success');
82  $button_tray->addElement($button);
83 
84  $button_2 = new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset');
85  $button_2->setClass('btn btn-warning');
86  $button_tray->addElement($button_2);
87 
88  $button_3 = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button');
89  $button_3->setExtra("onclick='javascript:history.go(-1);'");
90  $button_3->setClass('btn btn-danger');
91  $button_tray->addElement($button_3);
92 
93  $this->addElement($button_tray);
94  }
95 }
const _AM_IMAGES_CAT_STR_TYOPENG
Definition: admin.php:52
const A_SUBMIT
Definition: en_US.php:128
const _MI_IMAGES_PERMISSIONS
Definition: modinfo.php:28
const _AM_IMAGES_CAT_HEIGHT
Definition: admin.php:56
const A_RESET
Definition: en_US.php:121
static getInstance()
Definition: Xoops.php:160
addElement(Element $formElement, $required=false)
Definition: Form.php:206
const _MI_IMAGES_CATEGORIES
Definition: modinfo.php:26
const _AM_IMAGES_WEIGHT
Definition: admin.php:29
const _AM_IMAGES_CAT_DISPLAY
Definition: admin.php:50
const _AM_IMAGES_CAT_STR_TYPE
Definition: admin.php:51
const _AM_IMAGES_CAT_WIDTH
Definition: admin.php:55
getVar($key, $format= 's')
$button
Definition: xoops_code.php:29
$xoops
Definition: admin.php:25
const _AM_IMAGES_CAT_ADD
Definition: admin.php:33
const _AM_IMAGES_CAT_SIZE
Definition: admin.php:54
const _AM_IMAGES_CAT_INDB
Definition: admin.php:45
const A_CANCEL
Definition: en_US.php:82
const _AM_IMAGES_CAT_ASFILE
Definition: admin.php:46
$button_tray
Definition: xoops_code.php:26
$button_2
Definition: xoops_code.php:34
const _AM_IMAGES_CAT_NAME
Definition: admin.php:47
__construct(ImagesCategory $obj)
Definition: category.php:27
const _AM_IMAGES_CAT_WRITE_GRP
Definition: admin.php:49
$button_3
Definition: xoops_code.php:38
const _AM_IMAGES_CAT_READ_GRP
Definition: admin.php:48
const _AM_IMAGES_CAT_EDIT
Definition: admin.php:34