Paperyard
Public Member Functions | Private Attributes | List of all members
Paperyard\Controllers\Rule\SenderDetails Class Reference
Inheritance diagram for Paperyard\Controllers\Rule\SenderDetails:
Paperyard\Controllers\BasicController

Public Member Functions

 __construct (Twig $view, LoggerInterface $logger, Messages $flash)
 
 __invoke (Request $request, Response $response, $args)
 
 render ()
 
- Public Member Functions inherited from Paperyard\Controllers\BasicController
 getPlugins ()
 
 registerPlugin ($name, $type=PluginType::NORMAL)
 
 getLanguageFlag ()
 

Private Attributes

 $rule
 

Additional Inherited Members

- Protected Attributes inherited from Paperyard\Controllers\BasicController
 $view
 
 $logger
 
 $flash
 

Detailed Description

Definition at line 16 of file SenderDetails.php.

Constructor & Destructor Documentation

Paperyard\Controllers\Rule\SenderDetails::__construct ( Twig  $view,
LoggerInterface  $logger,
Messages  $flash 
)

SenderDetails constructor.

Parameters
Twig$view
LoggerInterface$logger
Messages$flash

Definition at line 27 of file SenderDetails.php.

28  {
29  $this->view = $view;
30  $this->logger = $logger;
31  $this->flash = $flash;
32 
33  $this->registerPlugin('bootstrap-notify.min');
34  }
registerPlugin($name, $type=PluginType::NORMAL)

Member Function Documentation

Paperyard\Controllers\Rule\SenderDetails::__invoke ( Request  $request,
Response  $response,
  $args 
)
Parameters
Request$request
Response$response
$args
Returns
Response|static

Definition at line 42 of file SenderDetails.php.

43  {
44  // find model from id
45  $this->rule = \Paperyard\Models\Rule\Senders::find((int)$request->getAttribute('ruleId'));
46 
47  // if not found, redirect with error
48  if ($this->rule === null) {
49  $this->flash->addMessage('error', _('Rule not found.'));
50  return $response->withRedirect('/rules/senders');
51  }
52 
53  // show rule details
54  $this->view->render($response, 'rule/sender_details.twig', $this->render());
55  return $response;
56  }
Paperyard\Controllers\Rule\SenderDetails::render ( )

render

Returns
array data to render the view

Definition at line 62 of file SenderDetails.php.

63  {
64  return array(
65  'plugins' => parent::getPlugins(),
66  'rule' => $this->rule,
67  'languageFlag' => parent::getLanguageFlag()
68  );
69  }

Member Data Documentation

Paperyard\Controllers\Rule\SenderDetails::$rule
private

Definition at line 19 of file SenderDetails.php.


The documentation for this class was generated from the following file: