$f->text('year', 'Year:', 30, 'YYYY'); $f->button('action_report', 'Report', false); $f->end(); } protected function action_report() { $hdgs = array('Number', 'Date', 'Start', 'Stop', 'Title'); $ttl = "{$_POST['year']} Panels"; $stmt = $this->db->query('select number, date_held, time_start, time_stop, title from panelcwa where year = :year order by number', array('year' => $_POST['year'])); if ($stmt->rowCount() == 0) { $this->message('No records found', true); } else { $r = new Report(); if ($_POST['dest'] == 'screen') { $r->html($ttl, $stmt, $hdgs); } else { if ($_POST['dest'] == 'pdf') { $r->pdf($ttl, $stmt, array(50, 50, 50, 50), $hdgs); } else { if ($_POST['dest'] == 'csv') { $r->csv($stmt); } } } } } } $page = new MyPage('Panels Report', true, 'panels-view'); $page->go();
<?php class MyPage extends AnewtPage { function __construct() { /* Call the parent constructor */ AnewtPage::__construct(); /* Add stylesheets */ $this->add_stylesheet_href('style.css'); $this->add_stylesheet_href_media('print.css', 'print'); /* Link to an external JavaScript file */ $this->add_javascript_src('some-script.js'); /* Embed JavaScript code directly */ $this->add_javascript_content('function foo() { alert("foo"); }'); /* Provide a list of blocks */ $this->blocks = array('header', 'content', 'footer'); /* Set some default values */ $this->title = 'This is the default title'; } } /* You can use this page like this: */ $p = new MyPage(); /* ... */ $p->flush();
<?php class MyPage extends AnewtPage { function MyPage() { AnewtPage::AnewtPage(); $this->set('blocks', array('header', 'content', 'footer')); } function build_header() { return ax_p('This is the header'); } function build_footer() { return ax_p('This is the footer'); } } $p = new MyPage(); $p->append_to('content', ax_p('This is the content.')); $p->flush();
<?php require_once "../configure.php"; require_once INCLUDE_DIR . "web/BaseWeb.php"; class MyPage extends BaseWeb { function __construct($opt = null) { parent::__construct($opt); $this->name = 'mypage'; $this->template = 'mypage.tpl'; } function initialize() { $this->checkSession(); $this->assignSession(); } } $page = new MyPage(); $page->run();
function MyPage($aFormName, $aFormTitle = null) { MyPage::__construct($aFormName, $aFormTitle); }