rylon 9113312549 fixed paths,
fixed missing "<?php" in soarqllib
fixed search on movie-info-page
2012-01-14 20:10:25 +01:00

98 lines
2.4 KiB
PHP

<?php
/**
* Description of view
*
* @author Michael Scholz | Ulf Gebhardt
*/
class view{
/**
*
* Print the Sparql resultset in HTML
*
* @param type $result
* @param type $ref
*
*/
public function printSparqlResult($result, $ref){
print("<div align=center>");
if( !$result )
{ print sparql_errno() . ": " . sparql_error(). "\n"; exit; }
$fields = $result->field_array( $result );
print("<div text-align=left>");
foreach( $fields as $field )
{
print "<br><b>$field:</b><br>";
$info = $field; //save typ of object
}
while( $row = sparql_fetch_array( $result ) )
{
foreach( $fields as $field )
{
if($ref == 1){
print "<a href=\"?title=$row[$field]&thing=$info\">$row[$field]</a><br>";
}else if($ref == 2){
print "<a href=$row[$field] target=blank>" . $row[$field] . "</a><br>";
}else if($ref == 3){
print "<img src=\"$row[$field]\" alt=\"$row[$field]\">";
}else{
print $row[$field] . "<br>";
}
}
}
print("</div>");
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<div align=center>
This Page is only a small Semantic Web Application which allows you to find information
about movies using "Linked Movie Data Base" and "DBpedia".
</p>
Which Movie are you interested in?</tab>
<form method="post" action="">
<input type="text" name="movieTitleByUser" size="45">
<input type="submit" name="buttonPressed" value="Search">
</form>
</p>
<a href="http://www.linkedmdb.org/" target="_blank"><img src="view/mdb.png" alt="linkedmdb.org"></a>
</br>
<a href="http://www.dbpedia.org/" target="_blank"><img src="view/dbpedia.png" alt="dbpedia.org"></a>
</div>
</body>
</html>