本文整理汇总了PHP中XoopsFormCheckBox::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsFormCheckBox::setValue方法的具体用法?PHP XoopsFormCheckBox::setValue怎么用?PHP XoopsFormCheckBox::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsFormCheckBox
的用法示例。
在下文中一共展示了XoopsFormCheckBox::setValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: XoopsFormRadioYN
//$criteria->setSort ('uname');
//$criteria->setOrder ('ASC');
$user_select->addOptionArray($member_handler->getUserList());
$form->addElement($user_select);
// Q&As can be commented?
$form->addElement(new XoopsFormRadioYN(_AM_SF_IMPORT_ALLOWCOMMENTS, 'cancomment', 1, ' ' . _AM_SF_YES . '', ' ' . _AM_SF_NO . ''));
$group_list =& $member_handler->getGroupList();
$groups_selected = array();
$groups_checkbox = new XoopsFormCheckBox(_AM_SF_IMPORT_PERMISSIONS, 'groups_read');
foreach ($group_list as $group_id => $group_name) {
if ($group_id != XOOPS_GROUP_ADMIN) {
$groups_selected[] = $group_id;
$groups_checkbox->addOption($group_id, $group_name);
}
}
$groups_checkbox->setValue($groups_selected);
$form->addElement($groups_checkbox);
$form->addElement(new XoopsFormHidden('op', 'go'));
$form->addElement(new XoopsFormButton('', 'import', _AM_SF_IMPORT, 'submit'));
$form->display();
}
}
exit;
}
if ($op == 'go') {
$import_category = isset($_POST['import_category']) ? $_POST['import_category'] : null;
if (!$import_category) {
redirect_header($scriptname, 2, _AM_SF_NOCATSELECTED);
exit;
}
include_once "admin_header.php";
示例2: drawContactForm
function drawContactForm($cc)
{
global $xoopsConfig, $xoopsOption, $xoopsTpl, $xoopsUser, $xoopsUserIsAdmin, $xoopsLogger;
$contactclass = $cc;
$xoopsOption['template_main'] = 'contact_contactusform.html';
include XOOPS_ROOT_PATH . "/header.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
// build contact form
$contact_form = new XoopsThemeForm($contactclass->getContactHead(), "contactform", "index.php", "post", true);
// check for pre-existing error condition
if ($contactclass->getErrorLevel() != 0) {
$err = $contactclass->getErrorLevel();
$message = _CT_ERROR_CONDITION;
if ($err & _CT_ERROR_BADSECVAL) {
$message .= _CT_ERROR_BADSECVALUE_MSG;
}
if ($err & _CT_ERROR_BADEMAIL) {
$message .= _CT_ERROR_BADEMAIL_MSG;
}
$error_text = new XoopsFormLabel(_CT_ERROR_CONDITIONHEAD, $message);
$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);
//.........这里部分代码省略.........
示例3: XoopsThemeQueryForm
function XoopsThemeQueryForm($title, $name, $action, $method = "post", $nome_pesquisa, $campos, $count = 3, $campos2 = "", $count2 = false)
{
$this->XoopsForm($title, $name, $action, $method);
if (!$campos2) {
$campos2 = $campos;
}
if ($count2 === false) {
$count2 = $count;
}
$this->addElement(new XoopsFormLabel("Pesquisa:"));
for ($i = 0; $i < $count; $i++) {
$buscaRow = new XoopsFormElementTray("   {$i} -->");
$checkbox = new XoopsFormCheckBox("", "where[{$i}][ativa]", "true");
$checkbox->addOption("Ativar");
if ($i == 0) {
$checkbox->setValue("Ativar");
}
$buscaRow->addElementNotRef($checkbox);
$campo = new XoopsFormSelect("", "where[{$i}][campo]", "url");
foreach ($campos as $key => $value) {
$campo->addOption($value);
}
$buscaRow->addElementNotRef($campo);
$buscaRow->addElementNotRef(new XoopsFormSelectSqlMatch("", "where[{$i}][tipo]"));
$buscaRow->addElementNotRef(new XoopsFormText("", "where[{$i}][pesquisa]", 20, 100));
$buscaRow->addElementNotRef(new XoopsFormSelectSqlAnd("", "where[{$i}][and]"));
$this->addElementNotRef($buscaRow);
}
if ($count2 > 0) {
$this->addElement(new XoopsFormLabel("Ordenação:"));
for ($i = 0; $i < $count2; $i++) {
$ordemRow = new XoopsFormElementTray("   {$i} -->");
$checkbox2 = new XoopsFormCheckBox("", "order[{$i}][ativa]", "true");
$checkbox2->addOption("Ativar");
if ($i == 0) {
$checkbox2->setValue("Ativar");
}
$ordemRow->addElementNotRef($checkbox2);
$campo2 = new XoopsFormSelect("", "order[{$i}][campo]", "url");
foreach ($campos2 as $key => $value) {
$campo2->addOption($value);
}
$ordemRow->addElementNotRef($campo2);
$ordemRow->addElementNotRef(new XoopsFormSelectSqlOrder("", "order[{$i}][tipo]"));
$this->addElementNotRef($ordemRow);
}
}
$checkbox3 = new XoopsFormCheckBox("Mostrar lista detalhada", "detalhes", "");
$checkbox3->addOption("Sim", "Sim");
$this->addElement($checkbox3);
$this->addElement(new XoopsFormButton(" ", "pesquisa[{$nome_pesquisa}]", "Pesquisar", "submit", true));
}