fduh/poker-bundle
Composer 安装命令:
composer require fduh/poker-bundle
包简介
Results manager for poker and other card games.
关键字:
README 文档
README
Installation
Add the dependency:
$ composer require fduh/poker-bundle dev-master
Add the bundle:
// app/AppKernel.php class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Fduh\PokerBundle\FduhPokerBundle(), // Optional, for Google Chart new SaadTazi\GChartBundle\SaadTaziGChartBundle(), ); } }
How to use
Results Handler
After you created some seasons, events and results, you now want to manage players, rankings and scores. Here's how to use the bundle:
$resultsHandler = $this->get('poker.results_handler'); // Add events $resultsHandler->addEvents($yourEvents); // Or a season $resultsHandler->addSeason($yourSeason);
Of course, you can retrieve events by using:
// Reduces requests count $events = $this->get('poker.repository.hydrated.event')->findAllViewableEventsByDateAsc();
Now there's how you should use the results handler in your template:
{% for eventData in resultsHandler.eventManager.eventsData %}
{{ eventData.event }} // Access to the Event entity
{# And other functions... #}
{% endfor %}
{% for playerData in resultsHandler.playerManager.playersData %}
{{ playerData.player }} // Access to the Player entity
{{ playerData.score }}
{{ playerData.rank }}
{{ playerData.wonEvents }}
{# And a lot of functions... #}
{% endfor %}
Open PlayerDataInterface.php and EventDataInterface.php to read more about provided properties.
Watch a practical example at standrewspokerclub.fr.
Chart
If you want to display score evolution (in controller):
$chartMaker = $this->get('poker.chart_maker'); $chartMaker->setSeason($season); $chart = $chartMaker->getChart(); return array( 'chart' => $chart->toArray(), 'width' => $chartMaker->getWidth(), 'height' => $chartMaker->getHeight() // ... }
And in the template (mine for the example):
<script> $(function() { {{ gchart_line_chart(chart, 'chart', width, height, null, { // your options } ) }} }); </script>
Watch a practical example at standrewspokerclub.fr.
Configuration
Reference dump:
fduh_poker: calculation_class: ~
If you want the bundle to calculate scores differently, override the calculation_class with a class implementing Fduh\PokerBundle\Calculator\CalculationStrategyInterface.
Run this command to recalculate every score:
$ php app/console poker:update-scores
To do
- TwigExtensions
- a lot of things.....
Feel free to contribute this project.
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-05-23