removed some unused stuff
@@ -1,143 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Create the DOMDocument for the XML output
|
||||
$xmlDoc = new DOMDocument("1.0");
|
||||
|
||||
if($data['format'] == "xml") {
|
||||
// Add reference to the XSLT
|
||||
$xsl = $xmlDoc->createProcessingInstruction("xml-stylesheet", "type=\"text/xsl\" href=\"".base_url()."assets/api.xsl\"");
|
||||
$xmlDoc->appendChild($xsl);
|
||||
}
|
||||
|
||||
// Get the method called, and build the root node
|
||||
$call = $data['queryInfo']['call'];
|
||||
$rootNode = $xmlDoc->createElement("Wavelog-API");
|
||||
$parentNode = $xmlDoc->appendChild($rootNode);
|
||||
|
||||
// Get the results output
|
||||
$output = $data[$call."_Result"];
|
||||
|
||||
// Add the queryInfo node
|
||||
$node = $xmlDoc->createElement("queryInfo");
|
||||
$queryElement = $parentNode->appendChild($node);
|
||||
$queryElement->setAttribute("timeStamp", date("r", time()));
|
||||
$queryElement->setAttribute("calledMethod", $data['queryInfo']['call']);
|
||||
//$queryElement->setAttribute("queryArgs", $queryArgsString);
|
||||
$queryElement->setAttribute("resultsCount", count($data['queryInfo']['numResults']));
|
||||
if(ENVIRONMENT == "development") {
|
||||
$debugInfo = $xmlDoc->createElement("debugInfo");
|
||||
$debugElement = $queryElement->appendChild($debugInfo);
|
||||
$debugElement->setAttribute("dbQuery", $data['queryInfo']['dbQuery']);
|
||||
$debugElement->setAttribute("clientVersion", $_SERVER['HTTP_USER_AGENT']);
|
||||
$debugElement->setAttribute("requestURI", $_SERVER['REQUEST_URI']);
|
||||
# $debugElement->setAttribute("benchMark", $this->benchmark->marker['total_execution_time_start'].", ".$this->benchmark->marker['loading_time:_base_classes_start'].", ".$this->benchmark->marker['loading_time:_base_classes_end'].", ".$this->benchmark->marker['controller_execution_time_( api / add )_start']);
|
||||
}
|
||||
$queryElement->setAttribute("executionTime", $data['queryInfo']['executionTime']);
|
||||
$queryElement->setAttribute("logbookURL", $this->config->item('base_url'));
|
||||
|
||||
// Add the main results node
|
||||
$node = $xmlDoc->createElement("results");
|
||||
$elementsNode = $parentNode->appendChild($node);
|
||||
|
||||
// Cycle through the results and add to the results node
|
||||
if($output['results'])
|
||||
{
|
||||
foreach($output['results'] as $e) {
|
||||
$node = $xmlDoc->createElement("result");
|
||||
$element = $elementsNode->appendChild($node);
|
||||
|
||||
foreach($e as $attr) {
|
||||
#while($attr = current($e)) {
|
||||
if(is_array($attr))
|
||||
{
|
||||
foreach($attr as $subattr)
|
||||
{
|
||||
$node = $xmlDoc->createElement(key($e));
|
||||
foreach($subattr as $subsubattr)
|
||||
{
|
||||
$node->setAttribute(key($subattr), $subsubattr);
|
||||
next($subattr);
|
||||
}
|
||||
$element->appendChild($node);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$element->setAttribute(key($e), $attr);
|
||||
}
|
||||
next($e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($data['error']))
|
||||
{
|
||||
$node = $xmlDoc->createElement("error");
|
||||
$errorNode = $parentNode->appendChild($node);
|
||||
|
||||
$errorNode->setAttribute("id", $data['error']);
|
||||
}
|
||||
|
||||
// Output
|
||||
|
||||
// Check whether we want XML or JSON output
|
||||
if(($data['format'] == "xml") || ($data['format'] == "xmlp") || ($data['format'] == "xmlt")) {
|
||||
if(($data['format'] == "xml") || ($data['format'] == "xmlp")) {
|
||||
// Set the content-type for browsers
|
||||
header("Content-type: text/xml");
|
||||
}
|
||||
echo formatXmlString($xmlDoc->saveXML());
|
||||
} else if($data['format'] == "json") {
|
||||
// Set the content-type for browsers
|
||||
header("Content-type: application/json");
|
||||
// For now, our JSON output is simply the XML re-parsed with SimpleXML and
|
||||
// then re-encoded with json_encode
|
||||
$x = simplexml_load_string($xmlDoc->saveXML());
|
||||
$j = json_encode($x);
|
||||
echo $j;
|
||||
} else {
|
||||
echo "Error: Unknown format type '".$data['format']."'.";
|
||||
}
|
||||
|
||||
// This function tidies up the outputted XML
|
||||
function formatXmlString($xml) {
|
||||
|
||||
// add marker linefeeds to aid the pretty-tokeniser (adds a linefeed between all tag-end boundaries)
|
||||
$xml = preg_replace('/(>)(<)(\/*)/', "$1\n$2$3", $xml);
|
||||
|
||||
// now indent the tags
|
||||
$token = strtok($xml, "\n");
|
||||
$result = ''; // holds formatted version as it is built
|
||||
$pad = 0; // initial indent
|
||||
$matches = array(); // returns from preg_matches()
|
||||
|
||||
// scan each line and adjust indent based on opening/closing tags
|
||||
while ($token !== false) :
|
||||
|
||||
// test for the various tag states
|
||||
|
||||
// 1. open and closing tags on same line - no change
|
||||
if (preg_match('/.+<\/\w[^>]*>$/', $token, $matches)) :
|
||||
$indent=0;
|
||||
// 2. closing tag - outdent now
|
||||
elseif (preg_match('/^<\/\w/', $token, $matches)) :
|
||||
$pad--;
|
||||
// 3. opening tag - don't pad this one, only subsequent tags
|
||||
elseif (preg_match('/^<\w[^>]*[^\/]>.*$/', $token, $matches)) :
|
||||
$indent=1;
|
||||
// 4. no indentation needed
|
||||
else :
|
||||
$indent = 0;
|
||||
endif;
|
||||
|
||||
// pad the line with the required number of leading spaces
|
||||
$line = str_pad($token, strlen($token)+$pad, ' ', STR_PAD_LEFT);
|
||||
$result .= $line . "\n"; // add to the cumulative result, with linefeed
|
||||
$token = strtok("\n"); // get the next token
|
||||
$pad += $indent; // update the pad size for subsequent lines
|
||||
endwhile;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,100 +0,0 @@
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<tr class="titles">
|
||||
<td><?= __("Date"); ?></td>
|
||||
<td><?= __("Time"); ?></td>
|
||||
<td><?= __("Call"); ?></td>
|
||||
<td><?= __("Mode"); ?></td>
|
||||
<td><?= __("Sent"); ?></td>
|
||||
<td><?= __("Rcvd"); ?></td>
|
||||
<td><?= __("Band"); ?></td>
|
||||
<td><?= __("Country"); ?></td>
|
||||
<?php if(($this->config->item('use_auth')) && ($this->session->userdata('user_type') >= 2)) { ?>
|
||||
<td><?= __("QSL"); ?></td>
|
||||
|
||||
<?php if($this->session->userdata('user_eqsl_name') != "") { ?>
|
||||
<td><?= __("eQSL"); ?></td>
|
||||
<?php } else { ?>
|
||||
<td></td>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($this->session->userdata('user_lotw_name') != "") { ?>
|
||||
<td><?= __("LoTW"); ?></td>
|
||||
<?php } else { ?>
|
||||
<td></td>
|
||||
<?php } ?>
|
||||
|
||||
<td></td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
|
||||
<?php $i = 0; foreach ($results->result() as $row) { ?>
|
||||
<?php echo '<tr class="tr'.($i & 1).'">'; ?>
|
||||
<td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date('d/m/y', $timestamp); ?></td>
|
||||
<td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date('H:i', $timestamp); ?></td>
|
||||
<td><a id="edit_qso" href="javascript:displayQso(<?php echo $row->COL_PRIMARY_KEY; ?>)"><?php echo str_replace("0","Ø",strtoupper($row->COL_CALL)); ?></a></td>
|
||||
<td><?php echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE; ?></td>
|
||||
<td><?php echo $row->COL_RST_SENT; ?> <?php if ($row->COL_STX_STRING) { ?><span class="label"><?php echo $row->COL_STX_STRING;?></span><?php } ?></td>
|
||||
<td><?php echo $row->COL_RST_RCVD; ?> <?php if ($row->COL_SRX_STRING) { ?><span class="label"><?php echo $row->COL_SRX_STRING;?></span><?php } ?></td>
|
||||
<?php if($row->COL_SAT_NAME != null) { ?>
|
||||
<td><?php echo $row->COL_SAT_NAME; ?></td>
|
||||
<?php } else { ?>
|
||||
<td><?php echo $row->COL_BAND; ?></td>
|
||||
<?php } ?>
|
||||
<td><?php echo ucwords(strtolower(($row->COL_COUNTRY))); ?></td>
|
||||
<?php if(($this->config->item('use_auth')) && ($this->session->userdata('user_type') >= 2)) { ?>
|
||||
<td>
|
||||
<span class="qsl-<?php echo ($row->COL_QSL_SENT=='Y')?'green':'red'?>">▲</span>
|
||||
<span class="qsl-<?php echo ($row->COL_QSL_RCVD=='Y')?'green':'red'?>">▼</span>
|
||||
</td>
|
||||
|
||||
<?php if ($this->session->userdata('user_eqsl_name')){ ?>
|
||||
<td class="eqsl">
|
||||
<span class="eqsl-<?php echo ($row->COL_EQSL_QSL_SENT=='Y')?'green':'red'?>">▲</span>
|
||||
<span class="eqsl-<?php echo ($row->COL_EQSL_QSL_RCVD=='Y')?'green':'red'?>">▼</span>
|
||||
</td>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($this->session->userdata('user_lotw_name') != "") { ?>
|
||||
<td class="lotw">
|
||||
<span class="lotw-<?php echo ($row->COL_LOTW_QSL_SENT=='Y')?'green':'red'?>">▲</span>
|
||||
<span class="lotw-<?php echo ($row->COL_LOTW_QSL_RCVD=='Y')?'green':'red'?>">▼</span>
|
||||
</td>
|
||||
<?php } ?>
|
||||
|
||||
<td><a class="editbox" href="<?php echo site_url('qso/edit'); ?>/<?php echo $row->COL_PRIMARY_KEY; ?>" ><img src="<?php echo base_url(); ?>/images/application_edit.png" width="16" height="16" alt="Edit" />
|
||||
</a></td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php $i++; } ?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<style>
|
||||
TD.qsl{
|
||||
width: 20px;
|
||||
}
|
||||
TD.eqsl{
|
||||
width: 33px;
|
||||
}
|
||||
.eqsl-green{
|
||||
color: #00A000;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
.eqsl-red{
|
||||
color: #F00;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
TD.lotw{
|
||||
width: 33px;
|
||||
}
|
||||
.lotw-green{
|
||||
color: #00A000;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
.lotw-red{
|
||||
color: #F00;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
</style>
|
||||
119
assets/api.xsl
@@ -1,119 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:template match="/">
|
||||
<html>
|
||||
<head>
|
||||
<title><xsl:value-of select="//queryInfo/@calledMethod"/></title>
|
||||
<style>
|
||||
body {
|
||||
background: #eee;
|
||||
font-family: Verdana, sans-serif;
|
||||
font-size: 8px;
|
||||
}
|
||||
#results table {
|
||||
border: 0px solid #000;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
#results th {
|
||||
padding: 4px;
|
||||
border: 1px solid #000;
|
||||
background-color: #6AA57B;
|
||||
font-size: 11px;
|
||||
}
|
||||
#results td {
|
||||
padding: 4px;
|
||||
border: 1px solid #000;
|
||||
font-size: 11px;
|
||||
}
|
||||
#results tr.row0 {
|
||||
background-color: #A3BDF5;
|
||||
}
|
||||
#results tr.row1 {
|
||||
background-color: #9ADF9A;
|
||||
}
|
||||
img {
|
||||
border: 0px;
|
||||
}
|
||||
#footer {
|
||||
font-size: 8px;
|
||||
}
|
||||
#debug {
|
||||
border: 1px dotted #fff;
|
||||
background-color: #c00;
|
||||
color: #fff;
|
||||
font-size: 8px;
|
||||
}
|
||||
#debug td {
|
||||
padding: 4px;
|
||||
color: #fff;
|
||||
font-size: 10px;
|
||||
}
|
||||
.blank {
|
||||
background-color: transparent;
|
||||
}
|
||||
.sub {
|
||||
background-color: #cfc;
|
||||
}
|
||||
.subattr {
|
||||
background-color: #cfc;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Output of '<xsl:value-of select="//queryInfo/@calledMethod"/>'</h1>
|
||||
<table id="results">
|
||||
<tr>
|
||||
<xsl:for-each select="//results/result[1]/@*">
|
||||
<th><b><xsl:value-of select="name()"/></b></th>
|
||||
</xsl:for-each>
|
||||
</tr>
|
||||
<xsl:for-each select="//results/result">
|
||||
<tr class="row{position() mod 2}">
|
||||
<xsl:for-each select="@*">
|
||||
<td><xsl:value-of select="."/></td>
|
||||
</xsl:for-each>
|
||||
</tr>
|
||||
<xsl:for-each select="*">
|
||||
<tr>
|
||||
<td class="blank"></td>
|
||||
<td class="sub"><xsl:value-of select="name()"/></td>
|
||||
<td class="blank" colspan="20">
|
||||
<table>
|
||||
<tr>
|
||||
<xsl:for-each select="@*">
|
||||
<td class="subattr">
|
||||
<xsl:value-of select="name()"/> = <xsl:value-of select="."/>
|
||||
</td>
|
||||
</xsl:for-each>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
<p/>
|
||||
<xsl:if test="//debugInfo">
|
||||
<div id="debug">
|
||||
<table>
|
||||
<tr>
|
||||
<td><b>requestURI</b></td><td><xsl:value-of select="//debugInfo/@requestURI" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>dbQuery</b></td><td><xsl:value-of select="//debugInfo/@dbQuery" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>clientVersion</b></td><td><xsl:value-of select="//debugInfo/@clientVersion" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<p/>
|
||||
</xsl:if>
|
||||
<div id="footer">
|
||||
Retrieved from the <xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="//queryInfo/logbookURL"/>/index.php/api</xsl:attribute>HRD Web Frontend</xsl:element> API at <b><xsl:value-of select="//queryInfo/@timeStamp"/></b>. Query took <b><xsl:value-of select="//queryInfo/@executionTime"/></b> seconds.<br/>This is formatted XML using XSLT.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
|
Before Width: | Height: | Size: 100 KiB |
|
Before Width: | Height: | Size: 89 KiB |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 703 B |
BIN
images/body.png
|
Before Width: | Height: | Size: 278 B |
|
Before Width: | Height: | Size: 715 B |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 321 B |
|
Before Width: | Height: | Size: 416 B |
|
Before Width: | Height: | Size: 391 B |
|
Before Width: | Height: | Size: 389 B |
|
Before Width: | Height: | Size: 527 B |
|
Before Width: | Height: | Size: 258 B |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
@@ -1,27 +0,0 @@
|
||||
body {
|
||||
background:#EEE url(body.png) repeat-x;
|
||||
font: 13px "Trebuchet MS", Arial, Verdana;
|
||||
padding:20px;
|
||||
}
|
||||
a {
|
||||
text-decoration:none;
|
||||
color:#3C769D;
|
||||
}
|
||||
h1 a,
|
||||
p em a {
|
||||
display:block;
|
||||
overflow:hidden;
|
||||
text-indent:-9999px;
|
||||
}
|
||||
h1 a {
|
||||
width:700px;
|
||||
height:200px;
|
||||
background:transparent url(markitup.png) no-repeat center center;
|
||||
}
|
||||
p em a {
|
||||
background:transparent url(jaysalvat.png) no-repeat 10% 50%;
|
||||
width:120px; height:28px;
|
||||
left:30px;
|
||||
position:absolute;
|
||||
top:0px;
|
||||
}
|
||||