Paperyard
Public Member Functions | Private Attributes | List of all members
Paperyard\Controllers\Rule\ArchiveDetails Class Reference
Inheritance diagram for Paperyard\Controllers\Rule\ArchiveDetails:
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 ArchiveDetails.php.

Constructor & Destructor Documentation

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

ArchiveDetails constructor.

Parameters
Twig$view
LoggerInterface$logger
Messages$flash

Definition at line 27 of file ArchiveDetails.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\ArchiveDetails::__invoke ( Request  $request,
Response  $response,
  $args 
)
Parameters
Request$request
Response$response
$args
Returns
Response|static

Definition at line 42 of file ArchiveDetails.php.

43  {
44  // find model from id
45  $this->rule = \Paperyard\Models\Rule\Archive::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/archives');
51  }
52 
53  // show rule details
54  $this->view->render($response, 'rule/archive_details.twig', $this->render());
55  return $response;
56  }
Paperyard\Controllers\Rule\ArchiveDetails::render ( )

render

Returns
array data to render the view

Definition at line 62 of file ArchiveDetails.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\ArchiveDetails::$rule
private

Definition at line 19 of file ArchiveDetails.php.


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