Esempio n. 1
0
 function display_output($output, $row)
 {
     return ax_pre($output);
 }
Esempio n. 2
0
 /**
  * \private
  *
  * Show a simple error page.
  *
  * \param $exception
  *   The AnewtHTTPException instance
  */
 protected function show_error_page($exception)
 {
     assert('$exception instanceof Exception;');
     anewt_include('page');
     $p = new AnewtPage();
     $p->show_dublin_core = false;
     /* Title */
     if ($exception instanceof AnewtHTTPException) {
         $title = sprintf('%d - %s', $exception->getCode(), http_status_to_string($exception->getCode()));
     } else {
         $title = sprintf('%d - %s', HTTP_STATUS_INTERNAL_SERVER_ERROR, http_status_to_string(HTTP_STATUS_INTERNAL_SERVER_ERROR));
     }
     $p->title = $title;
     $p->append(ax_h1($title));
     /* Add default explanation (instead of just a title) for some exceptions. */
     $message = $exception->getMessage();
     if ($message) {
         $p->append(ax_p($message));
     } else {
         switch ($exception->getCode()) {
             case HTTP_STATUS_NOT_FOUND:
                 $p->append(ax_p('The requested resource cannot be found.'));
                 break;
             case HTTP_STATUS_FORBIDDEN:
                 $p->append(ax_p('Access to the requested resource was denied.'));
                 break;
             case HTTP_STATUS_INTERNAL_SERVER_ERROR:
                 $p->append(ax_p('An internal server error occurred while processing your request.'));
                 break;
             default:
                 break;
         }
     }
     /* Backtrace */
     $p->append(ax_pre($exception->getTraceAsString()));
     $p->flush();
 }
Esempio n. 3
0
$page = new AnewtPage();
$page->set('title', 'Anewt form test page');
$page->add_stylesheet(ax_stylesheet($css));
$page->append(ax_h1('Test form'));
$form = new TestForm();
assert('$form->get_control_value("text5") === "7"');
$form->set_control_value('text5', '8');
if ($form->autofill()) {
    if ($form->process()) {
        $page->append(ax_p('Form succesfully processed!'));
    } else {
        $page->append(ax_p('Error while processing form!'));
    }
} else {
    $page->append(ax_p('Form not processed.'));
}
$fr = new AnewtFormRendererDefault();
$fr->set_form($form);
$page->append(ax_h2('The form'));
$page->append($fr);
if (AnewtRequest::is_post()) {
    $values = $form->get_control_values();
    ob_start();
    var_dump($values);
    $values = ob_get_clean();
    $page->append(ax_h2('Form output'));
    $page->append(ax_pre($values));
    $page->append(ax_h2('$_POST values'));
    $page->append(ax_pre(print_r($_POST, true)));
}
$page->flush();