mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-25 06:44:33 +02:00
Evaluate, Test and Move the items und library/Icinga/Web to the source tree
Fix PSR compliance. refs #4256
This commit is contained in:
parent
56844306c3
commit
5e14f828ba
@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Icinga\Web;
|
namespace Icinga\Web;
|
||||||
|
|
||||||
@ -6,13 +8,17 @@ use Zend_Form;
|
|||||||
use Zend_Controller_Front as Front; // TODO: Get from App
|
use Zend_Controller_Front as Front; // TODO: Get from App
|
||||||
use Zend_Controller_Action_HelperBroker as ZfActionHelper;
|
use Zend_Controller_Action_HelperBroker as ZfActionHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Form
|
||||||
|
* @package Icinga\Web
|
||||||
|
*/
|
||||||
class Form extends Zend_Form
|
class Form extends Zend_Form
|
||||||
{
|
{
|
||||||
protected $request;
|
protected $request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Zend_Controller_Request_Abstract $request
|
|
||||||
* @param array $options[optional]
|
* @param array $options[optional]
|
||||||
|
* @internal param \Icinga\Web\Zend_Controller_Request_Abstract $request
|
||||||
*/
|
*/
|
||||||
public function __construct($options = null)
|
public function __construct($options = null)
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
/**
|
|
||||||
* Icinga Web Grapher Hook
|
|
||||||
*/
|
|
||||||
namespace Icinga\Web\Hook;
|
namespace Icinga\Web\Hook;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,30 +1,62 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Icinga\Web\Hook;
|
namespace Icinga\Web\Hook;
|
||||||
|
|
||||||
use Icinga\Application\Logger as Logger;
|
use Icinga\Application\Logger as Logger;
|
||||||
|
|
||||||
abstract class Toptray {
|
/**
|
||||||
|
* Class Toptray
|
||||||
|
* @package Icinga\Web\Hook
|
||||||
|
*/
|
||||||
|
abstract class Toptray
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
const ALIGN_LEFT = "pull-left";
|
const ALIGN_LEFT = "pull-left";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
const ALIGN_NONE = "";
|
const ALIGN_NONE = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
const ALIGN_RIGHT = "pull-right";
|
const ALIGN_RIGHT = "pull-right";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $align = self::ALIGN_NONE;
|
protected $align = self::ALIGN_NONE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $align
|
||||||
|
*/
|
||||||
public function setAlignment($align)
|
public function setAlignment($align)
|
||||||
{
|
{
|
||||||
$this->align = $align;
|
$this->align = $align;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
final public function getWidgetDOM()
|
final public function getWidgetDOM()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return '<ul class="nav '.$this->align.'" >'.$this->buildDOM().'</ul>';
|
return '<ul class="nav ' . $this->align . '" >' . $this->buildDOM() . '</ul>';
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Logger::error("Could not create tray widget : %s",$e->getMessage());
|
Logger::error("Could not create tray widget : %s", $e->getMessage());
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
abstract protected function buildDOM();
|
abstract protected function buildDOM();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
/**
|
|
||||||
* Module action controller
|
|
||||||
*/
|
|
||||||
namespace Icinga\Web;
|
namespace Icinga\Web;
|
||||||
|
|
||||||
use Icinga\Application\Config;
|
use Icinga\Application\Config;
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Icinga\Web\Paginator\Adapter;
|
namespace Icinga\Web\Paginator\Adapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see Zend_Paginator_Adapter_Interface
|
* @see Zend_Paginator_Adapter_Interface
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
|
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
@ -65,3 +67,5 @@ class Icinga_Web_Paginator_ScrollingStyle_SlidingWithBorder implements Zend_Pagi
|
|||||||
return $range;
|
return $range;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @codingStandardsIgnoreEnd
|
@ -1,8 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
/**
|
|
||||||
* Web Widget abstract class
|
|
||||||
*/
|
|
||||||
namespace Icinga\Web\Widget;
|
namespace Icinga\Web\Widget;
|
||||||
|
|
||||||
use Icinga\Exception\ProgrammingError;
|
use Icinga\Exception\ProgrammingError;
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
/**
|
|
||||||
* Form
|
|
||||||
*/
|
|
||||||
namespace Icinga\Web\Widget;
|
namespace Icinga\Web\Widget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
/**
|
|
||||||
* Single tab
|
|
||||||
*/
|
|
||||||
namespace Icinga\Web\Widget;
|
namespace Icinga\Web\Widget;
|
||||||
|
|
||||||
use Icinga\Exception\ProgrammingError;
|
use Icinga\Exception\ProgrammingError;
|
||||||
@ -49,9 +48,7 @@ class Tab extends AbstractWidget
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Health check at initialization time
|
* Health check at initialization time
|
||||||
*
|
* @throws \Icinga\Exception\ProgrammingError if tab name is missing
|
||||||
* @throws Icinga\Exception\ProgrammingError if tab name is missing
|
|
||||||
*
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function init()
|
protected function init()
|
||||||
@ -75,7 +72,7 @@ class Tab extends AbstractWidget
|
|||||||
*/
|
*/
|
||||||
public function setActive($active = true)
|
public function setActive($active = true)
|
||||||
{
|
{
|
||||||
$this->active = (bool) $active;
|
$this->active = (bool)$active;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,10 +97,15 @@ class Tab extends AbstractWidget
|
|||||||
$class = $this->isActive() ? ' class="active"' : '';
|
$class = $this->isActive() ? ' class="active"' : '';
|
||||||
$caption = $this->title;
|
$caption = $this->title;
|
||||||
if ($this->icon !== null) {
|
if ($this->icon !== null) {
|
||||||
$caption = $view->img($this->icon, array(
|
$caption = $view->img(
|
||||||
|
$this->icon,
|
||||||
|
array(
|
||||||
'width' => 16,
|
'width' => 16,
|
||||||
'height' => 16
|
'height' => 16
|
||||||
)) . ' ' . $caption;
|
)
|
||||||
|
)
|
||||||
|
. ' '
|
||||||
|
. $caption;
|
||||||
}
|
}
|
||||||
if ($this->url !== null) {
|
if ($this->url !== null) {
|
||||||
$tab = $view->qlink(
|
$tab = $view->qlink(
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
/**
|
|
||||||
* Navigation tabs
|
|
||||||
*/
|
|
||||||
namespace Icinga\Web\Widget;
|
namespace Icinga\Web\Widget;
|
||||||
|
|
||||||
use Icinga\Exception\ProgrammingError;
|
use Icinga\Exception\ProgrammingError;
|
||||||
|
@ -56,15 +56,24 @@ class QueryAdapterTest extends \PHPUnit_Framework_TestCase
|
|||||||
$backend = new Statusdat($this->config);
|
$backend = new Statusdat($this->config);
|
||||||
$query = $backend->select()->from('hostlist');
|
$query = $backend->select()->from('hostlist');
|
||||||
|
|
||||||
$paginator = new QueryAdapter($query);
|
$adapter = new QueryAdapter($query);
|
||||||
|
|
||||||
$this->assertEquals(30, $paginator->count());
|
$this->assertEquals(30, $adapter->count());
|
||||||
|
|
||||||
$data = $paginator->getItems(0, 10);
|
$data = $adapter->getItems(0, 10);
|
||||||
|
|
||||||
$this->assertCount(10, $data);
|
$this->assertCount(10, $data);
|
||||||
|
|
||||||
$data = $paginator->getItems(10, 20);
|
$data = $adapter->getItems(10, 20);
|
||||||
$this->assertCount(10, $data);
|
$this->assertCount(10, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testLimit2()
|
||||||
|
{
|
||||||
|
$backend = new Statusdat($this->config);
|
||||||
|
$query = $backend->select()->from('hostlist');
|
||||||
|
|
||||||
|
$adapter = new QueryAdapter($query);
|
||||||
|
$this->assertEquals(30, $adapter->count());
|
||||||
|
}
|
||||||
}
|
}
|
@ -27,6 +27,8 @@ require_once '../../library/Icinga/Protocol/AbstractQuery.php';
|
|||||||
require_once '../../library/Icinga/Protocol/Statusdat/IReader.php';
|
require_once '../../library/Icinga/Protocol/Statusdat/IReader.php';
|
||||||
require_once '../../library/Icinga/Protocol/Statusdat/Reader.php';
|
require_once '../../library/Icinga/Protocol/Statusdat/Reader.php';
|
||||||
require_once '../../library/Icinga/Protocol/Statusdat/Query.php';
|
require_once '../../library/Icinga/Protocol/Statusdat/Query.php';
|
||||||
|
require_once '../../library/Icinga/Protocol/Statusdat/Parser.php';
|
||||||
|
require_once '../../library/Icinga/Protocol/Statusdat/RuntimeStateContainer.php';
|
||||||
|
|
||||||
require_once '../../library/Icinga/Web/Paginator/ScrollingStyle/SlidingWithBorder.php';
|
require_once '../../library/Icinga/Web/Paginator/ScrollingStyle/SlidingWithBorder.php';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user