本文整理汇总了PHP中XoopsThemeForm::setExtra方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsThemeForm::setExtra方法的具体用法?PHP XoopsThemeForm::setExtra怎么用?PHP XoopsThemeForm::setExtra使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsThemeForm
的用法示例。
在下文中一共展示了XoopsThemeForm::setExtra方法的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: 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;
}
示例3: getFormInfofields
/**
* Get form
*
* @param bool|mixed $action
* @return XoopsThemeForm
*/
public function getFormInfofields($action = false)
{
global $xoopsUser;
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
// Title
$title = $this->isNew() ? sprintf(_AM_WGTEAMS_INFOFIELD_ADD) : sprintf(_AM_WGTEAMS_INFOFIELD_EDIT);
// Get Theme Form
xoops_load('XoopsFormLoader');
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
// Infofields handler
//$infofieldsHandler = $this->wgteams->getHandler('infofields');
// Form Text AddField_name
$form->addElement(new XoopsFormText(_AM_WGTEAMS_INFOFIELD_NAME, 'infofield_name', 50, 255, $this->getVar('infofield_name')), true);
// Form Select User
$submitter = $this->isNew() ? $xoopsUser->getVar('uid') : $this->getVar('infofield_submitter');
$form->addElement(new XoopsFormSelectUser(_AM_WGTEAMS_SUBMITTER, 'infofield_submitter', false, $submitter, 1, false));
// Form Text Date Select
$form->addElement(new XoopsFormTextDateSelect(_AM_WGTEAMS_DATE_CREATE, 'infofield_date_created', '', $this->getVar('infofield_date_created')));
// Send
$form->addElement(new XoopsFormHidden('op', 'save'));
$form->addElement(new XoopsFormButtonTray('', _SUBMIT, 'submit', '', false));
return $form;
}
示例4: 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;
}
示例5: getForm
function getForm($action = false)
{
global $xoopsDB, $xoopsModule, $xoopsModuleConfig;
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
$title = $this->isNew() ? sprintf(_AM_TDMCREATE_MODULES_ADD) : sprintf(_AM_TDMCREATE_MODULES_EDIT);
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
$form = new XoopsThemeForm($title, 'form_modules', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
$form->insertBreak('<div align="center"><b>' . _AM_TDMCREATE_MODULES_IMPORTANT . '</b></div>', 'head');
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_NAME, 'modules_name', 50, 255, $this->getVar('modules_name')), true);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_VERSION, 'modules_version', 50, 255, $this->getVar('modules_version')), true);
$form->addElement(new XoopsFormTextArea(_AM_TDMCREATE_MODULES_DESCRIPTION, 'modules_description', $this->getVar('modules_description'), 3, 47), true);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_AUTHOR, 'modules_author', 50, 255, $this->getVar('modules_author')), true);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_LICENSE, 'modules_license', 50, 255, $this->getVar('modules_license')), true);
$modules_display_menu = $this->isNew() ? '1' : $this->getVar('modules_display_menu');
$form->addElement(new XoopsFormRadioYN(_AM_TDMCREATE_MODULES_DISPLAY_MENU, 'modules_display_menu', $modules_display_menu, _YES, _NO));
$modules_display_admin = $this->isNew() ? '1' : $this->getVar('modules_display_admin');
$form->addElement(new XoopsFormRadioYN(_AM_TDMCREATE_MODULES_DISPLAY_ADMIN, 'modules_display_admin', $modules_display_admin, _YES, _NO));
$modules_active_search = $this->isNew() ? '1' : $this->getVar('modules_active_search');
$form->addElement(new XoopsFormRadioYN(_AM_TDMCREATE_MODULES_ACTIVE_SEARCH, 'modules_active_search', $modules_active_search, _YES, _NO));
$modules_image = $this->getVar('modules_image') ? $this->getVar('modules_image') : 'blank.gif';
$uploadirectory = "/modules/" . $xoopsModule->dirname() . "/images/uploads/modules";
$imgtray = new XoopsFormElementTray(_AM_TDMCREATE_MODULES_IMAGE, '<br />');
$imgpath = sprintf(_AM_TDMCREATE_FORMIMAGE_PATH, "./modules/" . $xoopsModule->dirname() . "/images/uploads/modules");
$imageselect = new XoopsFormSelect($imgpath, 'modules_image', $modules_image);
$modules_image_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $uploadirectory);
foreach ($modules_image_array as $image) {
$imageselect->addOption("{$image}", $image);
}
$imageselect->setExtra("onchange='showImgSelected(\"image3\", \"modules_image\", \"" . $uploadirectory . "\", \"\", \"" . XOOPS_URL . "\")'");
$imgtray->addElement($imageselect, false);
$imgtray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . "/" . $uploadirectory . "/" . $modules_image . "' name='image3' id='image3' alt='' />"));
$fileseltray = new XoopsFormElementTray('', '<br />');
$fileseltray->addElement(new XoopsFormFile(_AM_TDMCREATE_FORMUPLOAD, 'attachedfile', 104857600), false);
$fileseltray->addElement(new XoopsFormLabel(''), false);
$imgtray->addElement($fileseltray);
$form->addElement($imgtray);
$form->insertBreak('<div align="center"><b>' . _AM_TDMCREATE_MODULES_NOTIMPORTANT . '</b></div>', 'head');
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_AUTHOR_WEBSITE_URL, 'modules_author_website_url', 50, 255, $this->getVar('modules_author_website_url')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_AUTHOR_WEBSITE_NAME, 'modules_author_website_name', 50, 255, $this->getVar('modules_author_website_name')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_CREDITS, 'modules_credits', 50, 255, $this->getVar('modules_credits')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_RELEASE_INFO, 'modules_release_info', 50, 255, $this->getVar('modules_release_info')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_RELEASE_FILE, 'modules_release_file', 50, 255, $this->getVar('modules_release_file')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_MANUAL, 'modules_manual', 50, 255, $this->getVar('modules_manual')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_MANUAL_FILE, 'modules_manual_file', 50, 255, $this->getVar('modules_manual_file')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_DEMO_SITE_URL, 'modules_demo_site_url', 50, 255, $this->getVar('modules_demo_site_url')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_DEMO_SITE_NAME, 'modules_demo_site_name', 50, 255, $this->getVar('modules_demo_site_name')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_MODULE_WEBSITE_URL, 'modules_module_website_url', 50, 255, $this->getVar('modules_module_website_url')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_MODULE_WEBSITE_NAME, 'modules_module_website_name', 50, 255, $this->getVar('modules_module_website_name')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_RELEASE, 'modules_release', 50, 255, $this->getVar('modules_release')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_STATUS, 'modules_module_status', 50, 255, $this->getVar('modules_module_status')), false);
$form->addElement(new XoopsFormHidden('op', 'modules_save'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
$form->display();
return $form;
}
示例6: 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;
}
示例7: 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;
}
示例8: replyForm
function replyForm($action = false, $title = _MA_SUPPORT_QUESTIONREPLY, $type = 'reply')
{
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
$member_handler =& xoops_gethandler('member');
$category_handler =& xoops_getmodulehandler('category', 'support');
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
$format = empty($format) ? "e" : $format;
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra("enctype=\"multipart/form-data\"");
// subject
$form->addElement(new XoopsFormLabel(_MA_SUPPORT_QUESTIONNAME, $this->getVar('subject', $format)));
// forword
if ($type == 'forword') {
$criteria = new CriteriaCompo();
$criteria->setSort('cat_weight');
$criteria->setOrder('ASC');
$categories = $category_handler->getList($criteria);
if (empty($categories)) {
$categories = array(_MA_SUPPORT_DEFAULTCAT);
}
$cat_select = new XoopsFormSelect(_MA_SUPPORT_FORWARDCAT, "cat_id", '');
$cat_select->addOption(0, _MA_SUPPORT_CHOICE);
$cat_select->addOptionArray($categories);
$form->addElement($cat_select);
$support = new XoopsFormElementTray(_MA_SUPPORT_FORWORDMANGER, '', 'support');
$support_select = new XoopsFormSelect('', "forword", '');
$support_select->addOption('', _MA_SUPPORT_CHOICE);
$support->addElement($support_select);
$support_multiLabel = new XoopsFormLabel('', _MA_SUPPORT_NOCHOICEMANGER);
$support->addElement($support_multiLabel);
$form->addElement($support);
}
// infomation
$configs = array('editor' => 'fckeditor', 'width' => '100%', 'height' => '500px', 'value' => '');
$form->addElement(new XoopsFormEditor(_MA_SUPPORT_QUESTIONDESC, 'infomation', $configs));
// annex
$annex = new XoopsFormElementTray(_MA_SUPPORT_ANNEX, '', 'annex');
$annex_file = new XoopsFormFile('', 'annex', '');
$annex_multiLabel = new XoopsFormLabel('', '<div><a id="addMore" href="javascript:void(0);">' . _MA_SUPPORT_ADDANNEX . '</a></div>');
$annex->addElement($annex_file);
$annex->addElement($annex_multiLabel);
$form->addElement($annex);
// gratetime
if ($this->isNew()) {
$form->addElement(new XoopsFormHidden('create_time', time()));
}
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}
示例9: getForm
/**
* @param bool $action
* @return XoopsThemeForm
*/
public function getForm($action = false)
{
global $xoopsDB, $xoopsModuleConfig;
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
$title = $this->isNew() ? sprintf(_AM_PRESENTER_CAT_ADD) : sprintf(_AM_PRESENTER_CAT_EDIT);
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
// Cat_pid
include_once XOOPS_ROOT_PATH . '/class/tree.php';
$categoriesHandler =& xoops_getModuleHandler('categories', 'presenter');
$criteria = new CriteriaCompo();
$categories = $categoriesHandler->getObjects($criteria);
if ($categories) {
$categories_tree = new XoopsObjectTree($categories, 'cat_id', 'cat_pid');
$cat_pid = $categories_tree->makeSelBox('cat_pid', 'cat_title', '--', $this->getVar('cat_pid', 'e'), false);
$form->addElement(new XoopsFormLabel(_AM_PRESENTER_CAT_PID, $cat_pid));
}
// Cat_title
$form->addElement(new XoopsFormText(_AM_PRESENTER_CAT_TITLE, 'cat_title', 50, 255, $this->getVar('cat_title')), true);
// Cat_desc
$form->addElement(new XoopsFormTextArea(_AM_PRESENTER_CAT_DESC, 'cat_desc', $this->getVar('cat_desc'), 4, 47), true);
// Cat_image
$cat_image = $this->getVar('cat_image') ? $this->getVar('cat_image') : 'blank.gif';
$uploadir = '/uploads/presenter/images/categories';
$imgtray = new XoopsFormElementTray(_AM_PRESENTER_CAT_IMAGE, '<br />');
$imgpath = sprintf(_AM_PRESENTER_FORMIMAGE_PATH, $uploadir);
$imageselect = new XoopsFormSelect($imgpath, 'cat_image', $cat_image);
$image_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $uploadir);
foreach ($image_array as $image) {
$imageselect->addOption("{$image}", $image);
}
$imageselect->setExtra("onchange='showImgSelected(\"image_cat_image\", \"cat_image\", \"" . $uploadir . "\", \"\", \"" . XOOPS_URL . "\")'");
$imgtray->addElement($imageselect);
$imgtray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . "/" . $uploadir . "/" . $cat_image . "' name='image_cat_image' id='image_cat_image' alt='' />"));
$fileseltray = new XoopsFormElementTray('', '<br />');
$fileseltray->addElement(new XoopsFormFile(_AM_PRESENTER_FORMUPLOAD, 'cat_image', $xoopsModuleConfig['maxsize']));
$fileseltray->addElement(new XoopsFormLabel(''));
$imgtray->addElement($fileseltray);
$form->addElement($imgtray);
// Cat_weight
$form->addElement(new XoopsFormText(_AM_PRESENTER_CAT_WEIGHT, 'cat_weight', 50, 255, $this->getVar('cat_weight')), false);
// Cat_color
// $form->addElement(new XoopsFormColorPicker(_AM_PRESENTER_CAT_COLOR, 'cat_color', $this->getVar('cat_color')), false);
$form->addElement(new XoopsFormHidden('op', 'save'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}
示例10: 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;
}
示例11: 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;
}
示例12: getForm
function getForm($action = false)
{
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
$title = $this->isNew() ? _AM_SPOTLIGHT_ADD_PAGE : _AM_SPOTLIGHT_EDIT_PAGE;
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra("enctype=\"multipart/form-data\"");
$form->addElement(new XoopsFormText(_AM_SPOTLIGHT_SLIDE_NAME, 'sp_name', 60, 255, $this->getVar('sp_name', 'e')), true);
$form->addElement(new XoopsFormTextArea(_AM_SPOTLIGHT_EXPLAIN, 'sp_desc', $this->getVar('sp_desc', 'e'), 5, 80));
//component
$component_name = $this->getVar('component_name', 'e');
if (empty($component_name)) {
$component_name = 'default';
}
include_once XOOPS_ROOT_PATH . "/modules/spotlight/components/{$component_name}/config.php";
//include component logo
$components_list = XoopsLists::getDirListAsArray(dirname(dirname(__FILE__)) . '/components');
foreach ($components_list as $key => $val) {
include_once XOOPS_ROOT_PATH . "/modules/spotlight/components/{$val}/config.php";
$_name = isset($config['name']) ? $config['name'] : $val;
$component_names[$val] = $_name;
unset($_name);
unset($config['name']);
}
$component = new XoopsFormElementTray(_AM_SPOTLIGHT_COMPONENTS);
$component_select = new XoopsFormSelect('', 'component_name', $component_name);
$component_select->addOptionArray($component_names);
$component->addElement($component_select);
$component->addElement(new XoopsFormLabel('', '<div id="component_logo">'));
if (isset($config['logo']) && file_exists(dirname(dirname(__FILE__)) . "/components/{$component_name}/{$config['logo']}")) {
$img_patch = XOOPS_URL . "/modules/spotlight/components/{$component_name}/{$config['logo']}";
$component->addElement(new XoopsFormLabel('', "<img src='{$img_patch}'>"));
} else {
$component->addElement(new XoopsFormLabel('', _AM_SPOTLIGHT_NO));
}
$component->addElement(new XoopsFormLabel('', '</div>'));
$form->addElement($component);
$form->addElement(new XoopsFormHidden('sp_id', $this->getVar('sp_id')));
$form->addElement(new XoopsFormHidden('ac', 'insert'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}
示例13: 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;
}
示例14: 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;
}
示例15: getForm
/**
* @return XoopsThemeForm
*/
public function getForm()
{
if ($this->isNew()) {
$blank_img = 'blank.gif';
} else {
$blank_img = $this->getVar('avatar_file', 'e');
}
// Get User Config
$config_handler = xoops_getHandler('config');
$xoopsConfigUser = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
$form = new XoopsThemeForm(_AM_SYSTEM_AVATAR_ADD, 'avatar_form', 'admin.php', 'post', true);
$form->setExtra('enctype="multipart/form-data"');
$form->addElement(new XoopsFormText(_IMAGENAME, 'avatar_name', 50, 255, $this->getVar('avatar_name', 'e')), true);
$maxpixel = '<div class="small basic italic">' . _US_MAXPIXEL . ' : ' . $xoopsConfigUser['avatar_width'] . ' x ' . $xoopsConfigUser['avatar_height'] . '</div>';
$maxsize = '<div class="small basic italic">' . _US_MAXIMGSZ . ' : ' . $xoopsConfigUser['avatar_maxsize'] . '</div>';
$uploadirectory_img = '';
$imgtray_img = new XoopsFormElementTray(_IMAGEFILE . '<br><br>' . $maxpixel . $maxsize, '<br>');
$imageselect_img = new XoopsFormSelect(sprintf(_AM_SYSTEM_AVATAR_USE_FILE, XOOPS_UPLOAD_PATH), 'avatar_file', $blank_img);
$image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH);
$imageselect_img->addOption("{$blank_img}", $blank_img);
foreach ($image_array_img as $image_img) {
// if (preg_match('#avt#', $image_img)) {
if (false !== strpos(image_img, 'avt')) {
$imageselect_img->addOption("{$image_img}", $image_img);
}
}
$imageselect_img->setExtra("onchange='showImgSelected(\"image_img\", \"avatar_file\", \"" . $uploadirectory_img . "\", \"\", \"" . XOOPS_UPLOAD_URL . "\")'");
$imgtray_img->addElement($imageselect_img, false);
$imgtray_img->addElement(new XoopsFormLabel('', "<br><img src='" . XOOPS_UPLOAD_URL . '/' . $blank_img . "' name='image_img' id='image_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);
$form->addElement(new XoopsFormText(_IMGWEIGHT, 'avatar_weight', 3, 4, $this->getVar('avatar_weight', 'e')));
$form->addElement(new XoopsFormRadioYN(_IMGDISPLAY, 'avatar_display', $this->getVar('avatar_display', 'e'), _YES, _NO));
$form->addElement(new XoopsFormHidden('op', 'save'));
$form->addElement(new XoopsFormHidden('fct', 'avatars'));
$form->addElement(new XoopsFormHidden('avatar_id', $this->getVar('avatar_id', 'e')));
$form->addElement(new XoopsFormButton('', 'avt_button', _SUBMIT, 'submit'));
return $form;
}