Paperyard
Shell.php
Go to the documentation of this file.
1 <?php
2 
4 
11 
12 class Shell extends BasicController
13 {
14  public function __construct(Twig $view, LoggerInterface $logger, Messages $flash)
15  {
16  $this->view = $view;
17  $this->logger = $logger;
18  $this->flash = $flash;
19 
20  $this->registerPlugin('shell-log');
21  }
22 
23  public function __invoke(Request $request, Response $response, $args)
24  {
25  if ($request->isXhr()) {
26  // provide entities
27  return $response->withJson(\Paperyard\Models\Log\Shell::where('id', '>=', (int)$request->getAttribute('since'))->orderBy('id', 'DESC')->take((int)$request->getAttribute('count'))->get());
28  } else {
29  // provide view
30  $this->view->render($response, 'misc/shell.twig', $this->render());
31  }
32  }
33 
38  public function render()
39  {
40  return array(
41  'plugins' => parent::getPlugins(),
42  'languageFlag' => parent::getLanguageFlag()
43  );
44  }
45 }
registerPlugin($name, $type=PluginType::NORMAL)
__construct(Twig $view, LoggerInterface $logger, Messages $flash)
Definition: Shell.php:14
__invoke(Request $request, Response $response, $args)
Definition: Shell.php:23