本文整理汇总了PHP中Icinga\Data\Filter\Filter::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Filter::where方法的具体用法?PHP Filter::where怎么用?PHP Filter::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Icinga\Data\Filter\Filter
的用法示例。
在下文中一共展示了Filter::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showAction
public function showAction()
{
$this->setAutorefreshInterval(15);
$checkNowForm = new CheckNowCommandForm();
$checkNowForm->setObjects($this->serviceList)->handleRequest();
$this->view->checkNowForm = $checkNowForm;
$this->serviceList->setColumns(array('host_display_name', 'host_handled', 'host_name', 'host_problem', 'host_state', 'service_acknowledged', 'service_active_checks_enabled', 'service_description', 'service_display_name', 'service_handled', 'service_in_downtime', 'service_is_flapping', 'service_last_state_change', 'service_notifications_enabled', 'service_passive_checks_enabled', 'service_problem', 'service_state'));
$acknowledgedObjects = $this->serviceList->getAcknowledgedObjects();
if (!empty($acknowledgedObjects)) {
$removeAckForm = new RemoveAcknowledgementCommandForm();
$removeAckForm->setObjects($acknowledgedObjects)->handleRequest();
$this->view->removeAckForm = $removeAckForm;
}
$this->setAutorefreshInterval(15);
$this->view->rescheduleAllLink = Url::fromRequest()->setPath('monitoring/services/reschedule-check');
$this->view->downtimeAllLink = Url::fromRequest()->setPath('monitoring/services/schedule-downtime');
$this->view->processCheckResultAllLink = Url::fromRequest()->setPath('monitoring/services/process-check-result');
$this->view->addCommentLink = Url::fromRequest()->setPath('monitoring/services/add-comment');
$this->view->deleteCommentLink = Url::fromRequest()->setPath('monitoring/services/delete-comment');
$this->view->stats = $this->serviceList->getServiceStateSummary();
$this->view->objects = $this->serviceList;
$this->view->unhandledObjects = $this->serviceList->getUnhandledObjects();
$this->view->problemObjects = $this->serviceList->getProblemObjects();
$this->view->downtimeUnhandledLink = Url::fromPath('monitoring/services/schedule-downtime')->setQueryString($this->serviceList->getUnhandledObjects()->objectsFilter()->toQueryString());
$this->view->downtimeLink = Url::fromPath('monitoring/services/schedule-downtime')->setQueryString($this->serviceList->getProblemObjects()->objectsFilter()->toQueryString());
$this->view->acknowledgedObjects = $acknowledgedObjects;
$this->view->acknowledgeLink = Url::fromPath('monitoring/services/acknowledge-problem')->setQueryString($this->serviceList->getUnacknowledgedObjects()->objectsFilter()->toQueryString());
$this->view->unacknowledgedObjects = $this->serviceList->getUnacknowledgedObjects();
$this->view->objectsInDowntime = $this->serviceList->getObjectsInDowntime();
$this->view->inDowntimeLink = Url::fromPath('monitoring/list/services')->setQueryString($this->serviceList->getObjectsInDowntime()->objectsFilter(array('host' => 'host_name', 'service' => 'service_description'))->toQueryString());
$this->view->showDowntimesLink = Url::fromPath('monitoring/downtimes/show')->setQueryString($this->serviceList->getObjectsInDowntime()->objectsFilter()->andFilter(Filter::where('object_type', 'service'))->toQueryString());
$this->view->commentsLink = Url::fromRequest()->setPath('monitoring/list/comments');
$this->view->sendCustomNotificationLink = Url::fromRequest()->setPath('monitoring/services/send-custom-notification');
}
示例2: objectsFilter
/**
* Returns a Filter that matches all hosts in this list
*
* @return Filter
*/
public function objectsFilter($columns = array('host' => 'host'))
{
$filterExpression = array();
foreach ($this as $host) {
$filterExpression[] = Filter::where($columns['host'], $host->getName());
}
return FilterOr::matchAny($filterExpression);
}
示例3: argumentsAction
public function argumentsAction()
{
$this->getTabs()->activate('arguments');
$this->view->title = $this->translate('Command arguments');
$this->view->table = $this->loadTable('icingaCommandArgument')->setCommandObject($this->object)->setFilter(Filter::where('command', $this->params->get('name')));
$form = $this->view->form = $this->loadForm('icingaCommandArgument')->setCommandObject($this->object);
if ($id = $this->params->shift('argument_id')) {
$form->loadObject($id);
}
$form->handleRequest();
}
示例4: createElements
/**
* Create and add elements to this form
*
* @param array $formData The data sent by the user
*/
public function createElements(array $formData)
{
// TODO(jom): Fetching already existing members to prevent the user from mistakenly creating duplicate
// memberships (no matter whether the data source permits it or not, a member does never need to be
// added more than once) should be kept at backend level (GroupController::fetchUsers) but this does
// not work currently as our ldap protocol stuff is unable to handle our filter implementation..
$members = $this->backend->select()->from('group_membership', array('user_name'))->where('group_name', $this->groupName)->fetchColumn();
$filter = empty($members) ? Filter::matchAll() : Filter::not(Filter::where('user_name', $members));
$users = $this->ds->select()->from('user', array('user_name'))->applyFilter($filter)->fetchColumn();
if (!empty($users)) {
$this->addElement('multiselect', 'user_name', array('multiOptions' => array_combine($users, $users), 'label' => $this->translate('Backend Users'), 'description' => $this->translate('Select one or more users (fetched from your user backends) to add as group member'), 'class' => 'grant-permissions'));
}
$this->addElement('textarea', 'users', array('required' => empty($users), 'label' => $this->translate('Users'), 'description' => $this->translate('Provide one or more usernames separated by comma to add as group member')));
$this->setTitle(sprintf($this->translate('Add members for group %s'), $this->groupName));
$this->setSubmitLabel($this->translate('Add'));
}
示例5: showAction
public function showAction()
{
$this->setAutorefreshInterval(15);
if ($this->Auth()->hasPermission('monitoring/command/schedule-check')) {
$checkNowForm = new CheckNowCommandForm();
$checkNowForm->setObjects($this->serviceList)->handleRequest();
$this->view->checkNowForm = $checkNowForm;
}
$acknowledgedObjects = $this->serviceList->getAcknowledgedObjects();
if (!empty($acknowledgedObjects)) {
$removeAckForm = new RemoveAcknowledgementCommandForm();
$removeAckForm->setObjects($acknowledgedObjects)->handleRequest();
$this->view->removeAckForm = $removeAckForm;
}
$featureStatus = $this->serviceList->getFeatureStatus();
$toggleFeaturesForm = new ToggleObjectFeaturesCommandForm(array('backend' => $this->backend, 'objects' => $this->serviceList));
$toggleFeaturesForm->load((object) $featureStatus)->handleRequest();
$this->view->toggleFeaturesForm = $toggleFeaturesForm;
$this->setAutorefreshInterval(15);
$this->view->rescheduleAllLink = Url::fromRequest()->setPath('monitoring/services/reschedule-check');
$this->view->downtimeAllLink = Url::fromRequest()->setPath('monitoring/services/schedule-downtime');
$this->view->processCheckResultAllLink = Url::fromRequest()->setPath('monitoring/services/process-check-result');
$this->view->addCommentLink = Url::fromRequest()->setPath('monitoring/services/add-comment');
$this->view->deleteCommentLink = Url::fromRequest()->setPath('monitoring/services/delete-comment');
$this->view->stats = $this->serviceList->getServiceStateSummary();
$this->view->objects = $this->serviceList;
$this->view->unhandledObjects = $this->serviceList->getUnhandledObjects();
$this->view->problemObjects = $this->serviceList->getProblemObjects();
$this->view->downtimeUnhandledLink = Url::fromPath('monitoring/services/schedule-downtime')->setQueryString($this->serviceList->getUnhandledObjects()->objectsFilter()->toQueryString());
$this->view->downtimeLink = Url::fromPath('monitoring/services/schedule-downtime')->setQueryString($this->serviceList->getProblemObjects()->objectsFilter()->toQueryString());
$this->view->acknowledgedObjects = $acknowledgedObjects;
$this->view->acknowledgeLink = Url::fromPath('monitoring/services/acknowledge-problem')->setQueryString($this->serviceList->getUnacknowledgedObjects()->objectsFilter()->toQueryString());
$this->view->unacknowledgedObjects = $this->serviceList->getUnacknowledgedObjects();
$this->view->objectsInDowntime = $this->serviceList->getObjectsInDowntime();
$this->view->inDowntimeLink = Url::fromPath('monitoring/list/services')->setQueryString($this->serviceList->getObjectsInDowntime()->objectsFilter(array('host' => 'host_name', 'service' => 'service_description'))->toQueryString());
$this->view->showDowntimesLink = Url::fromPath('monitoring/downtimes/show')->setQueryString($this->serviceList->getObjectsInDowntime()->objectsFilter()->andFilter(Filter::where('object_type', 'service'))->toQueryString());
$this->view->commentsLink = Url::fromRequest()->setPath('monitoring/list/comments');
$this->view->sendCustomNotificationLink = Url::fromRequest()->setPath('monitoring/services/send-custom-notification');
}
示例6: addpropertyAction
public function addpropertyAction()
{
$this->view->stayHere = true;
$edit = false;
if ($id = $this->params->get('id')) {
$edit = true;
}
$form = $this->view->form = $this->loadForm('syncProperty')->setDb($this->db());
if ($edit) {
$form->loadObject($id);
$rule_id = $form->getObject()->rule_id;
$form->setRule(SyncRule::load($rule_id, $this->db()));
} elseif ($rule_id = $this->params->get('rule_id')) {
$form->setRule(SyncRule::load($rule_id, $this->db()));
}
$form->setSuccessUrl('director/syncrule/property', array('rule_id' => $rule_id));
$form->handleRequest();
$tabs = $this->getTabs()->add('edit', array('url' => 'director/syncrule/edit', 'urlParams' => array('id' => $rule_id), 'label' => $this->translate('Edit sync rule')));
if ($edit) {
$tabs->add('property', array('label' => $this->translate('Properties'), 'url' => 'director/syncrule/property', 'urlParams' => array('rule_id' => $rule_id)));
} else {
$tabs->add('property', array('label' => $this->translate('Properties'), 'url' => 'director/syncrule/property', 'urlParams' => array('rule_id' => $rule_id)));
}
$tabs->activate('property');
$this->view->title = $this->translate('Sync property');
// add/edit
$this->view->table = $this->loadTable('syncproperty')->enforceFilter(Filter::where('rule_id', $rule_id))->setConnection($this->db());
$this->render('list/table', null, true);
}
示例7: delete
/**
* Delete table rows, optionally limited by using a filter
*
* @param string $table
* @param Filter $filter
*/
public function delete($table, Filter $filter = null)
{
if ($table === 'group') {
parent::delete('group_membership', $filter);
$idQuery = $this->select(array('group_id'));
if ($filter !== null) {
$idQuery->applyFilter($filter);
}
$this->update('group', array('parent' => null), Filter::where('parent', $idQuery->fetchColumn()));
}
parent::delete($table, $filter);
}
示例8: where
/**
* Filter this query using the given column and value
*
* This notifies the repository about the required filter column.
*
* @param string $column
* @param mixed $value
*
* @return $this
*/
public function where($column, $value = null)
{
$this->addFilter(Filter::where($column, $value));
return $this;
}
示例9: objectsFilter
/**
* Returns a Filter that matches all hosts in this HostList
*
* @param array $columns Override filter column names
*
* @return Filter
*/
public function objectsFilter($columns = array('host' => 'host', 'service' => 'service'))
{
$filterExpression = array();
foreach ($this as $service) {
$filterExpression[] = Filter::matchAll(Filter::where($columns['host'], $service->getHost()->getName()), Filter::where($columns['service'], $service->getName()));
}
return FilterOr::matchAny($filterExpression);
}
示例10: enforceFilter
public function enforceFilter($filter, $expression = null)
{
if (!$filter instanceof Filter) {
$filter = Filter::where($filter, $expression);
}
$this->enforcedFilters[] = $filter;
return $this;
}
示例11: servicegridAction
public function servicegridAction()
{
$this->addTitleTab('servicegrid', $this->translate('Service Grid'), $this->translate('Show the Service Grid'));
$this->setAutorefreshInterval(15);
$query = $this->backend->select()->from('servicestatus', array('host_display_name', 'host_name', 'service_description', 'service_display_name', 'service_handled', 'service_output', 'service_state'));
$this->applyRestriction('monitoring/filter/objects', $query);
$this->filterQuery($query);
$filter = (bool) $this->params->shift('problems', false) ? Filter::where('service_problem', 1) : null;
$pivot = $query->pivot('service_description', 'host_name', $filter, $filter ? clone $filter : null)->setXAxisHeader('service_display_name')->setYAxisHeader('host_display_name');
$this->setupSortControl(array('host_display_name' => $this->translate('Hostname'), 'service_display_name' => $this->translate('Service Name')), $pivot);
$this->view->horizontalPaginator = $pivot->paginateXAxis();
$this->view->verticalPaginator = $pivot->paginateYAxis();
list($pivotData, $pivotHeader) = $pivot->toArray();
$this->view->pivotData = $pivotData;
$this->view->pivotHeader = $pivotHeader;
}
示例12: fetchResults
/**
* Fetch all entries and forecasts by using the dataview associated with this timeline
*
* @return array The dataview's result
*/
private function fetchResults()
{
$hookResults = array();
foreach (Hook::all('timeline') as $timelineProvider) {
$hookResults = array_merge($hookResults, $timelineProvider->fetchEntries($this->displayRange), $timelineProvider->fetchForecasts($this->forecastRange));
foreach ($timelineProvider->getIdentifiers() as $identifier => $attributes) {
if (!array_key_exists($identifier, $this->identifiers)) {
$this->identifiers[$identifier] = $attributes;
}
}
}
$query = $this->dataview;
$filter = Filter::matchAll(Filter::where('type', array_keys($this->identifiers)), Filter::expression('timestamp', '<=', $this->displayRange->getStart()->getTimestamp()), Filter::expression('timestamp', '>', $this->displayRange->getEnd()->getTimestamp()));
$query->applyFilter($filter);
return array_merge($query->getQuery()->fetchAll(), $hookResults);
}
示例13: onSuccess
/**
* {@inheritdoc}
*/
public function onSuccess()
{
$backend = $this->getBackend();
$backend->update($backend->getBaseTable(), array('password' => $this->getElement('new_password')->getValue()), Filter::where('user_name', $this->Auth()->getUser()->getUsername()));
Notification::success($this->translate('Account updated'));
}
示例14: reallyRetrieveStatesFromBackend
public function reallyRetrieveStatesFromBackend()
{
Benchmark::measure('Retrieving states for business process ' . $this->getName());
$backend = $this->getBackend();
// TODO: Split apart, create a dedicated function.
// Separate "parse-logic" from "retrieve-state-logic"
// Allow DB-based backend
// Use IcingaWeb2 Multi-Backend-Support
$check_results = array();
$hostFilter = array_keys($this->hosts);
if ($this->state_type === self::HARD_STATE) {
$hostStateColumn = 'host_hard_state';
$hostStateChangeColumn = 'host_last_hard_state_change';
$serviceStateColumn = 'service_hard_state';
$serviceStateChangeColumn = 'service_last_hard_state_change';
} else {
$hostStateColumn = 'host_state';
$hostStateChangeColumn = 'host_last_state_change';
$serviceStateColumn = 'service_state';
$serviceStateChangeColumn = 'service_last_state_change';
}
$filter = Filter::matchAny();
foreach ($hostFilter as $host) {
$filter->addFilter(Filter::where('host_name', $host));
}
if ($filter->isEmpty()) {
return $this;
}
$hostStatus = $backend->select()->from('hostStatus', array('hostname' => 'host_name', 'last_state_change' => $hostStateChangeColumn, 'in_downtime' => 'host_in_downtime', 'ack' => 'host_acknowledged', 'state' => $hostStateColumn))->applyFilter($filter)->getQuery()->fetchAll();
$serviceStatus = $backend->select()->from('serviceStatus', array('hostname' => 'host_name', 'service' => 'service_description', 'last_state_change' => $serviceStateChangeColumn, 'in_downtime' => 'service_in_downtime', 'ack' => 'service_acknowledged', 'state' => $serviceStateColumn))->applyFilter($filter)->getQuery()->fetchAll();
foreach ($serviceStatus as $row) {
$this->handleDbRow($row);
}
foreach ($hostStatus as $row) {
$this->handleDbRow($row);
}
ksort($this->root_nodes);
Benchmark::measure('Got states for business process ' . $this->getName());
return $this;
}
示例15: where
public function where($condition, $value = null)
{
$this->filter->addFilter(Filter::where($condition, $value));
$this->query->where($condition, $value);
return $this;
}