Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/fooman/pdfcore-m2/src/Block/Pdf/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/fooman/pdfcore-m2/src/Block/Pdf/Column.php
<?php
/**
 * @copyright Copyright (c) 2015 Fooman Limited (http://www.fooman.co.nz)
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Fooman\PdfCore\Block\Pdf;

class Column extends \Magento\Backend\Block\Widget\Grid\Column
{
    public const DEFAULT_WIDTH = 20;
    public const DEFAULT_TITLE = '';
    public const COLUMN_TYPE = 'default';

    protected $title;
    protected $widthAbs;
    protected $currencyCode;
    protected $baseCurrencyCode;
    protected $calculatedWidth;

    /**
     * get type of column
     *
     * @return string
     */
    public function getType()
    {
        return static::COLUMN_TYPE;
    }

    /**
     * get title for column
     *
     * @return string
     */
    public function getTitle()
    {
        if (null === $this->title) {
            $default = static::DEFAULT_TITLE;
            return __($default);
        }
        return __($this->title);
    }

    /**
     * set title for column
     *
     * @param $title
     *
     * @return $this
     */
    public function setTitle($title)
    {
        $this->title = $title;
        return $this;
    }

    public function getCurrencyCode()
    {
        return $this->currencyCode;
    }

    public function setCurrencyCode($currency)
    {
        $this->currencyCode = $currency;
        return $this;
    }

    public function getBaseCurrencyCode()
    {
        return $this->baseCurrencyCode;
    }

    public function setBaseCurrencyCode($currency)
    {
        $this->baseCurrencyCode = $currency;
        return $this;
    }

    public function getRate()
    {
        //since we use the already exchanged rate set it to 1 to prevent a second exchange rate calculation
        return 1;
    }

    public function getUseOrderCurrency()
    {
        return true;
    }

    public function isDisplayingBothCurrencies()
    {
        return
            !empty($this->baseCurrencyCode)
            && $this->baseCurrencyCode !== $this->currencyCode;
    }

    /**
     * get absolute width of column
     *
     * @return int
     */
    public function getWidthAbs()
    {
        if (null === $this->widthAbs) {
            return static::DEFAULT_WIDTH;
        }

        return $this->widthAbs;
    }

    /**
     * set absolute width of column
     *
     * @param $width
     *
     * @return $this
     */
    public function setWidthAbs($width)
    {
        $this->widthAbs = $width;
        return $this;
    }

    public function convertInterfaceConstantToGetter($input)
    {
        return 'get' . str_replace(' ', '', ucwords(str_replace('_', ' ', $input)));
    }

    public function getOrderItem($row)
    {
        if ($row instanceof \Magento\Sales\Api\Data\OrderItemInterface) {
            return $row;
        }
        return $row->getOrderItem();
    }

    public function setCalculatedWidth($width)
    {
        $this->calculatedWidth = $width;
        return $this;
    }

    public function getCalculatedWidth()
    {
        return $this->calculatedWidth;
    }

    protected function getAvailablePageWidth($storeId)
    {
        $pageSize = $this->_scopeConfig->getValue(
            \Fooman\PdfCore\Helper\Page::XML_PATH_PDF_PAGE_SIZE,
            \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
            $storeId
        );

        $pageOrientation = $this->_scopeConfig->getValue(
            \Fooman\PdfCore\Helper\Page::XML_PATH_PDF_PAGE_ORIENTATION,
            \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
            $storeId
        );

        $size = \TCPDF_STATIC::getPageSizeFromFormat($pageSize);

        if ($pageOrientation == \Fooman\PdfCore\Model\Config\Source\Pageorientation::PORTRAIT) {
            $width = $size[0];
        } else {
            $width = $size[1];
        }

        //convert to mm
        $width = round($width * 25.4 / 72, 2);

        $margin = $this->_scopeConfig->getValue(
            \Fooman\PdfCore\Model\PdfRenderer::XML_PATH_SIDE_MARGINS,
            \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
            $storeId
        );

        return $width - 2 * $margin;
    }

    public function isColumnSuppressed($row, $columnIndex)
    {
        $suppressedColumns = $row->getFoomanPdfSuppressedColumn();
        if (!$suppressedColumns || !is_array($suppressedColumns)) {
            return false;
        }
        return in_array($columnIndex, $suppressedColumns);
    }
}

Spamworldpro Mini