本文整理汇总了PHP中XoopsFormCheckBox::setClass方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsFormCheckBox::setClass方法的具体用法?PHP XoopsFormCheckBox::setClass怎么用?PHP XoopsFormCheckBox::setClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsFormCheckBox
的用法示例。
在下文中一共展示了XoopsFormCheckBox::setClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getForm
/**
* @param bool $action
*
* @return XoopsThemeForm
*/
public function getForm($action = false)
{
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
if ($this->isNew()) {
$s_cat_value = '';
$a_mod_value = array();
$r_mod_value = array();
$r_block_value = array();
} else {
$sysperm_handler = xoops_getHandler('groupperm');
$s_cat_value = $sysperm_handler->getItemIds('system_admin', $this->getVar('groupid'));
$member_handler = xoops_getHandler('member');
$thisgroup = $member_handler->getGroup($this->getVar('groupid'));
$moduleperm_handler = xoops_getHandler('groupperm');
$a_mod_value = $moduleperm_handler->getItemIds('module_admin', $thisgroup->getVar('groupid'));
$r_mod_value = $moduleperm_handler->getItemIds('module_read', $thisgroup->getVar('groupid'));
$gperm_handler = xoops_getHandler('groupperm');
$r_block_value = $gperm_handler->getItemIds('block_read', $this->getVar('groupid'));
}
xoops_load('XoopsFormLoader');
xoops_load('XoopsLists');
include_once XOOPS_ROOT_PATH . '/modules/system/constants.php';
$title = $this->isNew() ? sprintf(_AM_SYSTEM_GROUPS_ADD) : sprintf(_AM_SYSTEM_GROUPS_EDIT);
$form = new XoopsThemeForm($title, 'groupform', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
$name_text = new XoopsFormText(_AM_SYSTEM_GROUPS_NAME, 'name', 30, 50, $this->getVar('name'));
$desc_text = new XoopsFormTextArea(_AM_SYSTEM_GROUPS_DESCRIPTION, 'desc', $this->getVar('description'));
$system_catids = new XoopsFormElementTray(_AM_SYSTEM_GROUPS_SYSTEMRIGHTS, '');
$s_cat_checkbox_all = new XoopsFormCheckBox('', 'catbox', 1);
$s_cat_checkbox_all->addOption('allbox', _AM_SYSTEM_ALL);
$s_cat_checkbox_all->setExtra(" onclick='xoopsCheckGroup(\"groupform\", \"catbox\" , \"system_catids[]\");' ");
$s_cat_checkbox_all->setClass('xo-checkall');
$system_catids->addElement($s_cat_checkbox_all);
$s_cat_checkbox = new XoopsFormCheckBox('', 'system_catids', $s_cat_value);
$s_cat_checkbox->columns = 6;
$admin_dir = XOOPS_ROOT_PATH . '/modules/system/admin/';
$dirlist = XoopsLists::getDirListAsArray($admin_dir);
foreach ($dirlist as $file) {
include XOOPS_ROOT_PATH . '/modules/system/admin/' . $file . '/xoops_version.php';
if (!empty($modversion['category'])) {
if (xoops_getModuleOption('active_' . $file, 'system') == 1) {
$s_cat_checkbox->addOption($modversion['category'], $modversion['name']);
}
}
unset($modversion);
}
unset($dirlist);
$system_catids->addElement($s_cat_checkbox);
$admin_mids = new XoopsFormElementTray(_AM_SYSTEM_GROUPS_ACTIVERIGHTS, '');
$s_admin_checkbox_all = new XoopsFormCheckBox('', 'adminbox', 1);
$s_admin_checkbox_all->addOption('allbox', _AM_SYSTEM_ALL);
$s_admin_checkbox_all->setExtra(" onclick='xoopsCheckGroup(\"groupform\", \"adminbox\" , \"admin_mids[]\");' ");
$s_admin_checkbox_all->setClass('xo-checkall');
$admin_mids->addElement($s_admin_checkbox_all);
$a_mod_checkbox = new XoopsFormCheckBox('', 'admin_mids[]', $a_mod_value);
$a_mod_checkbox->columns = 5;
$module_handler = xoops_getHandler('module');
$criteria = new CriteriaCompo(new Criteria('hasadmin', 1));
$criteria->add(new Criteria('isactive', 1));
$criteria->add(new Criteria('dirname', 'system', '<>'));
$a_mod_checkbox->addOptionArray($module_handler->getList($criteria));
$admin_mids->addElement($a_mod_checkbox);
$read_mids = new XoopsFormElementTray(_AM_SYSTEM_GROUPS_ACCESSRIGHTS, '');
$s_mod_checkbox_all = new XoopsFormCheckBox('', 'readbox', 1);
$s_mod_checkbox_all->addOption('allbox', _AM_SYSTEM_ALL);
$s_mod_checkbox_all->setExtra(" onclick='xoopsCheckGroup(\"groupform\", \"readbox\" , \"read_mids[]\");' ");
$s_mod_checkbox_all->setClass('xo-checkall');
$read_mids->addElement($s_mod_checkbox_all);
$r_mod_checkbox = new XoopsFormCheckBox('', 'read_mids[]', $r_mod_value);
$r_mod_checkbox->columns = 5;
$criteria = new CriteriaCompo(new Criteria('hasmain', 1));
$criteria->add(new Criteria('isactive', 1));
$r_mod_checkbox->addOptionArray($module_handler->getList($criteria));
$read_mids->addElement($r_mod_checkbox);
$criteria = new CriteriaCompo(new Criteria('isactive', 1));
$criteria->setSort('mid');
$criteria->setOrder('ASC');
$module_list = $module_handler->getList($criteria);
$module_list[0] = _AM_SYSTEM_GROUPS_CUSTOMBLOCK;
$block_handler = xoops_getHandler('block');
$blocks_obj = $block_handler->getObjects(new Criteria('mid', "('" . implode("', '", array_keys($module_list)) . "')", 'IN'), true);
$blocks_module = array();
foreach (array_keys($blocks_obj) as $bid) {
$title = $blocks_obj[$bid]->getVar('title');
$blocks_module[$blocks_obj[$bid]->getVar('mid')][$blocks_obj[$bid]->getVar('bid')] = empty($title) ? $blocks_obj[$bid]->getVar('name') : $title;
}
ksort($blocks_module);
$r_block_tray = new XoopsFormElementTray(_AM_SYSTEM_GROUPS_BLOCKRIGHTS, '<br><br>');
$s_checkbox_all = new XoopsFormCheckBox('', 'blocksbox', 1);
$s_checkbox_all->addOption('allbox', _AM_SYSTEM_ALL);
$s_checkbox_all->setExtra(" onclick='xoopsCheckGroup(\"groupform\", \"blocksbox\" , \"read_bids[]\");' ");
$s_checkbox_all->setClass('xo-checkall');
$r_block_tray->addElement($s_checkbox_all);
//.........这里部分代码省略.........
示例2: createElements
public function createElements()
{
include_once dirname(dirname(__DIR__)) . '/include/common.php';
// Category
$criteria = new Criteria(null);
$criteria->setSort('weight');
$criteria->setOrder('ASC');
$myTree = new XoopsObjectTree($this->publisher->getHandler('category')->getObjects($criteria), 'categoryid', 'parentid');
$catSelect = $myTree->makeSelBox('parentid', 'name', '--', $this->targetObject->parentid(), true);
$this->addElement(new XoopsFormLabel(_AM_PUBLISHER_PARENT_CATEGORY_EXP, $catSelect));
// Name
$this->addElement(new XoopsFormText(_AM_PUBLISHER_CATEGORY, 'name', 50, 255, $this->targetObject->name('e')), true);
// Description
$this->addElement(new XoopsFormTextArea(_AM_PUBLISHER_COLDESCRIPT, 'description', $this->targetObject->description('e'), 7, 60));
// EDITOR
$groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
$gpermHandler =& $this->publisher->getHandler('groupperm');
$moduleId = $this->publisher->getModule()->mid();
$allowedEditors = publisherGetEditors($gpermHandler->getItemIds('editors', $groups, $moduleId));
$nohtml = false;
if (count($allowedEditors) > 0) {
$editor = XoopsRequest::getString('editor', '', 'POST');
if (!empty($editor)) {
publisherSetCookieVar('publisher_editor', $editor);
} else {
$editor = publisherGetCookieVar('publisher_editor');
if (empty($editor) && is_object($GLOBALS['xoopsUser'])) {
$editor = null !== $GLOBALS['xoopsUser']->getVar('publisher_editor') ? $GLOBALS['xoopsUser']->getVar('publisher_editor') : '';
// Need set through user profile
}
}
$editor = empty($editor) || !in_array($editor, $allowedEditors) ? $this->publisher->getConfig('submit_editor') : $editor;
$formEditor = new XoopsFormSelectEditor($this, 'editor', $editor, $nohtml, $allowedEditors);
$this->addElement($formEditor);
} else {
$editor = $this->publisher->getConfig('submit_editor');
}
$editorConfigs = array();
$editorConfigs['rows'] = $this->publisher->getConfig('submit_editor_rows') == '' ? 35 : $this->publisher->getConfig('submit_editor_rows');
$editorConfigs['cols'] = $this->publisher->getConfig('submit_editor_cols') == '' ? 60 : $this->publisher->getConfig('submit_editor_cols');
$editorConfigs['width'] = $this->publisher->getConfig('submit_editor_width') == '' ? '100%' : $this->publisher->getConfig('submit_editor_width');
$editorConfigs['height'] = $this->publisher->getConfig('submit_editor_height') == '' ? '400px' : $this->publisher->getConfig('submit_editor_height');
$editorConfigs['name'] = 'header';
$editorConfigs['value'] = $this->targetObject->header('e');
$textHeader = new XoopsFormEditor(_AM_PUBLISHER_CATEGORY_HEADER, $editor, $editorConfigs, $nohtml, $onfailure = null);
$textHeader->setDescription(_AM_PUBLISHER_CATEGORY_HEADER_DSC);
$this->addElement($textHeader);
// IMAGE
$imageArray = XoopsLists::getImgListAsArray(publisherGetImageDir('category'));
$imageSelect = new XoopsFormSelect('', 'image', $this->targetObject->getImage());
//$imageSelect -> addOption ('-1', '---------------');
$imageSelect->addOptionArray($imageArray);
$imageSelect->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . PUBLISHER_DIRNAME . '/images/category/' . "\", \"\", \"" . XOOPS_URL . "\")'");
$imageTray = new XoopsFormElementTray(_AM_PUBLISHER_IMAGE, ' ');
$imageTray->addElement($imageSelect);
$imageTray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . publisherGetImageDir('category', false) . $this->targetObject->getImage() . "' name='image3' id='image3' alt='' />"));
$imageTray->setDescription(_AM_PUBLISHER_IMAGE_DSC);
$this->addElement($imageTray);
// IMAGE UPLOAD
$max_size = 5000000;
$fileBox = new XoopsFormFile(_AM_PUBLISHER_IMAGE_UPLOAD, 'image_file', $max_size);
$fileBox->setExtra("size ='45'");
$fileBox->setDescription(_AM_PUBLISHER_IMAGE_UPLOAD_DSC);
$this->addElement($fileBox);
// Short url
$textShortUrl = new XoopsFormText(_AM_PUBLISHER_CATEGORY_SHORT_URL, 'short_url', 50, 255, $this->targetObject->short_url('e'));
$textShortUrl->setDescription(_AM_PUBLISHER_CATEGORY_SHORT_URL_DSC);
$this->addElement($textShortUrl);
// Meta Keywords
$textMetaKeywords = new XoopsFormTextArea(_AM_PUBLISHER_CATEGORY_META_KEYWORDS, 'meta_keywords', $this->targetObject->meta_keywords('e'), 7, 60);
$textMetaKeywords->setDescription(_AM_PUBLISHER_CATEGORY_META_KEYWORDS_DSC);
$this->addElement($textMetaKeywords);
// Meta Description
$textMetaDescription = new XoopsFormTextArea(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION, 'meta_description', $this->targetObject->meta_description('e'), 7, 60);
$textMetaDescription->setDescription(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION_DSC);
$this->addElement($textMetaDescription);
// Weight
$this->addElement(new XoopsFormText(_AM_PUBLISHER_COLPOSIT, 'weight', 4, 4, $this->targetObject->weight()));
// Added by skalpa: custom template support
//todo, check this
$this->addElement(new XoopsFormText('Custom template', 'template', 50, 255, $this->targetObject->template('e')), false);
// READ PERMISSIONS
$readPermissionsTray = new XoopsFormElementTray(_AM_PUBLISHER_PERMISSIONS_CAT_READ, '');
$selectAllReadCheckbox = new XoopsFormCheckBox('', "adminbox", 1);
$selectAllReadCheckbox->addOption('allbox', _AM_SYSTEM_ALL);
$selectAllReadCheckbox->setExtra(" onclick='xoopsCheckGroup(\"form\", \"adminbox\" , \"groupsRead[]\");' ");
$selectAllReadCheckbox->setClass('xo-checkall');
$readPermissionsTray->addElement($selectAllReadCheckbox);
$groupsReadCheckbox = new XoopsFormCheckBox('', 'groupsRead[]', $this->targetObject->getGroupsRead());
foreach ($this->userGroups as $group_id => $group_name) {
$groupsReadCheckbox->addOption($group_id, $group_name);
}
$readPermissionsTray->addElement($groupsReadCheckbox);
$this->addElement($readPermissionsTray);
// SUBMIT PERMISSIONS
$submitPermissionsTray = new XoopsFormElementTray(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT, '');
$submitPermissionsTray->setDescription(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT_DSC);
$selectAllSubmitCheckbox = new XoopsFormCheckBox('', "adminbox2", 1);
$selectAllSubmitCheckbox->addOption('allbox', _AM_SYSTEM_ALL);
$selectAllSubmitCheckbox->setExtra(" onclick='xoopsCheckGroup(\"form\", \"adminbox2\" , \"groupsSubmit[]\");' ");
//.........这里部分代码省略.........