本文整理汇总了PHP中Form_Input::setWidth方法的典型用法代码示例。如果您正苦于以下问题:PHP Form_Input::setWidth方法的具体用法?PHP Form_Input::setWidth怎么用?PHP Form_Input::setWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Form_Input
的用法示例。
在下文中一共展示了Form_Input::setWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_row
function display_row($trc, $value, $fieldname, $type, $rowhelper, $description, $ewidth = null)
{
global $text, $group;
switch ($type) {
case "input":
$inpt = new Form_Input($fieldname . $trc, null, 'text', $value);
$inpt->setHelp($description);
if ($ewidth) {
$inpt->setWidth($ewidth);
}
$group->add($inpt);
break;
case "checkbox":
$group->add(new Form_Checkbox($fieldname . $trc, null, null, $value, 'ON'))->setHelp($description);
break;
case "password":
$group->add(new Form_Input($fieldname . $trc, null, 'password', $value))->setHelp($description);
break;
case "textarea":
$group->add(new Form_Textarea($fieldname . $trc, null, $value))->setHelp($description);
break;
case "select":
$options = array();
foreach ($rowhelper['options']['option'] as $rowopt) {
$options[$rowopt['value']] = $rowopt['name'];
}
$grp = new Form_Select($fieldname . $trc, null, $value, $options);
$grp->setHelp($description);
if ($ewidth) {
$grp->setWidth($ewidth);
}
$group->add($grp);
break;
case "interfaces_selection":
$size = $size ? "size=\"{$size}\"" : '';
$multiple = '';
if (isset($rowhelper['multiple'])) {
$multiple = "multiple";
}
echo "<select style='height:22px;' id='{$fieldname}{$trc}' name='{$fieldname}{$trc}' {$size} {$multiple}>\n";
$ifaces = get_configured_interface_with_descr();
$additional_ifaces = $rowhelper['add_to_interfaces_selection'];
if (!empty($additional_ifaces)) {
$ifaces = array_merge($ifaces, explode(',', $additional_ifaces));
}
if (is_array($value)) {
$values = $value;
} else {
$values = explode(',', $value);
}
$ifaces["lo0"] = "loopback";
$options = array();
$selected = array();
foreach ($ifaces as $ifname => $iface) {
$options[$ifname] = $iface;
if (in_array($ifname, $values)) {
array_push($selected, $ifname);
}
}
$group->add(new Form_Select($fieldname . $trc, null, $multiple ? $selected : $selected[0], $options, $multiple))->setHelp($description);
//echo "</select>\n";
break;
case "select_source":
$options = array();
$selected = array();
if (isset($rowhelper['show_disable_value'])) {
$options[$rowhelper['show_disable_value']] = $rowhelper['show_disable_value'];
}
$source_url = $rowhelper['source'];
eval("\$pkg_source_txt = &{$source_url};");
foreach ($pkg_source_txt as $opt) {
$source_name = $rowhelper['source_name'] ? $opt[$rowhelper['source_name']] : $opt[$rowhelper['name']];
$source_value = $rowhelper['source_value'] ? $opt[$rowhelper['source_value']] : $opt[$rowhelper['value']];
$options[$source_value] = $source_name;
if ($source_value == $value) {
array_push($selected, $value);
}
}
$group->add(new Form_Select($fieldname . $trc, null, $multiple ? $selected : $selected[0], $options, $multiple))->setHelp($description);
break;
}
}