本文整理汇总了PHP中CButton::SetType方法的典型用法代码示例。如果您正苦于以下问题:PHP CButton::SetType方法的具体用法?PHP CButton::SetType怎么用?PHP CButton::SetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CButton
的用法示例。
在下文中一共展示了CButton::SetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DBfetch
$frmCnct->AddVar("linkid", $_REQUEST["linkid"]);
$db_link = DBfetch(DBselect('SELECT * FROM sysmaps_link_triggers WHERE linkid=' . $_REQUEST["linkid"] . ' AND triggerid=' . $_REQUEST['triggerid']));
$triggerid = $_REQUEST['triggerid'];
$drawtype = $db_link["drawtype"];
$color = $db_link["color"];
} else {
$triggerid = get_request("triggerid", 0);
$drawtype = get_request("drawtype", 0);
$color = get_request("color", 0);
}
$frmCnct->AddVar("triggerid", $triggerid);
/* START comboboxes preparations */
$cmbType = new CComboBox("drawtype", $drawtype);
foreach (map_link_drawtypes() as $i) {
$value = map_link_drawtype2str($i);
$cmbType->AddItem($i, $value);
}
$btnSelect = new CButton('btn1', S_SELECT, "return PopUp('popup.php?dstfrm=" . $frmCnct->GetName() . "&dstfld1=triggerid&dstfld2=trigger&srctbl=triggers&srcfld1=triggerid&srcfld2=description');", 'T');
$btnSelect->SetType('button');
/* END preparation */
$description = $triggerid > 0 ? expand_trigger_description($triggerid) : '';
$frmCnct->AddRow(S_TRIGGER, array(new CTextBox('trigger', $description, 70, 'yes'), SPACE, $btnSelect));
$frmCnct->AddRow(S_TYPE . ' (' . S_PROBLEM_BIG . ')', $cmbType);
$frmCnct->AddRow(S_COLOR . ' (' . S_PROBLEM_BIG . ')', new CColor('color', $color));
$frmCnct->AddItemToBottomRow(new CButton("save", isset($_REQUEST['triggerid']) ? S_SAVE : S_ADD));
$frmCnct->AddItemToBottomRow(SPACE);
$frmCnct->AddItemToBottomRow(new CButton("cancel", S_CANCEL, 'javascript: window.close();'));
$frmCnct->Show();
}
}
include_once "include/page_footer.php";
示例2: CScript
$script = new CScript("javascript: if(CLNDR['events_since'].clndr.setSDateFromOuterObj()){" . "\$('filter_timesince').value = parseInt(CLNDR['events_since'].clndr.sdt.getTime()/1000);}" . "if(CLNDR['events_till'].clndr.setSDateFromOuterObj()){" . "\$('filter_timetill').value = parseInt(CLNDR['events_till'].clndr.sdt.getTime()/1000);}");
$filterForm->AddAction('onsubmit', $script);
$filterForm->AddVar('triggerid', $_REQUEST['triggerid']);
if (isset($_REQUEST['triggerid']) && $_REQUEST['triggerid'] > 0) {
$trigger = expand_trigger_description($_REQUEST['triggerid']);
} else {
$trigger = "";
}
$row = new CRow(array(new CCol(S_TRIGGER, 'form_row_l'), new CCol(array(new CTextBox("trigger", $trigger, 96, 'yes'), new CButton("btn1", S_SELECT, "return PopUp('popup.php?" . "dstfrm=" . $filterForm->GetName() . "&dstfld1=triggerid&dstfld2=trigger" . "&srctbl=triggers&srcfld1=triggerid&srcfld2=description&real_hosts=1');", 'T')), 'form_row_r')));
$filterForm->AddRow($row);
$filterForm->AddVar('show_unknown', $show_unknown);
$unkcbx = new CCheckBox('show_unk', $show_unknown, null, '1');
$unkcbx->SetAction('javascript: create_var("' . $filterForm->GetName() . '", "show_unknown", (this.checked?1:0), 0); ');
$filterForm->AddRow(S_SHOW_UNKNOWN, $unkcbx);
$reset = new CButton("filter_rst", S_RESET);
$reset->SetType('button');
$reset->SetAction('javascript: var uri = new Curl(location.href); uri.setArgument("filter_rst",1); location.href = uri.getUrl();');
$filterForm->AddItemToBottomRow(new CButton("filter_set", S_FILTER));
$filterForm->AddItemToBottomRow($reset);
$p_elements[] = create_filter(S_FILTER, $navigation, $filterForm, 'tr_filter', get_profile('web.events.filter.state', 0));
} else {
$p_elements[] = get_thin_table_header(SPACE, $navigation);
}
//-------
$p_elements[] = $table;
$p_elements[] = get_thin_table_header(SPACE, $navigation);
$events_hat = create_hat($text, $p_elements, $fs_icon, 'hat_events', get_profile('web.events.hats.hat_events.state', 1));
$events_hat->Show();
$jsmenu = new CPUMenu(null, 170);
$jsmenu->InsertJavaScript();
include_once "include/page_footer.php";
示例3: insert_map_link_form
function insert_map_link_form()
{
$frmCnct = new CFormTable('New connector', 'sysmap.php');
$frmCnct->SetHelp('web.sysmap.connector.php');
$frmCnct->addVar('sysmapid', $_REQUEST['sysmapid']);
if (isset($_REQUEST['linkid']) && !isset($_REQUEST['form_refresh'])) {
$frmCnct->addVar('linkid', $_REQUEST['linkid']);
$db_links = DBselect('SELECT * FROM sysmaps_links WHERE linkid=' . $_REQUEST['linkid']);
$db_link = DBfetch($db_links);
$selementid1 = $db_link['selementid1'];
$selementid2 = $db_link['selementid2'];
$triggers = array();
$drawtype = $db_link['drawtype'];
$color = $db_link['color'];
$res = DBselect('SELECT * FROM sysmaps_link_triggers WHERE linkid=' . $_REQUEST['linkid']);
while ($rows = DBfetch($res)) {
$triggers[] = $rows;
}
} else {
if (isset($_REQUEST['linkid'])) {
$frmCnct->addVar('linkid', $_REQUEST['linkid']);
}
$selementid1 = get_request('selementid1', 0);
$selementid2 = get_request('selementid2', 0);
$triggers = get_request('triggers', array());
$drawtype = get_request('drawtype', 0);
$color = get_request('color', 0);
}
/* START comboboxes preparations */
$cmbElements1 = new CComboBox('selementid1', $selementid1);
$cmbElements2 = new CComboBox('selementid2', $selementid2);
$db_selements = DBselect('SELECT selementid,label,elementid,elementtype ' . ' FROM sysmaps_elements ' . ' WHERE sysmapid=' . $_REQUEST['sysmapid']);
while ($db_selement = DBfetch($db_selements)) {
$label = $db_selement['label'];
if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST) {
$db_host = get_host_by_hostid($db_selement['elementid']);
$label .= ':' . $db_host['host'];
} else {
if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_MAP) {
$db_map = get_sysmap_by_sysmapid($db_selement['elementid']);
$label .= ':' . $db_map['name'];
} else {
if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_TRIGGER) {
if ($db_selement['elementid'] > 0) {
$label .= ':' . expand_trigger_description($db_selement['elementid']);
}
} else {
if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST_GROUP) {
if ($db_selement['elementid'] > 0) {
$db_group = DBfetch(DBselect('SELECT name FROM groups WHERE groupid=' . $db_selement['elementid']));
$label .= ':' . $db_group['name'];
}
}
}
}
}
$cmbElements1->addItem($db_selement['selementid'], $label);
$cmbElements2->addItem($db_selement['selementid'], $label);
}
$cmbType = new CComboBox('drawtype', $drawtype);
foreach (map_link_drawtypes() as $i) {
$value = map_link_drawtype2str($i);
$cmbType->addItem($i, $value);
}
/* END preparation */
$frmCnct->addRow(S_ELEMENT_1, $cmbElements1);
$frmCnct->addRow(S_ELEMENT_2, $cmbElements2);
//trigger links
foreach ($triggers as $id => $trigger) {
if (isset($trigger['triggerid'])) {
$triggers[$id]['description'] = expand_trigger_description($trigger['triggerid']);
}
}
$table = new CTable();
$table->SetClass('tableinfo');
$table->setOddRowClass('even_row');
$table->setEvenRowClass('even_row');
$table->options['cellpadding'] = 3;
$table->options['cellspacing'] = 1;
$table->headerClass = 'header';
$table->footerClass = 'footer';
$table->SetHeader(array(new CCheckBox('all_triggers', null, "CheckAll('" . $frmCnct->GetName() . "','all_triggers','triggers');"), S_TRIGGERS, S_TYPE, S_COLOR));
$table->addOption('id', 'link_triggers');
foreach ($triggers as $id => $trigger) {
if (!isset($trigger['triggerid'])) {
continue;
}
$colorbox = new CSpan(SPACE . SPACE . SPACE);
$colorbox->addOption('style', 'text-decoration: none; outline-color: black; outline-style: solid; outline-width: 1px; background-color: #' . $trigger['color'] . ';');
$table->addRow(array(array(new CCheckBox('triggers[' . $trigger['triggerid'] . '][triggerid]', null, null, $trigger['triggerid']), new CVar('triggers[' . $trigger['triggerid'] . '][triggerid]', $trigger['triggerid'])), array(new CLink($trigger['description'], "javascript: openWinCentered('popup_link_tr.php?form=1&dstfrm=" . $frmCnct->GetName() . "&triggerid=" . $trigger['triggerid'] . url_param('linkid') . "','ZBX_Link_Indicator',560,260,'scrollbars=1, toolbar=0, menubar=0, resizable=0');"), new CVar('triggers[' . $trigger['triggerid'] . '][description]', $trigger['description'])), array(map_link_drawtype2str($trigger['drawtype']), new CVar('triggers[' . $trigger['triggerid'] . '][drawtype]', $trigger['drawtype'])), array($colorbox, new CVar('triggers[' . $trigger['triggerid'] . '][color]', $trigger['color']))));
}
$btnadd = new CButton('btn1', S_ADD, "javascript: openWinCentered('popup_link_tr.php?form=1&dstfrm=" . $frmCnct->GetName() . url_param('linkid') . "','ZBX_Link_Indicator',560,180,'scrollbars=1, toolbar=0, menubar=0, resizable=0');", 'T');
$btnRemove = new CButton('btn1', S_REMOVE, "javascript: remove_childs('" . $frmCnct->GetName() . "','triggers','tr');", 'T');
$btnadd->SetType('button');
$frmCnct->addRow(S_LINK_STATUS_INDICATORS, array($table, BR(), $btnadd, $btnRemove));
//----------
$frmCnct->addRow(S_TYPE . ' (' . S_OK_BIG . ')', $cmbType);
$frmCnct->addRow(S_COLOR . ' (' . S_OK_BIG . ')', new CColor('color', $color));
$frmCnct->addItemToBottomRow(new CButton("save_link", S_SAVE));
if (isset($_REQUEST["linkid"])) {
//.........这里部分代码省略.........
示例4: CCheckBox
$table->setHeader(array(new CCheckBox('all_child_services', null, "check_childs('" . $frmService->GetName() . "','childs','all_child_services');"), S_SERVICES, S_SOFT, S_TRIGGER));
$table->setAttribute('id', 'service_childs');
foreach ($childs as $id => $child) {
$prefix = null;
$trigger = '-';
$description = new CLink($child['name'], 'services_form.php?sform=1&serviceid=' . $child['serviceid'], 'action');
if (isset($child['triggerid']) && !empty($child['triggerid'])) {
$trigger = expand_trigger_description($child['triggerid']);
}
$table->AddRow(array(array(new CCheckBox('childs_to_del[' . $child['serviceid'] . '][serviceid]', null, null, $child['serviceid']), new CVar('childs[' . $child['serviceid'] . '][serviceid]', $child['serviceid'])), array($description, new CVar('childs[' . $child['serviceid'] . '][name]', $child['name'])), new CCheckBox('childs[' . $child['serviceid'] . '][soft]', isset($child['soft']) && !empty($child['soft']) ? 'checked' : 'no', null, isset($child['soft']) && !empty($child['soft']) ? 1 : 0), array($trigger, new CVar('childs[' . $child['serviceid'] . '][triggerid]', isset($child['triggerid']) ? $child['triggerid'] : ''))));
}
$cb = new CButton('add_child_service', S_ADD);
$cb->SetType('button');
$cb->SetAction("javascript: openWinCentered('services_form.php?cservices=1" . url_param('serviceid') . "','ZBX_Services_List',640,520,'scrollbars=1, toolbar=0, menubar=0, resizable=0');");
$cb2 = new CButton('del_child_service', S_REMOVE);
$cb2->SetType('button');
$cb2->SetAction("javascript: remove_childs('" . $frmService->GetName() . "','childs_to_del','tr');");
$frmService->AddRow(S_DEPENDS_ON, array($table, BR(), $cb, $cb2));
//----------
//--------------------------------------------- </LINK> -------------------------------------------
//algorithm
$cmbAlg = new CComboBox('algorithm', $algorithm);
foreach (array(SERVICE_ALGORITHM_MAX, SERVICE_ALGORITHM_MIN, SERVICE_ALGORITHM_NONE) as $val) {
$cmbAlg->AddItem($val, algorithm2str($val));
}
$frmService->AddRow(S_STATUS_CALCULATION_ALGORITHM, $cmbAlg);
//-------
//SLA
$frmService->AddRow(S_CALCULATE_SLA, new CCheckBox('showsla', $showsla, "javascript: display_element('sla_row');", 1));
$row = new CRow(array(new CCol(S_ACCEPTABLE_SLA_IN_PERCENT, 'form_row_l'), new CCol(new CTextBox("goodsla", $goodsla, 6), 'form_row_r')));
$row->setAttribute('style', $linktrigger == 1 ? '' : 'display: none;');