本文整理汇总了PHP中CSpan::addOption方法的典型用法代码示例。如果您正苦于以下问题:PHP CSpan::addOption方法的具体用法?PHP CSpan::addOption怎么用?PHP CSpan::addOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSpan
的用法示例。
在下文中一共展示了CSpan::addOption方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unset
/* $mediatype=get_mediatype_by_mediatypeid($_REQUEST["mediatypeid"]);*/
$result = delete_mediatype($_REQUEST["mediatypeid"]);
show_messages($result, S_MEDIA_TYPE_DELETED, S_MEDIA_TYPE_WAS_NOT_DELETED);
if ($result) {
/* add_audit(AUDIT_ACTION_DELETE,AUDIT_RESOURCE_MEDIA_TYPE,
"Media type [".$mediatype["description"]."]");
*/
unset($_REQUEST["form"]);
}
}
$form = new CForm();
$form->SetMethod('get');
$form->AddItem(new CButton("form", S_CREATE_MEDIA_TYPE));
$row_count = 0;
$numrows = new CSpan(null, 'info');
$numrows->addOption('name', 'numrows');
$header = get_table_header(array(S_CONFIGURATION_OF_MEDIA_TYPES_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
show_table_header($header, $form);
if (isset($_REQUEST["form"])) {
echo SBR;
insert_media_type_form();
} else {
$table = new CTableInfo(S_NO_MEDIA_TYPES_DEFINED);
$table->setHeader(array(make_sorting_link(S_TYPE, 'mt.type'), make_sorting_link(S_DESCRIPTION, 'mt.description'), S_DETAILS));
$result = DBselect('SELECT mt.* ' . ' FROM media_type mt' . ' WHERE ' . DBin_node('mt.mediatypeid') . order_by('mt.type,mt.description'));
while ($row = DBfetch($result)) {
switch ($row['type']) {
case MEDIA_TYPE_EMAIL:
$details = S_SMTP_SERVER . ": '" . $row['smtp_server'] . "', " . S_SMTP_HELO . ": '" . $row['smtp_helo'] . "', " . S_SMTP_EMAIL . ": '" . $row['smtp_email'] . "'";
break;
case MEDIA_TYPE_EXEC:
示例2: make_latest_issues
function make_latest_issues($params = array())
{
global $USER_DETAILS;
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY);
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, array());
$scripts_by_hosts = get_accessible_scripts_by_hosts($available_hosts);
$config = select_config();
$sql_select = '';
$sql_from = '';
$sql_where = '';
$limit = 20;
if (!empty($params)) {
if (isset($params['limit'])) {
$limit = $params['limit'];
}
if (isset($params['groupid']) && $params['groupid'] > 0) {
$sql_select .= ',g.name ';
$sql_from .= ',groups g ';
$sql_where .= ' AND g.groupid=hg.groupid ' . ' AND hg.groupid=' . $params['groupid'];
}
if (isset($params['hostid']) && $params['hostid'] > 0) {
$sql_where .= ' AND h.hostid=' . $params['hostid'];
}
}
$table = new CTableInfo();
$table->setHeader(array(is_show_subnodes() ? S_NODE : null, isset($params['groupid']) && $params['groupid'] > 0 ? S_GROUP : null, S_HOST, S_ISSUE, S_LAST_CHANGE, S_AGE, $config['event_ack_enable'] ? S_ACK : NULL, S_ACTIONS));
$sql = 'SELECT DISTINCT t.triggerid,t.status,t.description,t.expression,t.priority,t.lastchange,t.value,h.host,h.hostid ' . $sql_select . ' FROM triggers t,hosts h,items i,functions f,hosts_groups hg ' . $sql_from . ' WHERE f.itemid=i.itemid ' . ' AND h.hostid=i.hostid ' . ' AND hg.hostid=h.hostid ' . ' AND t.triggerid=f.triggerid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND ' . DBcondition('t.triggerid', $available_triggers) . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND t.value=' . TRIGGER_VALUE_TRUE . $sql_where . ' ORDER BY t.lastchange DESC';
$result = DBselect($sql, $limit);
while ($row = DBfetch($result)) {
// Check for dependencies
if (trigger_dependent($row["triggerid"])) {
continue;
}
$host = null;
$menus = '';
$host_nodeid = id2nodeid($row['hostid']);
foreach ($scripts_by_hosts[$row['hostid']] as $id => $script) {
$script_nodeid = id2nodeid($script['scriptid']);
if (bccomp($host_nodeid, $script_nodeid) == 0) {
$menus .= "['" . $script['name'] . "',\"javascript: openWinCentered('scripts_exec.php?execute=1&hostid=" . $row['hostid'] . "&scriptid=" . $script['scriptid'] . "','" . S_TOOLS . "',760,540,'titlebar=no, resizable=yes, scrollbars=yes, dialog=no');\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
}
}
$menus .= "[" . zbx_jsvalue(S_LINKS) . ",null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
$menus .= "['" . S_LATEST_DATA . "',\"javascript: redirect('latest.php?hostid=" . $row['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
$menus = rtrim($menus, ',');
$menus = "show_popup_menu(event,[[" . zbx_jsvalue(S_TOOLS) . ",null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}]," . $menus . "],180);";
$host = new CSpan($row['host']);
$host->addOption('onclick', 'javascript: ' . $menus);
$host->addOption('onmouseover', "javascript: this.style.cursor = 'pointer';");
$event_sql = 'SELECT e.eventid, e.value, e.clock, e.objectid as triggerid, e.acknowledged, t.type, t.url ' . ' FROM events e, triggers t ' . ' WHERE e.object=' . EVENT_SOURCE_TRIGGERS . ' AND e.objectid=' . $row['triggerid'] . ' AND t.triggerid=e.objectid ' . ' AND e.value=' . TRIGGER_VALUE_TRUE . ' ORDER by e.object DESC, e.objectid DESC, e.eventid DESC';
$res_events = DBSelect($event_sql, 1);
while ($row_event = DBfetch($res_events)) {
$ack = NULL;
if ($config['event_ack_enable']) {
if ($row_event['acknowledged'] == 1) {
$ack_info = make_acktab_by_eventid($row_event['eventid']);
$ack_info->addOption('style', 'width: auto;');
$ack = new CLink(S_YES, 'acknow.php?eventid=' . $row_event['eventid'], 'action');
$ack->setHint($ack_info);
} else {
$ack = new CLink(S_NO, 'acknow.php?eventid=' . $row_event['eventid'], 'on');
}
}
// $description = expand_trigger_description($row['triggerid']);
$description = expand_trigger_description_by_data(array_merge($row, array('clock' => $row_event['clock'])), ZBX_FLAG_EVENT);
//actions
$actions = get_event_actions_stat_hints($row_event['eventid']);
//--------
$clock = new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS, $row_event['clock']), 'events.php?triggerid=' . $row['triggerid'] . '&source=0&nav_time=' . $row['lastchange'], 'action');
$description = $row_event['url'] ? new CLink($description, $row_event['url'], 'action', null, true) : $description;
$table->addRow(array(get_node_name_by_elid($row['triggerid']), $host, new CCol($description, get_severity_style($row["priority"])), $clock, zbx_date2age($row_event['clock']), $ack, $actions));
}
unset($row, $description, $actions, $alerts, $hint);
}
$table->setFooter(new CCol(S_UPDATED . ': ' . date("H:i:s", time())));
return $table;
}
示例3: foreach
$triggers[$row['triggerid']]['items'][$row['itemid']] = $item;
}
foreach ($triggers as $triggerid => $row) {
$description = expand_trigger_description_by_data($row);
$menus = '';
$host_nodeid = id2nodeid($row['hostid']);
foreach ($scripts_by_hosts[$row['hostid']] as $id => $script) {
$script_nodeid = id2nodeid($script['scriptid']);
if (bccomp($host_nodeid, $script_nodeid) == 0) {
$menus .= "['" . $script['name'] . "',\"javascript: openWinCentered('scripts_exec.php?execute=1&hostid=" . $row['hostid'] . "&scriptid=" . $script['scriptid'] . "','" . S_TOOLS . "',760,540,'titlebar=no, resizable=yes, scrollbars=yes, dialog=no');\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
}
}
$menus .= "[" . zbx_jsvalue(S_LINKS) . ",null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
$menus .= "['" . S_LATEST_DATA . "',\"javascript: redirect('latest.php?hostid=" . $row['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
$menus = rtrim($menus, ',');
$menus = "show_popup_menu(event,[[" . zbx_jsvalue(S_TOOLS) . ",null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}]," . $menus . "],180);";
$host = new CSpan($row['host']);
$host->addOption('onclick', 'javascript: ' . $menus);
$host->addOption('onmouseover', "javascript: this.style.cursor = 'pointer';");
$tr_conf_link = 'null';
if ($USER_DETAILS['type'] > USER_TYPE_ZABBIX_USER) {
$tr_conf_link = "['" . S_CONFIGURATION_OF_TRIGGERS . "',\"javascript: redirect('triggers.php?form=update&triggerid=" . $row['triggerid'] . "&hostid=" . $row['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}]";
}
$tr_desc = new CSpan($description, 'pointer');
$tr_desc->addAction('onclick', "create_mon_trigger_menu(event, " . " new Array({'triggerid': '" . $row['triggerid'] . "', 'lastchange': '" . $row['lastchange'] . "'}," . $tr_conf_link . ")," . zbx_jsvalue($row['items']) . ");");
$table->addRow(array(get_node_name_by_elid($row['triggerid']), $host, $tr_desc, new CCol(get_severity_description($row['priority']), get_severity_style($row['priority'])), $row['cnt_event']));
}
$table->show();
$jsmenu = new CPUMenu(null, 170);
$jsmenu->InsertJavaScript();
include_once 'include/page_footer.php';
示例4: 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"])) {
//.........这里部分代码省略.........
示例5: foreach
$host_nodeid = id2nodeid($row['hostid']);
foreach ($scripts_by_hosts[$row['hostid']] as $id => $script) {
$script_nodeid = id2nodeid($script['scriptid']);
if (bccomp($host_nodeid, $script_nodeid) == 0) {
$menus .= "['" . $script['name'] . "',\"javascript: openWinCentered('scripts_exec.php?execute=1&hostid=" . $row['hostid'] . "&scriptid=" . $script['scriptid'] . "','" . S_TOOLS . "',760,540,'titlebar=no, resizable=yes, scrollbars=yes, dialog=no');\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
}
}
$menus .= "[" . zbx_jsvalue(S_LINKS) . ",null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
$menus .= "['" . S_LATEST_DATA . "',\"javascript: redirect('latest.php?hostid=" . $row['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
if ($admin_links) {
// $menus.= "['".S_HOST_CONFIGURATION."',\"javascript: redirect('hosts.php?form=update&hostid=".$row['hostid']."')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
}
$menus = rtrim($menus, ',');
$menus = "show_popup_menu(event,[[" . zbx_jsvalue(S_TOOLS) . ",null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}]," . $menus . "],180);";
$host = new CSpan($row['host'], 'pointer');
$host->addOption('onclick', 'javascript: ' . $menus);
}
$tr_conf_link = 'null';
if ($admin_links) {
$tr_conf_link = "['" . S_CONFIGURATION_OF_TRIGGERS . "',\"javascript: redirect('triggers.php?form=update&triggerid=" . $row['triggerid'] . "&hostid=" . $row['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}]";
}
$tr_desc = new CSpan($description, 'pointer');
$tr_desc->addAction('onclick', "javascript: create_mon_trigger_menu(event, " . " new Array({'triggerid': '" . $row['triggerid'] . "', 'lastchange': '" . $row['lastchange'] . "'}, " . $tr_conf_link . ")," . zbx_jsvalue($row['items']) . ");");
//--
$table->addRow(array($show_event_col ? SPACE : NULL, new CCol(get_severity_description($row['priority']), get_severity_style($row['priority'], $row['value'])), $value, new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS, $row['lastchange']), 'events.php?triggerid=' . $row['triggerid'] . '&nav_time=' . $row['lastchange'], 'action'), get_node_name_by_elid($row['triggerid']), $host, $tr_desc, $actions, $show_event_col ? SPACE : NULL, new CLink(zbx_empty($row['comments']) ? S_ADD : S_SHOW, 'tr_comments.php?triggerid=' . $row['triggerid'], 'action')));
$event_limit = 0;
foreach ($row['events'] as $eventid => $row_event) {
$value = new CSpan(trigger_value2str($row_event['value']), get_trigger_value_style($row_event['value']));
if ($config['event_ack_enable']) {
if ($row_event['acknowledged'] == 1) {
$acks_cnt = DBfetch(DBselect('SELECT COUNT(*) as cnt FROM acknowledges WHERE eventid=' . $row_event['eventid']));