mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 00:24:35 +00:00
Removed not used libraries and views
This commit is contained in:
@@ -1,54 +0,0 @@
|
||||
<style type="text/css">
|
||||
.table tr th {
|
||||
text-align:center;
|
||||
background: -moz-linear-gradient(top, #FAFAFA 0%, #E9E9E9 100%);
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #FAFAFA), color-stop(100%, #E9E9E9));background: -webkit-linear-gradient(top, #FAFAFA 0%, #E9E9E9 100%);
|
||||
background: -o-linear-gradient(top, #FAFAFA 0%, #E9E9E9 100%);
|
||||
background: -ms-linear-gradient(top, #FAFAFA 0%, #E9E9E9 100%);
|
||||
background: linear-gradient(top, #FAFAFA 0%, #E9E9E9 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#FAFAFA', endColorstr = '#E9E9E9');-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#FAFAFA', endColorstr='#E9E9E9')";
|
||||
border: 1px solid #D5D5D5;
|
||||
}
|
||||
</style>
|
||||
<div class="bootstrap-widget-header">
|
||||
<i class="icon-home icon-white"></i><h3></h3>
|
||||
</div>
|
||||
<div class="bootstrap-widget-content">
|
||||
<div class="container">
|
||||
<div class="pull-left">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<table class="table table-condensed table-hover table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th class="span4">Name</th>
|
||||
<th class="span4">Give Name</th>
|
||||
<th class="span4">Family Name</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$foaf = EasyRdf_Graph::newAndLoad('http://njh.me/foaf.rdf');
|
||||
$me = $foaf->primaryTopic();
|
||||
?>
|
||||
<tr>
|
||||
|
||||
<td> <?php echo $me->get('foaf:name') ?></td>
|
||||
<td> <?= $me->get('foaf:givenName') ?> </td>
|
||||
<td> <?= $me->get('foaf:familyName') ?></td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
@@ -1,74 +0,0 @@
|
||||
<style type="text/css">
|
||||
.table tr th {
|
||||
text-align:center;
|
||||
background: -moz-linear-gradient(top, #FAFAFA 0%, #E9E9E9 100%);
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #FAFAFA), color-stop(100%, #E9E9E9));background: -webkit-linear-gradient(top, #FAFAFA 0%, #E9E9E9 100%);
|
||||
background: -o-linear-gradient(top, #FAFAFA 0%, #E9E9E9 100%);
|
||||
background: -ms-linear-gradient(top, #FAFAFA 0%, #E9E9E9 100%);
|
||||
background: linear-gradient(top, #FAFAFA 0%, #E9E9E9 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#FAFAFA', endColorstr = '#E9E9E9');-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#FAFAFA', endColorstr='#E9E9E9')";
|
||||
border: 1px solid #D5D5D5;
|
||||
}
|
||||
</style>
|
||||
<div class="bootstrap-widget-header">
|
||||
<i class="icon-home icon-white"></i><h3></h3>
|
||||
</div>
|
||||
<div class="bootstrap-widget-content">
|
||||
<div class="container">
|
||||
<div class="pull-left">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<table class="table table-condensed table-hover table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th class="span4">Label</th>
|
||||
<th class="span4">Country</th>
|
||||
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
EasyRdf_Namespace::set('category', 'http://dbpedia.org/resource/Category:');
|
||||
EasyRdf_Namespace::set('dbpedia', 'http://dbpedia.org/resource/');
|
||||
EasyRdf_Namespace::set('dbo', 'http://dbpedia.org/ontology/');
|
||||
EasyRdf_Namespace::set('dbp', 'http://dbpedia.org/property/');
|
||||
|
||||
$sparql = new EasyRdf_Sparql_Client('http://dbpedia.org/sparql');
|
||||
|
||||
|
||||
$result = $sparql->query(
|
||||
'SELECT * WHERE {'.
|
||||
' ?country rdf:type dbo:Country .'.
|
||||
' ?country rdfs:label ?label .'.
|
||||
' ?country dc:subject category:Member_states_of_the_United_Nations .'.
|
||||
' FILTER ( lang(?label) = "en" )'.
|
||||
'} ORDER BY ?label'
|
||||
);
|
||||
|
||||
?>
|
||||
Total number of countries: <?= $result->numRows() ?>
|
||||
<?php foreach ($result as $row ): ?>
|
||||
<tr>
|
||||
<td> <a href="http://dbpedia.org/resource/<?php echo $row->label ?>"><?php echo $row->label ?></a></td>
|
||||
<td><a href="http://dbpedia.org/resource/"> <?php echo $row->country ?></td>
|
||||
|
||||
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
@@ -1,112 +0,0 @@
|
||||
<div class="bootstrap-widget-header">
|
||||
<i class="icon-home icon-white"></i><h3>Converter</h3>
|
||||
</div>
|
||||
<div class="bootstrap-widget-content">
|
||||
<div class="container">
|
||||
<div class="pull-left">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Convert RDF from one format to another
|
||||
*
|
||||
* The source RDF data can either be fetched from the web
|
||||
* or typed into the Input box.
|
||||
*
|
||||
* The first thing that this script does is make a list the names of the
|
||||
* supported input and output formats. These options are then
|
||||
* displayed on the HTML form.
|
||||
*
|
||||
* The input data is loaded or parsed into an EasyRdf_Graph.
|
||||
* That graph is than outputted again in the desired output format.
|
||||
*
|
||||
* @package EasyRdf
|
||||
* @copyright Copyright (c) 2009-2013 Nicholas J Humfrey
|
||||
* @license http://unlicense.org/
|
||||
*/
|
||||
|
||||
// set_include_path(get_include_path() . PATH_SEPARATOR . '../lib/');
|
||||
|
||||
echo $this->load->view('rdf/html_tag_helpers');
|
||||
|
||||
$input_format_options = array('Guess' => 'guess');
|
||||
$output_format_options = array();
|
||||
foreach (EasyRdf_Format::getFormats() as $format) {
|
||||
if ($format->getSerialiserClass()) {
|
||||
$output_format_options[$format->getLabel()] = $format->getName();
|
||||
}
|
||||
if ($format->getParserClass()) {
|
||||
$input_format_options[$format->getLabel()] = $format->getName();
|
||||
}
|
||||
}
|
||||
|
||||
// Stupid PHP :(
|
||||
if (get_magic_quotes_gpc() and isset($_REQUEST['data'])) {
|
||||
$_REQUEST['data'] = stripslashes($_REQUEST['data']);
|
||||
}
|
||||
|
||||
// Default to Guess input and Turtle output
|
||||
if (!isset($_REQUEST['output_format'])) {
|
||||
$_REQUEST['output_format'] = 'turtle';
|
||||
}
|
||||
if (!isset($_REQUEST['input_format'])) {
|
||||
$_REQUEST['input_format'] = 'guess';
|
||||
}
|
||||
|
||||
// Display the form, if raw option isn't set
|
||||
if (!isset($_REQUEST['raw'])) {
|
||||
print "<html>\n";
|
||||
print "<head><title>EasyRdf Converter</title></head>\n";
|
||||
print "<body>\n";
|
||||
print "<h1>EasyRdf Converter</h1>\n";
|
||||
|
||||
print "<div style='margin: 10px'>\n";
|
||||
print form_tag();
|
||||
print label_tag('data', 'Input Data: ').'<br />'.text_area_tag('data', '', array('cols'=>30, 'rows'=>10)) . "<br />\n";
|
||||
print label_tag('uri', 'or Uri: ').text_field_tag('uri', 'http://www.dajobe.org/foaf.rdf', array('size'=>80)) . "<br />\n";
|
||||
print label_tag('input_format', 'Input Format: ').select_tag('input_format', $input_format_options) . "<br />\n";
|
||||
print label_tag('output_format', 'Output Format: ').select_tag('output_format', $output_format_options) . "<br />\n";
|
||||
print label_tag('raw', 'Raw Output: ').check_box_tag('raw') . "<br />\n";
|
||||
print reset_tag() . submit_tag();
|
||||
print form_end_tag();
|
||||
print "</div>\n";
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['uri']) or isset($_REQUEST['data'])) {
|
||||
// Parse the input
|
||||
$graph = new EasyRdf_Graph($_REQUEST['uri']);
|
||||
if (empty($_REQUEST['data'])) {
|
||||
$graph->load($_REQUEST['uri'], $_REQUEST['input_format']);
|
||||
} else {
|
||||
$graph->parse($_REQUEST['data'], $_REQUEST['input_format'], $_REQUEST['uri']);
|
||||
}
|
||||
|
||||
// Lookup the output format
|
||||
$format = EasyRdf_Format::getFormat($_REQUEST['output_format']);
|
||||
|
||||
// Serialise to the new output format
|
||||
$output = $graph->serialise($format);
|
||||
if (!is_scalar($output)) {
|
||||
$output = var_export($output, true);
|
||||
}
|
||||
|
||||
// Send the output back to the client
|
||||
if (isset($_REQUEST['raw'])) {
|
||||
header('Content-Type: '.$format->getDefaultMimeType());
|
||||
print $output;
|
||||
} else {
|
||||
print '<pre>'.htmlspecialchars($output).'</pre>';
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['raw'])) {
|
||||
print "</body>\n";
|
||||
print "</html>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
@@ -1,124 +0,0 @@
|
||||
|
||||
<div class="bootstrap-widget-header">
|
||||
<i class="icon-home icon-white"></i><h3></h3>
|
||||
</div>
|
||||
<div class="bootstrap-widget-content">
|
||||
<div class="container">
|
||||
<div class="pull-left">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<form name="my-form" id="my-form" action="#" method="post" enctype="multipart/form-data">
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="kategori">FOAF</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="uri" name="uri" class="span3" value="http://njh.me/foaf.rdf">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<button type="submit" name="simpan" class="btn btn-info btn-small"><i class="icon-ok-circle"></i> Simpan</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<h3>FOAF me</h3>
|
||||
<?php
|
||||
|
||||
echo $this->load->view('rdf/html_tag_helpers');
|
||||
|
||||
|
||||
if (isset($_REQUEST['uri'])): ?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php $graph = EasyRdf_Graph::newAndLoad($_REQUEST['uri']); ?>
|
||||
|
||||
<?php if ($graph->type() == 'foaf:PersonalProfileDocument'): ?>
|
||||
<?php echo $person = $graph->primaryTopic(); ?>
|
||||
<?php elseif ($graph->type() == 'foaf:Person'): ?>
|
||||
<?php echo $person = $graph->resource(); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
<!-- Start -->
|
||||
|
||||
<?php if (isset($person)): ?>
|
||||
|
||||
|
||||
<table class="table table-condensed table-hover table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th class="span4">Name</th>
|
||||
<th class="span4">Homepage</th>
|
||||
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td><?= $person->get('foaf:name') ?> </td>
|
||||
<td><a href="<?= $person->get('foaf:homepage') ?>"> <?= $person->get('foaf:homepage') ?></td>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<!-- NEw Format -->
|
||||
<h3>Known Person</h3>
|
||||
|
||||
<?php foreach ($person->all('foaf:knows') as $friend) {
|
||||
$label = $friend->label();
|
||||
|
||||
if (!$label) {
|
||||
$label = $friend->getUri();
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<table class="table table-condensed table-hover table-bordered table-striped">
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<?php if ($friend->isBNode()): ?>
|
||||
<td><?= $label ?></td>
|
||||
<?php else: ?>
|
||||
|
||||
<?php echo "<li>".link_to_self($label, 'uri='.urlencode($friend))."</li>"; ?>
|
||||
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
} ?>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<!--endif paling atas-->
|
||||
<?php endif; ?>
|
||||
@@ -1,121 +0,0 @@
|
||||
<div class="bootstrap-widget-header">
|
||||
<i class="icon-home icon-white"></i><h3>EasyRdf FOAF Maker Example</h3>
|
||||
</div>
|
||||
<div class="bootstrap-widget-content">
|
||||
<div class="container">
|
||||
<div class="pull-left">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
/**
|
||||
* Construct a FOAF document with a choice of serialisations
|
||||
*
|
||||
* This example is similar in concept to Leigh Dodds' FOAF-a-Matic.
|
||||
* The fields in the HTML form are inserted into an empty
|
||||
* EasyRdf_Graph and then serialised to the chosen format.
|
||||
*
|
||||
* @package EasyRdf
|
||||
* @copyright Copyright (c) 2009-2013 Nicholas J Humfrey
|
||||
* @license http://unlicense.org/
|
||||
*/
|
||||
|
||||
// set_include_path(get_include_path() . PATH_SEPARATOR . '../lib/');
|
||||
|
||||
echo $this->load->view('rdf/html_tag_helpers');
|
||||
|
||||
if (isset($_REQUEST['enable_arc']) && $_REQUEST['enable_arc']) {
|
||||
require_once "EasyRdf/Serialiser/Arc.php";
|
||||
EasyRdf_Format::registerSerialiser('ntriples', 'EasyRdf_Serialiser_Arc');
|
||||
EasyRdf_Format::registerSerialiser('posh', 'EasyRdf_Serialiser_Arc');
|
||||
EasyRdf_Format::registerSerialiser('rdfxml', 'EasyRdf_Serialiser_Arc');
|
||||
EasyRdf_Format::registerSerialiser('turtle', 'EasyRdf_Serialiser_Arc');
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['enable_rapper']) && $_REQUEST['enable_rapper']) {
|
||||
require_once "EasyRdf/Serialiser/Rapper.php";
|
||||
EasyRdf_Format::registerSerialiser('dot', 'EasyRdf_Serialiser_Rapper');
|
||||
EasyRdf_Format::registerSerialiser('rdfxml', 'EasyRdf_Serialiser_Rapper');
|
||||
EasyRdf_Format::registerSerialiser('turtle', 'EasyRdf_Serialiser_Rapper');
|
||||
}
|
||||
|
||||
$format_options = array();
|
||||
foreach (EasyRdf_Format::getFormats() as $format) {
|
||||
if ($format->getSerialiserClass()) {
|
||||
$format_options[$format->getLabel()] = $format->getName();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<h1></h1>
|
||||
|
||||
<?= form_tag(null, array('method' => 'POST')) ?>
|
||||
|
||||
<h2>Your Identifier</h2>
|
||||
<?= labeled_text_field_tag('uri', 'http://www.example.com/joe#me', array('size'=>40)) ?><br />
|
||||
|
||||
<h2>Your details</h2>
|
||||
<?= labeled_text_field_tag('title', 'Mr', array('size'=>8)) ?><br />
|
||||
<?= labeled_text_field_tag('given_name', 'Joseph') ?><br />
|
||||
<?= labeled_text_field_tag('family_name', 'Bloggs') ?><br />
|
||||
<?= labeled_text_field_tag('nickname', 'Joe') ?><br />
|
||||
<?= labeled_text_field_tag('email', '[email protected]') ?><br />
|
||||
<?= labeled_text_field_tag('homepage', 'http://www.example.com/', array('size'=>40)) ?><br />
|
||||
|
||||
<h2>People you know</h2>
|
||||
<?= labeled_text_field_tag('person_1', 'http://www.example.com/dave#me', array('size'=>40)) ?><br />
|
||||
<?= labeled_text_field_tag('person_2', '', array('size'=>40)) ?><br />
|
||||
<?= labeled_text_field_tag('person_3', '', array('size'=>40)) ?><br />
|
||||
<?= labeled_text_field_tag('person_4', '', array('size'=>40)) ?><br />
|
||||
|
||||
<h2>Output</h2>
|
||||
Enable Arc 2? <?= check_box_tag('enable_arc') ?><br />
|
||||
Enable Rapper? <?= check_box_tag('enable_rapper') ?><br />
|
||||
<?= label_tag('format').select_tag('format', $format_options, 'rdfxml') ?><br />
|
||||
|
||||
<?= submit_tag() ?>
|
||||
<?= form_end_tag() ?>
|
||||
|
||||
|
||||
<?php
|
||||
if (isset($_REQUEST['uri'])) {
|
||||
|
||||
$graph = new EasyRdf_Graph();
|
||||
|
||||
# 1st Technique
|
||||
$me = $graph->resource($_REQUEST['uri'], 'foaf:Person');
|
||||
$me->set('foaf:name', $_REQUEST['title'].' '.$_REQUEST['given_name'].' '.$_REQUEST['family_name']);
|
||||
if ($_REQUEST['email']) {
|
||||
$email = $graph->resource("mailto:".$_REQUEST['email']);
|
||||
$me->add('foaf:mbox', $email);
|
||||
}
|
||||
if ($_REQUEST['homepage']) {
|
||||
$homepage = $graph->resource($_REQUEST['homepage']);
|
||||
$me->add('foaf:homepage', $homepage);
|
||||
}
|
||||
|
||||
# 2nd Technique
|
||||
$graph->addLiteral($_REQUEST['uri'], 'foaf:title', $_REQUEST['title']);
|
||||
$graph->addLiteral($_REQUEST['uri'], 'foaf:givenname', $_REQUEST['given_name']);
|
||||
$graph->addLiteral($_REQUEST['uri'], 'foaf:family_name', $_REQUEST['family_name']);
|
||||
$graph->addLiteral($_REQUEST['uri'], 'foaf:nick', $_REQUEST['nickname']);
|
||||
|
||||
# Add friends
|
||||
for ($i=1; $i<=4; $i++) {
|
||||
if ($_REQUEST["person_$i"]) {
|
||||
$person = $graph->resource($_REQUEST["person_$i"]);
|
||||
$graph->add($me, 'foaf:knows', $person);
|
||||
}
|
||||
}
|
||||
|
||||
# Finally output the graph
|
||||
$data = $graph->serialise($_REQUEST['format']);
|
||||
if (!is_scalar($data)) {
|
||||
$data = var_export($data, true);
|
||||
}
|
||||
print "<pre>".htmlspecialchars($data)."</pre>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
@@ -1,121 +0,0 @@
|
||||
<div class="bootstrap-widget-header">
|
||||
<i class="icon-home icon-white"></i><h3>EasyRdf FOAF Maker Example</h3>
|
||||
</div>
|
||||
<div class="bootstrap-widget-content">
|
||||
<div class="container">
|
||||
<div class="pull-left">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
/**
|
||||
* Construct a FOAF document with a choice of serialisations
|
||||
*
|
||||
* This example is similar in concept to Leigh Dodds' FOAF-a-Matic.
|
||||
* The fields in the HTML form are inserted into an empty
|
||||
* EasyRdf_Graph and then serialised to the chosen format.
|
||||
*
|
||||
* @package EasyRdf
|
||||
* @copyright Copyright (c) 2009-2013 Nicholas J Humfrey
|
||||
* @license http://unlicense.org/
|
||||
*/
|
||||
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib/');
|
||||
|
||||
echo $this->load->view('rdf/html_tag_helpers');
|
||||
|
||||
if (isset($_REQUEST['enable_arc']) && $_REQUEST['enable_arc']) {
|
||||
require_once "EasyRdf/Serialiser/Arc.php";
|
||||
EasyRdf_Format::registerSerialiser('ntriples', 'EasyRdf_Serialiser_Arc');
|
||||
EasyRdf_Format::registerSerialiser('posh', 'EasyRdf_Serialiser_Arc');
|
||||
EasyRdf_Format::registerSerialiser('rdfxml', 'EasyRdf_Serialiser_Arc');
|
||||
EasyRdf_Format::registerSerialiser('turtle', 'EasyRdf_Serialiser_Arc');
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['enable_rapper']) && $_REQUEST['enable_rapper']) {
|
||||
require_once "EasyRdf/Serialiser/Rapper.php";
|
||||
EasyRdf_Format::registerSerialiser('dot', 'EasyRdf_Serialiser_Rapper');
|
||||
EasyRdf_Format::registerSerialiser('rdfxml', 'EasyRdf_Serialiser_Rapper');
|
||||
EasyRdf_Format::registerSerialiser('turtle', 'EasyRdf_Serialiser_Rapper');
|
||||
}
|
||||
|
||||
$format_options = array();
|
||||
foreach (EasyRdf_Format::getFormats() as $format) {
|
||||
if ($format->getSerialiserClass()) {
|
||||
$format_options[$format->getLabel()] = $format->getName();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<h1></h1>
|
||||
|
||||
<?= form_tag(null, array('method' => 'POST')) ?>
|
||||
|
||||
<h2>Your Identifier</h2>
|
||||
<?= labeled_text_field_tag('uri', 'http://www.example.com/joe#me', array('size'=>40)) ?><br />
|
||||
|
||||
<h2>Your details</h2>
|
||||
<?= labeled_text_field_tag('title', 'Mr', array('size'=>8)) ?><br />
|
||||
<?= labeled_text_field_tag('given_name', 'Joseph') ?><br />
|
||||
<?= labeled_text_field_tag('family_name', 'Bloggs') ?><br />
|
||||
<?= labeled_text_field_tag('nickname', 'Joe') ?><br />
|
||||
<?= labeled_text_field_tag('email', '[email protected]') ?><br />
|
||||
<?= labeled_text_field_tag('homepage', 'http://www.example.com/', array('size'=>40)) ?><br />
|
||||
|
||||
<h2>People you know</h2>
|
||||
<?= labeled_text_field_tag('person_1', 'http://www.example.com/dave#me', array('size'=>40)) ?><br />
|
||||
<?= labeled_text_field_tag('person_2', '', array('size'=>40)) ?><br />
|
||||
<?= labeled_text_field_tag('person_3', '', array('size'=>40)) ?><br />
|
||||
<?= labeled_text_field_tag('person_4', '', array('size'=>40)) ?><br />
|
||||
|
||||
<h2>Output</h2>
|
||||
Enable Arc 2? <?= check_box_tag('enable_arc') ?><br />
|
||||
Enable Rapper? <?= check_box_tag('enable_rapper') ?><br />
|
||||
<?= label_tag('format').select_tag('format', $format_options, 'rdfxml') ?><br />
|
||||
|
||||
<?= submit_tag() ?>
|
||||
<?= form_end_tag() ?>
|
||||
|
||||
|
||||
<?php
|
||||
if (isset($_REQUEST['uri'])) {
|
||||
|
||||
$graph = new EasyRdf_Graph();
|
||||
|
||||
# 1st Technique
|
||||
$me = $graph->resource($_REQUEST['uri'], 'foaf:Person');
|
||||
$me->set('foaf:name', $_REQUEST['title'].' '.$_REQUEST['given_name'].' '.$_REQUEST['family_name']);
|
||||
if ($_REQUEST['email']) {
|
||||
$email = $graph->resource("mailto:".$_REQUEST['email']);
|
||||
$me->add('foaf:mbox', $email);
|
||||
}
|
||||
if ($_REQUEST['homepage']) {
|
||||
$homepage = $graph->resource($_REQUEST['homepage']);
|
||||
$me->add('foaf:homepage', $homepage);
|
||||
}
|
||||
|
||||
# 2nd Technique
|
||||
$graph->addLiteral($_REQUEST['uri'], 'foaf:title', $_REQUEST['title']);
|
||||
$graph->addLiteral($_REQUEST['uri'], 'foaf:givenname', $_REQUEST['given_name']);
|
||||
$graph->addLiteral($_REQUEST['uri'], 'foaf:family_name', $_REQUEST['family_name']);
|
||||
$graph->addLiteral($_REQUEST['uri'], 'foaf:nick', $_REQUEST['nickname']);
|
||||
|
||||
# Add friends
|
||||
for ($i=1; $i<=4; $i++) {
|
||||
if ($_REQUEST["person_$i"]) {
|
||||
$person = $graph->resource($_REQUEST["person_$i"]);
|
||||
$graph->add($me, 'foaf:knows', $person);
|
||||
}
|
||||
}
|
||||
|
||||
# Finally output the graph
|
||||
$data = $graph->serialise($_REQUEST['format']);
|
||||
if (!is_scalar($data)) {
|
||||
$data = var_export($data, true);
|
||||
}
|
||||
print "<pre>".htmlspecialchars($data)."</pre>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
@@ -1,218 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Rails Style html tag helpers
|
||||
*
|
||||
* These are used by the other examples to make the code
|
||||
* more concise and simpler to read.
|
||||
*
|
||||
* @copyright Copyright (c) 2009-2013 Nicholas J Humfrey
|
||||
* @license http://unlicense.org/
|
||||
*/
|
||||
|
||||
/* Examples:
|
||||
|
||||
echo content_tag('p','Paragraph Tag', array('class'=>'foo'));
|
||||
|
||||
echo tag('br');
|
||||
echo link_to('Hyperlink', 'http://www.example.com/?a=1&b=2');
|
||||
echo tag('br');
|
||||
|
||||
echo form_tag();
|
||||
|
||||
echo label_tag('first_name').text_field_tag('first_name', 'Joe').tag('br');
|
||||
echo label_tag('password').password_field_tag().tag('br');
|
||||
|
||||
echo label_tag('radio1_value1', 'Radio 1').radio_button_tag('radio1', 'value1').tag('br');
|
||||
echo label_tag('radio1_value2', 'Radio 2').radio_button_tag('radio1', 'value2', true).tag('br');
|
||||
echo label_tag('radio1_value3', 'Radio 3').radio_button_tag('radio1', 'value3').tag('br');
|
||||
|
||||
echo label_tag('check1', 'Check 1').check_box_tag('check1', 'value1').tag('br');
|
||||
echo label_tag('check2', 'Check 2').check_box_tag('check2', 'value2', true).tag('br');
|
||||
echo label_tag('check3', 'Check 3').check_box_tag('check3', 'value3').tag('br');
|
||||
|
||||
$options = array('Label 1' => 'value1', 'Label 2' => 'value2', 'Label 3' => 'value3');
|
||||
echo label_tag('select1', 'Select Something:');
|
||||
echo select_tag('select1', $options, 'value2').tag('br');
|
||||
|
||||
echo label_tag('textarea1', 'Type Something:');
|
||||
echo text_area_tag('textarea1', "Hello World!").tag('br');
|
||||
|
||||
echo submit_tag();
|
||||
|
||||
echo form_end_tag();
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function tag_options($options)
|
||||
{
|
||||
$html = "";
|
||||
foreach ($options as $key => $value) {
|
||||
if ($key and $value) {
|
||||
$html .= " ".htmlspecialchars($key)."=\"".
|
||||
htmlspecialchars($value)."\"";
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
function tag($name, $options = array(), $open = false)
|
||||
{
|
||||
return "<$name".tag_options($options).($open ? ">" : " />");
|
||||
}
|
||||
|
||||
function content_tag($name, $content = null, $options = array())
|
||||
{
|
||||
return "<$name".tag_options($options).">".
|
||||
htmlspecialchars($content)."</$name>";
|
||||
}
|
||||
|
||||
function link_to($text, $uri = null, $options = array())
|
||||
{
|
||||
if ($uri == null) $uri = $text;
|
||||
$options = array_merge(array('href' => $uri), $options);
|
||||
return content_tag('a', $text, $options);
|
||||
}
|
||||
|
||||
function link_to_self($text, $query_string, $options = array())
|
||||
{
|
||||
return link_to($text, $_SERVER['PHP_SELF'].'?'.$query_string, $options);
|
||||
}
|
||||
|
||||
function image_tag($src, $options = array())
|
||||
{
|
||||
$options = array_merge(array('src' => $src), $options);
|
||||
return tag('img', $options);
|
||||
}
|
||||
|
||||
function input_tag($type, $name, $value = null, $options = array())
|
||||
{
|
||||
$options = array_merge(
|
||||
array(
|
||||
'type' => $type,
|
||||
'name' => $name,
|
||||
'id' => $name,
|
||||
'value' => $value
|
||||
),
|
||||
$options
|
||||
);
|
||||
return tag('input', $options);
|
||||
}
|
||||
|
||||
function text_field_tag($name, $default = null, $options = array())
|
||||
{
|
||||
$value = isset($_REQUEST[$name]) ? $_REQUEST[$name] : $default;
|
||||
return input_tag('text', $name, $value, $options);
|
||||
}
|
||||
|
||||
function text_area_tag($name, $default = null, $options = array())
|
||||
{
|
||||
$content = isset($_REQUEST[$name]) ? $_REQUEST[$name] : $default;
|
||||
$options = array_merge(
|
||||
array(
|
||||
'name' => $name,
|
||||
'id' => $name,
|
||||
'cols' => 60,
|
||||
'rows' => 5
|
||||
),
|
||||
$options
|
||||
);
|
||||
return content_tag('textarea', $content, $options);
|
||||
}
|
||||
|
||||
function hidden_field_tag($name, $default = null, $options = array())
|
||||
{
|
||||
$value = isset($_REQUEST[$name]) ? $_REQUEST[$name] : $default;
|
||||
return input_tag('hidden', $name, $value, $options);
|
||||
}
|
||||
|
||||
function password_field_tag($name = 'password', $default = null, $options = array())
|
||||
{
|
||||
$value = isset($_REQUEST[$name]) ? $_REQUEST[$name] : $default;
|
||||
return input_tag('password', $name, $value, $options);
|
||||
}
|
||||
|
||||
function radio_button_tag($name, $value, $default = false, $options = array())
|
||||
{
|
||||
if ((isset($_REQUEST[$name]) and $_REQUEST[$name] == $value) or
|
||||
(!isset($_REQUEST[$name]) and $default))
|
||||
{
|
||||
$options = array_merge(array('checked' => 'checked'), $options);
|
||||
}
|
||||
$options = array_merge(array('id' => $name.'_'.$value), $options);
|
||||
return input_tag('radio', $name, $value, $options);
|
||||
}
|
||||
|
||||
function check_box_tag($name, $value = '1', $default = false, $options = array())
|
||||
{
|
||||
if ((isset($_REQUEST[$name]) and $_REQUEST[$name] == $value) or
|
||||
(!isset($_REQUEST['submit']) and $default))
|
||||
{
|
||||
$options = array_merge(array('checked' => 'checked'),$options);
|
||||
}
|
||||
return input_tag('checkbox', $name, $value, $options);
|
||||
}
|
||||
|
||||
function submit_tag($name = '', $value = 'Submit', $options = array())
|
||||
{
|
||||
return input_tag('submit', $name, $value, $options);
|
||||
}
|
||||
|
||||
function reset_tag($name = '', $value = 'Reset', $options = array())
|
||||
{
|
||||
return input_tag('reset', $name, $value, $options);
|
||||
}
|
||||
|
||||
function label_tag($name, $text = null, $options = array())
|
||||
{
|
||||
if ($text == null) {
|
||||
$text = ucwords(str_replace('_', ' ', $name)).': ';
|
||||
}
|
||||
$options = array_merge(
|
||||
array('for' => $name, 'id' => "label_for_$name"),
|
||||
$options
|
||||
);
|
||||
return content_tag('label', $text, $options);
|
||||
}
|
||||
|
||||
function labeled_text_field_tag($name, $default = null, $options = array())
|
||||
{
|
||||
return label_tag($name).text_field_tag($name, $default, $options);
|
||||
}
|
||||
|
||||
function select_tag($name, $options, $default = null, $html_options = array())
|
||||
{
|
||||
$opts = '';
|
||||
foreach ($options as $key => $value) {
|
||||
$arr = array('value' => $value);
|
||||
if ((isset($_REQUEST[$name]) and $_REQUEST[$name] == $value) or
|
||||
(!isset($_REQUEST[$name]) and $default == $value))
|
||||
{
|
||||
$arr = array_merge(array('selected' => 'selected'),$arr);
|
||||
}
|
||||
$opts .= content_tag('option', $key, $arr);
|
||||
}
|
||||
$html_options = array_merge(
|
||||
array('name' => $name, 'id' => $name),
|
||||
$html_options
|
||||
);
|
||||
return "<select".tag_options($html_options).">$opts</select>";
|
||||
}
|
||||
|
||||
function form_tag($uri = null, $options = array())
|
||||
{
|
||||
if ($uri == null) {
|
||||
$uri = $_SERVER['PHP_SELF'];
|
||||
}
|
||||
$options = array_merge(
|
||||
array('method' => 'get', 'action' => $uri),
|
||||
$options
|
||||
);
|
||||
return tag('form', $options, true);
|
||||
}
|
||||
|
||||
function form_end_tag()
|
||||
{
|
||||
return "</form>";
|
||||
}
|
||||
Reference in New Issue
Block a user