. */ function renderChecklist($check, $level = 1, $parent = 0) { global $structure; $user = auth()->getUser(); $enabled = $check->assignedUsers ? ($check->assignedUsers->pluck('id')->search($user->id) !== false || ($user->idgruppo) == 1) : true; $margin = ($level * 20); $result = ' '; if ($check->is_titolo) { $result .= ' '; } else { $result .= ' '; $result .= ' '; $result .= ' '; $result .= ' '; $result .= ' '; } $result .= ' '; $result .= ' '; if (sizeof($check->children) > 0) { $result .= ' '; } $result .= '
'.$check->content.' checked_at) ? 'checked' : '').' '.(!$enabled ? 'disabled' : '').'> '.$check->content.' '.(!empty($check->checked_at) ? tr('Verificato da _NAME_ il _DATE_', [ '_NAME_' => $check->checkUser->username, '_DATE_' => timestampFormat($check->checked_at), ]) : '').' {[ "type": "textarea", "class": "unblockable", "name": "note_checklist", "placeholder": "'.tr('Note').'...", "id": "note_'.$check->id.'", "value": "'.$check->note.'" ]} '; if (intval($check->assignedUsers->pluck('id')->toArray()) > 0) { $result .= ' '; } else { $result .= ' '; } $result .= '
'; $children = $structure->checks()->where('id_parent', $check->id)->orderBy('order')->get(); foreach ($children as $child) { $result .= renderChecklist($child, $level + 1, $check->id); } $result .= '
'; return $result; } function renderChecklistInserimento($check, $level = 1, $parent = 0) { global $record; $margin = ($level * 20); $result = ' '; $result .= ' '; $result .= ' '; $result .= ' '; if (sizeof($check->children) > 0) { $result .= ' '; } $result .= '
'; $result .= ' '.$check->content.''; $result .= '
'; $children = $record->checks()->where('id_parent', $check->id)->orderBy('order')->get(); foreach ($children as $child) { $result .= renderChecklistInserimento($child, $level + 1, $check->id); } $result .= '
'; return $result; } function renderChecklistHtml($check, $level = 0) { $user = auth()->getUser(); $enabled = $check->assignedUsers ? $check->assignedUsers->pluck('id')->search($user->id) !== false : true; $width = 10 + 20 * $level; $result = ' '.(!empty($check->checked_at) ? '' : '').' '.$check->content.''.(!empty($check->value) ? ': '.$check->value : '').' '; $children = $check->children; foreach ($children as $child) { $result .= renderChecklistHtml($child, $level + 1); } return $result; }