当前位置: 首页>>代码示例>>PHP>>正文


PHP Web\Url类代码示例

本文整理汇总了PHP中Icinga\Web\Url的典型用法代码示例。如果您正苦于以下问题:PHP Url类的具体用法?PHP Url怎么用?PHP Url使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Url类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 public function render()
 {
     if ($this->url === null) {
         $this->url = Url::fromRequest();
     }
     $currentLimit = (int) $this->url->getParam('limit', $this->default);
     $availableLimits = array(10 => '10', 25 => '25', 50 => '50', 100 => '100', 500 => '500');
     if ($currentLimit === 0) {
         $availableLimits[0] = t('all');
     }
     // if ($this->pages === 1 && $currentLimit === 10) return '';
     $limits = array();
     $view = $this->view();
     $gotCurrent = false;
     foreach ($availableLimits as $limit => $caption) {
         if ($gotCurrent) {
             if ($this->pages === 1) {
                 //    break;
             }
         }
         if ($this->max !== null && ($limit === 0 || $limit > $this->max)) {
             //echo "$limit > $this->max"; break;
         }
         if ($limit === $currentLimit) {
             $gotCurrent = true;
             $limits[] = $caption;
         } else {
             $limits[] = $view->qlink($caption, $this->url->setParam('limit', $limit), null, array('title' => sprintf($view->translate('Limit each page to a maximum of %u rows'), $caption)));
         }
     }
     if (empty($limits)) {
         return '';
     }
     return '<span class="widgetLimiter">' . implode(' ', $limits) . '</span>';
 }
开发者ID:JakobGM,项目名称:icingaweb2,代码行数:35,代码来源:Limiter.php

示例2: getUrl

 /**
  * Get the request URL
  *
  * @return Url
  */
 public function getUrl()
 {
     if ($this->url === null) {
         $this->url = Url::fromRequest($this);
     }
     return $this->url;
 }
开发者ID:trigoesrodrigo,项目名称:icingaweb2,代码行数:12,代码来源:Request.php

示例3: indexAction

 /**
  * Create full report
  */
 public function indexAction()
 {
     $this->getTabs()->add('alertsummary', array('title' => $this->translate('Show recent alerts and visualize notifications and problems' . ' based on their amount and chronological distribution'), 'label' => $this->translate('Alert Summary'), 'url' => Url::fromRequest()))->extend(new DashboardAction())->extend(new MenuAction())->activate('alertsummary');
     $this->view->title = $this->translate('Alert Summary');
     $this->view->intervalBox = $this->createIntervalBox();
     list($recentAlerts, $recentAlertsUrl) = $this->createRecentAlerts();
     $this->view->recentAlerts = $recentAlerts;
     $this->view->recentAlertsUrl = $recentAlertsUrl;
     $this->view->interval = $this->getInterval();
     $this->view->defectChart = $this->createDefectImage();
     $this->view->healingChart = $this->createHealingChart();
     $this->view->perf = $this->createNotificationPerfdata();
     $this->view->trend = $this->createTrendInformation();
     $this->setAutorefreshInterval(15);
     $query = $this->backend->select()->from('notification', array('host_name', 'host_display_name', 'service_description', 'service_display_name', 'notification_output', 'notification_contact_name', 'notification_start_time', 'notification_state'));
     $this->applyRestriction('monitoring/filter/objects', $query);
     $this->view->notifications = $query;
     $this->view->notificationsUrl = 'monitoring/list/notifications';
     $this->setupLimitControl();
     if ($limit = $this->params->get('limit')) {
         $query->limit($limit);
     } else {
         $query->limit(25);
     }
 }
开发者ID:trigoesrodrigo,项目名称:icingaweb2,代码行数:28,代码来源:AlertsummaryController.php

示例4: showAction

 public function showAction()
 {
     $this->setAutorefreshInterval(15);
     $checkNowForm = new CheckNowCommandForm();
     $checkNowForm->setObjects($this->serviceList)->handleRequest();
     $this->view->checkNowForm = $checkNowForm;
     $this->serviceList->setColumns(array('host_icon_image', 'host_icon_image_alt', 'host_name', 'host_address', 'host_output', 'host_state', 'host_problem', 'host_handled', 'service_icon_image', 'service_icon_image_alt', 'service_output', 'service_description', 'service_state', 'service_problem', 'service_handled', 'service_acknowledged', 'service_in_downtime', 'service_is_flapping', 'service_notifications_enabled', 'service_active_checks_enabled', 'service_passive_checks_enabled'));
     $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()->toQueryString());
     $this->view->commentsLink = Url::fromRequest()->setPath('monitoring/list/comments');
     $this->view->sendCustomNotificationLink = Url::fromRequest()->setPath('monitoring/services/send-custom-notification');
 }
开发者ID:JakobGM,项目名称:icingaweb2,代码行数:34,代码来源:ServicesController.php

示例5: showAction

 public function showAction()
 {
     $this->setAutorefreshInterval(15);
     $checkNowForm = new CheckNowCommandForm();
     $checkNowForm->setObjects($this->hostList)->handleRequest();
     $this->view->checkNowForm = $checkNowForm;
     $this->hostList->setColumns(array('host_acknowledged', 'host_active_checks_enabled', 'host_display_name', 'host_handled', 'host_in_downtime', 'host_is_flapping', 'host_last_state_change', 'host_name', 'host_notifications_enabled', 'host_passive_checks_enabled', 'host_problem', 'host_state'));
     $acknowledgedObjects = $this->hostList->getAcknowledgedObjects();
     if (!empty($acknowledgedObjects)) {
         $removeAckForm = new RemoveAcknowledgementCommandForm();
         $removeAckForm->setObjects($acknowledgedObjects)->handleRequest();
         $this->view->removeAckForm = $removeAckForm;
     }
     $hostStates = $this->hostList->getStateSummary();
     $this->setAutorefreshInterval(15);
     $this->view->rescheduleAllLink = Url::fromRequest()->setPath('monitoring/hosts/reschedule-check');
     $this->view->downtimeAllLink = Url::fromRequest()->setPath('monitoring/hosts/schedule-downtime');
     $this->view->processCheckResultAllLink = Url::fromRequest()->setPath('monitoring/hosts/process-check-result');
     $this->view->addCommentLink = Url::fromRequest()->setPath('monitoring/hosts/add-comment');
     $this->view->stats = $hostStates;
     $this->view->objects = $this->hostList;
     $this->view->unhandledObjects = $this->hostList->getUnhandledObjects();
     $this->view->problemObjects = $this->hostList->getProblemObjects();
     $this->view->acknowledgeUnhandledLink = Url::fromPath('monitoring/hosts/acknowledge-problem')->setQueryString($this->hostList->getUnhandledObjects()->objectsFilter()->toQueryString());
     $this->view->downtimeUnhandledLink = Url::fromPath('monitoring/hosts/schedule-downtime')->setQueryString($this->hostList->getUnhandledObjects()->objectsFilter()->toQueryString());
     $this->view->downtimeLink = Url::fromPath('monitoring/hosts/schedule-downtime')->setQueryString($this->hostList->getProblemObjects()->objectsFilter()->toQueryString());
     $this->view->acknowledgedObjects = $this->hostList->getAcknowledgedObjects();
     $this->view->acknowledgeLink = Url::fromPath('monitoring/hosts/acknowledge-problem')->setQueryString($this->hostList->getUnacknowledgedObjects()->objectsFilter()->toQueryString());
     $this->view->unacknowledgedObjects = $this->hostList->getUnacknowledgedObjects();
     $this->view->objectsInDowntime = $this->hostList->getObjectsInDowntime();
     $this->view->inDowntimeLink = Url::fromPath('monitoring/list/hosts')->setQueryString($this->hostList->getObjectsInDowntime()->objectsFilter()->toQueryString());
     $this->view->showDowntimesLink = Url::fromPath('monitoring/list/downtimes')->setQueryString($this->hostList->objectsFilter()->andFilter(FilterEqual::where('object_type', 'host'))->toQueryString());
     $this->view->commentsLink = Url::fromRequest()->setPath('monitoring/list/comments');
     $this->view->sendCustomNotificationLink = Url::fromRequest()->setPath('monitoring/hosts/send-custom-notification');
 }
开发者ID:kobmaki,项目名称:icingaweb2,代码行数:35,代码来源:HostsController.php

示例6: preDispatch

 /**
  * Use a default redirection rule to welcome page
  */
 public function preDispatch()
 {
     if ($this->getRequest()->getActionName() !== 'welcome') {
         // @TODO(el): Avoid landing page redirects: https://dev.icinga.org/issues/9656
         $this->redirectNow(Url::fromRequest()->setPath('dashboard'));
     }
 }
开发者ID:0svald,项目名称:icingaweb2,代码行数:10,代码来源:IndexController.php

示例7: createLink

 /**
  * Creates a menu item link element
  *
  * @param Menu $menu
  *
  * @return string
  */
 public function createLink(Menu $menu)
 {
     if ($menu->getIcon() && strpos($menu->getIcon(), '.') === false) {
         return sprintf('<a href="%s"%s><i aria-hidden="true" class="icon-%s"></i>%s</a>', $menu->getUrl() ?: '#', $this->getAttributes(), $menu->getIcon(), $this->getView()->escape($menu->getTitle()));
     }
     return sprintf('<a href="%s"%s>%s%s<span></span></a>', $menu->getUrl() ?: '#', $this->getAttributes(), $menu->getIcon() ? '<img aria-hidden="true" src="' . Url::fromPath($menu->getIcon()) . '" class="icon" /> ' : '', $this->getView()->escape($menu->getTitle()));
 }
开发者ID:hsanjuan,项目名称:icingaweb2,代码行数:14,代码来源:MenuItemRenderer.php

示例8: historyAction

 /**
  * @deprecated
  */
 public function historyAction()
 {
     if ($this->params->has('service')) {
         $this->redirectNow(Url::fromRequest()->setPath('monitoring/service/history'));
     }
     $this->redirectNow(Url::fromRequest()->setPath('monitoring/host/history'));
 }
开发者ID:NerdGZ,项目名称:icingaweb2,代码行数:10,代码来源:ShowController.php

示例9: editAction

 /**
  * Edit an user group backend
  */
 public function editAction()
 {
     $backendName = $this->params->getRequired('backend');
     $form = new UserGroupBackendForm();
     $form->setAction(Url::fromRequest());
     $form->setRedirectUrl('usergroupbackend/list');
     $form->setTitle(sprintf($this->translate('Edit User Group Backend %s'), $backendName));
     $form->setIniConfig(Config::app('groups'));
     $form->setOnSuccess(function (UserGroupBackendForm $form) use($backendName) {
         try {
             $form->edit($backendName, array_map(function ($v) {
                 return $v !== '' ? $v : null;
             }, $form->getValues()));
         } catch (Exception $e) {
             $form->error($e->getMessage());
             return false;
         }
         if ($form->save()) {
             Notification::success(sprintf(t('User group backend "%s" successfully updated'), $backendName));
             return true;
         }
         return false;
     });
     try {
         $form->load($backendName);
         $form->handleRequest();
     } catch (NotFoundError $_) {
         $this->httpNotFound(sprintf($this->translate('User group backend "%s" not found'), $backendName));
     }
     $this->view->form = $form;
     $this->render('form');
 }
开发者ID:hsanjuan,项目名称:icingaweb2,代码行数:35,代码来源:UsergroupbackendController.php

示例10: indexAction

 public function indexAction()
 {
     $this->getTabs()->add('tactical_overview', array('title' => $this->translate('Show an overview of all hosts and services, their current' . ' states and monitoring feature utilisation'), 'label' => $this->translate('Tactical Overview'), 'url' => Url::fromRequest()))->extend(new DashboardAction())->activate('tactical_overview');
     $stats = $this->backend->select()->from('statussummary', array('hosts_up', 'hosts_pending', 'hosts_down', 'hosts_down_unhandled', 'hosts_unreachable', 'hosts_unreachable_unhandled', 'services_ok_on_ok_hosts', 'services_ok_not_checked_on_ok_hosts', 'services_pending_on_ok_hosts', 'services_pending_not_checked_on_ok_hosts', 'services_warning_handled_on_ok_hosts', 'services_warning_unhandled_on_ok_hosts', 'services_warning_passive_on_ok_hosts', 'services_warning_not_checked_on_ok_hosts', 'services_critical_handled_on_ok_hosts', 'services_critical_unhandled_on_ok_hosts', 'services_critical_passive_on_ok_hosts', 'services_critical_not_checked_on_ok_hosts', 'services_unknown_handled_on_ok_hosts', 'services_unknown_unhandled_on_ok_hosts', 'services_unknown_passive_on_ok_hosts', 'services_unknown_not_checked_on_ok_hosts', 'services_ok_on_problem_hosts', 'services_ok_not_checked_on_problem_hosts', 'services_pending_on_problem_hosts', 'services_pending_not_checked_on_problem_hosts', 'services_warning_handled_on_problem_hosts', 'services_warning_unhandled_on_problem_hosts', 'services_warning_passive_on_problem_hosts', 'services_warning_not_checked_on_problem_hosts', 'services_critical_handled_on_problem_hosts', 'services_critical_unhandled_on_problem_hosts', 'services_critical_passive_on_problem_hosts', 'services_critical_not_checked_on_problem_hosts', 'services_unknown_handled_on_problem_hosts', 'services_unknown_unhandled_on_problem_hosts', 'services_unknown_passive_on_problem_hosts', 'services_unknown_not_checked_on_problem_hosts', 'hosts_active', 'hosts_passive', 'hosts_not_checked', 'services_active', 'services_passive', 'services_not_checked', 'hosts_not_processing_event_handlers', 'services_not_processing_event_handlers', 'hosts_not_triggering_notifications', 'services_not_triggering_notifications', 'hosts_without_flap_detection', 'services_without_flap_detection', 'hosts_flapping', 'services_flapping'));
     $this->applyRestriction('monitoring/filter/objects', $stats);
     $this->view->statusSummary = $stats->fetchRow();
 }
开发者ID:hsanjuan,项目名称:icingaweb2,代码行数:7,代码来源:TacticalController.php

示例11: createDelCommentForm

 /**
  * Create a command form to delete a single comment
  *
  * @return DeleteCommentsCommandForm
  */
 private function createDelCommentForm()
 {
     $this->assertPermission('monitoring/command/comment/delete');
     $delCommentForm = new DeleteCommentCommandForm();
     $delCommentForm->setAction(Url::fromPath('monitoring/comment/show')->setParam('comment_id', $this->comment->id));
     $delCommentForm->handleRequest();
     return $delCommentForm;
 }
开发者ID:NerdGZ,项目名称:icingaweb2,代码行数:13,代码来源:CommentController.php

示例12: __construct

 public function __construct($options = null)
 {
     parent::__construct($this->handleOptions($options));
     $this->setMethod('post');
     $this->setAction(Url::fromRequest());
     $this->createIdElement();
     $this->regenerateCsrfToken();
 }
开发者ID:0svald,项目名称:icingaweb2-module-businessprocess,代码行数:8,代码来源:QuickForm.php

示例13: init

 /**
  * Initialize this form
  */
 public function init()
 {
     $this->setName('form_dashboard_addurl');
     if (!$this->getSubmitLabel()) {
         $this->setSubmitLabel($this->translate('Add To Dashboard'));
     }
     $this->setAction(Url::fromRequest());
 }
开发者ID:0svald,项目名称:icingaweb2,代码行数:11,代码来源:DashletForm.php

示例14: createDelDowntimeForm

 /**
  * Create a command form to delete a single comment
  *
  * @return DeleteDowntimeCommandForm
  */
 private function createDelDowntimeForm()
 {
     $this->assertPermission('monitoring/command/downtime/delete');
     $delDowntimeForm = new DeleteDowntimeCommandForm();
     $delDowntimeForm->setAction(Url::fromPath('monitoring/downtime/show')->setParam('downtime_id', $this->downtime->id));
     $delDowntimeForm->handleRequest();
     return $delDowntimeForm;
 }
开发者ID:NerdGZ,项目名称:icingaweb2,代码行数:13,代码来源:DowntimeController.php

示例15: menuAction

 /**
  * Render the menu
  */
 public function menuAction()
 {
     $this->setAutorefreshInterval(15);
     $this->_helper->layout()->disableLayout();
     $url = Url::fromRequest();
     $menu = new MenuRenderer(Menu::load(), $url->getRelativeUrl());
     $this->view->menuRenderer = $menu->useCustomRenderer();
 }
开发者ID:JakobGM,项目名称:icingaweb2,代码行数:11,代码来源:LayoutController.php


注:本文中的Icinga\Web\Url类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。