Evaluate, Test and Move the items und library/Icinga/Web to the source tree

Fix PSR compliance.

refs #4256
This commit is contained in:
Marius Hein 2013-06-11 11:09:28 +02:00 committed by Jannis Moßhammer
parent 56844306c3
commit 5e14f828ba
12 changed files with 92 additions and 39 deletions

View File

@ -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)
{ {

View File

@ -1,8 +1,7 @@
<?php <?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
/**
* Icinga Web Grapher Hook
*/
namespace Icinga\Web\Hook; namespace Icinga\Web\Hook;
/** /**

View File

@ -1,19 +1,48 @@
<?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 {
@ -26,5 +55,8 @@ abstract class Toptray {
} }
/**
* @return mixed
*/
abstract protected function buildDOM(); abstract protected function buildDOM();
} }

View File

@ -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;

View File

@ -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
*/ */

View File

@ -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

View File

@ -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;

View File

@ -1,8 +1,7 @@
<?php <?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
/**
* Form
*/
namespace Icinga\Web\Widget; namespace Icinga\Web\Widget;
/** /**

View File

@ -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()
@ -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(

View File

@ -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;

View File

@ -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());
}
} }

View File

@ -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';