コード例 #1
0
 /**
  * created elements
  * @license   http://www.blags.org/
  * @created   :2010年05月21日 20时40分
  * @copyright 1997-2010 The Martin Group
  * @author    Martin <*****@*****.**>
  * */
 public function createElements()
 {
     $Form = new XoopsFormElementTray($this->Formjs() . _AM_MARTIN_SERVICE_TYPE);
     $service_type_name = new XoopsFormText('', 'service_type_name', 50, 255, $this->Obj->service_type_name());
     $service_type_name->setExtra('class="required"');
     $Form->addElement($service_type_name, true);
     $this->addElement($Form, false);
     $this->addElement(new XoopsFormHidden('typeid', $this->Obj->service_type_id()));
 }
コード例 #2
0
ファイル: element.php プロジェクト: LeeGlendenning/formulize
function createDataTypeUI($ele_type, $element, $id_form, $ele_encrypt)
{
    // data type controls ... added May 31 2009, jwe
    // only do it for existing elements where the datatype choice is relevant
    // do not do it for encrypted elements
    $renderedUI = "";
    // check if there's a special class file for this element type, and if so, instantiate an element object of that kind, so we can check if it needs a datatype UI or not
    $customTypeNeedsUI = false;
    if (file_exists(XOOPS_ROOT_PATH . "/modules/formulize/class/" . $ele_type . "Element.php")) {
        $customTypeHandler = xoops_getmodulehandler($ele_type . "Element", 'formulize');
        $customTypeObject = $customTypeHandler->create();
        $customTypeNeedsUI = $customTypeObject->needsDataType;
    }
    if (($ele_type == "text" or $ele_type == "textarea" or $ele_type == "select" or $ele_type == "radio" or $ele_type == "checkbox" or $ele_type == "derived" or $customTypeNeedsUI) and !$ele_encrypt) {
        if ($element) {
            $defaultTypeInformation = $element->getDataTypeInformation();
            $defaultType = $defaultTypeInformation['dataType'];
            $defaultTypeSize = $defaultTypeInformation['dataTypeSize'];
            //print "defaultType: $defaultType<br>";
            //print "defaultTypeSize: $defaultTypeSize<br>";
            $renderedUI .= "<input type='hidden' name='element_default_datatype' value='{$defaultType}'>\n";
            $renderedUI .= "<input type='hidden' name='element_default_datatypesize' value='{$defaultTypeSize}'>\n";
        } else {
            $defaultType = 'text';
            $defaultTypeSize = '';
        }
        // setup the UI for the options...
        $dataTypeTray = new XoopsFormElementTray(_AM_FORM_DATATYPE_CONTROLS, '<br>');
        $dataTypeTray->setDescription(_AM_FORM_DATATYPE_CONTROLS_DESC);
        $textType = new XoopsFormRadio('', 'element_datatype', $defaultType);
        $textDataTypeLabel = (!$element and $ele_type == 'text') ? _AM_FORM_DATATYPE_TEXT_NEWTEXT : _AM_FORM_DATATYPE_TEXT;
        $textType->addOption('text', $textDataTypeLabel);
        $intType = new XoopsFormRadio('', 'element_datatype', $defaultType);
        $intType->addOption('int', _AM_FORM_DATATYPE_INT);
        $decimalType = new XoopsFormRadio('', 'element_datatype', $defaultType);
        $decimalTypeSizeDefault = ($defaultTypeSize and $defaultType == "decimal") ? $defaultTypeSize : 2;
        $decimalTypeSize = new XoopsFormText('', 'element_datatype_decimalsize', 2, 2, $decimalTypeSizeDefault);
        $decimalTypeSize->setExtra(" style=\"width: 2em;\" ");
        // style to force width necessary to compensate for silly forced 60% textbox widths in ICMS admin side
        $decimalType->addOption('decimal', _AM_FORM_DATATYPE_DECIMAL1 . $decimalTypeSize->render() . _AM_FORM_DATATYPE_DECIMAL2);
        $varcharType = new XoopsFormRadio('', 'element_datatype', $defaultType);
        $varcharTypeSizeDefault = ($defaultTypeSize and $defaultType == 'varchar') ? $defaultTypeSize : 255;
        $varcharTypeSize = new XoopsFormText('', 'element_datatype_varcharsize', 3, 3, $varcharTypeSizeDefault);
        $varcharTypeSize->setExtra(" style=\"width: 3em;\" ");
        $varcharType->addOption('varchar', _AM_FORM_DATATYPE_VARCHAR1 . $varcharTypeSize->render() . _AM_FORM_DATATYPE_VARCHAR2);
        $charType = new XoopsFormRadio('', 'element_datatype', $defaultType);
        $charTypeSizeDefault = ($defaultTypeSize and $defaultType == 'char') ? $defaultTypeSize : 255;
        $charTypeSize = new XoopsFormText('', 'element_datatype_charsize', 3, 3, $charTypeSizeDefault);
        $charTypeSize->setExtra(" style=\"width: 3em;\" ");
        $charType->addOption('char', _AM_FORM_DATATYPE_CHAR1 . $charTypeSize->render() . _AM_FORM_DATATYPE_CHAR2);
        if ($defaultType != "text" and $defaultType != "int" and $defaultType != "decimal" and $defaultType != "varchar" and $defaultType != "char") {
            $otherType = new XoopsFormRadio('', 'element_datatype', $defaultType);
            $otherType->addOption($defaultType, _AM_FORM_DATATYPE_OTHER . $defaultType);
            $dataTypeTray->addElement($otherType);
        }
        $dataTypeTray->addElement($textType);
        $dataTypeTray->addElement($intType);
        $dataTypeTray->addElement($decimalType);
        $dataTypeTray->addElement($varcharType);
        $dataTypeTray->addElement($charType);
        $renderedUI .= $dataTypeTray->render();
    }
    return $renderedUI;
}
コード例 #3
0
    $categories =& $category_handler->getTree(0, "moderate", "----");
    $cat_options = array();
    $cat_options[0] = _NONE;
    foreach ($categories as $id => $cat) {
        $cat_options[$id] = $cat["prefix"] . $cat["cat_title"];
    }
    $cat_select = new XoopsFormSelect(art_constant("MD_PARENT_CATEGORY"), "cat_pid", $category_obj->getVar("cat_pid"));
    $cat_select->addOptionArray($cat_options);
    $form_art->addElement($cat_select);
} else {
    $form_art->addElement(new XoopsFormHidden("cat_pid", $category_obj->getVar("cat_pid")));
}
// Order
$order_input = new XoopsFormText(art_constant("MD_ORDER"), "cat_order", 20, 20, $category_obj->getVar("cat_order"));
if (!art_isAdministrator()) {
    $order_input->setExtra("type=\"disabled\"");
}
$form_art->addElement($order_input);
// Template set
$templates =& art_getTemplateList("category");
if (count($templates) > 0) {
    //$template_option_tray = new XoopsFormElementTray(art_constant("MD_TEMPLATE_SELECT"), "<br />");
    $template_select = new XoopsFormSelect(art_constant("MD_TEMPLATE_SELECT"), "cat_template", $category_obj->getVar("cat_template"));
    $template_select->addOptionArray($templates);
    //$template_option_tray->addElement($template_select);
    //$form_art->addElement($template_option_tray);
    $form_art->addElement($template_select);
}
// Image
if (!empty($xoopsModuleConfig["path_image"])) {
    $cat_image = $category_obj->getVar("cat_image");
コード例 #4
0
ファイル: contbox.php プロジェクト: severnaya99/Sg-2010
 $sortname = empty($_REQUEST['sortname']) ? empty($osortname) ? 'msg_time' : $osortname : $_REQUEST['sortname'];
 if (@$_REQUEST['after'] && $_REQUEST['after'] != "YYYY/MM/DD") {
     $catcriteria->add(new Criteria('msg_time', strtotime($_REQUEST['after']), ">"));
     $after = strtotime($_REQUEST['after']);
 } else {
     $after = 0;
 }
 $send = !empty($_GET['send']) ? 1 : 0;
 $start2 = !empty($_GET['start2']) ? intval($_GET['start2']) : 0;
 $xoopsTpl->assign('mp_formulaire', "<form name='read' method='post' action='contbox.php'>");
 $xoopsTpl->assign('mp_input_reply', "<input type='submit' onclick='document.prvmsg.action=\"contbox.php?send=1\"' id='post_messages' name='post_messages' value='" . _MP_SUBMIT . "'>");
 $xoopsTpl->assign('mp_input_del', "<input type='reset' id='reply' value='" . _MP_CLEAR . "'>");
 $form = new XoopsThemeForm(_MP_ADDCONTACT, "read", "contbox.php?send=1");
 //auto proposition de pseudo
 $tosee = new XoopsFormText('', 'inputString', 25, 50, '');
 $tosee->setExtra("onkeyup='lookup(this.value);'");
 $tosee_tray = new XoopsFormElementTray(_MP_SEARCH, '&nbsp;');
 $tosee_tray->addElement($tosee);
 //$tosee_tray->addElement(new XoopsFormLabel('', "<a href='###' onclick='lookupC();' >"._MP_CONTACT."</a>"));
 $tosee_tray->addElement(new XoopsFormLabel('', "<div class='suggestionsBox' id='suggestions' style='display: none;'>\r\n\t\t\t\t<div class='suggestionList' id='autoSuggestionsList'>\r\n\t\t\t\t\t&nbsp;\r\n\t\t\t\t</div><div align='center'><a href='#' onclick='closefill();'>Close</a></div> \r\n\t\t</div> "));
 $form->addElement($tosee_tray);
 //boite d'envoie
 $to_username = new XoopsFormSelect('', 'to_userid', @$_REQUEST['to_userid'], 5, true);
 $to_username->setExtra("style=\"width:170px;\" ");
 $to_username2 = new XoopsFormElementTray(_MP_CTT, '&nbsp;');
 $to_username2->setDescription(sprintf(_MP_UNOTE, $xoopsModuleConfig['senduser']));
 $to_username2->addElement($to_username);
 $to_username2->addElement(new XoopsFormLabel('', "<small><br /><a href='###' onclick='delfill();' >" . _MP_MDEL . "</a> | <a href='###' onclick='delallfill();' >" . _MP_MDELALL . "</a></small>"));
 $form->addElement($to_username2);
 $button_tray = new XoopsFormElementTray('', '');
 $post_button = new XoopsFormButton('', 'post_messages', _MP_SUBMIT, "submit");
コード例 #5
0
ファイル: department.php プロジェクト: trabisdementia/xuups
function editDepartment()
{
    $_xhelpSession = Session::singleton();
    global $imagearray, $xoopsModule, $oAdminButton, $limit, $start, $xoopsModuleConfig;
    $module_id = $xoopsModule->getVar('mid');
    $displayName =& $xoopsModuleConfig['xhelp_displayName'];
    // Determines if username or real name is displayed
    $_xhelpSession->set("xhelp_return_page", substr(strstr($_SERVER['REQUEST_URI'], 'admin/'), 6));
    if (isset($_REQUEST["deptid"])) {
        $deptID = $_REQUEST['deptid'];
    } else {
        redirect_header(XHELP_ADMIN_URL . "/department.php?op=manageDepartments", 3, _AM_XHELP_MSG_NO_DEPTID);
    }
    $hDepartments =& xhelpGetHandler('department');
    $hGroups =& xoops_gethandler('group');
    $hGroupPerm =& xoops_gethandler('groupperm');
    if (isset($_POST['updateDept'])) {
        $groups = isset($_POST['groups']) ? $_POST['groups'] : array();
        $hasErrors = false;
        //Department Name supplied?
        if (trim($_POST['newDept']) == '') {
            $hasErrors = true;
            $errors['newDept'][] = _AM_XHELP_MESSAGE_NO_DEPT;
        } else {
            //Department Name unique?
            $crit = new CriteriaCompo(new Criteria('department', $_POST['newDept']));
            $crit->add(new Criteria('id', $deptID, '!='));
            if ($existingDepts = $hDepartments->getCount($crit)) {
                $hasErrors = true;
                $errors['newDept'][] = _XHELP_MESSAGE_DEPT_EXISTS;
            }
        }
        if ($hasErrors) {
            $session =& Session::singleton();
            //Store existing dept info in session, reload addition page
            $aDept = array();
            $aDept['newDept'] = $_POST['newDept'];
            $aDept['groups'] = $groups;
            $session->set("xhelp_editDepartment_{$deptID}", $aDept);
            $session->set("xhelp_editDepartmentErrors_{$deptID}", $errors);
            header('Location: ' . xhelpMakeURI(XHELP_ADMIN_URL . '/department.php', array('op' => 'editDepartment', 'deptid' => $deptID), false));
            exit;
        }
        $dept =& $hDepartments->get($deptID);
        $oldDept = $dept;
        $groups = $_POST['groups'];
        // Need to remove old group permissions first
        $crit = new CriteriaCompo(new Criteria('gperm_modid', $module_id));
        $crit->add(new Criteria('gperm_itemid', $deptID));
        $crit->add(new Criteria('gperm_name', _XHELP_GROUP_PERM_DEPT));
        $hGroupPerm->deleteAll($crit);
        foreach ($groups as $group) {
            // Add new group permissions
            $hGroupPerm->addRight(_XHELP_GROUP_PERM_DEPT, $deptID, $group, $module_id);
        }
        $dept->setVar('department', $_POST['newDept']);
        if ($hDepartments->insert($dept)) {
            $message = _XHELP_MESSAGE_UPDATE_DEPT;
            // Update default dept
            if (isset($_POST['defaultDept']) && $_POST['defaultDept'] == 1) {
                xhelpSetMeta("default_department", $dept->getVar('id'));
            } else {
                $depts =& $hDepartments->getObjects();
                $aDepts = array();
                foreach ($depts as $dpt) {
                    $aDepts[] = $dpt->getVar('id');
                }
                xhelpSetMeta("default_department", $aDepts[0]);
            }
            // Edit configoption for department
            $hConfigOption =& xoops_gethandler('configoption');
            $crit = new CriteriaCompo(new Criteria('confop_name', $oldDept->getVar('department')));
            $crit->add(new Criteria('confop_value', $oldDept->getVar('id')));
            $confOption =& $hConfigOption->getObjects($crit);
            if (count($confOption) > 0) {
                $confOption[0]->setVar('confop_name', $dept->getVar('department'));
                if (!$hConfigOption->insert($confOption[0])) {
                    redirect_header(XHELP_ADMIN_URL . "/department.php?op=manageDepartments", 3, _AM_XHELP_MSG_UPDATE_CONFIG_ERR);
                }
            }
            _clearEditSessionVars($deptID);
            header("Location: " . XHELP_ADMIN_URL . "/department.php?op=manageDepartments");
        } else {
            $message = _XHELP_MESSAGE_UPDATE_DEPT_ERROR . $dept->getHtmlErrors();
            redirect_header(XHELP_ADMIN_URL . "/department.php?op=manageDepartments", 3, $message);
        }
    } else {
        xoops_cp_header();
        echo $oAdminButton->renderButtons('manDept');
        $dept =& $hDepartments->get($deptID);
        $session =& Session::singleton();
        $sess_dept = $session->get("xhelp_editDepartment_{$deptID}");
        $sess_errors = $session->get("xhelp_editDepartmentErrors_{$deptID}");
        //Display any form errors
        if (!$sess_errors === false) {
            xhelpRenderErrors($sess_errors, xhelpMakeURI(XHELP_ADMIN_URL . '/department.php', array('op' => 'clearEditSession', 'deptid' => $deptID)));
        }
        // Get list of groups with permission
        $crit = new CriteriaCompo(new Criteria('gperm_modid', $module_id));
        $crit->add(new Criteria('gperm_itemid', $deptID));
        $crit->add(new Criteria('gperm_name', _XHELP_GROUP_PERM_DEPT));
        $group_perms =& $hGroupPerm->getObjects($crit);
        $aPerms = array();
        // Put group_perms in usable format
        foreach ($group_perms as $perm) {
            $aPerms[$perm->getVar('gperm_groupid')] = $perm->getVar('gperm_groupid');
        }
        if (!$sess_dept === false) {
            $fld_newDept = $sess_dept['newDept'];
            $fld_groups = $sess_dept['groups'];
        } else {
            $fld_newDept = $dept->getVar('department');
            $fld_groups = $aPerms;
        }
        // Get list of all groups
        $crit = new Criteria('', '');
        $crit->setSort('name');
        $crit->setOrder('ASC');
        $groups =& $hGroups->getObjects($crit, true);
        $aGroups = array();
        foreach ($groups as $group_id => $group) {
            $aGroups[$group_id] = $group->getVar('name');
        }
        asort($aGroups);
        // Set groups in alphabetical order
        echo '<script type="text/javascript" src="' . XOOPS_URL . '/modules/xhelp/include/functions.js"></script>';
        $form = new xhelpForm(_AM_XHELP_EDIT_DEPARTMENT, 'edit_dept', xhelpMakeURI(XHELP_ADMIN_URL . '/department.php', array('op' => 'editDepartment', 'deptid' => $deptID)));
        $dept_name = new XoopsFormText(_AM_XHELP_TEXT_EDIT_DEPT, 'newDept', 20, 35, $fld_newDept);
        $group_select = new XoopsFormSelect(_AM_XHELP_TEXT_EDIT_DEPT_PERMS, 'groups', $fld_groups, 6, true);
        $group_select->addOptionArray($aGroups);
        $defaultDeptID = xhelpGetMeta("default_department");
        $defaultDept = new xhelpFormCheckbox(_AM_XHELP_TEXT_DEFAULT_DEPT, 'defaultDept', $defaultDeptID == $deptID ? 1 : 0, 'defaultDept');
        $defaultDept->addOption(1, "");
        $btn_tray = new XoopsFormElementTray('');
        $btn_tray->addElement(new XoopsFormButton('', 'updateDept', _AM_XHELP_BUTTON_SUBMIT, 'submit'));
        $form->addElement($dept_name);
        $form->addElement($group_select);
        $form->addElement($defaultDept);
        $form->addElement($btn_tray);
        $form->setLabelWidth('20%');
        echo $form->render();
        // Get dept staff members
        $hMembership =& xhelpGetHandler('membership');
        $hMember =& xoops_gethandler('member');
        $hStaffRole =& xhelpGetHandler('staffRole');
        $hRole =& xhelpGetHandler('role');
        $staff = $hMembership->membershipByDept($deptID, $limit, $start);
        $crit = new Criteria('j.department', $deptID);
        $staffCount =& $hMembership->getCount($crit);
        $roles =& $hRole->getObjects(null, true);
        echo "<form action='" . XHELP_ADMIN_URL . "/department.php?op=deleteStaffDept&amp;deptid=" . $deptID . "' method='post'>";
        echo "<table width='100%' cellspacing='1' class='outer'>\r\n              <tr><th colspan='" . (3 + count($roles)) . "'><label>" . _AM_XHELP_MANAGE_STAFF . "</label></th></tr>";
        if ($staffCount > 0) {
            $aStaff = array();
            foreach ($staff as $stf) {
                $aStaff[$stf->getVar('uid')] = $stf->getVar('uid');
                // Get array of staff uid
            }
            // Get user list
            $crit = new Criteria('uid', "(" . implode($aStaff, ',') . ")", "IN");
            //$members =& $hMember->getUserList($crit);
            $members =& xhelpGetUsers($crit, $displayName);
            // Get staff roles
            $crit = new CriteriaCompo(new Criteria('uid', "(" . implode($aStaff, ',') . ")", "IN"));
            $crit->add(new Criteria('deptid', $deptID));
            $staffRoles =& $hStaffRole->getObjects($crit);
            unset($aStaff);
            $staffInfo = array();
            foreach ($staff as $stf) {
                $staff_uid = $stf->getVar('uid');
                $staffInfo[$staff_uid]['uname'] = $members[$staff_uid];
                $aRoles = array();
                foreach ($staffRoles as $role) {
                    $role_id = $role->getVar('roleid');
                    if ($role->getVar('uid') == $staff_uid) {
                        $aRoles[$role_id] = $roles[$role_id]->getVar('name');
                    }
                    $staffInfo[$staff_uid]['roles'] = implode($aRoles, ', ');
                }
            }
            $nav = new XoopsPageNav($staffCount, $limit, $start, 'start', "op=editDepartment&amp;deptid={$deptID}&amp;limit={$limit}");
            echo "<tr class='head'><td rowspan='2'>" . _AM_XHELP_TEXT_ID . "</td><td rowspan='2'>" . _AM_XHELP_TEXT_USER . "</td><td colspan='" . count($roles) . "'>" . _AM_XHELP_TEXT_ROLES . "</td><td rowspan='2'>" . _AM_XHELP_TEXT_ACTIONS . "</td></tr>";
            echo "<tr class='head'>";
            foreach ($roles as $thisrole) {
                echo "<td>" . $thisrole->getVar('name') . "</td>";
            }
            echo "</tr>";
            foreach ($staffInfo as $uid => $staff) {
                echo "<tr class='even'>\r\n                          <td><input type='checkbox' name='staff[]' value='" . $uid . "' />" . $uid . "</td>\r\n                          <td>" . $staff['uname'] . "</td>";
                foreach ($roles as $thisrole) {
                    echo "<td><img src='" . XHELP_BASE_URL . "/images/";
                    echo in_array($thisrole->getVar('name'), explode(', ', $staff['roles'])) ? "on.png" : "off.png";
                    echo "' /></td>";
                }
                echo "    <td>\r\n                          <a href='" . XHELP_ADMIN_URL . "/staff.php?op=editStaff&amp;uid=" . $uid . "'><img src='" . XOOPS_URL . "/modules/xhelp/images/button_edit.png' title='" . _AM_XHELP_TEXT_EDIT . "' name='editStaff' /></a>&nbsp;\r\n                          <a href='" . XHELP_ADMIN_URL . "/department.php?op=deleteStaffDept&amp;uid=" . $uid . "&amp;deptid=" . $deptID . "'><img src='" . XOOPS_URL . "/modules/xhelp/images/button_delete.png' title='" . _AM_XHELP_TEXT_DELETE_STAFF_DEPT . "' name='deleteStaffDept' /></a>\r\n                      </td>\r\n                  </tr>";
            }
            echo "<tr>\r\n                      <td class='foot' colspan='" . (3 + count($roles)) . "'>\r\n                          <input type='checkbox' name='checkallRoles' value='0' onclick='selectAll(this.form,\"staff[]\",this.checked);' />\r\n                          <input type='submit' name='deleteStaff' id='deleteStaff' value='" . _AM_XHELP_BUTTON_DELETE . "' />\r\n                      </td>\r\n                  </tr>";
            echo "</table></form>";
            echo "<div id='staff_nav'>" . $nav->renderNav() . "</div>";
        } else {
            echo "</table></form>";
        }
        //now do the list of servers
        $hDeptServers =& xhelpGetHandler('departmentMailBox');
        $deptServers =& $hDeptServers->getByDepartment($deptID);
        //iterate
        if (count($deptServers) > 0) {
            echo "<br /><table width='100%' cellspacing='1' class='outer'>\r\n               <tr>\r\n                 <th colspan='5'><label>" . _AM_XHELP_DEPARTMENT_SERVERS . "</label></th>\r\n               </tr>\r\n               <tr>\r\n                 <td class='head' width='20%'><label>" . _AM_XHELP_DEPARTMENT_SERVERS_EMAIL . "</label></td>\r\n                 <td class='head'><label>" . _AM_XHELP_DEPARTMENT_SERVERS_TYPE . "</label></td>\r\n                 <td class='head'><label>" . _AM_XHELP_DEPARTMENT_SERVERS_SERVERNAME . "</label></td>\r\n                 <td class='head'><label>" . _AM_XHELP_DEPARTMENT_SERVERS_PORT . "</label></td>\r\n                 <td class='head'><label>" . _AM_XHELP_DEPARTMENT_SERVERS_ACTION . "</label></td>\r\n               </tr>";
            $i = 0;
            foreach ($deptServers as $server) {
                if ($server->getVar('active')) {
                    $activ_link = '".XHELP_ADMIN_URL."/department.php?op=activateMailbox&amp;setstate=0&amp;id=' . $server->getVar('id');
                    $activ_img = $imagearray['online'];
                    $activ_title = _AM_XHELP_MESSAGE_DEACTIVATE;
                } else {
                    $activ_link = '".XHELP_ADMIN_URL."/department.php?op=activateMailbox&amp;setstate=1&amp;id=' . $server->getVar('id');
                    $activ_img = $imagearray['offline'];
                    $activ_title = _AM_XHELP_MESSAGE_ACTIVATE;
                }
                echo '<tr class="even">
                   <td>' . $server->getVar('emailaddress') . '</td>
                   <td>' . xhelpGetMBoxType($server->getVar('mboxtype')) . '</td>
                   <td>' . $server->getVar('server') . '</td>
                   <td>' . $server->getVar('serverport') . '</td>
                   <td> <a href="' . $activ_link . '" title="' . $activ_title . '">' . $activ_img . '</a>
                        <a href="' . XHELP_ADMIN_URL . '/department.php?op=EditDepartmentServer&amp;id=' . $server->GetVar('id') . '">' . $imagearray['editimg'] . '</a>
                        <a href="' . XHELP_ADMIN_URL . '/department.php?op=DeleteDepartmentServer&amp;id=' . $server->GetVar('id') . '">' . $imagearray['deleteimg'] . '</a>

                   </td>
                 </tr>';
            }
            echo '</table>';
        }
        //finally add Mailbox form
        echo "<br /><br />";
        $formElements = array('type_select', 'server_text', 'port_text', 'username_text', 'pass_text', 'priority_radio', 'email_text', 'btn_tray');
        $form = new xhelpForm(_AM_XHELP_DEPARTMENT_ADD_SERVER, 'add_server', xhelpMakeURI(XHELP_ADMIN_URL . '/department.php', array('op' => 'AddDepartmentServer', 'id' => $deptID)));
        $type_select = new XoopsFormSelect(_AM_XHELP_DEPARTMENT_SERVERS_TYPE, 'mboxtype');
        $type_select->setExtra("id='mboxtype'");
        $type_select->addOption(_XHELP_MAILBOXTYPE_POP3, _AM_XHELP_MBOX_POP3);
        $server_text = new XoopsFormText(_AM_XHELP_DEPARTMENT_SERVERS_SERVERNAME, 'server', 40, 50);
        $server_text->setExtra("id='txtServer'");
        $port_text = new XoopsFormText(_AM_XHELP_DEPARTMENT_SERVERS_PORT, 'port', 5, 5, "110");
        $port_text->setExtra("id='txtPort'");
        $username_text = new XoopsFormText(_AM_XHELP_DEPARTMENT_SERVER_USERNAME, 'username', 25, 50);
        $username_text->setExtra("id='txtUsername'");
        $pass_text = new XoopsFormText(_AM_XHELP_DEPARTMENT_SERVER_PASSWORD, 'password', 25, 50);
        $pass_text->setExtra("id='txtPassword'");
        $priority_radio = new xhelpFormRadio(_AM_XHELP_DEPARTMENT_SERVERS_PRIORITY, 'priority', XHELP_DEFAULT_PRIORITY);
        $priority_array = array('1' => "<label for='priority1'><img src='" . XHELP_IMAGE_URL . "/priority1.png' title='" . xhelpGetPriority(1) . "' alt='priority1' /></label>", '2' => "<label for='priority2'><img src='" . XHELP_IMAGE_URL . "/priority2.png' title='" . xhelpGetPriority(2) . "' alt='priority2' /></label>", '3' => "<label for='priority3'><img src='" . XHELP_IMAGE_URL . "/priority3.png' title='" . xhelpGetPriority(3) . "' alt='priority3' /></label>", '4' => "<label for='priority4'><img src='" . XHELP_IMAGE_URL . "/priority4.png' title='" . xhelpGetPriority(4) . "' alt='priority4' /></label>", '5' => "<label for='priority5'><img src='" . XHELP_IMAGE_URL . "/priority5.png' title='" . xhelpGetPriority(5) . "' alt='priority5' /></label>");
        $priority_radio->addOptionArray($priority_array);
        $email_text = new XoopsFormText(_AM_XHELP_DEPARTMENT_SERVER_EMAILADDRESS, 'emailaddress', 50, 255);
        $email_text->setExtra("id='txtEmailaddress'");
        $btn_tray = new XoopsFormElementTray('');
        $test_button = new XoopsFormButton('', 'email_test', _AM_XHELP_BUTTON_TEST, 'button');
        $test_button->setExtra("id='test'");
        $submit_button = new XoopsFormButton('', 'updateDept2', _AM_XHELP_BUTTON_SUBMIT, 'submit');
        $cancel2_button = new XoopsFormButton('', 'cancel2', _AM_XHELP_BUTTON_CANCEL, 'button');
        $cancel2_button->setExtra("onclick='history.go(-1)'");
        $btn_tray->addElement($test_button);
        $btn_tray->addElement($submit_button);
        $btn_tray->addElement($cancel2_button);
        $form->setLabelWidth('20%');
        foreach ($formElements as $element) {
            $form->addElement(${$element});
        }
        echo $form->render();
        echo "<script type=\"text/javascript\" language=\"javascript\">\r\n          <!--\r\n          function xhelpEmailTest()\r\n          {\r\n            pop = openWithSelfMain(\"\", \"email_test\", 250, 150);\r\n            frm = xoopsGetElementById(\"add_server\");\r\n            newaction = \"department.php?op=testMailbox\";\r\n            oldaction = frm.action;\r\n            frm.action = newaction;\r\n            frm.target = \"email_test\";\r\n            frm.submit();\r\n            frm.action = oldaction;\r\n            frm.target = \"main\";\r\n\r\n          }\r\n\r\n          xhelpDOMAddEvent(xoopsGetElementById(\"email_test\"), \"click\", xhelpEmailTest, false);\r\n\r\n          //-->\r\n          </script>";
        xhelpAdminFooter();
        xoops_cp_footer();
    }
}
コード例 #6
0
 function optOther($s = '', $id, $entry, $counter, $checkbox = false)
 {
     static $blankSubformCounters = array();
     global $xoopsModuleConfig, $xoopsDB;
     if (!preg_match('/\\{OTHER\\|+[0-9]+\\}/', $s)) {
         return false;
     }
     // deal with displayElement elements...
     $id_parts = explode("_", $id);
     /* // displayElement elements will be in the format de_{id_req}_{ele_id} (deh?)
     		// regular elements will be in the format ele_{ele_id}
     		if(count($id_parts) == 3) {
     			$ele_id = $id_parts[2];
     		} else {
     			$ele_id = $id_parts[1];
     		}*/
     // NOW, in Formulize 3, id_parts[3] will always be the element id. :-)
     $ele_id = $id_parts[3];
     // gather the current value if there is one
     $other_text = "";
     if (is_numeric($entry)) {
         $otherq = q("SELECT other_text FROM " . $xoopsDB->prefix("formulize_other") . " WHERE id_req='{$entry}' AND ele_id='{$ele_id}' LIMIT 0,1");
         $other_text = $otherq[0]['other_text'];
     }
     if (strstr($_SERVER['PHP_SELF'], "formulize/printview.php")) {
         return $other_text;
     }
     $s = explode('|', preg_replace('/[\\{\\}]/', '', $s));
     $len = !empty($s[1]) ? $s[1] : $xoopsModuleConfig['t_width'];
     if ($entry == "new") {
         $blankSubformCounters[$ele_id] = isset($blankSubformCounters[$ele_id]) ? $blankSubformCounters[$ele_id] + 1 : 0;
         $blankSubformCounter = $blankSubformCounters[$ele_id];
         $otherKey = 'ele_' . $ele_id . '_' . $entry . '_' . $blankSubformCounter;
     } else {
         $otherKey = 'ele_' . $ele_id . '_' . $entry;
     }
     $box = new XoopsFormText('', 'other[' . $otherKey . ']', $len, 255, $other_text);
     if ($checkbox) {
         $box->setExtra("onchange=\"javascript:formulizechanged=1;\" onfocus=\"javascript:this.form.elements['" . $id . "[]'][{$counter}].checked = true;\"");
     } else {
         $box->setExtra("onchange=\"javascript:formulizechanged=1;\" onfocus=\"javascript:this.form." . $id . "[{$counter}].checked = true;\"");
     }
     return $box->render();
 }
コード例 #7
0
        $subject_add = new XoopsFormElementTray(_MD_TOPIC_SUBJECTC, '');
        $subjectpres = explode(',', $xoopsModuleConfig['subject_prefix']);
        $subjectpres = array_map('trim', $subjectpres);
        if (count($subjectpres) > 1) {
            foreach ($subjectpres as $subjectpre) {
                $subject_array[] = trim($subjectpre);
            }
            $subject_select = new XoopsFormSelect('', 'subject_pre', $subject_pre);
            $subject_select->addOptionArray($subject_array);
            $subject_add->addElement(new XoopsFormLabel($subject_select->render()));
        }
        $forum_form->addElement($subject_add);
    }
}
$subject_form = new XoopsFormText(_MD_SUBJECTC, 'subject', 60, 100, $subject);
$subject_form->setExtra("tabindex='1'");
$forum_form->addElement($subject_form, true);
if (!is_object($xoopsUser) && empty($admin_form_action)) {
    $required = empty($xoopsModuleConfig["require_name"]) ? false : true;
    $forum_form->addElement(new XoopsFormText(_MD_NAMEMAIL, 'poster_name', 60, 255, !empty($isedit) && !empty($poster_name) ? $poster_name : ''), $required);
}
$icons_radio = new XoopsFormRadio(_MD_MESSAGEICON, 'icon', $icon);
$subject_icons = XoopsLists::getSubjectsList();
foreach ($subject_icons as $iconfile) {
    $icons_radio->addOption($iconfile, '<img src="' . XOOPS_URL . '/images/subject/' . $iconfile . '" alt="" />');
}
$forum_form->addElement($icons_radio);
$nohtml = $forum->getVar('allow_html') ? false : true;
if (!empty($editor)) {
    newbb_setcookie("editor", $editor);
} else {
コード例 #8
0
    /**
     * created elements
     * @license http://www.blags.org/
     * @created:2010年05月21日 20时40分
     * @copyright 1997-2010 The Martin Group
     * @author Martin <*****@*****.**> 
     * */
    function createElements()
    {
        $Price =& $this->Obj;
        $today = intval(date('d'));
        $MouthDays = intval($this->MouthDays(date('m')));
        $js = '<script type=\'text/javascript\'>
			jQuery.noConflict(); 
			jQuery(document).ready(function($){
				$("#sub").click(function(){
					var result = true;
					$("form input[type=text]").each(function(Element){
						if($.trim($(this).val()) == "" && $.trim($(this).attr("class")) != "")
						{
							$(this).focus();
							result = false;
							return false;
						}
					});
					if(result)
					{
						$("#op").submit();	
					}else{
						alert("只能数字,不能为空");
					}
				});
				$(".sel").click(function(){
					var Check = $(this).prev("input[type=checkbox]").attr("checked") ? false : true;
					$(this).prev("input[type=checkbox]").attr("checked",Check);
				});
				/*$(".even").parent("tr").click(function(){
					var Check = $(this).find("input[type=checkbox]").attr("checked") ? false : true;
					$(this).find("input[type=checkbox]").attr("checked",Check);
					$(this).attr("style","background-color: rgb(0, 255, 0);");
				});*/
				$("#room_price_all").click(function(){
					var value = $(this).next("input").val();
					if(!parseFloat(value)){alert("this must be Number.");$(this).focus();return false;}
					$(".room_price").val(value);
				});
				$("#room_advisory_range_max_all").click(function(){
					var value = $(this).next("input").val();
					if(!parseFloat(value)){alert("this must be Number.");$(this).focus();return false;}
					$(".room_advisory_range_max").val(value);
				});
				$("#room_advisory_range_min_all").click(function(){
					var value = $(this).next("input").val();
					if(!parseFloat(value)){alert("this must be Number.");$(this).focus();return false;}
					$(".room_advisory_range_small").val(value);
				});
				$("#room_sented_coupon_all").click(function(){
					var value = $(this).next("input").val();
					if(!parseFloat(value)){alert("this must be Number.");$(this).focus();return false;}
					$(".room_sented_coupon").val(value);
				});
			});
			</script>';
        $button_str = '
						<table><tr><td width="150px;align=center;"><input type="button" id="room_price_all" value="ALL">&nbsp;<input type="text" size=5></td>
						<td width="100px;align=center;"><input type="button" id="room_advisory_range_min_all" value="ALL">&nbsp;<input type="text" size=5></td>
						<td width="150px;align=center;"><input type="button" id="room_advisory_range_max_all" value="ALL">&nbsp;<input type="text" size=5></td>
						<td width="150px;align=center;"><input type="button" id="room_sented_coupon_all" value="ALL">&nbsp;<input type="text" size=5></td></tr></table>
					';
        //var_dump($Price);
        if (!empty($Price) && is_array($Price) && isset($Price['room_price'])) {
            $PriceArea = new XoopsFormElementTray($js . '房间价格');
            $RoomElement = new XoopsFormSelect('客房', 'room_id', $Price['room_id'], 1);
            $RoomElement->addOptionArray($this->RoomList);
            $PriceArea->addElement($RoomElement, true);
            $PriceArea->addElement(new XoopsFormText('价格:', 'room_price', 11, 11, $Price['room_price']), true);
            $PriceArea->addElement(new XoopsFormText('价格范围:', 'room_advisory_range_small', 11, 11, $Price['room_advisory_range_small']), true);
            $PriceArea->addElement(new XoopsFormText('-', 'room_advisory_range_max', 11, 11, $Price['room_advisory_range_max']), true);
            //赠送现金卷
            $PriceArea->addElement(new XoopsFormText('赠送现金卷:', 'room_sented_coupon', 11, 11, $Price['room_sented_coupon']), true);
            $Special = new XoopsFormCheckBox('', "room_is_totay_special", $Price['room_is_totay_special']);
            $Special->addOption(1, '<label for="room_is_totay_special">' . _YES . '当日特价</label>');
            //$PriceArea->addElement(new XoopsFormText('时间:', 'room_date', 11, 11, date("Y-m-d",$Price['room_date'])), true);
            $PriceArea->addElement(new XoopsFormHidden('room_date[]', $Price['room_date']));
            $PriceArea->addElement($Special, false);
            $this->addElement($PriceArea, false);
        } else {
            $RoomElement = new XoopsFormSelect($js . '客房<br><font color=red><b>时间请不要修改</b></font>', 'room_id', '', 1);
            $RoomElement->addOptionArray($this->RoomList);
            $this->addElement($RoomElement);
            $Select = new XoopsFormElementTray('批量处理');
            $Select->addElement(new XoopsFormLabel("", $button_str));
            $this->addElement($Select);
            //var_dump($Price[1277395200]);
            //$countDate = count($Price) > 0 ? count($Price) + $today : $MouthDays + $today;
            $countDate = $MouthDays + $today;
            for ($today; $today <= $countDate; $today++) {
                $date = $today > $MouthDays ? date("Y") . '-' . (date("m") + 1) . '-' . ($today - $MouthDays) : date("Y") . '-' . date("m") . '-' . $today;
                $dateTime = strtotime($date);
                //var_dump($Price[$dateTime]);
                ${"PriceArea" . $today} = new XoopsFormElementTray('房间' . $date . '的价格');
                $room_price = new XoopsFormText('价格:', 'room_price[]', 11, 11, isset($Price[$dateTime]) ? $Price[$dateTime]['room_price'] : '0.00');
                $room_price->setExtra("class='room_price'");
                ${"PriceArea" . $today}->addElement($room_price, true);
                $room_advisory_range_small = new XoopsFormText('价格范围:', 'room_advisory_range_small[]', 11, 11, isset($Price[$dateTime]) ? $Price[$dateTime]['room_advisory_range_small'] : '0.00');
                $room_advisory_range_small->setExtra("class='room_advisory_range_small'");
                ${"PriceArea" . $today}->addElement($room_advisory_range_small, true);
                $room_advisory_range_max = new XoopsFormText('-', 'room_advisory_range_max[]', 11, 11, isset($Price[$dateTime]) ? $Price[$dateTime]['room_advisory_range_max'] : '0.00');
                $room_advisory_range_max->setExtra("class='room_advisory_range_max'");
                ${"PriceArea" . $today}->addElement($room_advisory_range_max, true);
                //赠送现金卷
                $room_sented_coupon = new XoopsFormText('赠送现金卷:', 'room_sented_coupon[]', 11, 11, isset($Price[$dateTime]) ? $Price[$dateTime]['room_sented_coupon'] : '0.00');
                $room_sented_coupon->setExtra("class='room_sented_coupon'");
                ${"PriceArea" . $today}->addElement($room_sented_coupon, true);
                $Special = new XoopsFormCheckBox('', "room_is_totay_special[{$dateTime}]", isset($Price[$dateTime]) ? $Price[$dateTime]['room_is_totay_special'] : 0);
                $Special->addOption(1, '<label class="sel">' . _YES . '当日特价</label>');
                //echo isset($Price[$dateTime]) ? $Price[$dateTime]['room_is_totay_special'] : 0;echo '<br>';
                //hide time
                //${"PriceArea".$today}->addElement(new XoopsFormText('时间:', 'room_date[]', 11, 11, $date), true);
                ${"PriceArea" . $today}->addElement(new XoopsFormHidden('room_date[]', $date));
                ${"PriceArea" . $today}->addElement($Special, false);
                $this->addElement(${"PriceArea" . $today}, false);
                unset(${"PriceArea" . $today}, $dateTime, $date, $room_price, $room_advisory_range_max, $room_advisory_range_small, $room_sented_coupon, $Special);
            }
        }
        /*$this->addElement( new XoopsFormText('客房名称', 'room_name', 45, 45, $this->Obj->room_name()), true);
        		$this->addElement( new XoopsFormText('客房面积', 'room_area', 11, 11, $this->Obj->room_area()), true);
        		$this->addElement( new XoopsFormText('客房楼层', 'room_floor', 45, 45, $this->Obj->room_floor()), true);
        		
        		$this->addElement( new XoopsFormText('加价', 'room_add_money', 11, 11, $this->Obj->room_add_money()), false);
        		$this->addElement( new XoopsFormTextArea('床描述', 'room_bed_info', $this->Obj->room_bed_info()) , false);
        		$this->addElement( new XoopsFormRadioYN('客房状态', 'room_status', $this->Obj->room_status(), "已发布",  "编辑中") , true);
        		$this->addElement( new XoopsFormText('赠送现金卷', 'room_sented_coupon', 11, 11, intval($this->Obj->room_sented_coupon())), false);*/
    }
コード例 #9
0
ファイル: form.inc.php プロジェクト: severnaya99/Sg-2010
$icons_radio = new XoopsFormRadio(_MP_MESSAGEICON, 'msg_image', $icon);
$subject_icons = XoopsLists::getSubjectsList();
foreach ($subject_icons as $iconfile) {
    $icons_radio->addOption($iconfile, '<img src="' . XOOPS_URL . '/images/subject/' . $iconfile . '" alt="" />');
}
$form->addElement($icons_radio);
if ($view_perms & GPERM_OEIL) {
    $indeximage_select = new XoopsFormText('', 'anim_msg', 25, 50, $anim);
    $indeximage_select->setExtra("readonly=\"readonly\" ");
    $indeximage_tray = new XoopsFormElementTray(_MP_MESSAGEOEIL, '&nbsp;');
    $indeximage_tray->addElement($indeximage_select);
    $indeximage_tray->addElement(new XoopsFormLabel('', "<A HREF=\"javascript:;\" onClick=\"window.open('pop.php','_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=0, copyhistory=0, menuBar=0, width=700, height=400');return false;\"><img src=\"images/popup.gif\">&nbsp;" . _MP_MESSAGEVUOEIL . "</A>"));
    $form->addElement($indeximage_tray);
}
$form_subject = new XoopsFormText(_MP_SUBJECTC, "subject", 50, 100, $subject);
$form_subject->setExtra("onclick=\"selectfill(" . $xoopsModuleConfig['senduser'] . ");\"");
$form->addElement($form_subject, true);
$editor = WysiwygForm(_MP_MESSAGEC, "message", $message, '100%', '400px', $formtype);
$editor->setDescription(sprintf($deschtml));
$form->addElement($editor);
//$text_select = new XoopsFormDhtmlTextArea(_MP_MESSAGE, "message", $message, 15, 85);
//$form->addElement($text_select, true);
$button_tray = new XoopsFormElementTray('', '');
//upload
if ($view_perms & GPERM_UP) {
    $indeximage_up = new XoopsFormFile('', 'fileup', $xoopsModuleConfig['mimemax']);
    $indeximage_uptray = new XoopsFormElementTray(_MP_MIMEFILE, '&nbsp;');
    $indeximage_uptray->addElement($indeximage_up);
    $indeximage_uptray->addElement(new XoopsFormLabel('', '<br />' . _MP_MIMETYPE2 . mp_mimetypes() . '<br />' . _MP_MIME . sprintf(_MD_NUMBYTES, $xoopsModuleConfig['mimemax'])));
    $form->addElement($indeximage_uptray);
    $up_tray = new XoopsFormElementTray(_MP_MIMEFILE, '&nbsp;');
コード例 #10
0
function xhld_get_hl_form($hl, $action = 'new')
{
    // add or edit
    if ($action == 'new') {
        $form_title = _AM_ADDHEADL;
        $op = 'addgo';
    } else {
        $form_title = _AM_EDITHEADL;
        $op = 'editgo';
    }
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    $form = new XoopsThemeForm($form_title, 'headline_form', 'index.php');
    $form->addElement(new XoopsFormText(_AM_SITENAME, 'headline_name', 40, 4096, $hl->getVar('headline_name')), true);
    $url_text = new XoopsFormText('', 'headline_url', 45, 4096, $hl->getVar('headline_url'));
    $url_tray = new XoopsFormElementTray(_AM_URL, '');
    $url_tray->addElement($url_text, true);
    $url_tray->addElement(new XoopsFormLabel("<img src='../images/html.gif' onClick=\"window.open(document.headline_form.headline_url.value,'','');return(false);\" alt='HTML' />"));
    $form->addElement($url_tray);
    $rssurl_text = new XoopsFormText('', 'headline_rssurl', 60, 4096, $hl->getVar('headline_rssurl'));
    $rssurl_tray = new XoopsFormElementTray(_AM_URLEDFXML, '');
    $rssurl_tray->addElement($rssurl_text, true);
    $rssurl_tray->addElement(new XoopsFormLabel("<img src='../images/xml.gif' onClick=\"window.open(document.headline_form.headline_rssurl.value,'','');return(false);\" alt='XML' />"));
    $form->addElement($rssurl_tray);
    $syndic_sel = new XoopsFormSelect(_AM_SYNDICATIONTYPE, 'headline_syndication', $hl->getVar('headline_syndication'));
    $syndic_sel->addOptionArray(array('' => _AM_SYNDICATIONTYPE_AUTO, 'RSS' => 'RSS', 'ATOM' => 'ATOM'));
    $form->addElement($syndic_sel);
    $form->addElement(new XoopsFormText(_AM_TITLEPATTERN, 'headline_titlepattern', 50, 4096, $hl->getVar('headline_titlepattern')), false);
    $form->addElement(new XoopsFormText(_AM_TITLEEXCLUDE, 'headline_titleexclude', 50, 4096, $hl->getVar('headline_titleexclude')), false);
    $form->addElement(new XoopsFormText(_AM_LINKPATTERN, 'headline_linkpattern', 50, 4096, $hl->getVar('headline_linkpattern')), false);
    $form->addElement(new XoopsFormText(_AM_LINKEXCLUDE, 'headline_linkexclude', 50, 4096, $hl->getVar('headline_linkexclude')), false);
    $form->addElement(new XoopsFormText(_AM_ORDER, 'headline_weight', 4, 3, $hl->getVar('headline_weight')));
    $enc_sel = new XoopsFormSelect(_AM_ENCODING, 'headline_encoding', $hl->getVar('headline_encoding'));
    $enc_sel->addOptionArray($GLOBALS['allowed_encodings']);
    $form->addElement($enc_sel);
    $cache_text = new XoopsFormText('', 'headline_cachetime', 6, 6, $hl->getVar('headline_cachetime') / 60);
    $cache_text->setExtra('style="text-align:right;"');
    $cache_tray = new XoopsFormElementTray(_AM_CACHETIME, '');
    $cache_tray->addElement($cache_text, true);
    $cache_tray->addElement(new XoopsFormLabel(sprintf(_MINUTES, '')));
    $form->addElement($cache_tray);
    $timeout_text = new XoopsFormText('', 'headline_timeout', 4, 4, $hl->getVar('headline_timeout'));
    $timeout_text->setExtra('style="text-align:right;"');
    $timeout_tray = new XoopsFormElementTray(_AM_TIMEOUT, '');
    $timeout_tray->addElement($timeout_text, true);
    $timeout_tray->addElement(new XoopsFormLabel(sprintf(_SECONDS, '')));
    $form->addElement($timeout_tray);
    $form->addElement(new XoopsFormRadioYN(_AM_ALLOWHTML, 'headline_allowhtml', $hl->getVar('headline_allowhtml'), _YES, _NO));
    $form->insertBreak(_AM_MAINSETT);
    $form->addElement(new XoopsFormRadioYN(_AM_DISPLAY, 'headline_display', $hl->getVar('headline_display'), _YES, _NO));
    $form->addElement(new XoopsFormRadioYN(_AM_DISPIMG, 'headline_mainimg', $hl->getVar('headline_mainimg'), _YES, _NO));
    $form->addElement(new XoopsFormRadioYN(_AM_DISPFULL, 'headline_mainfull', $hl->getVar('headline_mainfull'), _YES, _NO));
    $form->addElement(new XoopsFormText(_AM_DISPMAX, 'headline_mainmax', 5, 5, intval($hl->getVar('headline_mainmax'))), true);
    $form->insertBreak(_AM_BLOCKSETT);
    $form->addElement(new XoopsFormRadioYN(_AM_ASBLOCK, 'headline_asblock', $hl->getVar('headline_asblock'), _YES, _NO));
    $form->addElement(new XoopsFormRadioYN(_AM_DISPIMG, 'headline_blockimg', $hl->getVar('headline_blockimg'), _YES, _NO));
    $form->addElement(new XoopsFormText(_AM_DISPMAX, 'headline_blockmax', 5, 5, intval($hl->getVar('headline_blockmax'))), true);
    $form->insertBreak();
    $form->addElement(new XoopsFormHidden('headline_id', $hl->getVar('headline_id')));
    $form->addElement(new XoopsFormHidden('op', $op));
    $button_tray = new XoopsFormElementTray('', '&nbsp;');
    $button_tray->addElement(new XoopsFormButton('', 'headline_submit', _SUBMIT, 'submit'));
    if ($action != 'new') {
        $button_tray->addElement(new XoopsFormButton('', 'headline_saveas', _AM_SAVEAS, 'submit'));
    }
    $form->addElement($button_tray);
    // Ticket
    $GLOBALS['xoopsGTicket']->addTicketXoopsFormElement($form, __LINE__);
    return $form;
}
コード例 #11
0
 function getFilter($acid, $filterHandle, $boxesAsHidden = false)
 {
     include_once XOOPS_ROOT_PATH . '/class/xoopsform/formelement.php';
     //dependency
     include_once XOOPS_ROOT_PATH . '/class/xoopsform/formtext.php';
     //dependency
     include_once XOOPS_ROOT_PATH . '/class/xoopsform/formhidden.php';
     //dependency
     include_once XOOPS_ROOT_PATH . '/class/xoopsform/formtextdateselect.php';
     include_once XOOPS_ROOT_PATH . '/class/xoopsform/formselect.php';
     $hideLabel = false;
     // load the advanced calculation (procedure)
     $acObject = $this->get($acid);
     $fltr_grps = $acObject->getVar("fltr_grps");
     // look for the handle
     $fltr_grp_index = -1;
     foreach ($fltr_grps as $index => $fltr_grp) {
         if ($filterHandle == $fltr_grp["handle"]) {
             $fltr_grp_index = $index;
             break;
         }
     }
     if ($fltr_grp_index == -1) {
         print "Error: handle not found";
         return;
     }
     $fltr_grp = $fltr_grps[$fltr_grp_index];
     $kind = $fltr_grp["type"]["kind"];
     $form = $fltr_grp["form"];
     $elementUnderlyingField = $form ? "element" . $form : "no-underlying-element";
     if ($kind == 1) {
         // first param is caption, we can skip that because the front end person will embed this somewhere with a caption of their own attached
         // $elementName is the name that gets attached to the HTML element
         // 15 is the size
         // last param is the date the user chose, note it must be passed as a timestamp into the function
         $elementName = $acid . "_" . $fltr_grp["handle"];
         $dateValue = isset($_POST[$elementName]) ? strtotime($_POST[$elementName]) : (isset($_GET[$elementName]) ? strtotime($_GET[$elementName]) : "");
         if ($boxesAsHidden) {
             $hideLabel = true;
             if ($elementName == $acid . "_minAge") {
                 $dateValue = 0;
             }
             if ($elementName == $acid . "_maxAge") {
                 $dateValue = 99;
             }
             $form_ele = new XoopsFormHidden($elementName, $dateValue);
         } else {
             $form_ele = new XoopsFormTextDateSelect("", $elementName, 15, $dateValue);
             $form_ele->setExtra(' class="' . $elementUnderlyingField . '" ');
         }
         $selected = date("Y-m-d", $dateValue);
         // special catch for dates without a year, which is valid for OCANDS multi year groupings with only quarters specified
         if ($selected == "1969-12-31" and (strstr($elementName, "_startDate") or strstr($elementName, "_endDate")) and $selected != $_POST[$elementName] and $selected != $_GET[$elementName]) {
             $selected = $_POST[$elementName];
         }
     } else {
         if ($kind == 2) {
             // $selectedValue is the value in the option list that should be selected by default...
             //   if $selectedValue is "" then the first item will be selected (ie: no selection)
             // 1 is the size (number of rows)
             // 0 is the flag for if multiple selections are allowed
             $elementName = $acid . "_" . $fltr_grp["handle"];
             $selectedValue = isset($_POST[$elementName]) ? $_POST[$elementName] : (isset($_GET[$elementName]) ? $_GET[$elementName] : "");
             $form_ele = new XoopsFormSelect("", $elementName, $selectedValue, 1, 0);
             // 1. first item in the list should be "Choose an option..." with a value of "" (ie: empty)
             // 2. support for "pipe" syntax that is valid elsewhere in Formulize when admins are specifying options for selectboxes.
             //   if in the admin UI the user has said the options are this:
             //     one, two, three
             //   then we build an option array to put into the element, that looks like this:
             //     one=>one, two=>two, three=>three
             //   BUT, If the user typed the options into the admin UI like this:
             //     1|one, 2|two, 3|three
             //       then we build the array:
             //         1=>one, 2=>two, 3=>three
             $definedOptions = $fltr_grp["type"]["options"];
             $options = array();
             $options[""] = "Choose an option...";
             foreach ($definedOptions as $definedOption) {
                 $value = explode("|", $definedOption);
                 if (count($value) == 2) {
                     $options[$value[0]] = $value[1];
                     if ($selectedValue == $value[0]) {
                         $selected = trim($value[1]);
                     }
                 } else {
                     $options[$definedOption] = $definedOption;
                     if ($selectedValue == $definedOption) {
                         $selected = trim($definedOption);
                     }
                 }
             }
             $form_ele->addOptionArray($options);
             $form_ele->setExtra(' class="' . $elementUnderlyingField . '" ');
         } else {
             if ($kind == 3) {
                 $selected = array();
                 $elementName = $acid . "_" . $fltr_grp["handle"];
                 $tmp_html = "";
                 $index = 0;
                 foreach ($fltr_grp["type"]["options"] as $definedOption) {
                     $elementArrayName = $elementName . "[" . $index . "]";
                     $value = $this->_getFilterOptionsCheckboxStatus($fltr_grp, $index, $elementName);
                     //print $value . "!!<br><br>";print_r($_POST);print_r($_GET);exit();
                     if ($value == 1) {
                         $checked = ' CHECKED';
                     } else {
                         $checked = '';
                     }
                     $option_value = explode("|", $definedOption);
                     if (count($option_value) == 2) {
                         $tmp_html .= '<input type="checkbox" id="' . $elementArrayName . '" class="' . $elementUnderlyingField . ' ' . $elementName . '" name="' . $elementArrayName . '" value="1"' . $checked . '>';
                         $tmp_html .= $option_value[1] . "<br>";
                         if ($value == 1) {
                             $selected[] = trim($option_value[1]);
                         }
                     } else {
                         $tmp_html .= '<input type="checkbox" id="' . $elementArrayName . '" class="' . $elementUnderlyingField . ' ' . $elementName . '" name="' . $elementArrayName . '" value="1"' . $checked . '>';
                         $tmp_html .= $definedOption . "<br>";
                         if ($value == 1) {
                             $selected[] = trim($definedOption);
                         }
                     }
                     $index++;
                 }
                 if (count($selected) == 0) {
                     $selected = "All";
                 }
             } else {
                 if ($kind == 4) {
                     // textbox
                     $elementName = $acid . "_" . $fltr_grp["handle"];
                     $value = isset($_POST[$elementName]) ? $_POST[$elementName] : (isset($_GET[$elementName]) ? $_GET[$elementName] : "");
                     if ($boxesAsHidden) {
                         $form_ele = new XoopsFormHidden($elementName, $value);
                     } else {
                         $form_ele = new XoopsFormText('', $elementName, 20, 255, $value);
                         $form_ele->setExtra(' class="' . $elementUnderlyingField . '" ');
                     }
                     $selected = $value;
                 }
             }
         }
     }
     if ($form_ele) {
         $html = $form_ele->render();
     } else {
         if ($tmp_html) {
             $html = $tmp_html;
         } else {
             $html = "";
         }
     }
     $labelText = $hideLabel ? "" : $fltr_grp["fltr_label"];
     return array("label" => $labelText, "html" => $html, "selected" => $selected);
 }
コード例 #12
0
ファイル: submit.php プロジェクト: nouphet/rata
$reset_button = new XoopsFormButton("", "reset", $mode == G_INSERT ? _MD_GNAV_SMT_CLEAR : _CANCEL, "reset");
$submit_tray = new XoopsFormElementTray('');
$submit_tray->addElement($preview_button);
$submit_tray->addElement($submit_button);
$submit_tray->addElement($reset_button);
$lid_hidden = new XoopsFormHidden("lid", $photo['lid']);
//moreinfo
$url_text = new XoopsFormText(_MD_GNAV_ITM_URL, "url", 50, 255, $myts->makeTboxData4Edit($photo['url']));
$tel_text = new XoopsFormText(_MD_GNAV_ITM_TEL, "tel", 20, 20, $myts->makeTboxData4Edit($photo['tel']));
$fax_text = new XoopsFormText(_MD_GNAV_ITM_FAX, "fax", 20, 20, $myts->makeTboxData4Edit($photo['fax']));
$zip_text = new XoopsFormText(_MD_GNAV_ITM_ZIP, "zip", 10, 8, $myts->makeTboxData4Edit($photo['zip']));
$rss_text = new XoopsFormText(_MD_GNAV_ITM_RSS, "rss", 50, 255, $myts->makeTboxData4Edit($photo['rss']));
if ($language == 'japanese' || $language == 'ja_utf8') {
    if (file_exists(XOOPS_ROOT_PATH . $gnavi_ajaxzip_place . "ajaxzip2.js")) {
        $xoops_module_header .= "\n<script src='js/prototype.js' charset='UTF-8'></script>\n<script src='" . XOOPS_URL . $gnavi_ajaxzip_place . "ajaxzip2.js' charset='UTF-8'></script>\n<script type='text/javascript'>\n//<![CDATA[\n\tAjaxZip2.JSONDATA = '" . XOOPS_URL . $gnavi_ajaxzip_place . "data';\n//]]>\n</script>\n";
        $zip_text->setExtra("onKeyUp=\"AjaxZip2.zip2addr(this,'address','address');\"");
    }
}
$address_tray = new XoopsFormElementTray(_MD_GNAV_ITM_ADDRESS, '');
$address_text = new XoopsFormText("", "address", 50, 255, $myts->makeTboxData4Edit($photo['address']));
$address_tray->addElement($address_text);
if ($gnavi_usegooglemap) {
    $geo_button = new XoopsFormButton("", "geo", _MD_GNAV_MAP_SEARCH, "button");
    $geo_button->setExtra("onClick=\"showAddress(document.getElementById('address').value);\"");
    $address_tray->addElement($geo_button);
}
//Google Maps
if ($gnavi_usegooglemap) {
    $xoops_module_header .= "<script src='" . $gnavi_googlemap_url . "/maps?file=api&amp;v=2&amp;key={$gnavi_googlemapapi_key}' type='text/javascript' charset='utf-8'></script>\n<script src='js/map.js' type='text/javascript' charset='utf-8'></script>\n<script type='text/javascript'>\n//<![CDATA[\n\t{$gnavi_lang_java}\n\twindow.onload = InputGMap;\n//]]>\n</script>";
    if ($p_set_latlng) {
        $set_latlng_state = '';
コード例 #13
0
ファイル: admin_func.php プロジェクト: nouphet/rata
function hypconfShowForm($config)
{
    global $constpref, $mydirname, $mydirpath, $mytrustdirpath, $page, $xoopsConfig, $xoopsGTicket;
    if (!$config) {
        die('no configs');
    }
    if (isset($config['error'])) {
        echo '<div class="error">' . join('</div><div class="error">', $config['error']) . '</div>';
        unset($config['error']);
    }
    if (isset($config['contents'])) {
        echo $config['contents'];
        unset($config['contents']);
    }
    if ($config) {
        $count = count($config);
        include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
        include_once dirname(dirname(__FILE__)) . '/class/formcheckbox.php';
        if (!XC_CLASS_EXISTS('XoopsFormBreak')) {
            include_once dirname(dirname(__FILE__)) . '/class/formbreak.php';
        }
        $form = new XoopsThemeForm(hypconf_constant($constpref . '_ADMENU_' . strtoupper($page)), 'pref_form', 'index.php');
        $button_tray = new XoopsFormElementTray("");
        for ($i = 0; $i < $count; $i++) {
            $description = defined($config[$i]['description']) ? constant($config[$i]['description']) : '';
            //$title4tray = (!$description) ? hypconf_constant($config[$i]['title']) : hypconf_constant($config[$i]['title']).'<br /><br /><span style="font-weight:normal;">'.hypconf_constant($config[$i]['description']).'</span>'; // GIJ
            $title4tray = hypconf_constant($config[$i]['title']);
            $title = '';
            // GIJ
            switch ($config[$i]['formtype']) {
                case 'textarea':
                    $myts =& MyTextSanitizer::getInstance();
                    if ($config[$i]['valuetype'] == 'array') {
                        // this is exceptional.. only when value type is arrayneed a smarter way for this
                        $ele = $config[$i]['value'] != '' ? new XoopsFormTextArea($title, $config[$i]['name'], $myts->htmlspecialchars(implode('|', $config[$i]['value'])), 5, 50) : new XoopsFormTextArea($title, $config[$i]['name'], '', 5, 50);
                    } else {
                        $ele = new XoopsFormTextArea($title, $config[$i]['name'], $myts->htmlspecialchars($config[$i]['value']), 5, 50);
                        $ele->setExtra('class="norich"');
                    }
                    break;
                case 'select':
                    $size = 1;
                    if (!empty($config[$i]['size'])) {
                        $size = $config[$i]['size'];
                    }
                    $ele = new XoopsFormSelect($title, $config[$i]['name'], $config[$i]['value'], $size);
                    $options = $config[$i]['options'];
                    $opcount = count($options);
                    foreach ($options as $option) {
                        $optval = defined($option['confop_value']) ? constant($option['confop_value']) : $option['confop_value'];
                        $optkey = defined($option['confop_name']) ? constant($option['confop_name']) : $option['confop_name'];
                        $ele->addOption($optval, $optkey);
                    }
                    break;
                case 'select_multi':
                    $size = 5;
                    if (!empty($config[$i]['size'])) {
                        $size = $config[$i]['size'];
                    }
                    $ele = new XoopsFormSelect($title, $config[$i]['name'], $config[$i]['value'], $size, true);
                    $options = $config[$i]['options'];
                    foreach ($options as $option) {
                        $optval = defined($option['confop_value']) ? constant($option['confop_value']) : $option['confop_value'];
                        $optkey = defined($option['confop_name']) ? constant($option['confop_name']) : $option['confop_name'];
                        $ele->addOption($optval, $optkey);
                    }
                    break;
                case 'check':
                    $ele = new HypconfFormCheckBox($title, $config[$i]['name'], $config[$i]['value']);
                    if (!empty($config[$i]['width'])) {
                        //$ele->setWidth($config[$i]['width']);
                    }
                    $options = $config[$i]['options'];
                    foreach ($options as $option) {
                        $optval = defined($option['confop_value']) ? hypconf_constant($option['confop_value']) : $option['confop_value'];
                        $optkey = defined($option['confop_name']) ? hypconf_constant($option['confop_name']) : $option['confop_name'];
                        $ele->addOption($optval, $optkey);
                    }
                    break;
                case 'yesno':
                    $ele = new XoopsFormRadioYN($title, $config[$i]['name'], $config[$i]['value'], _YES, _NO);
                    break;
                case 'password':
                    $size = 50;
                    if (!empty($config[$i]['size'])) {
                        $size = $config[$i]['size'];
                    }
                    $myts =& MyTextSanitizer::getInstance();
                    $ele = new XoopsFormPassword($title, $config[$i]['name'], $size, 255, $myts->htmlspecialchars($config[$i]['value']));
                    break;
                case 'textbox':
                default:
                    $size = 50;
                    if (!empty($config[$i]['size'])) {
                        $size = $config[$i]['size'];
                    }
                    $myts =& MyTextSanitizer::getInstance();
                    $ele = new XoopsFormText($title, $config[$i]['name'], $size, 255, $myts->htmlspecialchars($config[$i]['value']));
                    if ($config[$i]['valuetype'] === 'int') {
                        $ele->setExtra(' style="text-align:right;"');
                    }
                    break;
            }
            $ele_tray = new XoopsFormElementTray($title4tray, '');
            $ele_tray->addElement($ele);
            $form->addElement($ele_tray);
            if ($description) {
                $form->insertBreak('<span style="font-weight:normal;">' . $description . '</span>', 'odd');
            }
            unset($ele_tray);
            unset($ele);
        }
        $button_tray->addElement(new XoopsFormHidden('op', 'save'));
        $button_tray->addElement(new XoopsFormHidden('page', $page));
        $xoopsGTicket->addTicketXoopsFormElement($button_tray, __LINE__, 1800, 'hypconf');
        $button_tray->addElement(new XoopsFormButton('', 'button', _GO, 'submit'));
        $form->addElement($button_tray);
        $form->display();
    }
}
コード例 #14
0
ファイル: admin_func.php プロジェクト: nao-pon/HypCommon
function hypconfShowForm($config)
{
    global $constpref, $mydirname, $mydirpath, $mytrustdirpath, $page, $xoopsConfig, $xoopsGTicket;
    if (!$config) {
        die('no configs');
    }
    if (isset($config['error'])) {
        echo '<div class="error">' . join('</div><div class="error">', $config['error']) . '</div>';
        unset($config['error']);
    }
    if (isset($config['contents'])) {
        echo $config['contents'];
        unset($config['contents']);
    }
    $underContents = '';
    if (isset($config['underContents'])) {
        $underContents = $config['underContents'];
        unset($config['underContents']);
    }
    if ($config) {
        $count = count($config);
        include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
        include_once dirname(dirname(__FILE__)) . '/class/formcheckbox.php';
        if (!XC_CLASS_EXISTS('XoopsFormBreak')) {
            include_once dirname(dirname(__FILE__)) . '/class/formbreak.php';
        }
        $form = new XoopsThemeForm(hypconf_constant($constpref . '_ADMENU_' . strtoupper($page)), 'pref_form', 'index.php');
        $button_tray = new XoopsFormElementTray("");
        for ($i = 0; $i < $count; $i++) {
            $description = defined($config[$i]['description']) ? constant($config[$i]['description']) : '';
            //$title4tray = (!$description) ? hypconf_constant($config[$i]['title']) : hypconf_constant($config[$i]['title']).'<br /><br /><span style="font-weight:normal;">'.hypconf_constant($config[$i]['description']).'</span>'; // GIJ
            $title4tray = hypconf_constant($config[$i]['title']);
            $title = '';
            // GIJ
            switch ($config[$i]['formtype']) {
                case 'textarea':
                    (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || ($myts =& MyTextSanitizer::getInstance());
                    if ($config[$i]['valuetype'] == 'array') {
                        // this is exceptional.. only when value type is arrayneed a smarter way for this
                        $ele = $config[$i]['value'] != '' ? new XoopsFormTextArea($title, $config[$i]['name'], $myts->htmlspecialchars(implode('|', $config[$i]['value'], _CHARSET)), 5, 50) : new XoopsFormTextArea($title, $config[$i]['name'], '', 5, 50);
                    } else {
                        $ele = new XoopsFormTextArea($title, $config[$i]['name'], $myts->htmlspecialchars($config[$i]['value'], ENT_COMPAT, _CHARSET), 5, 50);
                        $ele->setExtra('class="norich plain" spellcheck="false"');
                    }
                    break;
                case 'select':
                    $size = 1;
                    if (!empty($config[$i]['size'])) {
                        $size = $config[$i]['size'];
                    }
                    $ele = new XoopsFormSelect($title, $config[$i]['name'], $config[$i]['value'], $size);
                    $options = $config[$i]['options'];
                    $opcount = count($options);
                    //var_dump($options);
                    foreach ($options as $option) {
                        if (isset($option['confop_value']) && isset($option['confop_name'])) {
                            $optval = defined($option['confop_value']) ? constant($option['confop_value']) : $option['confop_value'];
                            $optkey = defined($option['confop_name']) ? constant($option['confop_name']) : $option['confop_name'];
                        } else {
                            $optval = $optkey = $option;
                        }
                        $ele->addOption($optval, $optkey);
                    }
                    break;
                case 'select_multi':
                    $size = 5;
                    if (!empty($config[$i]['size'])) {
                        $size = $config[$i]['size'];
                    }
                    $ele = new XoopsFormSelect($title, $config[$i]['name'], $config[$i]['value'], $size, true);
                    $options = $config[$i]['options'];
                    foreach ($options as $option) {
                        $optval = defined($option['confop_value']) ? constant($option['confop_value']) : $option['confop_value'];
                        $optkey = defined($option['confop_name']) ? constant($option['confop_name']) : $option['confop_name'];
                        $ele->addOption($optval, $optkey);
                    }
                    break;
                case 'check':
                    $ele = new HypconfFormCheckBox($title, $config[$i]['name'], $config[$i]['value']);
                    if (!empty($config[$i]['width'])) {
                        //$ele->setWidth($config[$i]['width']);
                    }
                    $options = $config[$i]['options'];
                    foreach ($options as $option) {
                        $optval = defined($option['confop_value']) ? hypconf_constant($option['confop_value']) : $option['confop_value'];
                        $optkey = defined($option['confop_name']) ? hypconf_constant($option['confop_name']) : $option['confop_name'];
                        $ele->addOption($optval, $optkey);
                    }
                    break;
                case 'radio':
                    $ele = new XoopsFormRadio($title, $config[$i]['name'], $config[$i]['value']);
                    if (!empty($config[$i]['width'])) {
                        //$ele->setWidth($config[$i]['width']);
                    }
                    $options = $config[$i]['options'];
                    foreach ($options as $option) {
                        $optval = defined($option['confop_value']) ? hypconf_constant($option['confop_value']) : $option['confop_value'];
                        $optkey = defined($option['confop_name']) ? hypconf_constant($option['confop_name']) : $option['confop_name'];
                        $ele->addOption($optval, $optkey);
                    }
                    break;
                case 'yesno':
                    $ele = new XoopsFormRadioYN($title, $config[$i]['name'], $config[$i]['value'], _YES, _NO);
                    break;
                case 'password':
                    $size = 50;
                    if (!empty($config[$i]['size'])) {
                        $size = $config[$i]['size'];
                    }
                    (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || ($myts =& MyTextSanitizer::getInstance());
                    $ele = new XoopsFormPassword($title, $config[$i]['name'], $size, 255, $myts->htmlspecialchars($config[$i]['value'], ENT_COMPAT, _CHARSET));
                    break;
                case 'label':
                    $ele = new XoopsFormLabel($title, $description);
                    $description = '';
                    break;
                case 'theme':
                case 'theme_multi':
                    $ele = $config[$i]['formtype'] !== 'theme_multi' ? new XoopsFormSelect($title, $config[$i]['name'], $config[$i]['value']) : new XoopsFormSelect($title, $config[$i]['name'], $config[$i]['value'], 5, true);
                    $handle = opendir(XOOPS_THEME_PATH . '/');
                    $dirlist = array();
                    while (false !== ($file = readdir($handle))) {
                        if (is_dir(XOOPS_THEME_PATH . '/' . $file) && !preg_match("/^\\..*\$/", $file) && strtolower($file) != 'cvs') {
                            $dirlist[$file] = $file;
                        }
                    }
                    closedir($handle);
                    $ele->addOption('', hypconf_constant($constpref . '_NOT_SPECIFY'));
                    if (!empty($dirlist)) {
                        asort($dirlist);
                        $ele->addOptionArray($dirlist);
                    }
                    break;
                case 'tplset':
                    $ele = new XoopsFormSelect($title, $config[$i]['name'], $config[$i]['value']);
                    $tplset_handler =& xoops_gethandler('tplset');
                    $tplsetlist =& $tplset_handler->getList();
                    asort($tplsetlist);
                    $ele->addOption('', hypconf_constant($constpref . '_NOT_SPECIFY'));
                    foreach ($tplsetlist as $key => $name) {
                        $ele->addOption($key, htmlspecialchars($name, ENT_QUOTES, _CHARSET));
                    }
                    break;
                case 'textbox':
                default:
                    $size = 50;
                    if (!empty($config[$i]['size'])) {
                        $size = $config[$i]['size'];
                    }
                    (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || ($myts =& MyTextSanitizer::getInstance());
                    $ele = new XoopsFormText($title, $config[$i]['name'], $size, 255, $myts->htmlspecialchars($config[$i]['value'], ENT_COMPAT, _CHARSET));
                    if ($config[$i]['valuetype'] === 'int') {
                        $ele->setExtra(' style="text-align:right;"');
                    }
                    break;
            }
            $ele_tray = new XoopsFormElementTray($title4tray, '');
            $ele_tray->addElement($ele);
            $form->addElement($ele_tray);
            if ($description) {
                $form->insertBreak('<span style="font-weight:normal;">' . $description . '</span>', 'odd');
            }
            unset($ele_tray);
            unset($ele);
        }
        $button_tray->addElement(new XoopsFormHidden('op', 'save'));
        $button_tray->addElement(new XoopsFormHidden('page', $page));
        $xoopsGTicket->addTicketXoopsFormElement($button_tray, __LINE__, 1800, 'hypconf');
        $button_tray->addElement(new XoopsFormButton('', 'button', _GO, 'submit'));
        $form->addElement($button_tray);
        $form->display();
    }
    if ($underContents) {
        echo '<div>' . $underContents . '</div>';
    }
}
コード例 #15
0
ファイル: pmlite.php プロジェクト: severnaya99/Sg-2010
 //form
 $form = new XoopsThemeForm(_MP_READMSG, "read", $_SERVER['PHP_SELF']);
 $form->setExtra("enctype='multipart/form-data'");
 $user_select_tray = new XoopsFormLabel(_MP_TO2, XoopsUser::getUnameFromId($to_userid));
 $texte_hidden = new XoopsFormHidden("to_userid", $to_userid);
 $form->addElement($user_select_tray);
 $form->addElement($texte_hidden);
 $icons_radio = new XoopsFormRadio(_MP_MESSAGEICON, 'icon');
 $subject_icons = XoopsLists::getSubjectsList();
 foreach ($subject_icons as $iconfile) {
     $icons_radio->addOption($iconfile, '<img src="' . XOOPS_URL . '/images/subject/' . $iconfile . '" alt="" />');
 }
 $form->addElement($icons_radio);
 if ($view_perms & GPERM_OEIL) {
     $indeximage_select = new XoopsFormText('', 'anim_msg', 25, 50);
     $indeximage_select->setExtra("readonly=\"readonly\" ");
     $indeximage_tray = new XoopsFormElementTray(_MP_MESSAGEOEIL, '&nbsp;');
     $indeximage_tray->addElement($indeximage_select);
     $indeximage_tray->addElement(new XoopsFormLabel('', "<A HREF=\"#\" onClick=\"window.open('" . XOOPS_URL . "/modules/mpmanager/pop.php','_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=0, copyhistory=0, menuBar=0, width=700, height=400');return false;\"><img src=\"" . XOOPS_URL . "/modules/mpmanager/images/popup.gif\">&nbsp;" . _MP_MESSAGEVUOEIL . "</A>"));
     $form->addElement($indeximage_tray);
 }
 $form->addElement(new XoopsFormText(_MP_SUBJECTC, "subject", 50, 100), true);
 $editor = WysiwygForm(_MP_MESSAGEC, "message", '', '100%', '400px', $formtype);
 $editor->setDescription(sprintf($deschtml));
 $form->addElement($editor);
 //upload
 if ($view_perms & GPERM_UP) {
     $indeximage_up = new XoopsFormFile('', 'fileup', $xoopsModuleConfig['mimemax']);
     $indeximage_uptray = new XoopsFormElementTray(_MP_MIMEFILE, '&nbsp;');
     $indeximage_uptray->addElement($indeximage_up);
     $indeximage_uptray->addElement(new XoopsFormLabel('', '<br />' . _MP_MIMETYPE2 . mp_mimetypes() . '<br />' . _MP_MIME . sprintf(_MD_NUMBYTES, $xoopsModuleConfig['mimemax'])));
コード例 #16
0
ファイル: index.php プロジェクト: jjdai/tellafriend
//JJD - Modif pour adapter la largeur des champs - 11/02/2016
$_GET['target_uri'] = str_replace('__protocole__', "http", $_GET['target_uri']);
$comment = empty($_GET['target_uri']) ? '' : sprintf("%1\$s\n%2\$s\n\n%3\$s", $xoopsModuleConfig['message_header'] == '' ? _MI_TAF_MSG_HEADER_DEFAUT : $xoopsModuleConfig['message_header'], $myts->stripSlashesGPC($_GET['target_uri']), $xoopsModuleConfig['message_footer'] == '' ? _MI_TAF_MSG_FOOTER_DEFAUT : $xoopsModuleConfig['message_footer']);
$comment4show = htmlspecialchars($comment, ENT_QUOTES);
$styleWidth = "style='width:{$xoopsModuleConfig['form_style_width']};'";
if (!is_object($xoopsUser)) {
    $fromname_text = new XoopsFormText(_MI_TAF_FORMTHFROMNAME, "fromName", 30, 100, '');
    $fromname_text->setExtra($styleWidth);
    $fromemail_text = new XoopsFormText(_MI_TAF_FORMTHFROMEMAIL, "fromEmail", 40, 100, '');
    $fromemail_text->setExtra($styleWidth);
    $_SESSION['usersSubject'] = $subject;
    $subject_text = new XoopsFormLabel(_MI_TAF_FORMTHSUBJ, $subject4show);
    $subject_text->setExtra($styleWidth);
} else {
    $subject_text = new XoopsFormText(_MI_TAF_FORMTHSUBJ, "usersSubject", 50, 100, $subject4show);
    $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);