.
*/
function renderChecklist($check, $level = 1, $parent = 0) {
global $structure;
$user = auth()->getUser();
$enabled = $check->assignedUsers ? $check->assignedUsers->pluck('id')->search($user->id) !== false : true;
$margin = ($level*20);
$result = '
|
|
';
return $result;
}
function renderChecklistInserimento($check, $level = 1, $parent = 0)
{
global $record;
$margin = ($level*20);
$result = '
';
$result .= '
';
$result .= '
'.$check->content.'';
$result .= '
| ';
$result .= '
| ';
$result .= '
';
if(sizeof($check->children)>0){
$result .= '
';
$children = $record->checks()->where('id_parent', $check->id)->orderBy('order')->get();
foreach ($children as $child) {
$result .= renderChecklistInserimento($child, $level + 1, $check->id);
}
$result .= '
|
';
}
$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;
}