本文整理汇总了PHP中CFormList::addVar方法的典型用法代码示例。如果您正苦于以下问题:PHP CFormList::addVar方法的具体用法?PHP CFormList::addVar怎么用?PHP CFormList::addVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFormList
的用法示例。
在下文中一共展示了CFormList::addVar方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CFormList
}
}
$divTabs->addTab('hostTab', _('Host'), $hostList);
// templates
$tmplList = new CFormList('tmpllist');
// create linked template table
$linkedTemplateTable = new CTable(_('No templates linked.'), 'formElementTable');
$linkedTemplateTable->attr('id', 'linkedTemplateTable');
$linkedTemplates = API::Template()->get(array('templateids' => $templateIds, 'output' => array('templateid', 'name')));
CArrayHelper::sort($linkedTemplates, array('name'));
// templates for normal hosts
if (!$isDiscovered) {
$linkedTemplateTable->setHeader(array(_('Name'), _('Action')));
$ignoredTemplates = array();
foreach ($linkedTemplates as $template) {
$tmplList->addVar('templates[]', $template['templateid']);
$linkedTemplateTable->addRow(array($template['name'], array(new CSubmit('unlink[' . $template['templateid'] . ']', _('Unlink'), null, 'link_menu'), SPACE, SPACE, isset($original_templates[$template['templateid']]) ? new CSubmit('unlink_and_clear[' . $template['templateid'] . ']', _('Unlink and clear'), null, 'link_menu') : SPACE)), null, 'conditions_' . $template['templateid']);
$ignoredTemplates[$template['templateid']] = $template['name'];
}
$tmplList->addRow(_('Linked templates'), new CDiv($linkedTemplateTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
// create new linked template table
$newTemplateTable = new CTable(null, 'formElementTable');
$newTemplateTable->attr('id', 'newTemplateTable');
$newTemplateTable->attr('style', 'min-width: 400px;');
$newTemplateTable->addRow(array(new CMultiSelect(array('name' => 'add_templates[]', 'objectName' => 'templates', 'ignored' => $ignoredTemplates))));
$newTemplateTable->addRow(array(new CSubmit('add_template', _('Add'), null, 'link_menu')));
$tmplList->addRow(_('Link new templates'), new CDiv($newTemplateTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
} else {
$linkedTemplateTable->setHeader(array(_('Name')));
foreach ($linkedTemplates as $template) {
$linkedTemplateTable->addRow(array($template['name']), null, 'conditions_' . $template['templateid']);
示例2: CForm
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
$action = 'screenedit.php?form=update&screenid=' . get_request('screenid');
if (isset($_REQUEST['screenitemid'])) {
$action .= '&screenitemid=' . get_request('screenitemid');
}
// create screen form
$screenForm = new CForm('post', $action);
$screenForm->setName('screen_item_form');
// create screen form list
$screenFormList = new CFormList('screenFormList');
$screenFormList->addVar('screenid', $_REQUEST['screenid']);
if (isset($_REQUEST['screenitemid'])) {
$screenFormList->addVar('screenitemid', $_REQUEST['screenitemid']);
$screenItems = zbx_toHash($this->data['screen']['screenitems'], 'screenitemid');
} else {
$screenFormList->addVar('x', $_REQUEST['x']);
$screenFormList->addVar('y', $_REQUEST['y']);
}
if (isset($_REQUEST['screenitemid']) && !isset($_REQUEST['form_refresh'])) {
$screenItem = $screenItems[$_REQUEST['screenitemid']];
$resourceType = $screenItem['resourcetype'];
$resourceId = $screenItem['resourceid'];
$width = $screenItem['width'];
$height = $screenItem['height'];
$colspan = $screenItem['colspan'];
$rowspan = $screenItem['rowspan'];
示例3: CDiv
$buttonRow->addItem($buttonColumn);
$customGroupTable->addRow($buttonRow);
$groupDiv = new CDiv($customGroupTable, 'objectgroup border_dotted ui-corner-all group-prototypes');
$groupList->addRow(_('Group prototypes'), $groupDiv);
$divTabs->addTab('groupTab', _('Groups'), $groupList);
// templates
$tmplList = new CFormList('tmpllist');
// create linked template table
$linkedTemplateTable = new CTable(_('No templates linked.'), 'formElementTable');
$linkedTemplateTable->attr('id', 'linkedTemplateTable');
$linkedTemplateTable->attr('style', 'min-width: 400px;');
$linkedTemplateTable->setHeader(array(_('Name'), _('Action')));
$ignoreTemplates = array();
if ($hostPrototype['templates']) {
foreach ($hostPrototype['templates'] as $template) {
$tmplList->addVar('templates[' . $template['templateid'] . ']', $template['templateid']);
$linkedTemplateTable->addRow(array($template['name'], !$hostPrototype['templateid'] ? new CSubmit('unlink[' . $template['templateid'] . ']', _('Unlink'), null, 'link_menu') : ''));
$ignoreTemplates[$template['templateid']] = $template['name'];
}
$tmplList->addRow(_('Linked templates'), new CDiv($linkedTemplateTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
} elseif ($hostPrototype['templateid']) {
$tmplList->addRow(_('No templates linked.'));
}
// create new linked template table
if (!$hostPrototype['templateid']) {
$newTemplateTable = new CTable(null, 'formElementTable');
$newTemplateTable->attr('id', 'newTemplateTable');
$newTemplateTable->attr('style', 'min-width: 400px;');
$newTemplateTable->addRow(array(new CMultiSelect(array('name' => 'add_templates[]', 'objectName' => 'templates', 'ignored' => $ignoreTemplates))));
$newTemplateTable->addRow(array(new CSubmit('add_template', _('Add'), null, 'link_menu')));
$tmplList->addRow(_('Link new templates'), new CDiv($newTemplateTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
示例4: CListBox
$cmbIPMIAuthtype = new CListBox('ipmi_authtype', $data['ipmi_authtype'], 7, null, ipmiAuthTypes());
$cmbIPMIPrivilege = new CListBox('ipmi_privilege', $data['ipmi_privilege'], 5, null, ipmiPrivileges());
} else {
$cmbIPMIAuthtype = [(new CTextBox('ipmi_authtype_name', ipmiAuthTypes($data['ipmi_authtype']), true))->setWidth(ZBX_TEXTAREA_SMALL_WIDTH), new CVar('ipmi_authtype', $data['ipmi_authtype'])];
$cmbIPMIPrivilege = [(new CTextBox('ipmi_privilege_name', ipmiPrivileges($data['ipmi_privilege']), true))->setWidth(ZBX_TEXTAREA_SMALL_WIDTH), new CVar('ipmi_privilege', $data['ipmi_privilege'])];
}
$divTabs->addTab('ipmiTab', _('IPMI'), (new CFormList())->addRow(_('Authentication algorithm'), $cmbIPMIAuthtype)->addRow(_('Privilege level'), $cmbIPMIPrivilege)->addRow(_('Username'), (new CTextBox('ipmi_username', $data['ipmi_username'], $data['flags'] == ZBX_FLAG_DISCOVERY_CREATED))->setWidth(ZBX_TEXTAREA_SMALL_WIDTH))->addRow(_('Password'), (new CTextBox('ipmi_password', $data['ipmi_password'], $data['flags'] == ZBX_FLAG_DISCOVERY_CREATED))->setWidth(ZBX_TEXTAREA_SMALL_WIDTH)));
/*
* Macros
*/
$macrosView = new CView('hostmacros', ['macros' => $data['macros'], 'show_inherited_macros' => $data['show_inherited_macros'], 'is_template' => false, 'readonly' => $data['flags'] == ZBX_FLAG_DISCOVERY_CREATED]);
$divTabs->addTab('macroTab', _('Macros'), $macrosView->render());
$inventoryFormList = new CFormList('inventorylist');
$inventoryFormList->addRow(null, (new CRadioButtonList('inventory_mode', (int) $data['inventory_mode']))->addValue(_('Disabled'), HOST_INVENTORY_DISABLED)->addValue(_('Manual'), HOST_INVENTORY_MANUAL)->addValue(_('Automatic'), HOST_INVENTORY_AUTOMATIC)->setEnabled($data['flags'] != ZBX_FLAG_DISCOVERY_CREATED)->setModern(true));
if ($data['flags'] == ZBX_FLAG_DISCOVERY_CREATED) {
$inventoryFormList->addVar('inventory_mode', $data['inventory_mode']);
}
$hostInventoryTable = DB::getSchema('host_inventory');
$hostInventoryFields = getHostInventories();
foreach ($hostInventoryFields as $inventoryNo => $inventoryInfo) {
$field_name = $inventoryInfo['db_field'];
if (!array_key_exists($field_name, $data['host_inventory'])) {
$data['host_inventory'][$field_name] = '';
}
if ($hostInventoryTable['fields'][$field_name]['type'] == DB::FIELD_TYPE_TEXT) {
$input = (new CTextArea('host_inventory[' . $field_name . ']', $data['host_inventory'][$field_name]))->setWidth(ZBX_TEXTAREA_BIG_WIDTH);
} else {
$field_length = $hostInventoryTable['fields'][$field_name]['length'];
if ($field_length < 39) {
$width = ZBX_TEXTAREA_SMALL_WIDTH;
} elseif ($field_length < 64) {