2017-08-04 16:28:16 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
2020-03-18 19:47:15 +01:00
|
|
|
$subcategorie = $dbo->fetchArray('SELECT * FROM `mg_categorie` WHERE `parent`='.prepare($id_record).' ORDER BY nome ASC ');
|
2017-08-04 16:28:16 +02:00
|
|
|
|
2020-03-18 22:24:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-04 16:28:16 +02:00
|
|
|
foreach ($subcategorie as $sub) {
|
2020-03-18 22:24:18 +01:00
|
|
|
$n_articoli = $dbo->fetchNum('SELECT * FROM `mg_articoli` WHERE `id_sottocategoria`='.prepare($sub['id']));
|
2017-08-04 16:28:16 +02:00
|
|
|
echo '
|
|
|
|
<tr>
|
|
|
|
<td>'.$sub['nome'].'</td>
|
|
|
|
<td>'.$sub['colore'].'</td>
|
|
|
|
<td>'.$sub['nota'].'</td>
|
|
|
|
<td>
|
2019-07-29 13:16:55 +02:00
|
|
|
<a class="btn btn-warning btn-sm" title="Modifica riga" onclick="launch_modal(\''.tr('Modifica sottocategoria').'\', \''.$rootdir.'/add.php?id_module='.$id_module.'&id_record='.$sub['id'].'&id_original='.$id_record.'\');"><i class="fa fa-edit"></i></a>
|
2020-03-18 22:24:18 +01:00
|
|
|
<a class="btn btn-sm btn-danger ask '.(($n_articoli>0) ? 'disabled tip' : '').'" data-backto="record-edit" data-id="'.$sub['id'].'" title="'.(($n_articoli>0) ? 'Sottocategoria collegata a '.$n_articoli.' articoli' : '' ).'">
|
2017-08-28 09:50:25 +02:00
|
|
|
<i class="fa fa-trash"></i>
|
2017-08-04 16:28:16 +02:00
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
}
|