/** * 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; }
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; }
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); }
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; }
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; }
/** * Constructor * * @param string $caption * @param string $name * @param mixed $value Pre-selected value (or array of them). */ public function __construct($caption, $name, $value = null) { /** @var XoopsMemberHandler $member_handler */ $member_handler = xoops_getHandler('member'); $userGroups = $member_handler->getGroupList(); parent::__construct($caption, $name, $value); $this->columns = 3; foreach ($userGroups as $group_id => $group_name) { $this->addOption($group_id, $group_name); } }
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(); }
// // // 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"));
} $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 ');
$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;
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); $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); } else { // else, we're editing an existing faq // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SF_MODIFY, 'submit' ) ); $butt_create = new XoopsFormButton('', '', $button_caption, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'addfaq\'"'); $button_tray->addElement($butt_create); $butt_edit = new XoopsFormButton('', '', _AM_SF_OPEN_QUESTION_EDIT, 'button'); $butt_edit->setExtra("onclick=\"location='faq.php?op=mod&faqid=" . $faqid . "'\""); $button_tray->addElement($butt_edit); $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); } $sform->addElement($button_tray); $sform->display(); echo "</div>"; unset($hidden); }
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; }
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>";
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); $r->addElement($b); $cat_tray->addElement($r); $this->addElement($cat_tray); //End of fx2024 code } /* $module_id = $xoopsModule->getVar('mid'); $gperm_handler = &xoops_gethandler('groupperm'); $mod_perms = $gperm_handler->getGroupIds('category_moderation', $categoryid, $module_id); $moderators_select = new XoopsFormSelect('', 'moderators', $moderators, 5, true); $moderators_tray->addElement($moderators_select); $butt_mngmods = new XoopsFormButton('', '', 'Manage mods', 'button'); $butt_mngmods->setExtra('onclick="javascript:small_window(\'pop.php\', 370, 350);"'); $moderators_tray->addElement($butt_mngmods); $butt_delmod = new XoopsFormButton('', '', 'Delete mod', 'button'); $butt_delmod->setExtra('onclick="javascript:deleteSelectedItemsFromList(this.form.elements[\'moderators[]\']);"'); $moderators_tray->addElement($butt_delmod); $this->addElement($moderators_tray); */ $this->addElement(new XoopsFormHidden('categoryid', $this->targetObject->categoryid())); //$parentid = $this->targetObject->parentid('s'); //$this -> addElement( new XoopsFormHidden( 'parentid', $parentid ) ); $this->addElement(new XoopsFormHidden('nb_sub_yet', $this->subCatsCount)); }
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'));
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; }
$image_tray = new XoopsFormElementTray("", " "); $image_tray->addElement($image_select); if (!empty($cat_image) && file_exists(XOOPS_ROOT_PATH . "/" . $path_image . "/" . $cat_image)) { $image_tray->addElement(new XoopsFormLabel("", "<div style=\"padding: 8px;\"><img src=\"" . XOOPS_URL . "/" . $path_image . "/" . $cat_image . "\" name=\"img\" id=\"img\" alt=\"\" /></div>")); } else { $image_tray->addElement(new XoopsFormLabel("", "<div style=\"padding: 8px;\"><img src=\"" . XOOPS_URL . "/images/blank.gif\" name=\"img\" id=\"img\" alt=\"\" /></div>")); } $image_option_tray->addElement($image_tray); $form_art->addElement($image_option_tray); } // The moderator if (art_isAdministrator()) { $form_art->addElement(new XoopsFormSelectUser(art_constant("MD_MODERATOR"), 'cat_moderator', false, $category_obj->getVar("cat_moderator"), 5, true)); } else { if ($moderators = $category_obj->getVar("cat_moderator")) { $moderator_checkbox = new XoopsFormCheckBox(art_constant("MD_MODERATOR"), "cat_moderator", array_keys($moderators)); $moderator_checkbox->addOptionArray(art_getUnameFromId($moderators)); $moderator_checkbox->setExtra("\"disabled\""); $form_art->addElement($moderator_checkbox); } } // Entry article $limit_article = 100; if ($category_obj->getVar("cat_id")) { $article_handler =& xoops_getmodulehandler("article", $GLOBALS["artdirname"]); $criteria_article = new Criteria("cat_id", $category_obj->getVar("cat_id")); $article_count = $article_handler->getCount($criteria_article); if ($article_count > 0) { $article_list[0] = _NONE; if ($article_count > $limit_article) { $article_list = $article_list + $article_handler->getList(new Criteria("art_id", $category_obj->getVar("cat_entry")));
function render($ele_value, $caption, $markupName, $isDisabled, $element, $entry_id) { global $myts; $myts =& MyTextSanitizer::getInstance(); $renderer =& new formulizeElementRenderer(); $ele_desc = $element->getVar('ele_desc', "f"); if (strstr($markupName, "de_")) { // display element uses a slightly different element name so it can be distinguished on subsequent page load from regular elements...THIS IS NOT TRUE/NECESSARY ANYMORE SINCE FORMULIZE 3, WHERE ALL ELEMENTS ARE DISPLAY ELEMENTS $true_ele_id = str_replace("de_" . $element->getVar('id_form') . "_" . $entry_id . "_", "", $markupName); } else { $true_ele_id = str_replace("ele_", "", $markupName); } $selected = array(); $options = array(); $disabledHiddenValue = array(); $disabledHiddenValues = ""; $disabledOutputText = array(); $opt_count = 1; while ($i = each($ele_value)) { $options[$opt_count] = $myts->stripSlashesGPC($i['key']); if ($i['value'] > 0) { $selected[] = $opt_count; $disabledHiddenValue[] = "<input type=hidden name=\"" . $markupName . "[]\" value=\"{$opt_count}\">"; } $opt_count++; } if ($element->getVar('ele_delim') != "") { $delimSetting = $element->getVar('ele_delim'); } $delimSetting =& $myts->undoHtmlSpecialChars($delimSetting); if ($delimSetting == "br") { $delimSetting = "<br />"; } $hiddenOutOfRangeValuesToWrite = array(); switch ($delimSetting) { case 'space': $form_ele1 = new XoopsFormCheckBox($caption, $markupName, $selected); $counter = 0; // counter used for javascript that works with 'Other' box while ($o = each($options)) { $o = formulize_swapUIText($o, $element->getVar('ele_uitext')); $other = $renderer->optOther($o['value'], $markupName, $entry_id, $counter, true); if ($other != false) { $form_ele1->addOption($o['key'], _formulize_OPT_OTHER . $other); if (in_array($o['key'], $selected)) { $disabledOutputText[] = _formulize_OPT_OTHER . $other; } } else { $form_ele1->addOption($o['key'], $o['value']); if (in_array($o['key'], $selected)) { $disabledOutputText[] = $o['value']; } if (strstr($o['value'], _formulize_OUTOFRANGE_DATA)) { $hiddenOutOfRangeValuesToWrite[$o['key']] = str_replace(_formulize_OUTOFRANGE_DATA, "", $o['value']); // if this is an out of range value, grab the actual value so we can stick it in a hidden element later } } $counter++; } $form_ele1->setExtra(" onchange=\"javascript:formulizechanged=1;\" jquerytag=\"{$form_ele_id}\" "); break; default: $form_ele1 = new XoopsFormElementTray($caption, $delimSetting); $counter = 0; // counter used for javascript that works with 'Other' box while ($o = each($options)) { $o = formulize_swapUIText($o, $element->getVar('ele_uitext')); $t = new XoopsFormCheckBox('', $markupName . '[]', $selected); $other = $renderer->optOther($o['value'], $markupName, $entry_id, $counter, true); if ($other != false) { $t->addOption($o['key'], _formulize_OPT_OTHER . $other); if (in_array($o['key'], $selected)) { $disabledOutputText[] = _formulize_OPT_OTHER . $other; } } else { $t->addOption($o['key'], $o['value']); if (in_array($o['key'], $selected)) { $disabledOutputText[] = $o['value']; } if (strstr($o['value'], _formulize_OUTOFRANGE_DATA)) { $hiddenOutOfRangeValuesToWrite[$o['key']] = str_replace(_formulize_OUTOFRANGE_DATA, "", $o['value']); // if this is an out of range value, grab the actual value so we can stick it in a hidden element later } } $t->setExtra(" onchange=\"javascript:formulizechanged=1;\" jquerytag=\"{$form_ele_id}\" "); $form_ele1->addElement($t); unset($t); $counter++; } break; } $renderedHoorvs = ""; if (count($hiddenOutOfRangeValuesToWrite) > 0) { foreach ($hiddenOutOfRangeValuesToWrite as $hoorKey => $hoorValue) { $thisHoorv = new xoopsFormHidden('formulize_hoorv_' . $true_ele_id . '_' . $hoorKey, $hoorValue); $renderedHoorvs .= $thisHoorv->render() . "\n"; unset($thisHoorv); } } if ($isDisabled) { $disabledHiddenValues = implode("\n", $disabledHiddenValue); // glue the individual value elements together into a set of values $renderedElement = implode(", ", $disabledOutputText); } else { $renderedElement = $form_ele1->render(); } $form_ele = new XoopsFormLabel($caption, "<nobr>{$renderedElement}</nobr>\n{$renderedHoorvs}\n{$disabledHiddenValues}\n"); $form_ele->setDescription(html_entity_decode($ele_desc, ENT_QUOTES)); return $form_ele; }
$xoopsTpl->assign('menumode',$menumode); $xoopsTpl->assign('menumode_other',$menumode_other); if( !empty($xoopsModuleConfig['quickreply_enabled']) && $topic_handler->getPermission($viewtopic_forum, $xforumtopic->getVar('topic_status'), "reply") ){ include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php"; $forum_form = new XoopsThemeForm(_MD_POSTREPLY, 'quick_reply', "post.php", 'post', true); if(!is_object($xoopsUser)){ $config_handler =& xoops_gethandler('config'); $user_tray = new XoopsFormElementTray(_MD_ACCOUNT); $user_tray->addElement(new XoopsFormText(_MD_NAME, "uname", 26, 255)); $user_tray->addElement(new XoopsFormPassword(_MD_PASSWORD, "pass", 10, 32)); $login_checkbox = new XoopsFormCheckBox('', 'login', 1); $login_checkbox->addOption(1, _MD_LOGIN); $user_tray->addElement($login_checkbox); $forum_form->addElement($user_tray, ''); } $quickform = "textarea"; $editor_configs = array(); $editor_configs["caption"] = _MD_MESSAGEC; $editor_configs["name"] ="message"; $editor_configs["rows"] = 10; $editor_configs["cols"] = 60; if(!$editor_handler =& xoops_gethandler("editor", true)){ if(!@include_once XOOPS_ROOT_PATH."/class/xoopseditor/xoopseditor.php") { require_once XOOPS_ROOT_PATH."/Frameworks/xoops22/class/xoopseditor/xoopseditor.php"; }
$status_select->addOptionArray(array(XOOPS_COMMENT_PENDING => _CM_PENDING, XOOPS_COMMENT_ACTIVE => _CM_ACTIVE, XOOPS_COMMENT_HIDDEN => _CM_HIDDEN)); $cform->addElement($status_select); } $html_checkbox = new XoopsFormCheckBox('', 'dohtml', $dohtml); $html_checkbox->addOption(1, _CM_DOHTML); $option_tray->addElement($html_checkbox); $button_tray->addElement(new XoopsFormButton('', 'com_dodelete', _DELETE, 'submit')); } } $smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $dosmiley); $smiley_checkbox->addOption(1, _CM_DOSMILEY); $option_tray->addElement($smiley_checkbox); $xcode_checkbox = new XoopsFormCheckBox('', 'doxcode', $doxcode); $xcode_checkbox->addOption(1, _CM_DOXCODE); $option_tray->addElement($xcode_checkbox); $br_checkbox = new XoopsFormCheckBox('', 'dobr', $dobr); $br_checkbox->addOption(1, _CM_DOAUTOWRAP); $option_tray->addElement($br_checkbox); $cform->addElement($option_tray); $cform->addElement(new XoopsFormHidden('com_pid', intval($com_pid))); $cform->addElement(new XoopsFormHidden('com_rootid', intval($com_rootid))); $cform->addElement(new XoopsFormHidden('com_id', $com_id)); $cform->addElement(new XoopsFormHidden('com_itemid', $com_itemid)); $cform->addElement(new XoopsFormHidden('com_order', $com_order)); $cform->addElement(new XoopsFormHidden('com_mode', $com_mode)); // add module specific extra params if ('system' != $xoopsModule->getVar('dirname')) { $comment_config = $xoopsModule->getInfo('comments'); if (isset($comment_config['extraParams']) && is_array($comment_config['extraParams'])) { $myts =& MyTextSanitizer::getInstance(); foreach ($comment_config['extraParams'] as $extra_param) {
$timezone_select = new XoopsFormSelectTimezone(_US_TIMEZONE, 'timezone_offset', $u_obj->getVar('timezone_offset', 'e')); $form->addElement($timezone_select); // user_intrest $interest_text = new XoopsFormText(_US_INTEREST, 'user_intrest', 30, 150, $u_obj->getVar('user_intrest', 'e')); $form->addElement($interest_text); // appeal $app_tray = new XoopsFormElementTray(_MD_XOONIPS_ACCOUNT_APPEAL, '<br />'); $app_tarea = new XoopsFormTextArea('', 'appeal', $xu_obj->getVar('appeal', 'e'), 5, 50, 'u_appeal'); $app_tray->addElement($app_tarea); $form->addElement($app_tray); // user_sig $sig_tray = new XoopsFormElementTray(_US_SIGNATURE, '<br />'); $sig_tarea = new XoopsFormTextArea('', 'user_sig', $u_obj->getVar('user_sig', 'e')); $sig_tray->addElement($sig_tarea); $sig_cbox_value = $u_obj->getVar('attachsig', 's') ? 1 : 0; $sig_cbox = new XoopsFormCheckBox('', 'attachsig', $sig_cbox_value); $sig_cbox->addOption(1, _US_SHOWSIG); $sig_tray->addElement($sig_cbox); $form->addElement($sig_tray); // password & vpass $pwd_text = new XoopsFormPassword('', 'password', 10, 32); $pwd_text2 = new XoopsFormPassword('', 'vpass', 10, 32); $pwd_tray = new XoopsFormElementTray(_US_PASSWORD . '<br />' . _US_TYPEPASSTWICE); $pwd_tray->addElement($pwd_text); $pwd_tray->addElement($pwd_text2); $form->addElement($pwd_tray); // notice mail $notice_mail_text = new XoopsFormText(_MD_XOONIPS_ACCOUNT_NOTICE_MAIL, 'notice_mail', 5, 10, $xu_obj->getVar('notice_mail', 'e')); $form->addElement($notice_mail_text); // usercookie if ($uid == $myuid) {
function edititem($showmenu = false, $itemid = 0) { global $smartsection_file_handler, $smartsection_item_handler, $smartsection_category_handler, $xoopsUser, $xoopsModule, $xoopsConfig, $xoopsDB; include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; // If there is a parameter, and the id exists, retrieve data: we're editing a item if ($itemid != 0) { // Creating the ITEM object $itemObj = new ssItem($itemid); if ($itemObj->notLoaded()) { redirect_header("item.php", 1, _AM_SS_NOITEMSELECTED); exit; } switch ($itemObj->status()) { case _SS_STATUS_SUBMITTED: $breadcrumb_action1 = _AM_SS_SUBMITTED; $breadcrumb_action2 = _AM_SS_APPROVING; $page_title = _AM_SS_SUBMITTED_TITLE; $page_info = _AM_SS_SUBMITTED_INFO; $button_caption = _AM_SS_APPROVE; $new_status = _SS_STATUS_PUBLISHED; break; case _SS_STATUS_PUBLISHED: $breadcrumb_action1 = _AM_SS_PUBLISHED; $breadcrumb_action2 = _AM_SS_EDITING; $page_title = _AM_SS_PUBLISHEDEDITING; $page_info = _AM_SS_PUBLISHEDEDITING_INFO; $button_caption = _AM_SS_MODIFY; $new_status = _SS_STATUS_PUBLISHED; break; case _SS_STATUS_OFFLINE: $breadcrumb_action1 = _AM_SS_OFFLINE; $breadcrumb_action2 = _AM_SS_EDITING; $page_title = _AM_SS_OFFLINEEDITING; $page_info = _AM_SS_OFFLINEEDITING_INFO; $button_caption = _AM_SS_MODIFY; $new_status = _SS_STATUS_OFFLINE; break; case "default": default: break; } $categoryObj =& $itemObj->category(); if ($showmenu) { ss_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2); } echo "<br />\n"; ss_collapsableBar('edititemtable', 'edititemicon', $page_title, $page_info); } else { // there's no parameter, so we're adding an item $itemObj =& $smartsection_item_handler->create(); $categoryObj =& $smartsection_category_handler->create(); $breadcrumb_action1 = _AM_SS_ITEMS; $breadcrumb_action2 = _AM_SS_CREATINGNEW; $button_caption = _AM_SS_CREATE; $new_status = _SS_STATUS_PUBLISHED; if ($showmenu) { ss_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2); } $sel_categoryid = isset($_GET['categoryid']) ? $_GET['categoryid'] : 0; $categoryObj->setVar('categoryid', $sel_categoryid); ss_collapsableBar('createitemtable', 'createitemicon', _AM_SS_ITEM_CREATING, _AM_SS_ITEM_CREATING_DSC); } // ITEM FORM $sform = new XoopsThemeForm(_AM_SS_ITEMS, "op", xoops_getenv('PHP_SELF')); $sform->setExtra('enctype="multipart/form-data"'); // CATEGORY $mytree = new XoopsTree($xoopsDB->prefix("smartsection_categories"), "categoryid", "parentid"); ob_start(); $sform->addElement(new XoopsFormHidden('categoryid', $categoryObj->categoryid())); $mytree->makeMySelBox("name", "weight", $categoryObj->categoryid()); $category_label = new XoopsFormLabel(_AM_SS_CATEGORY, ob_get_contents()); $category_label->setDescription(_AM_SS_CATEGORY_DSC); $sform->addElement($category_label); ob_end_clean(); // TITLE $title_text = new XoopsFormText(_AM_SS_TITLE, 'title', 50, 255, $itemObj->title(0, 'e')); $sform->addElement($title_text, true); // SUMMARY $summary_text = ss_getEditor(_AM_SS_SUMMARY, 'summary', $itemObj->summary(0, 'e')); $summary_text->setDescription(_AM_SS_SUMMARY_DSC); $sform->addElement($summary_text, false); // DISPLAY_SUMMARY $display_summary_radio = new XoopsFormRadioYN(_AM_SS_DISPLAY_SUMMARY, 'display_summary', $itemObj->display_summary(), ' ' . _AM_SS_YES . '', ' ' . _AM_SS_NO . ''); $sform->addElement($display_summary_radio); // BODY $body_text = ss_getEditor(_AM_SS_BODY, 'body', $itemObj->body(0, 'e')); //$body_text = new XoopsFormDhtmlTextArea(_AM_SS_BODY, 'body', $itemObj->body(0, 'e'), 20, 60); $body_text->setDescription(_AM_SS_BODY_DSC); $sform->addElement($body_text, true); // IMAGE $image_array =& XoopsLists::getImgListAsArray(ss_getImageDir('item')); $image_select = new XoopsFormSelect('', 'image', $itemObj->image()); //$image_select -> addOption ('-1', '---------------'); $image_select->addOptionArray($image_array); $image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/smartsection/images/item/' . "\", \"\", \"" . XOOPS_URL . "\")'"); $image_tray = new XoopsFormElementTray(_AM_SS_IMAGE_ITEM, ' '); $image_tray->addElement($image_select); $image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . ss_getImageDir('item', false) . $itemObj->image() . "' name='image3' id='image3' alt='' />")); $image_tray->setDescription(_AM_SS_IMAGE_ITEM_DSC); $sform->addElement($image_tray); // IMAGE UPLOAD $max_size = 5000000; $file_box = new XoopsFormFile(_AM_SS_IMAGE_UPLOAD, "image_file", $max_size); $file_box->setExtra("size ='45'"); $file_box->setDescription(_AM_SS_IMAGE_UPLOAD_ITEM_DSC); $sform->addElement($file_box); // Uid /* We need to retreive the users manually because for some reason, on the frxoops.org server, the method users::getobjects encounters a memory error */ $uid = $itemObj->uid() == 0 ? $xoopsUser->uid() : $itemObj->uid(); $uid_select = new XoopsFormSelect(_AM_SS_UID, 'uid', $uid, 1, false); $uid_select->setDescription(_AM_SS_UID_DSC); $sql = "SELECT uid, uname FROM " . $xoopsDB->prefix('users') . " ORDER BY uname ASC"; $result = $xoopsDB->query($sql); $users_array = array(); while ($myrow = $xoopsDB->fetchArray($result)) { $users_array[$myrow['uid']] = $myrow['uname']; } $uid_select->addOptionArray($users_array); $sform->addElement($uid_select); // Datesub $datesub = $itemObj->getVar('datesub') == 0 ? time() : $itemObj->getVar('datesub'); $datesub_datetime = new XoopsFormDateTime(_AM_SS_DATESUB, 'datesub', $size = 15, $datesub); $datesub_datetime->setDescription(_AM_SS_DATESUB_DSC); $sform->addElement($datesub_datetime); // STATUS $options = array(_SS_STATUS_PUBLISHED => _AM_SS_PUBLISHED, _SS_STATUS_OFFLINE => _AM_SS_OFFLINE); $status_select = new XoopsFormSelect(_AM_SS_STATUS, 'status', $new_status); $status_select->addOptionArray($options); $status_select->setDescription(_AM_SS_STATUS_DSC); $sform->addElement($status_select); // WEIGHT $sform->addElement(new XoopsFormText(_AM_SS_WEIGHT, 'weight', 5, 5, $itemObj->weight()), true); // COMMENTS $addcomments_radio = new XoopsFormRadioYN(_AM_SS_ALLOWCOMMENTS, 'cancomment', $itemObj->cancomment(), ' ' . _AM_SS_YES . '', ' ' . _AM_SS_NO . ''); $sform->addElement($addcomments_radio); // PER ITEM PERMISSIONS $member_handler =& xoops_gethandler('member'); $group_list =& $member_handler->getGroupList(); $groups_checkbox = new XoopsFormCheckBox(_AM_SS_PERMISSIONS_ITEM, 'groups[]', $itemObj->getGroups_read()); $groups_checkbox->setDescription(_AM_SS_PERMISSIONS_ITEM_DSC); 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); // VARIOUS OPTIONS $options_tray = new XoopsFormElementTray(_AM_SS_OPTIONS, '<br />'); $html_checkbox = new XoopsFormCheckBox('', 'dohtml', $itemObj->dohtml()); $html_checkbox->addOption(1, _AM_SS_DOHTML); $options_tray->addElement($html_checkbox); $smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $itemObj->dosmiley()); $smiley_checkbox->addOption(1, _AM_SS_DOSMILEY); $options_tray->addElement($smiley_checkbox); $xcodes_checkbox = new XoopsFormCheckBox('', 'doxcode', $itemObj->doxcode()); $xcodes_checkbox->addOption(1, _AM_SS_DOXCODE); $options_tray->addElement($xcodes_checkbox); $images_checkbox = new XoopsFormCheckBox('', 'doimage', $itemObj->doimage()); $images_checkbox->addOption(1, _AM_SS_DOIMAGE); $options_tray->addElement($images_checkbox); $linebreak_checkbox = new XoopsFormCheckBox('', 'dobr', $itemObj->dobr()); $linebreak_checkbox->addOption(1, _AM_SS_DOLINEBREAK); $options_tray->addElement($linebreak_checkbox); $sform->addElement($options_tray); // item ID $sform->addElement(new XoopsFormHidden('itemid', $itemObj->itemid())); $button_tray = new XoopsFormElementTray('', ''); $hidden = new XoopsFormHidden('op', 'additem'); $button_tray->addElement($hidden); if (!$itemid) { // there's no itemid? Then it's a new item // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SS_CREATE, 'submit' ) ); $butt_create = new XoopsFormButton('', '', _AM_SS_CREATE, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'additem\'"'); $button_tray->addElement($butt_create); $butt_clear = new XoopsFormButton('', '', _AM_SS_CLEAR, 'reset'); $button_tray->addElement($butt_clear); $butt_cancel = new XoopsFormButton('', '', _AM_SS_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); $sform->addElement($button_tray); $sform->display(); ss_close_collapsable('createitemtable', 'createitemicon'); } else { // else, we're editing an existing item // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SS_MODIFY, 'submit' ) ); $butt_create = new XoopsFormButton('', '', $button_caption, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'additem\'"'); $button_tray->addElement($butt_create); $butt_cancel = new XoopsFormButton('', '', _AM_SS_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); $sform->addElement($button_tray); $sform->display(); ss_close_collapsable('edititemtable', 'edititemicon'); } unset($hidden); if ($itemid != 0) { showfiles($itemObj); } }
// holds kewords that are shorter than allowed minmum length $temp_queries = preg_split('/[\\s,]+/', mb_convert_kana($query, 's')); foreach ($temp_queries as $q) { $queries[] = addSlashes(trim($q)); } } else { $queries = array(addSlashes(trim($query))); } include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; // create form $search_form = new XoopsThemeForm(_SR_SEARCH, "search", "index.php", 'get'); $search_form->addElement(new XoopsFormText(_SR_KEYWORDS, "query", 30, 255, htmlspecialchars(stripslashes(implode(" ", $queries)), ENT_QUOTES)), true); $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); $mods_checkbox = new XoopsFormCheckBox(_SR_SEARCHIN, "mids[]", $mids); $mods_checkbox->addOptionArray($modules_name); $search_form->addElement($mods_checkbox); $search_form->addElement(new XoopsFormHidden("action", "results")); $search_form->addElement(new XoopsFormHidden("page", "search")); $search_form->addElement(new XoopsFormButton("", "submit", _SR_SEARCH, "submit")); $search_form->display(); if ($action == 'results') { echo '<div style="font-size:small">'; echo "<h3>" . _SR_SEARCHRESULTS . "</h3>"; echo _SR_KEYWORDS . ':'; if ($andor != 'exact') { foreach ($queries as $q) { echo ' <b>' . htmlspecialchars(stripslashes($q)) . '</b>'; } } else {
$criteria_tray->addElement($idle); //$criteria_tray->addElement($idle_less); $criteria_tray->addElement($regdate); $criteria_tray->addElement($mailok_cbox); $criteria_tray->addElement($inactive_cbox); //$criteria_tray->addElement($regd_max); $form->addElement($criteria_tray); } $fname_text = new XoopsFormText(_AM_SYSTEM_MAILUSERS_MAILFNAME, 'mail_fromname', 30, 255, htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)); $fromemail = !empty($xoopsConfig['adminmail']) ? $xoopsConfig['adminmail'] : $xoopsUser->getVar('email', 'E'); $femail_text = new XoopsFormText(_AM_SYSTEM_MAILUSERS_MAILFMAIL, 'mail_fromemail', 30, 255, $fromemail); $subject_caption = _AM_SYSTEM_MAILUSERS_MAILSUBJECT . "<br><br><span style='font-size:x-small;font-weight:bold;'>" . _AM_SYSTEM_MAILUSERS_MAILTAGS . "</span><br><span style='font-size:x-small;font-weight:normal;'>" . _AM_SYSTEM_MAILUSERS_MAILTAGS2 . '</span>'; $subject_text = new XoopsFormText($subject_caption, 'mail_subject', 50, 255); $body_caption = _AM_SYSTEM_MAILUSERS_MAILBODY . "<br><br><span style='font-size:x-small;font-weight:bold;'>" . _AM_SYSTEM_MAILUSERS_MAILTAGS . "</span><br><span style='font-size:x-small;font-weight:normal;'>" . _AM_SYSTEM_MAILUSERS_MAILTAGS1 . '<br>' . _AM_SYSTEM_MAILUSERS_MAILTAGS2 . '<br>' . _AM_SYSTEM_MAILUSERS_MAILTAGS3 . '<br>' . _AM_SYSTEM_MAILUSERS_MAILTAGS4 . '</span>'; $body_text = new XoopsFormTextArea($body_caption, 'mail_body', '', 10); $to_checkbox = new XoopsFormCheckBox(_AM_SYSTEM_MAILUSERS_SENDTO, 'mail_send_to', 'mail'); $to_checkbox->addOption('mail', _AM_SYSTEM_MAILUSERS_EMAIL); $to_checkbox->addOption('pm', _AM_SYSTEM_MAILUSERS_PM); $start_hidden = new XoopsFormHidden('mail_start', 0); $op_hidden = new XoopsFormHidden('op', 'send'); $submit_button = new XoopsFormButton('', 'mail_submit', _SEND, 'submit'); $form->addElement($fname_text); $form->addElement($femail_text); $form->addElement($subject_text); $form->addElement($body_text); $form->addElement($to_checkbox); $form->addElement($op_hidden); $form->addElement($start_hidden); $form->addElement($submit_button); $form->setRequired($subject_text); $form->setRequired($body_text);
$email_text = new XoopsFormText('', 'email', 25, 60, $myts->htmlSpecialChars($email)); $email_option = new XoopsFormCheckBox('', 'user_viewemail', $user_viewemail); $email_option->addOption(1, _US_ALLOWVIEWEMAIL); $email_tray->addElement($email_text, true); $email_tray->addElement($email_option); $reg_form = new XoopsThemeForm(_US_USERREG, 'userinfo', 'register.php', 'post', true); $uname_size = $xoopsConfigUser['maxuname'] < 25 ? $xoopsConfigUser['maxuname'] : 25; $reg_form->addElement(new XoopsFormText(_US_NICKNAME, 'uname', $uname_size, $uname_size, $myts->htmlSpecialChars($uname)), true); $reg_form->addElement($email_tray); $reg_form->addElement(new XoopsFormPassword(_US_PASSWORD, 'pass', 10, 32, $myts->htmlSpecialChars($pass)), true); $reg_form->addElement(new XoopsFormPassword(_US_VERIFYPASS, 'vpass', 10, 32, $myts->htmlSpecialChars($vpass)), true); $reg_form->addElement(new XoopsFormText(_US_WEBSITE, 'url', 25, 255, $myts->htmlSpecialChars($url))); $tzselected = $timezone_offset != '' ? $timezone_offset : $xoopsConfig['default_TZ']; $reg_form->addElement(new XoopsFormSelectTimezone(_US_TIMEZONE, 'timezone_offset', $tzselected)); //$reg_form->addElement($avatar_tray); $reg_form->addElement(new XoopsFormRadioYN(_US_MAILOK, 'user_mailok', $user_mailok)); if ($xoopsConfigUser['reg_dispdsclmr'] != 0 && $xoopsConfigUser['reg_disclaimer'] != '') { $disc_tray = new XoopsFormElementTray(_US_DISCLAIMER, '<br />'); $disc_text = new XoopsFormTextarea('', 'disclaimer', $xoopsConfigUser['reg_disclaimer'], 15, 80); $disc_text->setExtra('readonly="readonly"'); $disc_tray->addElement($disc_text); $agree_chk = new XoopsFormCheckBox('', 'agree_disc', $agree_disc); $agree_chk->addOption(1, _US_IAGREE); $eltname = $agree_chk->getName(); $eltmsg = str_replace('"', '\\"', stripslashes(sprintf(_FORM_ENTER, _US_IAGREE))); $agree_chk->customValidationCode[] = "if ( myform.{$eltname}.checked == false ) { window.alert(\"{$eltmsg}\"); myform.{$eltname}.focus(); return false; }"; $disc_tray->addElement($agree_chk, true); $reg_form->addElement($disc_tray); } $reg_form->addElement(new XoopsFormHidden('op', 'newuser')); $reg_form->addElement(new XoopsFormButton('', 'submitButton', _US_SUBMIT, 'submit'));
finaliza_request(); break; case "editar": $sql = sprintf("select * from collaborator where id = %s", $_GET["idusuario"]); $db->query($sql); $tmp = $db->fetch_assoc(); $formulario = new XoopsThemeForm("Edit collaborator", "Edicao_usuario", "?acao=editarsalvar&idusuario=" . $_GET["idusuario"]); $formulario->addElement(new XoopsFormText("Name:", "usuario[Nome]", 50, 100, $tmp['name'])); $formulario->addElement(new XoopsFormText("E-mail:", "usuario[Email]", 50, 100, $tmp['email'])); $formulario->addElement(new XoopsFormText("Username:"******"usuario[Login]", 20, 20, $tmp['username'])); $formulario->addElement(new XoopsFormPassword("Password:"******"usuario[Senha]", 20, 32, $tmp['password'])); $formulario->addElement(new XoopsFormHidden("usuario[SenhaTmp]", $tmp['password'])); $administrador = new XoopsFormCheckBox("Administrator:", "usuario[Administrador]", $tmp['administrator'] ? "true" : ""); $administrador->addOption("true", " "); $formulario->addElement($administrador); $coordenador = new XoopsFormCheckBox("Coordinator:", "usuario[Coordenador]", $tmp['coordinator'] ? "true" : ""); $coordenador->addOption("true", " "); $formulario->addElement($coordenador); $tray2 = new XoopsFormElementTray("", "table", "", "right"); $tray2->addElement(new XoopsFormButton("", "excluirusuario", "Disable", "submit", true)); $tray2->addElement(new XoopsFormButton("", "salvarusuario", "Save", "submit", true)); $formulario->addElement($tray2); $smarty->assign("formulario", $formulario->render()); $smarty->assign("display_conteudo", "formulariopadrao"); finaliza_request(); break; default: } } $sql = "select * from collaborator where active = 1 order by name"; $db->query($sql);
/** * @param $add_or_edit * @param string $user */ function form_user($add_or_edit, $user = '') { global $xoopsConfig, $xoopsUser; $uid = system_CleanVars($_REQUEST, 'uid', 0); //RMV-NOTIFY include_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/notification.php'; include_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; if ($add_or_edit === true) { //Add user $uid_value = ''; $uname_value = ''; $name_value = ''; $email_value = ''; $email_cbox_value = 0; $url_value = ''; $timezone_value = $xoopsConfig['default_TZ']; $icq_value = ''; $aim_value = ''; $yim_value = ''; $msnm_value = ''; $location_value = ''; $occ_value = ''; $interest_value = ''; $sig_value = ''; $sig_cbox_value = 0; $umode_value = $xoopsConfig['com_mode']; $uorder_value = $xoopsConfig['com_order']; // RMV-NOTIFY $notify_method_value = XOOPS_NOTIFICATION_METHOD_PM; $notify_mode_value = XOOPS_NOTIFICATION_MODE_SENDALWAYS; $bio_value = ''; $rank_value = 0; $mailok_value = 0; $form_title = _AM_SYSTEM_USERS_ADDUSER; $form_isedit = false; $groups = array(XOOPS_GROUP_USERS); } else { //Edit user $member_handler = xoops_getHandler('member'); $user = $member_handler->getUser($uid); if (is_object($user)) { $uid_value = $uid; $uname_value = $user->getVar('uname', 'E'); $name_value = $user->getVar('name', 'E'); $email_value = $user->getVar('email', 'E'); $email_cbox_value = $user->getVar('user_viewemail') ? 1 : 0; $url_value = $user->getVar('url', 'E'); $temp = $user->getVar('theme'); $timezone_value = $user->getVar('timezone_offset'); $icq_value = $user->getVar('user_icq', 'E'); $aim_value = $user->getVar('user_aim', 'E'); $yim_value = $user->getVar('user_yim', 'E'); $msnm_value = $user->getVar('user_msnm', 'E'); $location_value = $user->getVar('user_from', 'E'); $occ_value = $user->getVar('user_occ', 'E'); $interest_value = $user->getVar('user_intrest', 'E'); $sig_value = $user->getVar('user_sig', 'E'); $sig_cbox_value = $user->getVar('attachsig') == 1 ? 1 : 0; $umode_value = $user->getVar('umode'); $uorder_value = $user->getVar('uorder'); // RMV-NOTIFY $notify_method_value = $user->getVar('notify_method'); $notify_mode_value = $user->getVar('notify_mode'); $bio_value = $user->getVar('bio', 'E'); $rank_value = $user->rank(false); $mailok_value = $user->getVar('user_mailok', 'E'); $form_title = _AM_SYSTEM_USERS_UPDATEUSER . ': ' . $user->getVar('uname'); $form_isedit = true; $groups = array_values($user->getGroups()); } } //Affichage du formulaire $form = new XoopsThemeForm($form_title, 'form_user', 'admin.php', 'post', true); $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_NICKNAME, 'username', 25, 25, $uname_value), true); $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_NAME, 'name', 30, 60, $name_value)); $email_tray = new XoopsFormElementTray(_AM_SYSTEM_USERS_EMAIL, '<br>'); $email_text = new XoopsFormText('', 'email', 30, 60, $email_value); $email_tray->addElement($email_text, true); $email_cbox = new XoopsFormCheckBox('', 'user_viewemail', $email_cbox_value); $email_cbox->addOption(1, _AM_SYSTEM_USERS_AOUTVTEAD); $email_tray->addElement($email_cbox); $form->addElement($email_tray, true); $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_URL, 'url', 30, 100, $url_value)); $form->addElement(new XoopsFormSelectTimezone(_AM_SYSTEM_USERS_TIMEZONE, 'timezone_offset', $timezone_value)); $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_ICQ, 'user_icq', 15, 15, $icq_value)); $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_AIM, 'user_aim', 18, 18, $aim_value)); $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_YIM, 'user_yim', 25, 25, $yim_value)); $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_MSNM, 'user_msnm', 30, 100, $msnm_value)); $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_LOCATION, 'user_from', 30, 100, $location_value)); $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_OCCUPATION, 'user_occ', 30, 100, $occ_value)); $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_INTEREST, 'user_intrest', 30, 150, $interest_value)); $sig_tray = new XoopsFormElementTray(_AM_SYSTEM_USERS_SIGNATURE, '<br>'); $sig_tarea = new XoopsFormTextArea('', 'user_sig', $sig_value); $sig_tray->addElement($sig_tarea); $sig_cbox = new XoopsFormCheckBox('', 'attachsig', $sig_cbox_value); $sig_cbox->addOption(1, _AM_SYSTEM_USERS_SHOWSIG); $sig_tray->addElement($sig_cbox); $form->addElement($sig_tray); $umode_select = new XoopsFormSelect(_AM_SYSTEM_USERS_CDISPLAYMODE, 'umode', $umode_value); $umode_select->addOptionArray(array('nest' => _NESTED, 'flat' => _FLAT, 'thread' => _THREADED)); $form->addElement($umode_select); $uorder_select = new XoopsFormSelect(_AM_SYSTEM_USERS_CSORTORDER, 'uorder', $uorder_value); $uorder_select->addOptionArray(array('0' => _OLDESTFIRST, '1' => _NEWESTFIRST)); $form->addElement($uorder_select); // RMV-NOTIFY $notify_method_select = new XoopsFormSelect(_NOT_NOTIFYMETHOD, 'notify_method', $notify_method_value); $notify_method_select->addOptionArray(array(XOOPS_NOTIFICATION_METHOD_DISABLE => _NOT_METHOD_DISABLE, XOOPS_NOTIFICATION_METHOD_PM => _NOT_METHOD_PM, XOOPS_NOTIFICATION_METHOD_EMAIL => _NOT_METHOD_EMAIL)); $form->addElement($notify_method_select); $notify_mode_select = new XoopsFormSelect(_NOT_NOTIFYMODE, 'notify_mode', $notify_mode_value); $notify_mode_select->addOptionArray(array(XOOPS_NOTIFICATION_MODE_SENDALWAYS => _NOT_MODE_SENDALWAYS, XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE => _NOT_MODE_SENDONCE, XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT => _NOT_MODE_SENDONCEPERLOGIN)); $form->addElement($notify_mode_select); $form->addElement(new XoopsFormTextArea(_AM_SYSTEM_USERS_EXTRAINFO, 'bio', $bio_value)); $rank_select = new XoopsFormSelect(_AM_SYSTEM_USERS_RANK, 'rank', $rank_value); $ranklist = XoopsLists::getUserRankList(); if (count($ranklist) > 0) { $rank_select->addOption(0, '--------------'); $rank_select->addOptionArray($ranklist); } else { $rank_select->addOption(0, _AM_SYSTEM_USERS_NSRID); } $form->addElement($rank_select); // adding a new user requires password fields if (!$form_isedit) { $form->addElement(new XoopsFormPassword(_AM_SYSTEM_USERS_PASSWORD, 'password', 10, 32), true); $form->addElement(new XoopsFormPassword(_AM_SYSTEM_USERS_RETYPEPD, 'pass2', 10, 32), true); } else { $form->addElement(new XoopsFormPassword(_AM_SYSTEM_USERS_PASSWORD, 'password', 10, 32)); $form->addElement(new XoopsFormPassword(_AM_SYSTEM_USERS_RETYPEPD, 'pass2', 10, 32)); } $form->addElement(new XoopsFormRadioYN(_AM_SYSTEM_USERS_ACCEPT_EMAIL, 'user_mailok', $mailok_value)); //Groups administration addition XOOPS 2.0.9: Mith $gperm_handler = xoops_getHandler('groupperm'); //If user has admin rights on groups if ($gperm_handler->checkRight('system_admin', XOOPS_SYSTEM_GROUP, $xoopsUser->getGroups(), 1)) { //add group selection $group_select[] = new XoopsFormSelectGroup(_AM_SYSTEM_USERS_GROUPS, 'groups', false, $groups, 5, true); } else { //add each user groups foreach ($groups as $key => $group) { $group_select[] = new XoopsFormHidden('groups[' . $key . ']', $group); } } foreach ($group_select as $group) { $form->addElement($group); unset($group); } $form->addElement(new XoopsFormHidden('fct', 'users')); $form->addElement(new XoopsFormHidden('op', 'users_save')); $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); if (!empty($uid_value)) { $form->addElement(new XoopsFormHidden('uid', $uid_value)); } $form->display(); }
$form_style->addElement($form_show_rating); $form_show_updated = new XoopsFormCheckBox("", "show_updated", $show_updated); $form_show_updated->addOption("Y", _LANG_WLC_SUBEDIT_UPDATE); $form_style->addElement($form_show_updated); $form_sort = new XoopsFormElementTray(_LANG_WLC_SUBEDIT_SORT); $form->addElement($form_sort); $form_sort_order = new XoopsFormSelect("", "sort_order", $sort_order); $form_sort_order->addOption("name", 'Name'); $form_sort_order->addOption("id", 'Id'); $form_sort_order->addOption("url", 'URL'); $form_sort_order->addOption("rating", 'Rating'); $form_sort_order->addOption("updated", 'Updated'); $form_sort_order->addOption("rand", 'Random'); $form_sort_order->addOption("length", 'Name Length'); $form_sort->addElement($form_sort_order); $form_sort_desc = new XoopsFormCheckBox("", "sort_desc", $sort_desc); $form_sort_desc->addOption("Y", _LANG_WLC_SUBEDIT_DESCEND); $form_sort->addElement($form_sort_desc); $form->addElement(new XoopsFormText(_LANG_WLC_SUBEDIT_BEFORE, "text_before_link", 45, 150, $text_before_link)); $form->addElement(new XoopsFormText(_LANG_WLC_SUBEDIT_BETWEEN, "text_after_link", 45, 150, $text_after_link)); $form->addElement(new XoopsFormText(_LANG_WLC_SUBEDIT_AFTER, "text_after_all", 45, 150, $text_after_all)); $form_list_limit = new XoopsFormText(_LANG_WLC_SUBEDIT_LIMIT, "list_limit", 5, 5, $list_limit); $form_list_limit->setDescription("(" . _LANG_WLC_EPAGE_EMPTY . ")"); $form->addElement($form_list_limit); if ($form_id == 'addcat') { $form->addElement(new XoopsFormButton("", "submit", _LANG_WLC_ADDBUTTON_TEXT, "submit")); $form->addElement(new XoopsFormHidden("action", 'addcat')); } elseif ($form_id == 'editcat') { $form_button = new XoopsFormElementTray(""); $form->addElement($form_button); $form_button->addElement(new XoopsFormButton("", "submit", _LANG_WLC_SAVEBUTTON_TEXT, "submit"));
$expired_checkbox = new XoopsFormCheckBox('', 'autoexpdate', $check); $expired_checkbox->addOption(1, _AM_SETEXPDATETIME); $option_tray->addElement($expired_checkbox); $option_tray->addElement(new XoopsFormDateTime(_AM_SETEXPDATETIME, 'expiry_date', 15, $expired)); } if (is_object($xoopsUser)) { $notify_checkbox = new XoopsFormCheckBox('', 'notifypub', $notifypub); $notify_checkbox->addOption(1, _NW_NOTIFYPUBLISH); $option_tray->addElement($notify_checkbox); if ($xoopsUser->isAdmin($xoopsModule->getVar('mid'))) { $nohtml_checkbox = new XoopsFormCheckBox('', 'nohtml', $nohtml); $nohtml_checkbox->addOption(1, _DISABLEHTML); $option_tray->addElement($nohtml_checkbox); } } $smiley_checkbox = new XoopsFormCheckBox('', 'nosmiley', $nosmiley); $smiley_checkbox->addOption(1, _DISABLESMILEY); $option_tray->addElement($smiley_checkbox); $sform->addElement($option_tray); //Submit buttons $button_tray = new XoopsFormElementTray('', ''); $preview_btn = new XoopsFormButton('', 'preview', _PREVIEW, 'submit'); $preview_btn->setExtra('accesskey="p"'); $button_tray->addElement($preview_btn); $submit_btn = new XoopsFormButton('', 'post', _NW_POST, 'submit'); $submit_btn->setExtra('accesskey="s"'); $button_tray->addElement($submit_btn); $sform->addElement($button_tray); //Hidden variables if (isset($storyid)) { $sform->addElement(new XoopsFormHidden('storyid', $storyid));
function topicsmanager() { global $xoopsModule, $xoopsModuleConfig, $xoopsDB; include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; //$uploadfolder=sprintf(_AMS_AM_UPLOAD_WARNING,XOOPS_URL . "/modules/" . $xoopsModule -> dirname().'/images/topics'); $uploadirectory = "/modules/" . $xoopsModule->dirname() . '/images/topics'; $start = isset($_GET['start']) ? intval($_GET['start']) : 0; include_once XOOPS_ROOT_PATH . "/class/tree.php"; $xt = new AmsTopic($xoopsDB->prefix("ams_topics")); $allTopics = $xt->getAllTopics(); $totaltopics = count($allTopics); if ($totaltopics > 0) { $topic_obj_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid'); $topics_arr = $topic_obj_tree->getAllChild(0); } echo "<form action='index.php' method='POST'>"; echo "<div class=\"odd\">"; echo "<div style='text-align: center;'><b>" . _AMS_AM_TOPICSMNGR . ' (' . ($start + 1) . '-' . ($start + $xoopsModuleConfig['storycountadmin'] > $totaltopics ? $totaltopics : $start + $xoopsModuleConfig['storycountadmin']) . ' ' . _AMS_AM_OF . ' ' . $totaltopics . ')' . "</b><br /><br />"; echo "<table border='1' width='100%'><tr class='bg3'><td align='center'>" . _AMS_AM_TOPIC . "</td><td align='left'>" . _AMS_AM_TOPICNAME . "</td><td align='center'>" . _AMS_AM_PARENTTOPIC . "</td><td> " . _AMS_AM_WEIGHT . " </td><td align='center'>" . _AMS_AM_ACTION . "</td></tr>"; //If topic not empty if ($totaltopics > 0) { $i = 0; foreach ($topics_arr as $thisTopic) { $i++; if ($i > $start && $i - $start <= $xoopsModuleConfig['storycountadmin']) { $linkedit = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/admin/index.php?op=topicsmanager&topic_id=' . $thisTopic->topic_id(); $linkdelete = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/admin/index.php?op=delTopic&topic_id=' . $thisTopic->topic_id(); $action = sprintf("<a href='%s'>%s</a> - <a href='%s'>%s</a>", $linkedit, _AMS_AM_EDIT, $linkdelete, _AMS_AM_DELETE); $parent = ' '; $pid = $thisTopic->topic_pid(); if ($pid > 0) { $parent = $topics_arr[$pid]->topic_title(); $thisTopic->prefix = str_replace(".", "-", $thisTopic->prefix) . ' '; } else { $thisTopic->prefix = str_replace(".", "", $thisTopic->prefix); } echo "<tr><td>" . $thisTopic->topic_id() . "</td><td align='left'>" . $thisTopic->prefix() . $thisTopic->topic_title() . "</td><td align='left'>" . $parent . "</td><td align='center'><input type='text' name='weight[" . $thisTopic->topic_id() . "]' value='" . $thisTopic->weight . "' size='10' maxlength='10' /> </td><td>" . $action . "</td></tr>"; } } echo "<tr><td colspan='3'></td><td><input type='hidden' name='op' value='reorder' />\r\n <input type='submit' name='submit' value='" . _AMS_AM_SUBMIT . "' /></td><td></td></tr>"; } echo "</table></div></div></form>"; if ($totaltopics > $xoopsModuleConfig['storycountadmin']) { $pagenav = new XoopsPageNav($totaltopics, $xoopsModuleConfig['storycountadmin'], $start, 'start', 'op=topicsmanager'); echo "<div align='right'>"; echo $pagenav->renderNav() . '</div><br />'; } $topic_id = isset($_GET['topic_id']) ? intval($_GET['topic_id']) : 0; if ($topic_id > 0) { $xtmod = $topics_arr[$topic_id]; $topic_title = $xtmod->topic_title('E'); $op = 'modTopicS'; if (trim($xtmod->topic_imgurl()) != '') { $topicimage = $xtmod->topic_imgurl(); } else { $topicimage = "blank.png"; } $btnlabel = _AMS_AM_MODIFY; $parent = $xtmod->topic_pid(); $formlabel = _AMS_AM_MODIFYTOPIC; $banner = $xtmod->banner; $banner_inherit = $xtmod->banner_inherit; $forum = $xtmod->forum_id; unset($xtmod); } else { $topic_title = ''; $op = 'addTopic'; $topicimage = 'xoops.gif'; $btnlabel = _AMS_AM_ADD; $parent = 0; $formlabel = _AMS_AM_ADD_TOPIC; $banner = ''; $banner_inherit = 0; $forum = 0; } $sform = new XoopsThemeForm($formlabel, "topicform", XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php', 'post'); $sform->setExtra('enctype="multipart/form-data"'); $sform->addElement(new XoopsFormText(_AMS_AM_TOPICNAME . ' ' . _AMS_AM_MAX40CHAR, 'topic_title', 40, 50, $topic_title), true); $sform->addElement(new XoopsFormHidden('op', $op), false); $sform->addElement(new XoopsFormHidden('topic_id', $topic_id), false); if ($totaltopics > 0) { $sform->addElement(new XoopsFormLabel(_AMS_AM_PARENTTOPIC, $topic_obj_tree->makeSelBox('topic_pid', 'topic_title', '--', $parent, true))); } else { $sform->addElement(new XoopsFormHidden('topic_pid', 0)); } // ********** Picture $imgtray = new XoopsFormElementTray(_AMS_AM_TOPICIMG, '<br />'); $imgpath = sprintf(_AMS_AM_IMGNAEXLOC, "modules/" . $xoopsModule->dirname() . "/images/topics/"); $imageselect = new XoopsFormSelect($imgpath, 'topic_imgurl', $topicimage); $topics_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/modules/AMS/images/topics/"); foreach ($topics_array as $image) { $imageselect->addOption("{$image}", $image); } $imageselect->setExtra("onchange='showImgSelected(\"image3\", \"topic_imgurl\", \"" . $uploadirectory . "\", \"\", \"" . XOOPS_URL . "\")'"); $imgtray->addElement($imageselect, false); $imgtray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . "/" . $uploadirectory . "/" . $topicimage . "' name='image3' id='image3' alt='' />")); $uploadfolder = sprintf(_AMS_AM_UPLOAD_WARNING, XOOPS_URL . "/modules/" . $xoopsModule->dirname() . '/images/topics'); $fileseltray = new XoopsFormElementTray('', '<br />'); $fileseltray->addElement(new XoopsFormFile(_AMS_AM_TOPIC_PICTURE, 'attachedfile', $xoopsModuleConfig['maxuploadsize']), false); $fileseltray->addElement(new XoopsFormLabel($uploadfolder), false); $imgtray->addElement($fileseltray); $sform->addElement($imgtray); //Forum linking $module_handler =& xoops_gethandler('module'); $forum_module =& $module_handler->getByDirname('newbb'); if (is_object($forum_module) && $forum_module->getVar('version') >= 200) { $forum_handler =& xoops_getmodulehandler('forum', 'newbb', true); if (is_object($forum_handler)) { $forums = $forum_handler->getForums(); if (count($forums) > 0) { $forum_tree = new XoopsObjectTree($forums, 'forum_id', 'parent_forum'); $sform->addElement(new XoopsFormLabel(_AMS_AM_LINKEDFORUM, $forum_tree->makeSelBox('forum_id', 'forum_name', '--', $forum, true))); } } } //Banner $sform->addElement(new XoopsFormDhtmlTextArea(_AMS_AM_TOPICBANNER, 'banner', $banner)); $inherit_checkbox = new XoopsFormCheckBox(_AMS_AM_BANNERINHERIT, 'banner_inherit', $banner_inherit); $inherit_checkbox->addOption(1, _YES); $sform->addElement($inherit_checkbox); //Added in AMS 2.50 Final. Use News 1.62 permission style //Enhance in AMS 3.0 Beta 1. Add default permission for approval=admin, submit=admin,User. // Permissions $member_handler =& xoops_gethandler('member'); $group_list =& $member_handler->getGroupList(); $gperm_handler =& xoops_gethandler('groupperm'); $group_type_ref =& $member_handler->getGroups(null, true); $admin_list = array(); $user_list = array(); $full_list = array(); $admincount = 1; $usercount = 1; $fullcount = 1; foreach (array_keys($group_type_ref) as $i) { if ($group_type_ref[$i]->getVar('group_type') == 'Admin') { $admin_list[$i] = $group_list[$i]; $admincount++; $user_list[$i] = $group_list[$i]; $usercount++; } if ($group_type_ref[$i]->getVar('group_type') == 'User') { $user_list[$i] = $group_list[$i]; $usercount++; } $full_list[$i] = $group_list[$i]; $fullcount++; } $admin_list = array_keys($admin_list); $user_list = array_keys($user_list); $full_list = array_keys($full_list); $groups_ids = array(); if ($topic_id > 0) { // Edit mode $groups_ids = $gperm_handler->getGroupIds('ams_approve', $topic_id, $xoopsModule->getVar('mid')); $groups_ids = array_values($groups_ids); $groups_AMS_can_approve_checkbox = new XoopsFormCheckBox(_AMS_AM_APPROVEFORM, 'groups_AMS_can_approve[]', $groups_ids); } else { // Creation mode $groups_AMS_can_approve_checkbox = new XoopsFormCheckBox(_AMS_AM_APPROVEFORM, 'groups_AMS_can_approve[]', $admin_list); } $groups_AMS_can_approve_checkbox->addOptionArray($group_list); $sform->addElement($groups_AMS_can_approve_checkbox); $groups_ids = array(); if ($topic_id > 0) { // Edit mode $groups_ids = $gperm_handler->getGroupIds('ams_submit', $topic_id, $xoopsModule->getVar('mid')); $groups_ids = array_values($groups_ids); $groups_AMS_can_submit_checkbox = new XoopsFormCheckBox(_AMS_AM_SUBMITFORM, 'groups_AMS_can_submit[]', $groups_ids); } else { // Creation mode $groups_AMS_can_submit_checkbox = new XoopsFormCheckBox(_AMS_AM_SUBMITFORM, 'groups_AMS_can_submit[]', $user_list); } $groups_AMS_can_submit_checkbox->addOptionArray($group_list); $sform->addElement($groups_AMS_can_submit_checkbox); $groups_ids = array(); if ($topic_id > 0) { // Edit mode $groups_ids = $gperm_handler->getGroupIds('ams_view', $topic_id, $xoopsModule->getVar('mid')); $groups_ids = array_values($groups_ids); $groups_AMS_can_view_checkbox = new XoopsFormCheckBox(_AMS_AM_VIEWFORM, 'groups_AMS_can_view[]', $groups_ids); } else { // Creation mode $groups_AMS_can_view_checkbox = new XoopsFormCheckBox(_AMS_AM_VIEWFORM, 'groups_AMS_can_view[]', $full_list); } $groups_AMS_can_view_checkbox->addOptionArray($group_list); $sform->addElement($groups_AMS_can_view_checkbox); // Submit buttons $button_tray = new XoopsFormElementTray('', ''); $submit_btn = new XoopsFormButton('', 'post', $btnlabel, 'submit'); $button_tray->addElement($submit_btn); $sform->addElement($button_tray); $sform->display(); }