XOOPS  2.6.0
menus_menu.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 
24 {
28  public function __construct(MenusMenu &$obj)
29  {
30  global $menu_id;
33  $this_handler = $helper->getHandlerMenu();
35 
36  $title = $obj->isNew() ? sprintf(_AM_MENUS_ADD_MENUS) : sprintf(_AM_MENUS_EDIT_MENUS);
37 
38  parent::__construct($title, 'form', 'admin_menu.php', 'post', true);
39 
40  $this->addElement(new Xoops\Form\Text(_AM_MENUS_MENU_TITLE, 'title', 50, 255, $obj->getVar('title'), ''), true);
41 
42  $this->addElement(new Xoops\Form\Text(_AM_MENUS_MENU_ALTTITLE, 'alt_title', 50, 255, $obj->getVar('alt_title'), ''));
43 
44  $this->addElement(new Xoops\Form\Text(_AM_MENUS_MENU_LINK, 'link', 50, 255, $obj->getVar('link'), ''));
45 
46  $this->addElement(new Xoops\Form\Text(_AM_MENUS_MENU_IMAGE, 'image', 50, 255, $obj->getVar('image'), ''));
47 
48  $criteria = new CriteriaCompo(new Criteria('mid', $menu_id));
49  $criteria->add(new Criteria('id', $obj->getVar('id'), '<>'));
50  $criteria->setSort('weight');
51  $criteria->setOrder('ASC');
52  $results = $this_handler->getAll($criteria, array('title', 'id', 'pid'));
53  $parent_tree = new XoopsObjectTree($results, 'id', 'pid');
54  $parent_select = $parent_tree->makeSelBox('pid', 'title', '-- ', $obj->getVar('pid'), true);
55  $this->addElement(new Xoops\Form\Label(_AM_MENUS_MENU_PARENT, $parent_select));
56 
57  $formvis = new Xoops\Form\Select(_AM_MENUS_MENU_VISIBLE, "visible", $obj->getVar('visible'));
58  $formvis->addOption("0", XoopsLocale::NO);
59  $formvis->addOption("1", XoopsLocale::YES);
60  $this->addElement($formvis);
61 
62  $formtarget = new Xoops\Form\Select(_AM_MENUS_MENU_TARGET, "target", $obj->getVar('target'));
63  $formtarget->addOption("_self", _AM_MENUS_MENU_TARG_SELF);
64  $formtarget->addOption("_blank", _AM_MENUS_MENU_TARG_BLANK);
65  $formtarget->addOption("_parent", _AM_MENUS_MENU_TARG_PARENT);
66  $formtarget->addOption("_top", _AM_MENUS_MENU_TARG_TOP);
67  $this->addElement($formtarget);
68 
69  $formgroups = new Xoops\Form\SelectGroup(_AM_MENUS_MENU_GROUPS, "groups", true, $obj->getVar('groups'), 5, true);
71  $this->addElement($formgroups);
72 
73  $formhooks = new Xoops\Form\Select(_AM_MENUS_MENU_ACCESS_FILTER, "hooks", $obj->getVar('hooks'), 5, true);
74  $accessFilter = array();
75  foreach ($decorators as $decorator) {
76  $decorator->accessFilter($accessFilter);
77  }
78  foreach ($accessFilter as $result) {
79  $formhooks->addOption($result['method'], $result['name']);
80  }
81  $this->addElement($formhooks);
82 
83  $formcss = new Xoops\Form\Text(_AM_MENUS_MENU_CSS, 'css', 50, 255, $obj->getVar('css'));
84  $this->addElement($formcss);
85 
86  $this->addElement(new Xoops\Form\Hidden('id', $obj->getVar('id')));
87  $this->addElement(new Xoops\Form\Hidden('mid', $obj->getVar('mid')));
88  $this->addElement(new Xoops\Form\Hidden('op', 'save'));
89  $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
90  }
91 }
const A_SUBMIT
Definition: en_US.php:128
static getInstance()
Definition: Xoops.php:160
addElement(Element $formElement, $required=false)
Definition: Form.php:206
$result
Definition: pda.php:33
static getInstance()
Definition: helper.php:34
const _AM_MENUS_ADD_MENUS
Definition: admin.php:20
getVar($key, $format= 's')
const _AM_MENUS_MENU_GROUPS_HELP
Definition: admin.php:13
const _AM_MENUS_MENU_TARG_SELF
Definition: admin.php:25
const _AM_MENUS_MENU_VISIBLE
Definition: admin.php:10
$xoops
Definition: admin.php:25
const _AM_MENUS_MENU_IMAGE
Definition: admin.php:15
const _AM_MENUS_MENU_ACCESS_FILTER
Definition: admin.php:18
const _AM_MENUS_MENU_TARG_BLANK
Definition: admin.php:26
const _AM_MENUS_MENU_CSS
Definition: admin.php:16
const _AM_MENUS_MENU_TARG_TOP
Definition: admin.php:28
const _AM_MENUS_MENU_GROUPS
Definition: admin.php:12
const _AM_MENUS_MENU_TARGET
Definition: admin.php:11
addOption($value, $name= '')
Definition: Select.php:113
$helper
__construct(MenusMenu &$obj)
Definition: menus_menu.php:28
static getAvailableDecorators()
Definition: decorator.php:40
$criteria
const _AM_MENUS_MENU_TITLE
Definition: admin.php:6
const _AM_MENUS_EDIT_MENUS
Definition: admin.php:22
const _AM_MENUS_MENU_PARENT
Definition: admin.php:9
const _AM_MENUS_MENU_TARG_PARENT
Definition: admin.php:27
setDescription($description)
Definition: Element.php:449
const _AM_MENUS_MENU_ALTTITLE
Definition: admin.php:7
const _AM_MENUS_MENU_LINK
Definition: admin.php:8
$menu_id
Definition: admin_menu.php:59