StockController
extends Controller
in package
Class StockController
- Manages the inventory of Lego bricks.
- Handles listing, filtering, and stock adjustments (Manual removal vs Factory purchase).
- Access is restricted to administrators.
Table of Contents
Properties
- $trans : array<string|int, mixed>
- $stockModel : StockModel
Methods
- __construct() : mixed
- Constructor.
- add() : void
- Handles stock adjustment form submissions.
- index() : void
- Displays the paginated stock list with optional filters.
- render() : void
- Renders a view file within a layout template.
- runJavaBuy() : mixed
- Executes the external Java application to process a purchase.
Properties
$trans
protected
array<string|int, mixed>
$trans
= []
Holds translation strings for the current language.
$stockModel
private
StockModel
$stockModel
Instance of the stock management model.
Methods
__construct()
Constructor.
public
__construct() : mixed
Initializes the controller and enforces administrator access.
add()
Handles stock adjustment form submissions.
public
add() : void
- Negative quantity: Direct database update (Loss/Breakage).
- Positive quantity: Triggers a Java command to "buy" stock from the factory.
index()
Displays the paginated stock list with optional filters.
public
index() : void
Retrieves flash messages (debug/error/success) from the session.
render()
Renders a view file within a layout template.
public
render(string $file[, array<string|int, mixed> $data = [] ][, string $template = 'default' ]) : void
Parameters
- $file : string
-
The name of the view file (without .php extension).
- $data : array<string|int, mixed> = []
-
Associative array of data to pass to the view.
- $template : string = 'default'
-
The layout template to use (default: 'default').
runJavaBuy()
Executes the external Java application to process a purchase.
private
runJavaBuy(mixed $ref, mixed $qty) : mixed
Nettoyage agressif pour éviter les problèmes d'encodage.
Parameters
- $ref : mixed
- $qty : mixed