Skip to content

Commit

Permalink
Merge pull request #10 from pedro-teixeira/feature/add-travis-badges
Browse files Browse the repository at this point in the history
Add travis and badges
  • Loading branch information
pedro-teixeira committed Oct 7, 2014
2 parents 95889d3 + 1534ce3 commit f80694e
Show file tree
Hide file tree
Showing 35 changed files with 179 additions and 145 deletions.
9 changes: 3 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
vendor
composer.lock
/vendor/
/bin/
/composer.lock

# IDE Files #
#############
.idea
nbproject

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
Expand Down
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: php

php:
- 5.3
- 5.4
- 5.5
- 5.6
- hhvm

before_script:
- composer self-update
- composer install

script:
- find ./Grid ./DependencyInjection ./Twig -name "*.php" -exec php -l {} \;
- ./bin/phpcs --extensions=php --standard=PSR2 ./Grid ./DependencyInjection ./Twig
2 changes: 1 addition & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* This is the class that validates and merges configuration from your app/config files
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
* @link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class
*/
class Configuration implements ConfigurationInterface
{
Expand Down
2 changes: 1 addition & 1 deletion Grid/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,4 +330,4 @@ public function getRender()
);
}
}
}
}
2 changes: 1 addition & 1 deletion Grid/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ public function createGrid($gridClassName)

return $grid;
}
}
}
13 changes: 9 additions & 4 deletions Grid/Filter/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ public function __construct(\Symfony\Component\DependencyInjection\Container $co
public function render()
{
if ($this->getUseDatePicker()) {
$html = '<input ' . $this->getNameAndId() . ' type="text" value="' . $this->getValue() . '" placeholder="' . $this->getPlaceholder() . '" data-date-format="' . strtolower($this->dateFormat) . '">';
$html .= '<script type="text/javascript">$(document).ready(function () {$("#' . $this->getId() . '").datepicker()})</script>';
$html = '<input ' . $this->getNameAndId() . ' type="text" value="' . $this->getValue() .
'" placeholder="' . $this->getPlaceholder() .
'" data-date-format="' . strtolower($this->dateFormat) . '">';

$html .= '<script type="text/javascript">' .
'$(document).ready(function () {$("#' . $this->getId() . '").datepicker()})</script>';
} else {
$html = '<input ' . $this->getNameAndId() . ' type="date" value="' . $this->getValue() . '" placeholder="' . $this->getPlaceholder() . '">';
$html = '<input ' . $this->getNameAndId() . ' type="date" value="' . $this->getValue() .
'" placeholder="' . $this->getPlaceholder() . '">';
}

return $html;
Expand All @@ -50,4 +55,4 @@ public function getUseDatePicker()
{
return $this->container->getParameter('pedro_teixeira_grid.date.use_datepicker');
}
}
}
22 changes: 16 additions & 6 deletions Grid/Filter/DateRange.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,28 @@ class DateRange extends Date
public function render()
{
if ($this->getUseDatePicker()) {
$html = '<input class="date-input" name="' . $this->getIndex() . '[]" id="' . $this->getId() .
'from" type="text" value="' . $this->getValue() .
'" placeholder="' . $this->getPlaceholder() .
'" data-date-format="' . strtolower($this->dateFormat) . '">';

$html = '<input class="date-input" name="' . $this->getIndex() . '[]" id="' . $this->getId() . 'from" type="text" value="' . $this->getValue() . '" placeholder="' . $this->getPlaceholder() . '" data-date-format="' . strtolower($this->dateFormat) . '">';
$html .= $this->getInputSeparator();
$html .= '<input class="date-input" name="' . $this->getIndex() . '[]" id="' . $this->getId() . 'to" type="text" value="' . $this->getValue() . '" placeholder="' . $this->getPlaceholder() . '" data-date-format="' . strtolower($this->dateFormat) . '">';
$html .= '<script type="text/javascript">$(document).ready(function () {$("#' . $this->getId() . 'from").datepicker(); $("#' . $this->getId() . 'to").datepicker()})</script>';

$html .= '<input class="date-input" name="' . $this->getIndex() . '[]" id="' . $this->getId() .
'to" type="text" value="' . $this->getValue() .
'" placeholder="' . $this->getPlaceholder() .
'" data-date-format="' . strtolower($this->dateFormat) . '">';

$html .= '<script type="text/javascript">$(document).ready(function () {$("#' .
$this->getId() . 'from").datepicker(); $("#' . $this->getId() . 'to").datepicker()})</script>';
} else {
$html = '<input class="date-input" name="' . $this->getIndex() . '[]" id="' . $this->getId() .
'from" type="date" placeholder="' . $this->getPlaceholder() . '" value="' . $this->getValue() . '"> ';

$html = '<input class="date-input" name="' . $this->getIndex() . '[]" id="' . $this->getId() . 'from" type="date" placeholder="' . $this->getPlaceholder() . '" value="' . $this->getValue() . '"> ';
$html .= $this->getInputSeparator();
$html .= '<input class="date-input" name="' . $this->getIndex() . '[]" id="' . $this->getId() . 'to" type="date" placeholder="' . $this->getPlaceholder() . '" value="' . $this->getValue() . '">';

$html .= '<input class="date-input" name="' . $this->getIndex() . '[]" id="' . $this->getId() .
'to" type="date" placeholder="' . $this->getPlaceholder() . '" value="' . $this->getValue() . '">';
}

return $html;
Expand All @@ -59,4 +69,4 @@ public function getInputSeparator()
{
return $this->inputSeparator;
}
}
}
2 changes: 1 addition & 1 deletion Grid/Filter/FilterAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,4 @@ public function execute(\Doctrine\ORM\QueryBuilder $queryBuilder, $value)
->setQueryBuilder($queryBuilder)
->execute($value);
}
}
}
10 changes: 7 additions & 3 deletions Grid/Filter/NumberRange.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ class NumberRange extends FilterAbstract
*/
public function render()
{
$html = '<input class="number-input" name="' . $this->getIndex() . '[]" id="' . $this->getId() . 'from" type="text" placeholder="' . $this->getPlaceholder() . '" value="' . $this->getValue() . '"> ';
$html = '<input class="number-input" name="' . $this->getIndex() . '[]" id="' . $this->getId() .
'from" type="text" placeholder="' . $this->getPlaceholder() . '" value="' . $this->getValue() . '"> ';

$html .= $this->getInputSeparator();
$html .= '<input class="number-input" name="' . $this->getIndex() . '[]" id="' . $this->getId() . 'to" type="text" placeholder="' . $this->getPlaceholder() . '" value="' . $this->getValue() . '">';

$html .= '<input class="number-input" name="' . $this->getIndex() . '[]" id="' . $this->getId() .
'to" type="text" placeholder="' . $this->getPlaceholder() . '" value="' . $this->getValue() . '">';

return $html;
}
Expand All @@ -48,4 +52,4 @@ public function getInputSeparator()
{
return $this->inputSeparator;
}
}
}
2 changes: 1 addition & 1 deletion Grid/Filter/Operator/Comparison.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,4 @@ public function getComparisonType()
{
return $this->comparisonType;
}
}
}
2 changes: 1 addition & 1 deletion Grid/Filter/Operator/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ public function execute($value)

$queryBuilder->setParameter($this->getIndexClean(), $date->format('Y-m-d') . '%');
}
}
}
8 changes: 5 additions & 3 deletions Grid/Filter/Operator/DateRange.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public function execute($value)
$queryBuilder->expr()->gte(
$this->getIndex(),
":{$this->getIndexClean()}_1"
))
)
)
->setParameter(
":{$this->getIndexClean()}_1",
$date->format('Y-m-d') . ' 00:00:00'
Expand All @@ -55,11 +56,12 @@ public function execute($value)
$queryBuilder->expr()->lte(
$this->getIndex(),
":{$this->getIndexClean()}_2"
))
)
)
->setParameter(
":{$this->getIndexClean()}_2",
$date->format('Y-m-d') . ' 23:59:59'
);
}
}
}
}
2 changes: 1 addition & 1 deletion Grid/Filter/Operator/Having.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ public function execute($value)
$queryBuilder->having($this->getIndex() . " = :{$this->getIndexClean()}")
->setParameter($this->getIndexClean(), $value);
}
}
}
2 changes: 1 addition & 1 deletion Grid/Filter/Operator/HavingNumberRange.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ public function execute($value)
);
}
}
}
}
8 changes: 5 additions & 3 deletions Grid/Filter/Operator/NumberRange.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public function execute($value)
$queryBuilder->expr()->gte(
$this->getIndex(),
":{$this->getIndexClean()}_1"
))
)
)
->setParameter(
":{$this->getIndexClean()}_1",
(float) $value[0]
Expand All @@ -38,11 +39,12 @@ public function execute($value)
$queryBuilder->expr()->lte(
$this->getIndex(),
":{$this->getIndexClean()}_2"
))
)
)
->setParameter(
":{$this->getIndexClean()}_2",
(float) $value[1]
);
}
}
}
}
2 changes: 1 addition & 1 deletion Grid/Filter/Operator/OperatorAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ public function getWhere()
{
return $this->where;
}
}
}
2 changes: 1 addition & 1 deletion Grid/Filter/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ public function getOptions()
{
return $this->options;
}
}
}
5 changes: 3 additions & 2 deletions Grid/Filter/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class Text extends FilterAbstract
*/
public function render()
{
$html = '<input ' . $this->getNameAndId() . ' type="' . $this->getInputType() . '" value="' . $this->getValue() . '" placeholder="' . $this->getPlaceholder() . '">';
$html = '<input ' . $this->getNameAndId() . ' type="' . $this->getInputType() .
'" value="' . $this->getValue() . '" placeholder="' . $this->getPlaceholder() . '">';

return $html;
}
Expand All @@ -41,4 +42,4 @@ public function getInputType()
{
return $this->inputType;
}
}
}
2 changes: 1 addition & 1 deletion Grid/Filter/YesNo.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ class YesNo extends Select
'0' => 'No',
'1' => 'Yes'
);
}
}
10 changes: 5 additions & 5 deletions Grid/GridAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,24 +370,24 @@ public function getData()
$rowColumn = $row[$column->getField()];

// Array scalar
} else if (array_key_exists(0, $row) && array_key_exists($column->getField(), $row[0])) {
} elseif (array_key_exists(0, $row) && array_key_exists($column->getField(), $row[0])) {

$rowColumn = $row[0][$column->getField()];

// Object
} else if (method_exists($row, 'get' . ucfirst($column->getField()))) {
} elseif (method_exists($row, 'get' . ucfirst($column->getField()))) {

$method = 'get' . ucfirst($column->getField());
$rowColumn = $row->$method();

// Object scalar
} else if (array_key_exists(0, $row) && method_exists($row[0], 'get' . ucfirst($column->getField()))) {
} elseif (array_key_exists(0, $row) && method_exists($row[0], 'get' . ucfirst($column->getField()))) {

$method = 'get' . ucfirst($column->getField());
$rowColumn = $row[0]->$method();

// Array
} else if ($column->getTwig()) {
} elseif ($column->getTwig()) {

$rowColumn = $this->templating->render(
$column->getTwig(),
Expand Down Expand Up @@ -508,4 +508,4 @@ public function render()
}
}
}
}
}
2 changes: 1 addition & 1 deletion Grid/GridView.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ public function getPaginationLimit()
{
return $this->container->getParameter('pedro_teixeira_grid.pagination.limit');
}
}
}
12 changes: 9 additions & 3 deletions Grid/Render/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ class Currency extends RenderAbstract
*/
public function render()
{
$formatter = new StubNumberFormatter($this->container->getParameter('pedro_teixeira_grid.currency.locale'), StubNumberFormatter::CURRENCY);
return $formatter->formatCurrency($this->getValue(), $this->container->getParameter('pedro_teixeira_grid.currency.currency'));
$formatter = new StubNumberFormatter(
$this->container->getParameter('pedro_teixeira_grid.currency.locale'),
StubNumberFormatter::CURRENCY
);

return $formatter->formatCurrency(
$this->getValue(),
$this->container->getParameter('pedro_teixeira_grid.currency.currency')
);
}
}

2 changes: 1 addition & 1 deletion Grid/Render/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ public function render()
return $transformer->format($this->getValue());
}
}
}
}
2 changes: 1 addition & 1 deletion Grid/Render/DateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ public function render()
return $transformer->format($this->getValue());
}
}
}
}
2 changes: 1 addition & 1 deletion Grid/Render/RenderAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ public function getStringOnly()
{
return $this->stringOnly;
}
}
}
2 changes: 1 addition & 1 deletion Grid/Render/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ public function render()
{
return $this->getValue();
}
}
}
2 changes: 1 addition & 1 deletion Grid/Render/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ public function render()
return '<a href="' . $this->getValue() . '" target="_blank">' . $this->getValue() . '</a>';
}
}
}
}
4 changes: 2 additions & 2 deletions Grid/Render/YesNo.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function render()
} else {
if ($this->getValue() && $this->getShowYes()) {
return '<i class="glyphicon glyphicon-ok"></i>';
} else if ($this->getShowNo()) {
} elseif ($this->getShowNo()) {
return '<i class="glyphicon glyphicon-remove"></i>';
}
}
Expand Down Expand Up @@ -74,4 +74,4 @@ public function getShowYes()
{
return $this->showYes;
}
}
}
Loading

0 comments on commit f80694e

Please sign in to comment.