本文整理汇总了PHP中XoopsFormCheckBox类的典型用法代码示例。如果您正苦于以下问题:PHP XoopsFormCheckBox类的具体用法?PHP XoopsFormCheckBox怎么用?PHP XoopsFormCheckBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XoopsFormCheckBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getForm
/**
* Get a {@link XoopsForm} object for creating/editing objects
* @param mixed $action receiving page - defaults to $_SERVER['REQUEST_URI']
* @param mixed $title title of the form
*
* @return object
*/
function getForm($action = false, $title = false)
{
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
if ($action == false) {
$action = $_SERVER['REQUEST_URI'];
}
if ($title == false) {
$title = $this->isNew() ? _ADD : _EDIT;
$title .= " " . _NL_AM_NEWSLETTER;
}
$form = new XoopsThemeForm($title, 'form', $action);
if (!$this->isNew()) {
$form->addElement(new XoopsFormHidden('id', $this->getVar('newsletter_id')));
}
$form->addElement(new XoopsFormText(_NL_AM_NAME, 'newsletter_name', 35, 255, $this->getVar('newsletter_name', 'e')), true);
$form->addElement(new XoopsFormTextArea(_NL_AM_DESCRIPTION, 'newsletter_description', $this->getVar('newsletter_description', 'e')));
$form->addElement(new XoopsFormText(_NL_AM_FROMNAME, 'newsletter_from_name', 35, 255, $this->getVar('newsletter_from_name', 'e')), true);
$form->addElement(new XoopsFormText(_NL_AM_FROMEMAIL, 'newsletter_from_email', 35, 255, $this->getVar('newsletter_from_email', 'e')), true);
$form->addElement(new XoopsFormText(_NL_AM_EMAIL, 'newsletter_email', 35, 255, $this->getVar('newsletter_email', 'e')), true);
$form->addElement(new XoopsFormTextArea(_NL_AM_CONFIRM_TEXT, "newsletter_confirm_text", $this->getVar('newsletter_confirm_text', 'e'), 10, 50, "newsletter_confirm_text"));
$member_handler =& xoops_gethandler('member');
$group_list =& $member_handler->getGroupList();
$groups_checkbox = new XoopsFormCheckBox(_NL_AM_PERMISSIONS_SELECT, 'newsletter_permissions[]', $this->getPermissions());
$groups_checkbox->setDescription(_NL_AM_PERMISSIONS_SELECT_DSC);
foreach ($group_list as $group_id => $group_name) {
$groups_checkbox->addOption($group_id, $group_name);
}
$form->addElement($groups_checkbox);
$template_select = new XoopsFormSelect(_NL_AM_TEMPLATE, 'newsletter_template', $this->getVar('newsletter_template', 'e'));
$template_select->addOption('smartmail_newsletter_pcworld.html');
$form->addElement($template_select);
$form->addElement(new XoopsFormHidden('op', 'save'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}
示例2: 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;
}
示例3: SmartFormUser_sigElement
function SmartFormUser_sigElement($object, $key)
{
$var = $object->vars[$key];
$control = $object->controls[$key];
$this->XoopsFormElementTray($var['form_caption'], '<br /><br />', $key . '_signature_tray');
$signature_textarea = new XoopsFormDhtmlTextArea('', $key, $object->getVar($key, 'e'));
$this->addElement($signature_textarea);
$attach_checkbox = new XoopsFormCheckBox('', 'attachsig', $object->getVar('attachsig', 'e'));
$attach_checkbox->addOption(1, _US_SHOWSIG);
$this->addElement($attach_checkbox);
}
示例4: 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;
}
示例5: getForm
function getForm($action = false)
{
global $xoopsModuleConfig;
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('cat_status');
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra("enctype=\"multipart/form-data\"");
//名称
$form->addElement(new XoopsFormText('分类名称', 'cat_name', 60, 255, $this->getVar('cat_name', $format)), true);
//题头图片
$cat_image = new XoopsFormElementTray('题头图片', '', 'image');
if ($this->getVar('cat_image')) {
$cat_image->addElement(new XoopsFormLabel('', '<img src="' . XOOPS_URL . '/uploads/resources/' . $this->getVar('cat_image') . '"><br><br>'));
$delete_check = new XoopsFormCheckBox('', 'delete_image');
$delete_check->addOption(1, _DELETE);
$cat_image->addElement($delete_check);
$display = '从新上传将会覆盖现有文件';
} else {
$display = '';
}
$cat_image->addElement(new XoopsFormFile('', 'cat_image', 1024 * 1024 * 2));
$cat_image->addElement(new XoopsFormLabel('', '允许上传的类型为jpeg,pjpeg,gif,png文件'));
$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('分类描述', 'cat_desc', $configs));
//状态
$form->addElement(new XoopsFormRadioYN('是否显示', 'cat_status', $status));
// gratetime
if ($this->isNew()) {
$form->addElement(new XoopsFormHidden('grate_time', time()));
}
$form->addElement(new XoopsFormHidden('cat_id', $this->getVar('cat_id')));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}
示例6: display_edit_form
function display_edit_form($cat, $form_title, $action)
{
global $cattree;
// Beggining of XoopsForm
$form = new XoopsThemeForm($form_title, 'MainForm', '');
// Hidden
$form->addElement(new XoopsFormHidden('action', htmlspecialchars($action, ENT_QUOTES)));
$form->addElement(new XoopsFormHidden('cid', intval($cat->cid)));
// Subject
$form->addElement(new XoopsFormText(_AM_CAT_TH_TITLE, 'cat_title', 60, 128, htmlspecialchars($cat->cat_title, ENT_QUOTES)), true);
// Description
$tarea_tray = new XoopsFormElementTray(_AM_CAT_TH_DESC, '<br />');
$tarea_tray->addElement(new XoopsFormDhtmlTextArea('', 'cat_desc', htmlspecialchars($cat->cat_desc, ENT_QUOTES), 15, 60));
$form->addElement($tarea_tray);
// Parent Category
ob_start();
$cattree->makeMySelBox("cat_title", "weight", $cat->pid, 1, 'pid');
$cat_selbox = ob_get_contents();
ob_end_clean();
$form->addElement(new XoopsFormLabel(_AM_CAT_TH_PARENT, $cat_selbox));
// Weight
$form->addElement(new XoopsFormText(_AM_CAT_TH_WEIGHT, 'weight', 6, 6, intval($cat->weight)), true);
// Options
$checkbox_tray = new XoopsFormElementTray(_AM_CAT_TH_OPTIONS, '<br />');
$ismenuitem_checkbox = new XoopsFormCheckBox('', 'ismenuitem', intval($cat->ismenuitem));
$ismenuitem_checkbox->addOption(1, _AM_CAT_TH_SUBMENU);
$checkbox_tray->addElement($ismenuitem_checkbox);
$form->addElement($checkbox_tray);
// Last Modified
$form->addElement(new XoopsFormLabel(_AM_CAT_TH_LASTMODIFY, formatTimestamp($cat->udtstamp)));
// 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);
// Ticket
$GLOBALS['xoopsGTicket']->addTicketXoopsFormElement($form, __LINE__);
// End of XoopsForm
$form->display();
}
示例7: XoopsThemeForm
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
// create form
$search_form = new XoopsThemeForm(_SR_SEARCH, "search_form", $_SERVER['PHP_SELF'], 'POST');
// create form elements
$search_form->addElement(new XoopsFormText(_SR_KEYWORDS, "query", 30, 255, htmlspecialchars(stripslashes(implode(" ", $queries)), ENT_QUOTES)), true);
$search_form->addElement(new XoopsFormText(_AMS_NW_USERNAME, "username", 30, 255, $username), false);
$type_select = new XoopsFormSelect(_SR_TYPE, "andor", $andor);
$type_select->addOptionArray(array("AND" => _SR_ALL, "OR" => _SR_ANY, "exact" => _SR_EXACT));
$search_form->addElement($type_select);
if (!empty($mids)) {
$mods_checkbox = new XoopsFormCheckBox(_SR_SEARCHIN, "mids[]", $mids);
} else {
$mods_checkbox = new XoopsFormCheckBox(_SR_SEARCHIN, "mids[]", $xoopsModule->mid());
}
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('hassearch', 1));
$criteria->add(new Criteria('isactive', 1));
$module_handler =& xoops_gethandler('module');
$mods_checkbox->addOptionArray($module_handler->getList($criteria));
$search_form->addElement($mods_checkbox);
if ($xoopsConfigSearch['keyword_min'] > 0) {
$search_form->addElement(new XoopsFormLabel(_SR_SEARCHRULE, sprintf(_SR_KEYIGNORE, $xoopsConfigSearch['keyword_min'])));
}
$search_form->addElement(new XoopsFormHidden("op", "results"));
$search_form->addElement(new XoopsFormHidden('storyid', $article->storyid()));
$search_form->addElement(new XoopsFormButton("", "submit", _SR_SEARCH, "submit"));
示例8: XoopsFormElementTray
}
$value[1] = $value[1] / 1024;
$p = !empty($value[1]) ? $value[1] : $xoopsModuleConfig['file_weight'];
$pds = new XoopsFormElementTray(_AM_ELE_TAILLEFICH, '');
$pds->addElement(new XoopsFormText('', 'ele_value[1]', 15, 15, $p));
$pds->addElement(new XoopsFormLabel('', ' Ko'));
$form->addElement($pds);
$tab = array();
//$value[2] = array();
foreach ($value[2] as $t => $k) {
foreach ($k as $c => $f) {
$tab[] = $value[2][$t]['value'];
}
}
// here we can add more mime type.
$mime = new XoopsFormCheckBox(_AM_ELE_TYPEMIME, 'ele_value[2]', $tab);
/*
$mime->addOption('pdf',' pdf ');
$mime->addOption('doc',' doc ');
$mime->addOption('txt',' txt ');
$mime->addOption('gif',' gif ');
$mime->addOption('mpeg',' mpeg ');
$mime->addOption('jpg',' jpg ');
$mime->addOption('zip',' zip ');
$mime->addOption('rar',' rar ');
*/
$mime->addOption('application/pdf', ' pdf ');
$mime->addOption('application/msword', ' doc ');
$mime->addOption('text/plain', ' txt ');
$mime->addOption('image/gif', ' gif ');
$mime->addOption('video/mpeg', ' mpeg ');
示例9: XoopsFormHidden
$sform->addElement(new XoopsFormHidden('action', 'saveedit'));
$sform->addElement(new XoopsFormHidden('manu_id', $item->getVar('manu_id')));
$sform->addElement(new XoopsFormText(_OLEDRION_LASTNAME, 'manu_name', 50, 255, $item->getVar('manu_name', 'e')), true);
$sform->addElement(new XoopsFormText(_OLEDRION_COMM_NAME, 'manu_commercialname', 50, 255, $item->getVar('manu_commercialname', 'e')), false);
$sform->addElement(new XoopsFormText(_OLEDRION_EMAIL, 'manu_email', 50, 255, $item->getVar('manu_email', 'e')), false);
$sform->addElement(new XoopsFormText(_OLEDRION_SITEURL, 'manu_url', 50, 255, $item->getVar('manu_url', 'e')), false);
$editor = oledrion_utils::getWysiwygForm(_OLEDRION_MANUFACTURER_INF, 'manu_bio', $item->getVar('manu_bio', 'e'), 15, 60, 'bio_hidden');
if ($editor) {
$sform->addElement($editor, false);
}
// Les 5 images
for ($i = 1; $i <= 5; $i++) {
if ($action == 'edit' && $item->pictureExists($i)) {
$pictureTray = new XoopsFormElementTray(_AM_OLEDRION_CURRENT_PICTURE, '<br />');
$pictureTray->addElement(new XoopsFormLabel('', "<img src='" . $item->getPictureUrl($i) . "' alt='' border='0' />"));
$deleteCheckbox = new XoopsFormCheckBox('', 'delpicture' . $i);
$deleteCheckbox->addOption(1, _DELETE);
$pictureTray->addElement($deleteCheckbox);
$sform->addElement($pictureTray);
unset($pictureTray, $deleteCheckbox);
}
$sform->addElement(new XoopsFormFile(_AM_OLEDRION_PICTURE . ' ' . $i, 'attachedfile' . $i, oledrion_utils::getModuleOption('maxuploadsize')), false);
}
$button_tray = new XoopsFormElementTray('', '');
$submit_btn = new XoopsFormButton('', 'post', $label_submit, 'submit');
$button_tray->addElement($submit_btn);
$sform->addElement($button_tray);
$sform = oledrion_utils::formMarkRequiredFields($sform);
$sform->display();
show_footer();
break;
示例10: editfaq
function editfaq($showmenu = false, $faqid = -1)
{
global $faq_handler, $category_handler, $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $modify, $xoopsModuleConfig, $xoopsModule, $XOOPS_URL, $myts;
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
// If there is a parameter, and the id exists, retrieve data: we're editing a faq
if ($faqid != -1) {
// Creating the FAQ object
$faqObj = new sfFaq($faqid);
if ($faqObj->notLoaded()) {
redirect_header("faq.php", 1, _AM_SF_NOARTTOEDIT);
exit;
}
switch ($faqObj->status()) {
case _SF_STATUS_ASKED:
$breadcrumb_action = _AM_SF_APPROVING;
$collapsableBar_title = _AM_SF_QUESTION_APPROVING;
$collapsableBar_info = _AM_SF_QUESTION_APPROVING_INFO;
$button_caption = _AM_SF_QUEUE;
break;
case "default":
default:
$breadcrumb_action = _AM_SF_EDITING;
$collapsableBar_title = _AM_SF_EDITQUES;
$collapsableBar_info = _AM_SF_EDITING_INFO;
$button_caption = _AM_SF_MODIFY;
break;
}
// Creating the category of this FAQ
$categoryObj =& $category_handler->get($faqObj->categoryid());
if ($showmenu) {
sf_adminMenu(3, _AM_SF_OPEN_QUESTIONS . " > " . $breadcrumb_action);
}
echo "<br />\n";
sf_collapsableBar('bottomtable', 'bottomtableicon');
echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a> " . $collapsableBar_title . "</h3>";
echo "<div id='bottomtable'>";
echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $collapsableBar_info . "</span>";
} else {
// there's no parameter, so we're adding a faq
$faqObj =& $faq_handler->create();
$faqObj->setVar('uid', $xoopsUser->getVar('uid'));
$categoryObj =& $category_handler->create();
$breadcrumb_action = _AM_SF_CREATINGNEW;
$button_caption = _AM_SF_CREATE;
if ($showmenu) {
sf_adminMenu(3, _AM_SF_OPEN_QUESTIONS . " > " . $breadcrumb_action);
}
sf_collapsableBar('bottomtable', 'bottomtableicon');
echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a> " . _AM_SF_CREATEQUESTION . "</h3>";
echo "<div id='bottomtable'>";
}
$sform = new XoopsThemeForm(_AM_SF_OPEN_QUESTION, "op", xoops_getenv('PHP_SELF'));
$sform->setExtra('enctype="multipart/form-data"');
// faq requester
$sform->addElement(new XoopsFormLabel(_AM_SF_REQUESTED_BY, sf_getLinkedUnameFromId($faqObj->uid(), $xoopsModuleConfig['userealname'])));
// CATEGORY
/*
* Get information for pulldown menu using XoopsTree.
* First var is the database table
* Second var is the unique field ID for the categories
* Last one is not set as we do not have sub menus in Smartfaq
*/
$mytree = new XoopsTree($xoopsDB->prefix("smartfaq_categories"), "categoryid", "parentid");
ob_start();
$mytree->makeMySelBox("name", "weight", $categoryObj->categoryid());
$sform->addElement(new XoopsFormLabel(_AM_SF_CATEGORY_QUESTION, ob_get_contents()));
ob_end_clean();
// faq QUESTION
$sform->addElement(new XoopsFormTextArea(_AM_SF_QUESTION, 'question', $faqObj->question(), 7, 60));
// PER ITEM PERMISSIONS
$member_handler =& xoops_gethandler('member');
$group_list =& $member_handler->getGroupList();
$groups_checkbox = new XoopsFormCheckBox(_AM_SF_PERMISSIONS_QUESTION, 'groups[]', $faqObj->getGroups_read());
foreach ($group_list as $group_id => $group_name) {
if ($group_id != XOOPS_GROUP_ADMIN) {
$groups_checkbox->addOption($group_id, $group_name);
}
}
$sform->addElement($groups_checkbox);
// faq ID
$sform->addElement(new XoopsFormHidden('faqid', $faqObj->faqid()));
$button_tray = new XoopsFormElementTray('', '');
$hidden = new XoopsFormHidden('op', 'addfaq');
$button_tray->addElement($hidden);
$sform->addElement(new XoopsFormHidden('status', $faqObj->status()));
// Setting the FAQ Status
/* $status_select = new XoopsFormSelect('', 'status', $status);
$status_select->addOptionArray(sf_getStatusArray());
$status_tray = new XoopsFormElementTray(_AM_SF_STATUS_EXP , ' ');
$status_tray->addElement($status_select);
$sform->addElement($status_tray);
*/
if ($faqid == -1) {
// there's no faqid? Then it's a new faq
// $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SF_CREATE, 'submit' ) );
$butt_create = new XoopsFormButton('', '', _AM_SF_CREATE, 'submit');
$butt_create->setExtra('onclick="this.form.elements.op.value=\'addfaq\'"');
$button_tray->addElement($butt_create);
$butt_clear = new XoopsFormButton('', '', _AM_SF_CLEAR, 'reset');
$button_tray->addElement($butt_clear);
//.........这里部分代码省略.........
示例11: addOption
function addOption($id1, $id2, $text, $type = 'check', $checked = null)
{
if (!isset($text)) {
$text = "";
}
$d = new XoopsFormText('', $id1, 40, 255, $text);
if ($type == 'check') {
$c = new XoopsFormCheckBox('', $id2, $checked);
$c->addOption(1, ' ');
} else {
$c = new XoopsFormRadio('', 'checked', $checked);
$c->addOption($id2, ' ');
}
$t = new XoopsFormElementTray('');
$t->addElement($c);
$t->addElement($d);
return $t;
}
示例12: while
while (false != ($file = readdir($handle))) {
if (strtolower($file) != 'cvs' && !preg_match("/[.]/", $file) && is_dir(XOOPS_ROOT_PATH . '/modules/system/admin/' . $file)) {
include XOOPS_ROOT_PATH . '/modules/system/admin/' . $file . '/xoops_version.php';
if (!empty($modversion['category'])) {
$s_cat_checkbox->addOption($modversion['category'], $modversion['name']);
}
unset($modversion);
}
}
$a_mod_checkbox = new XoopsFormCheckBox(_AM_ACTIVERIGHTS, "admin_mids[]", $a_mod_value);
$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));
$r_mod_checkbox = new XoopsFormCheckBox(_AM_ACCESSRIGHTS, "read_mids[]", $r_mod_value);
$criteria = new CriteriaCompo(new Criteria('hasmain', 1));
$criteria->add(new Criteria('isactive', 1));
$r_mod_checkbox->addOptionArray($module_handler->getList($criteria));
$r_lblock_checkbox = new XoopsFormCheckBox('<b>' . _LEFT . '</b><br />', "read_bids[]", $r_block_value);
$new_blocks_array = array();
$blocks_array = XoopsBlock::getAllBlocks("list", XOOPS_SIDEBLOCK_LEFT);
foreach ($blocks_array as $key => $value) {
$new_blocks_array[$key] = "<a href='" . XOOPS_URL . "/modules/system/admin.php?fct=blocksadmin&op=edit&bid=" . $key . "'>" . $value . " (ID: " . $key . ")</a>";
}
$r_lblock_checkbox->addOptionArray($new_blocks_array);
$r_cblock_checkbox = new XoopsFormCheckBox("<b>" . _CENTER . "</b><br />", "read_bids[]", $r_block_value);
$new_blocks_array = array();
$blocks_array = XoopsBlock::getAllBlocks("list", XOOPS_CENTERBLOCK_ALL);
foreach ($blocks_array as $key => $value) {
$new_blocks_array[$key] = "<a href='" . XOOPS_URL . "/modules/system/admin.php?fct=blocksadmin&op=edit&bid=" . $key . "'>" . $value . " (ID: " . $key . ")</a>";
示例13: createElements
function createElements()
{
global $xoopsDB;
$mytree = new XoopsTree($xoopsDB->prefix("smartsection_categories"), "categoryid", "parentid");
// Parent Category
ob_start();
$mytree->makeMySelBox("name", "weight", $this->targetObject->parentid(), 1, 'parentid');
//makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="")
$this->addElement(new XoopsFormLabel(_AM_SSECTION_PARENT_CATEGORY_EXP, ob_get_contents()));
ob_end_clean();
// Name
$this->addElement(new XoopsFormText(_AM_SSECTION_CATEGORY, 'name', 50, 255, $this->targetObject->name('e')), true);
// Description
$this->addElement(new XoopsFormTextArea(_AM_SSECTION_COLDESCRIPT, 'description', $this->targetObject->description('e'), 7, 60));
if (SMARTSECTION_LEVEL > 0) {
// Header
$text_header = smartsection_getEditor(_AM_SSECTION_CATEGORY_HEADER, 'header', $this->targetObject->header('e'));
$text_header->setDescription(_AM_SSECTION_CATEGORY_HEADER_DSC);
$this->addElement($text_header);
}
// IMAGE
$image_array = XoopsLists::getImgListAsArray(smartsection_getImageDir('category'));
$image_select = new XoopsFormSelect('', 'image', $this->targetObject->image());
//$image_select -> addOption ('-1', '---------------');
$image_select->addOptionArray($image_array);
$image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/smartsection/images/category/' . "\", \"\", \"" . XOOPS_URL . "\")'");
$image_tray = new XoopsFormElementTray(_AM_SSECTION_IMAGE, ' ');
$image_tray->addElement($image_select);
$image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartsection_getImageDir('category', false) . $this->targetObject->image() . "' name='image3' id='image3' alt='' />"));
$image_tray->setDescription(_AM_SSECTION_IMAGE_DSC);
$this->addElement($image_tray);
// IMAGE UPLOAD
$max_size = 5000000;
$file_box = new XoopsFormFile(_AM_SSECTION_IMAGE_UPLOAD, "image_file", $max_size);
$file_box->setExtra("size ='45'");
$file_box->setDescription(_AM_SSECTION_IMAGE_UPLOAD_DSC);
$this->addElement($file_box);
if (SMARTSECTION_LEVEL > 0) {
// Short url
$text_short_url = new XoopsFormText(_AM_SSECTION_CATEGORY_SHORT_URL, 'short_url', 50, 255, $this->targetObject->short_url('e'));
$text_short_url->setDescription(_AM_SSECTION_CATEGORY_SHORT_URL_DSC);
$this->addElement($text_short_url);
// Meta Keywords
$text_meta_keywords = new XoopsFormTextArea(_AM_SSECTION_CATEGORY_META_KEYWORDS, 'meta_keywords', $this->targetObject->meta_keywords('e'), 7, 60);
$text_meta_keywords->setDescription(_AM_SSECTION_CATEGORY_META_KEYWORDS_DSC);
$this->addElement($text_meta_keywords);
// Meta Description
$text_meta_description = new XoopsFormTextArea(_AM_SSECTION_CATEGORY_META_DESCRIPTION, 'meta_description', $this->targetObject->meta_description('e'), 7, 60);
$text_meta_description->setDescription(_AM_SSECTION_CATEGORY_META_DESCRIPTION_DSC);
$this->addElement($text_meta_description);
}
// Weight
$this->addElement(new XoopsFormText(_AM_SSECTION_COLPOSIT, 'weight', 4, 4, $this->targetObject->weight()));
if (SMARTSECTION_LEVEL > 0) {
// Added by skalpa: custom template support
$this->addElement(new XoopsFormText("Custom template", 'template', 50, 255, $this->targetObject->template('e')), false);
}
// READ PERMISSIONS
$groups_read_checkbox = new XoopsFormCheckBox(_AM_SSECTION_PERMISSIONS_CAT_READ, 'groups_read[]', $this->targetObject->getGroups_read());
foreach ($this->userGroups as $group_id => $group_name) {
if ($group_id != XOOPS_GROUP_ADMIN) {
$groups_read_checkbox->addOption($group_id, $group_name);
}
}
$this->addElement($groups_read_checkbox);
// Apply permissions on all items
$apply = isset($_POST['applyall']) ? intval($_POST['applyall']) : 0;
$addapplyall_radio = new XoopsFormRadioYN(_AM_SSECTION_PERMISSIONS_APPLY_ON_ITEMS, 'applyall', $apply, ' ' . _AM_SSECTION_YES . '', ' ' . _AM_SSECTION_NO . '');
$this->addElement($addapplyall_radio);
// SUBMIT PERMISSIONS
$groups_submit_checkbox = new XoopsFormCheckBox(_AM_SSECTION_PERMISSIONS_CAT_SUBMIT, 'groups_submit[]', $this->targetObject->getGroups_submit());
$groups_submit_checkbox->setDescription(_AM_SSECTION_PERMISSIONS_CAT_SUBMIT_DSC);
foreach ($this->userGroups as $group_id => $group_name) {
if ($group_id != XOOPS_GROUP_ADMIN) {
$groups_submit_checkbox->addOption($group_id, $group_name);
}
}
$this->addElement($groups_submit_checkbox);
if (SMARTSECTION_LEVEL > 0) {
// Added by fx2024
// sub Categories
$cat_tray = new XoopsFormElementTray(_AM_SSECTION_SCATEGORYNAME, '<br /><br />');
for ($i = 0; $i < $this->subCatsCount; $i++) {
if ($i < (isset($_POST['scname']) ? sizeof($_POST['scname']) : 0)) {
$subname = isset($_POST['scname']) ? $_POST['scname'][$i] : '';
} else {
$subname = '';
}
$cat_tray->addElement(new XoopsFormText('', 'scname[' . $i . ']', 50, 255, $subname), true);
}
$t = new XoopsFormText('', 'nb_subcats', 3, 2);
$l = new XoopsFormLabel('', sprintf(_AM_SSECTION_ADD_OPT, $t->render()));
$b = new XoopsFormButton('', 'submit', _AM_SSECTION_ADD_OPT_SUBMIT, 'submit');
if (!$this->targetObject->categoryid()) {
$b->setExtra('onclick="this.form.elements.op.value=\'addsubcats\'"');
} else {
$b->setExtra('onclick="this.form.elements.op.value=\'mod\'"');
}
$r = new XoopsFormElementTray('');
$r->addElement($l);
//.........这里部分代码省略.........
示例14: die
die("XOOPS root path not defined");
}
global $_POST;
include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
//include_once 'functions.php';
$mytree = new XoopsTree($xoopsDB->prefix("smartfaq_categories"), "categoryid", "parentid");
$form = new XoopsThemeForm(_MD_SF_SUBMITANSWER, "form", xoops_getenv('PHP_SELF'));
// faq QUESTION
$form->addElement(new XoopsFormLabel(_MD_SF_QUESTION, $faqObj->question()), false);
// ANSWER
$form->addElement(new XoopsFormDhtmlTextArea(_MD_SF_ANSWER_FAQ, 'answer', '', 15, 60), true);
// NOTIFY ON PUBLISH
if (is_object($xoopsUser)) {
$notify_checkbox = new XoopsFormCheckBox('', 'notifypub', 1);
$notify_checkbox->addOption(1, _MD_SF_NOTIFY);
$form->addElement($notify_checkbox);
}
if ($faqObj->status() == _SF_STATUS_PUBLISHED || $faqObj->status() == _SF_STATUS_NEW_ANSWER) {
$answerObj =& $faqObj->answer();
$form->addElement(new XoopsFormLabel(_MD_SF_ORIGINAL_ANSWER, $answerObj->answer()), false);
}
$form->addElement(new XoopsFormHidden('faqid', $faqObj->faqid()));
$button_tray = new XoopsFormElementTray('', '');
$hidden = new XoopsFormHidden('op', 'post');
$button_tray->addElement($hidden);
$button_tray = new XoopsFormElementTray('', '');
$hidden = new XoopsFormHidden('op', 'post');
$button_tray->addElement($hidden);
$button_tray->addElement(new XoopsFormButton('', 'post', _MD_SF_SUBMITANSWER, 'submit'));
示例15: XoopsFormRadioYN
if (!empty($xoopsModuleConfig["forum"]) && $isModerator && !$article_obj->getVar("art_forum")) {
$form_element["active"]["forum"] = new XoopsFormRadioYN(art_constant("MD_FORUM"), "forum", 0, _YES, " " . _NO);
}
// External Links
$form_element["active"]["art_elinks"] = new XoopsFormTextArea(art_constant("MD_ELINKS"), "art_elinks", $art_elinks, 3);
$form_element["inactive"]["art_elinks"] = new XoopsFormHidden("art_elinks", $art_elinks);
// Trackbacks
if (!empty($xoopsModuleConfig["do_trackback"])) {
$form_element["active"]["trackbacks"] = new XoopsFormTextArea(art_constant("MD_TRACKBACKS"), "trackbacks", $trackbacks, 3);
$form_element["inactive"]["trackbacks"] = new XoopsFormHidden("trackbacks", $trackbacks);
}
// Notify for approval
if (!$canPublish && is_object($xoopsUser) && $xoopsModuleConfig["notification_enabled"]) {
$form_element["active"]["notify"] = new XoopsFormRadioYN(art_constant("MD_NOTIFY_ON_APPROVAL"), "notify", $notify, _YES, " " . _NO);
$form_element["inactive"]["notify"] = new XoopsFormHidden("notify", $notify);
}
// Approval option
if ($article_obj->getVar("art_time_submit") && !$article_obj->getVar("art_time_publish") && $isModerator) {
$form_element["active"]["approved"] = new XoopsFormRadioYN(art_constant("MD_APPROVE"), "approved", 1, _YES, " " . _NO);
$form_element["inactive"]["approved"] =& $form_element["active"]["approved"];
}
// Update publish time
if ($article_obj->getVar("art_time_publish") && $isModerator) {
$update_time_value = !empty($_POST["update_time_value"]) && !empty($_POST["update_time"]) ? intval(strtotime(@$_POST["update_time_value"]["date"]) + @$_POST["update_time_value"]["time"]) : $article_obj->getVar("art_time_publish");
$date_tray = new XoopsFormElementTray(art_constant("MD_UPDATE_TIME"));
$date_tray->addElement(new XoopsFormDateTime("", "update_time_value", 15, $update_time_value));
$select_option = new XoopsFormCheckBox("", "update_time", intval(@$_POST["update_time"]));
$select_option->addOption(1, "<strong>" . _YES . "</strong>");
$date_tray->addElement($select_option);
$form_element["active"]["update_time"] = $date_tray;
}