PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Range.php

https://github.com/jonathanselander/magento2
PHP | 73 lines | 38 code | 4 blank | 31 comment | 5 complexity | e524b6338c5d79349b857633cfca8883 MD5 | raw file
Possible License(s): CC-BY-SA-3.0, Unlicense
  1. <?php
  2. /**
  3. * Magento
  4. *
  5. * NOTICE OF LICENSE
  6. *
  7. * This source file is subject to the Open Software License (OSL 3.0)
  8. * that is bundled with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://opensource.org/licenses/osl-3.0.php
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@magentocommerce.com so we can send you a copy immediately.
  14. *
  15. * DISCLAIMER
  16. *
  17. * Do not edit or add to this file if you wish to upgrade Magento to newer
  18. * versions in the future. If you wish to customize Magento for your
  19. * needs please refer to http://www.magentocommerce.com for more information.
  20. *
  21. * @category Magento
  22. * @package Magento_Backend
  23. * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com)
  24. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  25. */
  26. /**
  27. * Range grid column filter
  28. *
  29. * @category Magento
  30. * @package Magento_Backend
  31. * @author Magento Core Team <core@magentocommerce.com>
  32. */
  33. namespace Magento\Backend\Block\Widget\Grid\Column\Filter;
  34. class Range extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFilter
  35. {
  36. public function getHtml()
  37. {
  38. $html = '<div class="range"><div class="range-line">'
  39. . '<input type="text" name="' . $this->_getHtmlName()
  40. . '[from]" id="'.$this->_getHtmlId() . '_from" placeholder="'
  41. . __('From') . '" value="' . $this->getEscapedValue('from')
  42. . '" class="input-text no-changes" '
  43. . $this->getUiId('filter', $this->_getHtmlName(), 'from') . '/></div>';
  44. $html .= '<div class="range-line">'
  45. . '<input type="text" name="' . $this->_getHtmlName() . '[to]" id="'
  46. . $this->_getHtmlId() . '_to" placeholder="'
  47. . __('To') . '" value="' . $this->getEscapedValue('to') . '" class="input-text no-changes" '
  48. . $this->getUiId('filter', $this->_getHtmlName(), 'to') . '/></div></div>';
  49. return $html;
  50. }
  51. public function getValue($index=null)
  52. {
  53. if ($index) {
  54. return $this->getData('value', $index);
  55. }
  56. $value = $this->getData('value');
  57. if ((isset($value['from']) && strlen($value['from']) > 0)
  58. || (isset($value['to']) && strlen($value['to']) > 0)
  59. ) {
  60. return $value;
  61. }
  62. return null;
  63. }
  64. public function getCondition()
  65. {
  66. $value = $this->getValue();
  67. return $value;
  68. }
  69. }