本文整理汇总了PHP中XoopsFormCheckBox::setExtra方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsFormCheckBox::setExtra方法的具体用法?PHP XoopsFormCheckBox::setExtra怎么用?PHP XoopsFormCheckBox::setExtra使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsFormCheckBox
的用法示例。
在下文中一共展示了XoopsFormCheckBox::setExtra方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
// text render
$editor_configs = array();
$editor_configs["name"] = "text";
$editor_configs["value"] = $text;
$editor_configs["rows"] = empty($xoopsModuleConfig["editor_rows"]) ? 35 : $xoopsModuleConfig["editor_rows"];
$editor_configs["cols"] = empty($xoopsModuleConfig["editor_cols"]) ? 60 : $xoopsModuleConfig["editor_cols"];
$editor_configs["width"] = empty($xoopsModuleConfig["editor_width"]) ? "100%" : $xoopsModuleConfig["editor_width"];
$editor_configs["height"] = empty($xoopsModuleConfig["editor_height"]) ? "400px" : $xoopsModuleConfig["editor_height"];
$form_element["active"]["text"] = new XoopsFormEditor(art_constant("MD_TEXT"), $editor, $editor_configs, $nohtml, $onfailure = null);
$form_element["inactive"]["text"] = new XoopsFormHidden("text", $text);
// text options
$dohtml = empty($canhtml) ? 0 : $dohtml;
$html_checkbox = new XoopsFormCheckBox('', 'dohtml', $dohtml);
$html_checkbox->addOption(1, art_constant("MD_DOHTML"));
if (empty($canhtml)) {
$html_checkbox->setExtra("disabled");
}
$smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $dosmiley);
$smiley_checkbox->addOption(1, art_constant("MD_DOSMILEY"));
$xcode_checkbox = new XoopsFormCheckBox('', 'doxcode', $doxcode);
$xcode_checkbox->addOption(1, art_constant("MD_DOXCODE"));
$br_checkbox = new XoopsFormCheckBox('', 'dobr', $dobr);
$br_checkbox->addOption(1, art_constant("MD_DOBR"));
$options_tray = new XoopsFormElementTray(art_constant("MD_TEXTOPTIONS"), '<br />');
$options_tray->addElement($html_checkbox);
$options_tray->addElement($smiley_checkbox);
$options_tray->addElement($xcode_checkbox);
$options_tray->addElement($br_checkbox);
$form_element["active"]["text_options"] =& $options_tray;
//$form_element["inactive"]["text_options"] = null;
$form_element["inactive"]["text_options"][] = new XoopsFormHidden("dohtml", $dohtml);
示例2: XoopsFormLabel
if (!empty($cat_image) && file_exists(XOOPS_ROOT_PATH . "/" . $path_image . "/" . $cat_image)) {
$image_tray->addElement(new XoopsFormLabel("", "<div style=\"padding: 8px;\"><img src=\"" . XOOPS_URL . "/" . $path_image . "/" . $cat_image . "\" name=\"img\" id=\"img\" alt=\"\" /></div>"));
} else {
$image_tray->addElement(new XoopsFormLabel("", "<div style=\"padding: 8px;\"><img src=\"" . XOOPS_URL . "/images/blank.gif\" name=\"img\" id=\"img\" alt=\"\" /></div>"));
}
$image_option_tray->addElement($image_tray);
$form_art->addElement($image_option_tray);
}
// The moderator
if (art_isAdministrator()) {
$form_art->addElement(new XoopsFormSelectUser(art_constant("MD_MODERATOR"), 'cat_moderator', false, $category_obj->getVar("cat_moderator"), 5, true));
} else {
if ($moderators = $category_obj->getVar("cat_moderator")) {
$moderator_checkbox = new XoopsFormCheckBox(art_constant("MD_MODERATOR"), "cat_moderator", array_keys($moderators));
$moderator_checkbox->addOptionArray(art_getUnameFromId($moderators));
$moderator_checkbox->setExtra("\"disabled\"");
$form_art->addElement($moderator_checkbox);
}
}
// Entry article
$limit_article = 100;
if ($category_obj->getVar("cat_id")) {
$article_handler =& xoops_getmodulehandler("article", $GLOBALS["artdirname"]);
$criteria_article = new Criteria("cat_id", $category_obj->getVar("cat_id"));
$article_count = $article_handler->getCount($criteria_article);
if ($article_count > 0) {
$article_list[0] = _NONE;
if ($article_count > $limit_article) {
$article_list = $article_list + $article_handler->getList(new Criteria("art_id", $category_obj->getVar("cat_entry")));
$article_option_tray = new XoopsFormElementTray(art_constant("MD_ENTRY_SELECT"));
$name = "cat_entry";
示例3: XoopsFormText
$idle_less = new XoopsFormText(_AM_SYSTEM_MAILUSERS_IDLELESS . '<span class="bold green">*</span>', 'mail_idle_less', 10, 5);
$idle = new XoopsFormElementTray('<div class="bold spacer">' . _AM_SYSTEM_MAILUSERS_DAY . '</div>', '');
$idle->addElement($idle_more);
$idle->addElement($idle_less);
$regd_min = new XoopsFormTextDateSelect(_AM_SYSTEM_MAILUSERS_REGDMIN . '<span class="bold green">*</span>', 'mail_regd_min');
$regd_min->setValue('');
$regd_max = new XoopsFormTextDateSelect(_AM_SYSTEM_MAILUSERS_REGDMAX . '<span class="bold green">*</span>', 'mail_regd_max');
$regd_max->setValue('');
$regdate = new XoopsFormElementTray('<div class="bold spacer">' . _AM_SYSTEM_MAILUSERS_REGDATE . '</div>', '');
$regdate->addElement($regd_min);
$regdate->addElement($regd_max);
$mailok_cbox = new XoopsFormCheckBox('', 'mail_mailok');
$mailok_cbox->addOption(1, _AM_SYSTEM_MAILUSERS_MAILOK . '<span class="bold green">*</span>');
$inactive_cbox = new XoopsFormCheckBox('', 'mail_inactive');
$inactive_cbox->addOption(1, _AM_SYSTEM_MAILUSERS_INACTIVE . '<span class="bold green">*</span>');
$inactive_cbox->setExtra("onclick='javascript:disableElement(\"mail_lastlog_min\");disableElement(\"mail_lastlog_max\");disableElement(\"mail_idle_more\");disableElement(\"mail_idle_less\");disableElement(\"mail_to_group[]\");'");
$criteria_tray = new XoopsFormElementTray(_AM_SYSTEM_MAILUSERS_SENDTOUSERS, '<br><br>');
$criteria_tray->setDescription('<span class="bold green">*</span>' . _AM_SYSTEM_MAILUSERS_OPTIONAL);
$criteria_tray->addElement($group_select);
//$criteria_tray->addElement($lastlog);
$criteria_tray->addElement($date);
//$criteria_tray->addElement($lastlog_max);
$criteria_tray->addElement($idle);
//$criteria_tray->addElement($idle_less);
$criteria_tray->addElement($regdate);
$criteria_tray->addElement($mailok_cbox);
$criteria_tray->addElement($inactive_cbox);
//$criteria_tray->addElement($regd_max);
$form->addElement($criteria_tray);
}
$fname_text = new XoopsFormText(_AM_SYSTEM_MAILUSERS_MAILFNAME, 'mail_fromname', 30, 255, htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES));
示例4: render
function render($ele_value, $caption, $markupName, $isDisabled, $element, $entry_id)
{
global $myts;
$myts =& MyTextSanitizer::getInstance();
$renderer =& new formulizeElementRenderer();
$ele_desc = $element->getVar('ele_desc', "f");
if (strstr($markupName, "de_")) {
// display element uses a slightly different element name so it can be distinguished on subsequent page load from regular elements...THIS IS NOT TRUE/NECESSARY ANYMORE SINCE FORMULIZE 3, WHERE ALL ELEMENTS ARE DISPLAY ELEMENTS
$true_ele_id = str_replace("de_" . $element->getVar('id_form') . "_" . $entry_id . "_", "", $markupName);
} else {
$true_ele_id = str_replace("ele_", "", $markupName);
}
$selected = array();
$options = array();
$disabledHiddenValue = array();
$disabledHiddenValues = "";
$disabledOutputText = array();
$opt_count = 1;
while ($i = each($ele_value)) {
$options[$opt_count] = $myts->stripSlashesGPC($i['key']);
if ($i['value'] > 0) {
$selected[] = $opt_count;
$disabledHiddenValue[] = "<input type=hidden name=\"" . $markupName . "[]\" value=\"{$opt_count}\">";
}
$opt_count++;
}
if ($element->getVar('ele_delim') != "") {
$delimSetting = $element->getVar('ele_delim');
}
$delimSetting =& $myts->undoHtmlSpecialChars($delimSetting);
if ($delimSetting == "br") {
$delimSetting = "<br />";
}
$hiddenOutOfRangeValuesToWrite = array();
switch ($delimSetting) {
case 'space':
$form_ele1 = new XoopsFormCheckBox($caption, $markupName, $selected);
$counter = 0;
// counter used for javascript that works with 'Other' box
while ($o = each($options)) {
$o = formulize_swapUIText($o, $element->getVar('ele_uitext'));
$other = $renderer->optOther($o['value'], $markupName, $entry_id, $counter, true);
if ($other != false) {
$form_ele1->addOption($o['key'], _formulize_OPT_OTHER . $other);
if (in_array($o['key'], $selected)) {
$disabledOutputText[] = _formulize_OPT_OTHER . $other;
}
} else {
$form_ele1->addOption($o['key'], $o['value']);
if (in_array($o['key'], $selected)) {
$disabledOutputText[] = $o['value'];
}
if (strstr($o['value'], _formulize_OUTOFRANGE_DATA)) {
$hiddenOutOfRangeValuesToWrite[$o['key']] = str_replace(_formulize_OUTOFRANGE_DATA, "", $o['value']);
// if this is an out of range value, grab the actual value so we can stick it in a hidden element later
}
}
$counter++;
}
$form_ele1->setExtra(" onchange=\"javascript:formulizechanged=1;\" jquerytag=\"{$form_ele_id}\" ");
break;
default:
$form_ele1 = new XoopsFormElementTray($caption, $delimSetting);
$counter = 0;
// counter used for javascript that works with 'Other' box
while ($o = each($options)) {
$o = formulize_swapUIText($o, $element->getVar('ele_uitext'));
$t = new XoopsFormCheckBox('', $markupName . '[]', $selected);
$other = $renderer->optOther($o['value'], $markupName, $entry_id, $counter, true);
if ($other != false) {
$t->addOption($o['key'], _formulize_OPT_OTHER . $other);
if (in_array($o['key'], $selected)) {
$disabledOutputText[] = _formulize_OPT_OTHER . $other;
}
} else {
$t->addOption($o['key'], $o['value']);
if (in_array($o['key'], $selected)) {
$disabledOutputText[] = $o['value'];
}
if (strstr($o['value'], _formulize_OUTOFRANGE_DATA)) {
$hiddenOutOfRangeValuesToWrite[$o['key']] = str_replace(_formulize_OUTOFRANGE_DATA, "", $o['value']);
// if this is an out of range value, grab the actual value so we can stick it in a hidden element later
}
}
$t->setExtra(" onchange=\"javascript:formulizechanged=1;\" jquerytag=\"{$form_ele_id}\" ");
$form_ele1->addElement($t);
unset($t);
$counter++;
}
break;
}
$renderedHoorvs = "";
if (count($hiddenOutOfRangeValuesToWrite) > 0) {
foreach ($hiddenOutOfRangeValuesToWrite as $hoorKey => $hoorValue) {
$thisHoorv = new xoopsFormHidden('formulize_hoorv_' . $true_ele_id . '_' . $hoorKey, $hoorValue);
$renderedHoorvs .= $thisHoorv->render() . "\n";
unset($thisHoorv);
}
}
if ($isDisabled) {
//.........这里部分代码省略.........
示例5: constructElement
//.........这里部分代码省略.........
$entryData = $this->formulize_getCachedEntryData($id_form, $entry);
$creation_datetime = display($entryData, "creation_datetime");
$evalResult = eval($ele_value[0]);
if ($evalResult === false) {
$ele_value[0] = _formulize_ERROR_IN_LEFTRIGHT;
} else {
$ele_value[0] = $value;
// value is supposed to be the thing set in the eval'd code
}
}
$ele_value[0] = $this->formulize_replaceCurlyBracketVariables($ele_value[0], $entry, $id_form);
$form_ele = $ele_value;
// an array, item 0 is the contents of the break, item 1 is the class of the table cell (for when the form is table rendered)
break;
case 'text':
$ele_value[2] = stripslashes($ele_value[2]);
// $ele_value[2] = $myts->displayTarea($ele_value[2]); // commented by jwe 12/14/04 so that info displayed for viewing in a form box does not contain HTML formatting
$ele_value[2] = getTextboxDefault($ele_value[2], $id_form, $entry);
//if placeholder value is set
if ($ele_value[11]) {
$placeholder = $ele_value[2];
$ele_value[2] = "";
}
if (!strstr(getCurrentURL(), "printview.php")) {
// nmc 2007.03.24 - added
$form_ele = new XoopsFormText($ele_caption, $form_ele_id, $ele_value[0], $ele_value[1], $ele_value[2]);
} else {
// nmc 2007.03.24 - added
$form_ele = new XoopsFormLabel($ele_caption, formulize_numberFormat($ele_value[2], $this->_ele->getVar('ele_handle')));
// nmc 2007.03.24 - added
}
//if placeholder value is set
if ($ele_value[11]) {
$form_ele->setExtra("placeholder='" . $placeholder . "'");
}
//if numbers-only option is set
if ($ele_value[3]) {
$form_ele->setExtra("class='numbers-only-textbox'");
}
// if required unique option is set, create validation javascript that will ask the database if the value is unique or not
if ($ele_value[9]) {
$eltname = $form_ele_id;
$eltcaption = $ele_caption;
$eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption);
$eltmsg = str_replace('"', '\\"', stripslashes($eltmsg));
$eltmsgUnique = empty($eltcaption) ? sprintf(_formulize_REQUIRED_UNIQUE, $eltname) : sprintf(_formulize_REQUIRED_UNIQUE, $eltcaption);
if ($this->_ele->getVar('ele_req')) {
// need to manually handle required setting, since only one validation routine can run for an element, so we need to include required checking in this unique checking routine, if the user selected required too
$form_ele->customValidationCode[] = "\nif ( myform.{$eltname}.value == '' ) {\n";
$form_ele->customValidationCode[] = "window.alert(\"{$eltmsg}\");\n myform.{$eltname}.focus();\n return false;\n";
$form_ele->customValidationCode[] = "}\n";
}
$form_ele->customValidationCode[] = "if(formulize_xhr_returned_check_for_unique_value != 'notreturned') {\n";
// a value has already been returned from xhr, so let's check that out...
$form_ele->customValidationCode[] = "if(formulize_xhr_returned_check_for_unique_value != 'valuenotfound') {\n";
// request has come back, form has been resubmitted, but the check turned up postive, ie: value is not unique, so we have to halt submission , and reset the check for unique flag so we can check again when the user has typed again and is ready to submit
$form_ele->customValidationCode[] = "window.alert(\"{$eltmsgUnique}\");\n";
$form_ele->customValidationCode[] = "formulize_xhr_returned_check_for_unique_value = 'notreturned'\n";
$form_ele->customValidationCode[] = "myform.{$eltname}.focus();\n return false;\n";
$form_ele->customValidationCode[] = "}\n";
$form_ele->customValidationCode[] = "} else {\n";
// do not submit the form, just send off the request, which will trigger a resubmission after setting the returned flag above to true so that we won't send again on resubmission
$form_ele->customValidationCode[] = "\nvar formulize_xhr_params = []\n";
$form_ele->customValidationCode[] = "formulize_xhr_params[0] = myform.{$eltname}.value;\n";
$form_ele->customValidationCode[] = "formulize_xhr_params[1] = " . $this->_ele->getVar('ele_id') . ";\n";
$xhr_entry_to_send = is_numeric($entry) ? $entry : 0;
示例6: 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);
//.........这里部分代码省略.........
示例7: XoopsFormRadio
$form_geographical = new XoopsFormRadio(_LANG_WLA_SUB_GEOGRAPH . " : ", "geographical", $geographical);
$form_geographical->setExtra('class="valinp"');
$form_geographical->addOption("co-resident", _LANG_WLA_CHECK_RESI);
$form_geographical->addOption("neighbor", _LANG_WLA_CHECK_NEIG);
$form_geographical->addOption("", _LANG_WLA_CHECK_NONE);
$form_xfn->addElement($form_geographical);
$form_family = new XoopsFormRadio(_LANG_WLA_SUB_FAMILY . " : ", "family", $family);
$form_family->setExtra('class="valinp"');
$form_family->addOption("child", _LANG_WLA_CHECK_CHILD);
$form_family->addOption("parent", _LANG_WLA_CHECK_PARENT);
$form_family->addOption("sibling", _LANG_WLA_CHECK_SIBLING);
$form_family->addOption("spouse", _LANG_WLA_CHECK_SPOUSE);
$form_family->addOption("", _LANG_WLA_CHECK_NONE);
$form_xfn->addElement($form_family);
$form_romantic = new XoopsFormCheckBox(_LANG_WLA_SUB_ROMANTIC . " : ", "romantic", $romantic);
$form_romantic->setExtra('class="valinp"');
$form_romantic->addOption("muse", _LANG_WLA_CHECK_MUSE);
$form_romantic->addOption("crush", _LANG_WLA_CHECK_CRUSH);
$form_romantic->addOption("date", _LANG_WLA_CHECK_DATE);
$form_romantic->addOption("sweetheart", _LANG_WLA_CHECK_HEART);
$form_xfn->addElement($form_romantic);
$form->addElement($form_xfn);
$form->addElement(new XoopsFormTextArea(_LANG_WLA_SUB_NOTE, "link_notes", $link_notes, 10, 60));
$form_rating = new XoopsFormSelect(_LANG_WLA_SUB_RATE, "link_rating", $link_rating);
$form_rating->setDescription(_LANG_WLA_CHECK_ZERO);
for ($r = 0; $r < 10; $r++) {
$form_rating->addOption($r, $r);
}
$form->addElement($form_rating);
$form_target = new XoopsFormRadio(_LANG_WLA_SUB_TARGET, "link_target", $link_target);
$form_target->setDescription(_LANG_WLA_CHECK_STRICT);
示例8: Criteria
$criteria = new Criteria(1, 1);
$criteria->setSort('ele_order');
$criteria->setOrder('ASC');
$elements =& $formulaire_mgr->getObjects($criteria, $id);
foreach ($elements as $i) {
$ide = $i->getVar('ele_id');
$ele_value = $i->getVar('ele_value');
// $ele_value[0] = stripslashes ($ele_value[0]);
$renderer =& new FormulaireElementRenderer($i);
$ele_value =& $renderer->constructElement('ele_value[' . $ide . ']', true, '0');
$ele_type = $i->getVar('ele_type');
$req = $i->getVar('ele_req');
$check_req = new XoopsFormCheckBox('', 'ele_req[' . $ide . ']', $req);
$check_req->addOption(1, ' ');
if ($ele_type == 'checkbox' || $ele_type == 'radio' || $ele_type == 'yn' || $ele_type == 'select' || $ele_type == 'date' || $ele_type == 'areamodif' || $ele_type == 'upload' || $ele_type == 'areamodif' || $ele_type == 'sep') {
$check_req->setExtra('disabled="disabled"');
}
$order = $i->getVar('ele_order');
$text_order = new XoopsFormText('', 'ele_order[' . $ide . ']', 2, 2, $order);
$display = $i->getVar('ele_display');
$check_display = new XoopsFormCheckBox('', 'ele_display[' . $ide . ']', $display);
$check_display->addOption(1, ' ');
$hidden_id = new XoopsFormHidden('ele_id[]', $ide);
if (is_array($ele_value)) {
$ele_value[0] = addslashes($ele_value[0]);
}
echo '<tr>';
echo '<td class="even">' . $i->getVar('ele_caption') . "</td>\n";
echo '<td class="even">' . $ele_value->render() . "</td>\n";
echo '<td class="even" align="center">' . $check_req->render() . "</td>\n";
if ($order != 0) {
示例9: 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[]\");' ");
//.........这里部分代码省略.........