当前位置: 首页>>代码示例>>PHP>>正文


PHP XoopsFormSelect::setValue方法代码示例

本文整理汇总了PHP中XoopsFormSelect::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsFormSelect::setValue方法的具体用法?PHP XoopsFormSelect::setValue怎么用?PHP XoopsFormSelect::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XoopsFormSelect的用法示例。


在下文中一共展示了XoopsFormSelect::setValue方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setup_package

function setup_package($dirname)
{
    $pkgs = new PackageList();
    $pkgs->load();
    $pkg = $pkgs->getVar($dirname);
    if (empty($pkg)) {
        $pkg = $pkgs->selectPackage($dirname);
    }
    $pname = $pkg ? $pkg['pname'] : _AM_PKG_NOCURRENT;
    // current package-name
    if ($dirname) {
        $modversion = get_modversion($dirname);
        if (empty($modversion)) {
            return;
        }
        // illigal dirname?
        $title = $modversion['name'] . " ({$dirname})";
    } else {
        $title = XOOPS_VERSION;
    }
    echo "<h1>" . htmlspecialchars($title) . "</h1>\n";
    echo "<table class='outer' border='0' cellspacing='1'>\n";
    $n = 0;
    $form = new XoopsThemeForm(_AM_REG_DETAIL, "CustomForm", 'pkgadmin.php');
    $form->addElement(new XoopsFormHidden('dirname', $dirname));
    $form->addElement(new XoopsFormLabel(_AM_PKG_NAME, $pkg['name']));
    $form->addElement(new XoopsFormLabel(_AM_PKG_DIRNAME, $dirname));
    $form->addElement(new XoopsFormLabel(_AM_PKG_CURRENT_PNAME, $pname));
    $select = new XoopsFormSelect(_AM_PKG_PNAME, 'pname');
    foreach ($pkgs->getAllPackages() as $pn => $apkg) {
        $select->addOption($pn);
    }
    $select->setValue($pname);
    $form->addElement($select);
    $form->addElement(new XoopsFormButton("", "custom", _AM_REG_SUBMIT, "submit"));
    echo $form->render();
}
开发者ID:nbuy,项目名称:xoops-modules-update,代码行数:37,代码来源:pkgadmin.php

示例2: XoopsFormTextDateSelect

 $form->addElement(new XoopsFormTextDateSelect(_AM_VEHICULE_DATE_MEC, 'date_mec', 15, strtotime($date_mec)));
 $form->addElement(new XoopsFormText(_AM_VEHICULE_KILOMETRAGE, 'kilometrage', 50, 255, $kilometrage));
 $form->insertBreak('<h3><center>' . _AM_VEHICULE_TECHINFO . '</center></h3>', 'head');
 $ct = new XoopsFormElementTray(_AM_VEHICULE_CT);
 $ct->addElement(new XoopsFormTextDateSelect(_AM_VEHICULE_DERNIER_CT, 'dernier_ct', 15, strtotime($dernier_ct)));
 $ct->addElement(new XoopsFormTextDateSelect(_AM_VEHICULE_PROCHAIN_CT, 'prochain_ct', 15, strtotime($prochain_ct)));
 $form->addElement($ct);
 $info = new XoopsFormElementTray(' ');
 $req4 = $xoopsDB->query("SELECT id, nom FROM " . $xoopsDB->prefix("garage_marque") . " order by nom");
 $marques[0] = '---NA---';
 while (($row = $xoopsDB->fetchArray($req4)) != false) {
     $marques[$row['id']] = $row['nom'];
 }
 $marq = new XoopsFormSelect(_AM_VEHICULE_MARQUE, 'id_marque', null, 1, false);
 $marq->addOptionArray($marques);
 $marq->setValue($id_marque);
 $info->addElement($marq);
 $info->addElement(new XoopsFormText(_AM_VEHICULE_GAMME, 'gamme', 20, 25, $gamme));
 $info->addElement(new XoopsFormText(_AM_VEHICULE_MODELE_VERSION, 'modele_version', 20, 25, $modele_version));
 $form->addElement($info);
 $infocg = new XoopsFormElementTray(' ');
 $ene = new XoopsFormSelect(_AM_VEHICULE_ENERGIE, 'energie', $energie);
 $ene->addOption(_AM_VEHICULE_ENERGIE_ES, _AM_VEHICULE_ENERGIE_ES);
 $ene->addOption(_AM_VEHICULE_ENERGIE_GO, _AM_VEHICULE_ENERGIE_GO);
 $ene->addOption(_AM_VEHICULE_ENERGIE_GPL, _AM_VEHICULE_ENERGIE_GPL);
 $ene->addOption(_AM_VEHICULE_ENERGIE_ELEC, _AM_VEHICULE_ENERGIE_ELEC);
 $infocg->addElement($ene);
 $infocg->addElement(new XoopsFormText(_AM_VEHICULE_GENRE, 'genre', 20, 25, $genre));
 $infocg->addElement(new XoopsFormText(_AM_VEHICULE_VIN, 'vin', 25, 50, $vin));
 $form->addElement($infocg);
 $form->addElement(new XoopsformTextDateSelect(_AM_VEHICULE_DATE_CG, 'date_cg', 15, strtotime($date_cg)));
开发者ID:XoopsModules25x,项目名称:repairshop,代码行数:31,代码来源:vehicule.php

示例3: 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);
//.........这里部分代码省略.........
开发者ID:trabisdementia,项目名称:xuups,代码行数:101,代码来源:index.php

示例4: addOwnershipList

function addOwnershipList($form, $groups, $member_handler, $gperm_handler, $fid, $mid, $entry_id = "")
{
    global $xoopsDB;
    $add_groups = $gperm_handler->getGroupIds("add_own_entry", $fid, $mid);
    // May 5, 2006 -- limit to the user's own groups unless the user has global scope
    if (!($globalscope = $gperm_handler->checkRight("view_globalscope", $fid, $groups, $mid))) {
        $add_groups = array_intersect($add_groups, $groups);
    }
    $all_add_users = array();
    foreach ($add_groups as $grp) {
        $add_users = $member_handler->getUsersByGroup($grp);
        $all_add_users = array_merge((array) $add_users, $all_add_users);
        unset($add_users);
    }
    $unique_users = array_unique($all_add_users);
    $punames = array();
    foreach ($unique_users as $uid) {
        $uqueryforrealnames = "SELECT name, uname FROM " . $xoopsDB->prefix("users") . " WHERE uid={$uid}";
        $uresqforrealnames = $xoopsDB->query($uqueryforrealnames);
        $urowqforrealnames = $xoopsDB->fetchRow($uresqforrealnames);
        $punames[] = $urowqforrealnames[0] ? $urowqforrealnames[0] : $urowqforrealnames[1];
        // use the uname if there is no full name
    }
    // alphabetize the proxy list added 11/2/04
    array_multisort($punames, $unique_users);
    if ($entry_id) {
        include_once XOOPS_ROOT_PATH . "/modules/formulize/class/data.php";
        $data_handler = new formulizeDataHandler($fid);
        $entryMeta = $data_handler->getEntryMeta($entry_id);
        $entryOwner = $entryMeta[2];
        $entryOwnerName = $punames[array_search($entryOwner, $unique_users)];
        // need to look in one array to find the key to lookup in the other array...a legacy from when corresponding arrays were a common data structure in Formulize...multidimensional arrays were not well understood in the beginning
        $proxylist = new XoopsFormSelect(_AM_SELECT_UPDATE_OWNER, 'updateowner_' . $fid . '_' . $entry_id, 0, 1);
        $proxylist->addOption('nochange', _AM_SELECT_UPDATE_NOCHANGE . $entryOwnerName);
    } else {
        $proxylist = new XoopsFormSelect(_AM_SELECT_PROXY, 'proxyuser', 0, 5, TRUE);
        // made multi May 3 05
        $proxylist->addOption('noproxy', _formulize_PICKAPROXY);
    }
    for ($i = 0; $i < count($unique_users); $i++) {
        if ($unique_users[$i]) {
            $proxylist->addOption($unique_users[$i], $punames[$i]);
        }
    }
    if (!$entry_id) {
        $proxylist->setValue('noproxy');
    } else {
        $proxylist->setValue('nochange');
    }
    $proxylist->setClass("no-print");
    $form->addElement($proxylist);
    return $form;
}
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:53,代码来源:formdisplay.php

示例5: XoopsFormText

 $pce->addElement($pcec);
 $pce->addElement(new XoopsFormText('&nbsp;&nbsp;&nbsp;' . _AM_PCE_QTE, 'quantite', 3, 5, $quantite));
 $pce->addElement(new XoopsFormText('&nbsp;&nbsp;&nbsp;' . _AM_PCE_PXE, 'tarif_client', 10, 10, $tarif_client));
 $form->addElement($pce);
 $req4 = $xoopsDB->query("SELECT id, nom  FROM " . $xoopsDB->prefix("garage_fournisseur") . " order by nom");
 while (($row = $xoopsDB->fetchArray($req4)) != false) {
     $fournisseurs[$row['id']] = $row['nom'];
 }
 // Piece hors magasin
 $npce++;
 if ($quantite1 == 0) {
     $quantite1 = 1;
 }
 $fourn = new XoopsFormSelect('', 'id_fournisseur');
 $fourn->addOptionArray($fournisseurs);
 $fourn->setValue($id_fournisseur);
 $pcel = new XoopsFormElementTray('&nbsp;&nbsp;' . _AM_PCE_FSEUR);
 $pcel->addElement($fourn);
 $pcel->addElement(new XoopsFormText(_AM_PCE_DESIG, 'designation', 40, 50));
 $pcel->addElement(new XoopsFormText('&nbsp;&nbsp;&nbsp;' . _AM_PCE_QTE, 'quantite1', 3, 5, $quantite1));
 $pcel->addElement(new XoopsFormText('&nbsp;&nbsp;&nbsp;' . _AM_PCE_PX, 'tarif_client1', 10, 10));
 $form->addElement($pcel);
 $forfait = "<table border=1>";
 $forfait .= "<tr><th align=left>" . _AM_PCE_DESIG . "</th>";
 $forfait .= "<th align=center width=100px>" . _AM_PCE_QTE . "</th>";
 $forfait .= "<th align=center width=100px>" . _AM_PCE_PX . "</th>";
 $forfait .= "<th align=center width=100px>" . _AM_ACTION . "</th></tr>";
 //liste des forfaits deja affectés
 $reqf = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("garage_inter_forfait") . " WHERE id_inter=" . $id_inter);
 while ((list($idkey, $idinter, $id_forfait, $designation_ff, $ref_fournisseur, $quantite_ff, $tarif_client) = $xoopsDB->fetchRow($reqf)) != false) {
     $nbf = 1;
开发者ID:XoopsModules25x,项目名称:repairshop,代码行数:31,代码来源:inter_pces.php

示例6: while

    while (($row = $xoopsDB->fetchArray($req4)) != false) {
        $marques[$row['id']] = $row['nom'];
    }
    $marq = new XoopsFormSelect(_MD_VEHICULE_MARQUE, 'id_marque', null, 1, false);
    $marq->addOptionArray($marques);
    $info->addElement($marq);
    $info->addElement(new XoopsFormText(_MD_VEHICULE_GAMME, 'gamme', 20, 25));
    $info->addElement(new XoopsFormText(_MD_VEHICULE_MODELE_VERSION, 'modele_version', 20, 25));
    $form->addElement($info);
    $nref1 = new XoopsFormElementTray(_MD_CLIENT);
    $req4 = $xoopsDB->query("SELECT id, nom, prenom, cp FROM " . $xoopsDB->prefix("garage_clients") . " order by nom");
    while (($row = $xoopsDB->fetchArray($req4)) != false) {
        $clients[$row['id']] = $row['nom'] . ' - ' . $row['prenom'] . ' - ' . $row['cp'];
    }
    $cli = new XoopsFormSelect('', 'id_proprietaire', null, 1, false);
    $cli->addOptionArray($clients);
    $cli->setValue($id_proprietaire);
    $nref1->addElement($cli);
    $form->addElement($nref1);
    $nref = new XoopsFormElementTray(_MD_NEW_CLIENT);
    $nref->addElement(new XoopsFormText(_MD_NEW_CLIENT_NAME, 'new_proprietaire', 25, 255));
    $nref->addElement(new XoopsFormText(_MD_NEW_CLIENT_RS, 'new_proprietaire_rs', 25, 255));
    $form->addElement($nref);
    $form->addElement(new XoopsFormText(_MD_INTER_KM, 'kilometrage', 10, 15));
    $form->addElement(new XoopsFormTextArea(_MD_INTER_TAF, 'description', '', 5, 80));
    $form->addElement(new XoopsFormTextDateSelect(_MD_INTER_RECEP, 'date_debut', 15, date("d-m-Y")));
    $form->addElement(new XoopsFormTextDateSelect(_MD_INTER_DELAI, 'delai', 15, date("d-m-Y")));
    $form->addElement(new XoopsFormButton('', 'submit', _MD_CREATE, 'submit'));
    $form->display();
}
include_once XOOPS_ROOT_PATH . '/footer.php';
开发者ID:XoopsModules25x,项目名称:repairshop,代码行数:31,代码来源:intervention.php

示例7: XoopsThemeForm

}
switch ($op) {
    case "fields":
        if (!$tbl_id) {
            $tbl_id = 1;
        }
        $sql = "SELECT * FROM " . $xoopsDB->prefix('curl_tables') . " where view = '0'";
        $ret = $xoopsDB->queryF($sql);
        $form_sel = new XoopsThemeForm(_XC_SELECTTABLE, "seltable", $_SERVER['PHP_SELF'] . "");
        $form_sel->setExtra("enctype='multipart/form-data'");
        $table_sel = new XoopsFormSelect(_XC_SELECTTABLE . ':', 'select');
        $table_sel->setExtra('onchange="window.location=\'\'+this.options[this.selectedIndex].value"');
        while ($row = $xoopsDB->fetchArray($ret)) {
            $table_sel->addOption("index.php?op=fields&tbl_id=" . $row['tbl_id'], $row['tablename']);
            if ($tbl_id == $row['tbl_id']) {
                $table_sel->setValue("index.php?op=fields&tbl_id=" . $row['tbl_id']);
            }
        }
        $form_sel->addElement($table_sel);
        $sql = "SHOW FIELDS FROM " . $xoopsDB->prefix(get_tablename($tbl_id));
        $ret = $xoopsDB->queryF($sql);
        $form_fld = new XoopsThemeForm(_XC_FIELDOPTIONSFOR . ' ' . get_tablename($tbl_id), "fields", $_SERVER['PHP_SELF'] . "");
        $form_fld->setExtra("enctype='multipart/form-data'");
        $field = 0;
        $tbldat = get_tableconfig(get_tablename($tbl_id));
        $ele_tray = array();
        while (list($fieldname, $type, $null, $keytype, $tmp, $tmp) = $xoopsDB->fetchRow($ret)) {
            $field++;
            $int = 0;
            $string = 0;
            $float = 0;
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:31,代码来源:index.php

示例8: XoopsThemeForm

     echo '<td class="odd" ALIGN="left">' . $ref . '</td>';
     echo '<td class="odd" ALIGN="left">' . $designation . '</td>';
     echo '<td class="odd" ALIGN="left">' . $nom_fournisseur . '</td>';
     echo '<td class="odd" align="center"><A HREF="piece.php?op=modifpieces&id=' . $id . '"><img src="../images/modif.png"></a></td>';
     echo '<td class="odd" align="center"><A HREF="piece.php?op=suprpieces&id=' . $id . '"><img src="../images/sup.png"></a></td>';
 }
 echo '</tr></table><br /></div>';
 // Formulaire de creation
 $form = new XoopsThemeForm(_AM_PIECES_CREATION, 'cpieces', 'piece.php?op=creatpieces', 'post');
 $reqcat = $xoopsDB->query("SELECT id, nom FROM " . $xoopsDB->prefix("garage_cat_piece") . " order by nom");
 while (($row = $xoopsDB->fetchArray($reqcat)) != false) {
     $categories[$row['id']] = $row['nom'];
 }
 $cat = new XoopsFormSelect(_AM_VEHICULE_CAT_PIECE, 'id_cat_piece', null, 5, false);
 $cat->addOptionArray($categories);
 $cat->setValue($id_cat_piece);
 $form->addElement($cat);
 $form->addElement(new XoopsFormText(_AM_PIECES_REF, 'ref', 50, 255, ''));
 $form->addElement(new XoopsFormText(_AM_PIECES_DESIGNATION, 'designation', 50, 255, ''));
 $req4 = $xoopsDB->query("SELECT id, nom  FROM " . $xoopsDB->prefix("garage_fournisseur") . " order by nom");
 while (($row = $xoopsDB->fetchArray($req4)) != false) {
     $fournisseurs[$row['id']] = $row['nom'];
 }
 $four = new XoopsFormSelect(_AM_FSEUR, 'id_fournisseur', null, 5, false);
 $four->addOptionArray($fournisseurs);
 $form->addElement($four);
 //	$form -> addElement(new XoopsFormText(_AM_PIECES_FOURNISSEUR,'id_fournisseur',50,255, ''));
 $form->addElement(new XoopsFormText(_AM_PIECES_REF_FOURNISSEUR, 'ref_fournisseur', 50, 255, ''));
 $form->addElement(new XoopsFormText(_AM_PIECES_TARIF_HA, 'tarif_ha', 25, 25, ''));
 $form->addElement(new XoopsFormText(_AM_PIECES_TARIF_CLIENT, 'tarif_client', 25, 25, ''));
 $form->addElement(new XoopsFormButton('', 'submit', _AM_CREATING, 'submit'));
开发者ID:XoopsModules25x,项目名称:repairshop,代码行数:31,代码来源:piece.php

示例9: createFieldList

function createFieldList($val, $textbox = false, $limitToForm = false, $name = "", $firstValue = "", $multi_select = false)
{
    global $xoopsDB;
    array($formids);
    array($formnames);
    array($totalcaptionlist);
    array($totalvaluelist);
    $captionlistindex = 0;
    if ($limitToForm) {
        $limitToForm = " WHERE id_form = " . intval($limitToForm);
    } else {
        $limitToForm = "";
    }
    if (!$name) {
        $name = 'formlink';
    }
    $formlist = "SELECT id_form, desc_form FROM " . $xoopsDB->prefix("formulize_id") . " {$limitToForm} ORDER BY desc_form";
    $resformlist = $xoopsDB->query($formlist);
    if ($resformlist) {
        // loop through each form
        while ($rowformlist = $xoopsDB->fetchRow($resformlist)) {
            $fieldnames = "SELECT ele_caption, ele_id, ele_handle FROM " . $xoopsDB->prefix("formulize") . " WHERE id_form={$rowformlist['0']} ORDER BY ele_order";
            $resfieldnames = $xoopsDB->query($fieldnames);
            // loop through each caption in the current form
            while ($rowfieldnames = $xoopsDB->fetchRow($resfieldnames)) {
                // write formname: caption to the master array that will be passed to the select box.
                $totalcaptionlist[$captionlistindex] = printSmart(trans($rowformlist[1])) . ": " . printSmart(trans($rowfieldnames[0]), 50);
                $totalvaluelist[$captionlistindex] = $rowfieldnames[1];
                // if this is the selected entry
                if ($val == $totalvaluelist[$captionlistindex] or $val == $rowformlist[0] . "#*=:*" . $rowfieldnames[2]) {
                    $defaultlinkselection = $captionlistindex;
                }
                $captionlistindex++;
            }
        }
    }
    if ($textbox) {
        $am_ele_formlink = _AM_ELE_FORMLINK_TEXTBOX;
        $am_formlink_none = _AM_FORMLINK_NONE_TEXTBOX;
        $am_ele_formlink_desc = _AM_ELE_FORMLINK_DESC_TEXTBOX;
    } else {
        $am_ele_formlink = _AM_ELE_FORMLINK;
        $am_formlink_none = _AM_FORMLINK_NONE;
        $am_ele_formlink_desc = _AM_ELE_FORMLINK_DESC;
    }
    if ($firstValue) {
        // let a passed in value override the defaults
        $am_formlink_none = $firstValue;
    }
    // make the select box and add all the options
    $formlink = new XoopsFormSelect($am_ele_formlink, $name, '', $multi_select ? 8 : 1, $multi_select);
    $formlink->addOption("none", $am_formlink_none);
    for ($i = 0; $i < $captionlistindex; $i++) {
        $formlink->addOption($totalvaluelist[$i], htmlspecialchars(strip_tags($totalcaptionlist[$i])));
    }
    if (isset($defaultlinkselection)) {
        $formlink->setValue($totalvaluelist[$defaultlinkselection]);
    }
    $formlink->setDescription($am_ele_formlink_desc);
    if (!$textbox) {
        // return two pieces of info for selectboxes, since we need to know the element selected
        $to_return = array();
        $to_return[] = $formlink;
        $to_return[] = isset($defaultlinkselection) ? $totalvaluelist[$defaultlinkselection] : "";
        return $to_return;
    } else {
        return $formlink;
    }
}
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:69,代码来源:functions.php

示例10: contents_list

function contents_list()
{
    global $xoopsDB, $xoopsModuleConfig, $keywords, $status_sel;
    $res = $xoopsDB->query("SELECT count(mid) FROM " . MAIN);
    list($n) = $xoopsDB->fetchRow($res);
    $start = isset($_GET['start']) ? intval($_GET['start']) : 0;
    $max = $xoopsModuleConfig['max_rows'];
    $nav = new XoopsPageNav($n, $max, $start, "start", "op=list");
    echo "<style>\n.wait td { background-color: #fdd; padding: 5px; }\n.del td { background-color: #ccf; padding: 5px; }\n</style>\n";
    echo "<table width='100%'>\n";
    echo "<tr><td>" . _AM_COUNT . ' ' . $n . "</td><td>";
    if ($n > $max) {
        echo _AM_PAGE . ' ' . $nav->renderNav();
    }
    echo "</td><td align='center'><a href='../entry.php'>" . _AM_CONTENTS_NEW . "</a></td><td align='right'>[<a href='summary.php?export=csv&type=c'>" . _AM_EXPORT_FILE . "</a>]</td></tr>\n";
    echo "</table>\n";
    echo "<form method='POST'>\n";
    echo "<table cellspacing='1' padding='5' class='outer'>\n";
    $header = array('', _AM_TITLE, _AM_MTIME, _AM_POSTER, _AM_HITS, _AM_STATUS, _AM_SORT_ORDER, _AM_OPERATION);
    echo "<tr><th>" . join("</th><th>", $header) . "</th></tr>\n";
    $res = $xoopsDB->query("SELECT * FROM " . MAIN . " ORDER BY status,mtime DESC", $max, $start);
    $wn = $n = 0;
    while ($data = $xoopsDB->fetchArray($res)) {
        $mid = $data['mid'];
        $uid = $data['poster'];
        $poster = "<a href='" . XOOPS_URL . "/userinfo.php?uid={$uid}'>" . XoopsUser::getUnameFromId($uid) . "</a>";
        $w = $data['weight'];
        $weight = "<input size='2' name='weight[{$mid}]' value='{$w}'/>" . "<input type='hidden' name='prev[{$mid}]' value='{$w}'/>";
        $op = "<a href='../entry.php?mid={$mid}'>" . _EDIT . "</a>";
        $status = $data['status'];
        $ck = '';
        switch ($status) {
            case 'W':
                $bg = 'wait';
                $wn++;
                $ck = ' checked';
                break;
            case 'X':
                $bg = 'del';
                break;
            case 'N':
                $bg = $n++ % 2 ? 'even' : 'odd';
                break;
        }
        $check = "<input type='checkbox' name='check[{$mid}]' value='{$mid}'{$ck}/>";
        if (isset($status_sel[$status])) {
            $status = $status_sel[$status];
        }
        echo "<tr class='{$bg}'><td align='center'>{$check}</td>" . "<td><a href='../detail.php?mid={$mid}'>" . htmlspecialchars($data['title']) . "</a></td><td>" . formatTimestamp($data['mtime'], 'm') . "</td><td>" . "{$poster}</td><td align='right'>" . $data['hits'] . "</td><td align='center'>{$status}</td>" . "<td>{$weight}</td><td>{$op}</td></tr>";
    }
    echo "</table>\n";
    $op = new XoopsFormSelect('', 'op');
    $op->addOption('none', '--');
    if ($wn) {
        $op->addOption('conf', _AM_OP_CONF);
        $op->setValue('conf');
    }
    $op->addOption('hide', _AM_OP_HIDE);
    $op->addOption('del', _AM_OP_DEL);
    echo "<div>" . $op->render();
    echo " &nbsp; <input type='submit' value='" . _SUBMIT . "'/></div>\n";
    echo "</form>\n";
}
开发者ID:nbuy,项目名称:xoops-modules-medialinks,代码行数:63,代码来源:contents.php


注:本文中的XoopsFormSelect::setValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。