Exemplo n.º 1
0
 /**
  * Print the body
  */
 public function printBody()
 {
     // Check the data first
     $this->checkData();
     // Get template to render
     $template = file_get_contents(__DIR__ . "/../../../../includes/templates/graph");
     // Get flotjs
     $data['flotjs'] = file_get_contents(__DIR__ . "/../../../../includes/js/flot.min.js");
     // Set data
     $data['data'] = $this->getData();
     $values = explode(',', $_GET['values']);
     if (count($values) > 1) {
         $data['title'] = "Chart for the properties '" . implode(', ', $values) . "'";
     } else {
         $data['title'] = "Chart for the property '" . trim($_GET['values']) . "'";
     }
     // Check graph type
     $type = $_GET['type'];
     if (!(!empty($type) && in_array($type, $this->types))) {
         $type = "lines";
     }
     $data['type'] = $type;
     $body = $this->m->render($template, $data);
     // Use the pages generator
     $generator = new Generator();
     $generator->generate($body);
 }
Exemplo n.º 2
0
 public function printBody()
 {
     $generator = new Generator();
     $output = $this->displayTree($this->objectToPrint);
     $h = headers_list();
     $i = 0;
     $matches = array();
     while ($i < sizeof($h) && !preg_match("/Link: (.+);rel=next.*/", $h[$i], $matches)) {
         $i++;
     }
     if ($i < sizeof($h)) {
         //$output .= "<p class='nextpage'><a href='". $matches[1] ."'>Next page</a></p>";
     }
     $generator->generate($output, 'resource');
 }
Exemplo n.º 3
0
 /**
  * This function will print the body of the responsemessage when the object is a graph.
  */
 public function printGraph()
 {
     set_error_header(453, "RDF not supported");
     $generator = new Generator($this->rootname . " - formatter cannot process RDF");
     $body = "";
     $body .= "<h1>Formatter doesn't support RDF</h1>";
     $body .= "<p>We don't have a triple output for this formatter yet. This is a best effort in HTML.</p>";
     $body .= "<p>There are plenty of RDF formatters which do work however. Check .ttl or .json for instance.</p>";
     $rn = $this->rootname;
     $body .= "<table border=3>";
     $body .= "<tr><td>subject</td><td>predicate</td><td>object</td></tr>";
     foreach ($this->objectToPrint->{$rn}->triples as $triple) {
         $body .= "<tr><td>" . $triple["s"] . "</td>";
         $body .= "<td>" . $triple["p"] . "</td>";
         $body .= "<td>" . $triple["o"] . "</td>";
         $body .= "</tr>";
     }
     $body .= "</table>";
     $h = headers_list();
     $i = 0;
     $matches = array();
     while ($i < sizeof($h) && !preg_match("/Link: (.+);rel=next.*/", $h[$i], $matches)) {
         $i++;
     }
     if ($i < sizeof($h)) {
         $body .= "<p class='nextpage'><a href='" . $matches[1] . "'>Next page</a></p>";
     }
     $generator->generate($body);
 }
Exemplo n.º 4
0
Arquivo: index.php Projeto: tdt/pages
// $generator->addCSS("http://....css");
// Add a menu item: title, url, weight, active, open in new window
$generator->addMenuItem("This page", "http://thedatatank.com", false, true);
$generator->addMenuItem("This page", "#", true, false);
$generator->addMenuItem("This page", "#", false, false);
// Body
$body = '
<h1>Hello World!</h1>
<table class="table">
    <thead>
        <th>Subject</th>
        <th>Object</th>
        <th>Predicate</th>
    </thead>
    <tr>
        <td>subject</td>
        <td>object</td>
        <td>predicate</td>
    </tr>
</table>
<ul>
    <li>item</li>
    <li>item2</li>
    <ul>
        <li>item2.1</li>
        <li>item2.2</li>
    </ul>
</ul>';
// Generate the page
$generator->generate($body);