Paperyard
Public Member Functions | Private Member Functions | List of all members
Paperyard\Controllers\Misc\Index Class Reference
Inheritance diagram for Paperyard\Controllers\Misc\Index:
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 Member Functions

 documentsScanned ()
 
 toConfirm ()
 
 ocrFailures ()
 

Additional Inherited Members

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

Detailed Description

Definition at line 19 of file Index.php.

Constructor & Destructor Documentation

Paperyard\Controllers\Misc\Index::__construct ( Twig  $view,
LoggerInterface  $logger,
Messages  $flash 
)

Index constructor.

Parameters
Twig$view
LoggerInterface$logger
Messages$flash

Definition at line 27 of file Index.php.

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

Member Function Documentation

Paperyard\Controllers\Misc\Index::__invoke ( Request  $request,
Response  $response,
  $args 
)
Parameters
Request$request
Response$response
$args
Returns
Response

Definition at line 44 of file Index.php.

45  {
46  $this->view->render($response, 'index.twig', $this->render());
47  return $response;
48  }
Paperyard\Controllers\Misc\Index::documentsScanned ( )
private

documentsScanned

Counts the total scanned documents.

Returns
int total scanned documents

Definition at line 73 of file Index.php.

74  {
75  return \Paperyard\Models\Log\File::distinct()->get(['fileContent'])->count();
76  }
Paperyard\Controllers\Misc\Index::ocrFailures ( )
private

Definition at line 89 of file Index.php.

90  {
91  return count(Document::findAll(['/data/scan/error/*.pdf']));
92  }
static findAll(array $paths)
Definition: Document.php:424
Paperyard\Controllers\Misc\Index::render ( )

render

Returns
array data to render the view

Definition at line 54 of file Index.php.

55  {
56  return [
57  'plugins' => parent::getPlugins(),
58  'languageFlag' => parent::getLanguageFlag(),
59  'scannedToday' => $this->documentsScanned(),
60  'ocrFailures' => $this->ocrFailures(),
61  'toConfirm' => $this->toConfirm(),
62  'version' => ApplicationVersion::get(),
63  ];
64  }
Paperyard\Controllers\Misc\Index::toConfirm ( )
private

Definition at line 78 of file Index.php.

79  {
80  $documents = Document::findAll(['/data/outbox/*.pdf', '/data/inbox/*.pdf']);
81 
82  $to_confirm = array_filter($documents, function($document) {
83  return !$document['isConfirmed'];
84  });
85 
86  return count($to_confirm);
87  }
$documents
static findAll(array $paths)
Definition: Document.php:424

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