Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions application/clicommands/AutocompleteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function completeAction()
$search_word = $bare_params[$cword];
if ($search_word === '--') {
// TODO: Unfinished, completion missing
return $this->suggest(array('--verbose', '--help', '--debug'));
return $this->suggest(['--verbose', '--help', '--debug']);
}

$search = $params->shift();
Expand All @@ -68,7 +68,7 @@ public function completeAction()
if ($found) {
// Do not return suggestions if we are already on the next word:
if ($bare_params[$cword] === $search) {
return $this->suggest(array($found));
return $this->suggest([$found]);
}
} else {
return $this->suggest($loader->getLastSuggestions());
Expand All @@ -90,7 +90,7 @@ public function completeAction()
if ($command) {
// Do not return suggestions if we are already on the next word:
if ($bare_params[$cword] === $search) {
return $this->suggest(array($command));
return $this->suggest([$command]);
}
$obj = $loader->getModuleCommandInstance(
$module,
Expand All @@ -112,7 +112,7 @@ public function completeAction()
);
if ($action) {
if ($bare_params[$cword] === $search) {
return $this->suggest(array($action));
return $this->suggest([$action]);
}
} else {
return $this->suggest($loader->getLastSuggestions());
Expand Down
2 changes: 1 addition & 1 deletion application/clicommands/ModuleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function init()
public function listAction()
{
if ($type = $this->params->shift()) {
if (! in_array($type, array('enabled', 'installed'))) {
if (! in_array($type, ['enabled', 'installed'])) {
return $this->showUsage();
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/AboutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ public function indexAction()
$this->view->title = $this->translate('About');
$this->view->tabs = $this->getTabs()->add(
'about',
array(
[
'label' => $this->translate('About'),
'title' => $this->translate('About Icinga Web 2'),
'url' => 'about'
)
]
)->activate('about');
}
}
18 changes: 9 additions & 9 deletions application/controllers/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@ class AccountController extends Controller
public function init()
{
$this->getTabs()
->add('account', array(
->add('account', [
'title' => $this->translate('Update your account'),
'label' => $this->translate('My Account'),
'url' => 'account'
))
->add('navigation', array(
])
->add('navigation', [
'title' => $this->translate('List and configure your own navigation items'),
'label' => $this->translate('Navigation'),
'url' => 'navigation'
))
])
->add(
'devices',
array(
[
'title' => $this->translate('List of devices you are logged in'),
'label' => $this->translate('My Devices'),
'url' => 'my-devices'
)
]
);
}

Expand Down Expand Up @@ -72,9 +72,9 @@ public function indexAction()
$form = new PreferenceForm();
$form->setPreferences($user->getPreferences());
if (isset($config->config_resource)) {
$form->setStore(PreferencesStore::create(new ConfigObject(array(
'resource' => $config->config_resource
)), $user));
$form->setStore(PreferencesStore::create(new ConfigObject([
'resource' => $config->config_resource
]), $user));
}
$form->handleRequest();

Expand Down
4 changes: 2 additions & 2 deletions application/controllers/AnnouncementsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ public function indexAction()
{
$this->getTabs()->add(
'announcements',
array(
[
'active' => true,
'label' => $this->translate('Announcements'),
'title' => $this->translate('List All Announcements'),
'url' => Url::fromPath('announcements')
)
]
);

$announcements = (new AnnouncementIniRepository())
Expand Down
32 changes: 16 additions & 16 deletions application/controllers/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,30 @@ public function createApplicationTabs()
{
$tabs = $this->getTabs();
if ($this->hasPermission('config/general')) {
$tabs->add('general', array(
$tabs->add('general', [
'title' => $this->translate('Adjust the general configuration of Icinga Web 2'),
'label' => $this->translate('General'),
'url' => 'config/general',
'baseTarget' => '_main'
));
]);
}
if ($this->hasPermission('config/resources')) {
$tabs->add('resource', array(
$tabs->add('resource', [
'title' => $this->translate('Configure which resources are being utilized by Icinga Web 2'),
'label' => $this->translate('Resources'),
'url' => 'config/resource',
'baseTarget' => '_main'
));
]);
}
if ($this->hasPermission('config/access-control/users')
|| $this->hasPermission('config/access-control/groups')
) {
$tabs->add('authentication', array(
$tabs->add('authentication', [
'title' => $this->translate('Configure the user and group backends'),
'label' => $this->translate('Access Control Backends'),
'url' => 'config/userbackend',
'baseTarget' => '_main'
));
]);
}

return $tabs;
Expand Down Expand Up @@ -125,11 +125,11 @@ public function modulesAction()
// Overwrite tabs created in init
// @TODO(el): This seems not natural to me. Module configuration should have its own controller.
$this->view->tabs = Widget::create('tabs')
->add('modules', array(
->add('modules', [
'label' => $this->translate('Modules'),
'title' => $this->translate('List intalled modules'),
'url' => 'config/modules'
))
])
->activate('modules');
$this->view->modules = Icinga::app()->getModuleManager()->select()
->from('modules')
Expand Down Expand Up @@ -418,10 +418,10 @@ public function resourceAction()
public function createresourceAction()
{
$this->assertPermission('config/resources');
$this->getTabs()->add('resources/new', array(
$this->getTabs()->add('resources/new', [
'label' => $this->translate('New Resource'),
'url' => Url::fromRequest()
))->activate('resources/new');
])->activate('resources/new');
$form = new ResourceConfigForm();
$form->addDescription($this->translate('Resources are entities that provide data to Icinga Web 2.'));
$form->setIniConfig(Config::app('resources'));
Expand All @@ -439,10 +439,10 @@ public function createresourceAction()
public function editresourceAction()
{
$this->assertPermission('config/resources');
$this->getTabs()->add('resources/update', array(
$this->getTabs()->add('resources/update', [
'label' => $this->translate('Update Resource'),
'url' => Url::fromRequest()
))->activate('resources/update');
])->activate('resources/update');
$form = new ResourceConfigForm();
$form->setIniConfig(Config::app('resources'));
$form->setRedirectUrl('config/resource');
Expand All @@ -459,11 +459,11 @@ public function editresourceAction()
public function removeresourceAction()
{
$this->assertPermission('config/resources');
$this->getTabs()->add('resources/remove', array(
$this->getTabs()->add('resources/remove', [
'label' => $this->translate('Remove Resource'),
'url' => Url::fromRequest()
))->activate('resources/remove');
$form = new ConfirmRemovalForm(array(
])->activate('resources/remove');
$form = new ConfirmRemovalForm([
'onSuccess' => function ($form) {
$configForm = new ResourceConfigForm();
$configForm->setIniConfig(Config::app('resources'));
Expand All @@ -482,7 +482,7 @@ public function removeresourceAction()
return false;
}
}
));
]);
$form->setRedirectUrl('config/resource');
$form->handleRequest();

Expand Down
32 changes: 16 additions & 16 deletions application/controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public function init()
public function newDashletAction()
{
$form = new DashletForm();
$this->getTabs()->add('new-dashlet', array(
$this->getTabs()->add('new-dashlet', [
'active' => true,
'label' => $this->translate('New Dashlet'),
'url' => Url::fromRequest()
));
]);
$dashboard = $this->dashboard;
$form->setDashboard($dashboard);
if ($this->_request->getParam('url')) {
Expand Down Expand Up @@ -84,11 +84,11 @@ public function newDashletAction()

public function updateDashletAction()
{
$this->getTabs()->add('update-dashlet', array(
$this->getTabs()->add('update-dashlet', [
'active' => true,
'label' => $this->translate('Update Dashlet'),
'url' => Url::fromRequest()
));
]);
$dashboard = $this->dashboard;
$form = new DashletForm();
$form->setDashboard($dashboard);
Expand Down Expand Up @@ -149,11 +149,11 @@ public function updateDashletAction()
public function removeDashletAction()
{
$form = new ConfirmRemovalForm();
$this->getTabs()->add('remove-dashlet', array(
$this->getTabs()->add('remove-dashlet', [
'active' => true,
'label' => $this->translate('Remove Dashlet'),
'url' => Url::fromRequest()
));
]);
$dashboard = $this->dashboard;
if (! $this->_request->getParam('pane')) {
throw new Zend_Controller_Action_Exception(
Expand Down Expand Up @@ -205,23 +205,23 @@ public function renamePaneAction()
$form->addElement(
'text',
'name',
array(
[
'required' => true,
'label' => $this->translate('Name')
)
]
);
$form->addElement(
'text',
'title',
array(
[
'required' => true,
'label' => $this->translate('Title')
)
]
);
$form->setDefaults(array(
$form->setDefaults([
'name' => $paneName,
'title' => $this->dashboard->getPane($paneName)->getTitle()
));
]);
$form->setOnSuccess(function ($form) use ($paneName) {
$newName = $form->getValue('name');
$newTitle = $form->getValue('title');
Expand All @@ -241,10 +241,10 @@ public function renamePaneAction()
$this->view->form = $form;
$this->getTabs()->add(
'update-pane',
array(
[
'title' => $this->translate('Update Pane'),
'url' => $this->getRequest()->getUrl()
)
]
)->activate('update-pane');
}

Expand Down Expand Up @@ -306,11 +306,11 @@ function ($pane) {
);
if (empty($panes)) {
$this->view->title = 'Dashboard';
$this->getTabs()->add('dashboard', array(
$this->getTabs()->add('dashboard', [
'active' => true,
'title' => $this->translate('Dashboard'),
'url' => Url::fromRequest()
));
]);
} else {
if ($this->_getParam('pane')) {
$pane = $this->_getParam('pane');
Expand Down
10 changes: 5 additions & 5 deletions application/controllers/ErrorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function errorAction()
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
$this->getResponse()->setHttpResponseCode(404);
$this->view->messages = array($this->translate('Page not found.'));
$this->view->messages = [$this->translate('Page not found.')];
if ($isAuthenticated) {
if ($modules->hasInstalled($moduleName) && ! $modules->hasEnabled($moduleName)) {
$this->view->messages[0] .= ' ' . sprintf(
Expand Down Expand Up @@ -136,10 +136,10 @@ public function errorAction()
}
}

$this->view->messages = array();
$this->view->messages = [];

if ($this->getInvokeArg('displayExceptions')) {
$this->view->stackTraces = array();
$this->view->stackTraces = [];

do {
$this->view->messages[] = $exception->getMessage();
Expand Down Expand Up @@ -168,11 +168,11 @@ public function errorAction()
$this->view->hideControls = true;
} else {
$this->view->hideControls = false;
$this->getTabs()->add('error', array(
$this->getTabs()->add('error', [
'active' => true,
'label' => $this->translate('Error'),
'url' => Url::fromRequest()
));
]);
}
}
}
Loading
Loading