Files
CSiCoDB2/app/Controllers/ArticoloEvents.php
T
2026-05-06 11:04:41 +02:00

84 lines
2.5 KiB
PHP

<?php namespace App\Controllers;
use App\Libraries\Crud;
class ArticoloEvents extends CRUDController {
// Tab: ArticoloEvents = ['earIDarticoloEvent', 'earIDarticolo', 'earIDlavoratore', 'earDescrizione', 'earData', 'earTipologia'];
protected $crud;
function __construct() {
$params = [
'table' => 'ArticoloEvents',
'dev' => false,
'fields' => $this->field_options(),
'form_title_add' => 'Add Evento',
'form_title_update' => 'Edit Evento',
'form_submit' => 'Add',
'table_title' => 'Pagina per la tabella ArticoloEvents',
'form_submit_update' => 'Update',
'base' => '',
'UpdatedAt' => '',
'DeletedAt' => '',
];
$this->crud = new Crud($params, service('request'));
}// __construct
protected function field_options() {
$fields = [];
$fields['earIDarticoloEvent'] = ['label' => 'ID', 'helper' => 'Identificativo univoco del record nel database'];
$fields['earIDarticolo'] = [
'label' => 'Articolo',
'required' => true,
'type' => 'dropdown',
'helper' => 'Articolo a cui si riferisce l\'evento',
'relation' => [
'table'=> 'Articoli',
'primary_key' => 'arIDarticolo',
'display' => ['arCode', 'arNome'],
'order_by' => 'arCode',
'order' => 'ASC'
]
];
$fields['earIDlavoratore'] = [
'label' => 'Lavoratore',
'required' => true,
'type' => 'dropdown',
'helper' => 'Lavoratore a cui si riferisce l\'evento',
'relation' => [
'table'=> 'Lavoratori',
'primary_key' => 'lvIDlavoratore',
'display' => ['lvNickname', 'lvNome', 'lvCognome'], //'display' => ['lvNickname'],
'order_by' => 'lvNickname',
'order' => 'ASC'
]
];
$fields['earDescrizione'] = ['label' => 'Descrizione', 'helper' => 'Descrizione esaustiva dell\'evento', 'required' => true];
$fields['earData'] = ['label' => 'Timestamp', 'helper' => 'Timestamp dell\'evento', 'required' => true, 'type' => 'date'];
$fields['earTipologia'] = ['label' => 'Tipo', 'helper' => 'Tipologia di evento', 'required' => true];
return $fields;
}// field_options
public function index() { return $this->CRUD_view(['earIDarticoloEvent', 'earIDarticolo', 'earIDlavoratore', 'earDescrizione', 'earData', 'earTipologia']); }
//--------------------------------------------------------------------
// Auto CRUD terminato
//--------------------------------------------------------------------
}