Time.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * Sitemap grid link column renderer
  8. *
  9. */
  10. namespace Magento\Sitemap\Block\Adminhtml\Grid\Renderer;
  11. class Time extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
  12. {
  13. /**
  14. * @var \Magento\Framework\Stdlib\DateTime\DateTime
  15. */
  16. protected $_date;
  17. /**
  18. * @param \Magento\Backend\Block\Context $context
  19. * @param \Magento\Framework\Stdlib\DateTime\DateTime $date
  20. * @param array $data
  21. */
  22. public function __construct(
  23. \Magento\Backend\Block\Context $context,
  24. \Magento\Framework\Stdlib\DateTime\DateTime $date,
  25. array $data = []
  26. ) {
  27. $this->_date = $date;
  28. parent::__construct($context, $data);
  29. }
  30. /**
  31. * Prepare link to display in grid
  32. *
  33. * @param \Magento\Framework\DataObject $row
  34. * @return string
  35. */
  36. public function render(\Magento\Framework\DataObject $row)
  37. {
  38. $time = date('Y-m-d H:i:s', strtotime($row->getSitemapTime()) + $this->_date->getGmtOffset());
  39. return $time;
  40. }
  41. }