本文整理汇总了PHP中XoopsThemeForm::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsThemeForm::assign方法的具体用法?PHP XoopsThemeForm::assign怎么用?PHP XoopsThemeForm::assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsThemeForm
的用法示例。
在下文中一共展示了XoopsThemeForm::assign方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderFormSubmit
/**
* Render a form to send pictures
*
* @param int $maxbytes the maximum size of a picture
* @param object $xoopsTpl the one in which the form will be rendered
* @return bool TRUE
*
* obs: Some functions wont work on php 4 so edit lines down under acording to your version
*/
function renderFormSubmit($maxbytes, $xoopsTpl)
{
$form = new XoopsThemeForm(_MD_MYPICS_SUBMIT_PIC_TITLE, "form_picture", "submit.php", "post", true);
$field_url = new XoopsFormFile(_MD_MYPICS_SELECT_PHOTO, "sel_photo", 2000000);
$field_desc = new XoopsFormText(_MD_MYPICS_CAPTION, "caption", 35, 55);
$form->setExtra('enctype="multipart/form-data"');
$button_send = new XoopsFormButton("", "submit_button", _MD_MYPICS_UPLOADPICTURE, "submit");
$field_warning = new XoopsFormLabel(sprintf(_MD_MYPICS_YOUCANUPLOAD, $maxbytes / 1024));
$form->addElement($field_warning);
$form->addElement($field_url, true);
$form->addElement($field_desc, true);
$form->addElement($button_send);
$form->assign($xoopsTpl);
//If your server is php 5 uncomment this line
//$form->display(); //If your server is php 4.4 uncomment this line
return true;
}
示例2: XoopsTree
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'));
$form->addElement($button_tray);
$form->assign($xoopsTpl);
unset($hidden);
示例3: asort
}
}
asort($sortby_arr);
$sortby_arr = array_merge(array("" => _NONE, "uname" => _US_NICKNAME, "email" => _US_EMAIL), $sortby_arr);
$sortby_select = new XoopsFormSelect(_PROFILE_MA_SORTBY, 'sortby');
$sortby_select->addOptionArray($sortby_arr);
$searchform->addElement($sortby_select);
$order_select = new XoopsFormRadio(_PROFILE_MA_ORDER, 'order', 0);
$order_select->addOption(0, _ASCENDING);
$order_select->addOption(1, _DESCENDING);
$searchform->addElement($order_select);
$limit_text = new XoopsFormText(_PROFILE_MA_PERPAGE, 'limit', 15, 10, $limit_default);
$searchform->addElement($limit_text);
$searchform->addElement(new XoopsFormHidden('op', 'results'));
$searchform->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
$searchform->assign($GLOBALS['xoopsTpl']);
$GLOBALS['xoopsTpl']->assign('page_title', _PROFILE_MA_SEARCH);
//added count user
$member_handler =& xoops_gethandler('member');
$acttotal = $member_handler->getUserCount(new Criteria('level', 0, '>'));
$total = sprintf(_PROFILE_MA_ACTUS, "<span style='color:#ff0000;'>{$acttotal}</span>");
$GLOBALS['xoopsTpl']->assign('total_users', $total);
break;
case "results":
$xoopsOption['template_main'] = "profile_results.html";
include_once $GLOBALS['xoops']->path('header.php');
$GLOBALS['xoopsTpl']->assign('page_title', _PROFILE_MA_RESULTS);
$xoBreadcrumbs[] = array('link' => XOOPS_URL . "/modules/" . $GLOBALS['xoopsModule']->getVar('dirname', 'n') . '/search.php', 'title' => _SEARCH);
$xoBreadcrumbs[] = array('title' => _PROFILE_MA_RESULTS);
$member_handler =& xoops_gethandler('member');
// Dynamic fields
示例4: foreach
$sel_grp->setExtra("onchange='submit()'");
$member_handler =& xoops_gethandler('member');
$group_list = $member_handler->getGroupList();
$sel_grp->addOption(-1, _AM_SYSTEM_BLOCKS_TYPES);
$sel_grp->addOption(0, _AM_SYSTEM_BLOCKS_UNASSIGNED);
foreach ($group_list as $k => $v) {
$sel_grp->addOption($k, $v);
}
$filterform->addElement($sel_grp);
$sel_vis = new XoopsFormSelect(_AM_SYSTEM_BLOCKS_VISIBLE, 'selvis', $selvis);
$sel_vis->setExtra("onchange='submit()'");
$sel_vis->addOption(-1, _AM_SYSTEM_BLOCKS_TYPES);
$sel_vis->addOption(0, _NO);
$sel_vis->addOption(1, _YES);
$filterform->addElement($sel_vis);
$filterform->assign($xoopsTpl);
/* Get blocks */
$selvis = $selvis == -1 ? null : $selvis;
$selmod = $selmod == -2 ? null : $selmod;
$order_block = (isset($selvis) ? "" : "b.visible DESC, ") . "b.side,b.weight,b.bid";
if ($selgrp == 0) {
// get blocks that are not assigned to any groups
$blocks_arr = $block_handler->getNonGroupedBlocks($selmod, $toponlyblock = false, $selvis, $order_block);
} else {
$blocks_arr = $block_handler->getAllByGroupModule($selgrp, $selmod, $toponlyblock = false, $selvis, $order_block);
}
if ($selgen >= 0) {
foreach (array_keys($blocks_arr) as $bid) {
if ($blocks_arr[$bid]->getVar("mid") != $selgen) {
unset($blocks_arr[$bid]);
}
示例5: drawContactForm
//.........这里部分代码省略.........
$contact_form->addElement($error_text);
}
// check to see if there is some intro text to display
if ($contactclass->getContactIntro() != "") {
$intro_text = new XoopsFormLabel($contactclass->getContactIntroHead(), $contactclass->getContactIntro());
$contact_form->addElement($intro_text);
}
$name_text = new XoopsFormText(_CT_NAME, "usersName", 50, 100, $contactclass->getUserName());
$contact_form->addElement($name_text, true);
$email_text = new XoopsFormText(_CT_EMAIL, "usersEmail", 50, 100, $contactclass->getUserEmail());
$contact_form->addElement($email_text, true);
if ($contactclass->collectAddress() == true) {
$address_text = new XoopsFormTextArea(_CT_ADDRESS, "usersAddress", $contactclass->getAddress());
$contact_form->addElement($address_text);
}
if ($contactclass->collectURL() == true) {
$url_text = new XoopsFormText(_CT_URL, "usersSite", 50, 100, $contactclass->getURL());
$contact_form->addElement($url_text);
}
if ($contactclass->collectICQ() == true) {
$icq_text = new XoopsFormText(_CT_ICQ, "usersICQ", 50, 100, $contactclass->getICQ());
$contact_form->addElement($icq_text);
}
if ($contactclass->collectCompany() == true) {
$company_text = new XoopsFormText(_CT_COMPANY, "usersCompanyName", 50, 100, $contactclass->getCompany());
$contact_form->addElement($company_text);
}
if ($contactclass->collectLocation() == true) {
$location_text = new XoopsFormText(_CT_LOCATION, "usersCompanyLocation", 50, 100, $contactclass->getLocation());
$contact_form->addElement($location_text);
}
if ($contactclass->sendConfirm() == true) {
// draw the checkbox for user to get a confirmation mail
$email_v = $contactclass->getUserEmail();
$caption = $email_v == "" ? _CT_SENDCONFIRM : sprintf(_CT_SENDCONFIRMEMAIL, $email_v);
$sendconfirm = new XoopsFormCheckBox(_CT_CONFIRM, "userSendConfirm", $contactclass->getSendConfirm());
$sendconfirm->addOption(1, $caption);
$contact_form->addElement($sendconfirm);
}
if ($contactclass->showDepartment() == true) {
// show a drop down with the correct departments listed
$departmentlist = new XoopsFormSelect($contactclass->getDepartmentTitle(), "userDepartment");
$departments = $contactclass->getDepartments();
// get array of departments
$selDept = $contactclass->getSelectedDepartment();
$cnt = 0;
foreach ($departments as $val) {
$valexplode = explode(',', $val);
$selected = false;
if ($selDept != "" && strcmp($selDept, $valexplode[0]) == 0) {
// this option is selected
$selected = true;
} else {
if ($selDept == "" && $cnt == 0) {
// make it selected
$selected = true;
}
}
$departmentlist->addOption($valexplode[0]);
if ($selected == true) {
$departmentlist->setValue($valexplode[0]);
}
$cnt++;
}
$contact_form->addElement($departmentlist);
}
// add comment area
$comment_textarea = new XoopsFormTextArea(_CT_COMMENTS, "usersComments", $contactclass->getUserComments());
$contact_form->addElement($comment_textarea, true);
// add more info area if required
if ($contactclass->showMoreInfo() == true) {
// draw container with multi-select check boxes
$moreinfo = new XoopsFormCheckBox($contactclass->getMoreInfoTitle(), "userMoreInfo");
$moreinfolist = $contactclass->getMoreInfo();
$selmoreinfo = $contactclass->getUserMoreInfo();
foreach ($moreinfolist as $val) {
$moreinfo->addOption($val);
}
// end foreach $moreinfolist
$moreinfo->setValue($selmoreinfo);
$contact_form->addElement($moreinfo);
}
// add security check if required
if ($contactclass->collectSecurity() == true && extension_loaded('gd')) {
mt_srand((double) microtime() * 10000);
$random_num = mt_rand(0, 100000);
$security = "<img src='getgfx.php?random_num={$random_num}' border='1' alt='" . _CT_SECURITY_CODE . "' title='" . _CT_SECURITY_CODE . "'> " . "<img src='images/no-spam.jpg' alt='" . _CT_NO_SPAM . "' title='" . _CT_NO_SPAM . "'>";
// show the security block and input field
$security_graphic = new XoopsFormLabel(_CT_SECURITY_CODE, $security);
$contact_form->addElement($security_graphic);
$type_security = new XoopsFormText(_CT_SECURITY_TYPE, "securityType", 10, 6);
$contact_form->addElement($type_security, true);
$security_hidden = new XoopsFormHidden("securityHidden", $random_num);
$contact_form->addElement($security_hidden);
}
$submit_button = new XoopsFormButton("", "submit", _CT_SUBMIT, "submit");
$contact_form->addElement($submit_button);
$contact_form->assign($xoopsTpl);
include XOOPS_ROOT_PATH . "/footer.php";
}
示例6: asort
}
}
}
asort($sortby_arr);
$sortby_select = new XoopsFormSelect(_PROFILE_MA_SORTBY, 'sortby');
$sortby_select->addOptionArray($sortby_arr);
$searchform->addElement($sortby_select);
$order_select = new XoopsFormRadio(_PROFILE_MA_ORDER, 'order', 0);
$order_select->addOption(0, _ASCENDING);
$order_select->addOption(1, _DESCENDING);
$searchform->addElement($order_select);
$limit_text = new XoopsFormText(_PROFILE_MA_PERPAGE, 'limit', 15, 10);
$searchform->addElement($limit_text);
$searchform->addElement(new XoopsFormHidden('op', 'results'));
$searchform->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
$searchform->assign($xoopsTpl);
break;
case "results":
$xoopsOption['template_main'] = "profile_results.html";
include_once XOOPS_ROOT_PATH . "/header.php";
$member_handler =& xoops_gethandler('member');
// Dynamic fields
$profile_handler =& xoops_gethandler('profile');
// Get fields
$fields =& $profile_handler->loadFields();
// Get ids of fields that can be searched
$gperm_handler =& xoops_gethandler('groupperm');
$searchable_fields =& $gperm_handler->getItemIds('profile_search', $groups, $xoopsModule->getVar('mid'));
$searchvars = array();
$criteria = new CriteriaCompo(new Criteria('level', 0, ">"));
if (isset($_REQUEST['uname']) && $_REQUEST['uname'] != "") {
示例7: XoopsThemeForm
$form2 = new XoopsThemeForm(_US_CHOOSEAVT, 'chooseavatar', XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n') . '/edituser.php', 'post', true);
$avatar_select = new XoopsFormSelect('', 'user_avatar', $GLOBALS['xoopsUser']->getVar('user_avatar'));
$avatar_list = $avatar_handler->getList('S');
$avatar_selected = $GLOBALS['xoopsUser']->getVar("user_avatar", "E");
$avatar_selected = in_array($avatar_selected, array_keys($avatar_list)) ? $avatar_selected : "blank.gif";
$avatar_select->addOptionArray($avatar_list);
$avatar_select->setExtra("onchange='showImgSelected(\"avatar\", \"user_avatar\", \"uploads\", \"\", \"" . XOOPS_URL . "\")'");
$avatar_tray = new XoopsFormElementTray(_US_AVATAR, ' ');
$avatar_tray->addElement($avatar_select);
$avatar_tray->addElement(new XoopsFormLabel('', "<a href=\"javascript:openWithSelfMain('" . XOOPS_URL . "/misc.php?action=showpopups&type=avatars','avatars',600,400);\">" . _LIST . "</a><br />"));
$avatar_tray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_UPLOAD_URL . "/" . $avatar_selected . "' name='avatar' id='avatar' alt='' />"));
$form2->addElement($avatar_tray);
$form2->addElement(new XoopsFormHidden('uid', $GLOBALS['xoopsUser']->getVar('uid')));
$form2->addElement(new XoopsFormHidden('op', 'avatarchoose'));
$form2->addElement(new XoopsFormButton('', 'submit2', _SUBMIT, 'submit'));
$form2->assign($GLOBALS['xoopsTpl']);
}
if ($op == 'avatarupload') {
if (!$GLOBALS['xoopsSecurity']->check()) {
redirect_header('index.php', 3, _US_NOEDITRIGHT . "<br />" . implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
exit;
}
$xoops_upload_file = array();
$uid = 0;
if (!empty($_POST['xoops_upload_file']) && is_array($_POST['xoops_upload_file'])) {
$xoops_upload_file = $_POST['xoops_upload_file'];
}
if (!empty($_POST['uid'])) {
$uid = intval($_POST['uid']);
}
if (empty($uid) || $GLOBALS['xoopsUser']->getVar('uid') != $uid) {
示例8: XoopsFormRadioYN
}
$status_select = new XoopsFormRadioYN(_MD_SSECTION_FILE_STATUS, 'file_status', _SSECTION_STATUS_FILE_ACTIVE);
$status_select->setDescription(_MD_SSECTION_FILE_STATUS_DSC);
$files_form->addElement($status_select);
$files_button_tray = new XoopsFormElementTray('', '');
$files_hidden = new XoopsFormHidden('op', 'uploadfile');
$files_button_tray->addElement($files_hidden);
if ($fileid == 0) {
$files_butt_create = new XoopsFormButton('', '', _MD_SSECTION_UPLOAD, 'submit');
$files_butt_create->setExtra('onclick="this.form.elements.op.value=\'uploadfile\'"');
$files_button_tray->addElement($files_butt_create);
$files_butt_another = new XoopsFormButton('', '', _MD_SSECTION_FILE_UPLOAD_ANOTHER, 'submit');
$files_butt_another->setExtra('onclick="this.form.elements.op.value=\'uploadanother\'"');
$files_button_tray->addElement($files_butt_another);
} else {
$files_butt_create = new XoopsFormButton('', '', _MD_SSECTION_MODIFY, 'submit');
$files_butt_create->setExtra('onclick="this.form.elements.op.value=\'modify\'"');
$files_button_tray->addElement($files_butt_create);
}
$files_butt_clear = new XoopsFormButton('', '', _MD_SSECTION_CLEAR, 'reset');
$files_button_tray->addElement($files_butt_clear);
$butt_cancel = new XoopsFormButton('', '', _MD_SSECTION_CANCEL, 'button');
$butt_cancel->setExtra('onclick="history.go(-1)"');
$files_button_tray->addElement($butt_cancel);
$files_form->addElement($files_button_tray);
// fileid
$files_form->addElement(new XoopsFormHidden('fileid', $fileid));
// itemid
$files_form->addElement(new XoopsFormHidden('itemid', $itemid));
$files_form->assign($xoopsTpl);
示例9: XoopsFormText
$subject_text->setExtra($styleWidth);
}
$to_text = new XoopsFormText(_MI_TAF_FORMTHTO, "usersTo", 40, 100, '');
$to_text->setExtra($styleWidth);
$body_label = new XoopsFormLabel(_MI_TAF_FORMTHBODY, nl2br($comment4show));
$body_label->setExtra($styleWidth);
$body_hidden = new XoopsFormHidden("usersComments", $comment4show);
$comment_textarea = new XoopsFormTextArea(_MI_TAF_FORMTHBODY, "usersComments", $comment4show, 10, 40);
$comment_textarea->setExtra($styleWidth);
$ticket_hidden = $xoopsGTicket->getTicketXoopsForm(__LINE__);
$submit_button = new XoopsFormButton("", "submit", _MI_TAF_BUTTONSEND, "submit");
$contact_form = new XoopsThemeForm(_MI_TAF_FORMTITLE, "tf_form", "index.php");
$contact_form->addElement($to_text, true);
if (!is_object($xoopsUser)) {
$contact_form->addElement($fromname_text, true);
$contact_form->addElement($fromemail_text, true);
}
$contact_form->addElement($subject_text);
if ($xoopsModuleConfig['can_bodyedit']) {
$contact_form->addElement($comment_textarea, true);
} else {
$contact_form->addElement($body_label);
$contact_form->addElement($body_hidden);
}
$contact_form->addElement($ticket_hidden);
$contact_form->addElement($submit_button);
$contact_form->assign($xoopsTpl);
include XOOPS_ROOT_PATH . "/footer.php";
?>
示例10: while
// Make number options
$i = 1;
while ($i <= $xoopsModuleConfig['max_items']) {
$options[$i] = $i;
if ($i == 1) {
$i = 5;
} else {
$i = $i + 5;
}
}
$storynum_select = new XoopsFormSelect('', 'storynum', $xoopsOption['storynum']);
$storynum_select->addOptionArray($options);
$submit_btn = new XoopsFormButton('', 'submit', _GO, 'submit');
$topic_form->addElement($storynum_select);
$topic_form->addElement($submit_btn);
$topic_form->assign($xoopsTpl);
} else {
$xoopsTpl->assign('displaynav', false);
}
if ($showclassic) {
$ihome = $xoopsOption['storytopic'] > 0 ? 1 : 0;
$sarray = AmsStory::getAllPublished($xoopsOption['storynum'], $start, $xoopsModuleConfig['restrictindex'], $xoopsOption['storytopic'], $ihome);
$scount = count($sarray);
$xoopsTpl->assign('story_count', $scount);
if ($scount > 0) {
$uids = array();
foreach ($sarray as $storyid => $thisstory) {
$uids[$thisstory->uid()] = $thisstory->uid();
}
$member_handler =& xoops_gethandler('member');
$user_arr = $member_handler->getUsers(new Criteria('uid', "(" . implode(',', array_keys($uids)) . ")", 'IN'), true);
示例11: renderFormSubmit
/**
* Render a form to send videos
*
* @param int $maxbytes the maximum size of a picture
* @param object $xoopsTpl the one in which the form will be rendered
* @return bool TRUE
*
* obs: Some functions wont work on php 4 so edit lines down under acording to your version
*/
function renderFormSubmit($xoopsTpl)
{
$form = new XoopsThemeForm(_MD_YOGURT_ADDFAVORITEVIDEOS, "form_videos", "video_submited.php", "post", true);
$field_code = new XoopsFormText(_MD_YOGURT_YOUTUBECODE, "codigo", 50, 250);
$field_desc = new XoopsFormTextArea(_MD_YOGURT_CAPTION, "caption");
$form->setExtra('enctype="multipart/form-data"');
$button_send = new XoopsFormButton("", "submit_button", _MD_YOGURT_ADDVIDEO, "submit");
$form->addElement($field_warning);
$form->addElement($field_code, true);
$form->addElement($field_desc);
$form->addElement($button_send);
if (str_replace('.', '', PHP_VERSION) > 499) {
$form->assign($xoopsTpl);
//If your server is php 5
//$form->display();
} else {
$form->display();
//If your server is php 4.4
}
return true;
}