cerebrate/libraries/default/InboxProcessors/TemplateInboxProcessor.php....

65 lines
1.8 KiB
Plaintext
Raw Normal View History

<?php
use Cake\ORM\TableRegistry;
require_once(ROOT . DS . 'libraries' . DS . 'default' . DS . 'InboxProcessors' . DS . 'GenericInboxProcessor.php');
class SCOPE_InboxProcessor extends GenericInboxProcessor
{
protected $scope = '~to-be-defined~';
protected $action = 'not-specified'; //overriden when extending
protected $description = ''; // overriden when extending
protected $registeredActions = [
'ACTION'
];
public function __construct($loadFromAction=false) {
parent::__construct($loadFromAction);
}
public function create($requestData)
{
return parent::create($requestData);
}
}
class SCOPE_ACTION_Processor extends ProposalInboxProcessor implements GenericInboxProcessorActionI {
public $action = 'ACTION';
protected $description;
public function __construct() {
parent::__construct();
$this->description = __('~to-be-defined~');
$this->Users = TableRegistry::getTableLocator()->get('Users');
}
protected function addValidatorRules($validator)
{
return $validator;
}
public function create($requestData) {
$this->validateRequestData($requestData);
$requestData['title'] = __('~to-be-defined~');
return parent::create($requestData);
}
public function process($id, $requestData, $inboxRequest)
{
$proposalAccepted = false;
$saveResult = [];
if ($proposalAccepted) {
$this->discard($id, $requestData);
}
return $this->genActionResult(
$saveResult,
$proposalAccepted,
$proposalAccepted ? __('success') : __('fail'),
[]
);
}
public function discard($id, $requestData)
{
return parent::discard($id, $requestData);
}
}