public static function dispatch() { $action = get_http_var('action'); $r = null; if ($action == 'update') { $r = OtherArticleWidget::fetch_from_httpvars(); } else { $id = get_http_var('id'); $r = OtherArticleWidget::fetch_one($id); } $w = new OtherArticleWidget($r); // perform whatever action has been requested $w->perform($action); // is request ajax? $ajax = get_http_var('ajax') ? true : false; if ($ajax) { $w->emit_core(); } else { // not an ajax request, so output a full page admPageHeader("Other Article", "OtherArticleWidget::emit_head_js"); print "<h2>Other article</h2>\n"; $w->emit_full(); admPageFooter(); } }
<p>Submitted articles from outlets we don't cover</p> <form method="post" action=""> Show: <select name="status"> <option <?php echo $status == '' ? 'selected ' : ''; ?> value="">All</option> <option <?php echo $status == 'unapproved' ? 'selected ' : ''; ?> value="unapproved">Unapproved</option> <option <?php echo $status == 'approved' ? 'selected ' : ''; ?> value="approved">Approved</option> </select> <input type="submit" name="submit" value="Filter" /> </form> <?php $rows = OtherArticleWidget::fetch_lots($status); foreach ($rows as $r) { $w = new OtherArticleWidget($r); $w->emit_full(); } admPageFooter(); function ExtraHead() { OtherArticleWidget::emit_head_js(); }