The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ

Added a moon phase display

Signed-off-by: Gergely Polonkai <polesz@w00d5t0ck.info>
master
Polonkai Gergely 10 years ago
parent d7154719e2
commit dcd9842c7d
  1. 5
      src/KekRozsak/FrontBundle/Resources/public/css/statuslines.css
  2. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/0_large.png
  3. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/0_small.png
  4. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/10_large.png
  5. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/10_small.png
  6. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/11_large.png
  7. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/11_small.png
  8. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/12_large.png
  9. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/12_small.png
  10. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/13_large.png
  11. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/13_small.png
  12. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/14_large.png
  13. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/14_small.png
  14. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/15_large.png
  15. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/15_small.png
  16. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/16_large.png
  17. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/16_small.png
  18. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/17_large.png
  19. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/17_small.png
  20. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/18_large.png
  21. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/18_small.png
  22. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/19_large.png
  23. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/19_small.png
  24. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/1_large.png
  25. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/1_small.png
  26. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/20_large.png
  27. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/20_small.png
  28. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/21_large.png
  29. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/21_small.png
  30. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/22_large.png
  31. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/22_small.png
  32. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/23_large.png
  33. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/23_small.png
  34. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/24_large.png
  35. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/24_small.png
  36. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/25_large.png
  37. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/25_small.png
  38. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/26_large.png
  39. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/26_small.png
  40. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/27_large.png
  41. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/27_small.png
  42. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/2_large.png
  43. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/2_small.png
  44. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/3_large.png
  45. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/3_small.png
  46. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/4_large.png
  47. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/4_small.png
  48. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/5_large.png
  49. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/5_small.png
  50. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/6_large.png
  51. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/6_small.png
  52. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/7_large.png
  53. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/7_small.png
  54. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/8_large.png
  55. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/8_small.png
  56. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/9_large.png
  57. BIN
      src/KekRozsak/FrontBundle/Resources/public/images/moonphase/9_small.png
  58. 3
      src/KekRozsak/FrontBundle/Resources/views/Default/main_template.html.twig
  59. 62
      src/KekRozsak/FrontBundle/Twig/TwigMoonphaseExtension.php

@ -58,3 +58,8 @@
background-color: transparent;
color: #c4d3ff;
}
#moonphase {
float: right;
width: 30px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -52,6 +52,9 @@
<button type="submit">Keresés</button>
</div>
#}
<div id="moonphase">
<img src="{{ asset('bundles/kekrozsakfront/images/moonphase/' ~ moonphase.phaseNum ~ '_small.png') }}" alt="{{ moonphase.percent }}" />
</div>
</div>
<div id="top-line-padding"></div>
</div>

@ -0,0 +1,62 @@
<?php
namespace KekRozsak\FrontBundle\Twig;
use Symfony\Component\DependencyInjection\ContainerInterface;
use JMS\DiExtraBundle\Annotation as DI;
/**
* @DI\Service
* @DI\Tag("twig.extension")
*
*/
class TwigMoonphaseExtension extends \Twig_Extension
{
const SYNODIC = 29.53058867;
const SECPERDAY = 86400.0;
private $container;
/**
* @DI\InjectParams({
* "container" = @DI\Inject("service_container")
* })
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
*/
public function __construct(ContainerInterface $container)
{
$this->container = $container;
}
public function getGlobals()
{
$globals = parent::getGlobals();
$gds = new \DateTime('now');
$baseDate = new \DateTime();
$baseDate->setTimezone(new \DateTimeZone('UTC'));
$baseDate->setDate(2005, 4, 8);
$baseDate->setTime(8, 48, 0);
$diff = abs($gds->getTimestamp() - $baseDate->getTimestamp());
$origPhasePercent = $diff / (self::SYNODIC * self::SECPERDAY);
$phasePercent = fmod(($origPhasePercent) * 100.0, 100.0);
if ($phasePercent < 0) {
$phasePercent += 100;
}
$phase = round($phasePercent * 0.279);
$realPercent = (50.0 - abs($phasePercent - 50.0)) * 2.0;
$globals['moonphase'] = array(
'phaseNum' => $phase,
'percent' => $realPercent,
);
return $globals;
}
public function getName()
{
return 'twig_moonphase';
}
}
Loading…
Cancel
Save