|
|
|
@ -26,7 +26,13 @@ class home_out { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$one_row[] = $html_output; |
|
|
|
|
|
|
|
$did_submit = ($input['method'] === "POST"); |
|
|
|
|
|
|
|
|
|
|
|
$data = [ |
|
|
|
$data = [ |
|
|
|
|
|
|
|
'did_submit' => $did_submit, |
|
|
|
|
|
|
|
'headers' => $input['headers'], |
|
|
|
|
|
|
|
'user' => $one_row, |
|
|
|
'safe_html' => $html_output, |
|
|
|
'safe_html' => $html_output, |
|
|
|
'post_data' => $input['post_data'], |
|
|
|
'post_data' => $input['post_data'], |
|
|
|
'a_errors' => array_merge($input['a_errors'], $errors), |
|
|
|
'a_errors' => array_merge($input['a_errors'], $errors), |
|
|
|
@ -36,34 +42,11 @@ class home_out { |
|
|
|
...$data |
|
|
|
...$data |
|
|
|
]); |
|
|
|
]); |
|
|
|
$app->view->set('twig_functions', [ |
|
|
|
$app->view->set('twig_functions', [ |
|
|
|
'show_user_details' => '\Project\outputs\app\home_out::show_user_details', |
|
|
|
'show_table' => '\CodeHydrater\html::show_table', |
|
|
|
'show_errors' => '\Project\outputs\app\home_out::show_errors', |
|
|
|
'show_errors' => '\CodeHydrater\html::show_errors', |
|
|
|
]); |
|
|
|
]); |
|
|
|
$content = $app->view->fetch($app, "app/val_tests.html", ViewType::TWIG); |
|
|
|
$content = $app->view->fetch($app, "app/val_tests.html", ViewType::TWIG); |
|
|
|
$app->response->set_content($content); |
|
|
|
$app->response->set_content($content); |
|
|
|
return []; |
|
|
|
return []; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static function show_errors(?array $errors = []): void { |
|
|
|
|
|
|
|
if ($errors) { |
|
|
|
|
|
|
|
$message = "Please correct the following errors: "; |
|
|
|
|
|
|
|
$i = 0; |
|
|
|
|
|
|
|
foreach($errors as $error) { |
|
|
|
|
|
|
|
$i++; |
|
|
|
|
|
|
|
$message .= "<br/>{$i}) " . $error; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
echo $message; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static function show_user_details(array $input): void { |
|
|
|
|
|
|
|
$rows[] = $input; // Force one rows |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\CodeHydrater\html::show_table( |
|
|
|
|
|
|
|
['Full Name', 'Age', 'Email'], |
|
|
|
|
|
|
|
$rows, |
|
|
|
|
|
|
|
escape: false |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |