b374k
m1n1 1.01
Apache/2.4.41 (Ubuntu)
Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64
uid=33(www-data) gid=33(www-data) groups=33(www-data)
server ip : 62.171.164.128 | your ip : 127.0.0.1
safemode OFF
 >  / home / dev2.destoffenstraat.com / app / code / Mrgig / MV / Block / Adminhtml / Report / History /
Filename/home/dev2.destoffenstraat.com/app/code/Mrgig/MV/Block/Adminhtml/Report/History/Grid.php
Size2.58 kb
Permissionrwxrwxrwx
Ownerroot : root
Create time17-Aug-2025 10:26
Last modified23-Mar-2022 11:14
Last accessed22-Aug-2025 23:52
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
<?php

namespace Mrgig\MV\Block\Adminhtml\Report\History;

use Magento\Backend\Block\Widget\Grid\Extended;

class Grid extends Extended
{
protected $_report = null;

public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Backend\Helper\Data $backendHelper,
\Mrgig\MV\Model\ResourceModel\Report\History\CollectionFactory $collectionFactory,
\Magento\Framework\Registry $coreRegistry,
array $data = []
) {
$this->collectionFactory = $collectionFactory;
$this->_coreRegistry = $coreRegistry;
parent::__construct($context, $backendHelper, $data);
}

public function _construct()
{
parent::_construct();
$this->setId('reportViewHistoryGrid');

$this->setDefaultSort('created_at');
$this->setDefaultDir('DESC');
$this->setFilterVisibility(false);
$this->setUseAjax(true);
$this->setCustomPageSize(false);

$this->_report = $this->_coreRegistry->registry('current_report');
}

protected function _prepareCollection()
{
$collection = $this->collectionFactory->create();
$collection->addFieldToFilter('invoice_id', $this->_report->getInvoiceId());

$this->setCollection($collection);

return parent::_prepareCollection();
}

protected function _prepareColumns()
{
$this->addColumn('created_at', [
'header' => __('Create Date'),
'align' => 'left',
'width' => '165px',
'type' => 'datetime',
'format' => \IntlDateFormatter::MEDIUM,
'filter_time' => true,
'index' => 'created_at'
]);

$this->addColumn('comment', [
'header' => __('Comment'),
'align' => 'left',
'width' => '*',
'type' => 'text',
'sortable' => false,
'filter_index' => 'id',
'index' => 'comment',
'frame_callback' => [$this, 'callbackColumnComment']
]);

return parent::_prepareColumns();
}

public function callbackColumnComment($value, $row, $column, $isExport)
{
$fullComment = str_replace(
"\n",
'<br>',
$row->getData('comment')
);
$html = $this->stripTags($fullComment, '<br>');
return $html;
}

public function getRowUrl($row)
{
return '';
}

public function getGridUrl()
{
return $this->getUrl('*/report/viewHistoryGrid', ['_current' => true]);
}
}