venca-x / nette-stargazer
Nette addon. Convert round numer to stars
1.0.0
2018-01-09 20:54 UTC
Requires (Dev)
- nette/tester: @dev
This package is auto-updated.
Last update: 2024-11-07 05:02:43 UTC
README
Nette plugin for showing score as stars. You define positive and negavide symbols for ratio visualisation.
Installation
Install plugin to your dependencies with composer:
composer require venca-x/nette-stargazer:^1.0
For dev version install:
composer require venca-x/nette-stargazer:dev-master
Usage Sample
BasePresenter.php
protected function beforeRender() { parent::beforeRender(); $this->template->addFilter('stargazer', function ($text) { //$stargazer = new VencaX\Stargazer('<i class="fa fa-star"></i>', '<i class="fa fa-star-o"></i>'); //$stargazer = new VencaX\Stargazer(); $stargazer = new VencaX\Stargazer($star = "1", $starEmpty = "0", $starCount = 10); return $stargazer->makeStargazer($text); }); }
MyPresenter.php
protected function renderDefault() { $this->template->score = 5; }
Usage
{$o->score|stargazer|noescape} {$o->score|stargazer}
Output
*****00000