57 lines
1.6 KiB
PHP
57 lines
1.6 KiB
PHP
<?php namespace App\Controllers;
|
|||
|
|
|
||
|
|
use App\Libraries\Crud;
|
||
|
|
|
||
|
|
|
||
|
|
class Categorie extends CRUDController {
|
||
|
|
|
||
|
|
// Tab: Categorie = ['caIDcategoria', 'caCode', 'caNome', 'caDescrizione'];
|
||
|
|
|
||
|
|
protected $crud;
|
||
|
|
|
||
|
|
function __construct() {
|
||
|
|
|
||
|
|
$params = [
|
||
|
|
'table' => 'Categorie',
|
||
|
|
'dev' => false,
|
||
|
|
'fields' => $this->field_options(),
|
||
|
|
'form_title_add' => 'Add Categoria',
|
||
|
|
'form_title_update' => 'Edit Categoria',
|
||
|
|
'form_submit' => 'Add',
|
||
|
|
'table_title' => 'Pagina per la tabella Categorie',
|
||
|
|
'form_submit_update' => 'Update',
|
||
|
|
'base' => '',
|
||
|
|
'UpdatedAt' => '',
|
||
|
|
'DeletedAt' => '',
|
||
|
|
];
|
||
|
|
|
||
|
|
$this->crud = new Crud($params, service('request'));
|
||
|
|
}// __construct
|
||
|
|
|
||
|
|
|
||
|
|
protected function field_options() {
|
||
|
|
|
||
|
|
$fields = [];
|
||
|
|
$fields['caIDcategoria'] = ['label' => 'ID', 'helper' => 'Identificativo univoco del record nel database'];
|
||
|
|
$fields['caCode'] = ['label' => 'Code', 'helper' => 'Codice della categoria (2 caratteri)', 'required' => true];
|
||
|
|
$fields['caNome'] = ['label' => 'Nome', 'helper' => 'Nome della categoria (max 32 caratteri)', 'required' => true];
|
||
|
|
$fields['caDescrizione'] = ['label' => 'Descrizione', 'helper' => 'Descrizione esaustiva della categoria','required' => true];
|
||
|
|
|
||
|
|
return $fields;
|
||
|
|
}// field_options
|
||
|
|
|
||
|
|
|
||
|
|
public function index() { return $this->CRUD_view(['caIDcategoria', 'caCode', 'caNome', 'caDescrizione']); }
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
//--------------------------------------------------------------------
|
||
|
|
// Auto CRUD terminato
|
||
|
|
//--------------------------------------------------------------------
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|