本文整理汇总了PHP中CDiv::setHint方法的典型用法代码示例。如果您正苦于以下问题:PHP CDiv::setHint方法的具体用法?PHP CDiv::setHint怎么用?PHP CDiv::setHint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDiv
的用法示例。
在下文中一共展示了CDiv::setHint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getActionMessages
/**
* Get action messages.
*
* @param array $alerts
* @param string $alerts[n]['alertid']
* @param string $alerts[n]['userid']
* @param int $alerts[n]['alerttype']
* @param array $alerts[n]['mediatypes']
* @param string $alerts[n]['clock']
* @param int $alerts[n]['esc_step']
* @param int $alerts[n]['status']
* @param int $alerts[n]['retries']
* @param string $alerts[n]['subject']
* @param string $alerts[n]['sendto']
* @param string $alerts[n]['message']
* @param string $alerts[n]['error']
*
* @return CTableInfo
*/
function getActionMessages(array $alerts)
{
$dbUsers = API::User()->get(array('output' => array('userid', 'alias', 'name', 'surname'), 'userids' => zbx_objectValues($alerts, 'userid'), 'preservekeys' => true));
$table = new CTableInfo(_('No actions found.'));
$table->setHeader(array(_('Time'), _('Type'), _('Status'), _('Retries left'), _('Recipient(s)'), _('Message'), _('Info')));
foreach ($alerts as $alert) {
if ($alert['alerttype'] != ALERT_TYPE_MESSAGE) {
continue;
}
$mediaType = array_pop($alert['mediatypes']);
$time = zbx_date2str(DATE_TIME_FORMAT_SECONDS, $alert['clock']);
if ($alert['esc_step'] > 0) {
$time = array(bold(_('Step') . NAME_DELIMITER), $alert['esc_step'], br(), bold(_('Time') . NAME_DELIMITER), br(), $time);
}
if ($alert['status'] == ALERT_STATUS_SENT) {
$status = new CSpan(_('sent'), 'green');
$retries = new CSpan(SPACE, 'green');
} elseif ($alert['status'] == ALERT_STATUS_NOT_SENT) {
$status = new CSpan(_('In progress'), 'orange');
$retries = new CSpan(ALERT_MAX_RETRIES - $alert['retries'], 'orange');
} else {
$status = new CSpan(_('not sent'), 'red');
$retries = new CSpan(0, 'red');
}
$recipient = $alert['userid'] ? array(bold(getUserFullname($dbUsers[$alert['userid']])), BR(), $alert['sendto']) : $alert['sendto'];
$message = array(bold(_('Subject') . NAME_DELIMITER), br(), $alert['subject'], br(), br(), bold(_('Message') . NAME_DELIMITER));
array_push($message, BR(), zbx_nl2br($alert['message']));
if (zbx_empty($alert['error'])) {
$info = '';
} else {
$info = new CDiv(SPACE, 'status_icon iconerror');
$info->setHint($alert['error'], 'on');
}
$table->addRow(array(new CCol($time, 'top'), new CCol(isset($mediaType['description']) ? $mediaType['description'] : '', 'top'), new CCol($status, 'top'), new CCol($retries, 'top'), new CCol($recipient, 'top'), new CCol($message, 'wraptext top'), new CCol($info, 'wraptext top')));
}
return $table;
}
示例2: CLink
if ($discovery['templateid']) {
$template_host = get_realhost_by_itemid($discovery['templateid']);
$description[] = new CLink($template_host['name'], '?hostid=' . $template_host['hostid'], 'unknown');
$description[] = NAME_DELIMITER;
}
$discovery['name_expanded'] = itemName($discovery);
$description[] = new CLink($discovery['name_expanded'], '?form=update&itemid=' . $discovery['itemid']);
$status = new CLink(itemIndicator($discovery['status'], $discovery['state']), '?hostid=' . $_REQUEST['hostid'] . '&g_hostdruleid=' . $discovery['itemid'] . '&go=' . ($discovery['status'] ? 'activate' : 'disable'), itemIndicatorStyle($discovery['status'], $discovery['state']));
if ($data['showErrorColumn']) {
$error = '';
if ($discovery['status'] == ITEM_STATUS_ACTIVE) {
if (zbx_empty($discovery['error'])) {
$error = new CDiv(SPACE, 'status_icon iconok');
} else {
$error = new CDiv(SPACE, 'status_icon iconerror');
$error->setHint($discovery['error'], '', 'on');
}
}
}
// host prototype link
$hostPrototypeLink = null;
if ($data['host']['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) {
$hostPrototypeLink = array(new CLink(_('Host prototypes'), 'host_prototypes.php?parent_discoveryid=' . $discovery['itemid']), ' (' . $discovery['hostPrototypes'] . ')');
}
$discoveryTable->addRow(array(new CCheckBox('g_hostdruleid[' . $discovery['itemid'] . ']', null, null, $discovery['itemid']), $description, array(new CLink(_('Item prototypes'), 'disc_prototypes.php?hostid=' . get_request('hostid') . '&parent_discoveryid=' . $discovery['itemid']), ' (' . $discovery['items'] . ')'), array(new CLink(_('Trigger prototypes'), 'trigger_prototypes.php?hostid=' . get_request('hostid') . '&parent_discoveryid=' . $discovery['itemid']), ' (' . $discovery['triggers'] . ')'), array(new CLink(_('Graph prototypes'), 'graphs.php?hostid=' . get_request('hostid') . '&parent_discoveryid=' . $discovery['itemid']), ' (' . $discovery['graphs'] . ')'), $hostPrototypeLink, $discovery['key_'], $discovery['delay'], item_type2str($discovery['type']), $status, $data['showErrorColumn'] ? $error : null));
}
// create go buttons
$goComboBox = new CComboBox('go');
$goOption = new CComboItem('activate', _('Enable selected'));
$goOption->setAttribute('confirm', _('Enable selected discovery rules?'));
$goComboBox->addItem($goOption);
示例3: array
foreach ($data['discoveries'] as $discovery) {
// description
$description = array();
if ($discovery['templateid']) {
$dbTemplate = get_realhost_by_itemid($discovery['templateid']);
$description[] = new CLink($dbTemplate['name'], '?hostid=' . $dbTemplate['hostid'], 'unknown');
$description[] = NAME_DELIMITER;
}
$description[] = new CLink($discovery['name_expanded'], '?form=update&itemid=' . $discovery['itemid']);
// status
$status = new CLink(itemIndicator($discovery['status'], $discovery['state']), '?hostid=' . $_REQUEST['hostid'] . '&g_hostdruleid=' . $discovery['itemid'] . '&action=' . ($discovery['status'] == ITEM_STATUS_DISABLED ? 'discoveryrule.massenable' : 'discoveryrule.massdisable'), itemIndicatorStyle($discovery['status'], $discovery['state']));
// info
if ($data['showInfoColumn']) {
if ($discovery['status'] == ITEM_STATUS_ACTIVE && !zbx_empty($discovery['error'])) {
$info = new CDiv(SPACE, 'status_icon iconerror');
$info->setHint($discovery['error'], 'on');
} else {
$info = '';
}
} else {
$info = null;
}
// host prototype link
$hostPrototypeLink = null;
if ($data['host']['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) {
$hostPrototypeLink = array(new CLink(_('Host prototypes'), 'host_prototypes.php?parent_discoveryid=' . $discovery['itemid']), ' (' . $discovery['hostPrototypes'] . ')');
}
$discoveryTable->addRow(array(new CCheckBox('g_hostdruleid[' . $discovery['itemid'] . ']', null, null, $discovery['itemid']), $description, array(new CLink(_('Item prototypes'), 'disc_prototypes.php?hostid=' . getRequest('hostid') . '&parent_discoveryid=' . $discovery['itemid']), ' (' . $discovery['items'] . ')'), array(new CLink(_('Trigger prototypes'), 'trigger_prototypes.php?hostid=' . getRequest('hostid') . '&parent_discoveryid=' . $discovery['itemid']), ' (' . $discovery['triggers'] . ')'), array(new CLink(_('Graph prototypes'), 'graphs.php?hostid=' . getRequest('hostid') . '&parent_discoveryid=' . $discovery['itemid']), ' (' . $discovery['graphs'] . ')'), $hostPrototypeLink, $discovery['key_'], $discovery['delay'], item_type2str($discovery['type']), $status, $info));
}
// create go buttons
$goComboBox = new CComboBox('action');
示例4: get
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get()
{
$sortfield = 'clock';
$sortorder = ZBX_SORT_DOWN;
$sorttitle = _('Time');
switch ($this->screenitem['sort_triggers']) {
case SCREEN_SORT_TRIGGERS_TIME_ASC:
$sortfield = 'clock';
$sortorder = ZBX_SORT_UP;
$sorttitle = _('Time');
break;
case SCREEN_SORT_TRIGGERS_TIME_DESC:
$sortfield = 'clock';
$sortorder = ZBX_SORT_DOWN;
$sorttitle = _('Time');
break;
case SCREEN_SORT_TRIGGERS_TYPE_ASC:
$sortfield = 'description';
$sortorder = ZBX_SORT_UP;
$sorttitle = _('Type');
break;
case SCREEN_SORT_TRIGGERS_TYPE_DESC:
$sortfield = 'description';
$sortorder = ZBX_SORT_DOWN;
$sorttitle = _('Type');
break;
case SCREEN_SORT_TRIGGERS_STATUS_ASC:
$sortfield = 'status';
$sortorder = ZBX_SORT_UP;
$sorttitle = _('Status');
break;
case SCREEN_SORT_TRIGGERS_STATUS_DESC:
$sortfield = 'status';
$sortorder = ZBX_SORT_DOWN;
$sorttitle = _('Status');
break;
case SCREEN_SORT_TRIGGERS_RECIPIENT_ASC:
$sortfield = 'sendto';
$sortorder = ZBX_SORT_UP;
$sorttitle = _('Recipient(s)');
break;
case SCREEN_SORT_TRIGGERS_RECIPIENT_DESC:
$sortfield = 'sendto';
$sortorder = ZBX_SORT_DOWN;
$sorttitle = _('Recipient(s)');
break;
}
$sql = 'SELECT a.alertid,a.clock,a.sendto,a.subject,a.message,a.status,a.retries,a.error,' . 'a.userid,a.actionid,a.mediatypeid,mt.description' . ' FROM events e,alerts a' . ' LEFT JOIN media_type mt ON mt.mediatypeid=a.mediatypeid' . ' WHERE e.eventid=a.eventid' . ' AND alerttype=' . ALERT_TYPE_MESSAGE;
if (CWebUser::getType() != USER_TYPE_SUPER_ADMIN) {
$userid = CWebUser::$data['userid'];
$userGroups = getUserGroupsByUserId($userid);
$sql .= ' AND EXISTS (' . 'SELECT NULL' . ' FROM functions f,items i,hosts_groups hgg' . ' JOIN rights r' . ' ON r.id=hgg.groupid' . ' AND ' . dbConditionInt('r.groupid', $userGroups) . ' WHERE e.objectid=f.triggerid' . ' AND f.itemid=i.itemid' . ' AND i.hostid=hgg.hostid' . ' GROUP BY f.triggerid' . ' HAVING MIN(r.permission)>' . PERM_DENY . ')';
}
$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder;
$alerts = DBfetchArray(DBselect($sql, $this->screenitem['elements']));
order_result($alerts, $sortfield, $sortorder);
if ($alerts) {
$dbUsers = API::User()->get(array('output' => array('userid', 'alias', 'name', 'surname'), 'userids' => zbx_objectValues($alerts, 'userid'), 'preservekeys' => true));
}
// indicator of sort field
$sortfieldSpan = new CSpan(array($sorttitle, SPACE));
$sortorderSpan = new CSpan(SPACE, $sortorder === ZBX_SORT_DOWN ? 'icon_sortdown default_cursor' : 'icon_sortup default_cursor');
// create alert table
$actionTable = new CTableInfo(_('No action log entries found.'));
$actionTable->setHeader(array($sortfield === 'clock' ? array($sortfieldSpan, $sortorderSpan) : _('Time'), _('Action'), $sortfield === 'description' ? array($sortfieldSpan, $sortorderSpan) : _('Type'), $sortfield === 'sendto' ? array($sortfieldSpan, $sortorderSpan) : _('Recipient(s)'), _('Message'), $sortfield === 'status' ? array($sortfieldSpan, $sortorderSpan) : _('Status'), _('Info')));
$actions = API::Action()->get(array('output' => array('actionid', 'name'), 'actionids' => array_unique(zbx_objectValues($alerts, 'actionid')), 'preservekeys' => true));
foreach ($alerts as $alert) {
if ($alert['status'] == ALERT_STATUS_SENT) {
$status = new CSpan(_('Sent'), 'green');
} elseif ($alert['status'] == ALERT_STATUS_NOT_SENT) {
$status = new CSpan(array(_('In progress') . ':', BR(), _n('%1$s retry left', '%1$s retries left', ALERT_MAX_RETRIES - $alert['retries'])), 'orange');
} else {
$status = new CSpan(_('Not sent'), 'red');
}
$recipient = $alert['userid'] ? array(bold(getUserFullname($dbUsers[$alert['userid']])), BR(), $alert['sendto']) : $alert['sendto'];
$message = array(bold(_('Subject') . ':'), br(), $alert['subject'], br(), br(), bold(_('Message') . ':'), br(), $alert['message']);
if (zbx_empty($alert['error'])) {
$info = '';
} else {
$info = new CDiv(SPACE, 'status_icon iconerror');
$info->setHint($alert['error'], 'on');
}
$actionTable->addRow(array(new CCol(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $alert['clock']), 'top'), new CCol($actions[$alert['actionid']]['name'], 'top'), new CCol($alert['mediatypeid'] == 0 ? '-' : $alert['description'], 'top'), new CCol($recipient, 'top'), new CCol($message, 'top pre'), new CCol($status, 'top'), new CCol($info, 'wraptext top')));
}
return $this->getOutput($actionTable);
}
示例5: getAvailabilityTable
/**
* Returns zbx, snmp, jmx, ipmi availability status icons.
*
* @param type $host
*
* @return CDiv
*/
function getAvailabilityTable($host)
{
$arr = array('zbx', 'snmp', 'jmx', 'ipmi');
// for consistency in foreach loop
$host['zbx_available'] = $host['available'];
$host['zbx_error'] = $host['error'];
$ad = new CDiv(null, 'invisible');
foreach ($arr as $val) {
switch ($host[$val . '_available']) {
case HOST_AVAILABLE_TRUE:
$ai = new CDiv(SPACE, 'status_icon status_icon_extra icon' . $val . 'available');
break;
case HOST_AVAILABLE_FALSE:
$ai = new CDiv(SPACE, 'status_icon status_icon_extra icon' . $val . 'unavailable');
$ai->setHint($host[$val . '_error'], '', 'on');
break;
case HOST_AVAILABLE_UNKNOWN:
$ai = new CDiv(SPACE, 'status_icon status_icon_extra icon' . $val . 'unknown');
break;
}
$ad->addItem($ai);
}
return $ad;
}
示例6: CTableInfo
// create table
$auditTable = new CTableInfo(_('No action log entries found.'));
$auditTable->setHeader(array(_('Time'), _('Action'), _('Type'), _('Recipient(s)'), _('Message'), _('Status'), _('Info')));
foreach ($this->data['alerts'] as $alert) {
$mediatype = array_pop($alert['mediatypes']);
if ($alert['status'] == ALERT_STATUS_SENT) {
$status = $alert['alerttype'] == ALERT_TYPE_MESSAGE ? new CSpan(_('Sent'), 'green') : new CSpan(_('Executed'), 'green');
} elseif ($alert['status'] == ALERT_STATUS_NOT_SENT) {
$status = new CSpan(array(_('In progress') . ':', BR(), _n('%1$s retry left', '%1$s retries left', ALERT_MAX_RETRIES - $alert['retries'])), 'orange');
} else {
$status = new CSpan(_('Not sent'), 'red');
}
$message = $alert['alerttype'] == ALERT_TYPE_MESSAGE ? array(bold(_('Subject') . ':'), BR(), $alert['subject'], BR(), BR(), bold(_('Message') . ':'), BR(), zbx_nl2br($alert['message'])) : array(bold(_('Command') . ':'), BR(), zbx_nl2br($alert['message']));
if (zbx_empty($alert['error'])) {
$info = '';
} else {
$info = new CDiv(SPACE, 'status_icon iconerror');
$info->setHint($alert['error'], 'on');
}
$recipient = isset($alert['userid']) && $alert['userid'] ? array(bold(getUserFullname($this->data['users'][$alert['userid']])), BR(), $alert['sendto']) : $alert['sendto'];
$auditTable->addRow(array(new CCol(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $alert['clock']), 'top'), new CCol($this->data['actions'][$alert['actionid']]['name'], 'top'), new CCol($mediatype ? $mediatype['description'] : '-', 'top'), new CCol($recipient, 'top'), new CCol($message, 'wraptext top'), new CCol($status, 'top'), new CCol($info, 'top')));
}
// append table to form
$auditForm->addItem(array($this->data['paging'], $auditTable, $this->data['paging']));
// append navigation bar js
$objData = array('id' => 'timeline_1', 'domid' => 'events', 'loadSBox' => 0, 'loadImage' => 0, 'loadScroll' => 1, 'dynamic' => 0, 'mainObject' => 1, 'periodFixed' => CProfile::get('web.auditacts.timelinefixed', 1), 'sliderMaximumTimePeriod' => ZBX_MAX_PERIOD);
zbx_add_post_js('timeControl.addObject("events", ' . zbx_jsvalue($data['timeline']) . ', ' . zbx_jsvalue($objData) . ');');
zbx_add_post_js('timeControl.processObjects();');
// append form to widget
$auditWidget->addItem($auditForm);
return $auditWidget;
示例7: foreach
array_pop($description);
$description[] = ' : ';
$description[] = expand_trigger_description_by_data($dep_trigger);
}
}
// } add dependencies
if ($trigger['value'] != TRIGGER_VALUE_UNKNOWN) {
$trigger['error'] = '';
}
$templated = false;
foreach ($trigger['hosts'] as $hostid => $host) {
$templated |= HOST_STATUS_TEMPLATE == $host['status'];
}
if (!zbx_empty($trigger['error']) && !$templated) {
$error = new CDiv(SPACE, 'iconerror');
$error->setHint($trigger['error'], '', 'on');
} else {
$error = new CDiv(SPACE, 'iconok');
}
switch ($trigger['priority']) {
case 0:
$priority = S_NOT_CLASSIFIED;
break;
case 1:
$priority = new CCol(S_INFORMATION, 'information');
break;
case 2:
$priority = new CCol(S_WARNING, 'warning');
break;
case 3:
$priority = new CCol(S_AVERAGE, 'average');
示例8: CCol
// status
$status = new CCol(new CLink(itemIndicator($item['status'], $item['state']), '?group_itemid=' . $item['itemid'] . '&hostid=' . $item['hostid'] . '&action=' . ($item['status'] == ITEM_STATUS_DISABLED ? 'item.massenable' : 'item.massdisable'), itemIndicatorStyle($item['status'], $item['state'])));
// info
if ($data['showInfoColumn']) {
$infoIcons = array();
if ($item['status'] == ITEM_STATUS_ACTIVE && !zbx_empty($item['error'])) {
$info = new CDiv(SPACE, 'status_icon iconerror');
$info->setHint($item['error'], 'on');
$infoIcons[] = $info;
}
// discovered item lifetime indicator
if ($item['flags'] == ZBX_FLAG_DISCOVERY_CREATED && $item['itemDiscovery']['ts_delete']) {
$deleteError = new CDiv(SPACE, 'status_icon iconwarning');
// Check if item should've been deleted in the past.
if ($currentTime > $item['itemDiscovery']['ts_delete']) {
$deleteError->setHint(_s('The item is not discovered anymore and will be deleted the next time discovery rule is processed.'));
} else {
$deleteError->setHint(_s('The item is not discovered anymore and will be deleted in %1$s (on %2$s at %3$s).', zbx_date2age($item['itemDiscovery']['ts_delete']), zbx_date2str(DATE_FORMAT, $item['itemDiscovery']['ts_delete']), zbx_date2str(TIME_FORMAT, $item['itemDiscovery']['ts_delete'])));
}
$infoIcons[] = $deleteError;
}
if (!$infoIcons) {
$infoIcons[] = '';
}
} else {
$infoIcons = null;
}
// triggers info
$triggerHintTable = new CTableInfo();
$triggerHintTable->setHeader(array(_('Severity'), _('Name'), _('Expression'), _('Status')));
foreach ($item['triggers'] as $num => &$trigger) {
示例9: CDiv
$class = null;
$time = SPACE;
$hint = new CDiv(SPACE, $class);
$hintTable = new CTableInfo();
$hintTable->setAttribute('style', 'width: auto;');
if (isset($h_data['services'][$name])) {
$class = $h_data['services'][$name]['class'];
$time = $h_data['services'][$name]['time'];
if ($class == 'active') {
$hintTable->setHeader(S_UP_TIME);
} else {
if ($class == 'inactive') {
$hintTable->setHeader(S_DOWN_TIME);
}
}
$timeColumn = new CCol(zbx_date2age($h_data['services'][$name]['time']), $class);
$hintTable->addRow($timeColumn);
$hint->setHint($hintTable);
}
$table_row[] = new CCol($hint, $class);
}
$table->addRow($table_row);
$row_count++;
}
}
if (isset($row_count)) {
zbx_add_post_js('insert_in_element("numrows","' . $row_count . '");');
}
$dscvry_wdgt->addItem($table);
$dscvry_wdgt->show();
include_once "include/page_footer.php";
示例10: array
$httpTests = $this->data['httpTests'];
foreach ($httpTests as $httpTestId => $httpTest) {
$name = array();
if (isset($this->data['parentTemplates'][$httpTestId])) {
$template = $this->data['parentTemplates'][$httpTestId];
$name[] = new CLink($template['name'], '?groupid=0&hostid=' . $template['id'], 'unknown');
$name[] = NAME_DELIMITER;
}
$name[] = new CLink($httpTest['name'], '?form=update' . '&httptestid=' . $httpTestId . '&hostid=' . $httpTest['hostid']);
if ($this->data['showInfoColumn']) {
if ($httpTest['status'] == HTTPTEST_STATUS_ACTIVE && isset($httpTestsLastData[$httpTestId]) && $httpTestsLastData[$httpTestId]['lastfailedstep']) {
$lastData = $httpTestsLastData[$httpTestId];
$failedStep = $lastData['failedstep'];
$errorMessage = $failedStep ? _s('Step "%1$s" [%2$s of %3$s] failed: %4$s', $failedStep['name'], $failedStep['no'], $httpTest['stepscnt'], $lastData['error'] === null ? _('Unknown error') : $lastData['error']) : _s('Unknown step failed: %1$s', $lastData['error']);
$infoIcon = new CDiv(SPACE, 'status_icon iconerror');
$infoIcon->setHint($errorMessage, 'on');
} else {
$infoIcon = '';
}
} else {
$infoIcon = null;
}
$httpTable->addRow(array(new CCheckBox('group_httptestid[' . $httpTest['httptestid'] . ']', null, null, $httpTest['httptestid']), $this->data['hostid'] > 0 ? null : $httpTest['hostname'], $name, $httpTest['stepscnt'], $httpTest['delay'], $httpTest['retries'], httptest_authentications($httpTest['authentication']), $httpTest['http_proxy'] !== '' ? _('Yes') : _('No'), $httpTest['applicationid'] != 0 ? $httpTest['application_name'] : '-', new CLink(httptest_status2str($httpTest['status']), '?group_httptestid[]=' . $httpTest['httptestid'] . '&hostid=' . $httpTest['hostid'] . '&action=' . ($httpTest['status'] == HTTPTEST_STATUS_DISABLED ? 'httptest.massenable' : 'httptest.massdisable'), httptest_status2style($httpTest['status'])), $infoIcon));
}
// create go buttons
$goComboBox = new CComboBox('action');
$goOption = new CComboItem('httptest.massenable', _('Enable selected'));
$goOption->setAttribute('confirm', _('Enable selected web scenarios?'));
$goComboBox->addItem($goOption);
$goOption = new CComboItem('httptest.massdisable', _('Disable selected'));
$goOption->setAttribute('confirm', _('Disable selected web scenarios?'));
示例11: CCol
$status = S_UNKNOWN;
}
if ($row['available'] == HOST_AVAILABLE_TRUE) {
$available = new CCol(S_AVAILABLE, 'off');
} else {
if ($row['available'] == HOST_AVAILABLE_FALSE) {
$available = new CCol(S_NOT_AVAILABLE, 'on');
} else {
if ($row['available'] == HOST_AVAILABLE_UNKNOWN) {
$available = new CCol(S_UNKNOWN, 'unknown');
}
}
}
if (!zbx_empty($row['error'])) {
$error = new CDiv(SPACE, 'error_icon');
$error->setHint($row['error'], '', 'on');
} else {
$error = new CDiv(SPACE, 'ok_icon');
}
$templates = $row['templates'];
$templates_linked = array();
foreach ($templates as $templateid => $template) {
$templates_linked[$templateid] = array(empty($templates_linked) ? '' : ', ', $template['host']);
}
$table->addRow(array(new CCheckBox('hosts[' . $row['hostid'] . ']', NULL, NULL, $row['hostid']), $description, $items, $triggers, $graphs, $dns, $ip, $port, empty($templates) ? '-' : $templates_linked, $status, $available, $error));
$row_count++;
}
//----- GO ------
$goBox = new CComboBox('go');
$goBox->addItem('massupdate', S_MASS_UPDATE);
$goBox->addItem('activate', S_ACTIVATE_SELECTED);
示例12: array
}
$hostCount = $this->data['groupCounts'][$group['groupid']]['hosts'];
$templateCount = $this->data['groupCounts'][$group['groupid']]['templates'];
// name
$name = array();
if ($group['discoveryRule']) {
$name[] = new CLink($group['discoveryRule']['name'], 'host_prototypes.php?parent_discoveryid=' . $group['discoveryRule']['itemid'], 'parent-discovery');
$name[] = NAME_DELIMITER;
}
$name[] = new CLink($group['name'], 'hostgroups.php?form=update&groupid=' . $group['groupid']);
// info, discovered item lifetime indicator
if ($group['flags'] == ZBX_FLAG_DISCOVERY_CREATED && $group['groupDiscovery']['ts_delete']) {
$info = new CDiv(SPACE, 'status_icon iconwarning');
// Check if host group should've been deleted in the past.
if ($currentTime > $group['groupDiscovery']['ts_delete']) {
$info->setHint(_s('The host group is not discovered anymore and will be deleted the next time discovery rule is processed.'));
} else {
$info->setHint(_s('The host group is not discovered anymore and will be deleted in %1$s (on %2$s at %3$s).', zbx_date2age($group['groupDiscovery']['ts_delete']), zbx_date2str(DATE_FORMAT, $group['groupDiscovery']['ts_delete']), zbx_date2str(TIME_FORMAT, $group['groupDiscovery']['ts_delete'])));
}
} else {
$info = '';
}
$hostGroupTable->addRow(array(new CCheckBox('groups[' . $group['groupid'] . ']', null, null, $group['groupid']), $name, array(array(new CLink(_('Templates'), 'templates.php?groupid=' . $group['groupid'], 'unknown'), ' (' . $templateCount . ')'), BR(), array(new CLink(_('Hosts'), 'hosts.php?groupid=' . $group['groupid']), ' (' . $hostCount . ')')), new CCol(empty($hostsOutput) ? '-' : $hostsOutput, 'wraptext'), $info));
}
// create go button
$goComboBox = new CComboBox('action');
$goOption = new CComboItem('hostgroup.massenable', _('Enable selected'));
$goOption->setAttribute('confirm', _('Enable selected hosts?'));
$goComboBox->addItem($goOption);
$goOption = new CComboItem('hostgroup.massdisable', _('Disable selected'));
$goOption->setAttribute('confirm', _('Disable hosts in the selected host groups?'));
示例13: DBselect
$db_items = DBselect($sql);
while ($db_item = DBfetch($db_items)) {
$description = array();
$item_description = item_description($db_item);
if (isset($_REQUEST['filter_description']) && !zbx_stristr($item_description, $_REQUEST['filter_description'])) {
continue;
}
if ($db_item['templateid']) {
$template_host = get_realhost_by_itemid($db_item['templateid']);
array_push($description, new CLink($template_host['host'], '?' . 'hostid=' . $template_host['hostid'], 'unknown'), ':');
}
array_push($description, new CLink(item_description($db_item), '?form=update&itemid=' . $db_item['itemid'] . '&hostid=' . $db_item['hostid']));
$status = new CCol(new CLink(item_status2str($db_item['status']), '?group_itemid%5B%5D=' . $db_item['itemid'] . '&go=' . ($db_item['status'] ? 'activate' : 'disable'), item_status2style($db_item['status'])));
if (!zbx_empty($db_item['error'])) {
$error = new CDiv(SPACE, 'error_icon');
$error->setHint($db_item['error'], '', 'on');
} else {
$error = new CDiv(SPACE, 'ok_icon');
}
$applications = $show_applications ? implode(', ', get_applications_by_itemid($db_item['itemid'], 'name')) : null;
if (!is_null($applications) && empty($applications)) {
$applications = ' - ';
}
$applications = new CCol($applications, 'wraptext');
$table->addRow(array(new CCheckBox('group_itemid[' . $db_item['itemid'] . ']', null, null, $db_item['itemid']), $show_host ? $db_item['host'] : null, $description, $db_item['key_'], $db_item['delay'], $db_item['history'], $db_item['trends'], item_type2str($db_item['type']), $status, $applications, $error));
$row_count++;
}
//----- GO ------
$goBox = new CComboBox('go');
$goBox->addItem('activate', S_ACTIVATE_SELECTED);
$goBox->addItem('disable', S_DISABLE_SELECTED);
示例14: array
} else {
$triggerDependencies[] = array($hostNames, NAME_DELIMITER, $depTrigger['description']);
}
$triggerDependencies[] = BR();
}
array_pop($triggerDependencies);
$description = array_merge($description, array(new CDiv($triggerDependencies, 'dependencies')));
}
} else {
$description[] = new CLink(CHtml::encode($trigger['description']), 'trigger_prototypes.php?' . 'form=update' . '&hostid=' . $this->data['hostid'] . '&parent_discoveryid=' . $this->data['parent_discoveryid'] . '&triggerid=' . $triggerid);
}
// info
if ($data['showInfoColumn']) {
if ($trigger['status'] == TRIGGER_STATUS_ENABLED && !zbx_empty($trigger['error'])) {
$info = new CDiv(SPACE, 'status_icon iconerror');
$info->setHint($trigger['error'], 'on');
} else {
$info = '';
}
} else {
$info = null;
}
// status
$status = '';
if (!empty($this->data['parent_discoveryid'])) {
$status = new CLink(triggerIndicator($trigger['status']), 'trigger_prototypes.php?' . 'action=' . ($trigger['status'] == TRIGGER_STATUS_DISABLED ? 'triggerprototype.massenable' : 'triggerprototype.massdisable') . '&hostid=' . $this->data['hostid'] . '&g_triggerid=' . $triggerid . '&parent_discoveryid=' . $this->data['parent_discoveryid'], triggerIndicatorStyle($trigger['status']));
} else {
$status = new CLink(triggerIndicator($trigger['status'], $trigger['state']), 'triggers.php?' . 'action=' . ($trigger['status'] == TRIGGER_STATUS_DISABLED ? 'trigger.massenable' : 'trigger.massdisable') . '&hostid=' . $this->data['hostid'] . '&g_triggerid=' . $triggerid, triggerIndicatorStyle($trigger['status'], $trigger['state']));
}
// hosts
$hosts = null;
示例15: CCol
$status = new CCol(new CLink(itemIndicator($item['status'], $item['state']), '?group_itemid=' . $item['itemid'] . '&hostid=' . $item['hostid'] . '&go=' . ($item['status'] ? 'activate' : 'disable'), itemIndicatorStyle($item['status'], $item['state'])));
if ($data['showErrorColumn']) {
$statusIcons = array();
if ($item['status'] == ITEM_STATUS_ACTIVE) {
if (zbx_empty($item['error'])) {
$error = new CDiv(SPACE, 'status_icon iconok');
} else {
$error = new CDiv(SPACE, 'status_icon iconerror');
$error->setHint($item['error'], '', 'on');
}
$statusIcons[] = $error;
}
// discovered item lifetime indicator
if ($item['flags'] == ZBX_FLAG_DISCOVERY_CREATED && $item['itemDiscovery']['ts_delete']) {
$deleteError = new CDiv(SPACE, 'status_icon iconwarning');
$deleteError->setHint(_s('The item is not discovered anymore and will be deleted in %1$s (on %2$s at %3$s).', zbx_date2age($item['itemDiscovery']['ts_delete']), zbx_date2str(_('d M Y'), $item['itemDiscovery']['ts_delete']), zbx_date2str(_('H:i:s'), $item['itemDiscovery']['ts_delete'])));
$statusIcons[] = $deleteError;
}
}
$triggerHintTable = new CTableInfo();
$triggerHintTable->setHeader(array(_('Severity'), _('Name'), _('Expression'), _('Status')));
// triggers info
foreach ($item['triggers'] as $num => &$trigger) {
$trigger = $this->data['itemTriggers'][$trigger['triggerid']];
$triggerDescription = array();
if ($trigger['templateid'] > 0) {
if (!isset($this->data['triggerRealHosts'][$trigger['triggerid']])) {
$triggerDescription[] = new CSpan('HOST', 'unknown');
$triggerDescription[] = ':';
} else {
$realHost = reset($this->data['triggerRealHosts'][$trigger['triggerid']]);