Viewing file: _ordini.php (3.62 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
$xcrud = Xcrud::get_instance();
$xcrud->table('ordini');
$xcrud->table_name(' ');
$table = 'ordini';
$orderdetails = $xcrud->nested_table('Dettaglio ordini','id','ordini_dettaglio','id_ordine'); // 2nd level
$orderdetails->columns('id_contenuto,qta,prezzo');
$orderdetails->fields('id_contenuto,qta,prezzo');
$orderdetails->default_tab('Dettaglio');
$customers = $xcrud->nested_table('utenti','id_utente','utenti','id'); // 2nd level 2
$customers->columns('email');
$products = $orderdetails->nested_table('ordini_dettaglio','id','ordini_dettaglio','id_ordine'); // 3rd level
$products->default_tab('Product details');
//$productLines = $products->nested_table('Product Lines','productLine','productlines','productLine'); // 4th level
//$xcrud->relation('area_medica','aree_mediche','id','area');
$xcrud->button('#', "Sali", 'glyphicon glyphicon-arrow-up icon-arrow-up', 'btn xcrud-action', array(
'data-action' => 'movetop',
'data-task' => 'action',
'data-table' => ''.$table.'',
'data-primary' => '{id}'));
$xcrud->button('#', "Scendi", 'glyphicon glyphicon-arrow-down icon-arrow-down', 'btn xcrud-action', array(
'data-action' => 'movebottom',
'data-task' => 'action',
'data-table' => ''.$table.'',
'data-primary' => '{id}'));
$xcrud->create_action('movetop', 'movetop');
$xcrud->create_action('movebottom', 'movebottom');
$xcrud->create_action('publish', 'publish_action'); // action callback, function publish_action() in functions.php
$xcrud->create_action('unpublish', 'unpublish_action');
$xcrud->button('#', 'unpublished', 'icon-close glyphicon glyphicon-remove', 'xcrud-action',
array( // set action vars to the button
'data-task' => 'action',
'data-action' => 'publish',
'data-table' => ''.$table.'',
'data-primary' => '{id}'),
array( // set condition ( when button must be shown)
'pubblicato',
'!=',
'1')
);
$xcrud->button('#', 'published', 'icon-checkmark glyphicon glyphicon-ok', 'xcrud-action', array(
'data-task' => 'action',
'data-action' => 'unpublish',
'data-table' => ''.$table.'',
'data-primary' => '{id}'), array(
'pubblicato',
'=',
'1'));
//$xcrud->unset_sortable();
//$xcrud->order_by('ordinamento');
//$xcrud->modal('testo');
//$xcrud->column_width('pubblicato,testo,img','70px');
$xcrud->highlight_row('ordine_pagato', '=', 1, '#FFA299'); //non pagato
$xcrud->highlight_row('ordine_pagato', '=', 2, '#1eea14'); //eseguito
$xcrud->highlight_row('ordine_pagato', '=', 3, '#f88c18'); //sospeso
$xcrud->change_type('ordine_pagato', 'select', '1', array('1'=>'Non Pagato','2'=>'Pagamento eseguito','3'=>'Pagamento sospeso','0'=>'Altro'));
$xcrud->change_type('tipologia_pagamento', 'select', '1', array('1'=>'Carta di credito','2'=>'Bonifico','3'=>'Altro','4'=>'Paypal','0'=>'Non specificato'));
$xcrud->fields('id_utente,data_ordine,tipologia_pagamento, ordine_pagato, dati_fatturazione, dati_spedizione' , false, 'Ordine');
$xcrud->label('id_utente','Utente');
$date = date("d.m.Y");
$xcrud->change_type('data_ordine', 'datetime', $date);
//$xcrud->change_type('pubblicato', 'select', '1', array('1'=>'Yes','0'=>'No'));
$xcrud->columns('id_utente, ordine_pagato');
$xcrud->hide_button('view');
$xcrud->unset_csv();
echo $xcrud->render();
?>
|