. */ include_once __DIR__.'/../../core.php'; use Modules\Checklists\Check; use Modules\Checklists\ChecklistItem; switch(post('op')){ case "delete_check": $id = post('id'); $main_check = post('main_check'); if($main_check){ $record = ChecklistItem::find($id); }else{ $record = Check::find($id); } $record->delete(); break; case "update_position": $main_check = post('main_check'); $order = explode(',', post('order', true)); if($main_check){ foreach($order as $i => $id){ $dbo->query("UPDATE zz_checklist_items SET `order`=".prepare($i)." WHERE id=".prepare($id)); } }else{ foreach($order as $i => $id){ $dbo->query("UPDATE zz_checks SET `order`=".prepare($i)." WHERE id=".prepare($id)); } } break; case "save_checkbox": $id = post('id'); $record = Check::find($id); $record->checked_by = $user->id; $record->checked_at = date('Y-m-d H:i:s'); $record->save(); break; case "save_note": $note = post('note'); $id = post('id'); $record = Check::find($id); $record->note = $note; $record->save(); flash()->info(tr('Nota salvata correttamente!')); break; case "remove_checkbox": $id = post('id'); $record = Check::find($id); $record->checked_by = NULL; $record->checked_at = NULL; $record->save(); break; case "edit_check": $id_record = post('id_record'); $main_check = post('main_check'); if($main_check){ $record = ChecklistItem::find($id_record); }else{ $record = Check::find($id_record); } $record->content = post('content'); $record->save(); flash()->info(tr('Informazioni salvate correttamente!')); break; } ?>