本文整理汇总了PHP中XoopsFormSelect::addOption方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsFormSelect::addOption方法的具体用法?PHP XoopsFormSelect::addOption怎么用?PHP XoopsFormSelect::addOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsFormSelect
的用法示例。
在下文中一共展示了XoopsFormSelect::addOption方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createElements
function createElements($target)
{
$this->addElement(new XoopsFormText(_AM_MYTABS_TITLE, 'tabtitle', 35, 255, $target->getVar('tabtitle', 'e')));
$this->addElement(new XoopsFormDateTime(_AM_MYTABS_PUBLISHDATE, 'tabfromdate', 15, $target->getVar('tabfromdate', 'e')));
$this->addElement(new XoopsFormDateTime(_AM_MYTABS_ENDDATE, 'tabtodate', 15, $target->getVar('tabtodate', 'e')));
$always_select = new XoopsFormSelect(_AM_MYTABS_ALWAYSSHOW . ":", "tabalwayson", $target->getVar('tabshowalways', 'e'));
$always_select->addOption("yes", _AM_MYTABS_ALWAYS);
$always_select->addOption("time", _AM_MYTABS_TIMEBASED);
$always_select->addOption("no", _AM_MYTABS_OFF);
$this->addElement($always_select);
$this->addElement(new XoopsFormText(_AM_MYTABS_PRIORITY . ":", "tabpriority", 4, 5, $target->getVar('tabpriority', 'e')));
$note = new XoopsFormText(_AM_MYTABS_NOTE . ":", "tabnote", 50, 255, $target->getVar('tabnote', 'e'));
$this->addElement($note);
$this->addElement(new XoopsFormSelectGroup(_AM_MYTABS_GROUPS, 'tabgroups', true, $target->getVar('tabgroups'), 8, true));
$link = new XoopsFormText(_AM_MYTABS_LINK . ":", "tablink", 50, 255, $target->getVar('tablink', 'e'));
$this->addElement($link);
$rev = new XoopsFormText(_AM_MYTABS_REV . ":", "tabrev", 50, 255, $target->getVar('tabrev', 'e'));
$this->addElement($rev);
if (!$target->isNew()) {
$this->addElement(new XoopsFormHidden("tabid", $target->getVar('tabid')));
}
$this->addElement(new XoopsFormHidden("tabpageid", $target->getVar('tabpageid')));
$this->addElement(new XoopsFormHidden("op", "save"));
$tray = new XoopsFormElementTray("");
$tray->addElement(new XoopsFormButton("", "submit", _AM_MYTABS_OK, "submit"));
$cancel = new XoopsFormButton("", "cancel", _AM_MYTABS_CANCEL, "button");
$cancel->setExtra("onclick=\"self.location='index.php?pageid=" . $target->getVar('tabpageid') . "';\"");
$tray->addElement($cancel);
$this->addElement($tray);
}
示例2: XoopsThemeForm
function &execute(&$controller, &$request, &$user)
{
$editform =& $request->getAttribute('editform');
$form = new XoopsThemeForm(_MD_A_PLZXOO_LANG_EDIT_CATEGORY, 'Category', '', 'POST');
$form->addElement(new XoopsFormHidden('cid', $editform->cid_));
$form->addElement(new XoopsFormText(_MD_A_PLZXOO_LANG_NAME, 'name', 64, 255, $editform->name_));
//-------------------------
// ¿Æ¥«¥Æ¥´¥ê
//-------------------------
$select = new XoopsFormSelect(_MD_A_PLZXOO_LANG_PARENT_CATEGORY, 'pid', $editform->pid_);
$select->addOption(0, _MD_A_PLZXOO_LANG_TOP);
$categories =& $request->getAttribute('categories');
foreach ($categories as $category) {
$select->addOption($category->getVar('cid'), $category->getVar('name'));
}
$form->addElement($select);
unset($select);
$form->addElement(new XoopsFormDhtmlTextArea(_MD_A_PLZXOO_LANG_DESCRIPTION, 'description', $editform->description_, 6, 50));
$form->addElement(new XoopsFormText(_MD_A_PLZXOO_LANG_WEIGHT, 'weight', 10, 10, intval($editform->weight_)));
$tray = new XoopsFormElementTray(_MD_A_PLZXOO_LANG_CONTROL);
$tray->addElement(new XoopsFormButton('', 'submit', _MD_A_PLZXOO_LANG_SUBMIT, 'submit'));
$tray->addElement(new XoopsFormButton('', 'reset', _MD_A_PLZXOO_LANG_RESET, 'reset'));
$form->addElement($tray);
$renderer = new mojaLE_Renderer($controller, $request, $user);
$renderer->setTemplate('category_edit.tpl');
$renderer->setAttribute('xoopsform', $form);
return $renderer;
}
示例3: getForm
/**
* Get {@link XoopsForm} for setting prune criteria
*
* @return object
**/
function getForm($action = false)
{
if ($action === false) {
$action = $_SERVER['SCRIPT_NAME'];
}
$title = $this->isNew() ? sprintf(_MD_ILOG_INSERT, _MD_ILOG_INSERT) : sprintf(_MD_ILOG_EDIT, _MD_ILOG_EDIT);
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->addElement(new XoopsFormText(_MD_ILOG_TITLE, 'title', 60, 255, $this->getVar('title')));
//tag
$itemid = $this->isNew() ? 0 : $this->getVar("id");
include_once XOOPS_ROOT_PATH . "/modules/tag/include/formtag.php";
$form->addElement(new XoopsFormTag("keywords", 60, 255, $itemid, $catid = 0));
$configs = array('editor' => 'fckeditor', 'toolbarset' => 'ilog', 'width' => '100%', 'height' => '500px', 'value' => $this->getVar('text_body', 'e'));
$form->addElement(new XoopsFormEditor(_MD_ILOG_TEXT, 'text_body', $configs), true);
$configs = array('editor' => 'fckeditor', 'toolbarset' => 'Basic', 'width' => '100%', 'height' => '200px', 'value' => $this->getVar('summary', 'e'));
$form->addElement(new XoopsFormEditor(_MD_ILOG_SUMMARY, 'summary', $configs), true);
$form_select = new XoopsFormSelect(_MD_ILOG_STATUS, 'status', $this->getVar('status'));
$form_select->addOption('1', _MD_ILOG_ACCESSALL);
$form_select->addOption('2', _MD_ILOG_ACCESSME);
$form->addElement($form_select);
if (!$this->isNew()) {
//Load groups
$form->addElement(new XoopsFormHidden('id', $this->getVar('id')));
}
if ($this->isNew()) {
global $xoopsUser;
$form->addElement(new XoopsFormHidden('uid', $xoopsUser->uid()));
$form->addElement(new XoopsFormHidden('uname', $xoopsUser->getVar('uname')));
}
$form->addElement(new XoopsFormHidden('op', 'save'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}
示例4: b_smartmail_custom_edit
function b_smartmail_custom_edit($options)
{
$ts =& MyTextSanitizer::getInstance();
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
$form = new XoopsFormElementTray('', '<br />', 'options');
$form->addElement(new XoopsFormDhtmlTextArea(_NL_MB_CONTENT, 'options[0]', htmlspecialchars($ts->stripSlashesGPC($options[0]), ENT_QUOTES), 15, 60));
$type_select = new XoopsFormSelect(_NL_MB_CONTENTTYPE, 'options[1]', $options[1]);
$type_select->addOption('H', _NL_MB_HTMLBLOCK);
$type_select->addOption('S', _NL_MB_NOHTMLBLOCK);
$form->addElement($type_select);
return $form->render();
}
示例5: smartobject_addto_edit
function smartobject_addto_edit($options)
{
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
$form = '';
$layout_select = new XoopsFormSelect(_MB_SOBJECT_BLOCKS_ADDTO_LAYOUT, 'options[]', $options[0]);
$layout_select->addOption(0, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION0);
$layout_select->addOption(1, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION1);
$layout_select->addOption(2, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION2);
$layout_select->addOption(3, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION3);
$form .= $layout_select->getCaption() . ' ' . $layout_select->render() . '<br />';
return $form;
}
示例6: createElements
function createElements($target)
{
if ($target->isNew()) {
$this->addElement(new XoopsFormText(_AM_MYTABS_TITLE, 'title', 35, 255, $target->block->getVar('title', 'e')));
} else {
$this->addElement(new XoopsFormText(_AM_MYTABS_TITLE, 'title', 35, 255, $target->getVar('title', 'e')));
}
$options = $target->block->getOptions();
if ($options) {
$this->addElement(new XoopsFormLabel(_AM_MYTABS_OPTIONS, $options));
}
// DATE
$this->addElement(new XoopsFormDateTime(_AM_MYTABS_PUBLISHDATE, 'fromdate', 15, $target->getVar('fromdate', 'e')));
$this->addElement(new XoopsFormDateTime(_AM_MYTABS_ENDDATE, 'todate', 15, $target->getVar('todate', 'e')));
$always_select = new XoopsFormSelect(_AM_MYTABS_ALWAYSSHOW . ":", "alwayson", $target->getVar('showalways', 'e'));
$always_select->addOption("yes", _AM_MYTABS_ALWAYS);
$always_select->addOption("time", _AM_MYTABS_TIMEBASED);
$always_select->addOption("no", _AM_MYTABS_OFF);
$this->addElement($always_select);
$placement = new XoopsFormSelect(_AM_MYTABS_PLACEMENT . ":", "tabid", $target->getVar('tabid', 'e'));
$tab_handler = xoops_getmodulehandler('tab');
$tabs = $tab_handler->getObjects(new Criteria('tabpageid', $target->getVar('pageid')));
foreach ($tabs as $tab) {
$placement->addOption($tab->getVar('tabid'), $tab->getVar('tabtitle'));
}
$this->addElement($placement);
$block_placement = new XoopsFormSelect(_AM_MYTABS_BLOCK_PLACEMENT . ":", "placement", $target->getVar('placement', 'e'));
$block_placement->addOption("left", _AM_MYTABS_LEFT);
$block_placement->addOption("center", _AM_MYTABS_CENTER);
$block_placement->addOption("right", _AM_MYTABS_RIGHT);
$this->addElement($block_placement);
$this->addElement(new XoopsFormText(_AM_MYTABS_PRIORITY . ":", "priority", 4, 5, $target->getVar('priority', 'e')));
$cachetime = new XoopsFormSelect(_AM_MYTABS_CACHETIME, 'pbcachetime', $target->getVar('pbcachetime', 'e'));
$cache_options = array('0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK);
$cachetime->addOptionArray($cache_options);
$this->addElement($cachetime);
$this->addElement(new XoopsFormRadioYN(_AM_MYTABS_CACHEBYURL, 'cachebyurl', $target->getVar('cachebyurl', 'e')));
$note = new XoopsFormText(_AM_MYTABS_NOTE . ":", "note", 50, 255, $target->getVar('note', 'e'));
$this->addElement($note);
$this->addElement(new XoopsFormSelectGroup(_AM_MYTABS_GROUPS, 'groups', true, $target->getVar('groups'), 8, true));
if (!$target->isNew()) {
$this->addElement(new XoopsFormHidden("pageblockid", $target->getVar('pageblockid')));
}
$this->addElement(new XoopsFormHidden("blockid", $target->getVar('blockid')));
$this->addElement(new XoopsFormHidden("pageid", $target->getVar('pageid')));
$this->addElement(new XoopsFormHidden("op", "save"));
$tray = new XoopsFormElementTray("");
$tray->addElement(new XoopsFormButton("", "submit", _AM_MYTABS_OK, "submit"));
$cancel = new XoopsFormButton("", "cancel", _AM_MYTABS_CANCEL, "button");
$cancel->setExtra("onclick=\"self.location='index.php?pageid=" . $target->getVar('pageid') . "';\"");
$tray->addElement($cancel);
$this->addElement($tray);
}
示例7: getForm
/**
* @return XoopsThemeForm
*/
function getForm()
{
if ($this->isNew()) {
$blank_img = 'blank.gif';
} else {
$blank_img = str_replace('avatars/', '', $this->getVar('avatar_file', 'e'));
}
// Get User Config
$config_handler =& xoops_gethandler('config');
$xoopsConfigUser = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
// New and edit form
$form = new XoopsThemeForm(_AM_SYSTEM_AVATAR_ADD, 'avatar_form', 'admin.php', "post", true);
$form->setExtra('enctype="multipart/form-data"');
// Name
$form->addElement(new XoopsFormText(_IMAGENAME, 'avatar_name', 50, 255, $this->getVar('avatar_name', 'e')), true);
// Name description
$maxpixel = '<div>' . _US_MAXPIXEL . ' : ' . $xoopsConfigUser['avatar_width'] . ' x ' . $xoopsConfigUser['avatar_height'] . '</div>';
$maxsize = '<div>' . _US_MAXIMGSZ . ' : ' . $xoopsConfigUser['avatar_maxsize'] . '</div>';
// Upload part
$imgtray_img = new XoopsFormElementTray(_IMAGEFILE, '<br />');
$imgtray_img->setDescription($maxpixel . $maxsize);
$imageselect_img = new XoopsFormSelect(sprintf(_AM_SYSTEM_AVATAR_USE_FILE, XOOPS_UPLOAD_PATH . '/avatars/'), 'avatar_file', $blank_img);
$image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH . '/avatars');
$imageselect_img->addOption("{$blank_img}", $blank_img);
foreach ($image_array_img as $image_img) {
$imageselect_img->addOption("{$image_img}", $image_img);
}
$imageselect_img->setExtra("onchange='showImgSelected(\"xo-avatar-img\", \"avatar_file\", \"avatars\", \"\", \"" . XOOPS_UPLOAD_URL . "\")'");
$imgtray_img->addElement($imageselect_img, false);
$imgtray_img->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_UPLOAD_URL . "/avatars/" . $blank_img . "' name='image_img' id='xo-avatar-img' alt='' />"));
$fileseltray_img = new XoopsFormElementTray('<br />', '<br /><br />');
$fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_AVATAR_UPLOAD, 'avatar_file', 500000), false);
$imgtray_img->addElement($fileseltray_img);
$form->addElement($imgtray_img);
// Weight
$form->addElement(new XoopsFormText(_IMGWEIGHT, 'avatar_weight', 3, 4, $this->getVar('avatar_weight', 'e')));
// Display
$form->addElement(new XoopsFormRadioYN(_IMGDISPLAY, 'avatar_display', $this->getVar('avatar_display', 'e'), _YES, _NO));
// Hidden
if ($this->isNew()) {
$form->addElement(new XoopsFormHidden('avatar_type', 's'));
}
$form->addElement(new XoopsFormHidden('op', 'save'));
$form->addElement(new XoopsFormHidden('fct', 'avatars'));
$form->addElement(new XoopsFormHidden('avatar_id', $this->getVar('avatar_id', 'e')));
// Button
$form->addElement(new XoopsFormButton('', 'avt_button', _SUBMIT, 'submit'));
return $form;
}
示例8: getForm
function getForm($action = false)
{
if ($this->isNew()) {
$blank_img = 'blank.gif';
} else {
$blank_img = str_replace('ranks/', '', $this->getVar('rank_image', 'e'));
}
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
$title = $this->isNew() ? sprintf(_AM_SYSTEM_USERRANK_ADD) : sprintf(_AM_SYSTEM_USERRANK_EDIT);
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
$form->addElement(new XoopsFormText(_AM_SYSTEM_USERRANK_TITLE, 'rank_title', 50, 50, $this->getVar('rank_title'), true));
$form->addElement(new XoopsFormText(_AM_SYSTEM_USERRANK_MINPOST, 'rank_min', 10, 10, $this->getVar('rank_min')));
$form->addElement(new XoopsFormText(_AM_SYSTEM_USERRANK_MAXPOST, 'rank_max', 10, 10, $this->getVar('rank_max')));
$imgtray_img = new XoopsFormElementTray(_AM_SYSTEM_USERRANK_IMAGE, '<br />');
$imgpath_img = sprintf(_AM_SYSTEM_USERRANK_IMAGE_PATH, XOOPS_UPLOAD_PATH . '/ranks/');
$imageselect_img = new XoopsFormSelect($imgpath_img, 'rank_image', $blank_img);
$image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH . '/ranks');
$imageselect_img->addOption("{$blank_img}", $blank_img);
foreach ($image_array_img as $image_img) {
$imageselect_img->addOption("{$image_img}", $image_img);
}
$imageselect_img->setExtra("onchange='showImgSelected(\"xo-ranks-img\", \"rank_image\", \"ranks\", \"\", \"" . XOOPS_UPLOAD_URL . "\")'");
$imgtray_img->addElement($imageselect_img, false);
$imgtray_img->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_UPLOAD_URL . "/ranks/" . $blank_img . "' name='image_img' id='xo-ranks-img' alt='' />"));
$fileseltray_img = new XoopsFormElementTray('<br />', '<br /><br />');
$fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_USERRANK_UPLOAD, 'rank_image', 500000), false);
$fileseltray_img->addElement(new XoopsFormLabel(''), false);
$imgtray_img->addElement($fileseltray_img);
$form->addElement($imgtray_img);
if (!$this->isNew()) {
$rank_special = $this->getVar('rank_special');
} else {
$rank_special = 0;
}
$special_tray = new XoopsFormElementTray(_AM_SYSTEM_USERRANK_SPECIAL, '<br />');
$special_tray->setDescription(_AM_SYSTEM_USERRANK_SPECIAL_CAN);
$special_tray->addElement(new XoopsFormRadioYN('', 'rank_special', $rank_special));
$form->addElement($special_tray);
if (!$this->isNew()) {
$form->addElement(new XoopsFormHidden('rank_id', $this->getVar('rank_id')));
}
$form->addElement(new XoopsFormHidden('op', 'userrank_save'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}
示例9: XoopsFormSelectUser
/**
* Constructor
*
* @param string $caption
* @param string $name
* @param mixed $value Pre-selected value (or array of them).
* For an item with massive members, such as "Registered Users", "$value" should be used to store selected temporary users only instead of all members of that item
* @param bool $include_anon Include user "anonymous"?
* @param int $size Number or rows. "1" makes a drop-down-list.
* @param bool $multiple Allow multiple selections?
*/
function XoopsFormSelectUser($caption, $name, $value = array(), $include_anon = false, $size = 1, $multiple = false)
{
$this->XoopsFormElementTray($caption, "<br /><br />", $name);
$select_form = new XoopsFormSelect("", $name, $value, $size, $multiple);
if ($include_anon) {
$select_form->addOption(0, $GLOBALS["xoopsConfig"]['anonymous']);
}
$member_handler =& xoops_gethandler('member');
$criteria = new CriteriaCompo();
if (!is_array($value)) {
$value = array($value);
}
if (is_array($value) && count($value) > 0) {
$id_in = "(" . implode(",", $value) . ")";
$criteria->add(new Criteria("uid", $id_in, "IN"));
$criteria->setSort('name');
$criteria->setOrder('ASC');
$users = $member_handler->getUserList($criteria);
$select_form->addOptionArray($member_handler->getUserList($criteria));
}
$action_tray = new XoopsFormElementTray("", " | ");
$action_tray->addElement(new XoopsFormLabel('', "<a href='###' onclick='return openWithSelfMain(\"" . XOOPS_URL . "/modules/system/include/userselect.php?action=1&target=" . $name . "&multiple=" . $multiple . "\", \"userselect\", 800, 500, null);' >" . _LIST . "</a>"));
$action_tray->addElement(new XoopsFormLabel('', "<a href='###' onclick='return openWithSelfMain(\"" . XOOPS_URL . "/modules/system/include/userselect.php?action=0&target=" . $name . "&multiple=" . $multiple . "\", \"userselect\", 800, 500, null);' >" . _SEARCH . "</a>"));
$action_tray->addElement(new XoopsFormLabel('', "<a href='###' onclick='var sel = xoopsGetElementById(\"" . $name . "\");for (var i = sel.options.length-1; i >= 0; i--) {if (sel.options[i].selected) {sel.options[i] = null;}}'>" . _REMOVE . "</a>" . "<script type=\"text/javascript\">\n\t\t function addusers(opts){\n\t\t\t var num = opts.substring(0, opts.indexOf(\":\"));\n\t\t\t opts = opts.substring(opts.indexOf(\":\")+1, opts.length);\n \t\tvar sel = xoopsGetElementById(\"" . $name . "\");\n\t\t\t var arr = new Array(num);\n\t\t\t for(var n=0; n<num; n++){\n\t\t\t \tvar nm = opts.substring(0, opts.indexOf(\":\"));\n\t\t\t \topts = opts.substring(opts.indexOf(\":\")+1, opts.length);\n\t\t\t \tvar val = opts.substring(0, opts.indexOf(\":\"));\n\t\t\t \topts = opts.substring(opts.indexOf(\":\")+1, opts.length);\n\t\t\t \tvar txt = opts.substring(0, nm - val.length);\n\t\t\t \topts = opts.substring(nm - val.length, opts.length);\n\t\t\t\t\tvar added = false;\n\t\t\t\t\tfor (var k = 0; k < sel.options.length; k++) {\n\t\t\t\t\t\tif(sel.options[k].value == val){\n\t\t\t\t\t\t\tadded = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(added==false){\n\t\t\t\t\t\tappendSelectOption(\"" . $name . "\",txt, val);\n\t \t\t}\n\t\t\t }\n\t\t\t\treturn true;\n\t\t }\n\t\t\t</script>"));
$this->addElement($select_form);
$this->addElement($action_tray);
}
示例10: XoopsFormSelectUser
/**
* Constructor
*
* @param string $caption
* @param string $name
* @param mixed $value Pre-selected value (or array of them).
* For an item with massive members, such as "Registered Users", "$value" should be used to store selected temporary users only instead of all members of that item
* @param bool $include_anon Include user "anonymous"?
* @param int $size Number or rows. "1" makes a drop-down-list.
* @param bool $multiple Allow multiple selections?
*/
function XoopsFormSelectUser($caption, $name, $include_anon = false, $value = null, $size = 1, $multiple = false)
{
$limit = 200;
$select_element = new XoopsFormSelect('', $name, $value, $size, $multiple);
if ($include_anon) {
$select_element->addOption(0, $GLOBALS['xoopsConfig']['anonymous']);
}
$member_handler =& xoops_gethandler('member');
$user_count = $member_handler->getUserCount();
$value = is_array($value) ? $value : (empty($value) ? array() : array($value));
if ($user_count > $limit && count($value) > 0) {
$criteria = new CriteriaCompo(new Criteria('uid', '(' . implode(',', $value) . ')', 'IN'));
} else {
$criteria = new CriteriaCompo();
$criteria->setLimit($limit);
}
$criteria->setSort('uname');
$criteria->setOrder('ASC');
$users = $member_handler->getUserList($criteria);
$select_element->addOptionArray($users);
if ($user_count <= $limit) {
$this->XoopsFormElementTray($caption, "", $name);
$this->addElement($select_element);
return;
}
xoops_loadLanguage('findusers');
$js_addusers = "<script type='text/javascript'>\r\n function addusers(opts){\r\n var num = opts.substring(0, opts.indexOf(':'));\r\n opts = opts.substring(opts.indexOf(':')+1, opts.length);\r\n var sel = xoopsGetElementById('" . $name . "');\r\n var arr = new Array(num);\r\n for (var n=0; n < num; n++) {\r\n var nm = opts.substring(0, opts.indexOf(':'));\r\n opts = opts.substring(opts.indexOf(':')+1, opts.length);\r\n var val = opts.substring(0, opts.indexOf(':'));\r\n opts = opts.substring(opts.indexOf(':')+1, opts.length);\r\n var txt = opts.substring(0, nm - val.length);\r\n opts = opts.substring(nm - val.length, opts.length);\r\n var added = false;\r\n for (var k = 0; k < sel.options.length; k++) {\r\n if(sel.options[k].value == val){\r\n added = true;\r\n break;\r\n }\r\n }\r\n if (added == false) {\r\n sel.options[k] = new Option(txt, val);\r\n sel.options[k].selected = true;\r\n }\r\n }\r\n return true;\r\n }\r\n </script>";
$token = $GLOBALS['xoopsSecurity']->createToken();
$action_tray = new XoopsFormElementTray("", " | ");
$action_tray->addElement(new XoopsFormLabel('', '<a href="#" onclick="var sel = xoopsGetElementById(\'' . $name . '\');for (var i = sel.options.length-1; i >= 0; i--) {if (!sel.options[i].selected) {sel.options[i] = null;}}; return false;">' . _MA_USER_REMOVE . "</a>"));
$action_tray->addElement(new XoopsFormLabel('', '<a href="#" onclick="openWithSelfMain(\'' . XOOPS_URL . '/include/findusers.php?target=' . $name . '&multiple=' . $multiple . '&token=' . $token . '\', \'userselect\', 800, 600, null); return false;" >' . _MA_USER_MORE . "</a>" . $js_addusers));
$this->XoopsFormElementTray($caption, '<br /><br />', $name);
$this->addElement($select_element);
$this->addElement($action_tray);
}
示例11: brandForm
function brandForm($action = false)
{
global $xoopsModuleConfig;
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
$country_handler = xoops_getmodulehandler('country', 'catalog');
$title = $this->isNew() ? _AM_CATALOG_ADDBRAND : _AM_CATALOG_UPDATEBRAND;
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
$form->addElement(new XoopsFormText(_AM_CATALOG_BRANDNAME, 'brand_name', 60, 255, $this->getVar('brand_name')), true);
$countys =& $country_handler->getList();
$county_select = new XoopsFormSelect(_AM_CATALOG_CHOICECOUNTRY, "country_id", $this->getVar("country_id"));
$county_select->addOption('', _AM_CATALOG_CHOICE);
$county_select->addOptionArray($countys);
$form->addElement($county_select);
$configs = array('editor' => 'fckeditor', 'width' => '100%', 'height' => '150px', 'value' => $this->getVar('brand_description'));
$form->addElement(new XoopsFormEditor(_AM_CATALOG_BRANDDESC, 'brand_description', $configs, $nohtml = false, $OnFailure = ""));
if ($this->isNew()) {
$form->addElement(new XoopsFormHidden('brand_published', time()));
}
$form->addElement(new XoopsFormHidden('brand_id', $this->getVar('brand_id')));
$form->addElement(new XoopsFormHidden('ac', 'save'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}
示例12: links_block_edit
function links_block_edit($options)
{
include_once XOOPS_ROOT_PATH . "/modules/links/include/xoopsformloader.php";
$form = new XoopsBlockForm("", "", "");
$categories = new XoopsFormSelect(_MB_LINKS_SHOWCAT, 'options[0]', $options[0]);
$categories->addOption(0, _MB_LINKS_ALL);
$cat_handler = xoops_getmodulehandler('category', 'links');
$criteria = new CriteriaCompo();
$criteria->setSort('cat_order');
$criteria->setOrder('ASC');
$category = $cat_handler->getList($criteria);
foreach ($cat_handler->getList($criteria) as $k => $v) {
$categories->addOption($k, $v);
}
$form->addElement($categories, true);
$sort = new XoopsFormSelect(_MB_LINKS_SORTWAY, 'options[1]', $options[1]);
$sort->addOption('published', _MB_LINKS_PUBLISHTIME);
$sort->addOption('datetime', _MB_LINKS_UPDATETIME);
$sort->addOption('link_order', _MB_LINKS_DEFAULT);
$form->addElement($sort, true);
$form->addElement(new XoopsFormText(_MB_LINKS_SHOWHOWLIK, "options[2]", 5, 2, $options[2]), true);
$form->addElement(new XoopsFormText(_MB_LINKS_LIKTITLEMAX, "options[3]", 5, 2, $options[3]), true);
$form->addElement(new XoopsFormRadioYN(_MB_LINKS_SHOWCATTITLE, 'options[4]', $options[4]), true);
$display = new XoopsFormSelect(_MB_LINKS_BYSHOW, 'options[5]', $options[5]);
$display->addOption('1', _MB_LINKS_LOGOHOR);
$display->addOption('2', _MB_LINKS_LOGOVER);
$display->addOption('3', _MB_LINKS_TITLEHOR);
$display->addOption('4', _MB_LINKS_TITLEVER);
$form->addElement($display, true);
return $form->render();
}
示例13: getForm
/**
* @param bool $action
*
* @return XoopsThemeForm
*/
function getForm($action = false)
{
if ($this->isNew()) {
$blank_img = 'blank.gif';
} else {
$blank_img = str_replace('smilies/', '', $this->getVar('smile_url', 'e'));
}
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
$title = $this->isNew() ? sprintf(_AM_SYSTEM_SMILIES_ADD) : sprintf(_AM_SYSTEM_SMILIES_EDIT);
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
$form->addElement(new XoopsFormText(_AM_SYSTEM_SMILIES_CODE, 'code', 26, 25, $this->getVar('code')), true);
$form->addElement(new XoopsFormText(_AM_SYSTEM_SMILIES_DESCRIPTION, 'emotion', 50, 50, $this->getVar('emotion')), true);
$imgtray_img = new XoopsFormElementTray(_AM_SYSTEM_SMILIES_FILE, '<br />');
$imgpath_img = sprintf(_AM_SYSTEM_SMILIES_IMAGE_PATH, XOOPS_UPLOAD_PATH . '/smilies/');
$imageselect_img = new XoopsFormSelect($imgpath_img, 'smile_url', $blank_img);
$image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH . '/smilies');
$imageselect_img->addOption("{$blank_img}", $blank_img);
foreach ($image_array_img as $image_img) {
$imageselect_img->addOption("{$image_img}", $image_img);
}
$imageselect_img->setExtra('onchange="showImgSelected(\'xo-smilies-img\', \'smile_url\', \'smilies\', \'\', \'' . XOOPS_UPLOAD_URL . '\' )"');
$imgtray_img->addElement($imageselect_img, false);
$imgtray_img->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_UPLOAD_URL . "/smilies/" . $blank_img . "' name='image_img' id='xo-smilies-img' alt='' />"));
$fileseltray_img = new XoopsFormElementTray('<br />', '<br /><br />');
$fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_SMILIES_UPLOADS, 'smile_url', 500000), false);
$fileseltray_img->addElement(new XoopsFormLabel(''), false);
$imgtray_img->addElement($fileseltray_img);
$form->addElement($imgtray_img);
if (!$this->isNew()) {
$form->addElement(new XoopsFormHidden('smilies_id', $this->getVar('id')));
$display = $this->getVar('display');
} else {
$display = 0;
}
$form->addElement(new XoopsFormRadioYN(_AM_SYSTEM_SMILIES_OFF, 'display', $display));
$form->addElement(new XoopsFormHidden('op', 'save_smilie'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}
示例14: createElements
function createElements($target)
{
// $plugin->doConfig($form);
$this->addElement(new XoopsFormText(_SMARTBLOCKS_TITLE, 'title', 35, 255, $target->getVar('title', 'e')));
$options = $target->block->getOptions();
if ($options) {
$this->addElement(new XoopsFormLabel(_SMARTBLOCKS_OPTIONS, $options));
}
// DATE
$this->addElement(new XoopsFormDateTime(_SMARTBLOCKS_PUBLISHDATE, 'fromdate', 15, $target->getVar('fromdate', 'e')));
$this->addElement(new XoopsFormDateTime(_SMARTBLOCKS_ENDDATE, 'todate', 15, $target->getVar('todate', 'e')));
$always_select = new XoopsFormSelect(_SMARTBLOCKS_ALWAYSSHOW . ":", "alwayson", $target->getVar('showalways', 'e'));
$always_select->addOption("yes", _SMARTBLOCKS_ALWAYS);
$always_select->addOption("time", _SMARTBLOCKS_TIMEBASED);
$always_select->addOption("no", _SMARTBLOCKS_OFF);
$this->addElement($always_select);
$placement = new XoopsFormSelect(_SMARTBLOCKS_PLACEMENT . ":", "placement", $target->getVar('placement', 'e'));
$placement->addOption(1, _SMARTBLOCKS_LEFT);
$placement->addOption(2, _SMARTBLOCKS_RIGHT);
$placement->addOption(3, _SMARTBLOCKS_CENTER);
$placement->addOption(4, _SMARTBLOCKS_CENTER_LEFT);
$placement->addOption(5, _SMARTBLOCKS_CENTER_RIGHT);
$placement->addOption(6, _SMARTBLOCKS_BCENTER);
$placement->addOption(7, _SMARTBLOCKS_BCENTER_LEFT);
$placement->addOption(8, _SMARTBLOCKS_BCENTER_RIGHT);
$this->addElement($placement);
$this->addElement(new XoopsFormText(_SMARTBLOCKS_PRIORITY . ":", "priority", 4, 5, $target->getVar('priority', 'e')));
$falldown =& new XoopsFormCheckBox(_SMARTBLOCKS_FALLDOWN . ":", "falldown", $target->getVar('falldown', 'e'));
$falldown->addOption(1, _YES);
$this->addElement($falldown);
$cachetime = new XoopsFormSelect(_SMARTBLOCKS_CACHETIME, 'pbcachetime', $target->getVar('pbcachetime', 'e'));
$cache_options = array('0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK);
$cachetime->addOptionArray($cache_options);
$this->addElement($cachetime);
$this->addElement(new XoopsFormRadioYN(_SMARTBLOCKS_CACHEBYURL, 'cachebyurl', $target->getVar('cachebyurl', 'e')));
$note =& new XoopsFormText(_SMARTBLOCKS_NOTE . ":", "note", 50, 255, $target->getVar('note', 'e'));
$this->addElement($note);
$this->addElement(new XoopsFormSelectGroup(_SMARTBLOCKS_GROUPS, 'groups', true, $target->getVar('groups'), 8, true));
if ($target->isNew()) {
$this->addElement(new XoopsFormHidden("blockid", $target->block->getVar('bid')));
$this->addElement(new XoopsFormHidden("moduleid", $target->getVar('moduleid')));
$this->addElement(new XoopsFormHidden("location", $target->getVar('location')));
}
$this->addElement(new XoopsFormHidden("pageblockid", $target->getVar('pageblockid')));
$this->addElement(new XoopsFormHidden("op", "save"));
$tray =& new XoopsFormElementTray("");
$tray->addElement(new XoopsFormButton("", "submit", _SMARTBLOCKS_OK, "submit"));
$cancel =& new XoopsFormButton("", "cancel", _SMARTBLOCKS_CANCEL, "button");
$cancel->setExtra("onclick=\"self.location='page.php?location=" . $target->getVar('location') . "&moduleid=" . $target->getVar('moduleid') . "';\"");
$tray->addElement($cancel);
$this->addElement($tray);
}
示例15: b_ams_author_edit
function b_ams_author_edit($options)
{
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
$form = new XoopsFormElementTray('', '<br/>');
$sort_select = new XoopsFormSelect(_AMS_MB_NEWS_ORDER, 'options[0]', $options[0]);
$sort_select->addOption('count', _AMS_MB_NEWS_ARTCOUNT);
$sort_select->addOption('read', _AMS_MB_NEWS_HITS);
$sort_select->addOption('rating', _AMS_MB_NEWS_RATING);
$form->addElement($sort_select);
$form->addElement(new XoopsFormText(_AMS_MB_NEWS_DISP, 'options[1]', 20, 15, $options[1]));
$name_select = new XoopsFormSelect(_AMS_MB_NEWS_DISPLAYNAME, 'options[2]', $options[2]);
$name_select->addOption('uname', _AMS_MB_NEWS_USERNAME);
$name_select->addOption('name', _AMS_MB_NEWS_REALNAME);
$form->addElement($name_select);
$average_select = new XoopsFormSelect(_AMS_MB_NEWS_COMPUTING, 'options[3]', $options[3]);
$average_select->addOption('average', _AMS_MB_NEWS_AVERAGE);
$average_select->addOption('total', _AMS_MB_NEWS_TOTAL);
$form->addElement($average_select);
return $form->render();
}