本文整理汇总了PHP中XoopsFormElementTray::addElement方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsFormElementTray::addElement方法的具体用法?PHP XoopsFormElementTray::addElement怎么用?PHP XoopsFormElementTray::addElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsFormElementTray
的用法示例。
在下文中一共展示了XoopsFormElementTray::addElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: greenepForm
function greenepForm($action = false)
{
global $xoopsModuleConfig;
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
$title = $this->isNew() ? _AM_CATALOG_ADD_GREENEP : _AM_CATALOG_EDIT_GREENEP;
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
$form->addElement(new XoopsFormText(_AM_CATALOG_GREENEP_RANK, 'greenep_rank', 60, 255, $this->getVar('greenep_rank')), true);
$logo_image = new XoopsFormElementTray(_AM_CATALOG_GREENLOGO);
if ($this->getVar('greenep_id')) {
$logo_image->addElement(new XoopsFormLabel('', '<img src="' . XOOPS_URL . "/uploads/" . $this->getVar('greenep_logo') . '" width="100"><br><br>'));
$display = _AM_CATALOG_REUPLOAD;
} else {
$display = '';
}
$logo_image->addElement(new XoopsFormFile('', 'greenep_logo', 1024 * 1024 * 2));
$logo_image->addElement(new XoopsFormLabel('', $display));
$form->addElement($logo_image);
$form->addElement(new XoopsFormText(_AM_CATALOG_SORT, 'greenep_weight', 40, 60, $this->getVar('greenep_weight')));
$form->addElement(new XoopsFormHidden('greenep_id', $this->getVar('greenep_id')));
$form->addElement(new XoopsFormHidden('op', 'save'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}
示例2: 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);
}
示例3: createButtons
/**
* @创建按钮
* @license http://www.blags.org/
* @created:2010年05月20日 23时52分
* @copyright 1997-2010 The Martin Group
* @author Martin <china.codehome@gmail.com>
* */
function createButtons()
{
$button_tray = new XoopsFormElementTray('', '');
// No ID for category -- then it's new category, button says 'Create'
if (empty($this->Obj)) {
$butt_create = new XoopsFormButton('', '', '提交', 'submit');
$butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
$button_tray->addElement($butt_create);
$butt_clear = new XoopsFormButton('', '', '清空', 'reset');
$button_tray->addElement($butt_clear);
$butt_cancel = new XoopsFormButton('', '', 'cancel', 'button');
$butt_cancel->setExtra('onclick="history.go(-1)"');
$button_tray->addElement($butt_cancel);
$this->addElement($button_tray);
} else {
// button says 'Update'
$butt_create = new XoopsFormButton('', '', '修改', 'submit');
$butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
$button_tray->addElement($butt_create);
$butt_clear = new XoopsFormButton('', '', '清空', 'reset');
$button_tray->addElement($butt_clear);
$butt_cancel = new XoopsFormButton('', '', 'cancel', 'button');
$butt_cancel->setExtra('onclick="history.go(-1)"');
$button_tray->addElement($butt_cancel);
$this->addElement($button_tray);
}
}
示例4: display_edit_form
function display_edit_form($cat_array, $form_title, $action)
{
global $cattree;
$myts =& MyTextSanitizer::getInstance();
extract($cat_array);
// Beggining of XoopsForm
$form = new XoopsThemeForm($form_title, 'MainForm', '');
// Hidden
$form->addElement(new XoopsFormHidden('action', $action));
$form->addElement(new XoopsFormHidden('cid', $cid));
// Title
$form->addElement(new XoopsFormText(_AM_CAT_TH_TITLE, 'title', 30, 50, $myts->htmlSpecialChars($title)), true);
// Image URL
$form->addElement(new XoopsFormText(_AM_CAT_TH_IMGURL, 'imgurl', 50, 150, $myts->htmlSpecialChars($imgurl)));
// Parent Category
ob_start();
$cattree->makeMySelBox("title", "title", $pid, 1, 'pid');
$cat_selbox = ob_get_contents();
ob_end_clean();
$form->addElement(new XoopsFormLabel(_AM_CAT_TH_PARENT, $cat_selbox));
// Buttons
$button_tray = new XoopsFormElementTray('', ' ');
$button_tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
$button_tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset'));
$form->addElement($button_tray);
// End of XoopsForm
$form->display();
}
示例5: displayForm
/**
* XoopsfaqCategory::displayForm()
*
* @return
*/
function displayForm()
{
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
$caption = $this->isNew() ? _AM_XOOPSFAQ_CREATENEW : sprintf(_AM_XOOPSFAQ_MODIFYITEM, $this->getVar('category_title'));
$form = new XoopsThemeForm($caption, 'content', xoops_getenv('PHP_SELF'));
$form->addElement(new XoopsFormHiddenToken());
$form->addElement(new xoopsFormHidden('op', 'save'));
$form->addElement(new xoopsFormHidden('category_id', $this->getVar('category_id', 'e')));
// title
$category_title = new XoopsFormText(_AM_XOOPSFAQ_E_CATEGORY_TITLE, 'category_title', 50, 150, $this->getVar('category_title', 'e'));
$category_title->setDescription(_AM_XOOPSFAQ_E_CATEGORY_TITLE_DSC);
$form->addElement($category_title, true);
// order
$category_order = new XoopsFormText(_AM_XOOPSFAQ_E_CATEGORY_WEIGHT, 'category_order', 5, 5, $this->getVar('category_order', 'e'));
$category_order->setDescription(_AM_XOOPSFAQ_E_CATEGORY_WEIGHT_DSC);
$form->addElement($category_order, false);
$btnTray = new XoopsFormElementTray('', '');
$btnSubmit = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
$btnTray->addElement($btnSubmit);
$btnCancel = new XoopsFormButton('', '', _CANCEL, 'button');
$btnCancel->setExtra('onclick="history.go(-1)"');
$btnTray->addElement($btnCancel);
$form->addElement($btnTray);
$form->display();
}
示例6: editcat
function editcat($catid = '')
{
$name = '';
$description = '';
global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $modify;
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
if ($modify) {
$result = $xoopsDB->query("SELECT name, description FROM " . $xoopsDB->prefix("faqcategories") . " WHERE catID = '{$catid}'");
list($name, $description) = mysql_fetch_row($result);
if (mysql_num_rows($result) == 0) {
redirect_header("index.php", 1, _AM_NOCATTOEDIT);
exit;
}
$sform = new XoopsThemeForm(_AM_MODIFYCAT, "op", xoops_getenv('PHP_SELF'));
} else {
$sform = new XoopsThemeForm(_AM_ADDCAT, "op", xoops_getenv('PHP_SELF'));
}
$sform->addElement(new XoopsFormText(_AM_CATNAME, 'name', 50, 80, $name), true);
$sform->addElement(new XoopsFormDhtmlTextArea(_AM_CATDESCRIPT, 'description', $description, 15, 60));
$sform->addElement(new XoopsFormHidden('catid', $catid));
$sform->addElement(new XoopsFormHidden('modify', $modify));
$button_tray = new XoopsFormElementTray('', '');
$hidden = new XoopsFormHidden('op', 'addcat');
$button_tray->addElement($hidden);
if ($modify == '0') {
$button_tray->addElement(new XoopsFormButton('', 'update', _AM_CREATE, 'submit'));
} else {
$button_tray->addElement(new XoopsFormButton('', 'update', _AM_MODIFY, 'submit'));
}
$sform->addElement($button_tray);
$sform->display();
unset($hidden);
}
示例7: 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;
}
示例8: createButtons
/**
* @创建按钮
* @license http://www.blags.org/
* @created :2010年05月20日 23时52分
* @copyright 1997-2010 The Martin Group
* @author Martin <china.codehome@gmail.com>
* */
public function createButtons()
{
$button_tray = new XoopsFormElementTray('', '');
// No ID for category -- then it's new category, button says 'Create'
if (!$this->Obj->promotion_id()) {
$butt_create = new XoopsFormButton('', '', _SUBMIT, 'submit');
$butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
$button_tray->addElement($butt_create);
$butt_clear = new XoopsFormButton('', '', _RESET, 'reset');
$button_tray->addElement($butt_clear);
$butt_cancel = new XoopsFormButton('', '', _CANCEL, 'button');
$butt_cancel->setExtra('onclick="history.go(-1)"');
$button_tray->addElement($butt_cancel);
$this->addElement($button_tray);
} else {
// button says 'Update'
$butt_create = new XoopsFormButton('', '', _EDIT, 'submit');
$butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
$button_tray->addElement($butt_create);
$butt_clear = new XoopsFormButton('', '', _RESET, 'reset');
$button_tray->addElement($butt_clear);
$butt_cancel = new XoopsFormButton('', '', _CANCEL, 'button');
$butt_cancel->setExtra('onclick="history.go(-1)"');
$button_tray->addElement($butt_cancel);
$this->addElement($button_tray);
}
}
示例9: 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);
}
示例10: getForm
function getForm($action = false)
{
global $xoopsModuleConfig;
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
$linkusers_handler =& xoops_getmodulehandler('linkusers', 'support');
$member_handler =& xoops_gethandler('member');
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
$title = $this->isNew() ? _MA_SUPPORT_ADDCAT : _MA_SUPPORT_UPDATECAT;
$format = empty($format) ? "e" : $format;
$status = $this->isNew() ? 1 : $this->getVar('cat_status');
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra("enctype=\"multipart/form-data\"");
//名稱
$form->addElement(new XoopsFormText(_MA_SUPPORT_CATNAME, 'cat_name', 60, 255, $this->getVar('cat_name', $format)), true);
//題頭圖片
$cat_image = new XoopsFormElementTray(_MA_SUPPORT_CATLOGO, '', 'image');
if ($this->getVar('cat_image')) {
$cat_image->addElement(new XoopsFormLabel('', '<img width="100" src="' . XOOPS_URL . '/uploads/support/' . $this->getVar('cat_image') . '"><br><br>'));
$delete_check = new XoopsFormCheckBox('', 'delete_image');
$delete_check->addOption(1, _DELETE);
$cat_image->addElement($delete_check);
$display = _MA_SUPPORT_REUPLOADLOGOTIP;
} else {
$display = '';
}
$cat_image->addElement(new XoopsFormFile('', 'cat_image', 1024 * 1024 * 2));
$cat_image->addElement(new XoopsFormLabel('', _MA_SUPPORT_UPLOADSTYLE));
$cat_image->addElement(new XoopsFormLabel('', $display));
$form->addElement($cat_image);
//服務介紹
$configs = array('editor' => 'fckeditor', 'width' => '100%', 'height' => '500px', 'value' => $this->getVar('cat_desc'));
$form->addElement(new XoopsFormEditor(_MA_SUPPORT_CATDESC, 'cat_desc', $configs));
//狀態
$form->addElement(new XoopsFormRadioYN(_MA_SUPPORT_VISIBLE, 'cat_status', $status));
//管理員
$uids = $member_handler->getUsersByGroup($xoopsModuleConfig['support']);
$criteria = new CriteriaCompo(new Criteria("uid", "(" . implode(", ", $uids) . ")", "in"));
$members = $member_handler->getUserList($criteria);
$support_ids = array();
if (!$this->isNew()) {
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('cat_id', $this->getVar('cat_id')));
$linkusers = $linkusers_handler->getAll($criteria, array('uid'), false);
if (!empty($linkusers)) {
foreach ($linkusers as $k => $v) {
$support_ids[] = $v['uid'];
}
}
}
$support = new XoopsFormSelect(_MA_SUPPORT_MANGER, 'support_ids', $support_ids, 5, true);
$support->addOptionArray($members);
$form->addElement($support, true);
$form->addElement(new XoopsFormHidden('cat_id', $this->getVar('cat_id')));
$form->addElement(new XoopsFormHidden('ac', 'insert'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}
示例11: linksForm
function linksForm($action = false)
{
global $xoopsModuleConfig;
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
$title = $this->isNew() ? _AM_LINKS_ADDLIK : _AM_LINKS_UPDATELIK;
$link_status = $this->isNew() ? 1 : $this->getVar('link_status');
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
$cat_id = isset($_REQUEST['cid']) ? $_REQUEST['cid'] : '';
if (empty($cat_id)) {
$cat_id = $this->getVar("cat_id");
}
$categories = new XoopsFormSelect(_AM_LINKS_CATNAME, 'cat_id', $cat_id);
$cat_handler = xoops_getmodulehandler('category', 'links');
$criteria = new CriteriaCompo();
$criteria->setSort('cat_order');
$criteria->setOrder('ASC');
$categories->addOptionArray($cat_handler->getList($criteria));
$form->addElement($categories, true);
$form->addElement(new XoopsFormText(_AM_LINKS_TITLE, 'link_title', 40, 50, $this->getVar('link_title')), true);
if (!$this->isNew()) {
$form->addElement(new XoopsFormText(_AM_LINKS_LIKADD, 'link_url', 80, 5000, $this->getVar('link_url'), true));
$form->addElement(new XoopsFormHidden('datetime', time()));
} else {
$form->addElement(new XoopsFormText(_AM_LINKS_LIKADD, 'link_url', 80, 5000, 'http://'), true);
$form->addElement(new XoopsFormHidden('published', time()));
$form->addElement(new XoopsFormHidden('datetime', time()));
}
$logo_image = new XoopsFormElementTray(_AM_LINKS_LIKLOGO);
if (!empty($xoopsModuleConfig['logo'])) {
if ($this->getVar('link_title')) {
$logo_image->addElement(new XoopsFormLabel('', '<img src="' . XOOPS_URL . $xoopsModuleConfig['logo_dir'] . $this->getVar('link_image') . '"><br><br>'));
$display = _AM_LINKS_LOGOWARN;
} else {
$display = '';
}
$logo_image->addElement(new XoopsFormFile('', 'link_image', 1024 * 1024 * 2));
} else {
$logo_image->addElement(new XoopsFormText('', 'link_dir', 70, 255, $this->getVar('link_dir')));
$display = _AM_LINKS_LOGOTIPS . XOOPS_URL . '/uploads/logo/logo.jpg';
}
$logo_image->addElement(new XoopsFormLabel('', $display));
$form->addElement($logo_image);
$form->addElement(new XoopsFormText(_AM_LINKS_SORT, 'link_order', 4, 2, $this->getVar('link_order')));
$form->addElement(new XoopsFormText(_AM_LINKS_CONTACT, 'link_contact', 60, 255, $this->getVar('link_contact')));
$form->addElement(new XoopsFormRadioYN(_AM_LINKS_SHOW, 'link_status', $link_status));
$form->addElement(new XoopsFormHidden('link_id', $this->getVar('link_id')));
$form->addElement(new XoopsFormHidden('ac', 'insert'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}
示例12: 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);
}
示例13: 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();
}
示例14: getForm
function getForm($action = false)
{
global $xoopsModuleConfig;
include_once XOOPS_ROOT_PATH . "/modules/portfolio/include/functions.render.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
$title = $this->isNew() ? '添加服务' : '更新服务';
$format = empty($format) ? "e" : $format;
$status = $this->isNew() ? 1 : $this->getVar('service_status');
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra("enctype=\"multipart/form-data\"");
//名称
$form->addElement(new XoopsFormText('案例名称', 'service_name', 60, 255, $this->getVar('service_name', $format)), true);
$form->addElement(new XoopsFormText('页面标题', 'service_menu_name', 60, 255, $this->getVar('service_menu_name', $format)));
//题头图片
$service_image = new XoopsFormElementTray('题头图片', '', 'image');
if ($this->getVar('service_image')) {
$service_image->addElement(new XoopsFormLabel('', '<img src="' . XOOPS_URL . '/uploads/portfolio/' . $this->getVar('service_image') . '"><br><br>'));
$delete_check = new XoopsFormCheckBox('', 'delete_image');
$delete_check->addOption(1, _DELETE);
$service_image->addElement($delete_check);
$display = '从新上传将会覆盖现有文件';
} else {
$display = '';
}
$service_image->addElement(new XoopsFormFile('', 'service_image', 1024 * 1024 * 2));
$service_image->addElement(new XoopsFormLabel('', '允许上传的类型为jpeg,pjpeg,gif,png文件'));
$service_image->addElement(new XoopsFormLabel('', $display));
$form->addElement($service_image);
//服务介绍
$configs = array('editor' => 'fckeditor', 'width' => '100%', 'height' => '500px', 'value' => $this->getVar('service_desc'));
$form->addElement(new XoopsFormEditor('服务介绍', 'service_desc', $configs), false);
//模板选择
$templates = portfolio_getTemplateList("service");
if (count($templates) > 0) {
$template_select = new XoopsFormSelect('服务模板', "service_tpl", $this->getVar("service_tpl"));
$template_select->addOptionArray($templates);
$form->addElement($template_select);
}
//状态
$form->addElement(new XoopsFormRadioYN('是否显示', 'service_status', $status));
//创建时间
if ($this->isNew()) {
$form->addElement(new XoopsFormHidden('service_pushtime', time()));
}
$form->addElement(new XoopsFormHidden('service_id', $this->getVar('service_id')));
$form->addElement(new XoopsFormHidden('ac', 'insert'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}
示例15: createElements
function createElements($target)
{
$this->addElement(new XoopsFormText(_AM_MYTABS_TITLE, 'pagetitle', 35, 255, $target->getVar('pagetitle', 'e')));
if (!$target->isNew()) {
$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);
}