?>
<br />
  <?php 
echo label_tag('uri', 'or Uri: ') . text_field_tag('uri', 'http://www.dajobe.org/foaf.rdf', array('size' => 80));
?>
<br />
  <?php 
echo label_tag('input_format', 'Input Format: ') . select_tag('input_format', $input_format_options, 'guess');
?>
<br />
  <?php 
echo label_tag('output_format', 'Output Format: ') . select_tag('output_format', $output_format_options, 'turtle');
?>
<br />
  <?php 
echo reset_tag();
?>
 <?php 
echo submit_tag();
?>
  <?php 
echo form_end_tag();
?>
</div>

<?php 
if (isset($_REQUEST['uri']) or isset($_REQUEST['data'])) {
    $graph = new EasyRdf_Graph($_REQUEST['uri']);
    if (empty($_REQUEST['data'])) {
        $graph->load();
    } else {
$t->diag('input_date_tag()');
$t->todo('input_date_tag()');
// submit_tag()
$t->diag('submit_tag()');
$t->is(submit_tag(), '<input type="submit" name="commit" value="Save changes" />', 'submit_tag() default value is "Save changes"');
$t->is(submit_tag("save"), '<input type="submit" name="commit" value="save" />', 'submit_tag() takes a value as its first argument');
// options
$t->is(submit_tag('save', array('class' => 'foo')), '<input type="submit" name="commit" value="save" class="foo" />', 'submit_tag() takes an array of attribute options as its second argument');
$t->is(submit_tag('save', array('name' => 'foo')), '<input type="submit" name="foo" value="save" />', 'submit_tag() can override the "name" attribute');
// reset_tag()
$t->diag('reset_tag()');
$t->is(reset_tag(), '<input type="reset" name="reset" value="Reset" />', 'reset_tag() default value is "Reset"');
$t->is(reset_tag("save"), '<input type="reset" name="reset" value="save" />', 'reset_tag() takes a value as its first argument');
// options
$t->is(reset_tag('save', array('class' => 'foo')), '<input type="reset" name="reset" value="save" class="foo" />', 'reset_tag() takes an array of attribute options as its second argument');
$t->is(reset_tag('save', array('name' => 'foo')), '<input type="reset" name="foo" value="save" />', 'reset_tag() can override the "name" attribute');
// submit_image_tag()
$t->diag('submit_image_tag()');
$t->is(submit_image_tag('submit'), '<input type="image" name="commit" src="/images/submit.png" alt="Submit" />', 'submit_image_tag() takes an image source as its first argument');
$t->is(submit_image_tag('/img/submit.gif'), '<input type="image" name="commit" src="/img/submit.gif" alt="Submit" />', 'submit_image_tag() takes an image source as its first argument');
// options
$t->is(submit_image_tag('submit', array('class' => 'foo')), '<input type="image" name="commit" src="/images/submit.png" class="foo" alt="Submit" />', 'submit_image_tag() takes an array of attribute options as its second argument');
$t->is(submit_image_tag('submit', array('alt' => 'foo')), '<input type="image" name="commit" src="/images/submit.png" alt="foo" />', 'reset_tag() can override the "alt" attribute');
$t->is(submit_image_tag('submit', array('name' => 'foo')), '<input type="image" name="foo" src="/images/submit.png" alt="Submit" />', 'reset_tag() can override the "name" attribute');
// label_for()
$t->diag('label_for()');
$t->todo('label_for()');
// get_id_from_name()
$t->diag('get_id_from_name()');
$t->is(get_id_from_name('foo'), 'foo', 'get_id_from_name() returns the id if there is no [] in the id');
$t->is(get_id_from_name('foo[]', 'name'), 'foo_name', 'get_id_from_name() removes all [] from ids');
    $_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' => 80, '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);
Exemplo n.º 4
0
                            <?php 
} else {
    ?>
                                            <td class="page_action" colspan="2" style="vertical-align: middle;">
                            <?php 
}
$i = 0;
foreach ($actions as $action) {
    ++$i;
    if ($action['name'] == 'delete') {
        echo link_to_remote(__($action['name']), array('url' => $action['url'], 'update' => 'content', 'post' => 'true', 'confirm' => 'Are you sure?', 'script' => 'true', 'before' => "this.blur();showIndicator('content', 'snakebig_black');", 'complete' => "hideIndicator()"), array('class' => $action['color']));
    } else {
        if (array_key_exists('type', $action) && $action['type'] == 'submit') {
            echo submit_tag(__($action['name']), $action['options']);
        } elseif (array_key_exists('type', $action) && $action['type'] == 'reset') {
            echo reset_tag(__($action['name']), $action['options']);
        } elseif (array_key_exists('type', $action) && $action['type'] == 'direct') {
            if ($action['name'] == '_AS_CSV_') {
                echo link_to(image_tag('csv_file.png', 'title=Print CSV'), '#', array('onclick' => "window.open(\n\t\t\t\t\t\t\t\t\t\t'" . $action['url'] . "',\n\t\t\t\t\t\t\t\t\t\t'link',\n\t\t\t\t\t\t\t\t\t\t'height=480,width=640,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no'\n\t\t\t\t\t\t\t\t\t\t)", 'class' => $action['color']));
            } elseif ($action['name'] == '_AS_PDF_') {
                echo link_to(image_tag('pdf_file.png', 'title=Print PDF'), '#', array('onclick' => "window.open(\n\t\t\t\t\t\t\t\t\t\t'" . $action['url'] . "',\n\t\t\t\t\t\t\t\t\t\t'link',\n\t\t\t\t\t\t\t\t\t\t'height=480,width=640,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no'\n\t\t\t\t\t\t\t\t\t\t)", 'class' => $action['color']));
            } else {
                echo link_to(__($action['name']), '#', array('onclick' => "window.open(\n\t\t\t\t\t\t\t\t\t\t'" . $action['url'] . "',\n\t\t\t\t\t\t\t\t\t\t'link',\n\t\t\t\t\t\t\t\t\t\t'height=480,width=640,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no'\n\t\t\t\t\t\t\t\t\t\t)", 'class' => $action['color']));
            }
        } elseif (array_key_exists('type', $action) && $action['type'] == 'pdf') {
            echo link_to(image_tag('pdf_file.png', 'title=Print PDF'), '#', array('onclick' => "window.open(\n\t\t\t\t\t\t\t\t\t\t'" . $action['url'] . "',\n\t\t\t\t\t\t\t\t\t\t'link',\n\t\t\t\t\t\t\t\t\t\t'height=480,width=640,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no'\n\t\t\t\t\t\t\t\t\t\t)", 'class' => $action['color']));
        } elseif (array_key_exists('type', $action) && $action['type'] == 'csv') {
            echo link_to(image_tag('csv_file.png', 'title=Print CSV'), '#', array('onclick' => "window.open(\n\t\t\t\t\t\t\t\t\t\t'" . $action['url'] . "',\n\t\t\t\t\t\t\t\t\t\t'link',\n\t\t\t\t\t\t\t\t\t\t'height=480,width=640,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no'\n\t\t\t\t\t\t\t\t\t\t)", 'class' => $action['color']));
        } else {
            if ($action['name'] == 'filter') {
                #echo link_to_function(image_tag('filter.png', 'title=Filter'), visual_effect('toggle_appear', 'filter', array('onclick'=>'this.blur()', 'duration'=>'0.3')), 'class='.$action['color']);