CS: Fix docstrings in Icinga/Web/Widget/* and Icinga/Web/Controller/ActionController.php
refs #4512
This commit is contained in:
parent
aff2398c81
commit
7dc2f78b63
|
@ -2,29 +2,30 @@
|
|||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Web\Controller;
|
||||
|
||||
use \Icinga\Authentication\Manager as AuthManager;
|
||||
|
@ -50,38 +51,37 @@ use \Zend_Controller_Action_HelperBroker as ZfActionHelper;
|
|||
*/
|
||||
class ActionController extends ZfController
|
||||
{
|
||||
|
||||
/**
|
||||
* True to mark this layout to not render the full layout
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
* True to mark this layout to not render the full layout
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $replaceLayout = false;
|
||||
|
||||
/**
|
||||
* If true, this controller will be shown even when no authentication is available
|
||||
* Needed mainly for the authentication controller
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
* If true, this controller will be shown even when no authentication is available
|
||||
* Needed mainly for the authentication controller
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $handlesAuthentication = false;
|
||||
|
||||
/**
|
||||
* Set true when this controller modifies the session.
|
||||
*
|
||||
* otherwise the session will be written back to disk and closed before the controller
|
||||
* action is executed, leading to every modification in the session to be lost after
|
||||
* the response is submitted
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
* Set true when this controller modifies the session
|
||||
*
|
||||
* otherwise the session will be written back to disk and closed before the controller
|
||||
* action is executed, leading to every modification in the session to be lost after
|
||||
* the response is submitted
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $modifiesSession = false;
|
||||
|
||||
/**
|
||||
* True if authentication suceeded, otherwise false
|
||||
*
|
||||
* @var bool
|
||||
**/
|
||||
* True if authentication suceeded, otherwise false
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $allowAccess = false;
|
||||
|
||||
|
||||
|
@ -107,15 +107,13 @@ class ActionController extends ZfController
|
|||
*/
|
||||
protected $action_name;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The constructor starts benchmarking, loads the configuration and sets
|
||||
* other useful controller properties
|
||||
*
|
||||
* @param ZfRequest $request
|
||||
* @param ZfResponse $response
|
||||
* @param array $invokeArgs Any additional invocation arguments
|
||||
* @param ZfRequest $request
|
||||
* @param ZfResponse $response
|
||||
* @param array $invokeArgs Any additional invocation arguments
|
||||
*/
|
||||
public function __construct(
|
||||
ZfRequest $request,
|
||||
|
@ -148,10 +146,10 @@ class ActionController extends ZfController
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the @see \Icinga\Widget\Web\Tabs of this view
|
||||
*
|
||||
* @return Tabs
|
||||
**/
|
||||
* Return the tabs
|
||||
*
|
||||
* @return \Icinga\Widget\Web\Tabs
|
||||
*/
|
||||
public function getTabs()
|
||||
{
|
||||
return $this->view->tabs;
|
||||
|
@ -186,7 +184,7 @@ class ActionController extends ZfController
|
|||
* Assert the current user has the given permission
|
||||
*
|
||||
* TODO: This has not been implemented yet (Feature #4111)
|
||||
*
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
final protected function assertPermission()
|
||||
|
@ -230,7 +228,7 @@ class ActionController extends ZfController
|
|||
|
||||
/**
|
||||
* Redirect to a specific url, updating the browsers URL field
|
||||
*
|
||||
*
|
||||
* @param Url|string $url The target to redirect to
|
||||
**/
|
||||
public function redirectNow($url)
|
||||
|
|
|
@ -39,18 +39,22 @@ use \Icinga\Web\Url;
|
|||
class BasketAction implements Tabextension
|
||||
{
|
||||
/**
|
||||
* @see Tabextension::apply()
|
||||
* Applies the dashboard actions to the provided tabset
|
||||
*
|
||||
* @param Tabs $tabs The tabs object to extend with
|
||||
*
|
||||
* @see \Icinga\Web\Widget\Tabextension::apply()
|
||||
*/
|
||||
public function apply(Tabs $tabs)
|
||||
{
|
||||
$tabs->addAsDropdown(
|
||||
'basket',
|
||||
array(
|
||||
'title' => 'URL Basket',
|
||||
'icon' => 'img/classic/basket.png',
|
||||
'url' => Url::fromPath('basket/add'),
|
||||
'title' => 'URL Basket',
|
||||
'icon' => 'img/classic/basket.png',
|
||||
'url' => Url::fromPath('basket/add'),
|
||||
'urlParams' => array(
|
||||
'url' => Url::fromRequest()->getRelativeUrl()
|
||||
'url' => Url::fromRequest()->getRelativeUrl()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
|
|
@ -43,19 +43,20 @@ class DashboardAction implements Tabextension
|
|||
/**
|
||||
* Applies the dashboard actions to the provided tabset
|
||||
*
|
||||
* @param Tabs The tabs object to extend with
|
||||
* @see Tabextension::apply()
|
||||
* @param Tabs $tabs The tabs object to extend with
|
||||
*
|
||||
* @see \Icinga\Web\Widget\Tabextension::apply()
|
||||
*/
|
||||
public function apply(Tabs $tabs)
|
||||
{
|
||||
$tabs->addAsDropdown(
|
||||
'dashboard',
|
||||
array(
|
||||
'title' => 'Add to Dashboard',
|
||||
'iconCls' => 'dashboard',
|
||||
'url' => Url::fromPath('dashboard/addurl'),
|
||||
'title' => 'Add to Dashboard',
|
||||
'iconCls' => 'dashboard',
|
||||
'url' => Url::fromPath('dashboard/addurl'),
|
||||
'urlParams' => array(
|
||||
'url' => Url::fromRequest()->getRelativeUrl()
|
||||
'url' => Url::fromRequest()->getRelativeUrl()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
|
|
@ -28,15 +28,13 @@
|
|||
|
||||
namespace Icinga\Web\Widget\Tabextension;
|
||||
|
||||
use Icinga\Application\Logger;
|
||||
use Icinga\Web\Widget\Tab;
|
||||
use Icinga\Web\Widget\Tabs;
|
||||
use Icinga\Web\Url;
|
||||
use \Icinga\Application\Logger;
|
||||
use \Icinga\Web\Widget\Tab;
|
||||
use \Icinga\Web\Widget\Tabs;
|
||||
use \Icinga\Web\Url;
|
||||
|
||||
/**
|
||||
* Tabextension that offers different output formats for the user in the dropdown area
|
||||
*
|
||||
*
|
||||
*/
|
||||
class OutputFormat implements Tabextension
|
||||
{
|
||||
|
@ -97,7 +95,7 @@ class OutputFormat implements Tabextension
|
|||
* In general, it's assumed that all types are supported when an outputFormat extension
|
||||
* is added, so this class offers to remove specific types instead of adding ones
|
||||
*
|
||||
* @param array $disabled An array of output types to <b>not</b> show.
|
||||
* @param array $disabled An array of output types to <b>not</b> show.
|
||||
*
|
||||
*/
|
||||
public function __construct(array $disabled = array())
|
||||
|
@ -119,9 +117,9 @@ class OutputFormat implements Tabextension
|
|||
/**
|
||||
* Applies the format selectio to the provided tabset
|
||||
*
|
||||
* @param Tabs The tabs object to extend with
|
||||
* @param Tabs $tabs The tabs object to extend with
|
||||
*
|
||||
* @see Tabextension::apply()
|
||||
* @see Tabextension::apply()
|
||||
*/
|
||||
public function apply(Tabs $tabs)
|
||||
{
|
||||
|
|
|
@ -31,19 +31,20 @@ namespace Icinga\Web\Widget\Tabextension;
|
|||
use \Icinga\Web\Widget\Tabs;
|
||||
|
||||
/**
|
||||
* Tabextension interface that allows to extend a tabbar with reusable components.
|
||||
*
|
||||
* Tabs can be either extended by creating a tabextension and calling the apply method
|
||||
* or by calling the tabs @see \Icinga\Web\Widget\Tabs::extend() method and providing
|
||||
* a tab extension.
|
||||
*
|
||||
**/
|
||||
* Tabextension interface that allows to extend a tabbar with reusable components
|
||||
*
|
||||
* Tabs can be either extended by creating a `Tabextension` and calling the `apply()` method
|
||||
* or by calling the `\Icinga\Web\Widget\Tabs` `extend()` method and providing
|
||||
* a tab extension
|
||||
*
|
||||
* @see \Icinga\Web\Widget\Tabs::extend()
|
||||
*/
|
||||
interface Tabextension
|
||||
{
|
||||
/**
|
||||
* Apply this tabextension to the provided tabs
|
||||
*
|
||||
* @param Tabs $tabs The tabbar to modify
|
||||
**/
|
||||
* Apply this tabextension to the provided tabs
|
||||
*
|
||||
* @param Tabs $tabs The tabbar to modify
|
||||
*/
|
||||
public function apply(Tabs $tabs);
|
||||
}
|
||||
|
|
|
@ -31,12 +31,10 @@ namespace Icinga\Web\Widget;
|
|||
use \Icinga\Exception\ProgrammingError;
|
||||
use \Icinga\Web\Widget\Tabextension\Tabextension;
|
||||
use \Zend_View_Abstract;
|
||||
|
||||
use \Countable;
|
||||
|
||||
/**
|
||||
* Navigation tab widget
|
||||
*
|
||||
*/
|
||||
class Tabs implements Countable, Widget
|
||||
{
|
||||
|
@ -45,11 +43,11 @@ class Tabs implements Countable, Widget
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
private $baseTpl =<<<'EOT'
|
||||
<ul class="nav nav-tabs">
|
||||
{TABS}
|
||||
private $baseTpl = <<< 'EOT'
|
||||
<ul class="nav nav-tabs">
|
||||
{TABS}
|
||||
{DROPDOWN}
|
||||
</ul>
|
||||
</ul>
|
||||
EOT;
|
||||
|
||||
/**
|
||||
|
@ -57,13 +55,15 @@ EOT;
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
private $dropdownTpl =<<<'EOT'
|
||||
<li class="dropdown pull-right ">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-list-ul"> </i></a>
|
||||
<ul class="dropdown-menu">
|
||||
{TABS}
|
||||
</ul>
|
||||
</li>
|
||||
private $dropdownTpl = <<< 'EOT'
|
||||
<li class="dropdown pull-right ">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="icon-list-ul"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
{TABS}
|
||||
</ul>
|
||||
</li>
|
||||
EOT;
|
||||
|
||||
|
||||
|
@ -93,11 +93,12 @@ EOT;
|
|||
*
|
||||
* If another tab is currently active it will be deactivated
|
||||
*
|
||||
* @param string $name Name of the tab going to be activated
|
||||
* @param string $name Name of the tab going to be activated
|
||||
*
|
||||
* @throws ProgrammingError if given tab name doesn't exist
|
||||
* @return self
|
||||
*
|
||||
* @throws ProgrammingError When the given tab name doesn't exist
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function activate($name)
|
||||
{
|
||||
|
@ -124,9 +125,9 @@ EOT;
|
|||
/**
|
||||
* Set the CSS class name(s) for the <ul> element
|
||||
*
|
||||
* @param string $name CSS class name(s)
|
||||
* @param string $name CSS class name(s)
|
||||
*
|
||||
* @return self
|
||||
* @return self
|
||||
*/
|
||||
public function setClass($name)
|
||||
{
|
||||
|
@ -137,9 +138,9 @@ EOT;
|
|||
/**
|
||||
* Whether the given tab name exists
|
||||
*
|
||||
* @param string $name Tab name
|
||||
* @param string $name Tab name
|
||||
*
|
||||
* @return bool
|
||||
* @return bool
|
||||
*/
|
||||
public function has($name)
|
||||
{
|
||||
|
@ -149,11 +150,11 @@ EOT;
|
|||
/**
|
||||
* Whether the given tab name exists
|
||||
*
|
||||
* @param string $name The tab you're interested in
|
||||
* @param string $name The tab you're interested in
|
||||
*
|
||||
* @throws ProgrammingError if given tab name doesn't exist
|
||||
* @return Tab
|
||||
*
|
||||
* @return Tab
|
||||
* @throws ProgrammingError When the given tab name doesn't exist
|
||||
*/
|
||||
public function get($name)
|
||||
{
|
||||
|
@ -169,12 +170,12 @@ EOT;
|
|||
* A unique tab name is required, the Tab itself can either be an array
|
||||
* with tab properties or an instance of an existing Tab
|
||||
*
|
||||
* @param string $name The new tab name
|
||||
* @param array|Tab The tab itself of it's properties
|
||||
* @param string $name The new tab name
|
||||
* @param array|Tab $tab The tab itself of it's properties
|
||||
*
|
||||
* @throws ProgrammingError if tab name already exists
|
||||
* @return self
|
||||
*
|
||||
* @return self
|
||||
* @throws ProgrammingError When the tab name already exists
|
||||
*/
|
||||
public function add($name, $tab)
|
||||
{
|
||||
|
@ -196,10 +197,10 @@ EOT;
|
|||
* exists. The tab can either be an array with tab properties or an instance
|
||||
* of an existing Tab
|
||||
*
|
||||
* @param string $name The new tab name
|
||||
* @param array|Tab The tab itself of it's properties
|
||||
* @param string $name The new tab name
|
||||
* @param array|Tab $tab The tab itself of it's properties
|
||||
*
|
||||
* @return self
|
||||
* @return self
|
||||
*/
|
||||
public function set($name, $tab)
|
||||
{
|
||||
|
@ -227,9 +228,9 @@ EOT;
|
|||
/**
|
||||
* Render the dropdown area with it's tabs and return the resulting HTML
|
||||
*
|
||||
* @param Zend_View_Abstract $view The view used for rendering
|
||||
* @param Zend_View_Abstract $view The view used for rendering
|
||||
*
|
||||
* @return mixed|string
|
||||
* @return mixed|string
|
||||
*/
|
||||
private function renderDropdownTabs(Zend_View_Abstract $view)
|
||||
{
|
||||
|
@ -244,15 +245,15 @@ EOT;
|
|||
}
|
||||
$tabs .= $tab->render($view);
|
||||
}
|
||||
return str_replace("{TABS}", $tabs, $this->dropdownTpl);
|
||||
return str_replace('{TABS}', $tabs, $this->dropdownTpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render all tabs, except the ones in dropdown area and return the resulting HTML
|
||||
*
|
||||
* @param Zend_View_Abstract $view The view used for rendering
|
||||
* @param Zend_View_Abstract $view The view used for rendering
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
private function renderTabs(Zend_View_Abstract $view)
|
||||
{
|
||||
|
@ -268,6 +269,8 @@ EOT;
|
|||
}
|
||||
|
||||
/**
|
||||
* Render to HTML
|
||||
*
|
||||
* @see Widget::render
|
||||
*/
|
||||
public function render(Zend_View_Abstract $view)
|
||||
|
@ -277,17 +280,17 @@ EOT;
|
|||
}
|
||||
|
||||
$html = $this->baseTpl;
|
||||
$html = str_replace("{TABS}", $this->renderTabs($view), $html);
|
||||
$html = str_replace("{DROPDOWN}", $this->renderDropdownTabs($view), $html);
|
||||
$html = str_replace('{TABS}', $this->renderTabs($view), $html);
|
||||
$html = str_replace('{DROPDOWN}', $this->renderDropdownTabs($view), $html);
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of tabs
|
||||
*
|
||||
* @see Countable
|
||||
* @return int
|
||||
*
|
||||
* @return int
|
||||
* @see Countable
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
|
@ -307,9 +310,9 @@ EOT;
|
|||
/**
|
||||
* Apply a Tabextension on this tabs object
|
||||
*
|
||||
* @param Tabextension $tabextension
|
||||
* @param Tabextension $tabextension
|
||||
*
|
||||
* @return self
|
||||
* @return self
|
||||
*/
|
||||
public function extend(Tabextension $tabextension)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue