2021-03-18 15:17:39 +01:00
|
|
|
<?php
|
|
|
|
use Cake\ORM\TableRegistry;
|
|
|
|
|
2021-06-18 11:09:19 +02:00
|
|
|
require_once(ROOT . DS . 'libraries' . DS . 'default' . DS . 'InboxProcessors' . DS . 'GenericInboxProcessor.php');
|
2021-03-18 15:17:39 +01:00
|
|
|
|
2021-06-18 11:09:19 +02:00
|
|
|
class SCOPE_InboxProcessor extends GenericInboxProcessor
|
2021-03-18 15:17:39 +01:00
|
|
|
{
|
2021-03-22 16:17:56 +01:00
|
|
|
protected $scope = '~to-be-defined~';
|
2021-03-18 15:17:39 +01:00
|
|
|
protected $action = 'not-specified'; //overriden when extending
|
|
|
|
protected $description = ''; // overriden when extending
|
|
|
|
protected $registeredActions = [
|
2021-03-22 16:17:56 +01:00
|
|
|
'ACTION'
|
2021-03-18 15:17:39 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
public function __construct($loadFromAction=false) {
|
|
|
|
parent::__construct($loadFromAction);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function create($requestData)
|
|
|
|
{
|
|
|
|
return parent::create($requestData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-21 14:30:32 +02:00
|
|
|
class SCOPE_ACTION_Processor extends ProposalInboxProcessor implements GenericInboxProcessorActionI {
|
2021-03-22 16:17:56 +01:00
|
|
|
public $action = 'ACTION';
|
2021-03-18 15:17:39 +01:00
|
|
|
protected $description;
|
|
|
|
|
|
|
|
public function __construct() {
|
|
|
|
parent::__construct();
|
2021-03-22 16:17:56 +01:00
|
|
|
$this->description = __('~to-be-defined~');
|
2021-03-18 15:17:39 +01:00
|
|
|
$this->Users = TableRegistry::getTableLocator()->get('Users');
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function addValidatorRules($validator)
|
|
|
|
{
|
|
|
|
return $validator;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function create($requestData) {
|
|
|
|
$this->validateRequestData($requestData);
|
2021-03-22 16:17:56 +01:00
|
|
|
$requestData['title'] = __('~to-be-defined~');
|
2021-03-18 15:17:39 +01:00
|
|
|
return parent::create($requestData);
|
|
|
|
}
|
|
|
|
|
2021-06-14 13:25:49 +02:00
|
|
|
public function process($id, $requestData, $inboxRequest)
|
2021-03-18 15:17:39 +01:00
|
|
|
{
|
|
|
|
$proposalAccepted = false;
|
|
|
|
$saveResult = [];
|
|
|
|
if ($proposalAccepted) {
|
|
|
|
$this->discard($id, $requestData);
|
|
|
|
}
|
|
|
|
return $this->genActionResult(
|
|
|
|
$saveResult,
|
|
|
|
$proposalAccepted,
|
2021-03-22 16:17:56 +01:00
|
|
|
$proposalAccepted ? __('success') : __('fail'),
|
2021-03-18 15:17:39 +01:00
|
|
|
[]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function discard($id, $requestData)
|
|
|
|
{
|
|
|
|
return parent::discard($id, $requestData);
|
|
|
|
}
|
|
|
|
}
|