/**
  * @param bool $editable
  * @param bool $onlyEdit
  * @param string $expectedResult
  * @return void
  * @dataProvider renderDataProvider
  */
 public function testRender($editable, $onlyEdit, $expectedResult)
 {
     $value = 'some value';
     $keyValue = 'key';
     $this->columnMock->expects($this->once())->method('getEditable')->willReturn($editable);
     $this->columnMock->expects($this->any())->method('getEditOnly')->willReturn($onlyEdit);
     $this->columnMock->expects($this->any())->method('getIndex')->willReturn($keyValue);
     $this->columnMock->expects($this->any())->method('getId')->willReturn('test');
     $this->dataObjectMock->expects($this->any())->method('getData')->with($keyValue)->willReturn($value);
     $this->renderer->setColumn($this->columnMock);
     $this->assertEquals($expectedResult, $this->renderer->render($this->dataObjectMock));
 }
示例#2
0
 /**
  * @param \Magento\Backend\Block\Context                      $context
  * @param \Magento\Framework\Filesystem                       $filesystem
  * @param \Magento\Framework\Filesystem\Directory\ReadFactory $directoryRead
  * @param \Magento\Framework\Stdlib\DateTime\DateTime         $coreDate
  * @param array                                               $data
  */
 public function __construct(\Magento\Backend\Block\Context $context, \Magento\Framework\Filesystem $filesystem, \Magento\Framework\Filesystem\Directory\ReadFactory $directoryRead, \Magento\Framework\Stdlib\DateTime\DateTime $coreDate, array $data = [])
 {
     parent::__construct($context, $data);
     $this->_ioRead = $filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::ROOT);
     $this->_coreDate = $coreDate;
     $this->_directoryRead = $directoryRead->create("");
 }
示例#3
0
文件: Download.php 项目: nhc/Umc_Base
 /**
  * constructor
  *
  * @param Settings $settings
  * @param Filesystem $filesystem
  * @param Decoder $decoder
  * @param Downloader $downloader
  * @param Context $context
  * @param array $data
  */
 public function __construct(Settings $settings, Filesystem $filesystem, Decoder $decoder, Downloader $downloader, Context $context, array $data = [])
 {
     $this->settings = $settings;
     $this->filesystem = $filesystem;
     $this->decoder = $decoder;
     $this->downloader = $downloader;
     parent::__construct($context, $data);
 }
示例#4
0
 /**
  * Renders grid column
  *
  * @param \Magento\Framework\Object $row
  * @return string
  */
 public function render(\Magento\Framework\Object $row)
 {
     $line = parent::_getValue($row);
     $wrappedLine = '';
     $lineLength = $this->getColumn()->getData('lineLength') ? $this->getColumn()->getData('lineLength') : $this->_defaultMaxLineLength;
     for ($i = 0, $n = floor($this->string->strlen($line) / $lineLength); $i <= $n; $i++) {
         $wrappedLine .= $this->string->substr($line, $lineLength * $i, $lineLength) . "<br />";
     }
     return $wrappedLine;
 }
示例#5
0
 /**
  * Renders grid column
  *
  * @param   \Magento\Framework\DataObject $row
  * @return  string
  */
 public function render(\Magento\Framework\DataObject $row)
 {
     $encodedUrl = $this->_urlHelper->getEncodedUrl();
     if (!$row->getIsRead()) {
         return sprintf('<a href="%s">%s</a> | <a href="%s" onClick="deleteConfirm(\'%s\',this.href); return false;">%s</a>', $this->getUrl('*/*/markAsRead/', ['_current' => true, 'id' => $row->getId()]), __('Mark as Read'), $this->getUrl('*/*/remove/', ['_current' => true, 'id' => $row->getId(), \Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => $encodedUrl]), __('Are you sure?'), __('Remove'));
     } else {
         return sprintf('<a href="%s" onClick="deleteConfirm(\'%s\',this.href); return false;">%s</a>', $this->getUrl('*/*/remove/', ['_current' => true, 'id' => $row->getId(), \Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => $encodedUrl]), __('Are you sure?'), __('Remove'));
     }
     return parent::render($row);
 }
示例#6
0
 /**
  * @param \Magento\Framework\DataObject $row
  * @return int|string
  */
 protected function _getValue(\Magento\Framework\DataObject $row)
 {
     $data = parent::_getValue($row);
     if (intval($data) == $data) {
         return (string) number_format($data, 2);
     }
     if ($data !== null) {
         return $data * 1;
     }
     return $this->getColumn()->getDefault();
 }
示例#7
0
 /**
  * Render contents as a long text
  *
  * Text will be truncated as specified in string_limit, truncate or 250 by default
  * Also it can be html-escaped and nl2br()
  *
  * @param \Magento\Framework\Object $row
  * @return string
  */
 public function render(\Magento\Framework\Object $row)
 {
     $truncateLength = 250;
     // stringLength() is for legacy purposes
     if ($this->getColumn()->getStringLimit()) {
         $truncateLength = $this->getColumn()->getStringLimit();
     }
     if ($this->getColumn()->getTruncate()) {
         $truncateLength = $this->getColumn()->getTruncate();
     }
     $text = $this->filterManager->truncate(parent::_getValue($row), ['length' => $truncateLength]);
     if ($this->getColumn()->getEscape()) {
         $text = $this->escapeHtml($text);
     }
     if ($this->getColumn()->getNl2br()) {
         $text = nl2br($text);
     }
     return $text;
 }
示例#8
0
 /**
  * Renders grid column
  *
  * @param \Magento\Framework\DataObject $row
  * @return mixed
  */
 public function _getValue(\Magento\Framework\DataObject $row)
 {
     $format = $this->getColumn()->getFormat() ? $this->getColumn()->getFormat() : null;
     $defaultValue = $this->getColumn()->getDefault();
     if ($format === null) {
         // If no format and it column not filtered specified return data as is.
         $data = parent::_getValue($row);
         $string = $data === null ? $defaultValue : $data;
         return $this->escapeHtml($string);
     } elseif (preg_match_all($this->_variablePattern, $format, $matches)) {
         // Parsing of format string
         $formattedString = $format;
         foreach ($matches[0] as $matchIndex => $match) {
             $value = $row->getData($matches[1][$matchIndex]);
             $formattedString = str_replace($match, $value, $formattedString);
         }
         return $formattedString;
     } else {
         return $this->escapeHtml($format);
     }
 }
示例#9
0
 /**
  * @param \Magento\Backend\Block\Context $context
  * @param \Magento\Framework\Registry $registry
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Context $context, \Magento\Framework\Registry $registry, array $data = [])
 {
     $this->_coreRegistry = $registry;
     parent::__construct($context, $data);
 }
示例#10
0
 /**
  * @param \Magento\Backend\Block\Context $context
  * @param \Magento\Framework\Url\Helper\Data $urlHelper
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Context $context, \Magento\Framework\Url\Helper\Data $urlHelper, array $data = [])
 {
     $this->_urlHelper = $urlHelper;
     parent::__construct($context, $data);
 }
 public function __construct(\Magento\Backend\Block\Context $context, \Foggyline\Helpdesk\Model\TicketFactory $ticketFactory, array $data = [])
 {
     parent::__construct($context, $data);
     $this->ticketFactory = $ticketFactory;
 }
示例#12
0
文件: Store.php 项目: aiesh/magento2
 /**
  * @param \Magento\Backend\Block\Context $context
  * @param \Magento\Store\Model\System\Store $systemStore
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Context $context, \Magento\Store\Model\System\Store $systemStore, array $data = array())
 {
     $this->_systemStore = $systemStore;
     parent::__construct($context, $data);
 }
示例#13
0
文件: Number.php 项目: aiesh/magento2
 /**
  * Renders CSS
  *
  * @return string
  */
 public function renderCss()
 {
     return parent::renderCss() . ' col-number';
 }
示例#14
0
 /**
  * @param \Magento\Backend\Block\Context $context
  * @param \Magento\Framework\Stdlib\DateTime\DateTime $date
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Context $context, \Magento\Framework\Stdlib\DateTime\DateTime $date, array $data = [])
 {
     $this->_date = $date;
     parent::__construct($context, $data);
 }
示例#15
0
文件: Radio.php 项目: aiesh/magento2
 /**
  * @param \Magento\Backend\Block\Context $context
  * @param \Magento\Backend\Block\Widget\Grid\Column\Renderer\Options\Converter $converter
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Context $context, \Magento\Backend\Block\Widget\Grid\Column\Renderer\Options\Converter $converter, array $data = array())
 {
     parent::__construct($context, $data);
     $this->_converter = $converter;
 }
示例#16
0
文件: Image.php 项目: mrtuvn/m2ce.dev
 public function __construct(\Magento\Backend\Block\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, \Tuna\BannerSlider\Model\BannerFactory $bannerFactory, array $data = [])
 {
     parent::__construct($context, $data);
     $this->_storeManager = $storeManager;
     $this->_bannerFactory = $bannerFactory;
 }
示例#17
0
 /**
  * Renders CSS
  *
  * @return string
  */
 public function renderCss()
 {
     return parent::renderCss() . ' col-price';
 }
示例#18
0
 /**
  * Renders header of the column
  *
  * @return string
  */
 public function renderHeader()
 {
     if ($this->getColumn()->getHeader()) {
         return parent::renderHeader();
     }
     $checked = '';
     if ($filter = $this->getColumn()->getFilter()) {
         $checked = $filter->getValue() ? ' checked="checked"' : '';
     }
     $disabled = '';
     if ($this->getColumn()->getDisabled()) {
         $disabled = ' disabled="disabled"';
     }
     $html = '<th class="data-grid-th data-grid-actions-cell"><input type="checkbox" ';
     $html .= 'name="' . $this->getColumn()->getFieldName() . '" ';
     $html .= 'onclick="' . $this->getColumn()->getGrid()->getJsObjectName() . '.checkCheckboxes(this)" ';
     $html .= 'class="admin__control-checkbox"' . $checked . $disabled . ' ';
     $html .= 'title="' . __('Select All') . '"/><label></label></th>';
     return $html;
 }
示例#19
0
 /**
  * @param \Magento\Backend\Block\Context $context
  * @param \Magento\AdminNotification\Model\Inbox $notice
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Context $context, \Magento\AdminNotification\Model\Inbox $notice, array $data = [])
 {
     parent::__construct($context, $data);
     $this->_notice = $notice;
 }
示例#20
0
 /**
  * @param \Magento\Backend\Block\Context            $context
  * @param \Wyomind\SimpleGoogleShopping\Helper\Data $sgsHelper
  * @param array                                     $data
  */
 public function __construct(\Magento\Backend\Block\Context $context, \Wyomind\SimpleGoogleShopping\Helper\Data $sgsHelper, array $data = [])
 {
     parent::__construct($context, $data);
     $this->_sgsHelper = $sgsHelper;
 }
 public function __construct(\Magento\Backend\Block\Context $context, \Devopensource\Tickets\Model\TicketFactory $ticketFactory, array $data = [])
 {
     parent::__construct($context, $data);
     $this->ticketFactory = $ticketFactory;
 }
示例#22
0
 /**
  * @param \Magento\Backend\Block\Context $context
  * @param \Magento\Framework\Stdlib\String $stringHelper
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Context $context, \Magento\Framework\Stdlib\String $stringHelper, array $data = array())
 {
     $this->stringHelper = $stringHelper;
     parent::__construct($context, $data);
 }
示例#23
0
 /**
  * @param \Magento\Backend\Block\Context $context
  * @param \Magento\Sitemap\Model\SitemapFactory $sitemapFactory
  * @param \Magento\Framework\Filesystem $filesystem
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Context $context, \Magento\Sitemap\Model\SitemapFactory $sitemapFactory, \Magento\Framework\Filesystem $filesystem, array $data = [])
 {
     $this->_sitemapFactory = $sitemapFactory;
     $this->_filesystem = $filesystem;
     parent::__construct($context, $data);
 }
示例#24
0
文件: Link.php 项目: aiesh/magento2
 /**
  * @param \Magento\Backend\Block\Context $context
  * @param \Magento\Core\Helper\Data $coreHelper
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Context $context, \Magento\Core\Helper\Data $coreHelper, array $data = array())
 {
     $this->_coreHelper = $coreHelper;
     parent::__construct($context, $data);
 }
示例#25
0
 /**
  * @param \Magento\Backend\Block\Context $context
  * @param Action\UrlBuilder $actionUrlBuilder
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Context $context, Action\UrlBuilder $actionUrlBuilder, array $data = [])
 {
     $this->actionUrlBuilder = $actionUrlBuilder;
     parent::__construct($context, $data);
 }
示例#26
0
 /**
  * Returns HTML for CSS
  *
  * @return string
  */
 public function renderCss()
 {
     return parent::renderCss() . ' a-right';
 }
示例#27
0
文件: Image.php 项目: thuyetpv/Tci
 /**
  * @param \Magento\Backend\Block\Context $context
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Context $context, StoreManagerInterface $storemanager, array $data = [])
 {
     $this->_storeManager = $storemanager;
     parent::__construct($context, $data);
     $this->_authorization = $context->getAuthorization();
 }
 public function __construct(\Magento\Backend\Block\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManagerInterface, $data = [])
 {
     $this->storeManger = $storeManagerInterface;
     parent::__construct($context, $data);
 }
示例#29
0
文件: Id.php 项目: tingyeeh/magento2
 /**
  * @param \Magento\Backend\Block\Context $context
  * @param \Magento\Catalog\Helper\Product $productHelper
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Context $context, \Magento\Catalog\Helper\Product $productHelper, array $data = [])
 {
     $this->_productHelper = $productHelper;
     parent::__construct($context, $data);
 }
示例#30
0
 /**
  * @param \Magento\Backend\Block\Context $context
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Context $context, array $data = [])
 {
     parent::__construct($context, $data);
 }