function show() { $this->errorpage = array_key_exists('error', $_GET) ? $_GET['error'] : null; $summary = annotation_summary_query::from_params(); if (null == $summary) { header('HTTP/1.1 400 Bad Request'); echo '<h1>400 Bad Request</h1>'; } elseif (!MarginaliaHelper::isUrlSafe($summary->url)) { header('HTTP/1.1 400 Bad Request'); echo '<h1>400 Bad Request</h1>Bad url parameter'; } else { // Display individual annotations // Dunno if the range sorting is working $sql = $summary->sql('section_type, section_name, a.url, start_block, start_word, start_char, end_block, end_word, end_char'); // echo "SQL: $sql\n"; // uncomment for debugging $annotations = get_records_sql($sql); $format = array_key_exists('format', $_GET) ? $_GET['format'] : 'html'; if ('atom' == $format) { $this->show_atom($summary, $annotations); } else { $this->show_html($summary, $annotations); } } }
function derive($a) { $summary_query = new annotation_summary_query(array('text' => $this->text, 'exactmatch' => $this->exactmatch, 'all' => $this->all, 'orderby' => $this->orderby, 'sheet_type' => $this->sheet_type, 'user' => $this->user, 'ofuser' => $this->ofuser, 'url' => $this->url)); if ($a) { $summary_query->from_params($a); } return $summary_query; }