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/extmag/shiplab/Controller/Adminhtml/Label/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/extmag/shiplab/Controller/Adminhtml/Label/MassStatus.php
<?php
/**
 * Copyright © Extmag. All rights reserved.
 */

namespace Extmag\Shiplab\Controller\Adminhtml\Label;

use Extmag\Shiplab\Controller\Adminhtml\Label;
use Exception;
use Magento\Backend\Model\View\Result\Redirect;
use Magento\Framework\Exception\LocalizedException;

class MassStatus extends Label
{
    /**
     * Authorization level of a basic admin session
     *
     * @see _isAllowed()
     */
    public const ADMIN_RESOURCE = 'Extmag_Shiplab::shiplab_labels_save';

    /**
     * @return Redirect
     * @throws LocalizedException
     */
    public function execute()
    {
        $statusPickup = $this->getRequest()->getParam('pickup');
        $statusPrint = $this->getRequest()->getParam('print');
        $collection = $this->filter->getCollection($this->collectionFactory->create());
        $collectionSize = $collection->getSize();
        try {
            /**
             * @var \Extmag\Shiplab\Model\Label $model
             */
            foreach ($collection as $model) {
                if ($model->getStatus() > 0) {
                    if ($statusPickup !== null) {
                        $model->setIsPickup((((int)$statusPickup) === 1 ? 1 : 0));
                    }

                    if ($statusPrint !== null) {
                        $model->setIsPrinted((((int)$statusPrint) === 1 ? 1 : 0));
                    }

                    $this->labelRepository->save($model);
                }
            }

            $this->messageManager->addSuccessMessage(__('A total of %1 record(s) changed status.', $collectionSize));
        } catch (Exception $e) {
            // display error message
            $this->messageManager->addErrorMessage($e->getMessage());
        }

        // go to grid
        /** @var Redirect $resultRedirect */
        $resultRedirect = $this->resultRedirectFactory->create();
        return $resultRedirect->setRefererOrBaseUrl();
    }
}

Spamworldpro Mini