linkmobility4oxid/src/Application/Controller/Admin/AdminUser.php

62 lignes
1.8 KiB
PHP
Brut Vue normale Historique

2022-07-04 09:13:36 +02:00
<?php
/**
2022-07-13 13:21:52 +02:00
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
2022-07-04 09:13:36 +02:00
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
2022-07-13 13:21:52 +02:00
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link https://www.oxidmodule.com
2022-07-04 09:13:36 +02:00
*/
2022-07-13 13:21:52 +02:00
declare(strict_types=1);
2022-07-04 09:13:36 +02:00
namespace D3\Linkmobility4OXID\Application\Controller\Admin;
2022-12-31 00:29:59 +01:00
use D3\DIContainerHandler\d3DicHandler;
2022-07-04 09:13:36 +02:00
use D3\Linkmobility4OXID\Application\Model\Exceptions\noRecipientFoundException;
use D3\Linkmobility4OXID\Application\Model\MessageTypes\Sms;
2022-07-04 09:13:36 +02:00
use D3\Linkmobility4OXID\Application\Model\UserRecipients;
2022-12-28 00:09:24 +01:00
use OxidEsales\Eshop\Application\Model\Order;
2022-07-04 09:13:36 +02:00
use OxidEsales\Eshop\Application\Model\User;
2022-12-28 00:09:24 +01:00
class AdminUser extends AdminSendController
2022-07-04 09:13:36 +02:00
{
protected $_sThisTemplate = 'd3adminuser.tpl';
/**
* @var Sms
*/
protected $sms;
2022-12-28 00:09:24 +01:00
/** @var User */
protected $item;
/** @var UserRecipients */
protected $itemRecipients;
2022-07-04 09:13:36 +02:00
public function __construct()
{
2022-12-31 00:29:59 +01:00
$this->item = d3DicHandler::getInstance()->get('d3ox.linkmobility.'.User::class);
d3DicHandler::getInstance()->set(UserRecipients::class.".args.user", $this->item);
$this->itemRecipients = d3DicHandler::getInstance()->get(UserRecipients::class);
2022-07-04 09:13:36 +02:00
parent::__construct();
}
/**
2022-12-28 00:09:24 +01:00
* @return string
* @throws noRecipientFoundException
2022-07-04 09:13:36 +02:00
*/
2022-12-28 00:09:24 +01:00
protected function sendMessage(): string
2022-07-04 09:13:36 +02:00
{
2022-12-31 00:29:59 +01:00
d3DicHandler::getInstance()->setParameter(Sms::class.'.args.message', $this->getMessageBody());
2022-12-28 00:09:24 +01:00
/** @var Sms $sms */
2022-12-31 00:29:59 +01:00
$sms = d3DicHandler::getInstance()->get(Sms::class);
2022-12-28 00:09:24 +01:00
return $sms->sendUserAccountMessage($this->item) ?
(string) $this->getSuccessSentMessage($sms) :
$this->getUnsuccessfullySentMessage($sms);
2022-07-04 09:13:36 +02:00
}
2022-07-13 13:23:48 +02:00
}