{source}
<?php
header(„Content-type: text/html; charset=UTF-8“);
class SyXML {
private $file = „“;
private $xml = „“;
public function __construct($file) {
$this->file = $file;
}
public function readXML() {
$contents = $this->readRessource();
try {
$this->xml = new SimpleXMLElement($contents);
} catch(Exception $e) {
return false;
}
return true;
}
private function readRessource() {
$contents = „“;
$handle = fopen($this->file, „rb“);
$contents = stream_get_contents($handle);
fclose($handle);
return $contents;
}
public function fetchNodes($node) {
$xml = $this->xml;
$itemsArr = array();
foreach($xml->$node AS $items) {
$itemsArr[] =$items;
}
return $itemsArr;
}
public function fetchSingleNode($node) {
$xml = $this->xml;
return $xml->$node;
}
}
class SyList {
private $perPage = 10;
private $actCount = 0;
private $rowCount = 0;
private $url = „“;
public function __construct($url, $perPage) {
$this->url = $this->url = „http://www.ff-pechgraben.at/index.php?option=com_content&view=article&id=77&Itemid=476“;
$this->perPage = $perPage;
}
private function getPages() {
$pages = ceil($this->rowCount / $this->perPage);
return ($pages == 0) ? 1 : $pages;
}
public function getPrev() {
$pages = $this->getPages();
$prev = $this->actCount-$this->perPage;
if(($prev / $pages) < 0)
return „Zurück“;
else
return ‚<a href=“‚.$this->url.’&x=‘.$prev.'“>Zurück</a>‘;
}
public function getNext() {
$pages = $this->getPages();
$next = $this->actCount+$this->perPage;
if(($next/$pages) >= $this->perPage)
return „Weiter“;
else
return ‚<a href=“‚.$this->url.’&x=‘.$next.'“>Weiter</a>‘;
}
public function getLimitStatement() {
return „LIMIT „.$this->actCount.“, „.$this->perPage;
}
public function getFrom() {
return $this->actCount;
}
public function getPerPage() {
return $this->perPage;
}
public function setActCount($count) {
$pages = $this->getPages();
$max = ($count/$pages);
if(empty($count) || $count <= 0 || $max >= $this->perPage || ($count % $this->perPage))
$this->actCount = 0;
else
$this->actCount = $count;
}
public function setRowCount($count) {
$this->rowCount = $count;
}
public function getRowCount() {
return $this->rowCount;
}
public function getCounter() {
$html = „“;
if (($this->getFrom() + $this->getPerPage()) > $this->getRowCount())
$p = $this->getRowCount();
else
$p = ($this->getFrom() + $this->getPerPage());
$html .= „(„.($this->getFrom() + 1).“ – „.$p.“ von „.$this->getRowCount().“) „;
return $html;
}
public function getHtmlNavigation() {
return ‚
<table class=“listNavigation“ cellspacing=“0″ cellpadding=“0″>
<tr><td class=“listCounter“>‘.$this->getCounter().’ </td><td class=“listAction“>‘.$this->getPrev().‘ | ‚.$this->getNext().'</td></tr>
</table>
‚;
}
public function getHtmlFooter() {
return „</table><small>Quelle: <a href=’http://www.sybos.net‘>syBOS</a></small>“;
}
}
$xmlFile = „http://ws-sybos.ooelfv.at/sybServices/xmlEinsatz.php?token=b1f6ba17ba2441004b9e4b69edf85ad7&a=20“;
$perPage = 3;
$xml = new SyXML($xmlFile);
if($xml->readXML() == false) {
echo „Schnittstelle momentan nicht verfügbar!“;
} else {
$count = $xml->fetchSingleNode(„number“);
$list = new SyList(„?page=meineCMSEinsatzSeite“,$perPage);
$list->setRowCount($count);
$list->setActCount(@$_GET[‚x‘]);
echo $list->getHtmlNavigation();
$xmlFile = $xmlFile.“&f=“.$list->getFrom().“&a=“.$list->getPerPage();
$xml = new SyXML($xmlFile);
$xml->readXML();
$items = $xml->fetchNodes(„item“);
foreach ($items as $key=>$value)
{
foreach ($value->images->item as $item=>$image)
{
echo „<div class=’blogintrotext‘><tr><h2><a href=’http://www.ff-pechgraben.at/index.php?option=com_content&view=article&id=80&Itemid=476&id1=$value->id‘ >$value->veroeffentltitel</a></h2></tr>“;
echo „<tr><dl class=’article-info‘><dd class=’category-name‘>$value->abteilung</dd>am <dd class=’category-name‘>$value->bis</dd><dd class=’category-name‘>Geschrieben von Sybos</dd></dl>“;
echo „<a href=’http://www.ff-pechgraben.at/index.php?option=com_content&view=article&id=80&Itemid=476&id1=$value->id‘ ><img src=’$image->thumb‘ width=100 style=’margin:0px 10px 10px 0px‘ align=left /></a>“;
break;
}
$xml1 = new SyXML($xmlFile.“&thumbHeigth=100&id=“.$value->id);
if($xml1->readXML() == false)
{
echo „Schnittstelle momentan nicht verfügbar!“;
}
else
{
$item = $xml1->fetchNodes(„item“);
}
echo „<div style=’margin-left:120px‘>Am $value->bis
um $value->vont $value->bist
war die $value->abteilung
beim <br>$value->veroeffentltitel
in $value->einsatzort tätig. <br><p class=’readmore‘><a href=’http://www.ff-pechgraben.at/index.php?option=com_content&view=article&id=80&Itemid=476&id1=$value->id‘ > Weiterlesen: $value->veroeffentltitel</a></p></div></div>“;
}
}
?>
{/source}