本文整理汇总了PHP中Icinga\Web\Notification类的典型用法代码示例。如果您正苦于以下问题:PHP Notification类的具体用法?PHP Notification怎么用?PHP Notification使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Notification类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onSuccess
/**
* (non-PHPDoc)
* @see \Icinga\Web\Form::onSuccess() For the method documentation.
*/
public function onSuccess()
{
foreach ($this->objects as $object) {
/** @var \Icinga\Module\Monitoring\Object\Host $object */
$childHosts = (int) $this->getElement('child_hosts')->getValue();
$allServices = $this->getElement('all_services')->isChecked();
if ($childHosts === 0) {
$hostDowntime = new ScheduleHostDowntimeCommand();
if ($allServices === true) {
$hostDowntime->setForAllServices();
}
} else {
$hostDowntime = new PropagateHostDowntimeCommand();
if ($childHosts === 1) {
$hostDowntime->setTriggered();
}
if ($allServices === true) {
foreach ($object->services as $service) {
$serviceDowntime = new ScheduleServiceDowntimeCommand();
$serviceDowntime->setObject($service);
$this->scheduleDowntime($serviceDowntime, $this->request);
}
}
}
$hostDowntime->setObject($object);
$this->scheduleDowntime($hostDowntime, $this->request);
}
Notification::success($this->translatePlural('Scheduling host downtime..', 'Scheduling host downtimes..', count($this->objects)));
return true;
}
示例2: deployAction
public function deployAction()
{
$isApiRequest = $this->getRequest()->isApiRequest();
$checksum = $this->params->get('checksum');
if ($checksum) {
$config = IcingaConfig::load(Util::hex2binary($checksum), $this->db());
} else {
$config = IcingaConfig::generate($this->db());
$checksum = $config->getHexChecksum();
}
if ($this->api()->dumpConfig($config, $this->db())) {
if ($isApiRequest) {
return $this->sendJson((object) array('checksum' => $checksum));
} else {
$url = Url::fromPath('director/list/deploymentlog');
Notification::success($this->translate('Config has been submitted, validation is going on'));
$this->redirectNow($url);
}
} else {
if ($isApiRequest) {
return $this->sendJsonError('Config deployment failed');
} else {
$url = Url::fromPath('director/config/show', array('checksum' => $checksum));
Notification::success($this->translate('Config deployment failed'));
$this->redirectNow($url);
}
}
}
示例3: onSuccess
public function onSuccess()
{
$name = $this->getValue('name');
$this->storage->deleteProcess($name);
$this->setRedirectUrl('businessprocess');
Notification::success(sprintf('Process %s has been deleted', $name));
}
示例4: onSuccess
/**
* (non-PHPDoc)
* @see \Icinga\Web\Form::onSuccess() For the method documentation.
*/
public function onSuccess()
{
$disableNotifications = new DisableNotificationsExpireCommand();
$disableNotifications->setExpireTime($this->getElement('expire_time')->getValue()->getTimestamp());
$this->getTransport($this->request)->send($disableNotifications);
Notification::success($this->translate('Disabling host and service notifications..'));
return true;
}
示例5: runAction
public function runAction()
{
if ($runId = Sync::run(SyncRule::load($this->params->get('id'), $this->db()))) {
Notification::success('Source has successfully been synchronized');
$this->redirectNow('director/list/syncrule');
} else {
}
}
示例6: onSuccess
/**
* @see Form::onSuccess()
*/
public function onSuccess()
{
$this->config->setSection('security', $this->getValues());
if ($this->save()) {
Notification::success($this->translate('New security configuration has successfully been stored'));
} else {
return false;
}
}
示例7: onSuccess
/**
* (non-PHPDoc)
* @see \Icinga\Web\Form::onSuccess() For the method documentation.
*/
public function onSuccess()
{
foreach ($this->objects as $object) {
/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
$removeAck = new RemoveAcknowledgementCommand();
$removeAck->setObject($object);
$this->getTransport($this->request)->send($removeAck);
}
Notification::success(mtp('monitoring', 'Removing problem acknowledgement..', 'Removing problem acknowledgements..', count($this->objects)));
return true;
}
示例8: onSuccess
/**
* (non-PHPDoc)
* @see \Icinga\Web\Form::onSuccess() For the method documentation.
*/
public function onSuccess()
{
foreach ($this->objects as $object) {
/** @var \Icinga\Module\Monitoring\Object\Service $object */
$check = new ScheduleServiceCheckCommand();
$check->setObject($object);
$this->scheduleCheck($check, $this->request);
}
Notification::success($this->translatePlural('Scheduling service check..', 'Scheduling service checks..', count($this->objects)));
return true;
}
示例9: onSuccess
/**
* (non-PHPDoc)
* @see \Icinga\Web\Form::onSuccess() For the method documentation.
*/
public function onSuccess()
{
foreach ($this->objects as $object) {
/** @var \Icinga\Module\Monitoring\Object\Service $object */
$downtime = new ScheduleServiceDowntimeCommand();
$downtime->setObject($object);
$this->scheduleDowntime($downtime, $this->request);
}
Notification::success($this->translatePlural('Scheduling service downtime..', 'Scheduling service downtimes..', count($this->objects)));
return true;
}
示例10: onSuccess
/**
* (non-PHPDoc)
* @see \Icinga\Web\Form::onSuccess() For the method documentation.
*/
public function onSuccess()
{
foreach ($this->objects as $object) {
/** @var \Icinga\Module\Monitoring\Object\Host $object */
$check = new ScheduleHostCheckCommand();
$check->setObject($object)->setOfAllServices($this->getElement('all_services')->isChecked());
$this->scheduleCheck($check, $this->request);
}
Notification::success($this->translatePlural('Scheduling host check..', 'Scheduling host checks..', count($this->objects)));
return true;
}
示例11: onSuccess
/**
* {@inheritdoc}
*/
public function onSuccess()
{
foreach ($this->objects as $object) {
/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
$notification = new SendCustomNotificationCommand();
$notification->setObject($object)->setComment($this->getElement('comment')->getValue())->setAuthor($this->request->getUser()->getUsername())->setForced($this->getElement('forced')->isChecked())->setBroadcast($this->getElement('broadcast')->isChecked());
$this->getTransport($this->request)->send($notification);
}
Notification::success($this->translatePlural('Sending custom notification..', 'Sending custom notifications..', count($this->objects)));
return true;
}
示例12: loadModifiedBpConfig
protected function loadModifiedBpConfig()
{
$bp = $this->loadBpConfig();
$changes = ProcessChanges::construct($bp, $this->session());
if ($this->params->get('dismissChanges')) {
Notification::success(sprintf($this->translate('%d pending change(s) have been dropped'), $changes->count()));
$changes->clear();
$this->redirectNow($this->url()->without('dismissChanges')->without('unlocked'));
}
$bp->applyChanges($changes);
return $bp;
}
示例13: onSuccess
/**
* (non-PHPDoc)
* @see \Icinga\Web\Form::onSuccess() For the method documentation.
*/
public function onSuccess()
{
$cmd = new DeleteCommentCommand();
$cmd->setIsService($this->getElement('comment_is_service')->getValue())->setCommentId($this->getElement('comment_id')->getValue());
$this->getTransport($this->request)->send($cmd);
$redirect = $this->getElement('redirect')->getValue();
if (!empty($redirect)) {
$this->setRedirectUrl($redirect);
}
Notification::success($this->translate('Deleting comment..'));
return true;
}
示例14: runAction
public function runAction()
{
$id = $this->params->get('id');
$import = new Import(ImportSource::load($id, $this->db()));
if ($runId = $import->run()) {
Notification::success('Import succeeded');
$this->redirectNow(Url::fromPath('director/importrun', array('id' => $runId)));
} else {
Notification::success('Import skipped, no changes detected');
$this->redirectNow('director/list/importrun');
}
}
示例15: onSuccess
/**
* (non-PHPDoc)
* @see \Icinga\Web\Form::onSuccess() For the method documentation.
*/
public function onSuccess()
{
foreach ($this->objects as $object) {
/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
$ack = new AcknowledgeProblemCommand();
$ack->setObject($object)->setComment($this->getElement('comment')->getValue())->setAuthor($this->request->getUser()->getUsername())->setPersistent($this->getElement('persistent')->isChecked())->setSticky($this->getElement('sticky')->isChecked())->setNotify($this->getElement('notify')->isChecked());
if ($this->getElement('expire')->isChecked()) {
$ack->setExpireTime($this->getElement('expire_time')->getValue()->getTimestamp());
}
$this->getTransport($this->request)->send($ack);
}
Notification::success($this->translatePlural('Acknowledging problem..', 'Acknowledging problems..', count($this->objects)));
return true;
}