本文整理汇总了PHP中CTableInfo类的典型用法代码示例。如果您正苦于以下问题:PHP CTableInfo类的具体用法?PHP CTableInfo怎么用?PHP CTableInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CTableInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getContent
public function _getContent($refresh = false)
{
$table = new CTableInfo(_('No web scenarios found.'));
$table->setHeader(array(_('Website'), _('Links'), _('Broken Links')));
$data = array();
// fetch links between HTTP tests and host groups
$result = DbFetchArray(DBselect('SELECT website.*, sum(status LIKE "2%") as links_ok, sum(status != "" AND NOT status LIKE "2%") as links_404, sum(status = "" OR status is null) as links_unchecked FROM zabbix_spider.website LEFT JOIN zabbix_spider.page ON page.website = Website.aid group by page.website;'));
foreach ($result as $row) {
$deadlinks = DbFetchArray(DBselect('SELECT * FROM zabbix_spider.page WHERE NOT status IS NULL AND status != "200" AND status != "" and website = ' . $row['aid']));
$deadlink_output = array();
$link_options = array("target" => "_blank");
foreach ($deadlinks as $deadlink) {
$link_link = new CLink($deadlink['url'] == "" ? "root" : substr($deadlink['url'], 0, 50), ($deadlink['url'] == "" || $deadlink['url'][0] == "/" ? $row['url'] : "") . $deadlink['url']);
$link_link->setTarget("_blank");
$map_link = new CLink("map", $this->reportUrl . "?pid={$deadlink['aid']}");
$map_link->setTarget("_blank");
$info_link = new CLink($deadlink["status"], "http://www.checkupdown.com/status/E{$deadlink['status']}.html");
$info_link->setTarget("_blank");
$deadlink_output[] = new CDiv(array($link_link, " [ ", $map_link, " | ", $info_link, " ]"));
}
$link_link = new CLink($row['name'], $row['url']);
$link_link->setTarget("_blank");
$map_link = new CLink("map", $this->reportUrl . "?wid={$row['aid']}");
$map_link->setTarget("_blank");
$table->addRow(array(new CDiv(array($link_link, " [ ", $map_link, " ]")), new CDiv(array(new CSpan($row['links_ok'], 'green'), " / ", new CSpan($row['links_404'], 'red'), " / ", new CSpan($row['links_unchecked'], 'gray'))), new CDiv($deadlink_output)));
}
return $table;
}
示例2: _getContent
public function _getContent($refresh = false)
{
global $DB;
$table = new CTableInfo(_('No email log data found'));
$table->setHeader(array(_('System'), _('Interval'), _('Next Expected'), _('Last Seen'), _('Total Emails'), _('Actions')));
$data = array();
$db = mysql_connect("192.168.211.7", "zabbix", "asmd213)A)SDM@**@@");
$result = DbFetchArray(DBselect('
SELECT email_schedule.*,COUNT(email_match.schedule) as `email_count` FROM email_tracker.email_schedule LEFT JOIN email_tracker.email_match ON email_match.schedule = email_schedule.id GROUP BY email_schedule.id ORDER BY exec_order
'));
foreach ($result as $row) {
// $link_link = new CLink($row['name'],$row['url']);
// $link_link->setTarget("_blank");
// $map_link = new CLink("map","/spider_report.php?wid=$row[aid]");
// $map_link->setTarget("_blank");
$color = $row['missed'] == 0 ? 'green' : 'red';
$last_seen = empty($row['last_seen']) || $row['last_seen'] == '0000-00-00 00:00:00' ? 'Never' : $row['last_seen'];
$table->addRow(array(new CDiv($row['name']), new CDiv($row['expected_interval']), new CDiv($row['next_expected']), new CDiv(new CSpan($last_seen, $color)), new CDiv($row['email_count']), new CLink('Ack', '/zabbix/email.php?action=ack&id=' . $row['id'])));
// if (!isset($httpTestData[$row['httptestid']])) {
// $data[$row['groupid']]['unknown'] = empty($data[$row['groupid']]['unknown']) ? 1 : ++$data[$row['groupid']]['unknown'];
// }
// elseif ($httpTestData[$row['httptestid']]['lastfailedstep'] != 0) {
// $data[$row['groupid']]['failed'] = empty($data[$row['groupid']]['failed']) ? 1 : ++$data[$row['groupid']]['failed'];
// }
// else {
// $data[$row['groupid']]['ok'] = empty($data[$row['groupid']]['ok']) ? 1 : ++$data[$row['groupid']]['ok'];
// }
}
return $table;
}
示例3: simpleHTML
private function simpleHTML()
{
$table = new CTableInfo();
$table->addRow($this->makeHeaders());
foreach ($this->tree as $id => $rows) {
$table->addRow($this->makeRow($id));
}
return $table;
}
示例4: makeAckTab
/**
* Generate acknowledgement table
*
* @param array $event
* @param array $event['acknowledges']
* @param array $event['acknowledges']['clock']
* @param array $event['acknowledges']['alias']
* @param array $event['acknowledges']['message']
*
* @return CTableInfo
*/
function makeAckTab($event)
{
$table = new CTableInfo(_('No acknowledges defined.'));
$table->setHeader(array(_('Time'), _('User'), _('Comments')));
if (!empty($event['acknowledges']) && is_array($event['acknowledges'])) {
foreach ($event['acknowledges'] as $ack) {
$table->addRow(array(zbx_date2str(_('d M Y H:i:s'), $ack['clock']), $ack['alias'], new CCol(zbx_nl2br($ack['message']), 'wraptext')));
}
}
return $table;
}
示例5: make_acktab_by_eventid
function make_acktab_by_eventid($eventid)
{
$table = new CTableInfo();
$table->SetHeader(array(S_TIME, S_USER, S_COMMENTS));
$acks = get_acknowledges_by_eventid($eventid);
while ($ack = DBfetch($acks)) {
$user = get_user_by_userid($ack['userid']);
$table->AddRow(array(date('d-m-Y h:i:s A', $ack['clock']), $user['alias'], new CCol(zbx_nl2br($ack['message']), 'wraptext')));
}
return $table;
}
示例6: makeAckTab
/**
* Get acknowledgement table.
*
* @param array $event
* @param array $event['acknowledges']
* @param array $event['acknowledges']['clock']
* @param array $event['acknowledges']['alias']
* @param array $event['acknowledges']['message']
*
* @return CTableInfo
*/
function makeAckTab($event)
{
$acknowledgeTable = new CTableInfo(_('No acknowledges found.'));
$acknowledgeTable->setHeader(array(_('Time'), _('User'), _('Comments')));
if (!empty($event['acknowledges']) && is_array($event['acknowledges'])) {
foreach ($event['acknowledges'] as $acknowledge) {
$acknowledgeTable->addRow(array(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $acknowledge['clock']), getUserFullname($acknowledge), new CCol(zbx_nl2br($acknowledge['message']), 'wraptext')));
}
}
return $acknowledgeTable;
}
示例7: get
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get()
{
// if screen is defined in template, then 'real_resourceid' is defined and should be used
if (!empty($this->screenitem['real_resourceid'])) {
$this->screenitem['resourceid'] = $this->screenitem['real_resourceid'];
}
if ($this->screenitem['dynamic'] == SCREEN_DYNAMIC_ITEM && !empty($this->hostid)) {
$newitemid = get_same_item_for_host($this->screenitem['resourceid'], $this->hostid);
$this->screenitem['resourceid'] = !empty($newitemid) ? $newitemid : 0;
}
if ($this->screenitem['resourceid'] == 0) {
$table = new CTableInfo(_('No values found.'));
$table->setHeader(array(_('Timestamp'), _('Item')));
return $this->getOutput($table);
}
$items = CMacrosResolverHelper::resolveItemNames(array(get_item_by_itemid($this->screenitem['resourceid'])));
$item = reset($items);
switch ($item['value_type']) {
case ITEM_VALUE_TYPE_TEXT:
case ITEM_VALUE_TYPE_LOG:
$orderField = 'id';
break;
case ITEM_VALUE_TYPE_FLOAT:
case ITEM_VALUE_TYPE_UINT64:
default:
$orderField = array('itemid', 'clock');
}
$host = get_host_by_itemid($this->screenitem['resourceid']);
$table = new CTableInfo(_('No values found.'));
$table->setHeader(array(_('Timestamp'), $host['name'] . NAME_DELIMITER . $item['name_expanded']));
$stime = zbxDateToTime($this->timeline['stime']);
$histories = API::History()->get(array('history' => $item['value_type'], 'itemids' => $this->screenitem['resourceid'], 'output' => API_OUTPUT_EXTEND, 'sortorder' => ZBX_SORT_DOWN, 'sortfield' => $orderField, 'limit' => $this->screenitem['elements'], 'time_from' => $stime, 'time_till' => $stime + $this->timeline['period']));
foreach ($histories as $history) {
switch ($item['value_type']) {
case ITEM_VALUE_TYPE_FLOAT:
sscanf($history['value'], '%f', $value);
break;
case ITEM_VALUE_TYPE_TEXT:
case ITEM_VALUE_TYPE_STR:
case ITEM_VALUE_TYPE_LOG:
$value = $this->screenitem['style'] ? new CJsScript($history['value']) : $history['value'];
break;
default:
$value = $history['value'];
break;
}
if ($item['valuemapid'] > 0) {
$value = applyValueMap($value, $item['valuemapid']);
}
$class = $this->screenitem['style'] ? null : 'pre';
$table->addRow(array(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $history['clock']), new CCol($value, $class)));
}
return $this->getOutput($table);
}
示例8: make_acktab_by_eventid
function make_acktab_by_eventid($eventid)
{
$table = new CTableInfo();
$table->SetHeader(array(S_TIME, S_USER, S_COMMENTS));
$acks = get_acknowledges_by_eventid($eventid);
while ($ack = DBfetch($acks)) {
//$users = CUser::get(array('userids' => $ack['userid'], 'output' => API_OUTPUT_EXTEND));
//$user = reset($users);
$table->addRow(array(zbx_date2str(S_ACKNOWINC_BY_EVENTS_DATE_FORMAT, $ack['clock']), $ack['alias'], new CCol(zbx_nl2br($ack['message']), 'wraptext')));
}
return $table;
}
示例9: _getContent
public function _getContent($refresh = false)
{
$table = new CTableInfo(_('No Login data found'));
$table->setHeader(array(_('User'), _('System')));
$data = array();
$db = mysql_connect($this->config['server'], $this->config['user'], $this->config['password']);
$sql = 'SELECT DISTINCT username, GROUP_CONCAT(DISTINCT address SEPARATOR "\\n") as connected_to FROM logs.auth_log WHERE address <> "-" AND NOT username IN ("ANONYMOUS LOGON") AND (current_timestamp-ts_last)<900 GROUP BY username ORDER BY username;';
$result = mysql_query($sql, $db);
if (mysql_num_rows($result) == 0) {
return $table;
}
while ($row = mysql_fetch_assoc($result)) {
$table->addRow(array($row['username'], new CObject(str_replace("\n", "<br/>", $row['connected_to']))));
}
return $table;
}
示例10: get
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get()
{
$options = array('monitored' => true, 'value' => array(TRIGGER_VALUE_TRUE, TRIGGER_VALUE_FALSE), 'triggerLimit' => $this->screenitem['elements'], 'eventLimit' => $this->screenitem['elements']);
$item = new CTableInfo(_('No events found.'));
$item->setHeader(array(_('Time'), is_show_all_nodes() ? _('Node') : null, _('Host'), _('Description'), _('Value'), _('Severity')));
$events = getLastEvents($options);
foreach ($events as $event) {
$trigger = $event['trigger'];
$host = $event['host'];
$statusSpan = new CSpan(trigger_value2str($event['value']));
// add colors and blinking to span depending on configuration and trigger parameters
addTriggerValueStyle($statusSpan, $event['value'], $event['clock'], $event['acknowledged']);
$item->addRow(array(zbx_date2str(_('d M Y H:i:s'), $event['clock']), get_node_name_by_elid($event['objectid']), $host['name'], new CLink($trigger['description'], 'tr_events.php?triggerid=' . $event['objectid'] . '&eventid=' . $event['eventid']), $statusSpan, getSeverityCell($trigger['priority'])));
}
return $this->getOutput($item);
}
示例11: _getContent
public function _getContent($refresh = false)
{
$table = new CTableInfo(_('No eventlog data found'));
$table->setHeader(array(_('System'), _('Notifications')));
$data = array();
$db = mysql_connect($this->config['server'], $this->config['user'], $this->config['password']);
$sql = 'SELECT host, priority, COUNT(priority) as eventCount FROM logs.logs GROUP BY host, priority;';
$result = mysql_query($sql, $db);
if (mysql_num_rows($result) == 0) {
return $table;
}
$table = new CTableInfo(_('No eventlog data found'));
$systems = array();
$headers = array();
$pMerge = array('info' => 'Notice', 'notice' => 'Notice', 'warn' => 'Warning', 'warning' => 'Warning', 'err' => 'Error', 'error' => 'Error', 'crit' => 'Critical', 'critical' => 'Critical');
foreach ($pMerge as $key => $value) {
$headers[$value] = $value;
}
while ($row = mysql_fetch_assoc($result)) {
if (!isset($systems[$row['host']])) {
$systems[$row['host']] = array();
}
if (isset($pMerge[$row['priority']])) {
$row['priority'] = $pMerge[$row['priority']];
}
$systems[$row['host']][$row['priority']] = $row['eventCount'];
$headers[$row['priority']] = $row['priority'];
}
$headersCompile = array(_("Host"));
foreach ($headers as $value) {
$headersCompile[] = _($value);
}
$table->setHeader($headersCompile);
foreach ($systems as $systemName => $eventData) {
$systemData = array(new CLink($systemName, '/zabbix/eventlog.php?server=' . $systemName));
foreach ($headers as $value) {
if (isset($eventData[$value])) {
$systemData[] = _($eventData[$value]);
} else {
$systemData[] = _("");
}
}
$table->addRow($systemData);
}
return $table;
}
示例12: _getContent
public function _getContent($refresh = false)
{
if (!isset($this->config['sql'])) {
return "SQL not set";
}
$table = new CTableInfo($this->emptyText);
$resultSet = DBselect($this->config['sql']);
$result = DbFetchArray($resultSet);
if (!empty($this->columns)) {
$headers = array();
foreach ($this->columns as $column) {
$headers[] = !empty($column['name']) ? $column['name'] : $column['field'];
}
} else {
if (isset($result[0])) {
foreach ($result[0] as $key => $value) {
$headers[] = $key;
$column = array('eval' => false, 'evalClass' => false, 'class' => null, 'width' => null, 'name' => $key, 'value' => $key);
$this->columns[] = $column;
}
} else {
$headers[] = "Empty Table";
}
}
if ($this->headers) {
$table->setHeader($headers);
}
$index = 0;
foreach ($result as $row) {
$row['index'] = $index++;
$crow = new CRow(null, $this->getRowClass($row));
foreach ($this->columns as $column) {
$cell = new CCol($this->getValue($column, $row), $this->getClass($column, $row));
$crow->addItem($cell);
}
$table->addRow($crow);
}
return $table;
}
示例13: get
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get()
{
$total = 0;
// fetch accessible host ids
$hosts = API::Host()->get(['output' => ['hostid'], 'preservekeys' => true]);
$hostids = array_keys($hosts);
if ($this->screenitem['resourceid'] != 0) {
$cond_from = ',hosts_groups hg';
$cond_where = ' AND hg.hostid=h.hostid AND hg.groupid=' . zbx_dbstr($this->screenitem['resourceid']);
} else {
$cond_from = '';
$cond_where = '';
}
$db_host_cnt = DBselect('SELECT COUNT(DISTINCT h.hostid) AS cnt' . ' FROM hosts h' . $cond_from . ' WHERE h.available=' . HOST_AVAILABLE_TRUE . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ')' . ' AND ' . dbConditionInt('h.hostid', $hostids) . $cond_where);
$host_cnt = DBfetch($db_host_cnt);
$avail = $host_cnt['cnt'];
$total += $host_cnt['cnt'];
$db_host_cnt = DBselect('SELECT COUNT(DISTINCT h.hostid) AS cnt' . ' FROM hosts h' . $cond_from . ' WHERE h.available=' . HOST_AVAILABLE_FALSE . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ')' . ' AND ' . dbConditionInt('h.hostid', $hostids) . $cond_where);
$host_cnt = DBfetch($db_host_cnt);
$notav = $host_cnt['cnt'];
$total += $host_cnt['cnt'];
$db_host_cnt = DBselect('SELECT COUNT(DISTINCT h.hostid) AS cnt' . ' FROM hosts h' . $cond_from . ' WHERE h.available=' . HOST_AVAILABLE_UNKNOWN . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ')' . ' AND ' . dbConditionInt('h.hostid', $hostids) . $cond_where);
$host_cnt = DBfetch($db_host_cnt);
$uncn = $host_cnt['cnt'];
$total += $host_cnt['cnt'];
$avail = (new CCol($avail . ' ' . _('Available')))->addClass(ZBX_STYLE_GREEN);
$notav = (new CCol($notav . ' ' . _('Not available')))->addClass(ZBX_STYLE_RED);
$uncn = (new CCol($uncn . ' ' . _('Unknown')))->addClass(ZBX_STYLE_GREY);
$total = new CCol($total . ' ' . _('Total'));
$header = (new CDiv([new CTag('h4', true, _('Hosts info'))]))->addClass(ZBX_STYLE_DASHBRD_WIDGET_HEAD);
if ($this->screenitem['resourceid'] != 0) {
$groups = API::HostGroup()->get(['output' => ['name'], 'groupids' => [$this->screenitem['resourceid']]]);
$header->addItem((new CList())->addItem([_('Group'), ':', SPACE, $groups[0]['name']]));
}
$table = new CTableInfo();
if ($this->screenitem['style'] == STYLE_HORIZONTAL) {
$table->addRow([$avail, $notav, $uncn, $total]);
} else {
$table->addRow($avail);
$table->addRow($notav);
$table->addRow($uncn);
$table->addRow($total);
}
$footer = (new CList())->addItem(_s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS)))->addClass(ZBX_STYLE_DASHBRD_WIDGET_FOOT);
return $this->getOutput(new CUiWidget(uniqid(), [$header, $table, $footer]));
}
示例14: get
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get()
{
$status = get_status();
$server = $status['zabbix_server'] == _('Yes') ? (new CSpan(_('running')))->addClass(ZBX_STYLE_GREEN) : (new CSpan(_('not running')))->addClass(ZBX_STYLE_RED);
$user_link = CWebUser::$data['alias'];
if (!CWebUser::isGuest()) {
$user_link = new CLink($user_link, 'profile.php');
}
$server_link = _('Zabbix server');
if (CWebUser::$data['type'] == USER_TYPE_SUPER_ADMIN) {
$server_link = new CLink($server_link, 'zabbix.php?action=report.status');
}
$table = new CTableInfo();
$table->addRow(_('Users (online)') . NAME_DELIMITER . $status['users_count'] . '(' . $status['users_online'] . ')');
$table->addRow(new CCol([_('Logged in as'), SPACE, $user_link]));
$table->addRow(new CCol([$server_link, SPACE, _('is'), SPACE, $server]));
$table->addRow(new CCol([_('Hosts (m/n/t)') . NAME_DELIMITER . $status['hosts_count'] . '(', (new CSpan($status['hosts_count_monitored']))->addClass(ZBX_STYLE_GREEN), '/', (new CSpan($status['hosts_count_not_monitored']))->addClass(ZBX_STYLE_RED), '/', (new CSpan($status['hosts_count_template']))->addClass(ZBX_STYLE_GREY), ')']));
$table->addRow(new CCol([_('Items (m/d/n)') . NAME_DELIMITER . $status['items_count'] . '(', (new CSpan($status['items_count_monitored']))->addClass(ZBX_STYLE_GREEN), '/', (new CSpan($status['items_count_disabled']))->addClass(ZBX_STYLE_RED), '/', (new CSpan($status['items_count_not_supported']))->addClass(ZBX_STYLE_GREY), ')']));
$table->addRow(new CCol([_('Triggers (e/d)[p/o]') . NAME_DELIMITER . $status['triggers_count'] . '(' . $status['triggers_count_enabled'] . '/' . $status['triggers_count_disabled'] . ')[', (new CSpan($status['triggers_count_on']))->addClass(ZBX_STYLE_GREEN), '/', (new CSpan($status['triggers_count_off']))->addClass(ZBX_STYLE_RED), ']']));
$footer = (new CList())->addItem(_s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS)))->addClass(ZBX_STYLE_DASHBRD_WIDGET_FOOT);
return $this->getOutput((new CUiWidget(uniqid(), [$table, $footer]))->setHeader(_('Zabbix server info')));
}
示例15: CWidget
** 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.
**/
$mediaTypeWidget = new CWidget();
// create new media type button
$createForm = new CForm('get');
$createForm->addItem(new CSubmit('form', _('Create media type')));
$mediaTypeWidget->addPageHeader(_('CONFIGURATION OF MEDIA TYPES'), $createForm);
$mediaTypeWidget->addHeader(_('Media types'));
$mediaTypeWidget->addHeaderRowNumber();
// create form
$mediaTypeForm = new CForm();
$mediaTypeForm->setName('mediaTypesForm');
// create table
$mediaTypeTable = new CTableInfo(_('No media types found.'));
$mediaTypeTable->setHeader(array(new CCheckBox('all_media_types', null, "checkAll('" . $mediaTypeForm->getName() . "', 'all_media_types', 'mediatypeids');"), $this->data['displayNodes'] ? _('Node') : null, make_sorting_header(_('Name'), 'description'), make_sorting_header(_('Type'), 'type'), _('Status'), _('Used in actions'), _('Details')));
foreach ($this->data['mediatypes'] as $mediaType) {
switch ($mediaType['typeid']) {
case MEDIA_TYPE_EMAIL:
$details = _('SMTP server') . NAME_DELIMITER . '"' . $mediaType['smtp_server'] . '", ' . _('SMTP helo') . NAME_DELIMITER . '"' . $mediaType['smtp_helo'] . '", ' . _('SMTP email') . NAME_DELIMITER . '"' . $mediaType['smtp_email'] . '"';
break;
case MEDIA_TYPE_EXEC:
$details = _('Script name') . NAME_DELIMITER . '"' . $mediaType['exec_path'] . '"';
break;
case MEDIA_TYPE_SMS:
$details = _('GSM modem') . NAME_DELIMITER . '"' . $mediaType['gsm_modem'] . '"';
break;
case MEDIA_TYPE_JABBER:
$details = _('Jabber identifier') . NAME_DELIMITER . '"' . $mediaType['username'] . '"';
break;