本文整理汇总了PHP中Icinga\Data\Filter\Filter::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:PHP Filter::isEmpty方法的具体用法?PHP Filter::isEmpty怎么用?PHP Filter::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Icinga\Data\Filter\Filter
的用法示例。
在下文中一共展示了Filter::isEmpty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render()
{
$url = Url::fromRequest();
$view = $this->view();
$html = ' <form method="post" class="inline" action="' . $url . '"><input type="text" name="q" style="width: 8em" class="search" value="" placeholder="' . t('Add filter...') . '" /></form>';
// $html .= $this->renderFilter($this->filter);
$editorUrl = clone $url;
$editorUrl->setParam('modifyFilter', true);
if ($this->filter->isEmpty()) {
$title = t('Filter this list');
$txt = $view->icon('plus');
$remove = '';
} else {
$txt = t('Filtered');
$title = t('Modify this filter');
$remove = ' <a href="' . Url::fromRequest()->setParams(array()) . '" title="' . t('Remove this filter') . '">' . $view->icon('cancel') . '</a>';
}
$filter = $this->filter->isEmpty() ? '' : ': ' . $this->filter;
$html .= ($filter ? '<p>' : ' ') . '<a href="' . $editorUrl . '" title="' . $title . '">' . $txt . '</a>' . $this->shorten($filter, 72) . $remove . ($filter ? '</p>' : '');
return $html;
}
示例2: renderSearch
public function renderSearch()
{
$html = ' <form method="post" class="search inline dontprint" action="' . $this->preservedUrl() . '"><input type="text" name="q" style="width: 8em" class="search" value="" placeholder="' . t('Search...') . '" /></form>';
if ($this->filter->isEmpty()) {
$title = t('Filter this list');
} else {
$title = t('Modify this filter');
if (!$this->filter->isEmpty()) {
$title .= ': ' . $this->filter;
}
}
return $html . '<a href="' . $this->preservedUrl()->with('modifyFilter', true) . '" aria-label="' . $title . '" title="' . $title . '">' . '<i aria-hidden="true" class="icon-filter"></i>' . '</a>';
}
示例3: filterChainToArray
protected function filterChainToArray(Filter $filter)
{
if ($filter instanceof FilterAnd) {
$op = 'and';
} elseif ($filter instanceof FilterOr) {
$op = 'or';
} elseif ($filter instanceof FilterNot) {
$op = 'not';
} else {
throw new QueryException('Cannot render filter: %s', $filter);
}
$parts = array($op);
if (!$filter->isEmpty()) {
foreach ($filter->filters() as $f) {
$parts[] = $this->filterToArray($f);
}
}
return $parts;
}
示例4: renderFilter
/**
* Filter rendering
*
* Happens recursively, useful for filters and for Stats expressions
*
* @param Filter $filter The filter that should be rendered
* @param string $type Filter type. Usually "Filter" or "Stats"
* @param int $level Nesting level during recursion. Don't touch
* @param bool $keylookup Whether to resolve alias names
*
* @return string
*/
protected function renderFilter(Filter $filter, $type = 'Filter', $level = 0, $keylookup = true)
{
$str = '';
if ($filter instanceof FilterChain) {
if ($filter instanceof FilterAnd) {
$op = 'And';
} elseif ($filter instanceof FilterOr) {
$op = 'Or';
} elseif ($filter instanceof FilterNot) {
$op = 'Negate';
} else {
throw new IcingaException('Cannot render filter: %s', $filter);
}
$parts = array();
if (!$filter->isEmpty()) {
foreach ($filter->filters() as $f) {
$parts[] = $this->renderFilter($f, $type, $level + 1, $keylookup);
}
$str .= implode("\n", $parts);
if ($type === 'Filter') {
if (count($parts) > 1) {
$str .= "\n" . $op . ': ' . count($parts);
}
} else {
$str .= "\n" . $type . $op . ': ' . count($parts);
}
}
} else {
$str .= $type . ': ' . $this->renderFilterExpression($filter, $keylookup);
}
return $str;
}
示例5: fetchResources
public function fetchResources(Filter $filter = null, $exported = null)
{
if ($filter === null || $filter->isEmpty()) {
$query = null;
} else {
$query = FilterRenderer::forFilter($filter)->toArray();
}
if ($exported !== null) {
if ($query === null) {
$query = array('=', 'exported', $exported);
} else {
$query = array('and', array('=', 'exported', $exported), $query);
}
}
$url = 'resources';
$columns = array('certname', 'type', 'title', 'exported', 'parameters', 'environment');
if ($query !== null) {
if ($this->version === 'v4') {
$query = array('extract', $columns, $query);
}
$url .= '?' . $this->encodeParameter('query', $query);
}
$order = array(array('field' => 'type', 'order' => 'asc'), array('field' => 'title', 'order' => 'asc'));
if ($exported === null) {
array_unshift($order, array('field' => 'exported', 'order' => 'desc'));
}
$url .= '&' . $this->orderBy($order);
return $this->fetchLimited($url);
}