本文整理汇总了PHP中explode_exp函数的典型用法代码示例。如果您正苦于以下问题:PHP explode_exp函数的具体用法?PHP explode_exp怎么用?PHP explode_exp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了explode_exp函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: triggerIdents
function triggerIdents($triggerids)
{
$idents = array();
$options = array('triggerids' => $triggerids, 'select_hosts' => array('hostid', 'host'), 'output' => API_OUTPUT_EXTEND, 'nodeids' => get_current_nodeid(true));
$triggers = CTrigger::get($options);
foreach ($triggers as $tnum => $trigger) {
$host = reset($trigger['hosts']);
$idents[$trigger['triggerid']] = array('node' => get_node_name_by_elid($host['hostid'], true), 'host' => $host['host'], 'description' => $trigger['description'], 'expression' => explode_exp($trigger['expression'], false));
}
return $idents;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:11,代码来源:ident.inc.php
示例2: CFormTable
}
}
//------------------------ <FORM> ---------------------------
if (hasRequest('sform')) {
$frmTRLog = new CFormTable(_('Trigger'), null, null, null, 'sform');
$frmTRLog->setName('sform');
$frmTRLog->addHelpIcon();
$frmTRLog->setTableClass('formlongtable formtable');
if (hasRequest('triggerid')) {
$frmTRLog->addVar('triggerid', getRequest('triggerid'));
}
if (hasRequest('triggerid') && !hasRequest('form_refresh')) {
$result = DBselect('SELECT t.expression,t.description,t.priority,t.comments,t.url,t.status,t.type' . ' FROM triggers t' . ' WHERE t.triggerid=' . zbx_dbstr(getRequest('triggerid')) . ' AND EXISTS (' . 'SELECT NULL' . ' FROM functions f,items i' . ' WHERE t.triggerid=f.triggerid' . ' AND f.itemid=i.itemid ' . ' AND i.value_type IN (' . ITEM_VALUE_TYPE_LOG . ',' . ITEM_VALUE_TYPE_TEXT . ',' . ITEM_VALUE_TYPE_STR . ')' . ')');
if ($row = DBfetch($result)) {
$description = $row['description'];
$expression = explode_exp($row['expression']);
$type = $row['type'];
$priority = $row['priority'];
$comments = $row['comments'];
$url = $row['url'];
$status = $row['status'];
}
// break expression into parts
$expressions = $constructor->getPartsFromExpression($expression);
} else {
$description = getRequest('description', '');
$expressions = getRequest('expressions', array());
$type = getRequest('type', 0);
$priority = getRequest('priority', 0);
$comments = getRequest('comments', '');
$url = getRequest('url', '');
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:tr_logform.php
示例3: make_trigger_details
function make_trigger_details($trigger)
{
$hosts = reset($trigger['hosts']);
$hostId = $hosts['hostid'];
$hosts = API::Host()->get(array('output' => array('name', 'hostid', 'status'), 'hostids' => $hostId, 'selectScreens' => API_OUTPUT_COUNT, 'preservekeys' => true));
$host = reset($hosts);
$scripts = API::Script()->getScriptsByHosts($hostId);
$hostName = new CSpan($host['name'], 'link_menu');
$hostName->setMenuPopup(getMenuPopupHost($host, $scripts ? reset($scripts) : null));
$table = new CTableInfo();
if (is_show_all_nodes()) {
$table->addRow(array(_('Node'), get_node_name_by_elid($trigger['triggerid'])));
}
$table->addRow(array(_('Host'), $hostName));
$table->addRow(array(_('Trigger'), CMacrosResolverHelper::resolveTriggerName($trigger)));
$table->addRow(array(_('Severity'), getSeverityCell($trigger['priority'])));
$table->addRow(array(_('Expression'), explode_exp($trigger['expression'], true, true)));
$table->addRow(array(_('Event generation'), _('Normal') . (TRIGGER_MULT_EVENT_ENABLED == $trigger['type'] ? SPACE . '+' . SPACE . _('Multiple PROBLEM events') : '')));
$table->addRow(array(_('Disabled'), TRIGGER_STATUS_ENABLED == $trigger['status'] ? new CCol(_('No'), 'off') : new CCol(_('Yes'), 'on')));
return $table;
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:21,代码来源:triggers.inc.php
示例4: update_profile
if (isset($_REQUEST['favobj'])) {
if ('hat' == $_REQUEST['favobj']) {
update_profile('web.tr_events.hats.' . $_REQUEST['favid'] . '.state', $_REQUEST['state'], PROFILE_TYPE_INT);
}
}
if (PAGE_TYPE_JS == $page['type'] || PAGE_TYPE_HTML_BLOCK == $page['type']) {
exit;
}
//--------
if (!check_right_on_trigger_by_triggerid(PERM_READ_ONLY, $_REQUEST["triggerid"])) {
access_deny();
}
$trigger_data = DBfetch(DBselect('SELECT h.host, t.* ' . ' FROM hosts h, items i, functions f, triggers t ' . ' WHERE i.itemid=f.itemid ' . ' AND f.triggerid=t.triggerid ' . ' AND t.triggerid=' . $_REQUEST["triggerid"] . ' AND h.hostid=i.hostid ' . ' AND ' . DBin_node('t.triggerid')));
$p_elements = array();
//Header
$trigger_data['exp_expr'] = explode_exp($trigger_data["expression"], 1);
$trigger_data['exp_desc'] = expand_trigger_description_by_data($trigger_data);
$text = array(S_EVENTS_BIG . ': "' . $trigger_data['exp_desc'] . '"');
$url = '?fullscreen=' . ($_REQUEST['fullscreen'] ? '0' : '1') . url_param('triggerid') . url_param('eventid');
$fs_icon = new CDiv(SPACE, 'fullscreen');
$fs_icon->addOption('title', $_REQUEST['fullscreen'] ? S_NORMAL . ' ' . S_VIEW : S_FULLSCREEN);
$fs_icon->addAction('onclick', new CScript("javascript: document.location = '" . $url . "';"));
//-------
$left_tab = new CTable();
$left_tab->setCellPadding(3);
$left_tab->setCellSpacing(3);
$left_tab->addOption('border', 0);
$left_tab->addRow(create_hat(S_EVENT . SPACE . S_SOURCE . SPACE . S_DETAILS, make_trigger_details($_REQUEST['triggerid'], $trigger_data), null, 'hat_triggerdetails'));
$left_tab->addRow(create_hat(S_EVENT_DETAILS, make_event_details($_REQUEST['eventid']), null, 'hat_eventdetails'));
$right_tab = new CTable();
$right_tab->setCellPadding(3);
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:tr_events.php
示例5: checkIfExistsOnHost
/**
* Checks that no trigger with the same description and expression as $trigger exist on the given host.
* Assumes the given trigger is valid.
*
* @throws APIException if at least one trigger exists
*
* @param array $trigger a trigger with an exploded expression
* @param null $hostid
*
* @return void
*/
protected function checkIfExistsOnHost(array $trigger, $hostId = null)
{
// skip the check if the description and expression haven't been changed
if (!isset($trigger['description']) && !isset($trigger['expression'])) {
return;
}
// make sure we have all the required data
if (!isset($trigger['description']) || !isset($trigger['expression'])) {
$explodeExpression = !isset($trigger['expression']);
$trigger = $this->extendObject($this->tableName(), $trigger, array('description', 'expression'));
if ($explodeExpression) {
$trigger['expression'] = explode_exp($trigger['expression']);
}
}
$filter = array('description' => $trigger['description']);
if ($hostId) {
$filter['hostid'] = $hostId;
} else {
$expressionData = new CTriggerExpression($trigger['expression']);
$expressionData->parse($trigger['expression']);
$expressionHosts = $expressionData->getHosts();
$filter['host'] = reset($expressionHosts);
}
$triggers = $this->get(array('filter' => $filter, 'output' => array('expression', 'triggerid'), 'nopermissions' => true));
foreach ($triggers as $dbTrigger) {
$tmpExp = explode_exp($dbTrigger['expression']);
// check if the expressions are also equal and that this is a different trigger
$differentTrigger = !isset($trigger['triggerid']) || !idcmp($trigger['triggerid'], $dbTrigger['triggerid']);
if (strcmp($tmpExp, $trigger['expression']) == 0 && $differentTrigger) {
$options = array('output' => array('name'), 'templated_hosts' => true, 'nopermissions' => true, 'limit' => 1);
if (isset($filter['host'])) {
$options['filter'] = array('host' => $filter['host']);
} else {
$options['hostids'] = $hostId;
}
$host = API::Host()->get($options);
$host = reset($host);
self::exception(ZBX_API_ERROR_PARAMETERS, _s('Trigger "%1$s" already exists on "%2$s".', $trigger['description'], $host['name']));
}
}
}
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:52,代码来源:CTriggerGeneral.php
示例6: syncTemplates
public function syncTemplates(array $data)
{
$data['templateids'] = zbx_toArray($data['templateids']);
$data['hostids'] = zbx_toArray($data['hostids']);
$triggers = $this->get(array('hostids' => $data['templateids'], 'preservekeys' => true, 'output' => array('triggerid', 'expression', 'description', 'url', 'status', 'priority', 'comments', 'type')));
foreach ($triggers as $trigger) {
$trigger['expression'] = explode_exp($trigger['expression']);
$this->inherit($trigger, $data['hostids']);
}
return true;
}
开发者ID:itnihao,项目名称:Zabbix_,代码行数:11,代码来源:CTriggerPrototype.php
示例7: array
}
if (PAGE_TYPE_JS == $page['type'] || PAGE_TYPE_HTML_BLOCK == $page['type']) {
include_once 'include/page_footer.php';
exit;
}
//--------
$options = array('triggerids' => $_REQUEST['triggerid'], 'output' => API_OUTPUT_EXTEND, 'select_hosts' => API_OUTPUT_EXTEND);
$trigger = CTrigger::get($options);
if (!$trigger) {
access_deny();
} else {
$trigger = reset($trigger);
$trigger['host'] = reset($trigger['hosts']);
$trigger['host'] = $trigger['host']['host'];
}
$trigger['exp_expr'] = explode_exp($trigger['expression'], 1, false, true);
$trigger['exp_desc'] = expand_trigger_description_by_data($trigger);
$tr_event_wdgt = new CWidget();
$tr_event_wdgt->setClass('header');
// Main widget header
$text = array(S_EVENTS_BIG . ': "' . $trigger['exp_desc'] . '"');
$fs_icon = get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen']));
$tr_event_wdgt->addHeader($text, $fs_icon);
//-------
$left_tab = new CTable();
$left_tab->setCellPadding(3);
$left_tab->setCellSpacing(3);
$left_tab->setAttribute('border', 0);
// tr details
$tr_dtl = new CWidget('hat_triggerdetails', make_trigger_details($_REQUEST['triggerid'], $trigger));
$tr_dtl->setClass('header');
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:tr_events.php
示例8: selectTriggers
/**
* Select trigger ids for previously added trigger names/expressions.
*/
protected function selectTriggers()
{
if (!empty($this->triggers)) {
$this->triggersRefs = array();
$dbTriggers = API::Trigger()->get(array('output' => array('triggerid', 'expression', 'description'), 'filter' => array('description' => array_keys($this->triggers), 'flags' => array(ZBX_FLAG_DISCOVERY_NORMAL, ZBX_FLAG_DISCOVERY_PROTOTYPE, ZBX_FLAG_DISCOVERY_CREATED)), 'editable' => true));
foreach ($dbTriggers as $dbTrigger) {
$dbTriggerExpression = explode_exp($dbTrigger['expression']);
if (isset($this->triggers[$dbTrigger['description']][$dbTriggerExpression])) {
$this->triggersRefs[$dbTrigger['description']][$dbTriggerExpression] = $dbTrigger['triggerid'];
}
}
}
}
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:16,代码来源:CImportReferencer.php
示例9: syncTemplates
public function syncTemplates($data)
{
$data['templateids'] = zbx_toArray($data['templateids']);
$data['hostids'] = zbx_toArray($data['hostids']);
$triggers = $this->get(array('hostids' => $data['templateids'], 'preservekeys' => true, 'output' => API_OUTPUT_EXTEND, 'selectDependencies' => true));
foreach ($triggers as $trigger) {
$trigger['expression'] = explode_exp($trigger['expression']);
$this->inherit($trigger, $data['hostids']);
}
return true;
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:11,代码来源:CTriggerPrototype.php
示例10: EndElement
//.........这里部分代码省略.........
$data['type'] = 0;
}
if (!isset($data['priority'])) {
$data['priority'] = 0;
}
if (!isset($data['status'])) {
$data['status'] = 0;
}
if (!isset($data['comments'])) {
$data['comments'] = '';
}
if (!isset($data['url'])) {
$data['url'] = '';
}
if (!isset($this->data[XML_TAG_HOST]['hostid']) || !$this->data[XML_TAG_HOST]['hostid']) {
if (isset($this->data[XML_TAG_HOST]['skip']) && $this->data[XML_TAG_HOST]['skip']) {
// remember skipped triggers for dependencies
$this->data[XML_TAG_DEPENDENCIES]['skip'][] = $this->data[XML_TAG_HOST]['name'] . ':' . $data['description'];
info('Trigger [' . $data['description'] . '] skipped - user rule for host');
break;
// case
}
if (zbx_strstr($data['expression'], '{HOSTNAME}')) {
// remember skipped triggers for dependencies
$this->data[XML_TAG_DEPENDENCIES]['skip'][] = $this->data[XML_TAG_HOST]['name'] . ':' . $data['description'];
error('Trigger [' . $data['description'] . '] skipped - missing host');
break;
// case
}
} else {
$data['expression'] = str_replace('{{HOSTNAME}:', '{' . $this->data[XML_TAG_HOST]['name'] . ':', $data['expression']);
$result = DBselect('SELECT DISTINCT t.triggerid,t.templateid,t.expression ' . ' FROM triggers t,functions f,items i ' . ' WHERE t.triggerid=f.triggerid ' . ' AND f.itemid=i.itemid' . ' AND i.hostid=' . $this->data[XML_TAG_HOST]['hostid'] . ' AND t.description=' . zbx_dbstr($data['description']));
while ($trigger = DBfetch($result)) {
if (explode_exp($trigger['expression'], 0) == $data['expression']) {
break;
// while
}
}
if (!empty($trigger)) {
/* exist */
if ($this->trigger['exist'] == 1) {
/* skip */
// remember skipped triggers for dependencies
$this->data[XML_TAG_DEPENDENCIES]['skip'][] = $this->data[XML_TAG_HOST]['name'] . ':' . $data['description'];
info('Trigger [' . $data['description'] . '] skipped - user rule');
break;
// case
}
update_trigger($trigger['triggerid'], $data['expression'], $data['description'], $data['type'], $data['priority'], $data['status'], $data['comments'], $data['url'], get_trigger_dependencies_by_triggerid($trigger['triggerid']), $trigger['templateid']);
break;
// case
} else {
/* missed */
// continue [add_trigger]
}
}
if ($this->trigger['missed'] == 1) {
// remember skipped triggers for dependencies
$this->data[XML_TAG_DEPENDENCIES]['skip'][] = $this->data[XML_TAG_HOST]['name'] . ':' . $data['description'];
info('Trigger [' . $data['description'] . '] skipped - user rule');
break;
// case
}
add_trigger($data['expression'], $data['description'], $data['type'], $data['priority'], $data['status'], $data['comments'], $data['url']);
break;
// case
开发者ID:phedders,项目名称:zabbix,代码行数:67,代码来源:import.inc.php
示例11: time
$now = time();
if (isset($_REQUEST['status'])) {
$status = TRIGGER_STATUS_DISABLED;
} else {
$status = TRIGGER_STATUS_ENABLED;
}
//if(isset($_REQUEST['type'])) { $type=TRIGGER_MULT_EVENT_ENABLED; }
//else{ $type=TRIGGER_MULT_EVENT_DISABLED; }
$type = TRIGGER_MULT_EVENT_ENABLED;
if (isset($_REQUEST['triggerid'])) {
$options = array('triggerids' => $_REQUEST['triggerid'], 'output' => API_OUTPUT_EXTEND, 'selectDependencies' => API_OUTPUT_REFER);
$triggersData = API::Trigger()->get($options);
$triggerData = reset($triggersData);
if ($triggerData['templateid']) {
$_REQUEST['description'] = $triggerData['description'];
$expression = explode_exp($triggerData['expression']);
}
$trigger = array();
$trigger['triggerid'] = $_REQUEST['triggerid'];
$trigger['expression'] = $expression;
$trigger['description'] = $_REQUEST['description'];
$trigger['type'] = $type;
$trigger['priority'] = $_REQUEST['priority'];
$trigger['status'] = $status;
$trigger['comments'] = $_REQUEST['comments'];
$trigger['url'] = $_REQUEST['url'];
DBstart();
$result = API::Trigger()->update($trigger);
//REVERT
$result = DBend($result);
$triggerid = $_REQUEST['triggerid'];
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:tr_logform.php
示例12: show_messages
if (isset($_REQUEST['save'])) {
show_messages();
if (!check_right_on_trigger_by_expression(PERM_READ_WRITE, $_REQUEST['expression'])) {
if (isset($_REQUEST['triggerid'])) {
show_messages(false, null, S_CANNOT_UPDATE_TRIGGER);
} else {
show_messages(false, null, S_CANNOT_ADD_TRIGGER);
}
} else {
$status = isset($_REQUEST['status']) ? TRIGGER_STATUS_DISABLED : TRIGGER_STATUS_ENABLED;
$deps = get_request('dependencies', array());
if (isset($_REQUEST['triggerid'])) {
$triggerData = get_trigger_by_triggerid($_REQUEST['triggerid']);
if ($triggerData['templateid']) {
$_REQUEST['description'] = $triggerData['description'];
$_REQUEST['expression'] = explode_exp($triggerData['expression'], 0);
}
$current_deps = get_trigger_dependencies_by_triggerid($_REQUEST['triggerid']);
sort($deps);
sort($current_deps);
if ($deps == $current_deps) {
$deps = null;
}
$type = get_request('type');
$priority = get_request('priority');
$comments = get_request('comments');
$url = get_request('url');
if ($triggerData['type'] == $_REQUEST['type']) {
$type = null;
}
if ($triggerData['priority'] == $_REQUEST['priority']) {
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:triggers.php
示例13: CLink
if ($trigger['status'] == TRIGGER_STATUS_DISABLED) {
$status = new CLink(S_DISABLED, $status_link, 'disabled');
} else {
if ($trigger['status'] == TRIGGER_STATUS_UNKNOWN) {
$status = new CLink(S_UNKNOWN, $status_link, 'unknown');
} else {
if ($trigger['status'] == TRIGGER_STATUS_ENABLED) {
$status = new CLink(S_ENABLED, $status_link, 'enabled');
}
}
}
if ($_REQUEST['hostid'] > 0) {
$table->addRow(array(new CCheckBox('g_triggerid[' . $triggerid . ']', NULL, NULL, $triggerid), $priority, $status, $description, explode_exp($trigger['expression'], 1), $error));
} else {
foreach ($trigger['hosts'] as $host) {
$table->addRow(array(new CCheckBox('g_triggerid[' . $triggerid . ']', NULL, NULL, $triggerid), $priority, $status, $host['host'], $description, explode_exp($trigger['expression'], 1), $error));
}
}
}
//----- GO ------
$goBox = new CComboBox('go');
$goBox->addItem('activate', S_ACTIVATE_SELECTED);
$goBox->addItem('disable', S_DISABLE_SELECTED);
$goBox->addItem('massupdate', S_MASS_UPDATE);
$goBox->addItem('copy_to', S_COPY_SELECTED_TO);
$goBox->addItem('delete', S_DELETE_SELECTED);
// goButton name is necessary!!!
$goButton = new CButton('goButton', S_GO . ' (0)');
$goButton->setAttribute('id', 'goButton');
zbx_add_post_js('chkbxRange.pageGoName = "g_triggerid";');
$table->setFooter(new CCol(array($goBox, $goButton)));
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:triggers.php
示例14: make_trigger_details
function make_trigger_details($trigger)
{
$hostNames = array();
$hostIds = zbx_objectValues($trigger['hosts'], 'hostid');
$hosts = API::Host()->get(array('output' => array('name', 'hostid', 'status'), 'hostids' => $hostIds, 'selectScreens' => API_OUTPUT_COUNT, 'selectGraphs' => API_OUTPUT_COUNT));
if (count($hosts) > 1) {
order_result($hosts, 'name', ZBX_SORT_UP);
}
$scripts = API::Script()->getScriptsByHosts($hostIds);
foreach ($hosts as $host) {
$hostName = new CSpan($host['name'], 'link_menu');
$hostName->setMenuPopup(CMenuPopupHelper::getHost($host, $scripts[$host['hostid']]));
$hostNames[] = $hostName;
$hostNames[] = ', ';
}
array_pop($hostNames);
$table = new CTableInfo();
$table->addRow(array(new CCol(_n('Host', 'Hosts', count($hosts))), new CCol($hostNames, 'wraptext')));
$table->addRow(array(new CCol(_('Trigger')), new CCol(CMacrosResolverHelper::resolveTriggerName($trigger), 'wraptext')));
$table->addRow(array(_('Severity'), getSeverityCell($trigger['priority'])));
$table->addRow(array(new CCol(_('Expression')), new CCol(explode_exp($trigger['expression'], true, true), 'trigger-expression')));
$table->addRow(array(_('Event generation'), _('Normal') . (TRIGGER_MULT_EVENT_ENABLED == $trigger['type'] ? SPACE . '+' . SPACE . _('Multiple PROBLEM events') : '')));
$table->addRow(array(_('Disabled'), TRIGGER_STATUS_ENABLED == $trigger['status'] ? new CCol(_('No'), 'off') : new CCol(_('Yes'), 'on')));
return $table;
}
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:25,代码来源:triggers.inc.php
示例15: make_trigger_details
function make_trigger_details($trigger)
{
$table = new CTableInfo();
if (is_show_all_nodes()) {
$table->addRow(array(_('Node'), get_node_name_by_elid($trigger['triggerid'])));
}
$expression = explode_exp($trigger['expression'], true, true);
$host = API::Host()->get(array('output' => array('name', 'hostid'), 'hostids' => $trigger['hosts'][0]['hostid'], 'selectScreens' => API_OUTPUT_COUNT, 'selectInventory' => array('hostid'), 'preservekeys' => true));
$host = reset($host);
$hostScripts = API::Script()->getScriptsByHosts($host['hostid']);
// host js link
$hostSpan = new CSpan($host['name'], 'link_menu menu-host');
$scripts = $hostScripts[$host['hostid']];
$hostSpan->attr('data-menu', hostMenuData($host, $scripts));
// get visible name of the first host
$table->addRow(array(_('Host'), $hostSpan));
$table->addRow(array(_('Trigger'), CTriggerHelper::expandDescription($trigger)));
$table->addRow(array(_('Severity'), getSeverityCell($trigger['priority'])));
$table->addRow(array(_('Expression'), $expression));
$table->addRow(array(_('Event generation'), _('Normal') . (TRIGGER_MULT_EVENT_ENABLED == $trigger['type'] ? SPACE . '+' . SPACE . _('Multiple PROBLEM events') : '')));
$table->addRow(array(_('Disabled'), TRIGGER_STATUS_ENABLED == $trigger['status'] ? new CCol(_('No'), 'off') : new CCol(_('Yes'), 'on')));
return $table;
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:23,代码来源:triggers.inc.php
示例16: selectTriggers
/**
* Select trigger ids for previously added trigger names/expressions.
*/
protected function selectTriggers()
{
if (!empty($this->triggers)) {
$this->triggersRefs = array();
$triggerIds = array();
$sql = 'SELECT t.triggerid,t.expression,t.description' . ' FROM triggers t' . ' WHERE ' . dbConditionString('t.description', array_keys($this->triggers));
$dbTriggers = DBselect($sql);
while ($dbTrigger = DBfetch($dbTriggers)) {
$dbExpr = explode_exp($dbTrigger['expression']);
foreach ($this->triggers as $name => $expressions) {
if ($name == $dbTrigger['description']) {
foreach ($expressions as $expression) {
if ($expression == $dbExpr) {
$this->triggersRefs[$name][$expression] = $dbTrigger['triggerid'];
$triggerIds[] = $dbTrigger['triggerid'];
}
}
}
}
}
$allowedTriggers = API::Trigger()->get(array('triggerids' => $triggerIds, 'output' => array('triggerid'), 'filter' => array('flags' => array(ZBX_FLAG_DISCOVERY_NORMAL, ZBX_FLAG_DISCOVERY_PROTOTYPE)), 'editable' => true, 'preservekeys' => true));
foreach ($this->triggersRefs as $name => $expressions) {
foreach ($expressions as $expression => $triggerId) {
if (!isset($allowedTriggers[$triggerId])) {
unset($this->triggersRefs[$name][$expression]);
}
}
}
}
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:33,代码来源:CImportReferencer.php
示例17: getTriggersReferences
/**
* Get triggers references by trigger ids.
*
* @param array $triggerIds
*
* @return array
*/
protected function getTriggersReferences(array $triggerIds)
{
$idents = array();
$triggers = API::Trigger()->get(array('triggerids' => $triggerIds, 'output' => array('description', 'expression'), 'nodeids' => get_current_nodeid(true), 'preservekeys' => true));
foreach ($triggers as $id => $trigger) {
$idents[$id] = array('description' => $trigger['description'], 'expression' => explode_exp($trigger['expression']));
}
return $idents;
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:16,代码来源:CConfigurationExport.php
示例18: foreach
}
foreach ($triggers as $trigger) {
$usedHosts = array();
foreach ($trigger['hosts'] as $host) {
$usedHosts[$host['hostid']] = $host['name'];
}
$usedHostCount = count($usedHosts);
$triggerItems = array();
$trigger['items'] = CMacrosResolverHelper::resolveItemNames($trigger['items']);
foreach ($trigger['items'] as $item) {
$triggerItems[] = array('name' => $usedHostCount > 1 ? $usedHosts[$item['hostid']] . NAME_DELIMITER . $item['name_expanded'] : $item['name_expanded'], 'params' => array('itemid' => $item['itemid'], 'action' => in_array($item['value_type'], array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64)) ? 'showgraph' : 'showvalues'));
}
$description = new CSpan($trigger['description'], 'link_menu');
$description->setMenuPopup(getMenuPopupTrigger($trigger, $triggerItems));
if ($_REQUEST['show_details']) {
$description = array($description, BR(), explode_exp($trigger['expression'], true, true));
}
if (!empty($trigger['dependencies'])) {
$dependenciesTable = new CTableInfo();
$dependenciesTable->setAttribute('style', 'width: 200px;');
$dependenciesTable->addRow(bold(_('Depends on') . NAME_DELIMITER));
foreach ($trigger['dependencies'] as $dependency) {
$dependenciesTable->addRow(' - ' . CMacrosResolverHelper::resolveTriggerNameById($dependency['triggerid']));
}
$img = new Cimg('images/general/arrow_down2.png', 'DEP_UP');
$img->setAttribute('style', 'vertical-align: middle; border: 0px;');
$img->setHint($dependenciesTable);
$description = array($img, SPACE, $description);
}
$dependency = false;
$dependenciesTable = new CTableInfo();
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:tr_status.php
示例19: get_profile
$last_page['url'] = 'tr_status.php?hostid=' . get_profile('web.tr_status.hostid', 0);
}
redirect($last_page['url']);
exit;
} else {
if (isset($_REQUEST['cancel'])) {
$last_page = get_last_history_page();
if (!$last_page) {
$last_page['url'] = 'tr_status.php?hostid=' . get_profile('web.tr_status.hostid', 0);
}
redirect($last_page['url']);
exit;
}
}
}
$msg = $bulk ? ' BULK ACKNOWLEDGE ' : array('"' . expand_trigger_description_by_data($db_data) . '"', BR(), explode_exp($db_data["expression"], 1));
show_table_header(array(S_ALARM_ACKNOWLEDGES_BIG, ' : ', $msg));
echo SBR;
if (!$bulk) {
$table = new CTable(NULL, "ack_msgs");
$table->SetAlign("center");
$db_acks = get_acknowledges_by_eventid($db_data["eventid"]);
while ($db_ack = DBfetch($db_acks)) {
$db_user = get_user_by_userid($db_ack["userid"]);
$table->AddRow(array(new CCol($db_user["alias"], "user"), new CCol(date("d-m-Y h:i:s A", $db_ack["clock"]), "time")), "title");
$msgCol = new CCol(zbx_nl2br($db_ack['message']));
$msgCol->SetColspan(2);
$table->AddRow($msgCol, "msg");
}
/**/
if ($table->GetNumRows() > 0) {
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:acknow.php
示例20: insert_trigger_form
function insert_trigger_form()
{
global $USER_DETAILS;
$frmTrig = new CFormTable(S_TRIGGER, "triggers.php");
$frmTrig->SetHelp("config_triggers.php");
if ($_REQUEST['hostid'] > 0) {
$frmTrig->addVar("hostid", $_REQUEST['hostid']);
}
$dep_el = array();
$dependencies = get_request("dependencies", array());
$limited = null;
if (isset($_REQUEST["triggerid"])) {
$frmTrig->addVar("triggerid", $_REQUEST["triggerid"]);
$trigger = get_trigger_by_triggerid($_REQUEST["triggerid"]);
$frmTrig->SetTitle(S_TRIGGER . ' "' . htmlspecialchars($trigger["description"]) . '"');
$limited = $trigger['templateid'] ? 'yes' : null;
}
$expression = get_request("expression", "");
$description = get_request("description", "");
$type = get_request('type', 0);
$priority = get_request("priority", 0);
$status = get_request("status", 0);
$comments = get_request("comments", "");
$url = get_request("url", "");
if (isset($_REQUEST["triggerid"]) && !isset($_REQUEST["form_refresh"]) || isset($limited)) {
$description = $trigger["description"];
$expression = explode_exp($trigger["expression"], 0);
if (!isset($limited) || !isset($_REQUEST["form_refresh"])) {
$type = $trigger['type'];
$priority = $trigger["priority"];
$status = $trigger["status"];
$comments = $trigger["comments"];
$url = $trigger["url"];
$trigs = DBselect('SELECT t.triggerid,t.description,t.expression ' . ' FROM triggers t,trigger_depends d ' . ' WHERE t.triggerid=d.triggerid_up ' . ' AND d.triggerid_down=' . $_REQUEST['triggerid']);
while ($trig = DBfetch($trigs)) {
if (uint_in_array($trig["triggerid"], $dependencies)) {
continue;
}
array_push($dependencies, $trig["triggerid"]);
}
}
}
$frmTrig->addRow(S_NAME, new CTextBox("description", $description, 90, $limited));
$frmTrig->addRow(S_EXPRESSION, array(new CTextBox("expression", $expression, 75, $limited), $limited ? null : new CButton('insert', S_INSERT, "return PopUp('popup_trexpr.php?dstfrm=" . $frmTrig->GetName() . "&dstfld1=expression&srctbl=expression" . "&srcfld1=expression&expression=' + escape(getSelectedText(this.form.elements['expression'])),700,200);")));
/* dependencies */
foreach ($dependencies as $val) {
array_push($dep_el, array(new CCheckBox("rem_dependence[]", 'no', null, strval($val)), expand_trigger_description($val)), BR());
$frmTrig->addVar("dependencies[]", strval($val));
}
if (count($dep_el) == 0) {
array_push($dep_el, S_NO_DEPENDENCES_DEFINED);
} else {
array_push($dep_el, new CButton('del_dependence', 'delete selected'));
}
$frmTrig->addRow(S_THE_TRIGGER_DEPENDS_ON, $dep_el);
/* end dependencies */
/* new dependence */
// $frmTrig->addVar('new_dependence','0');
// $txtCondVal = new CTextBox('trigger','',75,'yes');
$btnSelect = new CButton('btn1', S_ADD, "return PopUp('popup.php?dstfrm=" . $frmTrig->GetName() . "&dstfld1=new_dependence[]&srctbl=triggers&multiselect=1&dstact=add_dependence&objname=triggers&srcfld1=1" . "',750,450);", 'T');
$frmTrig->addRow(S_NEW_DEPENDENCY, $btnSelect, 'new');
/* end new dependence */
$type_select = new CComboBox('type');
$type_select->additem(TRIGGER_MULT_EVENT_DISABLED, S_NORMAL, $type == TRIGGER_MULT_EVENT_ENABLED ? 'no' : 'yes');
$type_select->additem(TRIGGER_MULT_EVENT_ENABLED, S_NORMAL . SPACE . '+' . SPACE . S_MULTIPLE_TRUE_EVENTS, $type == TRIGGER_MULT_EVENT_ENABLED ? 'yes' : 'no');
$frmTrig->addRow(S_EVENT_GENERATION, $type_select);
$cmbPrior = new CComboBox("priority", $priority);
for ($i = 0; $i <= 5; $i++) {
$cmbPrior->addItem($i, get_severity_description($i));
}
$frmTrig->addRow(S_SEVERITY, $cmbPrior);
$frmTrig->addRow(S_COMMENTS, new CTextArea("comments", $comments, 90, 7));
$frmTrig->addRow(S_URL, new CTextBox("url", $url, 90));
$frmTrig->addRow(S_DISABLED, new CCheckBox("status", $status));
$frmTrig->addItemToBottomRow(new CButton("save", S_SAVE));
if (isset($_REQUEST["triggerid"])) {
$frmTrig->addItemToBottomRow(SPACE);
$frmTrig->addItemToBottomRow(new CButton("clone", S_CLONE));
$frmTrig->addItemToBottomRow(SPACE);
if (!$limited) {
$frmTrig->addItemToBottomRow(new CButtonDelete("Delete trigger?", url_param("form") . url_param('groupid') . url_param("hostid") . url_param("triggerid")));
}
}
$frmTrig->addItemToBottomRow(SPACE);
$frmTrig->addItemToBottomRow(new CButtonCancel(url_param('groupid') . url_param("hostid")));
$frmTrig->Show();
}
开发者ID:rennhak,项目名称:zabbix,代码行数:87,代码来源:forms.inc.php
注:本文中的explode_exp函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论